Hedgehog  3.1.0
A library to generate hybrid pipeline workflow systems
Loading...
Searching...
No Matches
hh::core::abstraction::GraphNodeAbstraction Class Referenceabstract

Base graph node abstraction. More...

#include "graph_node_abstraction.h"

Inheritance diagram for hh::core::abstraction::GraphNodeAbstraction:
Inheritance graph
Collaboration diagram for hh::core::abstraction::GraphNodeAbstraction:
Collaboration graph

Public Types

enum  Status { INIT , EXEC , TERM , INS }
 Graph status (INITialisation, EXECution, TERMination, INSide) More...
 

Public Member Functions

 GraphNodeAbstraction (std::string const &name)
 Base graph abstraction.
 
 ~GraphNodeAbstraction () override=default
 Default destructor.
 
int deviceId () const override
 Device id accessor.
 
size_t graphId () const override
 Graph id accessor.
 
Status graphStatus () const
 Graph status accessor.
 
std::chrono::time_point< std::chrono::system_clock > const & graphStartCreation () const
 Graph start creation timestamp accessor.
 
std::chrono::nanoseconds const & graphConstructionDuration () const
 Graph construction duration accessor.
 
void deviceId (int deviceId)
 Setter to the device id.
 
void graphId (size_t graphId)
 Setter to the graph id.
 
void graphConstructionDuration (std::chrono::nanoseconds const &graphConstructionDuration)
 Setter to the graph construction duration.
 
void registerNode (GraphNodeAbstraction *belongingGraph) override
 Register a graph inside a graph.
 
std::pair< std::chrono::nanoseconds, std::chrono::nanoseconds > minMaxExecutionDuration () const
 Accessor to the min / max execution duration of the nodes in the graph.
 
std::pair< std::chrono::nanoseconds, std::chrono::nanoseconds > minMaxWaitDuration () const
 Accessor to the min / max wait duration of the nodes in the graph.
 
virtual void joinThreads ()=0
 Interface to join the threads inside of a graph, called by the Default scheduler.
 
virtual void setInside ()=0
 Set a graph inside another one.
 
virtual void createInnerGroupsAndLaunchThreads (bool waitForInitialization)=0
 Create the groups and launch the threads of the inside nodes.
 
virtual void registerNodeInsideGraph (NodeAbstraction *core)=0
 Register a core inside a graph.
 
- 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.
 
GraphNodeAbstractionbelongingGraph () 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::Nodenode () const =0
 Node accessor.
 
- Public Member Functions inherited from hh::core::abstraction::PrintableAbstraction
tool::PrintOptions const & printOptions () const
 Print options const accessor.
 
tool::PrintOptionsprintOptions ()
 Print options accessor.
 
virtual void visit (Printer *printer)=0
 Visitor method, used by the printer to visit all nodes in the graph.
 

Protected Attributes

std::unique_ptr< std::map< NodeAbstraction *, std::vector< NodeAbstraction * > > > const insideNodesAndGroups_ = nullptr
 All nodes of the graph, mapped to their group nodes.
 
Status graphStatus_ = Status::INIT
 Group status.
 

Private Attributes

std::chrono::time_point< std::chrono::system_clock > const graphStartCreation_ = std::chrono::system_clock::now()
 graph creation timestamp
 
std::chrono::nanoseconds graphConstructionDuration_ = std::chrono::nanoseconds::zero()
 Node creation duration.
 
int deviceId_ = 0
 Device Id used for computation on devices.
 
size_t graphId_ = 0
 Graph Id used to identify a graph in an execution pipeline.
 

Detailed Description

Base graph node abstraction.

Definition at line 36 of file graph_node_abstraction.h.

Member Enumeration Documentation

◆ Status

Graph status (INITialisation, EXECution, TERMination, INSide)

Enumerator
INIT 
EXEC 
TERM 
INS 

Definition at line 39 of file graph_node_abstraction.h.

Constructor & Destructor Documentation

◆ GraphNodeAbstraction()

hh::core::abstraction::GraphNodeAbstraction::GraphNodeAbstraction ( std::string const &  name)
inlineexplicit

Base graph abstraction.

Parameters
nameGraph's name

Definition at line 58 of file graph_node_abstraction.h.

Here is the caller graph for this function:

◆ ~GraphNodeAbstraction()

hh::core::abstraction::GraphNodeAbstraction::~GraphNodeAbstraction ( )
overridedefault

Default destructor.

Member Function Documentation

◆ createInnerGroupsAndLaunchThreads()

virtual void hh::core::abstraction::GraphNodeAbstraction::createInnerGroupsAndLaunchThreads ( bool  waitForInitialization)
pure virtual

Create the groups and launch the threads of the inside nodes.

Parameters
waitForInitializationWait for internal nodes to be initialized flags

Implemented in hh::core::CoreGraph< Separator, AllTypes >, and hh::core::CoreGraph< Separator, AllTypes... >.

◆ deviceId() [1/2]

int hh::core::abstraction::GraphNodeAbstraction::deviceId ( ) const
inlineoverridevirtual

Device id accessor.

Returns
The device id

Reimplemented from hh::core::abstraction::NodeAbstraction.

Definition at line 67 of file graph_node_abstraction.h.

◆ deviceId() [2/2]

void hh::core::abstraction::GraphNodeAbstraction::deviceId ( int  deviceId)
inline

Setter to the device id.

Parameters
deviceIdDevice id to set

Definition at line 89 of file graph_node_abstraction.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ graphConstructionDuration() [1/2]

std::chrono::nanoseconds const & hh::core::abstraction::GraphNodeAbstraction::graphConstructionDuration ( ) const
inline

Graph construction duration accessor.

Returns
Graph construction duration

Definition at line 85 of file graph_node_abstraction.h.

Here is the caller graph for this function:

◆ graphConstructionDuration() [2/2]

void hh::core::abstraction::GraphNodeAbstraction::graphConstructionDuration ( std::chrono::nanoseconds const &  graphConstructionDuration)
inline

Setter to the graph construction duration.

Parameters
graphConstructionDurationGraph construction duration

Definition at line 97 of file graph_node_abstraction.h.

Here is the call graph for this function:

◆ graphId() [1/2]

size_t hh::core::abstraction::GraphNodeAbstraction::graphId ( ) const
inlineoverridevirtual

Graph id accessor.

Returns
The device id

Reimplemented from hh::core::abstraction::NodeAbstraction.

Definition at line 71 of file graph_node_abstraction.h.

◆ graphId() [2/2]

void hh::core::abstraction::GraphNodeAbstraction::graphId ( size_t  graphId)
inline

Setter to the graph id.

Parameters
graphIdGraph id to set

Definition at line 93 of file graph_node_abstraction.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ graphStartCreation()

std::chrono::time_point< std::chrono::system_clock > const & hh::core::abstraction::GraphNodeAbstraction::graphStartCreation ( ) const
inline

Graph start creation timestamp accessor.

Returns
Graph start creation timestamp

Definition at line 79 of file graph_node_abstraction.h.

Here is the caller graph for this function:

◆ graphStatus()

Status hh::core::abstraction::GraphNodeAbstraction::graphStatus ( ) const
inline

Graph status accessor.

Returns
Graph status

Definition at line 75 of file graph_node_abstraction.h.

◆ joinThreads()

virtual void hh::core::abstraction::GraphNodeAbstraction::joinThreads ( )
pure virtual

Interface to join the threads inside of a graph, called by the Default scheduler.

Implemented in hh::core::CoreGraph< Separator, AllTypes >, and hh::core::CoreGraph< Separator, AllTypes... >.

◆ minMaxExecutionDuration()

std::pair< std::chrono::nanoseconds, std::chrono::nanoseconds > hh::core::abstraction::GraphNodeAbstraction::minMaxExecutionDuration ( ) const
inline

Accessor to the min / max execution duration of the nodes in the graph.

Returns
Min / max execution duration in nanoseconds of the nodes in the graph

Definition at line 110 of file graph_node_abstraction.h.

Here is the call graph for this function:

◆ minMaxWaitDuration()

std::pair< std::chrono::nanoseconds, std::chrono::nanoseconds > hh::core::abstraction::GraphNodeAbstraction::minMaxWaitDuration ( ) const
inline

Accessor to the min / max wait duration of the nodes in the graph.

Returns
Min / max wait duration in nanoseconds of the nodes in the graph
Exceptions
std::runtime_errorAll the nodes in a group are not of the same types

Definition at line 156 of file graph_node_abstraction.h.

Here is the call graph for this function:
Here is the caller graph for this function:

◆ registerNode()

void hh::core::abstraction::GraphNodeAbstraction::registerNode ( GraphNodeAbstraction belongingGraph)
inlineoverridevirtual

Register a graph inside a graph.

Parameters
belongingGraphBelonging graph used to register this graph

Reimplemented from hh::core::abstraction::NodeAbstraction.

Definition at line 103 of file graph_node_abstraction.h.

Here is the call graph for this function:

◆ registerNodeInsideGraph()

virtual void hh::core::abstraction::GraphNodeAbstraction::registerNodeInsideGraph ( NodeAbstraction core)
pure virtual

Register a core inside a graph.

Parameters
coreCore to add to the graph

◆ setInside()

virtual void hh::core::abstraction::GraphNodeAbstraction::setInside ( )
pure virtual

Set a graph inside another one.

Implemented in hh::core::CoreGraph< Separator, AllTypes >, and hh::core::CoreGraph< Separator, AllTypes... >.

Here is the caller graph for this function:

Member Data Documentation

◆ deviceId_

int hh::core::abstraction::GraphNodeAbstraction::deviceId_ = 0
private

Device Id used for computation on devices.

Definition at line 46 of file graph_node_abstraction.h.

◆ graphConstructionDuration_

std::chrono::nanoseconds hh::core::abstraction::GraphNodeAbstraction::graphConstructionDuration_ = std::chrono::nanoseconds::zero()
private

Node creation duration.

Definition at line 44 of file graph_node_abstraction.h.

◆ graphId_

size_t hh::core::abstraction::GraphNodeAbstraction::graphId_ = 0
private

Graph Id used to identify a graph in an execution pipeline.

Definition at line 47 of file graph_node_abstraction.h.

◆ graphStartCreation_

std::chrono::time_point<std::chrono::system_clock> const hh::core::abstraction::GraphNodeAbstraction::graphStartCreation_ = std::chrono::system_clock::now()
private

graph creation timestamp

Definition at line 42 of file graph_node_abstraction.h.

◆ graphStatus_

Status hh::core::abstraction::GraphNodeAbstraction::graphStatus_ = Status::INIT
protected

Group status.

Definition at line 53 of file graph_node_abstraction.h.

◆ insideNodesAndGroups_

std::unique_ptr<std::map<NodeAbstraction *, std::vector<NodeAbstraction *> > > const hh::core::abstraction::GraphNodeAbstraction::insideNodesAndGroups_ = nullptr
protected

All nodes of the graph, mapped to their group nodes.

Definition at line 51 of file graph_node_abstraction.h.