Skip to content

Commit

Permalink
Adapt to rmm logger changes (#2513)
Browse files Browse the repository at this point in the history
This PR adapts to breaking changes in rmm in rapidsai/rmm#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: #2513
  • Loading branch information
vyasr authored Nov 27, 2024
1 parent c943181 commit 0e6d35f
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 6 deletions.
13 changes: 10 additions & 3 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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 $<BUILD_INTERFACE:cuda_std_17>)
target_compile_options(
Expand Down Expand Up @@ -288,8 +291,10 @@ if(RAFT_COMPILE_LIBRARY)
"$<$<COMPILE_LANGUAGE:CUDA>:${RAFT_CUDA_FLAGS}>"
)

add_library(raft_lib SHARED $<TARGET_OBJECTS:raft_objs>)
add_library(raft_lib_static STATIC $<TARGET_OBJECTS:raft_objs>)
# 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 $<FILTER:$<TARGET_OBJECTS:raft_objs>,EXCLUDE,rmm.*logger>)
add_library(raft_lib_static STATIC $<FILTER:$<TARGET_OBJECTS:raft_objs>,EXCLUDE,rmm.*logger>)

set_target_properties(
raft_lib raft_lib_static
Expand All @@ -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))
Expand Down
4 changes: 4 additions & 0 deletions cpp/bench/prims/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@ function(ConfigureBench)
PRIVATE raft::raft
raft_internal
$<$<BOOL:${ConfigureBench_LIB}>:raft::compiled>
$<$<NOT:$<BOOL:${ConfigureBench_LIB}>>:bench_rmm_logger>
${RAFT_CTK_MATH_DEPENDENCIES}
benchmark::benchmark
Threads::Threads
Expand Down Expand Up @@ -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)

Expand Down
6 changes: 3 additions & 3 deletions cpp/cmake/thirdparty/get_spdlog.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -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()
find_and_configure_spdlog()

0 comments on commit 0e6d35f

Please sign in to comment.