distribution independent script to some extent
This commit is contained in:
parent
9896bac743
commit
af79ac10ef
@ -8,9 +8,9 @@ before_install:
|
||||
- sudo apt-get install -yqq libopenblas-dev liblapack3 python3-numpy python3-dev swig
|
||||
- sudo ln -s /usr/lib/libopenblas.so /usr/lib/libopenblas.so.3
|
||||
install:
|
||||
- pip install http://download.pytorch.org/whl/cu80/torch-0.2.0.post3-cp36-cp36m-manylinux1_x86_64.whl
|
||||
- pip install numpy
|
||||
- pip install visdom
|
||||
- pip install -qqq http://download.pytorch.org/whl/cu80/torch-0.2.0.post3-cp36-cp36m-manylinux1_x86_64.whl
|
||||
- pip install -qqq numpy
|
||||
- pip install -qqq visdom
|
||||
# command to run tests
|
||||
script:
|
||||
- pytest ./test
|
@ -1,13 +1,57 @@
|
||||
#!/usr/bin/env bash
|
||||
|
||||
alias sudo=clear
|
||||
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_ONLN) == 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
|
||||
sudo make install
|
||||
RET=$?;
|
||||
if [ $RET -ne 0 ]; then
|
||||
echo "Error. OpenBLAS could not be installed";
|
||||
exit $RET;
|
||||
fi
|
||||
}
|
||||
|
||||
|
||||
# pre-requisites
|
||||
if [[ -r /usr/bin/pacman ]]; then
|
||||
pacman -S --noconfirm git wget
|
||||
|
||||
elif [[ -r /usr/bin/apt-get ]]; then
|
||||
apt-get install -y git wget python3-examples
|
||||
|
||||
elif [[ -r /usr/bin/yum ]]; then
|
||||
# cause install-deps supports only fedora v21 and v22
|
||||
yum install -y wget cmake curl readline-devel ncurses-devel \
|
||||
gcc-c++ gcc-gfortran git gnuplot unzip \
|
||||
nodejs npm libjpeg-turbo-devel libpng-devel \
|
||||
ImageMagick GraphicsMagick-devel fftw-devel \
|
||||
sox-devel sox qt-devel qtwebkit-devel \
|
||||
python-ipython czmq czmq-devel python3-tools
|
||||
|
||||
install_openblas
|
||||
|
||||
else
|
||||
echo "Does not support your distribution, top kek"
|
||||
exit 1
|
||||
fi
|
||||
|
||||
wget https://raw.githubusercontent.com/torch/ezinstall/master/install-deps -O ./install-deps
|
||||
chmod +x ./install-deps
|
||||
./install-deps
|
||||
|
||||
apt-get install swig
|
||||
|
||||
pip3 install --upgrade pip
|
||||
|
||||
# clone repo
|
||||
@ -20,14 +64,55 @@ git checkout e652a6648f52d20d95426d1814737e0e8601f348
|
||||
cp ./example_makefiles/makefile.inc.Linux ./makefile.inc
|
||||
|
||||
# change stuff in example makefile, for ubuntu 16.04
|
||||
# openblas dir
|
||||
sed -i "s/lib64\/libopenblas\.so\.0/lib\/libopenblas\.so/g" ./makefile.inc
|
||||
# nvcc compiler options
|
||||
sed -i "s/std c++11 \-lineinfo/std c++11 \-lineinfo \-Xcompiler \-D__CORRECT_ISO_CPP11_MATH_H_PROTO/g" ./makefile.inc
|
||||
# cuda installation root
|
||||
sed -i "s/CUDAROOT=\/usr\/local\/cuda-8.0\//CUDAROOT=\/usr\/local\/cuda/g" ./makefile.inc
|
||||
# python include directories
|
||||
sed -i "s/PYTHONCFLAGS=\-I\/usr\/include\/python2.7\/ \-I\/usr\/lib64\/python2.7\/site\-packages\/numpy\/core\/include\//PYTHONCFLAGS=\-I \/usr\/include\/python3\.5 \-I \/usr\/local\/lib\/python3\.5\/dist\-packages\/numpy\/core\/include/g" ./makefile.inc
|
||||
# arch
|
||||
if [[ -r /usr/bin/pacman ]]; then
|
||||
echo "Arch Linux found"
|
||||
pacman -S --noconfirm swig
|
||||
|
||||
# openblas dir
|
||||
sed -i "s/lib64\/libopenblas\.so\.0/lib\/libopenblas\.so/g" ./makefile.inc
|
||||
# nvcc compiler options
|
||||
sed -i "s/std c++11 \-lineinfo/std c++11 \-lineinfo \-Xcompiler \-D__CORRECT_ISO_CPP11_MATH_H_PROTO/g" ./makefile.inc
|
||||
# cuda installation root
|
||||
sed -i "s/CUDAROOT=\/usr\/local\/cuda-8.0\//CUDAROOT=\/usr\/local\/cuda/g" ./makefile.inc
|
||||
# python include directories
|
||||
sed -i "s/PYTHONCFLAGS=\-I\/usr\/include\/python2.7\/ \-I\/usr\/lib64\/python2.7\/site\-packages\/numpy\/core\/include\//PYTHONCFLAGS=\-I \/usr\/include\/python3\.6m \-I \/usr\/lib\/python3\.6\/site\-packages\/numpy\/core\/include/g" ./makefile.inc
|
||||
|
||||
# ubuntu
|
||||
elif [[ -r /usr/bin/apt-get ]]; then
|
||||
echo "Ubuntu found"
|
||||
apt-get -qq update
|
||||
apt-get install -y swig
|
||||
|
||||
# openblas dir
|
||||
sed -i "s/lib64\/libopenblas\.so\.0/lib\/libopenblas\.so/g" ./makefile.inc
|
||||
# nvcc compiler options
|
||||
sed -i "s/std c++11 \-lineinfo/std c++11 \-lineinfo \-Xcompiler \-D__CORRECT_ISO_CPP11_MATH_H_PROTO/g" ./makefile.inc
|
||||
# cuda installation root
|
||||
sed -i "s/CUDAROOT=\/usr\/local\/cuda-8.0\//CUDAROOT=\/usr\/local\/cuda/g" ./makefile.inc
|
||||
# python include directories
|
||||
sed -i "s/PYTHONCFLAGS=\-I\/usr\/include\/python2.7\/ \-I\/usr\/lib64\/python2.7\/site\-packages\/numpy\/core\/include\//PYTHONCFLAGS=\-I \/usr\/include\/python3\.5 \-I \/usr\/local\/lib\/python3\.5\/dist\-packages\/numpy\/core\/include/g" ./makefile.inc
|
||||
|
||||
# fedora
|
||||
elif [[ -r /usr/bin/yum ]]; then
|
||||
echo "Fedora found"
|
||||
yum install -y swig
|
||||
|
||||
# openblas dir
|
||||
sed -i "s/lib64\/libopenblas\.so\.0/lib\/libopenblas\.so/g" ./makefile.inc
|
||||
cp /tmp/OpenBLAS/libopenblas.so /usr/lib/
|
||||
# nvcc compiler options
|
||||
sed -i "s/std c++11 \-lineinfo/std c++11 \-lineinfo \-Xcompiler \-D__CORRECT_ISO_CPP11_MATH_H_PROTO/g" ./makefile.inc
|
||||
# cuda installation root
|
||||
sed -i "s/CUDAROOT=\/usr\/local\/cuda-8.0\//CUDAROOT=\/usr\/local\/cuda/g" ./makefile.inc
|
||||
# python include directories
|
||||
sed -i "s/PYTHONCFLAGS=\-I\/usr\/include\/python2.7\/ \-I\/usr\/lib64\/python2.7\/site\-packages\/numpy\/core\/include\//PYTHONCFLAGS=\-I \/usr\/include\/python3\.6m \-I \/usr\/local\/lib64\/python3\.6\/site\-packages\/numpy\/core\/include/g" ./makefile.inc
|
||||
|
||||
# fucked
|
||||
else
|
||||
echo "Does not support your distribution, top kek"
|
||||
exit -1
|
||||
fi
|
||||
|
||||
# build
|
||||
cd /faiss
|
||||
|
Loading…
Reference in New Issue
Block a user