diff options
author | Soumith Chintala <soumith@gmail.com> | 2017-05-19 17:40:41 +0300 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-05-19 17:40:41 +0300 |
commit | edbc0cb7b8a6db5788428fb3f67acaa8ffb5372c (patch) | |
tree | 041c6ce307b8588c35791c3bcf45fc5839011261 | |
parent | 9e2f875d0ee3d82e16d87b5abc0d64c92b50fd10 (diff) | |
parent | 60d554a083602728e32ce9b1b3525f4a7b0f7d0c (diff) |
Merge pull request #224 from perweij/add-debian-sid-support
Add debian sid support
-rwxr-xr-x | install-deps | 57 | ||||
-rwxr-xr-x | install.sh | 2 |
2 files changed, 38 insertions, 21 deletions
diff --git a/install-deps b/install-deps index d057f67..55a94fb 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 } @@ -349,7 +366,7 @@ elif [[ "$(uname)" == 'Linux' ]]; then install_openblas || true elif [[ $distribution == 'debian' ]]; then - if [[ $debian_major_version == '8' ]]; then + if [[ $debian_major_version == '8' ]] || [[ $debian_major_version == '9' ]]; then echo "==> Found Debian version ${debian_major_version}" if sudo apt-get update ; then echo "Updated successfully." @@ -367,7 +384,7 @@ elif [[ "$(uname)" == 'Linux' ]]; then install_openblas || true else - echo "Only Jessie Debian 8 is supported for now, aborting." + echo "Only Jessie Debian 8 and 9 is supported for now, aborting." exit 1 fi fi @@ -43,7 +43,7 @@ fi echo "Prefix set to $PREFIX" if [[ `uname` == 'Linux' ]]; then - export CMAKE_LIBRARY_PATH=/opt/OpenBLAS/include:/opt/OpenBLAS/lib:$CMAKE_LIBRARY_PATH + export CMAKE_LIBRARY_PATH=$PREFIX/include:/opt/OpenBLAS/include:$PREFIX/lib:/opt/OpenBLAS/lib:$CMAKE_LIBRARY_PATH fi export CMAKE_PREFIX_PATH=$PREFIX |