Hedgehog
3.1.0
A library to generate hybrid pipeline workflow systems
|
Execution pipeline core. More...
#include "core_execution_pipeline.h"
Public Member Functions | |
CoreExecutionPipeline (AbstractExecutionPipeline< Separator, AllTypes... > *const &executionPipeline, std::shared_ptr< CoreGraph< Separator, AllTypes... > > const coreGraph, std::vector< int > deviceIds, std::string const name="Execution pipeline") | |
Constructor using a user-defined execution pipeline, the base CoreGraph and the deviceIds to determine the number of graphs in the execution pipeline. The name is set as default as "Execution pipeline". | |
CoreExecutionPipeline (AbstractExecutionPipeline< Separator, AllTypes... > *const &executionPipeline, std::shared_ptr< CoreGraph< Separator, AllTypes... > > const coreGraph, size_t numberGraphs, std::string const name="Execution pipeline") | |
Constructor using a user-defined execution pipeline, the base CoreGraph, and the number of graphs in the execution pipeline. The name is set as default as "Execution pipeline". | |
~CoreExecutionPipeline () override=default | |
Default destructor. | |
void | preRun () override |
Do nothing as pre-run step. | |
void | run () override |
Main core execution pipeline logic. | |
void | postRun () override |
Post run logic, disconnects the switch and waits for each graph to terminate. | |
std::string | extraPrintingInformation () const override |
Extra printing information for the execution pipeline. | |
void | visit (Printer *printer) override |
Visit an execution pipeline. | |
void | registerNode (abstraction::GraphNodeAbstraction *belongingGraph) override |
Register the execution pipeline into the belongingGraph. | |
std::pair< std::chrono::nanoseconds, std::chrono::nanoseconds > | minMaxExecutionDuration () const override |
Getter to the min max execution duration from the nodes inside the graphs in the execution pipeline. | |
std::pair< std::chrono::nanoseconds, std::chrono::nanoseconds > | minMaxWaitDuration () const override |
Getter to the min max wait duration from the nodes inside the graphs in the execution pipeline. | |
Public Member Functions inherited from hh::core::abstraction::ExecutionPipelineNodeAbstraction | |
ExecutionPipelineNodeAbstraction (std::string const &name, behavior::Node *node) | |
Constructor using the node name. | |
~ExecutionPipelineNodeAbstraction () override=default | |
Default destructor. | |
std::vector< std::pair< std::string const, std::string const > > | ids () const override |
Node ids [nodeId, nodeGroupId] accessor. | |
bool | hasMemoryManagerAttached () const override |
Test if a node has a memory attached, an execution pipeline can't have a memory manager. | |
std::shared_ptr< AbstractMemoryManager > | memoryManager () const override |
Accessor to memory manager, an execution pipeline has no memory manager. | |
virtual void | launchGraphThreads (bool waitForInitialization)=0 |
Launch the graphs inside of the execution pipeline, called when the outer graph is executed. | |
virtual std::pair< std::chrono::nanoseconds, std::chrono::nanoseconds > | minMaxExecutionDuration () const =0 |
Getter to the min max execution duration from the nodes inside the graphs in the execution pipeline. | |
virtual std::pair< std::chrono::nanoseconds, std::chrono::nanoseconds > | minMaxWaitDuration () const =0 |
Getter to the min max wait duration from the nodes inside the graphs in the execution pipeline. | |
Public Member Functions inherited from hh::core::abstraction::TaskNodeAbstraction | |
TaskNodeAbstraction (std::string const &name, behavior::Node *node) | |
Create the abstraction with the node's name. | |
~TaskNodeAbstraction () override=default | |
Default destructor. | |
bool | isActive () const |
Accessor to task status. | |
bool | isInitialized () const |
Accessor to initialized flag. | |
size_t | numberReceivedElements () const |
Accessor to the number of received elements. | |
std::chrono::nanoseconds const & | waitDuration () const |
Accessor to the duration the node was in a wait state. | |
std::chrono::nanoseconds const & | memoryWaitDuration () const |
Accessor to the duration the node was in a memory wait state. | |
std::shared_ptr< NvtxProfiler > const & | nvtxProfiler () const |
Accessor to the NVTX profiler attached to the node. | |
std::chrono::nanoseconds | perElementExecutionDuration () const |
Accessor to the duration the average duration of processing an input data. | |
void | isActive (bool isActive) |
Setter to the task status. | |
void | incrementNumberReceivedElements () |
Increment the number of elements received. | |
void | incrementWaitDuration (std::chrono::nanoseconds const &wait) |
Increment the wait duration. | |
void | incrementMemoryWaitDuration (std::chrono::nanoseconds const &wait) |
Increase the memory wait duration. | |
void | incrementPerElementExecutionDuration (std::chrono::nanoseconds const &exec) |
Increase the execution time per elements. | |
virtual void | preRun ()=0 |
Pre run method, called only once. | |
virtual void | run ()=0 |
Run method, called when thread is attached. | |
virtual void | postRun ()=0 |
Post run method, called only once. | |
virtual std::string | extraPrintingInformation () const =0 |
Abstraction to add user-defined message for the printers. | |
virtual bool | hasMemoryManagerAttached () const =0 |
Flag accessor to the presence of memory manager attached. | |
virtual std::shared_ptr< AbstractMemoryManager > | memoryManager () const =0 |
Accessor to the attached memory manager. | |
behavior::Node * | node () const override |
Node accessor. | |
Public Member Functions inherited from hh::core::abstraction::NodeAbstraction | |
NodeAbstraction (std::string name) | |
Core node constructor using the core's name. | |
virtual | ~NodeAbstraction ()=default |
DEfault destructor. | |
std::string const & | name () const |
Accessor to the core's name. | |
virtual std::string | id () const |
Core's id ('x' + address of abstraction) as string. | |
bool | isRegistered () const |
Accessor to registration flag. | |
GraphNodeAbstraction * | belongingGraph () const |
Belonging graph accessor. | |
virtual int | deviceId () const |
Get the device identifier (got from belonging graph) | |
virtual size_t | graphId () const |
Get the graph identifier (got from belonging graph) | |
std::chrono::nanoseconds const & | executionDuration () const |
Execution duration. | |
std::chrono::time_point< std::chrono::system_clock > const & | startExecutionTimeStamp () const |
Accessor to the starting execution timestamp. | |
void | startExecutionTimeStamp (std::chrono::time_point< std::chrono::system_clock > const &startExecutionTimeStamp) |
Setter to the starting execution timestamp. | |
void | incrementExecutionDuration (std::chrono::nanoseconds const &exec) |
Increment execution duration. | |
virtual void | registerNode (GraphNodeAbstraction *belongingGraph) |
Register node to the given graph. | |
virtual std::vector< std::pair< std::string const, std::string const > > | ids () const =0 |
Node ids [nodeId, nodeGroupId] accessor. | |
virtual behavior::Node * | node () const =0 |
Node accessor. | |
Public Member Functions inherited from hh::core::abstraction::PrintableAbstraction | |
tool::PrintOptions const & | printOptions () const |
Print options const accessor. | |
tool::PrintOptions & | printOptions () |
Print options accessor. | |
virtual void | visit (Printer *printer)=0 |
Visitor method, used by the printer to visit all nodes in the graph. | |
Public Member Functions inherited from hh::core::abstraction::ClonableAbstraction | |
ClonableAbstraction () | |
Default constructor. | |
virtual | ~ClonableAbstraction ()=default |
Default destructor. | |
void | storeClone (std::shared_ptr< abstraction::NodeAbstraction > const &clone) |
Store a core clone. | |
virtual std::shared_ptr< abstraction::NodeAbstraction > | clone (std::map< NodeAbstraction *, std::shared_ptr< NodeAbstraction > > &correspondenceMap)=0 |
Clone virtual function. | |
virtual void | duplicateEdge (std::map< NodeAbstraction *, std::shared_ptr< NodeAbstraction > > &mapping)=0 |
Duplicate the output edges of a node. | |
Private Member Functions | |
void | initializeCoreExecutionPipeline (std::shared_ptr< CoreGraph< Separator, AllTypes... > > const coreGraph) |
Initialize the execution pipeline. | |
void | registerAndDuplicateGraph (std::shared_ptr< CoreGraph< Separator, AllTypes... > > const coreGraph) |
Register and duplicate the coreGraph in the execution pipeline. | |
void | connectCoreGraphs () |
Connect all of the core graphs into the execution pipeline (connection to the switch and output of the execution pipeline) | |
template<class InputTypes , size_t ... Indices> | |
void | operateReceivers (std::index_sequence< Indices... >) |
Operate the receivers for all input types. | |
template<class Input > | |
void | operateReceiver () |
Operate the receiver for a specific input type. | |
void | launchGraphThreads (bool waitForInitialization) override |
Create graph's inner groups and launch graph's threads. | |
std::string | id () const override |
Get the exec pipeline id. | |
std::shared_ptr< abstraction::NodeAbstraction > | clone (std::map< NodeAbstraction *, std::shared_ptr< NodeAbstraction > > &correspondenceMap) override |
Clone method, to duplicate an execution pipeline when it is part of another graph in an execution pipeline. | |
void | duplicateEdge (std::map< NodeAbstraction *, std::shared_ptr< NodeAbstraction > > &mapping) override |
Duplicate the execution pipeline edge. | |
Private Attributes | |
AbstractExecutionPipeline< Separator, AllTypes... > *const | executionPipeline_ = nullptr |
Pointer to the execution pipeline node. | |
std::vector< std::shared_ptr< CoreGraph< Separator, AllTypes... > > > | coreGraphs_ {} |
Vector of CoreGraph handled by the execution pipeline. | |
std::vector< int > | deviceIds_ {} |
Device ids matching the core graphs. | |
Additional Inherited Members | |
Protected Member Functions inherited from hh::core::abstraction::TaskNodeAbstraction | |
void | setInitialized () |
Set the task as initialized. | |
Execution pipeline core.
Separator | Separator position between input types and output types |
AllTypes | List of input and output types |
Definition at line 59 of file core_execution_pipeline.h.
|
inline |
Constructor using a user-defined execution pipeline, the base CoreGraph and the deviceIds to determine the number of graphs in the execution pipeline. The name is set as default as "Execution pipeline".
executionPipeline | User-defined execution pipeline |
coreGraph | Base CoreGraph |
deviceIds | Device Ids to set to the different graphs in the execution pipeline. The vector size determine the number of graphs in the execution pipeline. |
name | Name of the execution pipeline |
Definition at line 80 of file core_execution_pipeline.h.
|
inline |
Constructor using a user-defined execution pipeline, the base CoreGraph, and the number of graphs in the execution pipeline. The name is set as default as "Execution pipeline".
The device ids are set in sequence, the base graph as 0 and each clone as previous + 1.
executionPipeline | USer-defined execution pipeline |
coreGraph | Base CoreGraph |
numberGraphs | Number of graphs in the execution pipeline |
name | Name of the Execution pipeline, default is "Execution pipeline" |
Definition at line 100 of file core_execution_pipeline.h.
|
overridedefault |
Default destructor.
|
inlineoverrideprivate |
Clone method, to duplicate an execution pipeline when it is part of another graph in an execution pipeline.
correspondenceMap | Correspondence map of belonging graph's node |
Definition at line 329 of file core_execution_pipeline.h.
|
inlineprivate |
Connect all of the core graphs into the execution pipeline (connection to the switch and output of the execution pipeline)
Definition at line 270 of file core_execution_pipeline.h.
|
inlineoverrideprivate |
Duplicate the execution pipeline edge.
mapping | Correspondence map of belonging graph's node |
Definition at line 339 of file core_execution_pipeline.h.
|
inlineoverridevirtual |
Extra printing information for the execution pipeline.
Implements hh::core::abstraction::TaskNodeAbstraction.
Definition at line 173 of file core_execution_pipeline.h.
|
inlineoverrideprivatevirtual |
Get the exec pipeline id.
In fact get switch id, they share the same id
Reimplemented from hh::core::abstraction::NodeAbstraction.
Definition at line 324 of file core_execution_pipeline.h.
|
inlineprivate |
Initialize the execution pipeline.
Register, duplicate and connect the graph given in parameter
coreGraph | Base core graph |
std::runtime_error | If the graph is not valid, in the right state or the device ids are not valid |
Definition at line 229 of file core_execution_pipeline.h.
|
inlineoverrideprivatevirtual |
Create graph's inner groups and launch graph's threads.
waitForInitialization | Wait for internal nodes to be initialized flags |
Implements hh::core::abstraction::ExecutionPipelineNodeAbstraction.
Definition at line 315 of file core_execution_pipeline.h.
|
inlineoverridevirtual |
Getter to the min max execution duration from the nodes inside the graphs in the execution pipeline.
Implements hh::core::abstraction::ExecutionPipelineNodeAbstraction.
Definition at line 196 of file core_execution_pipeline.h.
|
inlineoverridevirtual |
Getter to the min max wait duration from the nodes inside the graphs in the execution pipeline.
Implements hh::core::abstraction::ExecutionPipelineNodeAbstraction.
Definition at line 211 of file core_execution_pipeline.h.
|
inlineprivate |
Operate the receiver for a specific input type.
Input |
Definition at line 296 of file core_execution_pipeline.h.
|
inlineprivate |
Operate the receivers for all input types.
InputTypes | Input data types |
Indices | Indices to travers the tuple of input types |
Definition at line 281 of file core_execution_pipeline.h.
|
inlineoverridevirtual |
Post run logic, disconnects the switch and waits for each graph to terminate.
Implements hh::core::abstraction::TaskNodeAbstraction.
Definition at line 165 of file core_execution_pipeline.h.
|
inlineoverridevirtual |
Do nothing as pre-run step.
Implements hh::core::abstraction::TaskNodeAbstraction.
Definition at line 118 of file core_execution_pipeline.h.
|
inlineprivate |
Register and duplicate the coreGraph in the execution pipeline.
The CoreGraph is duplicated n times cy calling clone() on it, all of the graphs are initialized and registered in the execution pipeline.
coreGraph | CoreGraph to duplicate and register |
Definition at line 251 of file core_execution_pipeline.h.
|
inlineoverridevirtual |
Register the execution pipeline into the belongingGraph.
belongingGraph | Graph to register the execution pipeline into |
Reimplemented from hh::core::abstraction::NodeAbstraction.
Definition at line 189 of file core_execution_pipeline.h.
|
inlineoverridevirtual |
Main core execution pipeline logic.
Implements hh::core::abstraction::TaskNodeAbstraction.
Definition at line 130 of file core_execution_pipeline.h.
|
inlineoverridevirtual |
Visit an execution pipeline.
printer | Printer used to gather information |
Implements hh::core::abstraction::PrintableAbstraction.
Definition at line 177 of file core_execution_pipeline.h.
|
private |
Vector of CoreGraph handled by the execution pipeline.
Definition at line 68 of file core_execution_pipeline.h.
|
private |
Device ids matching the core graphs.
Definition at line 70 of file core_execution_pipeline.h.
|
private |
Pointer to the execution pipeline node.
Definition at line 66 of file core_execution_pipeline.h.