18 #include <rmm/detail/export.hpp>
25 namespace RMM_NAMESPACE {
92 void* allocate_callback_arg =
nullptr,
93 void* deallocate_callback_arg =
nullptr) noexcept
94 : allocate_callback_(std::move(allocate_callback)),
95 deallocate_callback_(std::move(deallocate_callback)),
96 allocate_callback_arg_(allocate_callback_arg),
97 deallocate_callback_arg_(deallocate_callback_arg)
125 return allocate_callback_(bytes, stream, allocate_callback_arg_);
139 void do_deallocate(
void* ptr, std::size_t bytes,
cuda_stream_view stream)
override
141 deallocate_callback_(ptr, bytes, stream, deallocate_callback_arg_);
146 void* allocate_callback_arg_;
147 void* deallocate_callback_arg_;
Strongly-typed non-owning wrapper for CUDA streams with default constructor.
Definition: cuda_stream_view.hpp:39
A device memory resource that uses the provided callbacks for memory allocation and deallocation.
Definition: callback_memory_resource.hpp:72
callback_memory_resource(callback_memory_resource &&) noexcept=default
Default move constructor.
callback_memory_resource(allocate_callback_t allocate_callback, deallocate_callback_t deallocate_callback, void *allocate_callback_arg=nullptr, void *deallocate_callback_arg=nullptr) noexcept
Construct a new callback memory resource.
Definition: callback_memory_resource.hpp:89
Base class for all librmm device memory allocation.
Definition: device_memory_resource.hpp:93
std::function< void *(std::size_t, cuda_stream_view, void *)> allocate_callback_t
Callback function type used by callback memory resource for allocation.
Definition: callback_memory_resource.hpp:48
std::function< void(void *, std::size_t, cuda_stream_view, void *)> deallocate_callback_t
Callback function type used by callback_memory_resource for deallocation.
Definition: callback_memory_resource.hpp:66