|
UMPIRE
Umpire: resource management and provision
|
AllocationStrategy provides a unified interface to all classes that can be used to allocate and free data. More...
#include </home/docs/checkouts/readthedocs.org/user_builds/umpire/checkouts/develop/src/umpire/strategy/AllocationStrategy.hpp>

Public Member Functions | |
| AllocationStrategy (const std::string &name, int id, AllocationStrategy *parent, const std::string &strategy_name) noexcept | |
| Construct a new AllocationStrategy object. More... | |
| virtual | ~AllocationStrategy ()=default |
| 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 void | release () |
| Release any and all unused memory held by this AllocationStrategy. More... | |
| 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 | getActualSize () const noexcept |
| Get the current amount of memory allocated by this allocator. More... | |
| virtual std::size_t | getAllocationCount () const noexcept |
| Get the total number of active allocations by this allocator. More... | |
| virtual Platform | getPlatform () noexcept=0 |
| Get the platform associated with this AllocationStrategy. 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... | |
| virtual MemoryResourceTraits | getTraits () const noexcept |
| virtual bool | tracksMemoryUse () const noexcept |
| bool | isTracked () const noexcept |
Public Attributes | |
| std::size_t | m_current_size {0} |
| std::size_t | m_high_watermark {0} |
| std::size_t | m_allocation_count {0} |
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 |
Friends | |
| class | umpire::ResourceManager |
| class | umpire::Allocator |
| std::ostream & | operator<< (std::ostream &os, const AllocationStrategy &strategy) |
AllocationStrategy provides a unified interface to all classes that can be used to allocate and free data.
|
noexcept |
Construct a new AllocationStrategy object.
All AllocationStrategy objects must will have a unique name and id. This uniqueness is enforced by the ResourceManager.
| name | The name of this AllocationStrategy object. |
| id | The id of this AllocationStrategy object. |
|
virtualdefault |
| void * umpire::strategy::AllocationStrategy::allocate_internal | ( | std::size_t | bytes | ) |
References m_allocation_count, m_current_size, and 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().
| void * umpire::strategy::AllocationStrategy::allocate_named_internal | ( | const std::string & | name, |
| std::size_t | bytes | ||
| ) |
References m_allocation_count, m_current_size, and m_high_watermark.
Referenced by umpire::strategy::NamingShim::allocate(), and umpire::strategy::NamedAllocationStrategy::allocate_named().
| void umpire::strategy::AllocationStrategy::deallocate_internal | ( | void * | ptr, |
| std::size_t | size = 0 |
||
| ) |
References m_allocation_count, and 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().
|
virtual |
Release any and all unused memory held by this AllocationStrategy.
Reimplemented in umpire::strategy::FixedPool, umpire::strategy::ResourceAwarePool, umpire::strategy::QuickPool, umpire::strategy::MixedPool, and umpire::strategy::DynamicPoolList.
References umpire::util::message::Info, and UMPIRE_LOG.
Referenced by umpire::Allocator::release().
|
virtualnoexcept |
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 m_current_size.
Referenced by getActualSize(), and umpire::Allocator::getCurrentSize().
|
virtualnoexcept |
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 m_high_watermark.
Referenced by umpire::Allocator::getHighWatermark().
|
virtualnoexcept |
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 in umpire::strategy::FixedPool, umpire::strategy::ResourceAwarePool, umpire::strategy::QuickPool, umpire::strategy::MixedPool, umpire::strategy::DynamicPoolList, and umpire::resource::HostSharedMemoryResource.
References getCurrentSize().
Referenced by umpire::Allocator::getActualSize().
|
virtualnoexcept |
Get the total number of active allocations by this allocator.
References m_allocation_count.
Referenced by umpire::Allocator::getAllocationCount().
|
pure virtualnoexcept |
Get the platform associated with this AllocationStrategy.
The Platform distinguishes the appropriate place to execute operations on memory allocated by this AllocationStrategy.
Implemented in umpire::resource::MemoryResource, umpire::strategy::FixedPool, umpire::strategy::ThreadSafeAllocator, umpire::strategy::SlotPool, umpire::strategy::SizeLimiter, umpire::strategy::ResourceAwarePool, umpire::strategy::QuickPool, umpire::strategy::NumaPolicy, umpire::strategy::NamingShim, umpire::strategy::NamedAllocationStrategy, umpire::strategy::MonotonicAllocationStrategy, umpire::strategy::MixedPool, umpire::strategy::DynamicPoolList, umpire::strategy::DeviceIpcAllocator, umpire::strategy::AllocationPrefetcher, umpire::strategy::AllocationAdvisor, umpire::strategy::AlignedAllocator, umpire::resource::HostSharedMemoryResource, umpire::resource::HostMpi3SharedMemoryResource, umpire::resource::SyclDeviceMemoryResource< _allocator >, umpire::resource::NullMemoryResource, umpire::resource::NoOpMemoryResource, umpire::resource::HipUnifiedMemoryResource, umpire::resource::HipPinnedMemoryResource, umpire::resource::HipDeviceMemoryResource, umpire::resource::HipConstantMemoryResource, umpire::resource::FileMemoryResource, umpire::resource::DefaultMemoryResource< _allocator >, umpire::resource::CudaDeviceMemoryResource, and umpire::resource::CudaConstantMemoryResource.
Referenced by umpire::strategy::AlignedAllocator::AlignedAllocator(), umpire::op::MemoryOperationRegistry::find(), umpire::Allocator::getPlatform(), umpire::strategy::AlignedAllocator::getPlatform(), umpire::strategy::AllocationAdvisor::getPlatform(), umpire::strategy::AllocationPrefetcher::getPlatform(), umpire::strategy::DeviceIpcAllocator::getPlatform(), umpire::strategy::DynamicPoolList::getPlatform(), umpire::strategy::MixedPool::getPlatform(), umpire::strategy::MonotonicAllocationStrategy::getPlatform(), umpire::strategy::NamedAllocationStrategy::getPlatform(), umpire::strategy::NamingShim::getPlatform(), umpire::strategy::QuickPool::getPlatform(), umpire::strategy::ResourceAwarePool::getPlatform(), umpire::strategy::SizeLimiter::getPlatform(), umpire::strategy::SlotPool::getPlatform(), and umpire::strategy::ThreadSafeAllocator::getPlatform().
|
noexcept |
Get the name of this AllocationStrategy.
References m_name.
Referenced by umpire::strategy::DynamicPoolList::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().
|
noexcept |
References m_strategy_name.
Referenced by umpire::Allocator::getStrategyName().
|
noexcept |
Get the id of this AllocationStrategy.
References m_id.
Referenced by umpire::ResourceManager::destroyAllocator(), and umpire::Allocator::getId().
|
virtualnoexcept |
Traces where the allocator came from.
References m_parent.
Referenced by umpire::ResourceManager::destroyAllocator(), umpire::Allocator::getParent(), and umpire::is_accessible().
|
virtualnoexcept |
Reimplemented in umpire::strategy::FixedPool, umpire::strategy::ThreadSafeAllocator, umpire::strategy::SlotPool, umpire::strategy::SizeLimiter, umpire::strategy::ResourceAwarePool, umpire::strategy::QuickPool, umpire::strategy::NumaPolicy, umpire::strategy::NamingShim, umpire::strategy::NamedAllocationStrategy, umpire::strategy::MonotonicAllocationStrategy, umpire::strategy::MixedPool, umpire::strategy::DeviceIpcAllocator, umpire::strategy::AllocationPrefetcher, umpire::strategy::AllocationAdvisor, umpire::strategy::AlignedAllocator, umpire::resource::MemoryResource, and umpire::strategy::DynamicPoolList.
References umpire::util::message::Error, and UMPIRE_LOG.
Referenced by umpire::op::OpenMPTargetMemsetOperation::apply(), umpire::op::SyclMemPrefetchOperation::apply(), umpire::op::SyclMemsetOperation::apply(), umpire::strategy::DynamicPoolList::getTraits(), umpire::strategy::AlignedAllocator::getTraits(), umpire::strategy::AllocationAdvisor::getTraits(), umpire::strategy::AllocationPrefetcher::getTraits(), umpire::strategy::DeviceIpcAllocator::getTraits(), umpire::strategy::MixedPool::getTraits(), umpire::strategy::MonotonicAllocationStrategy::getTraits(), umpire::strategy::NamedAllocationStrategy::getTraits(), umpire::strategy::NamingShim::getTraits(), umpire::strategy::NumaPolicy::getTraits(), umpire::strategy::QuickPool::getTraits(), umpire::strategy::ResourceAwarePool::getTraits(), umpire::strategy::SizeLimiter::getTraits(), umpire::strategy::SlotPool::getTraits(), umpire::strategy::ThreadSafeAllocator::getTraits(), umpire::op::OpenMPTargetCopyOperation::transform(), umpire::op::SyclCopyOperation::transform(), umpire::op::SyclCopyFromOperation::transform(), and umpire::op::SyclCopyToOperation::transform().
|
virtualnoexcept |
Reimplemented in umpire::strategy::ResourceAwarePool, umpire::strategy::QuickPool, and umpire::strategy::DynamicPoolList.
|
noexcept |
References m_tracked.
Referenced by umpire::Allocator::isTracked().
|
protectednoexcept |
|
friend |
|
friend |
|
friend |
| std::size_t umpire::strategy::AllocationStrategy::m_current_size {0} |
| std::size_t umpire::strategy::AllocationStrategy::m_high_watermark {0} |
| std::size_t umpire::strategy::AllocationStrategy::m_allocation_count {0} |
|
protected |
Referenced by umpire::strategy::NamingShim::allocate(), and getName().
|
protected |
Referenced by getStrategyName().
|
protected |
Referenced by getId().
|
protected |
Referenced by isTracked().
|
protected |
Referenced by getParent().