From 0e6d35f7cbb4354641d69868d6cb10dcee21fbca Mon Sep 17 00:00:00 2001 From: Vyas Ramasubramani Date: Wed, 27 Nov 2024 12:36:38 -0800 Subject: [PATCH] Adapt to rmm logger changes (#2513) This PR adapts to breaking changes in rmm in https://github.com/rapidsai/rmm/pull/1722. This PR is a breaking change because consumers of raft that use any functionality that touches rmm logging will need to link to the rmm::rmm_logger_impl target as well now. Authors: - Vyas Ramasubramani (https://github.com/vyasr) Approvers: - Bradley Dice (https://github.com/bdice) URL: https://github.com/rapidsai/raft/pull/2513 --- cpp/CMakeLists.txt | 13 ++++++++++--- cpp/bench/prims/CMakeLists.txt | 4 ++++ cpp/cmake/thirdparty/get_spdlog.cmake | 6 +++--- 3 files changed, 17 insertions(+), 6 deletions(-) diff --git a/cpp/CMakeLists.txt b/cpp/CMakeLists.txt index 780f6f8581..78a4dbb913 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 spdlog::spdlog_header_only 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 @@ -313,6 +318,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)) 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) 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()