89 void* allocate_callback_arg =
nullptr,
90 void* deallocate_callback_arg =
nullptr) noexcept
91 : allocate_callback_(allocate_callback),
92 deallocate_callback_(deallocate_callback),
93 allocate_callback_arg_(allocate_callback_arg),
94 deallocate_callback_arg_(deallocate_callback_arg)
122 return allocate_callback_(bytes, stream, allocate_callback_arg_);
136 void do_deallocate(
void* ptr, std::size_t bytes,
cuda_stream_view stream)
override
138 deallocate_callback_(ptr, bytes, stream, deallocate_callback_arg_);
141 [[nodiscard]] std::pair<std::size_t, std::size_t> do_get_mem_info(
cuda_stream_view)
const override
143 throw std::runtime_error(
"cannot get free / total memory");
146 [[nodiscard]]
bool supports_streams() const noexcept
override {
return false; }
147 [[nodiscard]]
bool supports_get_mem_info() const noexcept
override {
return false; }
151 void* allocate_callback_arg_;
152 void* deallocate_callback_arg_;
Strongly-typed non-owning wrapper for CUDA streams with default constructor.
Definition: cuda_stream_view.hpp:41
A device memory resource that uses the provided callbacks for memory allocation and deallocation.
Definition: callback_memory_resource.hpp:70
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:87
Base class for all libcudf device memory allocation.
Definition: device_memory_resource.hpp:89
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:46
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:64