Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/torch/distro.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'install-deps')
-rwxr-xr-xinstall-deps53
1 files changed, 35 insertions, 18 deletions
diff --git a/install-deps b/install-deps
index d057f67..38982ac 100755
--- a/install-deps
+++ b/install-deps
@@ -8,25 +8,42 @@ set -e
install_openblas() {
# Get and build OpenBlas (Torch is much better with a decent Blas)
- cd /tmp/
- rm -rf OpenBLAS
- git clone https://github.com/xianyi/OpenBLAS.git
- cd OpenBLAS
- if [ $(getconf _NPROCESSORS_CONF) == 1 ]; then
- make NO_AFFINITY=1 USE_OPENMP=0 USE_THREAD=0
+ # Optionally set environment variable PREFIX to control
+ # the installation directory.
+
+
+ local PATH=$PATH:/sbin ## improve chances of finding ldconfig
+ # Only proceed installing OpenBLAS if either ldconfig is unavailable, or ldconfig
+ # reports that OpenBLAS is not already installed.
+ if ! type ldconfig >/dev/null || ! ldconfig -p | grep -q "lib\(open\)\?blas.so"; then
+ local tempdir=$(mktemp -d)
+
+ git clone https://github.com/xianyi/OpenBLAS.git "$tempdir"/OpenBLAS || { echo "Error. Cannot clone OpenBLAS." >&2 ; exit 1 ; }
+ cd "$tempdir"/OpenBLAS || { echo "Error. Cannot create tempdir." >&2 ; exit 1 ; }
+ if [ $(getconf _NPROCESSORS_CONF) == 1 ]; then
+ make NO_AFFINITY=1 USE_OPENMP=0 USE_THREAD=0
+ else
+ make NO_AFFINITY=1 USE_OPENMP=1
+ fi
+ RET=$?;
+ if [ $RET -ne 0 ]; then
+ echo "Error. OpenBLAS could not be compiled";
+ exit $RET;
+ fi
+ if [ ! -z "$PREFIX" ]; then
+ sudo make install PREFIX="$PREFIX"
+ else
+ sudo make install
+ fi
+ RET=$?;
+ if [ $RET -ne 0 ]; then
+ echo "Error. OpenBLAS could not be installed";
+ exit $RET;
+ fi
+ cd -
+ rm -rf "$tempdir"
else
- make NO_AFFINITY=1 USE_OPENMP=1
- fi
- RET=$?;
- if [ $RET -ne 0 ]; then
- echo "Error. OpenBLAS could not be compiled";
- exit $RET;
- fi
- sudo make install
- RET=$?;
- if [ $RET -ne 0 ]; then
- echo "Error. OpenBLAS could not be installed";
- exit $RET;
+ echo "Skipping install of OpenBLAS - it is already installed." >&2
fi
}