Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
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
25 changes: 22 additions & 3 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,11 @@ option(DISABLE_OPENMP "Disable OpenMP" OFF)
option(CUVS_COMPILE_DYNAMIC_ONLY "Only build the shared library and skip the static library." OFF)
option(CUVS_NVTX "Enable nvtx markers" OFF)
option(CUVS_RAFT_CLONE_ON_PIN "Explicitly clone RAFT branch when pinned to non-feature branch" ON)
option(CUVS_ENABLE_FLOWANN_SEARCH "Enable experimental FlowANN tiered-graph search" OFF)

if(CUVS_ENABLE_FLOWANN_SEARCH AND BUILD_CPU_ONLY)
message(FATAL_ERROR "CUVS_ENABLE_FLOWANN_SEARCH requires a CUDA-enabled build")
endif()
if(BUILD_CPU_ONLY)
set(BUILD_SHARED_LIBS OFF)
set(BUILD_TESTS OFF)
Expand Down Expand Up @@ -113,7 +117,6 @@ elseif(NOT BUILD_SHARED_LIBS)
set(cuvs_compile_mode "static_only")
set(_cuvs_lib_targets cuvs_static)
endif()

# Needed because GoogleBenchmark changes the state of FindThreads.cmake, causing subsequent runs to
# have different values for the `Threads::Threads` target. Setting this flag ensures
# `Threads::Threads` is the same value across all builds so that cache hits occur
Expand All @@ -127,6 +130,7 @@ message(VERBOSE "cuVS: Build cuVS unit-tests: ${BUILD_TESTS}")
message(VERBOSE "cuVS: Build CPU only components: ${BUILD_CPU_ONLY}")
message(VERBOSE "cuVS: Build ANN benchmarks: ${BUILD_CUVS_BENCH}")
message(VERBOSE "cuVS: Build only the shared library: ${CUVS_COMPILE_DYNAMIC_ONLY}")
message(VERBOSE "cuVS: Enable FlowANN tiered-graph search: ${CUVS_ENABLE_FLOWANN_SEARCH}")
message(VERBOSE "cuVS: Enable detection of conda environment for dependencies: ${DETECT_CONDA_ENV}")
message(VERBOSE "cuVS: Disable deprecation warnings " ${DISABLE_DEPRECATION_WARNINGS})
message(VERBOSE "cuVS: Disable OpenMP: ${DISABLE_OPENMP}")
Expand Down Expand Up @@ -169,6 +173,7 @@ if(NOT BUILD_CPU_ONLY)
BUILD_EXPORT_SET cuvs-exports
INSTALL_EXPORT_SET cuvs-exports
)

else()
add_compile_definitions(BUILD_CPU_ONLY)
endif()
Expand Down Expand Up @@ -233,6 +238,9 @@ if(NOT BUILD_CPU_ONLY)
"$<BUILD_INTERFACE:${CMAKE_CURRENT_BINARY_DIR}/include>"
"$<INSTALL_INTERFACE:include>"
)
target_compile_definitions(
cuvs_cpp_headers INTERFACE $<$<BOOL:${CUVS_ENABLE_FLOWANN_SEARCH}>:CUVS_ENABLE_FLOWANN_SEARCH>
)
target_link_libraries(cuvs_cpp_headers INTERFACE raft::raft rmm::rmm)

generate_inst_matrix(
Expand Down Expand Up @@ -1486,6 +1494,8 @@ if(NOT BUILD_CPU_ONLY)
src/neighbors/brute_force.cu
src/neighbors/brute_force_serialize.cu
src/neighbors/cagra.cpp
$<$<BOOL:${CUVS_ENABLE_FLOWANN_SEARCH}>:src/neighbors/flowann.cu>
$<$<BOOL:${CUVS_ENABLE_FLOWANN_SEARCH}>:src/neighbors/flowann_queue.cpp>
${cagra_build_inst_files}
${cagra_extend_inst_files}
src/neighbors/cagra_optimize.cu
Expand Down Expand Up @@ -1592,6 +1602,7 @@ if(NOT BUILD_CPU_ONLY)
"$<$<AND:$<COMPILE_LANGUAGE:CUDA>,$<CONFIG:Debug>>:${CUVS_DEBUG_CUDA_FLAGS}>"
)


target_compile_definitions(
cuvs_objs
PRIVATE CUVS_CUTILE_ENABLED=${CUVS_CUTILE_ENABLED}
Expand Down Expand Up @@ -1687,10 +1698,18 @@ if(NOT BUILD_CPU_ONLY)
$<BUILD_LOCAL_INTERFACE:$<TARGET_NAME_IF_EXISTS:NCCL::NCCL>>
$<BUILD_LOCAL_INTERFACE:$<TARGET_NAME_IF_EXISTS:hnswlib::hnswlib>>
$<$<BOOL:${CUVS_NVTX}>:CUDA::nvtx3>
PRIVATE $<TARGET_NAME_IF_EXISTS:OpenMP::OpenMP_CXX> $<COMPILE_ONLY:nvidia::cutlass::cutlass>
$<COMPILE_ONLY:cuco::cuco> CUDA::nvJitLink CUDA::nvrtc rtcx::rtcx kvikio::kvikio
PRIVATE $<TARGET_NAME_IF_EXISTS:OpenMP::OpenMP_CXX>
$<COMPILE_ONLY:nvidia::cutlass::cutlass>
$<COMPILE_ONLY:cuco::cuco>
CUDA::nvJitLink
CUDA::nvrtc
rtcx::rtcx
kvikio::kvikio
INTERFACE $<LINK_ONLY:kvikio::kvikio>
)
if(CUVS_ENABLE_FLOWANN_SEARCH)
target_link_libraries(cuvs INTERFACE $<LINK_ONLY:$<TARGET_NAME_IF_EXISTS:OpenMP::OpenMP_CXX>>)
endif()

endif()

Expand Down

Large diffs are not rendered by default.

Loading
Loading