From 66c989a1733b24c6eb86b334d5e7dd35dacb8665 Mon Sep 17 00:00:00 2001 From: Junjie Qi Date: Mon, 16 Dec 2024 10:50:44 -0800 Subject: [PATCH 1/4] Pin Nightlies with testing on PR (#4088) Summary: Pull Request resolved: https://github.com/facebookresearch/faiss/pull/4088 Test Plan: https://github.com/facebookresearch/faiss/actions/runs/12325339739 Reviewed By: gtwang01 Differential Revision: D67227820 Pulled By: junjieqi fbshipit-source-id: c516ea6c26415f521dff90f7de1ab6e65d173e44 --- conda/faiss-gpu-cuvs/meta.yaml | 16 ++++++++-------- conda/faiss-gpu/meta.yaml | 16 ++++++++-------- conda/faiss/meta.yaml | 16 ++++++++-------- 3 files changed, 24 insertions(+), 24 deletions(-) diff --git a/conda/faiss-gpu-cuvs/meta.yaml b/conda/faiss-gpu-cuvs/meta.yaml index e32099085e..d14d6af569 100644 --- a/conda/faiss-gpu-cuvs/meta.yaml +++ b/conda/faiss-gpu-cuvs/meta.yaml @@ -46,10 +46,10 @@ outputs: requirements: build: - {{ compiler('cxx') }} - - sysroot_linux-64 # [linux64] + - sysroot_linux-64 =2.17 # [linux64] - llvm-openmp # [osx] - cmake >=3.26.4 - - make # [not win] + - make =4.2 # [not win] - _openmp_mutex =4.5=2_kmp_llvm # [x86_64] - mkl =2023 # [x86_64] - mkl-devel =2023 # [x86_64] @@ -57,13 +57,13 @@ outputs: host: - _openmp_mutex =4.5=2_kmp_llvm # [x86_64] - mkl =2023 # [x86_64] - - openblas # [not x86_64] + - openblas =0.3 # [not x86_64] - libcuvs =24.08 - cuda-version {{ cudatoolkit }} run: - _openmp_mutex =4.5=2_kmp_llvm # [x86_64] - mkl =2023 # [x86_64] - - openblas # [not x86_64] + - openblas =0.3 # [not x86_64] - cuda-cudart {{ cuda_constraints }} - libcublas {{ libcublas_constraints }} - libcuvs =24.08 @@ -88,9 +88,9 @@ outputs: build: - {{ compiler('cxx') }} - sysroot_linux-64 =2.17 # [linux64] - - swig + - swig =4.0 - cmake >=3.24.0 - - make # [not win] + - make =4.2 # [not win] - _openmp_mutex =4.5=2_kmp_llvm # [x86_64] - mkl =2023 # [x86_64] - cuda-toolkit {{ cudatoolkit }} @@ -107,9 +107,9 @@ outputs: - {{ pin_subpackage('libfaiss', exact=True) }} test: requires: - - numpy + - numpy >=1.19,<2 - scipy - - pytorch + - pytorch <2.5 - pytorch-cuda {{ cuda_constraints }} commands: - python -X faulthandler -m unittest discover -v -s tests/ -p "test_*" diff --git a/conda/faiss-gpu/meta.yaml b/conda/faiss-gpu/meta.yaml index 05f7b59008..651d42fefa 100644 --- a/conda/faiss-gpu/meta.yaml +++ b/conda/faiss-gpu/meta.yaml @@ -47,18 +47,18 @@ outputs: requirements: build: - {{ compiler('cxx') }} - - sysroot_linux-64 # [linux64] + - sysroot_linux-64 =2.17 # [linux64] - llvm-openmp # [osx] - cmake >=3.24.0 - - make # [not win] + - make =4.2 # [not win] - mkl-devel =2023 # [x86_64] - cuda-toolkit {{ cudatoolkit }} host: - mkl =2023 # [x86_64] - - openblas # [not x86_64] + - openblas =0.3 # [not x86_64] run: - mkl =2023 # [x86_64] - - openblas # [not x86_64] + - openblas =0.3 # [not x86_64] - cuda-cudart {{ cuda_constraints }} - libcublas {{ libcublas_constraints }} test: @@ -81,9 +81,9 @@ outputs: build: - {{ compiler('cxx') }} - sysroot_linux-64 =2.17 # [linux64] - - swig + - swig =4.0 - cmake >=3.24.0 - - make # [not win] + - make =4.2 # [not win] - cuda-toolkit {{ cudatoolkit }} host: - python {{ python }} @@ -96,9 +96,9 @@ outputs: - {{ pin_subpackage('libfaiss', exact=True) }} test: requires: - - numpy + - numpy >=1.19,<2 - scipy - - pytorch + - pytorch <2.5 - pytorch-cuda {{ cuda_constraints }} commands: - python -X faulthandler -m unittest discover -v -s tests/ -p "test_*" diff --git a/conda/faiss/meta.yaml b/conda/faiss/meta.yaml index 79e7be953e..fe7612c23b 100644 --- a/conda/faiss/meta.yaml +++ b/conda/faiss/meta.yaml @@ -37,17 +37,17 @@ outputs: requirements: build: - {{ compiler('cxx') }} - - sysroot_linux-64 # [linux64] + - sysroot_linux-64 =2.17 # [linux64] - llvm-openmp # [osx] - cmake >=3.24.0 - - make # [not win] + - make =4.2 # [not win] - mkl-devel =2023 # [x86_64] host: - mkl =2023 # [x86_64] - - openblas # [not x86_64] + - openblas =0.3 # [not x86_64] run: - mkl =2023 # [x86_64] - - openblas # [not x86_64] + - openblas =0.3 # [not x86_64] test: requires: - conda-build @@ -68,9 +68,9 @@ outputs: build: - {{ compiler('cxx') }} - sysroot_linux-64 =2.17 # [linux64] - - swig + - swig =4.0 - cmake >=3.24.0 - - make # [not win] + - make =4.2 # [not win] host: - python {{ python }} - numpy >=1.19,<2 @@ -82,9 +82,9 @@ outputs: - {{ pin_subpackage('libfaiss', exact=True) }} test: requires: - - numpy + - numpy >=1.19,<2 - scipy - - pytorch + - pytorch <2.5 commands: - python -X faulthandler -m unittest discover -v -s tests/ -p "test_*" - python -X faulthandler -m unittest discover -v -s tests/ -p "torch_*" From db3409abd7b47d986e3454615bc7c9d3d69e7bce Mon Sep 17 00:00:00 2001 From: Satyendra Mishra Date: Mon, 16 Dec 2024 11:37:30 -0800 Subject: [PATCH 2/4] Update benchmarking library code to work for IdMap index as well (#4093) Summary: Pull Request resolved: https://github.com/facebookresearch/faiss/pull/4093 Update benchmarking library code to work for IdMap index as well by calling add_with_ids instead of add since ids are required for IDMap index Reviewed By: gtwang01 Differential Revision: D67254267 fbshipit-source-id: 947a141edbdd7e44d33a297054869e3b932e3b89 --- benchs/bench_fw/index.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/benchs/bench_fw/index.py b/benchs/bench_fw/index.py index 745235cd54..fe2fe103ef 100644 --- a/benchs/bench_fw/index.py +++ b/benchs/bench_fw/index.py @@ -677,6 +677,13 @@ def fetch_index(self): lambda: add_preassigned(index_ivf, xbt, QI.ravel()), once=True, ) + elif isinstance(index, faiss.IndexIDMap): + _, t, _ = timer( + "add_with_ids", + lambda: index.add_with_ids( + xb, np.arange(len(xb), dtype='int32')), + once=True, + ) else: _, t, _ = timer( "add", From 3ff8a24282787f4013888c8b8601128e145b30fd Mon Sep 17 00:00:00 2001 From: Satyendra Mishra Date: Tue, 17 Dec 2024 14:17:43 -0800 Subject: [PATCH 3/4] Test sa_decode methd on IndexIVFFlat (#4098) Summary: Pull Request resolved: https://github.com/facebookresearch/faiss/pull/4098 Increase test coverage: Test sa_decode methd on IndexIVFFlat Reviewed By: mnorris11 Differential Revision: D67345048 fbshipit-source-id: 533e090a690ffc855091a4f95642446f93b93a3f --- tests/test_ivf_index.cpp | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/tests/test_ivf_index.cpp b/tests/test_ivf_index.cpp index 21d8897d40..089c7a1e39 100644 --- a/tests/test_ivf_index.cpp +++ b/tests/test_ivf_index.cpp @@ -204,6 +204,20 @@ TEST(IVF, list_context) { EXPECT_EQ(nb, context.list_nos.size()) << "should have correct number of list numbers"; } + { + constexpr size_t num_vecs = 5; // number of vectors + std::vector vecs(num_vecs * d); + for (size_t i = 0; i < num_vecs * d; i++) { + vecs[i] = distrib(rng); + } + const size_t codeSize = index.sa_code_size(); + std::vector encodedData(num_vecs * codeSize); + index.sa_encode(num_vecs, vecs.data(), encodedData.data()); + std::vector decodedVecs(num_vecs * d); + index.sa_decode(num_vecs, encodedData.data(), decodedVecs.data()); + EXPECT_EQ(vecs, decodedVecs) + << "decoded vectors should be the same as the original vectors that were encoded"; + } { constexpr faiss::idx_t k = 100; constexpr size_t nprobe = 10; From 0a0af00966b64ee05e5cab9cdf8bcfa7d101525b Mon Sep 17 00:00:00 2001 From: Amir Sadoughi Date: Wed, 18 Dec 2024 14:34:27 -0800 Subject: [PATCH 4/4] Update action.yml (#4100) Summary: Debug CI failures Pull Request resolved: https://github.com/facebookresearch/faiss/pull/4100 Reviewed By: bshethmeta Differential Revision: D67409777 Pulled By: asadoughi fbshipit-source-id: 0e60ee10c7eef796aabc061f089d12b64f5a98ea --- .github/actions/build_conda/action.yml | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.github/actions/build_conda/action.yml b/.github/actions/build_conda/action.yml index bf84a38496..683fb7a5ba 100644 --- a/.github/actions/build_conda/action.yml +++ b/.github/actions/build_conda/action.yml @@ -34,8 +34,12 @@ runs: - name: Install conda build tools shell: ${{ steps.choose_shell.outputs.shell }} run: | - conda install -y -q "conda!=24.11.0" - conda install -y -q "conda-build!=24.11.0" + conda install -y "conda!=24.11.0" + conda install -y "conda-build!=24.11.0" + - name: Fix CI failure + shell: ${{ steps.choose_shell.outputs.shell }} + if: runner.os != 'Windows' + run: conda remove conda-anaconda-telemetry - name: Enable anaconda uploads if: inputs.label != '' shell: ${{ steps.choose_shell.outputs.shell }}