|
UMPIRE
Umpire: resource management and provision
|
File Memory allocator. More...
#include </home/docs/checkouts/readthedocs.org/user_builds/umpire/checkouts/develop/src/umpire/resource/FileMemoryResource.hpp>

Public Member Functions | |
| FileMemoryResource (Platform platform, const std::string &name, int id, MemoryResourceTraits traits) | |
| Construct a new FileMemoryResource. More... | |
| ~FileMemoryResource () | |
| Dallocates and removes all files created by the code meant for allocations. More... | |
| void * | allocate (std::size_t bytes) |
| Creates the allocation of size bytes using mmap. More... | |
| void | deallocate (void *ptr, std::size_t size) |
| Deallocates file connected to the pointer. More... | |
| std::size_t | getCurrentSize () const noexcept |
| Get current (total) size of the allocated memory. More... | |
| std::size_t | getHighWatermark () const noexcept |
| Get the high watermark of the total allocated size. More... | |
| bool | isAccessibleFrom (Platform p) noexcept |
| Platform | getPlatform () noexcept |
| Get the Platform assocatiated with this MemoryResource. More... | |
| MemoryResourceTraits | getTraits () const noexcept override |
| 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 | 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... | |
| 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 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} |
Static Public Attributes | |
| static int | s_file_counter {0} |
Protected Member Functions | |
| void | setTracking (bool) noexcept |
Protected Attributes | |
| Platform | m_platform |
| MemoryResourceTraits | m_traits |
| std::string | m_name |
| std::string | m_strategy_name |
| int | m_id |
| bool | m_tracked {true} |
| AllocationStrategy * | m_parent |
File Memory allocator.
This FileMemoryResource uses mmap to create a file mapping in order to use as additional memory. To create this mapping the function needs to take in the size of memory wanted for the allocation. The set location for the allocation by defult is ./ but can be assigned using enviroment variable "UMPIRE_MEMORY_FILE_DIR"
The return should be a pointer location. The same pointer location can be used for the deallocation. Deallocation uses munmap and removes the file associated with the pointer location.
| umpire::resource::FileMemoryResource::FileMemoryResource | ( | Platform | platform, |
| const std::string & | name, | ||
| int | id, | ||
| MemoryResourceTraits | traits | ||
| ) |
Construct a new FileMemoryResource.
| platform | Platform of this instance of the FileMemoryResource. |
| name | Name of this instance of the FileMemoryResource. |
| id | Id of this instance of the FileMemoryResource. |
| traits | Traits of this instance of the FileMemoryResource. |
| umpire::resource::FileMemoryResource::~FileMemoryResource | ( | ) |
Dallocates and removes all files created by the code meant for allocations.
References deallocate().
|
virtual |
Creates the allocation of size bytes using mmap.
Does the allocation as follows: 1) Find output file directory for mmap files using UMPIRE_MEMORY_FILE_DIR 2) Create name and create the file index using open 3) Setting Size Of Map File. Size is scaled to a page length on the system. 4) Truncate file using ftruncate64 5) Map file index with mmap 6) Store information about the allocated file into m_size_map
| bytes | The requested amount of bytes the user wants to use. Can not be zero or greater than avalable amount of bytes available. |
| UMPIRE_MEMORY_FILE_DIR | Used to specify where memory is going to be allocated from |
Implements umpire::resource::MemoryResource.
References umpire::util::MemoryMap< V >::insert(), s_file_counter, and UMPIRE_ERROR.
|
virtual |
Deallocates file connected to the pointer.
Using m_size_map, the pointer is looked up and the file name and size can be returned. With this munmap can be called to deallocated the correct file.
| ptr | Pointer location used to look up its information in m_size_map |
Implements umpire::resource::MemoryResource.
References umpire::util::MemoryMap< V >::erase(), umpire::util::MemoryMap< V >::find(), and UMPIRE_ERROR.
Referenced by ~FileMemoryResource().
|
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 from umpire::strategy::AllocationStrategy.
|
virtualnoexcept |
Get the high watermark of the total allocated size.
This is equivalent to the highest observed value of getCurrentSize.
Reimplemented from umpire::strategy::AllocationStrategy.
|
virtualnoexcept |
Implements umpire::resource::MemoryResource.
|
virtualnoexcept |
Get the Platform assocatiated with this MemoryResource.
This function is pure virtual and must be implemented by the inheriting class.
Implements umpire::resource::MemoryResource.
References m_platform.
|
overridevirtualnoexceptinherited |
Reimplemented from umpire::strategy::AllocationStrategy.
References umpire::resource::MemoryResource::m_traits.
|
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().
|
virtualinherited |
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().
|
virtualnoexceptinherited |
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 umpire::strategy::AllocationStrategy::getCurrentSize().
Referenced by umpire::Allocator::getActualSize().
|
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 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().
|
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().
|
virtualnoexceptinherited |
Reimplemented in umpire::strategy::ResourceAwarePool, umpire::strategy::QuickPool, and umpire::strategy::DynamicPoolList.
|
noexceptinherited |
References umpire::strategy::AllocationStrategy::m_tracked.
Referenced by umpire::Allocator::isTracked().
|
protectednoexceptinherited |
|
static |
Referenced by allocate().
|
protected |
Referenced by getPlatform().
|
protectedinherited |
|
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().