8#include <rmm/detail/export.hpp>
10#include <cuda/memory_resource>
25class RMM_EXPORT cuda_memory_resource final {
27 cuda_memory_resource() =
default;
28 ~cuda_memory_resource() =
default;
31 cuda_memory_resource&
operator=(cuda_memory_resource
const&) =
33 cuda_memory_resource&
operator=(cuda_memory_resource&&) =
48 [[nodiscard]]
void*
allocate([[maybe_unused]] cuda::stream_ref stream,
50 std::size_t alignment = rmm::CUDA_ALLOCATION_ALIGNMENT);
63 void deallocate([[maybe_unused]] cuda::stream_ref stream,
66 std::size_t alignment = rmm::CUDA_ALLOCATION_ALIGNMENT)
noexcept;
76 std::size_t alignment = rmm::CUDA_ALLOCATION_ALIGNMENT);
87 std::size_t alignment = rmm::CUDA_ALLOCATION_ALIGNMENT)
noexcept;
94 RMM_CONSTEXPR_FRIEND
void get_property(cuda_memory_resource
const&,
95 cuda::mr::device_accessible)
noexcept
106 [[nodiscard]]
bool operator==(cuda_memory_resource
const&)
const noexcept;
111 [[nodiscard]]
bool operator!=(cuda_memory_resource
const&)
const noexcept;
115static_assert(cuda::mr::synchronous_resource<cuda_memory_resource>);
116static_assert(cuda::mr::resource<cuda_memory_resource>);
118 cuda::mr::synchronous_resource_with<cuda_memory_resource, cuda::mr::device_accessible>);
119static_assert(cuda::mr::resource_with<cuda_memory_resource, cuda::mr::device_accessible>);
cuda_memory_resource & operator=(cuda_memory_resource &&)=default
Default move assignment operator.
cuda_memory_resource(cuda_memory_resource const &)=default
Default copy constructor.
cuda_memory_resource & operator=(cuda_memory_resource const &)=default
Default copy assignment operator.
void * allocate(cuda::stream_ref stream, std::size_t bytes, std::size_t alignment=rmm::CUDA_ALLOCATION_ALIGNMENT)
Allocates memory of size at least bytes.
friend void get_property(cuda_memory_resource const &, cuda::mr::device_accessible) noexcept
Enables the cuda::mr::device_accessible property.
Definition cuda_memory_resource.hpp:94
void * allocate_sync(std::size_t bytes, std::size_t alignment=rmm::CUDA_ALLOCATION_ALIGNMENT)
Allocates memory of size at least bytes synchronously.
void deallocate(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==(cuda_memory_resource const &) const noexcept
Compare this resource to another.
cuda_memory_resource(cuda_memory_resource &&)=default
Default move constructor.
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.
bool operator!=(cuda_memory_resource const &) const noexcept
Compare this resource to another.