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

Migrate from RAFT to CUVS #3549

Open
wants to merge 182 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 176 commits
Commits
Show all changes
182 commits
Select commit Hold shift + click to select a range
753a109
start integration of cagra
divyegala Oct 5, 2023
6ce2467
merge upstream
divyegala Jan 23, 2024
f21c1f1
add public API layer
divyegala Jan 30, 2024
11c0c54
merge upstream
divyegala Jan 30, 2024
656f493
write tests, figure out a way to compare
divyegala Feb 1, 2024
de67ca6
Merge remote-tracking branch 'upstream/main' into raft-cagra
divyegala Feb 1, 2024
ed32954
passing tests
divyegala Feb 7, 2024
42ca862
remove cpp test file
divyegala Feb 7, 2024
2fdfc6f
Merge remote-tracking branch 'upstream/main' into raft-cagra
divyegala Feb 7, 2024
2c9e965
style check
divyegala Feb 7, 2024
2e434fe
add required methods
divyegala Feb 7, 2024
382c178
conditionally compile cagra
divyegala Feb 8, 2024
8675974
copyTo and copyFrom
divyegala Feb 14, 2024
c7fcf4a
style check
divyegala Feb 14, 2024
eae832d
Merge branch 'main' into raft-cagra-hnsw
divyegala Feb 14, 2024
4b76e5f
Merge branch 'main' into raft-cagra-hnsw
divyegala Feb 16, 2024
065f912
add read/write
divyegala Feb 20, 2024
301f429
Merge remote-tracking branch 'origin/raft-cagra-hnsw' into raft-cagra…
divyegala Feb 20, 2024
2b0ea76
add destructor
divyegala Feb 20, 2024
8c83bd2
destructor body, copyto reset
divyegala Feb 21, 2024
39fb35a
remove destructor
divyegala Feb 21, 2024
49e2610
move cmake sources around
divyegala Feb 21, 2024
11bf6b2
merge upstream
divyegala Feb 21, 2024
d4434bb
more protections for copying
divyegala Feb 21, 2024
ac65c2d
support default constructed IndexHnswCagra in copyTo
divyegala Feb 22, 2024
619c376
fix failing binary hnsw tests
divyegala Feb 22, 2024
e25f8a4
link faiss_gpu target to OpenMP
divyegala Feb 23, 2024
e835150
raft still can't find openmp
divyegala Feb 23, 2024
aeabe12
openmp flags and uint32 IndexType
divyegala Feb 26, 2024
4e80586
forgot conditional check in index_read
divyegala Feb 26, 2024
c4bcaba
minor changes
divyegala Mar 7, 2024
341a3fc
api change
divyegala Mar 7, 2024
0ae7702
Merge branch 'raft-api-changes' into raft-cagra-hnsw
divyegala Mar 7, 2024
172aa65
working python
divyegala Mar 20, 2024
0cd684e
compile option to swig
divyegala Mar 21, 2024
7ff8b3b
expose ivf pq params
divyegala Apr 3, 2024
66d236f
update comments style
divyegala Apr 22, 2024
f697eac
Merge remote-tracking branch 'upstream/main' into raft-cagra-hnsw
divyegala Apr 22, 2024
1d6e6b1
use raft::runtime where possible
divyegala Apr 22, 2024
4a01ad4
format
divyegala Apr 22, 2024
949e634
format properly
divyegala Apr 22, 2024
bccd54a
InnerProduct
divyegala Apr 30, 2024
320654c
Merge remote-tracking branch 'upstream/main' into raft-cagra-hnsw
divyegala Apr 30, 2024
2aaa6e9
passing ip tests
divyegala May 7, 2024
70b0ab8
address review
divyegala May 9, 2024
e5756cc
Merge remote-tracking branch 'upstream/main' into raft-cagra-hnsw
divyegala May 9, 2024
8f72ce4
Merge remote-tracking branch 'upstream/main' into raft-cagra-hnsw
divyegala May 14, 2024
4148fea
base level only search
divyegala May 21, 2024
c13bcff
Merge remote-tracking branch 'upstream/main' into raft-cagra-hnsw
divyegala May 21, 2024
24a555d
fix virtual functions and serialization
divyegala May 23, 2024
51227b1
invert conditional
divyegala May 23, 2024
579a301
debug msg
divyegala May 23, 2024
ae0b8ba
more debug prints
divyegala May 23, 2024
4170a3e
fix efSearch setting in base search
divyegala May 23, 2024
75808b1
re-negate ip distances in search_level
divyegala May 23, 2024
09fb95b
Merge remote-tracking branch 'upstream/main' into raft-cagra-hnsw
divyegala May 23, 2024
9bd1039
fix format
divyegala May 23, 2024
ea8028d
re-up minimum recall for base only IP distance
divyegala May 23, 2024
fc31351
add python tests
divyegala May 30, 2024
3e2d343
Merge remote-tracking branch 'upstream/main' into raft-cagra-hnsw
divyegala May 30, 2024
03ee1fb
ifdef guards in gpu cloner
divyegala May 30, 2024
2e9cbc8
option to exclude dataset store on index
divyegala Jun 6, 2024
826ed98
sys.big_endian to sys.byteorder (#3422)
kuarora May 30, 2024
4dcdff5
Adding buck target for experiment bench_fw_ivf (#3423)
kuarora May 31, 2024
756ad46
add skip_storage flag to HNSW (#3487)
mdouze May 31, 2024
c48fba3
Add cpp tutorial for index factory refine index construction (#3494)
Jun 5, 2024
66fd9ac
Update .gitignore (#3492)
abhiramvad Jun 5, 2024
4615b00
rebase on latest changes
tarang-jain Jun 25, 2024
2ce4b28
fix spurious include to land the cagra diff (#3502)
mdouze Jun 11, 2024
959cd49
add use_raft to knn_gpu (torch) (#3509)
algoriddle Jun 13, 2024
2d1e49a
Add conda bin to path early in the cmake GitHub action (#3512)
ramilbakhshyiev Jun 13, 2024
11d6ce4
typo in test_io_no_storage (#3515)
algoriddle Jun 13, 2024
a651593
Consolidate build environment configuration steps in cmake builds (#3…
ramilbakhshyiev Jun 14, 2024
6d7317d
fix Windows build - signed int OMP for MSVC (#3517)
algoriddle Jun 14, 2024
1e0e35e
Unbreak RAFT conda builds (#3519)
ramilbakhshyiev Jun 17, 2024
5109d96
Bump libraft to 24.06 to unblock nightly RAFT builds (#3522)
ramilbakhshyiev Jun 18, 2024
4e98f8f
Add ABS_INNER_PRODUCT metric (#3524)
mdouze Jun 18, 2024
bea7343
initial commit
tarang-jain Jun 25, 2024
45c4d49
Adding faiss bench_fw to bento faiss kernel (#3531)
kuarora Jun 21, 2024
c9e23ef
Refactor bench_fw to support train, build & search in parallel (#3527)
kuarora Jun 21, 2024
8d24404
Add SQ8bit signed quantization (#3501)
naveentatikonda Jun 24, 2024
702c3d2
rm build.sh
tarang-jain Jun 25, 2024
a918768
remove compilation issues
tarang-jain Jul 5, 2024
fb628eb
pull upstream
tarang-jain Jul 5, 2024
499cae4
include common header; change dependency to libcuvs
tarang-jain Jul 5, 2024
ca45475
variable names changed
tarang-jain Jul 9, 2024
14e830d
Merge branch 'main' of https://github.com/facebookresearch/faiss into…
tarang-jain Jul 9, 2024
45c42bb
ivf-pq tests pass
tarang-jain Jul 17, 2024
c89b8f3
Merge branch 'main' of https://github.com/facebookresearch/faiss into…
tarang-jain Jul 17, 2024
a0a9b40
update caps
tarang-jain Jul 17, 2024
0106e12
fix failing tests
tarang-jain Jul 19, 2024
b7943de
Merge branch 'main' of https://github.com/facebookresearch/faiss into…
tarang-jain Jul 19, 2024
57915d4
update CMake, tests
tarang-jain Jul 19, 2024
3393d33
update github actions; conda pkg
tarang-jain Jul 19, 2024
87e2e6c
formatting; update github actions
tarang-jain Jul 19, 2024
5dad218
format
tarang-jain Jul 19, 2024
245fe20
small change to error message
tarang-jain Jul 19, 2024
1fe434a
don't need to link against raft::raft
Jul 24, 2024
b63d543
rm build.sh
Jul 24, 2024
6edead6
Merge branch 'main' into cuvs-migrate
tarang-jain Jul 25, 2024
2d9ff7d
merge latest main
tarang-jain Jul 31, 2024
a598ecb
cleanup docs; merge latest main
tarang-jain Jul 31, 2024
5794259
Merge branch 'main' into cuvs-migrate
tarang-jain Jul 31, 2024
bd01b85
Merge branch 'main' into cuvs-migrate
tarang-jain Jul 31, 2024
8f5a065
merge latest main
Aug 20, 2024
f62ed13
rm RAFT mentions
Aug 20, 2024
171979e
update action.yml
Aug 20, 2024
68b3d2d
undo some merge changes
Aug 20, 2024
bd80b31
undo some merge changes
Aug 20, 2024
a9efc3f
updates after PR reviews
Aug 27, 2024
90ccb63
Merge branch 'main' of https://github.com/facebookresearch/faiss into…
Aug 27, 2024
8d4496a
rename test_raft.py
Aug 27, 2024
3deb1e1
resolve failing Cagra test
Aug 27, 2024
4fdea22
clang-format
Aug 27, 2024
bb9bd67
Merge branch 'main' into cuvs-migrate
tarang-jain Aug 27, 2024
f723d8c
fix compilation issues
tarang-jain Aug 27, 2024
0be00b8
Merge branch 'main' into cuvs-migrate
tarang-jain Aug 31, 2024
74e21ab
resolve bfknn test failures
tarang-jain Sep 5, 2024
4feff2a
Merge branch 'main' of https://github.com/facebookresearch/faiss into…
tarang-jain Sep 5, 2024
3e097ce
Delete build.sh
tarang-jain Sep 5, 2024
15f4218
Merge branch 'main' into cuvs-migrate
tarang-jain Sep 5, 2024
141bcb9
merge upstream main
tarang-jain Sep 11, 2024
337a74a
Apply suggestions from code review
tarang-jain Sep 11, 2024
62bf7f3
update stream; dont reset handle
tarang-jain Sep 11, 2024
c75a7cc
Merge branch 'cuvs-migrate' of https://github.com/tarang-jain/faiss i…
tarang-jain Sep 11, 2024
aae6cf2
resolve compilation error
tarang-jain Sep 11, 2024
4b84f46
do not link cutlass
tarang-jain Sep 16, 2024
8bd4793
Merge branch 'main' of https://github.com/facebookresearch/faiss into…
tarang-jain Sep 16, 2024
a6f1775
link raft::raft
tarang-jain Sep 17, 2024
3ccb6d6
Merge branch 'main' of https://github.com/facebookresearch/faiss into…
tarang-jain Sep 17, 2024
c1b959c
sconditionally fndinng raft
tarang-jain Sep 17, 2024
7024c0d
Trigger Build
tarang-jain Sep 17, 2024
f207def
change link order
tarang-jain Sep 17, 2024
42dc0b7
Merge branch 'main' into cuvs-migrate
tarang-jain Sep 17, 2024
7ac798d
endif()
tarang-jain Sep 17, 2024
64d424a
Merge branch 'main' of https://github.com/facebookresearch/faiss into…
tarang-jain Sep 17, 2024
e10a05e
Merge branch 'cuvs-migrate' of https://github.com/tarang-jain/faiss i…
tarang-jain Sep 17, 2024
93172cf
change installed libcuvs version in git actions
tarang-jain Sep 19, 2024
1b183c9
Merge branch 'main' into cuvs-migrate
tarang-jain Sep 20, 2024
2691b08
Merge branch 'main' into cuvs-migrate
tarang-jain Sep 20, 2024
d4851ab
Merge branch 'main' into cuvs-migrate
tarang-jain Sep 22, 2024
54df8fa
Merge branch 'main' into cuvs-migrate
tarang-jain Sep 30, 2024
dbde0f3
dbg test, update pinned cuvs
tarang-jain Oct 1, 2024
3c775f7
update action.yml
tarang-jain Oct 1, 2024
07f8945
merge main
tarang-jain Oct 1, 2024
1d10929
Merge branch 'cuvs-migrate' of https://github.com/tarang-jain/faiss i…
tarang-jain Oct 1, 2024
a179697
rm debug statements, restore torch tests
tarang-jain Oct 2, 2024
5d998da
Merge branch 'main' into cuvs-migrate
tarang-jain Oct 7, 2024
5509c49
remove find_package(raft)
tarang-jain Oct 7, 2024
c0629c6
Merge branch 'main' of https://github.com/facebookresearch/faiss into…
tarang-jain Oct 7, 2024
43f9c3f
Merge branch 'cuvs-migrate' of https://github.com/tarang-jain/faiss i…
tarang-jain Oct 7, 2024
4a2228c
make brute_force::search compatible with 24.10
tarang-jain Oct 7, 2024
d55c553
rm raft::raft linkage
tarang-jain Oct 7, 2024
ff1555c
rm merge conflict
tarang-jain Oct 7, 2024
31c91e6
downgrade cmake version
tarang-jain Oct 7, 2024
16e23bb
rm mentions of use_raft
tarang-jain Oct 8, 2024
f472eb4
empty commit
tarang-jain Oct 8, 2024
10344a1
do not symblink sys dependencies for cuvs
tarang-jain Oct 8, 2024
b28fd89
Merge branch 'main' of https://github.com/facebookresearch/faiss into…
tarang-jain Oct 8, 2024
b1bb9ba
update torch test
tarang-jain Oct 8, 2024
3229a38
revert
tarang-jain Oct 8, 2024
3eb6a56
glibc version
tarang-jain Oct 9, 2024
80bb89c
merge upstream
tarang-jain Oct 9, 2024
abfe7f4
install cmd
tarang-jain Oct 9, 2024
26a45f2
upgrade pkgs
tarang-jain Oct 9, 2024
265fc52
link omp in tests
tarang-jain Oct 9, 2024
209048a
Xcompiler
tarang-jain Oct 9, 2024
54e772c
add raft::raft to tests cmake
tarang-jain Oct 10, 2024
4ba1389
update compile_options
tarang-jain Oct 11, 2024
5d82598
Merge branch 'main' of https://github.com/facebookresearch/faiss into…
tarang-jain Oct 11, 2024
19ddf28
downgrade to cuvs=24.08
tarang-jain Oct 11, 2024
0ab074a
action
tarang-jain Oct 12, 2024
fa6365b
Merge branch 'main' of https://github.com/facebookresearch/faiss into…
tarang-jain Oct 12, 2024
7ad8315
upgrade cmake with libcuvs=24.08
tarang-jain Oct 15, 2024
4e67ec0
Merge branch 'main' of https://github.com/facebookresearch/faiss into…
tarang-jain Oct 15, 2024
f3fb559
Merge branch 'main' into cuvs-migrate
tarang-jain Oct 15, 2024
7d52e98
merge upstream; add FIXME; rm raft::raft linkage
tarang-jain Oct 16, 2024
c23df0a
one more try with 24.10
tarang-jain Oct 16, 2024
468335f
Merge branch 'cuvs-migrate' of https://github.com/tarang-jain/faiss i…
tarang-jain Oct 16, 2024
b4989e6
one more try with 24.10
tarang-jain Oct 16, 2024
bb5cd83
rm std::nullopt
tarang-jain Oct 16, 2024
3361b44
revert changes to should_use_cuvs
tarang-jain Oct 17, 2024
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
18 changes: 9 additions & 9 deletions .github/actions/build_cmake/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,8 @@ inputs:
description: 'Enable GPU support.'
required: false
default: OFF
raft:
description: 'Enable RAFT support.'
cuvs:
description: 'Enable cuVS support.'
required: false
default: OFF
rocm:
Expand Down Expand Up @@ -50,11 +50,11 @@ runs:
if [ "${{ inputs.rocm }}" = "ON" ]; then
:
# regular CUDA for GPU builds
elif [ "${{ inputs.gpu }}" = "ON" ] && [ "${{ inputs.raft }}" = "OFF" ]; then
elif [ "${{ inputs.gpu }}" = "ON" ] && [ "${{ inputs.cuvs }}" = "OFF" ]; then
conda install -y -q cuda-toolkit -c "nvidia/label/cuda-12.4.0"
# and CUDA from RAFT channel for RAFT builds
elif [ "${{ inputs.raft }}" = "ON" ]; then
conda install -y -q libraft=24.06 cuda-version=12.4 cuda-toolkit -c rapidsai -c "nvidia/label/cuda-12.4.0" -c conda-forge
# and CUDA from cuVS channel for cuVS builds
elif [ "${{ inputs.cuvs }}" = "ON" ]; then
conda install -y -q libcuvs=24.08 cuda-version=12.4 cuda-toolkit -c rapidsai -c "nvidia/label/cuda-12.4.0" -c conda-forge
fi

# install test packages
Expand Down Expand Up @@ -106,7 +106,7 @@ runs:
shell: bash
run: ./faiss/gpu/hipify.sh
- name: Symblink system dependencies
if: inputs.raft == 'ON' || inputs.rocm == 'ON'
if: inputs.cuvs == 'ON' || inputs.rocm == 'ON'
shell: bash
run: |
# symblink system libraries for HIP compiler
Expand All @@ -123,7 +123,7 @@ runs:
-DBUILD_TESTING=ON \
-DBUILD_SHARED_LIBS=ON \
-DFAISS_ENABLE_GPU=${{ inputs.gpu }} \
-DFAISS_ENABLE_RAFT=${{ inputs.raft }} \
-DFAISS_ENABLE_CUVS=${{ inputs.cuvs }} \
-DFAISS_ENABLE_ROCM=${{ inputs.rocm }} \
-DFAISS_OPT_LEVEL=${{ inputs.opt_level }} \
-DFAISS_ENABLE_C_API=ON \
Expand Down Expand Up @@ -178,5 +178,5 @@ runs:
if: always()
uses: actions/upload-artifact@v4
with:
name: test-results-arch=${{ runner.arch }}-opt=${{ inputs.opt_level }}-gpu=${{ inputs.gpu }}-raft=${{ inputs.raft }}-rocm=${{ inputs.rocm }}
name: test-results-arch=${{ runner.arch }}-opt=${{ inputs.opt_level }}-gpu=${{ inputs.gpu }}-cuvs=${{ inputs.cuvs }}-rocm=${{ inputs.rocm }}
path: test-results
20 changes: 10 additions & 10 deletions .github/actions/build_conda/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,8 +9,8 @@ inputs:
description: "CUDA toolkit version to use."
default: ""
required: false
raft:
description: "Enable RAFT support."
cuvs:
description: "Enable cuVS support."
default: ""
required: false
runs:
Expand Down Expand Up @@ -59,34 +59,34 @@ runs:
run: |
conda build faiss --user pytorch --label ${{ inputs.label }} -c pytorch
- name: Conda build (GPU)
if: inputs.label == '' && inputs.cuda != '' && inputs.raft == ''
if: inputs.label == '' && inputs.cuda != '' && inputs.cuvs == ''
shell: ${{ steps.choose_shell.outputs.shell }}
working-directory: conda
run: |
conda build faiss-gpu --variants '{ "cudatoolkit": "${{ inputs.cuda }}" }' \
-c pytorch -c nvidia/label/cuda-${{ inputs.cuda }} -c nvidia
- name: Conda build (GPU) w/ anaconda upload
if: inputs.label != '' && inputs.cuda != '' && inputs.raft == ''
if: inputs.label != '' && inputs.cuda != '' && inputs.cuvs == ''
shell: ${{ steps.choose_shell.outputs.shell }}
working-directory: conda
env:
PACKAGE_TYPE: ${{ inputs.label }}
run: |
conda build faiss-gpu --variants '{ "cudatoolkit": "${{ inputs.cuda }}" }' \
--user pytorch --label ${{ inputs.label }} -c pytorch -c nvidia/label/cuda-${{ inputs.cuda }} -c nvidia
- name: Conda build (GPU w/ RAFT)
if: inputs.label == '' && inputs.cuda != '' && inputs.raft != ''
- name: Conda build (GPU w/ cuVS)
if: inputs.label == '' && inputs.cuda != '' && inputs.cuvs != ''
shell: ${{ steps.choose_shell.outputs.shell }}
working-directory: conda
run: |
conda build faiss-gpu-raft --variants '{ "cudatoolkit": "${{ inputs.cuda }}" }' \
conda build faiss-gpu-cuvs --variants '{ "cudatoolkit": "${{ inputs.cuda }}" }' \
-c pytorch -c nvidia/label/cuda-${{ inputs.cuda }} -c nvidia -c rapidsai -c rapidsai-nightly -c conda-forge
- name: Conda build (GPU w/ RAFT) w/ anaconda upload
if: inputs.label != '' && inputs.cuda != '' && inputs.raft != ''
- name: Conda build (GPU w/ cuVS) w/ anaconda upload
if: inputs.label != '' && inputs.cuda != '' && inputs.cuvs != ''
shell: ${{ steps.choose_shell.outputs.shell }}
working-directory: conda
env:
PACKAGE_TYPE: ${{ inputs.label }}
run: |
conda build faiss-gpu-raft --variants '{ "cudatoolkit": "${{ inputs.cuda }}" }' \
conda build faiss-gpu-cuvs --variants '{ "cudatoolkit": "${{ inputs.cuda }}" }' \
--user pytorch --label ${{ inputs.label }} -c pytorch -c nvidia/label/cuda-${{ inputs.cuda }} -c nvidia -c rapidsai -c rapidsai-nightly -c conda-forge
18 changes: 9 additions & 9 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -78,8 +78,8 @@ jobs:
uses: ./.github/actions/build_cmake
with:
gpu: ON
linux-x86_64-GPU-w-RAFT-cmake:
name: Linux x86_64 GPU w/ RAFT (cmake)
linux-x86_64-GPU-w-CUVS-cmake:
name: Linux x86_64 GPU w/ cuVS (cmake)
needs: linux-x86_64-cmake
runs-on: 4-core-ubuntu-gpu-t4
steps:
Expand All @@ -89,7 +89,7 @@ jobs:
uses: ./.github/actions/build_cmake
with:
gpu: ON
raft: ON
cuvs: ON
linux-x86_64-GPU-w-ROCm-cmake:
name: Linux x86_64 GPU w/ ROCm (cmake)
needs: linux-x86_64-cmake
Expand Down Expand Up @@ -199,8 +199,8 @@ jobs:
with:
label: main
cuda: "11.4.4"
linux-x86_64-GPU-RAFT-packages-CUDA11-8-0:
name: Linux x86_64 GPU w/ RAFT packages (CUDA 11.8.0)
linux-x86_64-GPU-CUVS-packages-CUDA11-8-0:
name: Linux x86_64 GPU w/ cuVS packages (CUDA 11.8.0)
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
runs-on: 4-core-ubuntu-gpu-t4
env:
Expand All @@ -217,7 +217,7 @@ jobs:
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }}
with:
label: main
raft: "ON"
cuvs: "ON"
cuda: "11.8.0"
linux-x86_64-GPU-packages-CUDA-12-1-1:
name: Linux x86_64 GPU packages (CUDA 12.1.1)
Expand All @@ -238,8 +238,8 @@ jobs:
with:
label: main
cuda: "12.1.1"
linux-x86_64-GPU-RAFT-packages-CUDA12-1-1:
name: Linux x86_64 GPU w/ RAFT packages (CUDA 12.1.1)
linux-x86_64-GPU-CUVS-packages-CUDA12-1-1:
name: Linux x86_64 GPU w/ cuVS packages (CUDA 12.1.1)
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
runs-on: 4-core-ubuntu-gpu-t4
env:
Expand All @@ -256,7 +256,7 @@ jobs:
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }}
with:
label: main
raft: "ON"
cuvs: "ON"
cuda: "12.1.1"
windows-x86_64-packages:
name: Windows x86_64 packages
Expand Down
12 changes: 6 additions & 6 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,8 @@ jobs:
with:
label: nightly
cuda: "11.4.4"
linux-x86_64-GPU-RAFT-CUDA11-8-0-nightly:
name: Linux x86_64 GPU w/ RAFT nightlies (CUDA 11.8.0)
linux-x86_64-GPU-CUVS-CUDA11-8-0-nightly:
name: Linux x86_64 GPU w/ cuVS nightlies (CUDA 11.8.0)
runs-on: 4-core-ubuntu-gpu-t4
env:
CUDA_ARCHS: "70-real;72-real;75-real;80;86-real"
Expand All @@ -54,7 +54,7 @@ jobs:
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }}
with:
label: nightly
raft: "ON"
cuvs: "ON"
cuda: "11.8.0"
linux-x86_64-GPU-CUDA-12-1-1-nightly:
name: Linux x86_64 GPU nightlies (CUDA 12.1.1)
Expand All @@ -73,8 +73,8 @@ jobs:
with:
label: nightly
cuda: "12.1.1"
linux-x86_64-GPU-RAFT-CUDA12-1-1-nightly:
name: Linux x86_64 GPU w/ RAFT nightlies (CUDA 12.1.1)
linux-x86_64-GPU-CUVS-CUDA12-1-1-nightly:
name: Linux x86_64 GPU w/ cuVS nightlies (CUDA 12.1.1)
runs-on: 4-core-ubuntu-gpu-t4
env:
CUDA_ARCHS: "70-real;72-real;75-real;80;86-real"
Expand All @@ -89,7 +89,7 @@ jobs:
ANACONDA_API_TOKEN: ${{ secrets.ANACONDA_API_TOKEN }}
with:
label: nightly
raft: "ON"
cuvs: "ON"
cuda: "12.1.1"
windows-x86_64-nightly:
name: Windows x86_64 nightlies
Expand Down
10 changes: 5 additions & 5 deletions CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ if(FAISS_ENABLE_GPU)
endif()
endif()

if(FAISS_ENABLE_RAFT)
if(FAISS_ENABLE_CUVS)
include(cmake/thirdparty/fetch_rapids.cmake)
include(rapids-cmake)
include(rapids-cpm)
Expand All @@ -59,7 +59,7 @@ list(APPEND CMAKE_MODULE_PATH "${PROJECT_SOURCE_DIR}/cmake")
# Valid values are "generic", "avx2", "avx512", "sve".
option(FAISS_OPT_LEVEL "" "generic")
option(FAISS_ENABLE_GPU "Enable support for GPU indexes." ON)
option(FAISS_ENABLE_RAFT "Enable RAFT for GPU indexes." OFF)
option(FAISS_ENABLE_CUVS "Enable cuVS for GPU indexes." OFF)
option(FAISS_ENABLE_ROCM "Enable ROCm for GPU indexes." OFF)
option(FAISS_ENABLE_PYTHON "Build Python extension." ON)
option(FAISS_ENABLE_C_API "Build C API." OFF)
Expand All @@ -79,9 +79,9 @@ if(FAISS_ENABLE_GPU)
endif()
endif()

if(FAISS_ENABLE_RAFT AND NOT TARGET raft::raft)
find_package(raft COMPONENTS compiled distributed)
asadoughi marked this conversation as resolved.
Show resolved Hide resolved
endif()
if(FAISS_ENABLE_CUVS AND NOT TARGET cuvs::cuvs)
find_package(cuvs)
endif()

add_subdirectory(faiss)

Expand Down
2 changes: 1 addition & 1 deletion INSTALL.md
Original file line number Diff line number Diff line change
Expand Up @@ -118,7 +118,7 @@ Several options can be passed to CMake, among which:
values are `ON` and `OFF`),
- `-DFAISS_ENABLE_PYTHON=OFF` in order to disable building python bindings
(possible values are `ON` and `OFF`),
- `-DFAISS_ENABLE_RAFT=ON` in order to enable building the RAFT implementations
asadoughi marked this conversation as resolved.
Show resolved Hide resolved
- `-DFAISS_ENABLE_CUVS=ON` in order to enable building the cuVS implementations
of the IVF-Flat and IVF-PQ GPU-accelerated indices (default is `OFF`, possible
values are `ON` and `OFF`)
- `-DBUILD_TESTING=OFF` in order to disable building C++ tests,
Expand Down
60 changes: 30 additions & 30 deletions benchs/bench_ivfflat_raft.py → benchs/bench_ivfflat_cuvs.py
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,8 @@ def aa(*args, **kwargs):
help='whether to benchmark add operation on GPU index')
aa('--bm_search', default=True,
help='whether to benchmark search operation on GPU index')
aa('--raft_only', default=False, action='store_true',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Have you run this before and after the change to determine the change (if any) in performance?

help='whether to only produce RAFT enabled benchmarks')
aa('--cuvs_only', default=False, action='store_true',
help='whether to only produce cuVS enabled benchmarks')


group = parser.add_argument_group('IVF options')
Expand All @@ -69,9 +69,9 @@ def aa(*args, **kwargs):
mr = rmm.mr.PoolMemoryResource(rmm.mr.CudaMemoryResource())
rmm.mr.set_current_device_resource(mr)

def bench_train_milliseconds(index, trainVecs, use_raft):
def bench_train_milliseconds(index, trainVecs, use_cuvs):
co = faiss.GpuMultipleClonerOptions()
co.use_raft = use_raft
co.use_cuvs = use_cuvs
index_gpu = faiss.index_cpu_to_gpu(res, 0, index, co)
t0 = time.time()
index_gpu.train(trainVecs)
Expand All @@ -88,21 +88,21 @@ def bench_train_milliseconds(index, trainVecs, use_raft):
for n_cols in dataset_dims:
index = faiss.index_factory(n_cols, "IVF{},Flat".format(args.n_centroids))
trainVecs = rs.rand(n_rows, n_cols).astype('float32')
raft_gpu_train_time = bench_train_milliseconds(
cuvs_gpu_train_time = bench_train_milliseconds(
index, trainVecs, True)
if args.raft_only:
print("Method: IVFFlat, Operation: TRAIN, dim: %d, n_centroids %d, numTrain: %d, RAFT enabled GPU train time: %.3f milliseconds" % (
n_cols, args.n_centroids, n_rows, raft_gpu_train_time))
if args.cuvs_only:
print("Method: IVFFlat, Operation: TRAIN, dim: %d, n_centroids %d, numTrain: %d, cuVS enabled GPU train time: %.3f milliseconds" % (
n_cols, args.n_centroids, n_rows, cuvs_gpu_train_time))
else:
classical_gpu_train_time = bench_train_milliseconds(
index, trainVecs, False)
print("Method: IVFFlat, Operation: TRAIN, dim: %d, n_centroids %d, numTrain: %d, classical GPU train time: %.3f milliseconds, RAFT enabled GPU train time: %.3f milliseconds" % (
n_cols, args.n_centroids, n_rows, classical_gpu_train_time, raft_gpu_train_time))
print("Method: IVFFlat, Operation: TRAIN, dim: %d, n_centroids %d, numTrain: %d, classical GPU train time: %.3f milliseconds, cuVS enabled GPU train time: %.3f milliseconds" % (
n_cols, args.n_centroids, n_rows, classical_gpu_train_time, cuvs_gpu_train_time))


def bench_add_milliseconds(index, addVecs, use_raft):
def bench_add_milliseconds(index, addVecs, use_cuvs):
co = faiss.GpuMultipleClonerOptions()
co.use_raft = use_raft
co.use_cuvs = use_cuvs
index_gpu = faiss.index_cpu_to_gpu(res, 0, index, co)
index_gpu.copyFrom(index)
t0 = time.time()
Expand All @@ -124,20 +124,20 @@ def bench_add_milliseconds(index, addVecs, use_raft):
for n_rows in addset_sizes:
for n_cols in dataset_dims:
addVecs = rs.rand(n_rows, n_cols).astype('float32')
raft_gpu_add_time = bench_add_milliseconds(index, addVecs, True)
if args.raft_only:
print("Method: IVFFlat, Operation: ADD, dim: %d, n_centroids %d, numAdd: %d, RAFT enabled GPU add time: %.3f milliseconds" % (
n_train, n_rows, n_cols, args.n_centroids, raft_gpu_add_time))
cuvs_gpu_add_time = bench_add_milliseconds(index, addVecs, True)
if args.cuvs_only:
print("Method: IVFFlat, Operation: ADD, dim: %d, n_centroids %d, numAdd: %d, cuVS enabled GPU add time: %.3f milliseconds" % (
n_train, n_rows, n_cols, args.n_centroids, cuvs_gpu_add_time))
else:
classical_gpu_add_time = bench_add_milliseconds(
index, addVecs, False)
print("Method: IVFFlat, Operation: ADD, dim: %d, n_centroids %d, numAdd: %d, classical GPU add time: %.3f milliseconds, RAFT enabled GPU add time: %.3f milliseconds" % (
n_train, n_rows, n_cols, args.n_centroids, classical_gpu_add_time, raft_gpu_add_time))
print("Method: IVFFlat, Operation: ADD, dim: %d, n_centroids %d, numAdd: %d, classical GPU add time: %.3f milliseconds, cuVS enabled GPU add time: %.3f milliseconds" % (
n_train, n_rows, n_cols, args.n_centroids, classical_gpu_add_time, cuvs_gpu_add_time))


def bench_search_milliseconds(index, addVecs, queryVecs, nprobe, k, use_raft):
def bench_search_milliseconds(index, addVecs, queryVecs, nprobe, k, use_cuvs):
co = faiss.GpuMultipleClonerOptions()
co.use_raft = use_raft
co.use_cuvs = use_cuvs
index_gpu = faiss.index_cpu_to_gpu(res, 0, index, co)
index_gpu.copyFrom(index)
index_gpu.add(addVecs)
Expand All @@ -162,19 +162,19 @@ def bench_search_milliseconds(index, addVecs, queryVecs, nprobe, k, use_raft):
addVecs = rs.rand(n_add, n_cols).astype('float32')
for n_rows in queryset_sizes:
queryVecs = rs.rand(n_rows, n_cols).astype('float32')
raft_gpu_search_time = bench_search_milliseconds(
cuvs_gpu_search_time = bench_search_milliseconds(
index, addVecs, queryVecs, args.nprobe, args.k, True)
if args.raft_only:
print("Method: IVFFlat, Operation: SEARCH, dim: %d, n_centroids: %d, numVecs: %d, numQuery: %d, nprobe: %d, k: %d, RAFT enabled GPU search time: %.3f milliseconds" % (
n_cols, args.n_centroids, n_add, n_rows, args.nprobe, args.k, raft_gpu_search_time))
if args.cuvs_only:
print("Method: IVFFlat, Operation: SEARCH, dim: %d, n_centroids: %d, numVecs: %d, numQuery: %d, nprobe: %d, k: %d, cuVS enabled GPU search time: %.3f milliseconds" % (
n_cols, args.n_centroids, n_add, n_rows, args.nprobe, args.k, cuvs_gpu_search_time))
else:
classical_gpu_search_time = bench_search_milliseconds(
index, addVecs, queryVecs, args.nprobe, args.k, False)
print("Method: IVFFlat, Operation: SEARCH, dim: %d, n_centroids: %d, numVecs: %d, numQuery: %d, nprobe: %d, k: %d, classical GPU search time: %.3f milliseconds, RAFT enabled GPU search time: %.3f milliseconds" % (
n_cols, args.n_centroids, n_add, n_rows, args.nprobe, args.k, classical_gpu_search_time, raft_gpu_search_time))
print("Method: IVFFlat, Operation: SEARCH, dim: %d, n_centroids: %d, numVecs: %d, numQuery: %d, nprobe: %d, k: %d, classical GPU search time: %.3f milliseconds, cuVS enabled GPU search time: %.3f milliseconds" % (
n_cols, args.n_centroids, n_add, n_rows, args.nprobe, args.k, classical_gpu_search_time, cuvs_gpu_search_time))

print("=" * 40)
print("Large RAFT Enabled Benchmarks")
print("Large cuVS Enabled Benchmarks")
print("=" * 40)
# Avoid classical GPU Benchmarks for large datasets because of OOM for more than 500000 queries and/or large dims as well as for large k
queryset_sizes = [100000, 500000, 1000000]
Expand All @@ -187,7 +187,7 @@ def bench_search_milliseconds(index, addVecs, queryVecs, nprobe, k, use_raft):
addVecs = rs.rand(n_add, n_cols).astype('float32')
for n_rows in queryset_sizes:
queryVecs = rs.rand(n_rows, n_cols).astype('float32')
raft_gpu_search_time = bench_search_milliseconds(
cuvs_gpu_search_time = bench_search_milliseconds(
index, addVecs, queryVecs, args.nprobe, args.k, True)
print("Method: IVFFlat, Operation: SEARCH, numTrain: %d, dim: %d, n_centroids: %d, numVecs: %d, numQuery: %d, nprobe: %d, k: %d, RAFT enabled GPU search time: %.3f milliseconds" % (
n_cols, args.n_centroids, n_add, n_rows, args.nprobe, args.k, raft_gpu_search_time))
print("Method: IVFFlat, Operation: SEARCH, numTrain: %d, dim: %d, n_centroids: %d, numVecs: %d, numQuery: %d, nprobe: %d, k: %d, cuVS enabled GPU search time: %.3f milliseconds" % (
n_cols, args.n_centroids, n_add, n_rows, args.nprobe, args.k, cuvs_gpu_search_time))
Loading
Loading