Skip to content

Commit

Permalink
Remove RMM logger CMake targets and use forward declaration (#343)
Browse files Browse the repository at this point in the history
Remove RMM logger CMake targets that are unused by UCXX, and thus prevent unnecessary linking to spdlog/fmt. Use a forward declaration for `rmm::device_buffer` to avoid symbols being added to the symbol table.

Authors:
  - Peter Andreas Entschev (https://github.com/pentschev)

Approvers:
  - Vyas Ramasubramani (https://github.com/vyasr)
  - Lawrence Mitchell (https://github.com/wence-)

URL: #343
  • Loading branch information
pentschev authored Dec 18, 2024
1 parent 0b98402 commit ec860d9
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 5 deletions.
3 changes: 1 addition & 2 deletions cpp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -188,8 +188,7 @@ target_compile_definitions(
# Enable RMM if necessary
if(UCXX_ENABLE_RMM)
target_link_libraries(ucxx
PUBLIC rmm::rmm rmm::rmm_logger
PRIVATE rmm::rmm_logger_impl
PUBLIC rmm::rmm
)

# Define spdlog level
Expand Down
7 changes: 4 additions & 3 deletions cpp/include/ucxx/buffer.h
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,10 @@

#include <ucxx/log.h>

#if UCXX_ENABLE_RMM
#include <rmm/device_buffer.hpp>
#endif
namespace rmm {
// Forward declaration to prevent symbols from being added to symbol table unnecessarily.
class device_buffer;
} // namespace rmm

namespace ucxx {

Expand Down
4 changes: 4 additions & 0 deletions cpp/tests/buffer.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,10 @@

#include <ucxx/api.h>

#if UCXX_ENABLE_RMM
#include <rmm/device_buffer.hpp>
#endif

namespace {

class BufferAllocator : public ::testing::Test,
Expand Down
4 changes: 4 additions & 0 deletions cpp/tests/request.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,10 @@
#include "ucxx/constructors.h"
#include "ucxx/utils/ucx.h"

#if UCXX_ENABLE_RMM
#include <rmm/device_buffer.hpp>
#endif

namespace {

using ::testing::Combine;
Expand Down

0 comments on commit ec860d9

Please sign in to comment.