forked from rapidsai/cuml
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathget_cuvs.cmake
More file actions
84 lines (73 loc) · 3.1 KB
/
get_cuvs.cmake
File metadata and controls
84 lines (73 loc) · 3.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
#=============================================================================
# Copyright (c) 2024-2025, 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")
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 "${rapids-cmake-checkout-tag}")
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()
set(CUVS_BUILD_MG_ALGOS ON)
if(SINGLEGPU)
set(CUVS_BUILD_MG_ALGOS OFF)
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_CAGRA_HNSWLIB OFF"
"BUILD_CUVS_BENCH OFF"
"BUILD_MG_ALGOS ${CUVS_BUILD_MG_ALGOS}"
)
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 ${rapids-cmake-checkout-tag}
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}
)