Skip to content

Commit

Permalink
Merge branch 'main' into gustavz/search_params_support_for_index_bina…
Browse files Browse the repository at this point in the history
…ry_flat
  • Loading branch information
gustavz authored Dec 19, 2024
2 parents e96237e + 0a0af00 commit b3db31b
Show file tree
Hide file tree
Showing 6 changed files with 51 additions and 26 deletions.
8 changes: 6 additions & 2 deletions .github/actions/build_conda/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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 }}
Expand Down
7 changes: 7 additions & 0 deletions benchs/bench_fw/index.py
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
16 changes: 8 additions & 8 deletions conda/faiss-gpu-cuvs/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -46,24 +46,24 @@ 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]
- cuda-toolkit {{ cudatoolkit }}
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
Expand All @@ -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 }}
Expand All @@ -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_*"
Expand Down
16 changes: 8 additions & 8 deletions conda/faiss-gpu/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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 }}
Expand All @@ -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_*"
Expand Down
16 changes: 8 additions & 8 deletions conda/faiss/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -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
Expand All @@ -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_*"
Expand Down
14 changes: 14 additions & 0 deletions tests/test_ivf_index.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -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<float> 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<uint8_t> encodedData(num_vecs * codeSize);
index.sa_encode(num_vecs, vecs.data(), encodedData.data());
std::vector<float> 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;
Expand Down

0 comments on commit b3db31b

Please sign in to comment.