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

Adapt to rmm logger changes #499

Merged
merged 22 commits into from
Nov 30, 2024
Merged
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
9 changes: 5 additions & 4 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -480,12 +480,13 @@ if(BUILD_SHARED_LIBS)
"$<$<COMPILE_LANGUAGE:CUDA>:${CUVS_CUDA_FLAGS}>"
)
target_link_libraries(
cuvs_objs PUBLIC raft::raft rmm::rmm ${CUVS_CTK_MATH_DEPENDENCIES}
cuvs_objs PUBLIC raft::raft rmm::rmm rmm::rmm_logger ${CUVS_CTK_MATH_DEPENDENCIES}
$<TARGET_NAME_IF_EXISTS:OpenMP::OpenMP_CXX>
PRIVATE rmm::rmm_logger_impl
)

add_library(cuvs SHARED $<TARGET_OBJECTS:cuvs_objs>)
add_library(cuvs_static STATIC $<TARGET_OBJECTS:cuvs_objs>)
add_library(cuvs SHARED $<FILTER:$<TARGET_OBJECTS:cuvs_objs>,EXCLUDE,rmm.*logger>)
add_library(cuvs_static STATIC $<FILTER:$<TARGET_OBJECTS:cuvs_objs>,EXCLUDE,rmm.*logger>)

target_compile_options(
cuvs INTERFACE $<$<COMPILE_LANG_AND_ID:CUDA,NVIDIA>:--expt-extended-lambda
Expand Down Expand Up @@ -696,7 +697,7 @@ target_compile_definitions(cuvs::cuvs INTERFACE $<$<BOOL:${CUVS_NVTX}>:NVTX_ENAB
target_link_libraries(
cuvs_c
PUBLIC cuvs::cuvs ${CUVS_CTK_MATH_DEPENDENCIES}
PRIVATE raft::raft
PRIVATE raft::raft rmm::rmm_logger_impl
)

# ensure CUDA symbols aren't relocated to the middle of the debug build binaries
Expand Down
8 changes: 7 additions & 1 deletion cpp/bench/ann/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ function(ConfigureAnnBench)
$<$<BOOL:${GPU_BUILD}>:CUDA::cudart_static>
$<TARGET_NAME_IF_EXISTS:OpenMP::OpenMP_CXX>
$<TARGET_NAME_IF_EXISTS:conda_env>
$<TARGET_NAME_IF_EXISTS:cuvs_bench_rmm_logger>
)

set_target_properties(
Expand Down Expand Up @@ -174,6 +175,11 @@ function(ConfigureAnnBench)
add_dependencies(CUVS_ANN_BENCH_ALL ${BENCH_NAME})
endfunction()

if(CUVS_FAISS_ENABLE_GPU)
add_library(cuvs_bench_rmm_logger OBJECT)
target_link_libraries(cuvs_bench_rmm_logger PRIVATE rmm::rmm_logger_impl)
endif()

# ##################################################################################################
# * Configure benchmark targets -------------------------------------------------------------

Expand Down Expand Up @@ -300,7 +306,7 @@ if(CUVS_ANN_BENCH_SINGLE_EXE)
target_link_libraries(
ANN_BENCH
PRIVATE raft::raft nlohmann_json::nlohmann_json benchmark::benchmark dl fmt::fmt-header-only
spdlog::spdlog_header_only $<$<TARGET_EXISTS:CUDA::nvtx3>:CUDA::nvtx3>
spdlog::spdlog_header_only $<$<TARGET_EXISTS:CUDA::nvtx3>:CUDA::nvtx3> rmm::rmm_logger_impl
)
set_target_properties(
ANN_BENCH
Expand Down
4 changes: 4 additions & 0 deletions cpp/test/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -49,6 +49,7 @@ function(ConfigureTest)
PRIVATE cuvs
cuvs::cuvs
raft::raft
test_rmm_logger
GTest::gtest
GTest::gtest_main
Threads::Threads
Expand Down Expand Up @@ -87,6 +88,9 @@ function(ConfigureTest)
)
endfunction()

add_library(test_rmm_logger OBJECT)
target_link_libraries(test_rmm_logger PRIVATE rmm::rmm_logger_impl)

# ##################################################################################################
# test sources ##################################################################################
# ##################################################################################################
Expand Down
13 changes: 8 additions & 5 deletions examples/cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,13 @@ add_executable(VAMANA_EXAMPLE src/vamana_example.cu)

# `$<TARGET_NAME_IF_EXISTS:conda_env>` is a generator expression that ensures that targets are
# installed in a conda environment, if one exists
target_link_libraries(CAGRA_EXAMPLE PRIVATE cuvs::cuvs $<TARGET_NAME_IF_EXISTS:conda_env>)
add_library(rmm_logger OBJECT)
target_link_libraries(rmm_logger PRIVATE rmm::rmm_logger_impl)

target_link_libraries(CAGRA_EXAMPLE PRIVATE cuvs::cuvs $<TARGET_NAME_IF_EXISTS:conda_env> rmm_logger)
target_link_libraries(
CAGRA_PERSISTENT_EXAMPLE PRIVATE cuvs::cuvs $<TARGET_NAME_IF_EXISTS:conda_env> Threads::Threads
CAGRA_PERSISTENT_EXAMPLE PRIVATE cuvs::cuvs $<TARGET_NAME_IF_EXISTS:conda_env> Threads::Threads rmm_logger
)
target_link_libraries(IVF_PQ_EXAMPLE PRIVATE cuvs::cuvs $<TARGET_NAME_IF_EXISTS:conda_env>)
target_link_libraries(IVF_FLAT_EXAMPLE PRIVATE cuvs::cuvs $<TARGET_NAME_IF_EXISTS:conda_env>)
target_link_libraries(VAMANA_EXAMPLE PRIVATE cuvs::cuvs $<TARGET_NAME_IF_EXISTS:conda_env>)
target_link_libraries(IVF_PQ_EXAMPLE PRIVATE cuvs::cuvs $<TARGET_NAME_IF_EXISTS:conda_env> rmm_logger)
target_link_libraries(IVF_FLAT_EXAMPLE PRIVATE cuvs::cuvs $<TARGET_NAME_IF_EXISTS:conda_env> rmm_logger)
target_link_libraries(VAMANA_EXAMPLE PRIVATE cuvs::cuvs $<TARGET_NAME_IF_EXISTS:conda_env> rmm_logger)
3 changes: 3 additions & 0 deletions python/cuvs/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -110,6 +110,9 @@ endif()

rapids_cython_init()

add_library(cuvs_rmm_logger OBJECT)
target_link_libraries(cuvs_rmm_logger PRIVATE rmm::rmm_logger_impl)

add_subdirectory(cuvs/common)
add_subdirectory(cuvs/distance)
add_subdirectory(cuvs/neighbors)
Expand Down
4 changes: 4 additions & 0 deletions python/cuvs/cuvs/common/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ rapids_cython_create_modules(
SOURCE_FILES "${cython_sources}"
LINKED_LIBRARIES "${linked_libraries}" ASSOCIATED_TARGETS cuvs MODULE_PREFIX common_
)

foreach(tgt IN LISTS RAPIDS_CYTHON_CREATED_TARGETS)
target_link_libraries(${tgt} PRIVATE cuvs_rmm_logger)
endforeach()
4 changes: 4 additions & 0 deletions python/cuvs/cuvs/distance/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ rapids_cython_create_modules(
SOURCE_FILES "${cython_sources}"
LINKED_LIBRARIES "${linked_libraries}" ASSOCIATED_TARGETS cuvs MODULE_PREFIX distance_
)

foreach(tgt IN LISTS RAPIDS_CYTHON_CREATED_TARGETS)
target_link_libraries(${tgt} PRIVATE cuvs_rmm_logger)
endforeach()
4 changes: 4 additions & 0 deletions python/cuvs/cuvs/neighbors/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -29,3 +29,7 @@ rapids_cython_create_modules(
SOURCE_FILES "${cython_sources}"
LINKED_LIBRARIES "${linked_libraries}" ASSOCIATED_TARGETS cuvs MODULE_PREFIX neighbors_refine_
)

foreach(tgt IN LISTS RAPIDS_CYTHON_CREATED_TARGETS)
target_link_libraries(${tgt} PRIVATE cuvs_rmm_logger)
endforeach()
4 changes: 4 additions & 0 deletions python/cuvs/cuvs/neighbors/brute_force/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -23,3 +23,7 @@ rapids_cython_create_modules(
LINKED_LIBRARIES "${linked_libraries}" ASSOCIATED_TARGETS cuvs MODULE_PREFIX
neighbors_brute_force_
)

foreach(tgt IN LISTS RAPIDS_CYTHON_CREATED_TARGETS)
target_link_libraries(${tgt} PRIVATE cuvs_rmm_logger)
endforeach()
4 changes: 4 additions & 0 deletions python/cuvs/cuvs/neighbors/cagra/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ rapids_cython_create_modules(
SOURCE_FILES "${cython_sources}"
LINKED_LIBRARIES "${linked_libraries}" ASSOCIATED_TARGETS cuvs MODULE_PREFIX neighbors_cagra_
)

foreach(tgt IN LISTS RAPIDS_CYTHON_CREATED_TARGETS)
target_link_libraries(${tgt} PRIVATE cuvs_rmm_logger)
endforeach()
4 changes: 4 additions & 0 deletions python/cuvs/cuvs/neighbors/filters/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ rapids_cython_create_modules(
SOURCE_FILES "${cython_sources}"
LINKED_LIBRARIES "${linked_libraries}" ASSOCIATED_TARGETS cuvs MODULE_PREFIX neighbors_prefilter_
)

foreach(tgt IN LISTS RAPIDS_CYTHON_CREATED_TARGETS)
target_link_libraries(${tgt} PRIVATE cuvs_rmm_logger)
endforeach()
4 changes: 4 additions & 0 deletions python/cuvs/cuvs/neighbors/hnsw/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ rapids_cython_create_modules(
SOURCE_FILES "${cython_sources}"
LINKED_LIBRARIES "${linked_libraries}" ASSOCIATED_TARGETS cuvs MODULE_PREFIX neighbors_hnsw_
)

foreach(tgt IN LISTS RAPIDS_CYTHON_CREATED_TARGETS)
target_link_libraries(${tgt} PRIVATE cuvs_rmm_logger)
endforeach()
4 changes: 4 additions & 0 deletions python/cuvs/cuvs/neighbors/ivf_flat/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ rapids_cython_create_modules(
SOURCE_FILES "${cython_sources}"
LINKED_LIBRARIES "${linked_libraries}" ASSOCIATED_TARGETS cuvs MODULE_PREFIX neighbors_ivf_flat_
)

foreach(tgt IN LISTS RAPIDS_CYTHON_CREATED_TARGETS)
target_link_libraries(${tgt} PRIVATE cuvs_rmm_logger)
endforeach()
4 changes: 4 additions & 0 deletions python/cuvs/cuvs/neighbors/ivf_pq/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,7 @@ rapids_cython_create_modules(
SOURCE_FILES "${cython_sources}"
LINKED_LIBRARIES "${linked_libraries}" ASSOCIATED_TARGETS cuvs MODULE_PREFIX neighbors_pq_
)

foreach(tgt IN LISTS RAPIDS_CYTHON_CREATED_TARGETS)
target_link_libraries(${tgt} PRIVATE cuvs_rmm_logger)
endforeach()
5 changes: 5 additions & 0 deletions python/cuvs/cuvs/test/conftest.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# arm tests sporadically run into
# https://bugzilla.redhat.com/show_bug.cgi?id=1722181.
# This is a workaround to ensure that OpenMP gets the TLS that it needs.

import sklearn # noqa: F401
Loading