-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Integrate RAFT FlatIndex / Distances #2707
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
Closed
Closed
Changes from 83 commits
Commits
Show all changes
109 commits
Select commit
Hold shift + click to select a range
861d194
For #669. Adding install target to gpu Makefile
cjnolet 60d654f
Starting integration of raft
cjnolet d474bf3
Adding proper inherited member definitions
cjnolet 8baee52
Updating raft ivf flat
cjnolet 2eb94f1
adding raftIVFFlat implementation
cjnolet f7d4185
Isolating quantizer training
cjnolet 26491cb
iAdding todos where we need to plug in raft functionality
cjnolet b4d08c4
Invocatino of index building has been compiled successfully. Still ne…
cjnolet bf876f9
Adding call to search.
cjnolet 9b1fc84
Adding stubs for remaining calls that need to be made from RAFT side in
cjnolet 884bfa5
iUpdating function calls for copyFrom to include populating the quant…
cjnolet 0958d2e
Implement some helpers
achirkin b7144a9
Make it compile
achirkin 38733bb
Make the tests to not crash... sometimes
achirkin 881fbc3
Merge pull request #1 from achirkin/raft_ivf_flat
cjnolet 173c459
Updates
cjnolet 8b7afe0
Merge branch 'raft_ivf_flat' of github.com:cjnolet/faiss into raft_iv…
cjnolet 548e0f0
More updates
cjnolet baa34d7
One test running so far.
cjnolet edc5991
Setting add_data_on_build = false;
cjnolet 10f89b4
Copying centroids directly and adding some prints for the test outputs
cjnolet 7c69020
reconstructions seems to be reasonable
cjnolet 8be7746
iUpdates to tests to compare against brute force as ground truth
cjnolet 933582a
Starting to look at resulting runtimes in raft ivf flat tests
cjnolet d2a6541
Adding timing info to raft test
cjnolet 986407a
Updating for rapids-cmake updates and RAFT updates
cjnolet ae4ed98
Adding RaftIndexIVFPQ
cjnolet d8894b8
Merge branch 'main' into raft_integration
cjnolet 410b2c6
Updates
cjnolet d7ca6b4
Adding FAISS_ENABLE_RAFT option to INSTALL.md
cjnolet 9875dad
Making build.sh work for quick building of proposal
cjnolet 60388dc
Merge branch 'main' into raft_integration
cjnolet c09d09b
Merging upstream
cjnolet 0081ed9
Integrating more deeply with `use_raft` option in the index config that
cjnolet a7e0cdd
IVF Flat
cjnolet fbf7e34
More updates
cjnolet a9b6963
Getting things building again. Adding raft handle to gpu resources.
cjnolet b640ba8
Getting FAISS building again w/ RaftIVFFlat
cjnolet af6d1e9
Adding the append vectors to raft index IVF flat.
cjnolet 545b3d2
Add ing flatindex for the fused l2 knn
cjnolet 2ac5a5b
Validating dispatch of flatindex
cjnolet 68944a5
1. Verified FlatIndex tests are passing (and using RAFT for k<=64 L2 …
cjnolet 3a37031
Calling train() on copyFrom() with reconstructed vectors and filling in
cjnolet 3f51425
IVFFlat gtests run through to completion without crash. Distances look
cjnolet db1801e
Some of the IVFFlat tests are passing.
cjnolet f0bbd41
CLeaning up the diff a bit
cjnolet f7da008
Removing the RaftIndex* files.
cjnolet 5ab762b
Using current raft 22.12
cjnolet 3684cd3
Checking in a little cleanup
cjnolet 35a46b2
Disabling raft from pulling in nn dependencies (e.g. faiss)
cjnolet eb9f6e9
Merge branch 'main' into raft_integration
cjnolet e7bf2e5
Updating raft for 23.02. Still working on failing tests.
cjnolet a8e2ad0
Isolating differences in results- it looks like it's related to the s…
cjnolet f19fd00
Add and query results appear to match well. LargeBatch tests are fail…
cjnolet 3ff97ab
Merge branch 'main' into raft_integration
cjnolet 1d2baed
Merge branch 'main' into raft_integration
cjnolet 6269ed1
Using facebook for licenses in cmake files
cjnolet b13593a
Adding small note to build.sh that the file is temporary.
cjnolet 81fbe64
Merge branch 'main' into raft_integration
cjnolet 333761c
Merge branch 'main' into raft_integration
cjnolet bc8885d
Fixing style
cjnolet 093579b
Merge branch 'master' into raft_integration
cjnolet 10f8080
Merge branch 'raft_integration' of github.com:cjnolet/faiss into raft…
cjnolet 19f38d4
Second pass of fixing formatting
cjnolet 17df798
Third pass at fixing format style
cjnolet 2993441
Adding nvidia license for traceability
cjnolet 5e7eb6d
Updates
cjnolet d1b0036
Merge remote-tracking branch 'faiss/main' into raft_integration
cjnolet ddc75ac
Merging
cjnolet 4ada77c
Merge branch 'main' into raft_integration
cjnolet ccc3bad
Merge branch 'main' into raft_integration
cjnolet 4ab77fe
Just integrating flat for now. Using USE_NVIDIA_RAFT variable
cjnolet 5e10532
Setting cmake standard to 11 if raft is not enabled
cjnolet f24d1f8
Reverting some of the ivf changes
cjnolet c8eb265
Clang format
cjnolet f4fcc5c
More updates. Removing raft ivf flat for now
cjnolet 67786b2
Removing gpu/makefile checked in by mistake
cjnolet 76ea55f
Removing test_contrib.py (checked in by mistake)
cjnolet 79a7e11
Removing testutils (checked in by mistake)
cjnolet f84573f
More formatting
cjnolet d14ff83
Adding new bfknn implementation to flatindex
cjnolet d46a379
So far things are looking good but we still have a little work to do …
cjnolet 6000993
Integrating w/ GpuDistance.cu. Adding raft to gpudistance and flat in…
cjnolet 8dc29d5
Implementing some review feedback
cjnolet 51ee05b
Adding rmm gpu resources.
cjnolet c679a32
Integrating rmm gpu resources into standard gpu resources
cjnolet 9b3121e
Making sure GpuIndexFlat is only using RAFT when it's supposed to
cjnolet eec4a21
Merge branch 'main' into integrate_raft_flat
cjnolet c3d3afa
Enabling remaining GpuDistance tests for RAFT. 3 failing tests remain:
cjnolet 400ed47
Merge branch 'integrate_raft_flat' of github.com:cjnolet/faiss into i…
cjnolet a354d44
Almost all the Flat and Distance tests are passing!
cjnolet a984d83
More tests passing. Still need to investigate why L2_float16 flat tes…
cjnolet 8a61c39
Reverting unecessary change in TestGpuIndexFlat.cpp
cjnolet 9b21ce2
Adding nvidia license to all modified files for tracking.
cjnolet 2074e1d
Merge branch 'main' into integrate_raft_flat
cjnolet 2dac056
Merge branch 'main' into integrate_raft_flat
cjnolet eec1c06
Merge branch 'main' into integrate_raft_flat
cjnolet 9cd4f62
Merge branch 'main' into integrate_raft_flat
algoriddle fc643b3
Update GpuIndexFlat.cu
algoriddle a5c0c97
Update TestGpuIndexFlat.cpp
algoriddle 3c45f78
Merge branch 'main' into integrate_raft_flat
algoriddle 7e28a8b
Changing fork/pinned tag to rapids 23.04
cjnolet 7180c89
Merge branch 'integrate_raft_flat' of github.com:cjnolet/faiss into i…
cjnolet ff803ec
Merge branch 'main' into integrate_raft_flat
algoriddle 44c0c5e
merging internal version
algoriddle b1c05d0
add untracked
algoriddle 009f77c
Merge branch 'main' into pr_2707
algoriddle 8545c07
remove build.sh
algoriddle c6386f6
code format
algoriddle File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,52 @@ | ||
| #!/bin/bash | ||
|
|
||
| # NOTE: This file is temporary for the proof-of-concept branch and will be removed before this PR is merged | ||
|
|
||
| BUILD_TYPE=Release | ||
| BUILD_DIR=build/ | ||
|
|
||
| RAFT_REPO_REL="" | ||
| EXTRA_CMAKE_ARGS="" | ||
| set -e | ||
|
|
||
| if [[ ${RAFT_REPO_REL} != "" ]]; then | ||
| RAFT_REPO_PATH="`readlink -f \"${RAFT_REPO_REL}\"`" | ||
| EXTRA_CMAKE_ARGS="${EXTRA_CMAKE_ARGS} -DCPM_raft_SOURCE=${RAFT_REPO_PATH}" | ||
| fi | ||
|
|
||
| if [ "$1" == "clean" ]; then | ||
| rm -rf build | ||
| exit 0 | ||
| fi | ||
|
|
||
| if [ "$1" == "test" ]; then | ||
| make -C build -j test | ||
| exit 0 | ||
| fi | ||
|
|
||
| if [ "$1" == "test-raft" ]; then | ||
| ./build/faiss/gpu/test/TestRaftIndexIVFFlat | ||
| exit 0 | ||
| fi | ||
|
|
||
| mkdir -p $BUILD_DIR | ||
| cd $BUILD_DIR | ||
|
|
||
| cmake \ | ||
| -DFAISS_ENABLE_GPU=ON \ | ||
| -DFAISS_ENABLE_RAFT=ON \ | ||
| -DFAISS_ENABLE_PYTHON=OFF \ | ||
| -DBUILD_TESTING=ON \ | ||
| -DBUILD_SHARED_LIBS=OFF \ | ||
| -DCMAKE_BUILD_TYPE=${BUILD_TYPE} \ | ||
| -DFAISS_OPT_LEVEL=avx2 \ | ||
| -DRAFT_NVTX=OFF \ | ||
| -DCMAKE_CUDA_ARCHITECTURES="NATIVE" \ | ||
| -DCMAKE_EXPORT_COMPILE_COMMANDS=ON \ | ||
| -DCMAKE_CUDA_COMPILER_LAUNCHER=ccache \ | ||
| -DCMAKE_C_COMPILER_LAUNCHER=ccache \ | ||
| -DCMAKE_CXX_COMPILER_LAUNCHER=ccache \ | ||
| ${EXTRA_CMAKE_ARGS} \ | ||
| ../ | ||
|
|
||
| cmake --build . -j12 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,12 @@ | ||
| # Copyright (c) Facebook, Inc. and its affiliates. | ||
| # | ||
| # This source code is licensed under the MIT license found in the | ||
| # LICENSE file in the root directory of this source tree. | ||
|
|
||
| set(RAPIDS_VERSION "23.02") | ||
|
|
||
| if(NOT EXISTS ${CMAKE_CURRENT_BINARY_DIR}/FAISS_RAPIDS.cmake) | ||
| file(DOWNLOAD https://raw.githubusercontent.com/rapidsai/rapids-cmake/branch-${RAPIDS_VERSION}/RAPIDS.cmake | ||
| ${CMAKE_CURRENT_BINARY_DIR}/FAISS_RAPIDS.cmake) | ||
| endif() | ||
| include(${CMAKE_CURRENT_BINARY_DIR}/FAISS_RAPIDS.cmake) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,40 @@ | ||
| # Copyright (c) Facebook, Inc. and its affiliates. | ||
| # | ||
| # This source code is licensed under the MIT license found in the | ||
| # LICENSE file in the root directory of this source tree. | ||
|
|
||
| set(RAFT_VERSION "${RAPIDS_VERSION}") | ||
| set(RAFT_FORK "benfred") | ||
| set(RAFT_PINNED_TAG "bfknn")#"branch-${RAPIDS_VERSION}") | ||
|
|
||
| function(find_and_configure_raft) | ||
| set(oneValueArgs VERSION FORK PINNED_TAG) | ||
| cmake_parse_arguments(PKG "${options}" "${oneValueArgs}" | ||
| "${multiValueArgs}" ${ARGN} ) | ||
|
|
||
| #----------------------------------------------------- | ||
| # Invoke CPM find_package() | ||
| #----------------------------------------------------- | ||
| rapids_cpm_find(raft ${PKG_VERSION} | ||
| GLOBAL_TARGETS raft::raft | ||
| BUILD_EXPORT_SET faiss-exports | ||
| INSTALL_EXPORT_SET faiss-exports | ||
| CPM_ARGS | ||
| GIT_REPOSITORY https://github.com/${PKG_FORK}/raft.git | ||
| GIT_TAG ${PKG_PINNED_TAG} | ||
| SOURCE_SUBDIR cpp | ||
| OPTIONS | ||
| "BUILD_TESTS OFF" | ||
| "BUILD_BENCH OFF" | ||
| "RAFT_COMPILE_LIBRARIES OFF" | ||
| "RAFT_ENABLE_NN_DEPENDENCIES OFF" | ||
| ) | ||
| endfunction() | ||
|
|
||
| # Change pinned tag here to test a commit in CI | ||
| # To use a different RAFT locally, set the CMake variable | ||
| # CPM_raft_SOURCE=/path/to/local/raft | ||
| find_and_configure_raft(VERSION ${RAFT_VERSION}.00 | ||
| FORK ${RAFT_FORK} | ||
| PINNED_TAG ${RAFT_PINNED_TAG} | ||
| ) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.