|
UMPIRE
Umpire: resource management and provision
|
Simple dynamic pool for allocations. More...
#include </home/docs/checkouts/readthedocs.org/user_builds/umpire/checkouts/develop/src/umpire/strategy/DynamicPoolList.hpp>

Public Member Functions | |
| DynamicPoolList (const std::string &name, int id, Allocator allocator, const std::size_t first_minimum_pool_allocation_size=s_default_first_block_size, const std::size_t next_minimum_pool_allocation_size=s_default_next_block_size, const std::size_t alignment=s_default_alignment, PoolCoalesceHeuristic< DynamicPoolList > should_coalesce=percent_releasable_hwm(100)) noexcept | |
| Construct a new DynamicPoolList. More... | |
| DynamicPoolList (const DynamicPoolList &)=delete | |
| void * | allocate (size_t bytes) override |
| void | deallocate (void *ptr, std::size_t size) override |
| Free the memory at ptr. More... | |
| void | release () override |
| Release any and all unused memory held by this AllocationStrategy. More... | |
| std::size_t | getReleasableBlocks () const noexcept |
| std::size_t | getTotalBlocks () const noexcept |
| std::size_t | getActualSize () const noexcept override |
| Get the current amount of memory allocated by this allocator. More... | |
| std::size_t | getActualHighwaterMark () const noexcept |
| std::size_t | getAlignedSize () const noexcept |
| std::size_t | getAlignedHighwaterMark () const noexcept |
| Platform | getPlatform () noexcept override |
| Get the platform associated with this AllocationStrategy. More... | |
| MemoryResourceTraits | getTraits () const noexcept final override |
| bool | tracksMemoryUse () const noexcept override |
| std::size_t | getReleasableSize () const noexcept |
| Get the number of bytes that may be released back to resource. More... | |
| std::size_t | getBlocksInPool () const noexcept |
| Get the number of memory blocks that the pool has. More... | |
| std::size_t | getLargestAvailableBlock () const noexcept |
| Get the largest allocatable number of bytes from pool before the pool will grow. More... | |
| void | coalesce () noexcept |
| void * | allocate_internal (std::size_t bytes) |
| void * | allocate_named_internal (const std::string &name, std::size_t bytes) |
| void | deallocate_internal (void *ptr, std::size_t size=0) |
| virtual std::size_t | getCurrentSize () const noexcept |
| Get current (total) size of the allocated memory. More... | |
| virtual std::size_t | getHighWatermark () const noexcept |
| Get the high watermark of the total allocated size. More... | |
| virtual std::size_t | getAllocationCount () const noexcept |
| Get the total number of active allocations by this allocator. More... | |
| const std::string & | getName () noexcept |
| Get the name of this AllocationStrategy. More... | |
| const std::string & | getStrategyName () const noexcept |
| int | getId () noexcept |
| Get the id of this AllocationStrategy. More... | |
| virtual AllocationStrategy * | getParent () const noexcept |
| Traces where the allocator came from. More... | |
| bool | isTracked () const noexcept |
Static Public Member Functions | |
| static PoolCoalesceHeuristic< DynamicPoolList > | percent_releasable (int percentage) |
| Coalescing Heuristic functions for Percent-Releasable and Blocks-Releasable. Both have the option to reallocate to High Watermark instead of actual size of the pool (actual size is currently the default). More... | |
| static PoolCoalesceHeuristic< DynamicPoolList > | percent_releasable_hwm (int percentage) |
| static PoolCoalesceHeuristic< DynamicPoolList > | blocks_releasable (std::size_t nblocks) |
| static PoolCoalesceHeuristic< DynamicPoolList > | blocks_releasable_hwm (std::size_t nblocks) |
Public Attributes | |
| std::size_t | m_current_size {0} |
| std::size_t | m_high_watermark {0} |
| std::size_t | m_allocation_count {0} |
Static Public Attributes | |
| static constexpr std::size_t | s_default_first_block_size {512 * 1024 * 1024} |
| static constexpr std::size_t | s_default_next_block_size {1 * 1024 * 1024} |
| static constexpr std::size_t | s_default_alignment {16} |
Protected Member Functions | |
| void | setTracking (bool) noexcept |
Protected Attributes | |
| std::string | m_name |
| std::string | m_strategy_name |
| int | m_id |
| bool | m_tracked {true} |
| AllocationStrategy * | m_parent |
Simple dynamic pool for allocations.
This AllocationStrategy uses Simpool to provide pooling for allocations of any size. The behavior of the pool can be controlled by two parameters: the initial allocation size, and the minimum allocation size.
The initial size controls how large the first piece of memory allocated is, and the minimum size controls the lower bound on all future chunk allocations.
|
noexcept |
Construct a new DynamicPoolList.
| name | Name of this instance of the DynamicPoolList. |
| id | Id of this instance of the DynamicPoolList. |
| allocator | Allocation resource that pool uses |
| first_minimum_pool_allocation_size | Minimum size the pool initially allocates |
| next_minimum_pool_allocation_size | The minimum size of all future allocations. |
| align_bytes | Number of bytes with which to align allocation sizes (power-of-2) |
| do_heuristic | Heuristic for when to perform coalesce operation |
|
delete |
|
static |
Coalescing Heuristic functions for Percent-Releasable and Blocks-Releasable. Both have the option to reallocate to High Watermark instead of actual size of the pool (actual size is currently the default).
References UMPIRE_ERROR, and UMPIRE_UNUSED_ARG.
|
static |
References UMPIRE_ERROR, and UMPIRE_UNUSED_ARG.
|
static |
|
static |
|
override |
References DynamicSizePool< IA >::allocate(), umpire::util::message::Debug, and UMPIRE_LOG.
|
overridevirtual |
Free the memory at ptr.
| ptr | Pointer to free. |
Implements umpire::strategy::AllocationStrategy.
References DynamicSizePool< IA >::coalesce(), DynamicSizePool< IA >::deallocate(), umpire::util::message::Debug, and UMPIRE_LOG.
|
overridevirtual |
Release any and all unused memory held by this AllocationStrategy.
Reimplemented from umpire::strategy::AllocationStrategy.
References umpire::util::message::Debug, DynamicSizePool< IA >::release(), and UMPIRE_LOG.
|
noexcept |
References DynamicSizePool< IA >::getReleasableBlocks().
|
noexcept |
References DynamicSizePool< IA >::getTotalBlocks().
|
overridevirtualnoexcept |
Get the current amount of memory allocated by this allocator.
Note that this can be larger than getCurrentSize(), particularly if the AllocationStrategy implements some kind of pooling.
Reimplemented from umpire::strategy::AllocationStrategy.
References umpire::util::message::Debug, DynamicSizePool< IA >::getActualSize(), and UMPIRE_LOG.
|
noexcept |
References DynamicSizePool< IA >::getActualHighwaterMark().
|
noexcept |
References DynamicSizePool< IA >::getAlignedSize().
|
noexcept |
References DynamicSizePool< IA >::getAlignedHighwaterMark().
|
overridevirtualnoexcept |
Get the platform associated with this AllocationStrategy.
The Platform distinguishes the appropriate place to execute operations on memory allocated by this AllocationStrategy.
Implements umpire::strategy::AllocationStrategy.
References umpire::strategy::AllocationStrategy::getPlatform().
|
finaloverridevirtualnoexcept |
Reimplemented from umpire::strategy::AllocationStrategy.
References umpire::strategy::AllocationStrategy::getTraits().
|
overridevirtualnoexcept |
Reimplemented from umpire::strategy::AllocationStrategy.
|
noexcept |
Get the number of bytes that may be released back to resource.
A memory pool has a set of blocks that have no allocations against them. If the size of the set is greater than one, then the pool will have a number of bytes that may be released back to the resource or coalesced into a larger block.
References umpire::util::message::Debug, DynamicSizePool< IA >::getReleasableSize(), and UMPIRE_LOG.
|
noexcept |
Get the number of memory blocks that the pool has.
References umpire::util::message::Debug, DynamicSizePool< IA >::getBlocksInPool(), and UMPIRE_LOG.
|
noexcept |
Get the largest allocatable number of bytes from pool before the pool will grow.
return The largest number of bytes that may be allocated without causing pool growth
References umpire::util::message::Debug, DynamicSizePool< IA >::getLargestAvailableBlock(), and UMPIRE_LOG.
|
noexcept |
|
inherited |
References umpire::strategy::AllocationStrategy::m_allocation_count, umpire::strategy::AllocationStrategy::m_current_size, and umpire::strategy::AllocationStrategy::m_high_watermark.
Referenced by umpire::strategy::mixins::AlignedAllocation::aligned_allocate(), umpire::strategy::AlignedAllocator::allocate(), umpire::strategy::AllocationAdvisor::allocate(), umpire::strategy::AllocationPrefetcher::allocate(), umpire::strategy::MixedPool::allocate(), umpire::strategy::NamedAllocationStrategy::allocate(), umpire::strategy::NumaPolicy::allocate(), umpire::strategy::SizeLimiter::allocate(), umpire::strategy::SlotPool::allocate(), umpire::strategy::ThreadSafeAllocator::allocate(), and umpire::strategy::MonotonicAllocationStrategy::MonotonicAllocationStrategy().
|
inherited |
References umpire::strategy::AllocationStrategy::m_allocation_count, umpire::strategy::AllocationStrategy::m_current_size, and umpire::strategy::AllocationStrategy::m_high_watermark.
Referenced by umpire::strategy::NamingShim::allocate(), and umpire::strategy::NamedAllocationStrategy::allocate_named().
|
inherited |
References umpire::strategy::AllocationStrategy::m_allocation_count, and umpire::strategy::AllocationStrategy::m_current_size.
Referenced by umpire::strategy::mixins::AlignedAllocation::aligned_deallocate(), umpire::strategy::AlignedAllocator::deallocate(), umpire::strategy::AllocationAdvisor::deallocate(), umpire::strategy::AllocationPrefetcher::deallocate(), umpire::strategy::MixedPool::deallocate(), umpire::strategy::NamedAllocationStrategy::deallocate(), umpire::strategy::NamingShim::deallocate(), umpire::strategy::NumaPolicy::deallocate(), umpire::strategy::SizeLimiter::deallocate(), umpire::strategy::ThreadSafeAllocator::deallocate(), umpire::strategy::DeviceIpcAllocator::deallocate(), umpire::strategy::DeviceIpcAllocator::~DeviceIpcAllocator(), umpire::strategy::MonotonicAllocationStrategy::~MonotonicAllocationStrategy(), and umpire::strategy::SlotPool::~SlotPool().
|
virtualnoexceptinherited |
Get current (total) size of the allocated memory.
This is the total size of all allocation currently 'live' that have been made by this AllocationStrategy object.
Reimplemented in umpire::strategy::FixedPool, umpire::strategy::MonotonicAllocationStrategy, umpire::resource::SyclDeviceMemoryResource< _allocator >, umpire::resource::NullMemoryResource, umpire::resource::NoOpMemoryResource, and umpire::resource::FileMemoryResource.
References umpire::strategy::AllocationStrategy::m_current_size.
Referenced by umpire::strategy::AllocationStrategy::getActualSize(), and umpire::Allocator::getCurrentSize().
|
virtualnoexceptinherited |
Get the high watermark of the total allocated size.
This is equivalent to the highest observed value of getCurrentSize.
Reimplemented in umpire::strategy::FixedPool, umpire::strategy::MonotonicAllocationStrategy, umpire::resource::SyclDeviceMemoryResource< _allocator >, umpire::resource::NullMemoryResource, umpire::resource::NoOpMemoryResource, and umpire::resource::FileMemoryResource.
References umpire::strategy::AllocationStrategy::m_high_watermark.
Referenced by umpire::Allocator::getHighWatermark().
|
virtualnoexceptinherited |
Get the total number of active allocations by this allocator.
References umpire::strategy::AllocationStrategy::m_allocation_count.
Referenced by umpire::Allocator::getAllocationCount().
|
noexceptinherited |
Get the name of this AllocationStrategy.
References umpire::strategy::AllocationStrategy::m_name.
Referenced by coalesce(), umpire::strategy::QuickPool::coalesce(), umpire::strategy::ResourceAwarePool::coalesce(), umpire::strategy::mixins::Inspector::deregisterAllocation(), umpire::ResourceManager::destroyAllocator(), DynamicSizePool< IA >::DynamicSizePool(), umpire::Allocator::getName(), and umpire::util::unwrap_allocation_strategy().
|
noexceptinherited |
References umpire::strategy::AllocationStrategy::m_strategy_name.
Referenced by umpire::Allocator::getStrategyName().
|
noexceptinherited |
Get the id of this AllocationStrategy.
References umpire::strategy::AllocationStrategy::m_id.
Referenced by umpire::ResourceManager::destroyAllocator(), and umpire::Allocator::getId().
|
virtualnoexceptinherited |
Traces where the allocator came from.
References umpire::strategy::AllocationStrategy::m_parent.
Referenced by umpire::ResourceManager::destroyAllocator(), umpire::Allocator::getParent(), and umpire::is_accessible().
|
noexceptinherited |
References umpire::strategy::AllocationStrategy::m_tracked.
Referenced by umpire::Allocator::isTracked().
|
protectednoexceptinherited |
|
staticconstexpr |
|
staticconstexpr |
|
staticconstexpr |
|
inherited |
Referenced by umpire::strategy::AllocationStrategy::allocate_internal(), umpire::strategy::AllocationStrategy::allocate_named_internal(), umpire::strategy::AllocationStrategy::deallocate_internal(), umpire::strategy::mixins::Inspector::deregisterAllocation(), umpire::strategy::AllocationStrategy::getCurrentSize(), and umpire::strategy::mixins::Inspector::registerAllocation().
|
inherited |
|
inherited |
Referenced by umpire::strategy::AllocationStrategy::allocate_internal(), umpire::strategy::AllocationStrategy::allocate_named_internal(), umpire::strategy::AllocationStrategy::deallocate_internal(), umpire::strategy::mixins::Inspector::deregisterAllocation(), umpire::strategy::AllocationStrategy::getAllocationCount(), and umpire::strategy::mixins::Inspector::registerAllocation().
|
protectedinherited |
|
protectedinherited |
Referenced by umpire::strategy::AllocationStrategy::getStrategyName().
|
protectedinherited |
Referenced by umpire::strategy::AllocationStrategy::getId().
|
protectedinherited |
Referenced by umpire::strategy::AllocationStrategy::isTracked().
|
protectedinherited |
Referenced by umpire::strategy::AllocationStrategy::getParent().