19 #include <rmm/detail/aligned.hpp>
20 #include <rmm/detail/export.hpp>
21 #include <rmm/detail/nvtx/ranges.hpp>
23 #include <cuda/memory_resource>
27 namespace RMM_NAMESPACE {
123 return do_allocate(bytes, stream);
145 do_deallocate(ptr, bytes, stream);
163 return do_is_equal(other);
178 void*
allocate(std::size_t bytes, std::size_t alignment)
197 void deallocate(
void* ptr, std::size_t bytes, std::size_t alignment)
237 return do_allocate(bytes, stream);
256 std::size_t alignment,
279 do_deallocate(ptr, bytes, stream);
291 return do_is_equal(other);
303 return !do_is_equal(other);
339 virtual void do_deallocate(
void* ptr, std::size_t bytes,
cuda_stream_view stream) = 0;
357 return this == &other;
360 static_assert(cuda::mr::async_resource_with<device_memory_resource, cuda::mr::device_accessible>);
Strongly-typed non-owning wrapper for CUDA streams with default constructor.
Definition: cuda_stream_view.hpp:39
Base class for all librmm device memory allocation.
Definition: device_memory_resource.hpp:93
void deallocate_async(void *ptr, std::size_t bytes, cuda_stream_view stream)
Deallocate memory pointed to by p.
Definition: device_memory_resource.hpp:276
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:311
device_memory_resource(device_memory_resource &&) noexcept=default
Default move constructor.
void deallocate(void *ptr, std::size_t bytes, std::size_t alignment)
Deallocate memory pointed to by p.
Definition: device_memory_resource.hpp:197
void * allocate(std::size_t bytes, std::size_t alignment)
Allocates memory of size at least bytes.
Definition: device_memory_resource.hpp:178
void * allocate_async(std::size_t bytes, cuda_stream_view stream)
Allocates memory of size at least bytes.
Definition: device_memory_resource.hpp:234
bool operator==(device_memory_resource const &other) const noexcept
Comparison operator with another device_memory_resource.
Definition: device_memory_resource.hpp:289
void deallocate(void *ptr, std::size_t bytes, cuda_stream_view stream=cuda_stream_view{})
Deallocate memory pointed to by p.
Definition: device_memory_resource.hpp:142
void deallocate_async(void *ptr, std::size_t bytes, std::size_t alignment, cuda_stream_view stream)
Deallocate memory pointed to by p.
Definition: device_memory_resource.hpp:254
bool operator!=(device_memory_resource const &other) const noexcept
Comparison operator with another device_memory_resource.
Definition: device_memory_resource.hpp:301
device_memory_resource(device_memory_resource const &)=default
Default copy constructor.
void * allocate_async(std::size_t bytes, std::size_t alignment, cuda_stream_view stream)
Allocates memory of size at least bytes.
Definition: device_memory_resource.hpp:216
bool is_equal(device_memory_resource const &other) const noexcept
Compare this resource to another.
Definition: device_memory_resource.hpp:161
constexpr std::size_t align_up(std::size_t value, std::size_t alignment) noexcept
Align up to nearest multiple of specified power of 2.
Definition: aligned.hpp:77