Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

avx512 CI + conda packages #3197

Closed
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -314,6 +314,10 @@ workflows:
name: Linux x86_64 AVX2 (cmake)
exec: linux-x86_64-cpu
opt_level: "avx2"
- build_cmake:
name: Linux x86_64 AVX512 (cmake)
exec: linux-x86_64-cpu
opt_level: "avx512"
- build_cmake:
name: Linux x86_64 GPU (cmake)
exec: linux-x86_64-gpu
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -17,3 +17,4 @@
/tests/test
/tests/gtest/
faiss/python/swigfaiss_avx2.swig
faiss/python/swigfaiss_avx512.swig
6 changes: 3 additions & 3 deletions conda/faiss-gpu-raft/build-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
set -e


# Build libfaiss.so/libfaiss_avx2.so.
# Build libfaiss.so/libfaiss_avx2.so/libfaiss_avx512.so
cmake -B _build \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_TESTING=OFF \
-DFAISS_OPT_LEVEL=avx2 \
-DFAISS_OPT_LEVEL=avx512 \
-DFAISS_ENABLE_GPU=ON \
-DFAISS_ENABLE_RAFT=ON \
-DCMAKE_CUDA_ARCHITECTURES="${CUDA_ARCHS}" \
Expand All @@ -20,7 +20,7 @@ cmake -B _build \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_BUILD_TYPE=Release .

make -C _build -j$(nproc) faiss faiss_avx2
make -C _build -j$(nproc) faiss faiss_avx2 faiss_avx512

cmake --install _build --prefix $PREFIX
cmake --install _build --prefix _libfaiss_stage/
6 changes: 3 additions & 3 deletions conda/faiss-gpu-raft/build-pkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
set -e


# Build swigfaiss.so/swigfaiss_avx2.so.
# Build swigfaiss.so/swigfaiss_avx2.so/swigfaiss_avx512.so
cmake -B _build_python_${PY_VER} \
-Dfaiss_ROOT=_libfaiss_stage/ \
-DFAISS_OPT_LEVEL=avx2 \
-DFAISS_OPT_LEVEL=avx512 \
-DFAISS_ENABLE_GPU=ON \
-DFAISS_ENABLE_RAFT=ON \
-DCMAKE_BUILD_TYPE=Release \
-DPython_EXECUTABLE=$PYTHON \
faiss/python

make -C _build_python_${PY_VER} -j$(nproc) swigfaiss swigfaiss_avx2
make -C _build_python_${PY_VER} -j$(nproc) swigfaiss swigfaiss_avx2 swigfaiss_avx512

# Build actual python module.
cd _build_python_${PY_VER}/
Expand Down
5 changes: 3 additions & 2 deletions conda/faiss-gpu-raft/test_cpu_dispatch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@

set -e

FAISS_DISABLE_CPU_FEATURES=AVX2 LD_DEBUG=libs python -c "import faiss" 2>&1 | grep libfaiss.so
LD_DEBUG=libs python -c "import faiss" 2>&1 | grep libfaiss_avx2.so
FAISS_OPT_LEVEL= LD_DEBUG=libs python -c "import faiss" 2>&1 | grep libfaiss.so
FAISS_OPT_LEVEL=AVX2 LD_DEBUG=libs python -c "import faiss" 2>&1 | grep libfaiss_avx2.so
FAISS_OPT_LEVEL=AVX512 LD_DEBUG=libs python -c "import faiss" 2>&1 | grep libfaiss_avx512.so
6 changes: 3 additions & 3 deletions conda/faiss-gpu/build-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
set -e


# Build libfaiss.so/libfaiss_avx2.so.
# Build libfaiss.so/libfaiss_avx2.so/libfaiss_avx512.so
cmake -B _build \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_TESTING=OFF \
-DFAISS_OPT_LEVEL=avx2 \
-DFAISS_OPT_LEVEL=avx512 \
-DFAISS_ENABLE_GPU=ON \
-DFAISS_ENABLE_RAFT=OFF \
-DCMAKE_CUDA_ARCHITECTURES="${CUDA_ARCHS}" \
Expand All @@ -20,7 +20,7 @@ cmake -B _build \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_BUILD_TYPE=Release .

make -C _build -j$(nproc) faiss faiss_avx2
make -C _build -j$(nproc) faiss faiss_avx2 faiss_avx512

cmake --install _build --prefix $PREFIX
cmake --install _build --prefix _libfaiss_stage/
6 changes: 3 additions & 3 deletions conda/faiss-gpu/build-pkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,17 +7,17 @@
set -e


# Build swigfaiss.so/swigfaiss_avx2.so.
# Build swigfaiss.so/swigfaiss_avx2.so/swigfaiss_avx512.so
cmake -B _build_python_${PY_VER} \
-Dfaiss_ROOT=_libfaiss_stage/ \
-DFAISS_OPT_LEVEL=avx2 \
-DFAISS_OPT_LEVEL=avx512 \
-DFAISS_ENABLE_GPU=ON \
-DFAISS_ENABLE_RAFT=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DPython_EXECUTABLE=$PYTHON \
faiss/python

make -C _build_python_${PY_VER} -j$(nproc) swigfaiss swigfaiss_avx2
make -C _build_python_${PY_VER} -j$(nproc) swigfaiss swigfaiss_avx2 swigfaiss_avx512

# Build actual python module.
cd _build_python_${PY_VER}/
Expand Down
5 changes: 3 additions & 2 deletions conda/faiss-gpu/test_cpu_dispatch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@

set -e

FAISS_DISABLE_CPU_FEATURES=AVX2 LD_DEBUG=libs python -c "import faiss" 2>&1 | grep libfaiss.so
LD_DEBUG=libs python -c "import faiss" 2>&1 | grep libfaiss_avx2.so
FAISS_OPT_LEVEL= LD_DEBUG=libs python -c "import faiss" 2>&1 | grep libfaiss.so
FAISS_OPT_LEVEL=AVX2 LD_DEBUG=libs python -c "import faiss" 2>&1 | grep libfaiss_avx2.so
FAISS_OPT_LEVEL=AVX512 LD_DEBUG=libs python -c "import faiss" 2>&1 | grep libfaiss_avx512.so
6 changes: 3 additions & 3 deletions conda/faiss/build-lib-osx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,11 @@
set -e


# Build libfaiss.so/libfaiss_avx2.so.
# Build libfaiss.so/libfaiss_avx2.so/libfaiss_avx512.so
cmake -B _build \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_TESTING=OFF \
-DFAISS_OPT_LEVEL=avx2 \
-DFAISS_OPT_LEVEL=avx512 \
-DFAISS_ENABLE_GPU=OFF \
-DFAISS_ENABLE_PYTHON=OFF \
-DBLA_VENDOR=Intel10_64lp \
Expand All @@ -21,7 +21,7 @@ cmake -B _build \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_BUILD_TYPE=Release .

make -C _build -j$(nproc) faiss faiss_avx2
make -C _build -j$(nproc) faiss faiss_avx2 faiss_avx512

cmake --install _build --prefix $PREFIX
cmake --install _build --prefix _libfaiss_stage/
6 changes: 3 additions & 3 deletions conda/faiss/build-lib.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,18 +7,18 @@
set -e


# Build libfaiss.so/libfaiss_avx2.so.
# Build libfaiss.so/libfaiss_avx2.so/libfaiss_avx512.so
cmake -B _build \
-DBUILD_SHARED_LIBS=ON \
-DBUILD_TESTING=OFF \
-DFAISS_OPT_LEVEL=avx2 \
-DFAISS_OPT_LEVEL=avx512 \
-DFAISS_ENABLE_GPU=OFF \
-DFAISS_ENABLE_PYTHON=OFF \
-DBLA_VENDOR=Intel10_64lp \
-DCMAKE_INSTALL_LIBDIR=lib \
-DCMAKE_BUILD_TYPE=Release .

make -C _build -j$(nproc) faiss faiss_avx2
make -C _build -j$(nproc) faiss faiss_avx2 faiss_avx512

cmake --install _build --prefix $PREFIX
cmake --install _build --prefix _libfaiss_stage/
2 changes: 1 addition & 1 deletion conda/faiss/build-pkg-arm64.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
set -e


# Build swigfaiss.so/swigfaiss_avx2.so.
# Build swigfaiss.so
cmake -B _build_python_${PY_VER} \
-Dfaiss_ROOT=_libfaiss_stage/ \
-DFAISS_ENABLE_GPU=OFF \
Expand Down
6 changes: 3 additions & 3 deletions conda/faiss/build-pkg-osx.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,10 @@
set -e


# Build swigfaiss.so/swigfaiss_avx2.so.
# Build swigfaiss.so/swigfaiss_avx2.so/swigfaiss_avx512
cmake -B _build_python_${PY_VER} \
-Dfaiss_ROOT=_libfaiss_stage/ \
-DFAISS_OPT_LEVEL=avx2 \
-DFAISS_OPT_LEVEL=avx512 \
-DFAISS_ENABLE_GPU=OFF \
-DOpenMP_CXX_FLAGS=-fopenmp=libiomp5 \
-DOpenMP_CXX_LIB_NAMES=libiomp5 \
Expand All @@ -19,7 +19,7 @@ cmake -B _build_python_${PY_VER} \
-DPython_EXECUTABLE=$PYTHON \
faiss/python

make -C _build_python_${PY_VER} -j$(nproc) swigfaiss swigfaiss_avx2
make -C _build_python_${PY_VER} -j$(nproc) swigfaiss swigfaiss_avx2 swigfaiss_avx512

# Build actual python module.
cd _build_python_${PY_VER}/
Expand Down
6 changes: 3 additions & 3 deletions conda/faiss/build-pkg.sh
Original file line number Diff line number Diff line change
Expand Up @@ -7,16 +7,16 @@
set -e


# Build swigfaiss.so/swigfaiss_avx2.so.
# Build swigfaiss.so/swigfaiss_avx2.so/swigfaiss_avx512.so
cmake -B _build_python_${PY_VER} \
-Dfaiss_ROOT=_libfaiss_stage/ \
-DFAISS_OPT_LEVEL=avx2 \
-DFAISS_OPT_LEVEL=avx512 \
-DFAISS_ENABLE_GPU=OFF \
-DCMAKE_BUILD_TYPE=Release \
-DPython_EXECUTABLE=$PYTHON \
faiss/python

make -C _build_python_${PY_VER} -j$(nproc) swigfaiss swigfaiss_avx2
make -C _build_python_${PY_VER} -j$(nproc) swigfaiss swigfaiss_avx2 swigfaiss_avx512

# Build actual python module.
cd _build_python_${PY_VER}/
Expand Down
5 changes: 3 additions & 2 deletions conda/faiss/test_cpu_dispatch.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,5 +6,6 @@

set -e

FAISS_DISABLE_CPU_FEATURES=AVX2 LD_DEBUG=libs python -c "import faiss" 2>&1 | grep libfaiss.so
LD_DEBUG=libs python -c "import faiss" 2>&1 | grep libfaiss_avx2.so
FAISS_OPT_LEVEL= LD_DEBUG=libs python -c "import faiss" 2>&1 | grep libfaiss.so
FAISS_OPT_LEVEL=AVX2 LD_DEBUG=libs python -c "import faiss" 2>&1 | grep libfaiss_avx2.so
FAISS_OPT_LEVEL=AVX512 LD_DEBUG=libs python -c "import faiss" 2>&1 | grep libfaiss_avx512.so
2 changes: 1 addition & 1 deletion faiss/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -328,7 +328,7 @@ if(FAISS_OPT_LEVEL STREQUAL "avx2")
)
endif()
if(FAISS_OPT_LEVEL STREQUAL "avx512")
install(TARGETS faiss_avx512
install(TARGETS faiss_avx2 faiss_avx512
EXPORT faiss-targets
ARCHIVE DESTINATION ${CMAKE_INSTALL_LIBDIR}
LIBRARY DESTINATION ${CMAKE_INSTALL_LIBDIR}
Expand Down
2 changes: 1 addition & 1 deletion faiss/utils/utils.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ std::string get_compile_options() {
#ifdef __AVX2__
options += "AVX2 ";
#elif __AVX512F__
options += "AVX512";
options += "AVX512 ";
#elif defined(__aarch64__)
options += "NEON ";
#else
Expand Down
4 changes: 2 additions & 2 deletions tests/test_index_accuracy.py
Original file line number Diff line number Diff line change
Expand Up @@ -639,14 +639,14 @@ def test_OIVFPQ(self):
d = ev.d
quantizer = faiss.IndexFlatL2(d)
index = faiss.IndexIVFPQ(quantizer, d, ncentroids, M, 8)
index.nprobe = 5
index.nprobe = 12

res = ev.launch("IVFPQ", index)
e_ivfpq = ev.evalres(res)

quantizer = faiss.IndexFlatL2(d)
index_ivfpq = faiss.IndexIVFPQ(quantizer, d, ncentroids, M, 8)
index_ivfpq.nprobe = 5
index_ivfpq.nprobe = 12
opq_matrix = faiss.OPQMatrix(d, M)
opq_matrix.niter = 10
index = faiss.IndexPreTransform(opq_matrix, index_ivfpq)
Expand Down