-
Notifications
You must be signed in to change notification settings - Fork 46
/
build.sh
35 lines (28 loc) · 1.03 KB
/
build.sh
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
sudo apt install -y build-essential swig
sudo apt install -y intel-mkl
sudo snap install cmake --classic
cd $HOME
wget https://repo.anaconda.com/miniconda/Miniconda3-latest-Linux-x86_64.sh -O $HOME/miniconda.sh
bash $HOME/miniconda.sh -b -p $HOME/miniconda
export PATH="$HOME/miniconda/bin:$PATH"
echo 'export PATH="$HOME/miniconda/bin:$PATH"' >> $HOME/.bashrc
conda update conda --yes
conda update --all --yes
conda install numpy --yes
cd $HOME
git clone https://github.com/facebookresearch/faiss.git
cd faiss
cmake -B build \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_TESTING=ON \
-DFAISS_OPT_LEVEL=avx2 \
-DFAISS_ENABLE_GPU=OFF \
-DFAISS_ENABLE_PYTHON=ON \
-DPython_EXECUTABLE=$HOME/miniconda/bin/python \
-DCMAKE_BUILD_TYPE=Release .
make -C build -j faiss faiss_avx2
make -C build -j swigfaiss swigfaiss_avx2
cd build/faiss/python
python setup.py install
export PYTHONPATH=$HOME/faiss/build/faiss/python/build/lib:$PYTHONPATH
echo 'export PYTHONPATH=$HOME/faiss/build/faiss/python/build/lib:$PYTHONPATH' >> $HOME/.bashrc