|
5 months ago | |
---|---|---|
.devcontainer | 1 year ago | |
.vscode | 1 year ago | |
faiss_study | 1 year ago | |
gtest | 5 months ago | |
swig_demo | 5 months ago | |
.clang-format | 1 year ago | |
.dockerignore | 1 year ago | |
.gitignore | 5 months ago | |
CMakeLists.txt | 1 year ago | |
Makefile | 1 year ago | |
README.md | 1 year ago |
# cmake 构建
cmake -B build . -DFAISS_ENABLE_GPU=OFF -DFAISS_ENABLE_PYTHON=ON
# 编译
make -C build faiss_study
# python
make -C build swigfaiss
cd build/faiss/python && python3 setup.py install
CMake 构建的选项:
-DFAISS_ENABLE_GPU=OFF
是否(ON/OFF)构建 GPU 版本-DFAISS_ENABLE_PYTHON=OFF
是否(ON/OFF)构建 python-DBUILD_TESTING=OFF
in order to disable building C++ tests,-DBUILD_SHARED_LIBS=ON
in order to build a shared library (possible values
are ON
and OFF
),-DCMAKE_BUILD_TYPE=Release
in order to enable generic compiler
optimization options (enables -O3
on gcc for instance),-DFAISS_OPT_LEVEL=avx2
in order to enable the required compiler flags to
generate code using optimized SIMD instructions (possible values are generic
,
sse4
, and avx2
, by increasing order of optimization),-DBLA_VENDOR=Intel10_64_dyn -DMKL_LIBRARIES=/path/to/mkl/libs
to use the
Intel MKL BLAS implementation, which is significantly faster than OpenBLAS
(more information about the values for the BLA_VENDOR
option can be found in
the CMake docs),-DCUDAToolkit_ROOT=/path/to/cuda-10.1
in order to hint to the path of
the CUDA toolkit (for more information, see
CMake docs),-DCMAKE_CUDA_ARCHITECTURES="75;72"
for specifying which GPU architectures
to build against (see CUDA docs to
determine which architecture(s) you should pick),-DPython_EXECUTABLE=/path/to/python3.7
in order to build a python
interface for a different python than the default one (see
CMake docs).$ make -C build -j swigfaiss
$ (cd build/faiss/python && python setup.py install)
# vscode中使用的编译命令(amd64)
$ make -C build swigfaiss
$ cd build/faiss/python && python3 setup.py install
The first command builds the python bindings for Faiss, while the second one generates and installs the python package.
$ make -C build install
# vscode中使用的编译命令(amd64)
$ make -C build install
This will make the compiled library (either libfaiss.a
or libfaiss.so
on
Linux) available system-wide, as well as the C++ headers. This step is not
needed to install the python package only.