7 #include <rmm/detail/export.hpp>
14 namespace RMM_NAMESPACE {
81 void* allocate_callback_arg =
nullptr,
82 void* deallocate_callback_arg =
nullptr) noexcept
83 : allocate_callback_(std::move(allocate_callback)),
84 deallocate_callback_(std::move(deallocate_callback)),
85 allocate_callback_arg_(allocate_callback_arg),
86 deallocate_callback_arg_(deallocate_callback_arg)
114 return allocate_callback_(bytes, stream, allocate_callback_arg_);
128 void do_deallocate(
void* ptr, std::size_t bytes,
cuda_stream_view stream) noexcept
override
130 deallocate_callback_(ptr, bytes, stream, deallocate_callback_arg_);
135 void* allocate_callback_arg_;
136 void* deallocate_callback_arg_;
Strongly-typed non-owning wrapper for CUDA streams with default constructor.
Definition: cuda_stream_view.hpp:28
A device memory resource that uses the provided callbacks for memory allocation and deallocation.
Definition: callback_memory_resource.hpp:61
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:78
Base class for all librmm device memory allocation.
Definition: device_memory_resource.hpp:83
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:37
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:55