From 3e15dfb2a476e8747ed6c73413400308c5617ba5 Mon Sep 17 00:00:00 2001 From: Samer Afach Date: Fri, 13 Jan 2017 08:43:58 +0100 Subject: [PATCH] Added get_resources.sh that gets Polymath and OpenBLAS --- get_resources.sh | 45 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 get_resources.sh diff --git a/get_resources.sh b/get_resources.sh new file mode 100644 index 0000000..45bf9d3 --- /dev/null +++ b/get_resources.sh @@ -0,0 +1,45 @@ +#!/bin/bash + +start_dir=$(pwd) +rm -rf 3rdparty + +mkdir -p 3rdparty/Polymath +git clone https://git.afach.de/samerafach/Polymath 3rdparty/Polymath +if [ $? -ne 0 ]; then + echo 'Polymath repository cloning failed.' + exit 1 +fi + +read -p "Would you like to get OpenBLAS, compile it, or should I expect it to be already in your system? [y/n]: " -n 1 -r +echo "Notice that a compiled version of OpenBLAS is faster because it will be accustomed for your CPU." +if [[ $REPLY =~ ^[Nn]$ ]] +then +echo "Skipped getting OpenBLAS..." + exit 0 +fi + +mkdir -p 3rdparty/OpenBLAS +git clone https://github.com/xianyi/OpenBLAS.git 3rdparty/OpenBLAS +if [ $? -ne 0 ]; then + echo 'Cloning OpenBLAS failed.' + exit 1 +fi + +cd 3rdparty/OpenBLAS +make -j $(nproc) +if [ $? -ne 0 ]; then + echo 'Building OpenBLAS failed.' + exit 1 +fi + +#replace ln -fs with cp, to avoid linking problems with ntfs file systems +#sed -i 's/ln -fs/cp/g' Makefile +#sed -i 's/ln -fs/cp/g' Makefile.install + +make PREFIX=${start_dir}/spintrum/OpenBLAS_install install +if [ $? -ne 0 ]; then + echo 'OpenBLAS installation failed.' + exit 1 +fi + +cd ${start_dir}