-
Notifications
You must be signed in to change notification settings - Fork 539
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Migrate to use cuVS for vector search (#6085)
This PR updates to use cuVS instead of RAFT for vector search, pairwise distances and clustering. This is required for us to deprecate the vector search functionality in RAFT, in favour of the code in cuVS. Because some code hasn't been migrated over to cuvs yet, we will continue to use the version in RAFT - but with RAFT in header only mode. In particular this functionality will be used in RAFT header only mode: * Random Ball Cover (see rapidsai/cuvs#218) * Sparse KNN * nn-descent rapidsai/cuvs#364 * [MetricProcessor](c7d1b0e) * knn_merge_parts * build_dendrogram_host * build_sorted_mst * raft DistanceType Because sparse KNN in RAFT uses the DistanceType in RAFT, we can't fully move over to use the DistanceType code in cuVS with this PR. (Also the DistanceType code in RAFT has a `Precomputed` option that isn't available in cuvs - but is needed by cuml for dbscan.) This means that we have both the raft and cuvs DistanceType enum's in use with this change, with conversions between them. Authors: - Ben Frederickson (https://github.com/benfred) - Bradley Dice (https://github.com/bdice) - Kyle Edwards (https://github.com/KyleFromNVIDIA) - Corey J. Nolet (https://github.com/cjnolet) Approvers: - Corey J. Nolet (https://github.com/cjnolet) - Dante Gama Dessavre (https://github.com/dantegd) - Bradley Dice (https://github.com/bdice) URL: #6085
- Loading branch information
Showing
71 changed files
with
694 additions
and
2,570 deletions.
There are no files selected for viewing
This file contains 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 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 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 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 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 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 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 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 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 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 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 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,77 @@ | ||
#============================================================================= | ||
# Copyright (c) 2024, NVIDIA CORPORATION. | ||
# | ||
# Licensed under the Apache License, Version 2.0 (the "License"); | ||
# you may not use this file except in compliance with the License. | ||
# You may obtain a copy of the License at | ||
# | ||
# http://www.apache.org/licenses/LICENSE-2.0 | ||
# | ||
# Unless required by applicable law or agreed to in writing, software | ||
# distributed under the License is distributed on an "AS IS" BASIS, | ||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
# See the License for the specific language governing permissions and | ||
# limitations under the License. | ||
#============================================================================= | ||
|
||
set(CUML_MIN_VERSION_cuvs "${CUML_VERSION_MAJOR}.${CUML_VERSION_MINOR}.00") | ||
set(CUML_BRANCH_VERSION_cuvs "${CUML_VERSION_MAJOR}.${CUML_VERSION_MINOR}") | ||
|
||
function(find_and_configure_cuvs) | ||
set(oneValueArgs VERSION FORK PINNED_TAG EXCLUDE_FROM_ALL USE_CUVS_STATIC COMPILE_LIBRARY CLONE_ON_PIN) | ||
cmake_parse_arguments(PKG "${options}" "${oneValueArgs}" | ||
"${multiValueArgs}" ${ARGN} ) | ||
|
||
if(PKG_CLONE_ON_PIN AND NOT PKG_PINNED_TAG STREQUAL "branch-${CUML_BRANCH_VERSION_cuvs}") | ||
message(STATUS "CUML: CUVS pinned tag found: ${PKG_PINNED_TAG}. Cloning cuvs locally.") | ||
set(CPM_DOWNLOAD_cuvs ON) | ||
elseif(PKG_USE_CUVS_STATIC AND (NOT CPM_cuvs_SOURCE)) | ||
message(STATUS "CUML: Cloning cuvs locally to build static libraries.") | ||
set(CPM_DOWNLOAD_cuvs ON) | ||
else() | ||
message(STATUS "Not cloning cuvs locally") | ||
endif() | ||
|
||
if(PKG_USE_CUVS_STATIC) | ||
set(CUVS_LIB cuvs::cuvs_static PARENT_SCOPE) | ||
else() | ||
set(CUVS_LIB cuvs::cuvs PARENT_SCOPE) | ||
endif() | ||
|
||
rapids_cpm_find(cuvs ${PKG_VERSION} | ||
GLOBAL_TARGETS cuvs::cuvs | ||
BUILD_EXPORT_SET cuml-exports | ||
INSTALL_EXPORT_SET cuml-exports | ||
CPM_ARGS | ||
GIT_REPOSITORY https://github.com/${PKG_FORK}/cuvs.git | ||
GIT_TAG ${PKG_PINNED_TAG} | ||
SOURCE_SUBDIR cpp | ||
EXCLUDE_FROM_ALL ${PKG_EXCLUDE_FROM_ALL} | ||
OPTIONS | ||
"BUILD_TESTS OFF" | ||
"BUILD_BENCH OFF" | ||
) | ||
|
||
if(cuvs_ADDED) | ||
message(VERBOSE "CUML: Using CUVS located in ${cuvs_SOURCE_DIR}") | ||
else() | ||
message(VERBOSE "CUML: Using CUVS located in ${cuvs_DIR}") | ||
endif() | ||
|
||
|
||
endfunction() | ||
|
||
# Change pinned tag here to test a commit in CI | ||
# To use a different CUVS locally, set the CMake variable | ||
# CPM_cuvs_SOURCE=/path/to/local/cuvs | ||
find_and_configure_cuvs(VERSION ${CUML_MIN_VERSION_cuvs} | ||
FORK rapidsai | ||
PINNED_TAG branch-${CUML_BRANCH_VERSION_cuvs} | ||
EXCLUDE_FROM_ALL ${CUML_EXCLUDE_CUVS_FROM_ALL} | ||
# When PINNED_TAG above doesn't match cuml, | ||
# force local cuvs clone in build directory | ||
# even if it's already installed. | ||
CLONE_ON_PIN ${CUML_CUVS_CLONE_ON_PIN} | ||
COMPILE_LIBRARY ${CUML_CUVS_COMPILED} | ||
USE_CUVS_STATIC ${CUML_USE_CUVS_STATIC} | ||
) |
This file contains 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 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 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 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.