9 #include <rmm/detail/export.hpp>
11 #include <cuda/memory_resource>
12 #include <cuda/stream_ref>
13 #include <cuda_runtime_api.h>
17 namespace RMM_NAMESPACE {
80 void*
allocate([[maybe_unused]] cuda::stream_ref stream,
126 cuda::mr::device_accessible) noexcept
136 cuda::mr::host_accessible) noexcept
156 static_assert(cuda::mr::synchronous_resource<system_memory_resource>);
157 static_assert(cuda::mr::resource<system_memory_resource>);
159 cuda::mr::synchronous_resource_with<system_memory_resource, cuda::mr::device_accessible>);
161 cuda::mr::synchronous_resource_with<system_memory_resource, cuda::mr::host_accessible>);
162 static_assert(cuda::mr::resource_with<system_memory_resource, cuda::mr::device_accessible>);
163 static_assert(cuda::mr::resource_with<system_memory_resource, cuda::mr::host_accessible>);
Memory resource that uses malloc/free for allocation/deallocation.
Definition: system_memory_resource.hpp:57
system_memory_resource(system_memory_resource const &)=default
Default copy constructor.
system_memory_resource(system_memory_resource &&)=default
Default copy constructor.
system_memory_resource & operator=(system_memory_resource const &)=default
Default copy assignment operator.
bool operator==(system_memory_resource const &) const noexcept
Compare this resource to another.
friend void get_property(system_memory_resource const &, cuda::mr::device_accessible) noexcept
Enables the cuda::mr::device_accessible property.
Definition: system_memory_resource.hpp:125
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.
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!=(system_memory_resource const &) const noexcept
Compare this resource to another.
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_sync(void *ptr, std::size_t bytes, std::size_t alignment=rmm::CUDA_ALLOCATION_ALIGNMENT) noexcept
Deallocate memory pointed to by ptr synchronously.
friend void get_property(system_memory_resource const &, cuda::mr::host_accessible) noexcept
Enables the cuda::mr::host_accessible property.
Definition: system_memory_resource.hpp:135
system_memory_resource & operator=(system_memory_resource &&)=default
Default move assignment operator.
static constexpr std::size_t CUDA_ALLOCATION_ALIGNMENT
Default alignment used for CUDA memory allocation.
Definition: aligned.hpp:25
Strong type for a CUDA device identifier.
Definition: cuda_device.hpp:27
bool is_system_memory_supported(cuda_device_id device_id)
Check if system allocated memory (SAM) is supported on the specified device.