Hedgehog
3.1.0
A library to generate hybrid pipeline workflow systems
|
AbstractState manager. More...
#include "state_manager.h"
Public Member Functions | |
StateManager (std::shared_ptr< AbstractState< Separator, AllTypes... > > state, std::string const &name="State manager", bool const automaticStart=false) | |
Main state manager constructor. | |
StateManager (std::shared_ptr< core::CoreStateManager< Separator, AllTypes... > > core, std::shared_ptr< AbstractState< Separator, AllTypes... > > state) | |
AbstractState Manager constructor with a user-custom core. | |
~StateManager () override=default | |
Default destructor for the state manager. | |
std::shared_ptr< AbstractState< Separator, AllTypes... > > const & | state () const |
AbstractState accessor. | |
bool | automaticStart () const |
Automatic start flag accessor. | |
std::shared_ptr< core::CoreStateManager< Separator, AllTypes... > > const & | coreStateManager () const |
Accessor to the core. | |
bool | canTerminate () const override |
Default termination rule, it terminates if there is no predecessor connection and there is no input data. | |
std::shared_ptr< StateManager< Separator, AllTypes... > > | copy () final |
Provide a copy of the state manager. | |
virtual std::shared_ptr< StateManager< Separator, AllTypes... > > | copyStateManager (std::shared_ptr< AbstractState< Separator, AllTypes... > > state) |
Customizable copy method. | |
![]() | |
TaskNode (std::shared_ptr< hh::core::abstraction::TaskNodeAbstraction > core) | |
Constructor using a core. | |
~TaskNode () override=default | |
Default destructor. | |
std::shared_ptr< AbstractMemoryManager > const & | memoryManager () const |
Memory manager accessor. | |
void | connectMemoryManager (std::shared_ptr< AbstractMemoryManager > mm) |
Connect a memory manager to a task. | |
std::shared_ptr< ManagedMemory > | getManagedMemory () |
Get a managed memory for the memory manager attached to the task, can block if none are available at the time of the call. | |
virtual void | initialize () |
initialize step for the task | |
virtual void | shutdown () |
shutdown step for the task | |
virtual std::string | extraPrintingInformation () const |
Print extra information for the task. | |
![]() | |
Node (std::shared_ptr< hh::core::abstraction::NodeAbstraction > core) | |
Constructor's node. | |
virtual | ~Node ()=default |
Default destructor. | |
std::shared_ptr< hh::core::abstraction::NodeAbstraction > const & | core () const |
Core accessor. | |
std::string | name () const |
Node's name accessor. | |
![]() | |
CanTerminate ()=default | |
Default constructor. | |
virtual | ~CanTerminate ()=default |
Default destructor. | |
virtual bool | canTerminate () const =0 |
Termination condition. | |
![]() | |
Cleanable ()=default | |
Default constructor. | |
~Cleanable ()=default | |
Default destructor. | |
virtual void | clean () |
Clean a node. | |
![]() | |
Copyable (size_t const numberThreads) | |
Copyable constructor, set the number of threads for a node. | |
virtual | ~Copyable ()=default |
Default destructor. | |
size_t | numberThreads () const |
Number of threads accessor. | |
std::vector< StateManager< Separator, AllTypes... > const * > | group () const |
Get the group of nodes that hold the current nodes. | |
virtual std::shared_ptr< StateManager< Separator, AllTypes... > > | copy () |
Copy method called to either create a group of node or duplicate a node when an execution pipeline is created. | |
Private Attributes | |
std::shared_ptr< AbstractState< Separator, AllTypes... > > | state_ = nullptr |
AbstractState managed. | |
std::shared_ptr< core::CoreStateManager< Separator, AllTypes... > > | coreStateManager_ = nullptr |
AbstractState manager core. | |
AbstractState manager.
The state manager is a Hedgehog node that manages locally the state of the computation. To do so, it uses a state protected by a mutex. The state holds the data structures that are used to manage the flow of data and organize rendez-vous points or other synchronization mechanisms. The default order of execution is:
The state is protected because it can be shared between multiple state managers, either with multiple state managers in the same graph or if the state managers belongs to a graph that is duplicated with an execution pipeline. In this case, each of the state managers in every graph copy will share the same state. This can be used when dealing with computation across multiple GPUs, to synchronize data or share information between devices.
The state manager can be derived to change its termination rule for example. The method copyStateManager can be derived to customise the copy mechanism of the state manager.
Separator | Separator position between input types and output types |
AllTypes | List of input and output types |
Definition at line 60 of file state_manager.h.
|
inlineexplicit |
Main state manager constructor.
state | AbstractState managed by the state manager |
name | Name of the state manager (default: "AbstractState manager") |
automaticStart | Flag to start the execution of the state manager without data (sending automatically nullptr to each of the input types) |
std::runtime_error | the state is not valid (== nullptr or does not derive from CoreStateManager) |
Definition at line 78 of file state_manager.h.
|
inlineexplicit |
AbstractState Manager constructor with a user-custom core.
A custom core can be used to customize how the state manager behaves internally. For example, by default any input is stored in a std::queue, it can be changed to a std::priority_queue instead through the core.
core | Custom core used to change the behavior of the state manager |
state | AbstractState managed by the state manager |
std::runtime_error | the state is not valid (== nullptr or does not derive from CoreStateManager) |
Definition at line 107 of file state_manager.h.
|
overridedefault |
Default destructor for the state manager.
|
inline |
Automatic start flag accessor.
Definition at line 136 of file state_manager.h.
|
inlineoverridevirtual |
Default termination rule, it terminates if there is no predecessor connection and there is no input data.
Implements hh::behavior::CanTerminate.
Definition at line 146 of file state_manager.h.
|
inlinefinalvirtual |
Provide a copy of the state manager.
std::runtime_error | a state manager copy is not valid (== nullptr or do not share the same state) |
Reimplemented from hh::behavior::Copyable< StateManager< Separator, AllTypes... > >.
Definition at line 153 of file state_manager.h.
|
inlinevirtual |
Customizable copy method.
state | AbstractState to insert in the state manager copy |
Definition at line 174 of file state_manager.h.
|
inline |
Accessor to the core.
Definition at line 140 of file state_manager.h.
|
inline |
AbstractState accessor.
Definition at line 132 of file state_manager.h.
|
private |
AbstractState manager core.
Definition at line 69 of file state_manager.h.
|
private |
AbstractState managed.
Definition at line 68 of file state_manager.h.