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 }} 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", 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_*" 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;