-
-
Save Glavin001/ff08b5bb9beddfa3fcbebbbe7d9f2399 to your computer and use it in GitHub Desktop.
Revisions
-
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode charactersOriginal file line number Diff line number Diff line change @@ -0,0 +1,41 @@ function install_faiss() { pyenv shell rise pip install numpy sudo apt-get install -y \ build-essential \ libopenblas-dev \ gfortran \ swig PREFIX_MAIN=$(pyenv virtualenv-prefix) SITE_PACKAGES=$(venv_site_packages) PYTHON_NUMPY_INCLUDE_DIR="${SITE_PACKAGES}/numpy/core/include/" PYTHON_INCLUDE_DIR="$(echo "${PREFIX_MAIN}/include/python"*"m")/" # Download Facebook Faiss library source code cd "${CODE_PATH}" git clone --depth 1 https://github.com/facebookresearch/faiss.git -b "${FAISS_BRANCH}" cd "${CODE_PATH}/faiss" # Setup makefile cp example_makefiles/makefile.inc.Linux makefile.inc echo "PYTHONCFLAGS=-I${PYTHON_INCLUDE_DIR} -I${PYTHON_NUMPY_INCLUDE_DIR}" \ >> makefile.inc export BLASLDFLAGS="/usr/lib/libopenblas.so.0" # Compile faiss make -j "${NPROC}" # Create python bindings make py if is_cuda_compatible; then # Compile GPU version cd "${CODE_PATH}/faiss/gpu" make -j "${NPROC}" make py cd "${CODE_PATH}/faiss" else echo "No NVIDIA GPU detected, skipping faiss gpu install" fi # Copy python modules to python system path cp -- *.py *.so "$(venv_site_packages)/" }