8 #include <rmm/detail/export.hpp>
10 #include <cuda/memory_resource>
11 #include <cuda/stream_ref>
15 namespace RMM_NAMESPACE {
48 void*
allocate([[maybe_unused]] cuda::stream_ref stream,
63 void deallocate([[maybe_unused]] cuda::stream_ref stream,
94 cuda::mr::device_accessible) noexcept
104 cuda::mr::host_accessible) noexcept
124 static_assert(cuda::mr::synchronous_resource<managed_memory_resource>);
125 static_assert(cuda::mr::resource<managed_memory_resource>);
127 cuda::mr::synchronous_resource_with<managed_memory_resource, cuda::mr::device_accessible>);
129 cuda::mr::synchronous_resource_with<managed_memory_resource, cuda::mr::host_accessible>);
130 static_assert(cuda::mr::resource_with<managed_memory_resource, cuda::mr::device_accessible>);
131 static_assert(cuda::mr::resource_with<managed_memory_resource, cuda::mr::host_accessible>);
Memory resource that uses cudaMallocManaged/Free for allocation/deallocation.
Definition: managed_memory_resource.hpp:25
void * allocate([[maybe_unused]] cuda::stream_ref stream, std::size_t bytes, std::size_t alignment=rmm::CUDA_ALLOCATION_ALIGNMENT)
Allocates memory of size at least bytes.
managed_memory_resource(managed_memory_resource &&)=default
Default move constructor.
void * allocate_sync(std::size_t bytes, std::size_t alignment=rmm::CUDA_ALLOCATION_ALIGNMENT)
Allocates memory of size at least bytes synchronously.
bool operator==(managed_memory_resource const &) const noexcept
Compare this resource to another.
friend void get_property(managed_memory_resource const &, cuda::mr::host_accessible) noexcept
Enables the cuda::mr::host_accessible property.
Definition: managed_memory_resource.hpp:103
friend void get_property(managed_memory_resource const &, cuda::mr::device_accessible) noexcept
Enables the cuda::mr::device_accessible property.
Definition: managed_memory_resource.hpp:93
void deallocate_sync(void *ptr, std::size_t bytes, std::size_t alignment=rmm::CUDA_ALLOCATION_ALIGNMENT) noexcept
Deallocate memory pointed to by ptr synchronously.
managed_memory_resource & operator=(managed_memory_resource &&)=default
Default move assignment operator.
managed_memory_resource & operator=(managed_memory_resource const &)=default
Default copy assignment operator.
void deallocate([[maybe_unused]] cuda::stream_ref stream, void *ptr, std::size_t bytes, std::size_t alignment=rmm::CUDA_ALLOCATION_ALIGNMENT) noexcept
Deallocate memory pointed to by ptr.
bool operator!=(managed_memory_resource const &) const noexcept
Compare this resource to another.
managed_memory_resource(managed_memory_resource const &)=default
Default copy constructor.
static constexpr std::size_t CUDA_ALLOCATION_ALIGNMENT
Default alignment used for CUDA memory allocation.
Definition: aligned.hpp:25