7 #include <rmm/detail/export.hpp>
8 #include <rmm/mr/detail/callback_memory_resource_impl.hpp>
11 #include <cuda/memory_resource>
16 namespace RMM_NAMESPACE {
55 class callback_memory_resource_impl;
66 :
public cuda::mr::shared_resource<detail::callback_memory_resource_impl> {
67 using shared_base = cuda::mr::shared_resource<detail::callback_memory_resource_impl>;
74 cuda::mr::device_accessible) noexcept
95 void* allocate_callback_arg =
nullptr,
96 void* deallocate_callback_arg =
nullptr);
102 static_assert(cuda::mr::resource_with<callback_memory_resource, cuda::mr::device_accessible>,
103 "callback_memory_resource does not satisfy the cuda::mr::resource concept");
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:66
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:73
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_view, void *)> allocate_callback_t
Callback function type used by callback memory resource for allocation.
Definition: callback_memory_resource.hpp:36
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:52