-
-
Save mdouze/2b96e804ee2825e72323c0a296061c7e to your computer and use it in GitHub Desktop.
This file contains 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 characters
curl -O https://repo.anaconda.com/miniconda/Miniconda3-latest-MacOSX-arm64.sh | |
bash ./Miniconda3-latest-MacOSX-arm64.sh | |
. $HOME/miniconda3/etc/profile.d/conda.sh | |
conda install python | |
conda install numpy | |
conda install swig | |
conda install cmake | |
export PATH=$HOME/miniconda3/bin:$PATH | |
git clone https://github.com/facebookresearch/faiss.git | |
cd faiss | |
cmake -B build -DBUILD_TESTING=ON -DFAISS_ENABLE_GPU=OFF \ | |
-DCMAKE_BUILD_TYPE=Release -DFAISS_ENABLE_C_API=ON \ | |
-DPython_EXECUTABLE=$(which python) | |
make -k -C build -j faiss | |
# C++ tests do not work | |
# make -C build test | |
make -C build -j swigfaiss | |
cd build/faiss/python | |
python3 setup.py build | |
cd - | |
cd tests | |
PYTHONPATH=../build/faiss/python/build/lib/ python3 -m unittest discover | |
OK I figured it out.
conda install libomp
cmake -B build -DBUILD_TESTING=ON -DFAISS_ENABLE_GPU=OFF \
-DCMAKE_BUILD_TYPE=Release -DFAISS_ENABLE_C_API=ON \
-DPython_EXECUTABLE=$(which python) \
-DOpenMP_C_FLAGS=-fopenmp=lomp -DOpenMP_CXX_FLAGS=-fopenmp=lomp \
-DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \
-DOpenMP_libomp_LIBRARY="$HOME/miniconda3/lib/libomp.dylib" \
-DOpenMP_CXX_FLAGS="-Xpreprocessor -fopenmp $HOME/miniconda3/lib/libomp.dylib \
-I$HOME/miniconda3/include" -DOpenMP_CXX_LIB_NAMES="libomp" \
-DOpenMP_C_FLAGS="-Xpreprocessor -fopenmp -I$HOME/miniconda3/include"
or install via brew:
brew install libomp
and add:
-DOpenMP_C_FLAGS=-fopenmp=lomp \
-DOpenMP_CXX_FLAGS=-fopenmp=lomp \
-DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \
-DOpenMP_libomp_LIBRARY="/opt/homebrew/opt/libomp/lib/libomp.dylib" \
-DOpenMP_CXX_FLAGS="-Xpreprocessor -fopenmp /opt/homebrew/opt/libomp/lib/libomp.dylib \
-I/opt/homebrew/opt/libomp/include" -DOpenMP_CXX_LIB_NAMES="libomp" \
-DOpenMP_C_FLAGS="-Xpreprocessor -fopenmp --I/opt/homebrew/opt/libomp/include"
✌️
brew install miniconda
brew install libomp
conda install python
conda install numpy
conda install swig
conda install cmake
cmake -B build -DBUILD_TESTING=ON -DFAISS_ENABLE_GPU=OFF \
-DCMAKE_BUILD_TYPE=Release -DFAISS_ENABLE_C_API=ON \
-DPython_EXECUTABLE=$(which python) \
-DOpenMP_C_FLAGS=-fopenmp=lomp \
-DOpenMP_CXX_FLAGS=-fopenmp=lomp \
-DOpenMP_C_LIB_NAMES="libomp" -DOpenMP_CXX_LIB_NAMES="libomp" \
-DOpenMP_libomp_LIBRARY="/opt/homebrew/opt/libomp/lib/libomp.dylib" \
-DOpenMP_CXX_FLAGS="-Xpreprocessor -fopenmp /opt/homebrew/opt/libomp/lib/libomp.dylib \
-I/opt/homebrew/opt/libomp/include" -DOpenMP_CXX_LIB_NAMES="libomp" \
-DOpenMP_C_FLAGS="-Xpreprocessor -fopenmp --I/opt/homebrew/opt/libomp/include"
make -k -C build -j faiss
make -C build -j swigfaiss
cd build/faiss/python
python3 setup.py build
cd -
cd tests
PYTHONPATH=../build/faiss/python/build/lib/ python3 -m unittest discover
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
How did you solve the following issue