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... | |
Friends | |
| 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 32 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 57 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 69 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 127 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 120 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 138 of file host_memory_resource.hpp.