Skip to content
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
16 changes: 14 additions & 2 deletions src/common/device_vector.cuh
Original file line number Diff line number Diff line change
Expand Up @@ -7,10 +7,16 @@
#include <thrust/device_vector.h> // for device_vector

#if defined(XGBOOST_USE_RMM) && XGBOOST_USE_RMM == 1
#include <cuda/memory_resource> // for async_resource_ref
#include <cuda/stream_ref> // for stream_ref
#include <cuda/memory_resource> // for async_resource_ref
#include <cuda/stream_ref> // for stream_ref

// TODO(hcho3): Remove this guard once we require Rapids 25.12+
#if (RMM_MAJOR_VERSION == 25 && RMM_MINOR_VERSION == 12) || RMM_MAJOR_VERSION >= 26
#include <rmm/mr/per_device_resource.hpp> // for get_current_device_resource
#else // (RMM_MAJOR_VERSION == 25 && RMM_MINOR_VERSION == 12) || RMM_MAJOR_VERSION >= 26
#include <rmm/mr/device/device_memory_resource.hpp> // for device_memory_resource
#include <rmm/mr/device/per_device_resource.hpp> // for get_current_device_resource
#endif // (RMM_MAJOR_VERSION == 25 && RMM_MINOR_VERSION == 12) || RMM_MAJOR_VERSION >= 26

#include "xgboost/global_config.h" // for GlobalConfigThreadLocalStore

Expand Down Expand Up @@ -266,7 +272,13 @@ namespace detail {
*/
template <typename T>
class ThrustAllocMrAdapter : public thrust::device_malloc_allocator<T> {

// TODO(hcho3): Remove this guard once we require Rapids 25.12+
#if (RMM_MAJOR_VERSION == 25 && RMM_MINOR_VERSION == 12) || RMM_MAJOR_VERSION >= 26
DeviceAsyncResourceRef mr_{rmm::mr::get_current_device_resource_ref()};
#else // (RMM_MAJOR_VERSION == 25 && RMM_MINOR_VERSION == 12) || RMM_MAJOR_VERSION >= 26
DeviceAsyncResourceRef mr_{rmm::mr::get_current_device_resource()};
#endif // (RMM_MAJOR_VERSION == 25 && RMM_MINOR_VERSION == 12) || RMM_MAJOR_VERSION >= 26

public:
using Super = thrust::device_malloc_allocator<T>;
Expand Down
9 changes: 9 additions & 0 deletions tests/cpp/helpers.cc
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,18 @@
#if defined(XGBOOST_USE_RMM) && XGBOOST_USE_RMM == 1
#include <memory>
#include <vector>

// TODO(hcho3): Remove this guard once we require Rapids 25.12+
#if (RMM_MAJOR_VERSION == 25 && RMM_MINOR_VERSION == 12) || RMM_MAJOR_VERSION >= 26
#include "rmm/mr/per_device_resource.hpp"
#include "rmm/mr/cuda_memory_resource.hpp"
#include "rmm/mr/pool_memory_resource.hpp"
#else // (RMM_MAJOR_VERSION == 25 && RMM_MINOR_VERSION == 12) || RMM_MAJOR_VERSION >= 26
#include "rmm/mr/device/per_device_resource.hpp"
#include "rmm/mr/device/cuda_memory_resource.hpp"
#include "rmm/mr/device/pool_memory_resource.hpp"
#endif // (RMM_MAJOR_VERSION == 25 && RMM_MINOR_VERSION == 12) || RMM_MAJOR_VERSION >= 26

#endif // defined(XGBOOST_USE_RMM) && XGBOOST_USE_RMM == 1

bool FileExists(const std::string& filename) {
Expand Down
Loading