File tree Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Expand file tree Collapse file tree 1 file changed +6
-1
lines changed Original file line number Diff line number Diff line change @@ -420,7 +420,7 @@ struct XGBDefaultDeviceAllocatorImpl : XGBBaseDeviceAllocator<T> {
420
420
* allocations if verbose. Does not initialise memory on construction.
421
421
*/
422
422
template <class T >
423
- struct XGBCachingDeviceAllocatorImpl : XGBBaseDeviceAllocator <T> {
423
+ struct XGBCachingDeviceAllocatorImpl : thrust::device_malloc_allocator <T> {
424
424
using pointer = thrust::device_ptr<T>; // NOLINT
425
425
template <typename U>
426
426
struct rebind // NOLINT
@@ -462,8 +462,13 @@ using XGBDeviceAllocator = detail::XGBDefaultDeviceAllocatorImpl<T>;
462
462
/* ! Be careful that the initialization constructor is a no-op, which means calling
463
463
* `vec.resize(n)` won't initialize the memory region to 0. Instead use
464
464
* `vec.resize(n, 0)`*/
465
+ #if defined(XGBOOST_USE_RMM) && XGBOOST_USE_RMM == 1
466
+ template <typename T>
467
+ using XGBCachingDeviceAllocator = detail::XGBDefaultDeviceAllocatorImpl<T>;
468
+ #else // defined(XGBOOST_USE_RMM) && XGBOOST_USE_RMM == 1
465
469
template <typename T>
466
470
using XGBCachingDeviceAllocator = detail::XGBCachingDeviceAllocatorImpl<T>;
471
+ #endif // defined(XGBOOST_USE_RMM) && XGBOOST_USE_RMM == 1
467
472
/* * \brief Specialisation of thrust device vector using custom allocator. */
468
473
template <typename T>
469
474
using device_vector = thrust::device_vector<T, XGBDeviceAllocator<T>>; // NOLINT
You can’t perform that action at this time.
0 commit comments