Host memory resource using standard CPU allocation. More...
#include <host_memory_resource.hpp>
Public Member Functions | |
| 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... | |
| void * | allocate (rmm::cuda_stream_view stream, std::size_t size, std::size_t alignment=rmm::CUDA_ALLOCATION_ALIGNMENT) |
| Allocates 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 |
| Deallocates host memory associated with a CUDA stream. More... | |
| bool | operator== ([[maybe_unused]] HostMemoryResource const &other) const noexcept |
| Compares this resource to another resource. More... | |
| bool | operator!= ([[maybe_unused]] HostMemoryResource const &other) const noexcept |
| Compares this resource to another resource. More... | |
Public Member Functions inherited from rapidsmpf::BackRefMixin< BufferResource > | |
| BackRefMixin () noexcept=default | |
| Construct a mixin with no installed back-reference. | |
| BackRefMixin (BackRefMixin const &other) | |
Acquire shared ownership of other's back-referenced owner. More... | |
| BackRefMixin (BackRefMixin &&) noexcept=default | |
| Move constructor. | |
| BackRefMixin & | operator= (BackRefMixin const &other) |
| Copy assignment with the same semantics as the copy constructor. More... | |
| BackRefMixin & | operator= (BackRefMixin &&) noexcept=default |
| Move assignment operator. More... | |
| bool | operator== (BackRefMixin const &other) const noexcept |
| Owner-based equality. More... | |
| void | set_backref (std::weak_ptr< BufferResource > backref) |
| Install a back-reference on this instance. More... | |
Friends | |
| class | BufferResource |
| void | get_property (HostMemoryResource const &, cuda::mr::host_accessible) noexcept |
Enables the cuda::mr::host_accessible property. More... | |
Host memory resource using standard CPU allocation.
This resource allocates pageable host memory using the new and delete operators. It is intended for use with cuda::mr::resource and related facilities, and advertises the cuda::mr::host_accessible property.
For sufficiently large allocations (>4 MiB), this resource also issues a best-effort request to enable Transparent Huge Pages (THP) on the allocated region. THP can improve device-host memory transfer performance for large buffers. The hint is applied via madvise(MADV_HUGEPAGE) and may be ignored by the kernel depending on system configuration or resource availability.
Definition at line 35 of file host_memory_resource.hpp.
| void* rapidsmpf::HostMemoryResource::allocate | ( | rmm::cuda_stream_view | stream, |
| std::size_t | size, | ||
| std::size_t | alignment = rmm::CUDA_ALLOCATION_ALIGNMENT |
||
| ) |
Allocates 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. |
|
inline |
Synchronously allocates host memory is disabled.
Always use stream-ordered allocators in RapidsMPF.
| std::invalid_argument | Always. |
Definition at line 59 of file host_memory_resource.hpp.
|
noexcept |
Deallocates host memory associated with a CUDA stream.
Synchronizes stream before deallocating the memory with the delete operator.
| 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. |
|
inline |
Synchronously deallocates host memory is disabled.
| std::invalid_argument | Always. |
Definition at line 71 of file host_memory_resource.hpp.
|
inlinenoexcept |
Compares this resource to another resource.
All instances are stateless and interchangeable, so this always returns true.
| other | The resource to compare with. |
Definition at line 129 of file host_memory_resource.hpp.
|
default |
Move assignment.
|
default |
Copy assignment.
|
inlinenoexcept |
Compares this resource to another resource.
All instances are stateless and interchangeable, so this always returns true.
| other | The resource to compare with. |
Definition at line 122 of file host_memory_resource.hpp.
|
friend |
Enables the cuda::mr::host_accessible property.
This property declares that a HostMemoryResource provides host accessible memory
Definition at line 140 of file host_memory_resource.hpp.