7 #include <rmm/detail/export.hpp>
8 #include <rmm/mr/detail/callback_memory_resource_impl.hpp>
11 #include <cuda/memory_resource>
12 #include <cuda/stream>
56 class callback_memory_resource_impl;
67 :
public cuda::mr::shared_resource<detail::callback_memory_resource_impl> {
68 using shared_base = cuda::mr::shared_resource<detail::callback_memory_resource_impl>;
75 cuda::mr::device_accessible) noexcept
96 void* allocate_callback_arg =
nullptr,
97 void* deallocate_callback_arg =
nullptr);
103 static_assert(cuda::mr::resource_with<callback_memory_resource, cuda::mr::device_accessible>,
104 "callback_memory_resource does not satisfy the cuda::mr::resource concept");
A device memory resource that uses the provided callbacks for memory allocation and deallocation.
Definition: callback_memory_resource.hpp:67
friend void get_property(callback_memory_resource const &, cuda::mr::device_accessible) noexcept
Enables the cuda::mr::device_accessible property.
Definition: callback_memory_resource.hpp:74
callback_memory_resource(allocate_callback_t allocate_callback, deallocate_callback_t deallocate_callback, void *allocate_callback_arg=nullptr, void *deallocate_callback_arg=nullptr)
Construct a new callback memory resource.
std::function< void *(std::size_t, cuda::stream_ref, 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_ref, void *)> deallocate_callback_t
Callback function type used by callback_memory_resource for deallocation.
Definition: callback_memory_resource.hpp:53