8 #include <rmm/detail/aligned.hpp>
9 #include <rmm/detail/cccl_adaptors.hpp>
10 #include <rmm/detail/cuda_memory_resource.hpp>
11 #include <rmm/detail/error.hpp>
12 #include <rmm/detail/export.hpp>
13 #include <rmm/detail/nvtx/ranges.hpp>
17 namespace RMM_NAMESPACE {
113 "Alignment must be less than or equal to 256 and a power of two",
116 void* ptr = do_allocate(bytes, stream);
117 stream.synchronize();
159 "Alignment must be less than or equal to 256 and a power of two",
161 return do_allocate(bytes, stream);
178 do_deallocate(ptr, bytes, stream);
196 return do_is_equal(other);
208 return do_is_equal(other);
220 return !do_is_equal(other);
256 virtual void do_deallocate(
void* ptr, std::size_t bytes,
cuda_stream_view stream) noexcept = 0;
274 return this == &other;
279 static_assert(rmm::detail::polyfill::resource<device_memory_resource>);
280 static_assert(rmm::detail::polyfill::async_resource<device_memory_resource>);
282 rmm::detail::polyfill::resource_with<device_memory_resource, cuda::mr::device_accessible>);
284 rmm::detail::polyfill::async_resource_with<device_memory_resource, cuda::mr::device_accessible>);
Exception thrown when an RMM allocation fails.
Definition: error.hpp:44
Strongly-typed non-owning wrapper for CUDA streams with default constructor.
Definition: cuda_stream_view.hpp:28
Base class for all librmm device memory allocation.
Definition: device_memory_resource.hpp:83
friend void get_property(device_memory_resource const &, cuda::mr::device_accessible) noexcept
Enables the cuda::mr::device_accessible property.
Definition: device_memory_resource.hpp:228
device_memory_resource(device_memory_resource &&) noexcept=default
Default move constructor.
void deallocate(cuda_stream_view stream, void *ptr, std::size_t bytes, [[maybe_unused]] std::size_t alignment=rmm::CUDA_ALLOCATION_ALIGNMENT) noexcept
Deallocate memory pointed to by ptr on the specified stream.
Definition: device_memory_resource.hpp:173
void * allocate(cuda_stream_view stream, std::size_t bytes, std::size_t alignment=rmm::CUDA_ALLOCATION_ALIGNMENT)
Allocates memory of size at least bytes on the specified stream.
Definition: device_memory_resource.hpp:153
void deallocate_sync(void *ptr, std::size_t bytes, [[maybe_unused]] std::size_t alignment=rmm::CUDA_ALLOCATION_ALIGNMENT) noexcept
Deallocate memory pointed to by ptr.
Definition: device_memory_resource.hpp:132
bool operator==(device_memory_resource const &other) const noexcept
Comparison operator with another device_memory_resource.
Definition: device_memory_resource.hpp:206
bool operator!=(device_memory_resource const &other) const noexcept
Comparison operator with another device_memory_resource.
Definition: device_memory_resource.hpp:218
device_memory_resource(device_memory_resource const &)=default
Default copy constructor.
bool is_equal(device_memory_resource const &other) const noexcept
Compare this resource to another.
Definition: device_memory_resource.hpp:194
static constexpr std::size_t CUDA_ALLOCATION_ALIGNMENT
Default alignment used for CUDA memory allocation.
Definition: aligned.hpp:25
bool is_supported_alignment(std::size_t alignment) noexcept
Returns whether or not alignment is a valid memory alignment.
RAPIDS Memory Manager - The top-level namespace for all RMM functionality.