-
Notifications
You must be signed in to change notification settings - Fork 4.4k
Installing Faiss
Matthijs Douze edited this page Jan 27, 2021
·
5 revisions
** This page is WIP, currently mainly notes **
See INSTALL.md
This is useful to make sure the MKL impementation is as fast as possible.
source ~/anaconda3/etc/profile.d/conda.sh
conda activate host_env_for_faiss # an environment that contains python and numpy
git clone https://github.com/facebookresearch/faiss.git faiss_xx
cd faiss_xx
target_dir=$PWD/install_py
# often the system cmake is too old
cmake=path_to_compiled_cmake
$cmake -B build \
-DFAISS_ENABLE_GPU=OFF \
-DBLA_VENDOR=Intel10_64_dyn \
-DMKL_LIBRARIES=$CONDA_PREFIX/lib \
-DPython_EXECUTABLE=$(which python) \
-DFAISS_OPT_LEVEL=avx2 \
-DCMAKE_BUILD_TYPE=Release
make -C build -j 10
(cd build/faiss/python/ ; python setup.py install --prefix $target_dir )
(cd ..; PYTHONPATH=$target_dir/lib/python3.7/site-packages/faiss-1.6.3-py3.7.egg/ python -c "
Commands for an ubuntu 18 image on an Amazon c6g.8xlarge machine :
set -e
sudo apt-get install libatlas-base-dev libatlas3-base
sudo apt-get install clang-8
sudo apt-get install swig
# cmake provided with ubuntu is too old
wget https://github.com/Kitware/CMake/releases/download/v3.19.3/cmake-3.19.3.tar.gz
tar xvzf cmake-3.19.3.tar.gz
cd cmake-3.19.3/
./configure --prefix=/home/matthijs/cmake && make -j
cd $HOME
alias cmake=$HOME/cmake/bin/cmake
# clone Faiss
git clone https://github.com/facebookresearch/faiss.git
cd faiss
cmake -B build -DCMAKE_CXX_COMPILER=clang++-8 -DFAISS_ENABLE_GPU=OFF -DPython_EXECUTABLE=$(which python3) -DFAISS_OPT_LEVEL=generic -DCMAKE_BUILD_TYPE=Release -DBUILD_TEST\
ING=ON
(cd build/faiss/python/ ; python3 setup.py build)
# run tests
export PYTHONPATH=$PWD/build/faiss/python/build/lib/
python3 -m unittest discover
Faiss building blocks: clustering, PCA, quantization
Index IO, cloning and hyper parameter tuning
CPU Faiss + Intel SVS - Overview
GPU Faiss + NVIDIA cuVS - Overview
GPU Faiss + NVIDIA cuVS - Usage
Threads and asynchronous calls
Inverted list objects and scanners
Indexes that do not fit in RAM
Brute force search without an index
Fast accumulation of PQ and AQ codes (FastScan)
Setting search parameters for one query
Binary hashing index benchmark