From 0190a04c06bbccdb5e5c36202ce16ba49e1da489 Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Tue, 26 Nov 2024 19:24:20 +0000 Subject: [PATCH 1/5] Adapt to rmm logger changes --- cpp/CMakeLists.txt | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 780f6f8581..5ea9cdf802 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -180,7 +180,10 @@ target_include_directories( ) # Keep RAFT as lightweight as possible. Only CUDA libs and rmm should be used in global target. -target_link_libraries(raft INTERFACE rmm::rmm cuco::cuco nvidia::cutlass::cutlass CCCL::CCCL) +target_link_libraries( + raft INTERFACE rmm::rmm rmm::rmm_logger $ cuco::cuco + nvidia::cutlass::cutlass CCCL::CCCL +) target_compile_features(raft INTERFACE cxx_std_17 $) target_compile_options( @@ -288,8 +291,10 @@ if(RAFT_COMPILE_LIBRARY) "$<$:${RAFT_CUDA_FLAGS}>" ) - add_library(raft_lib SHARED $) - add_library(raft_lib_static STATIC $) + # Make sure not to add the rmm logger twice since it will be brought in as an interface source by + # the rmm::rmm_logger_impl target. + add_library(raft_lib SHARED $,EXCLUDE,rmm.*logger>) + add_library(raft_lib_static STATIC $,EXCLUDE,rmm.*logger>) set_target_properties( raft_lib raft_lib_static From 3d6dfdbc5679521c0c0ea119fb8a933b1fcd2b82 Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Wed, 27 Nov 2024 17:01:38 +0000 Subject: [PATCH 2/5] Link unconditionally --- cpp/CMakeLists.txt | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 5ea9cdf802..17b5d78e5e 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -181,8 +181,8 @@ target_include_directories( # Keep RAFT as lightweight as possible. Only CUDA libs and rmm should be used in global target. target_link_libraries( - raft INTERFACE rmm::rmm rmm::rmm_logger $ cuco::cuco - nvidia::cutlass::cutlass CCCL::CCCL + raft INTERFACE rmm::rmm rmm::rmm_logger rmm::rmm_logger_impl cuco::cuco nvidia::cutlass::cutlass + CCCL::CCCL ) target_compile_features(raft INTERFACE cxx_std_17 $) From bfc3a35283cbb7858204f93e99487f7ed3431e06 Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Wed, 27 Nov 2024 17:15:39 +0000 Subject: [PATCH 3/5] Only link the impl to each of the consuming library targets --- cpp/CMakeLists.txt | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 17b5d78e5e..2b2c9b4b34 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -181,8 +181,7 @@ target_include_directories( # Keep RAFT as lightweight as possible. Only CUDA libs and rmm should be used in global target. target_link_libraries( - raft INTERFACE rmm::rmm rmm::rmm_logger rmm::rmm_logger_impl cuco::cuco nvidia::cutlass::cutlass - CCCL::CCCL + raft INTERFACE rmm::rmm rmm::rmm_logger cuco::cuco nvidia::cutlass::cutlass CCCL::CCCL ) target_compile_features(raft INTERFACE cxx_std_17 $) @@ -318,6 +317,8 @@ if(RAFT_COMPILE_LIBRARY) # ensure CUDA symbols aren't relocated to the middle of the debug build binaries target_link_options(${target} PRIVATE "${CMAKE_CURRENT_BINARY_DIR}/fatbin.ld") endforeach() + target_link_libraries(raft_lib PRIVATE rmm::rmm_logger_impl) + target_link_libraries(raft_lib_static PRIVATE rmm::rmm_logger_impl) endif() if(TARGET raft_lib AND (NOT TARGET raft::raft_lib)) From a0da5a9ad39e075738820f31781f53af329c7383 Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Wed, 27 Nov 2024 17:41:51 +0000 Subject: [PATCH 4/5] raft needs to link to spdlog itself since it is using spdlog directly, it cannot rely on transitive linkage from rmm --- cpp/CMakeLists.txt | 3 ++- cpp/cmake/thirdparty/get_spdlog.cmake | 6 +++--- 2 files changed, 5 insertions(+), 4 deletions(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 2b2c9b4b34..78a4dbb913 100644 --- a/cpp/CMakeLists.txt +++ b/cpp/CMakeLists.txt @@ -181,7 +181,8 @@ target_include_directories( # Keep RAFT as lightweight as possible. Only CUDA libs and rmm should be used in global target. target_link_libraries( - raft INTERFACE rmm::rmm rmm::rmm_logger cuco::cuco nvidia::cutlass::cutlass CCCL::CCCL + raft INTERFACE rmm::rmm rmm::rmm_logger spdlog::spdlog_header_only cuco::cuco + nvidia::cutlass::cutlass CCCL::CCCL ) target_compile_features(raft INTERFACE cxx_std_17 $) diff --git a/cpp/cmake/thirdparty/get_spdlog.cmake b/cpp/cmake/thirdparty/get_spdlog.cmake index 57e38c2638..b1ffbe246f 100644 --- a/cpp/cmake/thirdparty/get_spdlog.cmake +++ b/cpp/cmake/thirdparty/get_spdlog.cmake @@ -16,9 +16,9 @@ function(find_and_configure_spdlog) include(${rapids-cmake-dir}/cpm/spdlog.cmake) - rapids_cpm_spdlog(FMT_OPTION "EXTERNAL_FMT_HO" INSTALL_EXPORT_SET rmm-exports) - rapids_export_package(BUILD spdlog rmm-exports) + rapids_cpm_spdlog(FMT_OPTION "EXTERNAL_FMT_HO" INSTALL_EXPORT_SET raft-exports) + rapids_export_package(BUILD spdlog raft-exports) endfunction() -find_and_configure_spdlog() \ No newline at end of file +find_and_configure_spdlog() From aaadff5697b159017dba4a72e74b6e92c7a5da75 Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Wed, 27 Nov 2024 18:59:34 +0000 Subject: [PATCH 5/5] Make sure the logger is linked to the benchmarks --- cpp/bench/prims/CMakeLists.txt | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/cpp/bench/prims/CMakeLists.txt b/cpp/bench/prims/CMakeLists.txt index cf03a36612..edc1af4e02 100644 --- a/cpp/bench/prims/CMakeLists.txt +++ b/cpp/bench/prims/CMakeLists.txt @@ -32,6 +32,7 @@ function(ConfigureBench) PRIVATE raft::raft raft_internal $<$:raft::compiled> + $<$>:bench_rmm_logger> ${RAFT_CTK_MATH_DEPENDENCIES} benchmark::benchmark Threads::Threads @@ -73,6 +74,9 @@ function(ConfigureBench) endfunction() +add_library(bench_rmm_logger OBJECT) +target_link_libraries(bench_rmm_logger PRIVATE rmm::rmm_logger_impl) + if(BUILD_PRIMS_BENCH) ConfigureBench(NAME CORE_BENCH PATH core/bitset.cu core/copy.cu main.cpp)