A coalescing best-fit suballocator which uses a pool of memory allocated from an upstream memory_resource. More...
#include <pool_memory_resource.hpp>


Public Member Functions | |
| pool_memory_resource (cuda::mr::any_resource< cuda::mr::device_accessible > upstream, std::size_t initial_pool_size, std::optional< std::size_t > maximum_pool_size=std::nullopt) | |
Construct a pool_memory_resource and allocate the initial device memory pool using upstream. More... | |
| device_async_resource_ref | get_upstream_resource () const noexcept |
| rmm::device_async_resource_ref to the upstream resource More... | |
| std::size_t | pool_size () const noexcept |
| Computes the size of the current pool. More... | |
Friends | |
| void | get_property (pool_memory_resource const &, cuda::mr::device_accessible) noexcept |
Enables the cuda::mr::device_accessible property. More... | |
A coalescing best-fit suballocator which uses a pool of memory allocated from an upstream memory_resource.
Allocation and deallocation are thread-safe. Also, this class is compatible with CUDA per-thread default stream.
This class is copyable and shares ownership of its internal state, allowing multiple instances to safely reference the same underlying pool.
|
explicit |
Construct a pool_memory_resource and allocate the initial device memory pool using upstream.
| rmm::logic_error | if initial_pool_size is not aligned to a multiple of 256 bytes. |
| rmm::logic_error | if maximum_pool_size is neither the default nor aligned to a multiple of 256 bytes. |
| upstream | The resource from which to allocate blocks for the pool. |
| initial_pool_size | Minimum size, in bytes, of the initial pool. |
| maximum_pool_size | Maximum size, in bytes, that the pool can grow to. Defaults to all of the available memory from the upstream resource. |
|
noexcept |
rmm::device_async_resource_ref to the upstream resource
|
noexcept |
Computes the size of the current pool.
Includes allocated as well as free memory.
|
friend |
Enables the cuda::mr::device_accessible property.
This property declares that a pool_memory_resource provides device accessible memory