Memory resource that provides pinned (page-locked) host memory using a pool. More...
#include <pinned_memory_resource.hpp>
Public Member Functions | |
| PinnedMemoryResource (int numa_id=get_current_numa_node(), PinnedPoolProperties pool_properties={}) | |
| Construct a pinned (page-locked) host memory resource. More... | |
| void * | allocate (rmm::cuda_stream_view stream, std::size_t size, std::size_t alignment=rmm::CUDA_ALLOCATION_ALIGNMENT) override |
| Allocates pinned host memory associated with a CUDA stream. More... | |
| void | deallocate (rmm::cuda_stream_view stream, void *ptr, std::size_t size, std::size_t alignment=rmm::CUDA_ALLOCATION_ALIGNMENT) noexcept override |
| Deallocates pinned host memory associated with a CUDA stream. More... | |
| bool | is_equal (HostMemoryResource const &other) const noexcept override |
| Compares this resource to another resource. More... | |
Public Member Functions inherited from rapidsmpf::HostMemoryResource | |
| HostMemoryResource ()=default | |
| Default constructor. | |
| virtual | ~HostMemoryResource ()=default |
| Virtual destructor to allow polymorphic use. | |
| HostMemoryResource (HostMemoryResource const &)=default | |
| Copyable. | |
| HostMemoryResource (HostMemoryResource &&)=default | |
| Movable. | |
| HostMemoryResource & | operator= (HostMemoryResource const &)=default |
| Copy assignment. More... | |
| HostMemoryResource & | operator= (HostMemoryResource &&)=default |
| Move assignment. More... | |
| void * | allocate_sync (std::size_t, std::size_t) |
| Synchronously allocates host memory is disabled. More... | |
| void | deallocate_sync (void *, std::size_t, std::size_t) |
| Synchronously deallocates host memory is disabled. More... | |
| virtual bool | is_equal ([[maybe_unused]] HostMemoryResource const &other) const noexcept |
| Compares this resource to another resource. More... | |
| bool | operator== (HostMemoryResource const &other) const noexcept |
| Compares this resource to another resource. More... | |
| bool | operator!= (HostMemoryResource const &other) const noexcept |
| Compares this resource to another resource. More... | |
Static Public Member Functions | |
| static std::shared_ptr< PinnedMemoryResource > | make_if_available (int numa_id=get_current_numa_node(), PinnedPoolProperties pool_properties={}) |
| Create a pinned memory resource if the system supports pinned memory. More... | |
| static std::shared_ptr< PinnedMemoryResource > | from_options (config::Options options) |
| Construct from configuration options. More... | |
Static Public Attributes | |
| static constexpr auto | Disabled = nullptr |
| Sentinel value used to disable pinned host memory. | |
Friends | |
| void | get_property (PinnedMemoryResource const &, cuda::mr::device_accessible) noexcept |
Enables the cuda::mr::host_accessible property. More... | |
Memory resource that provides pinned (page-locked) host memory using a pool.
This resource allocates and deallocates pinned host memory asynchronously through CUDA streams. It offers higher bandwidth and lower latency for device transfers compared to regular pageable host memory.
Definition at line 87 of file pinned_memory_resource.hpp.
| rapidsmpf::PinnedMemoryResource::PinnedMemoryResource | ( | int | numa_id = get_current_numa_node(), |
| PinnedPoolProperties | pool_properties = {} |
||
| ) |
Construct a pinned (page-locked) host memory resource.
The pool has no maximum size. To restrict its growth, use BufferResource::LimitAvailableMemory or a similar mechanism.
| numa_id | NUMA node from which memory should be allocated. By default, the resource uses the NUMA node of the calling thread. |
| pool_properties | Properties for configuring the pinned memory pool. |
| rapidsmpf::cuda_error | If pinned host memory pools are not supported by the current CUDA version or if CUDA initialization fails. |
|
overridevirtual |
Allocates pinned host memory associated with a CUDA stream.
| stream | CUDA stream associated with the allocation. |
| size | Number of bytes to at least allocate. |
| alignment | Required alignment. |
| std::bad_alloc | If the allocation fails. |
| std::invalid_argument | If alignment is not a valid alignment. |
Reimplemented from rapidsmpf::HostMemoryResource.
|
overridevirtualnoexcept |
Deallocates pinned host memory associated with a CUDA stream.
| stream | CUDA stream associated with operations that used ptr. |
| ptr | Pointer to the memory to deallocate. May be nullptr. |
| size | Number of bytes previously allocated at ptr. |
| alignment | Alignment originally used for the allocation. |
Reimplemented from rapidsmpf::HostMemoryResource.
|
static |
Construct from configuration options.
| options | Configuration options. |
|
overridenoexcept |
Compares this resource to another resource.
Two resources are considered equal if memory allocated by one may be deallocated by the other.
| other | The resource to compare with. |
|
static |
Create a pinned memory resource if the system supports pinned memory.
| numa_id | The NUMA node to associate with the resource. Defaults to the current NUMA node. |
| pool_properties | Properties for configuring the pinned memory pool. |
PinnedMemoryResource when supported, otherwise PinnedMemoryResource::Disabled.
|
friend |
Enables the cuda::mr::host_accessible property.
This property declares that a HostMemoryResource provides host accessible memory.
Definition at line 184 of file pinned_memory_resource.hpp.