|
Hedgehog
0.0.0
A library to generate hybrid pipeline workflow systems
|
Derived class from AbstractMemoryManager for statically allocated MemoryData, used for example for GPU computation to avoid synchronisation during dynamic allocation. More...
#include "static_memory_manager.h"


Classes | |
| class | HasConstructor |
| SFINAE construct to test if ManagedMemory has a constructor with Args... as parameter. More... | |
Public Member Functions | |
| StaticMemoryManager ()=delete | |
| Deleted default constructor. | |
| StaticMemoryManager (size_t const &capacity, Args ... args) | |
| Constructor to use defining the pool capacity and the arguments to give the type constructor. More... | |
| StaticMemoryManager (StaticMemoryManager< ManagedMemory, Args... > &rhs) | |
| Copy constructor used by the copy method. More... | |
| void | initialize () final |
| Initialize method, calling the private initialize method with the pack arguments, and the user definable initializeMemoryManager. | |
| std::shared_ptr< AbstractMemoryManager< ManagedMemory > > | copy () override |
| Copy method used for task duplication and execution pipeline. More... | |
Public Member Functions inherited from hh::AbstractMemoryManager< ManagedMemory > | |
| AbstractMemoryManager ()=delete | |
| Deleted Default constructor. | |
| AbstractMemoryManager (size_t const &capacity) | |
| Only used constructor. More... | |
| virtual | ~AbstractMemoryManager ()=default |
| Default destructor. | |
| void | deviceId (int deviceId) |
| Device id setter. More... | |
| void | profiler (const std::shared_ptr< NvtxProfiler > &profiler) |
| NVTX profiler setter. More... | |
| size_t | currentSize () |
| Return the current size of the inside pool. More... | |
| std::shared_ptr< ManagedMemory > | getManagedMemory () |
| Get an available managed memory, block if none are available. More... | |
| void | recycleMemory (std::shared_ptr< MemoryData< ManagedMemory >> managedMemory) |
| Recycle memory. More... | |
| virtual void | initializeMemoryManager () |
| User-definable initialization step for a memory manager. | |
Private Member Functions | |
| template<size_t... Is> | |
| void | initialize (std::index_sequence< Is... >) |
| Private initialize method to call a specific constructor for the type. More... | |
Private Attributes | |
| std::tuple< Args... > | args_ = {} |
| Values to pass to the constructor. | |
Additional Inherited Members | |
Protected Member Functions inherited from hh::AbstractMemoryManager< ManagedMemory > | |
| int | deviceId () const |
| Device Id accessor. More... | |
| std::unique_ptr< behavior::Pool< ManagedMemory > > const & | pool () const |
| Inside pool accessor. More... | |
| size_t | capacity () const |
| Capacity accessor. More... | |
| bool | isInitialized () const |
| Initialized flag accessor. More... | |
| std::mutex & | memoryManagerMutex () |
| User api mutex accessor. More... | |
| void | initialized () |
| Flag the memory manager has initialized. | |
Protected Attributes inherited from hh::AbstractMemoryManager< ManagedMemory > | |
| std::mutex | memoryManagerMutex_ |
| Mutex for user interface. | |
Derived class from AbstractMemoryManager for statically allocated MemoryData, used for example for GPU computation to avoid synchronisation during dynamic allocation.
The main difference between the AbstractMemoryManager and the StaticMemoryManager, is the allocation process. Instead of filling the pool with default constructed data, the data will be constructed with a specific constructor. In order to select the constructor, the parameter's type(s) of the constructor that will be used as part of the template list of the StaticMemoryManager. For example, we can build a class A as:
So the memory manager
will fill a pool with 10 A, calling the constructor:
The memory manager
will fill a pool with 12 A, calling the constructor:
with 42 (int) and 6.5 (float) as values. So the memory manager
will fill a pool with 1 A (a pool can not be empty), calling the constructor:
with 42 (int), 6.5 (float), 3.14159 (double) as values.
Because the static memory manager is made to be used "as is", a copy method has been implemented using the copy constructor. So if the StaticMemoryManager needs to be derived, use the copy constructor of the StaticMemoryManager to transfer mandatory attributes to the copy.
| ManagedMemory | Type to be managed by the memory manager |
| Args | List of types corresponding to the constructor list of types |
Definition at line 83 of file static_memory_manager.h.
|
inlineexplicit |
Constructor to use defining the pool capacity and the arguments to give the type constructor.
| capacity | Pool capacity |
| args | List of arguments to give the type constructor |
Definition at line 120 of file static_memory_manager.h.
|
inline |
Copy constructor used by the copy method.
| rhs | StaticMemoryManager to copy |
Definition at line 126 of file static_memory_manager.h.
|
inlineoverridevirtual |
Copy method used for task duplication and execution pipeline.
Reimplemented from hh::AbstractMemoryManager< ManagedMemory >.
Definition at line 142 of file static_memory_manager.h.
|
inlineprivate |
Private initialize method to call a specific constructor for the type.
| Is | Index sequence to iterate over the args |
Definition at line 150 of file static_memory_manager.h.
