Memory resource that uses malloc/free for allocation/deallocation. More...
#include <system_memory_resource.hpp>
Public Member Functions | |
| 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. More... | |
| system_memory_resource & | operator= (system_memory_resource &&)=default |
| Default move assignment operator. More... | |
| void * | allocate ([[maybe_unused]] cuda::stream_ref stream, std::size_t bytes, [[maybe_unused]] std::size_t alignment=rmm::CUDA_ALLOCATION_ALIGNMENT) |
Allocates memory of size at least bytes. More... | |
| void | deallocate (cuda::stream_ref stream, void *ptr, std::size_t bytes, [[maybe_unused]] std::size_t alignment=rmm::CUDA_ALLOCATION_ALIGNMENT) noexcept |
Deallocate memory pointed to by ptr. More... | |
| void * | allocate_sync (std::size_t bytes, std::size_t alignment=rmm::CUDA_ALLOCATION_ALIGNMENT) |
Allocates memory of size at least bytes synchronously. More... | |
| 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. More... | |
| bool | operator== (system_memory_resource const &) const noexcept |
| Compare this resource to another. More... | |
| bool | operator!= (system_memory_resource const &) const noexcept |
| Compare this resource to another. More... | |
Friends | |
| void | get_property (system_memory_resource const &, cuda::mr::device_accessible) noexcept |
Enables the cuda::mr::device_accessible property. More... | |
| void | get_property (system_memory_resource const &, cuda::mr::host_accessible) noexcept |
Enables the cuda::mr::host_accessible property. More... | |
Memory resource that uses malloc/free for allocation/deallocation.
There are two flavors of hardware/software environments that support accessing system allocated memory (SAM) from the GPU: HMM and ATS.
Heterogeneous Memory Management (HMM) is a software-based solution for PCIe-connected GPUs on x86 systems. Requirements:
For more information, see https://developer.nvidia.com/blog/simplifying-gpu-application-development-with-heterogeneous-memory-management/.
Address Translation Services (ATS) is a hardware/software solution for the Grace Hopper Superchip that uses the NVLink Chip-2-Chip (C2C) interconnect to provide coherent memory. For more information, see https://developer.nvidia.com/blog/nvidia-grace-hopper-superchip-architecture-in-depth/.
|
inline |
Allocates memory of size at least bytes.
The returned pointer will have at minimum 256 byte alignment.
The stream argument is ignored.
| stream | This argument is ignored |
| bytes | The size of the allocation |
| alignment | The alignment of the allocation |
|
inline |
Allocates memory of size at least bytes synchronously.
| bytes | The size of the allocation |
| alignment | The alignment of the allocation |
|
inlinenoexcept |
Deallocate memory pointed to by ptr.
This function synchronizes the stream before deallocating the memory.
| stream | The stream in which to order this deallocation |
| ptr | Pointer to be deallocated |
| bytes | The size in bytes of the allocation. This must be equal to the value of bytes that was passed to the allocate call that returned ptr. |
| alignment | The alignment that was passed to the allocate call that returned ptr |
|
inlinenoexcept |
Deallocate memory pointed to by ptr synchronously.
| ptr | Pointer to be deallocated |
| bytes | The size in bytes of the allocation |
| alignment | The alignment that was passed to the allocate call that returned ptr |
|
inlinenoexcept |
Compare this resource to another.
All instances of system_memory_resource are equivalent.
|
default |
Default move assignment operator.
|
default |
Default copy assignment operator.
|
inlinenoexcept |
Compare this resource to another.
All instances of system_memory_resource are equivalent.
|
friend |
Enables the cuda::mr::device_accessible property.
This property declares that a system_memory_resource provides device-accessible memory
|
friend |
Enables the cuda::mr::host_accessible property.
This property declares that a system_memory_resource provides host-accessible memory