The global arena for allocating memory from the upstream memory resource. More...
#include <arena.hpp>
Public Member Functions | |
global_arena (Upstream *upstream_mr, std::optional< std::size_t > arena_size) | |
Construct a global arena. More... | |
global_arena (global_arena const &)=delete | |
global_arena & | operator= (global_arena const &)=delete |
global_arena (global_arena &&) noexcept=delete | |
global_arena & | operator= (global_arena &&) noexcept=delete |
~global_arena () | |
Destroy the global arena and deallocate all memory it allocated using the upstream resource. | |
bool | handles (std::size_t size) const |
Should allocation of size bytes be handled by the global arena directly? More... | |
superblock | acquire (std::size_t size) |
Acquire a superblock that can fit a block of the given size. More... | |
void | release (superblock &&sblk) |
Release a superblock. More... | |
void | release (std::set< superblock > &superblocks) |
Release a set of superblocks from a dying arena. More... | |
void * | allocate (std::size_t size) |
Allocate a large block directly. More... | |
bool | deallocate (void *ptr, std::size_t size, cuda_stream_view stream) |
Deallocate memory pointed to by ptr . More... | |
bool | deallocate (void *ptr, std::size_t bytes) |
Deallocate memory pointed to by ptr . More... | |
void | dump_memory_log (std::shared_ptr< spdlog::logger > const &logger) const |
Dump memory to log. More... | |
The global arena for allocating memory from the upstream memory resource.
The global arena is a shared memory pool from which other arenas allocate superblocks.
Upstream | Memory resource to use for allocating the arena. Implements rmm::mr::device_memory_resource interface. |
|
inline |
Construct a global arena.
rmm::logic_error | if upstream_mr == nullptr . |
upstream_mr | The memory resource from which to allocate blocks for the pool |
arena_size | Size in bytes of the global arena. Defaults to half of the available memory on the current device. |
|
inline |
Acquire a superblock that can fit a block of the given size.
size | The size in bytes of the allocation. |
|
inline |
Allocate a large block directly.
size | The size in bytes of the allocation. |
|
inline |
Deallocate memory pointed to by ptr
.
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 . |
|
inline |
Deallocate memory pointed to by ptr
.
ptr | Pointer to be deallocated. |
size | The size in bytes of the allocation. This must be equal to the value of size that was passed to the allocate call that returned p . |
stream | Stream on which to perform deallocation. |
|
inline |
Dump memory to log.
logger | the spdlog logger to use |
|
inline |
Should allocation of size
bytes be handled by the global arena directly?
size | The size in bytes of the allocation. |
|
inline |
Release a set of superblocks from a dying arena.
superblocks | The set of superblocks. |
|
inline |
Release a superblock.
s | Superblock to be released. |