Hedgehog
3.1.0
A library to generate hybrid pipeline workflow systems
|
Base memory manager. More...
#include "memory_manager.h"
Public Member Functions | |
MemoryManager (size_t const &capacity) | |
Create a memory manager with a certain capacity. | |
~MemoryManager () override=default | |
Default destructor. | |
std::shared_ptr< AbstractMemoryManager > | copy () override |
Default copy method. | |
virtual void | initializeMemoryManager () |
User-definable initialization step for a memory manager. | |
std::shared_ptr< ManagedMemory > | getManagedMemory () final |
Get managed memory from the pool. | |
![]() | |
AbstractMemoryManager (size_t const &capacity) | |
Only used constructor. | |
virtual | ~AbstractMemoryManager ()=default |
Default destructor. | |
int | deviceId () const |
Device Id accessor. | |
size_t | currentSize () |
Return the current size of the inside pool. | |
size_t | capacity () const |
Capacity accessor. | |
void | deviceId (int deviceId) |
Device id setter. | |
void | profiler (const std::shared_ptr< NvtxProfiler > &profiler) |
NVTX profiler setter. | |
virtual std::shared_ptr< ManagedMemory > | getManagedMemory ()=0 |
Get an available managed memory, block if none are available. | |
virtual void | recycleMemory (std::shared_ptr< ManagedMemory > const &managedMemory)=0 |
Recycle memory. | |
virtual std::shared_ptr< AbstractMemoryManager > | copy ()=0 |
Virtual copy method used for task duplication and execution pipeline. | |
virtual void | initialize ()=0 |
Initialize the memory manager. | |
virtual std::string | managedType () const =0 |
Return the real managed type under the form of a string. | |
Private Member Functions | |
void | recycleMemory (std::shared_ptr< ManagedMemory > const &managedMemory) final |
Recycling mechanism for managed memory. | |
void | initialize () final |
Initialize the memory manager. | |
std::string | managedType () const final |
Getter to real managed type as string. | |
Additional Inherited Members | |
![]() | |
std::shared_ptr< NvtxProfiler > const & | profiler () const |
Accessor to NVTX profiler. | |
std::unique_ptr< tool::Pool< ManagedMemory > > const & | pool () const |
Inside pool accessor. | |
bool | isInitialized () const |
Initialized flag accessor. | |
std::mutex & | memoryManagerMutex () |
User api mutex accessor. | |
void | initialized () |
Flag the memory manager has initialized. | |
![]() | |
std::mutex | memoryManagerMutex_ = {} |
Mutex for user interface. | |
Base memory manager.
Memory manager with default created managed object
T | Type managed by the memory manager |
Definition at line 37 of file memory_manager.h.
|
inlineexplicit |
Create a memory manager with a certain capacity.
capacity | Capacity of the memory manager |
Definition at line 41 of file memory_manager.h.
|
overridedefault |
Default destructor.
|
inlineoverridevirtual |
Default copy method.
Implements hh::AbstractMemoryManager.
Definition at line 49 of file memory_manager.h.
|
inlinefinalvirtual |
Get managed memory from the pool.
Get managed memory from the pool. If the pool is empty, the call will block until a new element get available.
Implements hh::AbstractMemoryManager.
Definition at line 60 of file memory_manager.h.
|
inlinefinalprivatevirtual |
Initialize the memory manager.
Thread safe initialization, fill the pool with default constructed object
Implements hh::AbstractMemoryManager.
Definition at line 87 of file memory_manager.h.
|
inlinevirtual |
User-definable initialization step for a memory manager.
Definition at line 54 of file memory_manager.h.
|
inlinefinalprivatevirtual |
Getter to real managed type as string.
Implements hh::AbstractMemoryManager.
Definition at line 105 of file memory_manager.h.
|
inlinefinalprivatevirtual |
Recycling mechanism for managed memory.
Thread safe recycle that will in sequence:
managedMemory | Type of the managed memory |
Implements hh::AbstractMemoryManager.
Definition at line 74 of file memory_manager.h.