Skip to content

Commit 97132aa

Browse files
bdicehcho3
andauthored
Updates for RMM 25.12 compatibility (#11834)
* Updates for RMM 25.12 compatibility * Add macros to support building with RMM 25.10 --------- Co-authored-by: Philip Hyunsu Cho <[email protected]> Co-authored-by: Hyunsu Cho <[email protected]>
1 parent d664e11 commit 97132aa

File tree

2 files changed

+23
-2
lines changed

2 files changed

+23
-2
lines changed

src/common/device_vector.cuh

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -7,10 +7,16 @@
77
#include <thrust/device_vector.h> // for device_vector
88

99
#if defined(XGBOOST_USE_RMM) && XGBOOST_USE_RMM == 1
10-
#include <cuda/memory_resource> // for async_resource_ref
11-
#include <cuda/stream_ref> // for stream_ref
10+
#include <cuda/memory_resource> // for async_resource_ref
11+
#include <cuda/stream_ref> // for stream_ref
12+
13+
// TODO(hcho3): Remove this guard once we require Rapids 25.12+
14+
#if (RMM_MAJOR_VERSION == 25 && RMM_MINOR_VERSION == 12) || RMM_MAJOR_VERSION >= 26
15+
#include <rmm/mr/per_device_resource.hpp> // for get_current_device_resource
16+
#else // (RMM_MAJOR_VERSION == 25 && RMM_MINOR_VERSION == 12) || RMM_MAJOR_VERSION >= 26
1217
#include <rmm/mr/device/device_memory_resource.hpp> // for device_memory_resource
1318
#include <rmm/mr/device/per_device_resource.hpp> // for get_current_device_resource
19+
#endif // (RMM_MAJOR_VERSION == 25 && RMM_MINOR_VERSION == 12) || RMM_MAJOR_VERSION >= 26
1420

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

@@ -266,7 +272,13 @@ namespace detail {
266272
*/
267273
template <typename T>
268274
class ThrustAllocMrAdapter : public thrust::device_malloc_allocator<T> {
275+
276+
// TODO(hcho3): Remove this guard once we require Rapids 25.12+
277+
#if (RMM_MAJOR_VERSION == 25 && RMM_MINOR_VERSION == 12) || RMM_MAJOR_VERSION >= 26
278+
DeviceAsyncResourceRef mr_{rmm::mr::get_current_device_resource_ref()};
279+
#else // (RMM_MAJOR_VERSION == 25 && RMM_MINOR_VERSION == 12) || RMM_MAJOR_VERSION >= 26
269280
DeviceAsyncResourceRef mr_{rmm::mr::get_current_device_resource()};
281+
#endif // (RMM_MAJOR_VERSION == 25 && RMM_MINOR_VERSION == 12) || RMM_MAJOR_VERSION >= 26
270282

271283
public:
272284
using Super = thrust::device_malloc_allocator<T>;

tests/cpp/helpers.cc

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,18 @@
2929
#if defined(XGBOOST_USE_RMM) && XGBOOST_USE_RMM == 1
3030
#include <memory>
3131
#include <vector>
32+
33+
// TODO(hcho3): Remove this guard once we require Rapids 25.12+
34+
#if (RMM_MAJOR_VERSION == 25 && RMM_MINOR_VERSION == 12) || RMM_MAJOR_VERSION >= 26
35+
#include "rmm/mr/per_device_resource.hpp"
36+
#include "rmm/mr/cuda_memory_resource.hpp"
37+
#include "rmm/mr/pool_memory_resource.hpp"
38+
#else // (RMM_MAJOR_VERSION == 25 && RMM_MINOR_VERSION == 12) || RMM_MAJOR_VERSION >= 26
3239
#include "rmm/mr/device/per_device_resource.hpp"
3340
#include "rmm/mr/device/cuda_memory_resource.hpp"
3441
#include "rmm/mr/device/pool_memory_resource.hpp"
42+
#endif // (RMM_MAJOR_VERSION == 25 && RMM_MINOR_VERSION == 12) || RMM_MAJOR_VERSION >= 26
43+
3544
#endif // defined(XGBOOST_USE_RMM) && XGBOOST_USE_RMM == 1
3645

3746
bool FileExists(const std::string& filename) {

0 commit comments

Comments
 (0)