Hedgehog  0.0.0
A library to generate hybrid pipeline workflow systems
hh::core::CoreGraph< GraphOutput, GraphInputs > Class Template Reference

Core associated to the Graph. More...

#include "core_graph.h"

Inheritance diagram for hh::core::CoreGraph< GraphOutput, GraphInputs >:
Inheritance graph
Collaboration diagram for hh::core::CoreGraph< GraphOutput, GraphInputs >:
Collaboration graph

Public Member Functions

 CoreGraph (Graph< GraphOutput, GraphInputs... > *graph, NodeType const type, std::string_view const &name, std::unique_ptr< AbstractScheduler > scheduler=std::make_unique< DefaultScheduler >())
 CoreGraph constructor. More...
 
 CoreGraph (CoreGraph< GraphOutput, GraphInputs... > const &rhs)
 Core graph copy constructor. More...
 
std::shared_ptr< CoreNodeclone () override
 Clone a core graph calling the graph copy constructor. More...
 
 ~CoreGraph () override
 Graph's core default destructor.
 
behavior::Nodenode () override
 User graph accessor. More...
 
int deviceId () override
 Device id accessor. More...
 
int graphId () override
 Graph id accessor. More...
 
std::unique_ptr< std::set< CoreNode * > > const & inputsCoreNodes () const
 Input node's cores accessor. More...
 
std::unique_ptr< std::set< CoreSender< GraphOutput > * > > const & outputCoreNodes () const
 Output node's CoreSender accessor. More...
 
std::shared_ptr< CoreGraphSource< GraphInputs... > > const & source () const
 Source accessor. More...
 
void graphId (size_t graphId)
 Graph id setter. More...
 
void deviceId (int deviceId) override
 Device id setter. More...
 
std::chrono::duration< uint64_t, std::micro > maxExecutionTime () const override
 Compute the maximum execution time for the graph's inside nodes. More...
 
std::chrono::duration< uint64_t, std::micro > minExecutionTime () const override
 Compute the minimum execution time for the graph's inside nodes. More...
 
std::chrono::duration< uint64_t, std::micro > maxWaitTime () const override
 Compute the maximum wait time for the graph's inside nodes. More...
 
std::chrono::duration< uint64_t, std::micro > minWaitTime () const override
 Compute the minimum wait time for the graph's inside nodes. More...
 
template<class UserDefinedSender , class UserDefinedMultiReceiver , class Output = typename UserDefinedSender::output_t, class Inputs = typename UserDefinedMultiReceiver::inputs_t, class IsSender = typename std::enable_if_t< std::is_base_of_v< behavior::Sender<Output>, UserDefinedSender > >, class IsMultiReceiver = typename std::enable_if_t< std::is_base_of_v< typename helper::HelperMultiReceiversType<Inputs>::type, UserDefinedMultiReceiver > >>
void addEdge (std::shared_ptr< UserDefinedSender > from, std::shared_ptr< UserDefinedMultiReceiver > to)
 Add a directed edge from a compatible "from" node to "to" node. More...
 
template<class UserDefinedMultiReceiver , class InputsMR = typename UserDefinedMultiReceiver::inputs_t, class InputsG = typename behavior::MultiReceivers<GraphInputs...>::inputs_t, class isMultiReceiver = typename std::enable_if_t< std::is_base_of_v<typename helper::HelperMultiReceiversType<InputsMR>::type, UserDefinedMultiReceiver> >, class isInputCompatible = typename std::enable_if_t<traits::is_included_v<InputsMR, InputsG>>>
void input (std::shared_ptr< UserDefinedMultiReceiver > inputNode)
 Set a node as input for the graph. More...
 
void output (std::shared_ptr< behavior::Sender< GraphOutput >> outputNode)
 Set a node as output for the graph. More...
 
template<class Input , class = typename std::enable_if_t<traits::Contains<Input, GraphInputs...>::value>>
void broadcastAndNotifyToAllInputs (std::shared_ptr< Input > &data)
 Broadcast data and notify all input nodes. More...
 
void setInside () override
 Set the graph as inside, in case of connection to another node.
 
std::vector< std::pair< std::string, std::string > > ids () const final
 Get ids of input nodes (vector<pair<nodeId, nodeIdCluster>>) More...
 
void executeGraph ()
 Execute the graph. More...
 
void waitForTermination ()
 Wait for all inside threads to join.
 
void finishPushingData ()
 Notify the graph no more input data will be pushed.
 
std::shared_ptr< GraphOutput > getBlockingResult ()
 Get data out of the graph. More...
 
void createCluster ([[maybe_unused]]std::shared_ptr< std::multimap< CoreNode *, std::shared_ptr< CoreNode >>> &insideNodesGraph) override
 Create all clusters for inside nodes and launch the threads, not gathered into insideNodesGraph. More...
 
void visit (AbstractPrinter *printer) override
 Special visit method for a CoreGraph. More...
 
void addReceiver (CoreReceiver< GraphOutput > *receiver) override
 Add a receiver to the graph, i.e, add a receiver to all output nodes. More...
 
void removeReceiver (CoreReceiver< GraphOutput > *receiver) override
 Remove a receiver from the graph, i.e, remove a receiver from all output nodes. More...
 
void sendAndNotify ([[maybe_unused]]std::shared_ptr< GraphOutput > ptr) override
 Send a data and notify receivers, not possible for a graph, throws an error in every case. More...
 
void addSlot (CoreSlot *slot) override
 Add a slot to a graph, i.e, to all output nodes. More...
 
void removeSlot (CoreSlot *slot) override
 Remove a slot from a graph, i.e, from all output nodes. More...
 
void notifyAllTerminated () override
 Notify termination to all connected nodes, not possible for a graph, throw an error in every case. More...
 
void addNotifier (CoreNotifier *notifier) override
 Add a notifier to the graph, ie, to all input nodes. More...
 
void removeNotifier (CoreNotifier *notifier) override
 Remove a notifier from the graph, ie, from all input nodes. More...
 
bool hasNotifierConnected () override
 Test notifier for the graph, should not be used, connection is made to the input nodes. More...
 
size_t numberInputNodes () const override
 Return the number of input nodes connected, a graph should not have such a connection, throws in every case. More...
 
void wakeUp () override
 Wake up a graph, wake up all input nodes.
 
bool waitForNotification () override
 A graph can't wait for notification, throws an error in all case. More...
 
std::set< CoreSender< GraphOutput > * > getSenders () override
 Get the senders from the graphs, gather them from the output nodes. More...
 
std::set< CoreSlot * > getSlots () override
 Get the slots from the graphs, gather them from the input nodes. More...
 
void joinThreads () override
 Join the threads managed by the graph.
 
void createInnerClustersAndLaunchThreads ()
 Create inside nodes' cluster and launch the threads.
 
void launchThreads ()
 Launch the threads using the graph's scheduler.
 
- Public Member Functions inherited from hh::core::CoreSender< GraphOutput >
 CoreSender (std::string_view const &name, NodeType const type, size_t const numberThreads)
 CoreSender constructor. More...
 
 ~CoreSender () override
 CoreSender destructor.
 
virtual void sendAndNotify (std::shared_ptr< GraphOutput > data)=0
 Interface to send and notify a data to all connected CoreReceiver. More...
 
void duplicateEdge (CoreNode *duplicateNode, std::map< CoreNode *, std::shared_ptr< CoreNode >> &correspondenceMap) override
 Duplicate all the edges from this to it's copy duplicateNode. More...
 
- Public Member Functions inherited from hh::core::CoreNotifier
 CoreNotifier ()=delete
 Deleted default constructor.
 
 CoreNotifier (std::string_view const &name, NodeType const type, size_t const numberThreads)
 Notifier constructor. More...
 
 ~CoreNotifier () override
 Notifier destructor.
 
- Public Member Functions inherited from hh::core::CoreNode
 CoreNode ()=delete
 Deleted default constructor.
 
 CoreNode (std::string_view const &name, NodeType const type, size_t numberThreads)
 Core node only constructor. More...
 
virtual ~CoreNode ()
 Default virtual destructor.
 
virtual std::string id () const
 Unique Id accessor. More...
 
std::string_view const & name () const
 Node name accessor. More...
 
NodeType type () const
 Node type accessor. More...
 
bool isInside () const
 Node inside property accessor. More...
 
bool hasBeenRegistered () const
 Node registration property accessor. More...
 
CoreNodecoreClusterNode () const
 Main cluster core node link to this node accessor. More...
 
int threadId () const
 Thread id accessor. More...
 
size_t numberThreads () const
 Number of threads associated accessor. More...
 
CoreNodebelongingNode () const
 Belonging node accessor. More...
 
std::shared_ptr< std::multimap< CoreNode *, std::shared_ptr< CoreNode > > > const & insideNodes () const
 Inside node accessor. More...
 
std::shared_ptr< std::multimap< CoreNode *, std::shared_ptr< CoreNode > > > & insideNodes ()
 Inside nodes accessor. More...
 
std::chrono::duration< uint64_t, std::micro > const & executionTime () const
 Execution time accessor. More...
 
std::chrono::duration< uint64_t, std::micro > const & waitTime () const
 Wait time accessor. More...
 
std::chrono::duration< uint64_t, std::micro > const & memoryWaitTime () const
 Memory wait time accessor. More...
 
bool isInCluster () const
 In cluster property accessor. More...
 
bool isActive () const
 Is active property accessor. More...
 
bool isCudaRelated () const
 Is related to CUDA, used to have a green background on the dot file. More...
 
std::chrono::time_point< std::chrono::high_resolution_clock > const & creationTimeStamp () const
 Creation timestamp accessor. More...
 
std::chrono::time_point< std::chrono::high_resolution_clock > const & startExecutionTimeStamp () const
 Execution start timestamp accessor. More...
 
std::chrono::duration< uint64_t, std::micro > const & creationDuration () const
 Creation duration accessor. More...
 
std::chrono::duration< uint64_t, std::micro > const & executionDuration () const
 Execution duration accessor. More...
 
std::chrono::duration< uint64_t, std::micro > meanExecTimeCluster () const
 Compute and return the mean execution time for all tasks in the node cluster. More...
 
std::chrono::duration< uint64_t, std::micro > meanWaitTimeCluster () const
 Compute and return the mean wait time for all tasks in the node cluster. More...
 
std::chrono::duration< uint64_t, std::micro > meanMemoryWaitTimeCluster () const
 Compute and return the mean memory wait time for all tasks in the node cluster. More...
 
uint64_t stdvExecTimeCluster () const
 Compute and return the standard deviation execution time for all tasks in the node cluster. More...
 
uint64_t stdvWaitTimeCluster () const
 Compute and return the standard deviation wait time for all tasks in the node cluster. More...
 
uint64_t stdvMemoryWaitTimeCluster () const
 Compute and return the standard deviation memory wait time for all tasks in the node cluster. More...
 
std::pair< uint64_t, uint64_t > minmaxWaitTimeCluster () const
 Compute and return the min and max wait time for all tasks in the node cluster. More...
 
std::pair< uint64_t, uint64_t > minmaxMemoryWaitTimeCluster () const
 Compute and return the min and max memory wait time for all tasks in the node cluster. More...
 
std::pair< uint64_t, uint64_t > minmaxExecTimeCluster () const
 Compute and return the min and max execution time for all tasks in the node cluster. More...
 
size_t numberActiveThreadInCluster () const
 Compute and return the number of active nodes in a cluster. More...
 
virtual std::string extraPrintingInformation ()
 Extra printing information accessor. More...
 
void startExecutionTimeStamp (std::chrono::time_point< std::chrono::high_resolution_clock > const &startExecutionTimeStamp)
 Execution timestamp setter. More...
 
void setInCluster ()
 Set the task as part of a cluster.
 
void threadId (uint8_t threadId)
 Set the thread id. More...
 
void coreClusterNode (CoreNode *coreClusterNode)
 Set the main cluster node to associate to this node. More...
 
void name (std::string_view const &name)
 Name node setter. More...
 
void numberThreads (size_t numberThreads)
 Number of threads setter. More...
 
void belongingNode (CoreNode *belongingNode)
 Belonging node setter. More...
 
void hasBeenRegistered (bool hasBeenRegistered)
 Has been registered property setter. More...
 
void isActive (bool isActive)
 Is active property setter. More...
 
void isCudaRelated (bool isCudaRelated)
 Is CUDA related property setter. More...
 
void isInside (bool isInside)
 Set the node as being inside another one. More...
 
void creationDuration (std::chrono::duration< uint64_t, std::micro > const &creationDuration)
 Creation duration setter. More...
 
void executionDuration (std::chrono::duration< uint64_t, std::micro > const &executionDuration)
 Execution duration setter. More...
 
void incrementWaitForMemoryDuration (std::chrono::duration< uint64_t, std::micro > const &memoryWait)
 Add wait for memory duration to total duration. More...
 
virtual void preRun ()
 Method defining what to do before the run.
 
virtual void run ()
 Run method, main execution.
 
virtual void postRun ()
 Method defining what to do after the run.
 
virtual void createCluster (std::shared_ptr< std::multimap< CoreNode *, std::shared_ptr< CoreNode >>> &)
 Define how to create a cluster for the node, by default do nothing.
 
void removeInsideNode (CoreNode *coreNode)
 Remove a node from the registered inside nodes. More...
 
void copyInnerStructure (CoreNode *rhs)
 Copy inner structure from rhs nodes to this. More...
 
- Public Member Functions inherited from hh::core::CoreGraphMultiReceivers< GraphInputs... >
 CoreGraphMultiReceivers (std::string_view const &name, NodeType const type, size_t const numberThreads)
 CoreGraphMultiReceivers constructor. More...
 
 ~CoreGraphMultiReceivers () override
 CoreGraphMultiReceivers destructor.
 
bool receiversEmpty () final
 Test if all the CoreGraphMultiReceivers of the graphs (its input nodes CoreMultiReceivers) are empty. More...
 
behavior::Nodenode () override
 Get a node from the graph, that does not exist, throw an error in every case. More...
 
- Public Member Functions inherited from hh::core::CoreMultiReceivers< GraphInputs... >
 CoreMultiReceivers (std::string_view const &name, NodeType const type, size_t const numberThreads)
 CoreMultiReceivers constructor. More...
 
 ~CoreMultiReceivers () override
 CoreMultiReceivers destructor.
 
virtual size_t totalQueueSize ()
 Compute all receivers queue size. More...
 
void removeForAllSenders (CoreNode *coreNode)
 Remove all coreNode's senders from this. More...
 
- Public Member Functions inherited from hh::core::CoreSlot
 CoreSlot (std::string_view const &name, NodeType const type, size_t const numberThreads)
 Core slot constructor. More...
 
 ~CoreSlot () override
 Core Slot destructor.
 
- Public Member Functions inherited from hh::core::CoreReceiver< Inputs >
 CoreReceiver (std::string_view const &name, NodeType const type, size_t const numberThreads)
 Constructor with node name, node type and number of threads for the node. More...
 
 ~CoreReceiver () override
 Default destructor.
 
virtual void addSender (CoreSender< Inputs > *sender)=0
 Interface to add a CoreSender to the receiver. More...
 
virtual void removeSender (CoreSender< Inputs > *sender)=0
 Interface to remove a CoreSender from the receiver. More...
 
virtual void receive (std::shared_ptr< Inputs > data)=0
 Interface to receive a data. More...
 
virtual bool receiverEmpty ()=0
 Accessor to test emptiness on the receiver. More...
 
virtual size_t queueSize ()
 Interface to get the number of element to be treated by this node for this type, by default return 0. More...
 
virtual std::set< CoreReceiver< Inputs > *> receivers ()=0
 Accessor to all receivers connected to this receiver. More...
 
- Public Member Functions inherited from hh::core::CoreGraphReceiver< GraphInputs >
 CoreGraphReceiver (std::string_view const &name, NodeType const type, size_t const numberThreads)
 CoreGraphReceiver constructor. More...
 
virtual ~CoreGraphReceiver ()
 CoreGraphReceiver destructor.
 
void addSender (CoreSender< GraphInputs > *sender) final
 Add a CoreSender to the graph. More...
 
void removeSender (CoreSender< GraphInputs > *sender) final
 Remove a CoreSender from the graph. More...
 
void receive (std::shared_ptr< GraphInputs > ptr) final
 Define how the graph receives data for a specific type and sends the data to all input nodes. More...
 
void addGraphReceiverInput (CoreReceiver< GraphInputs > *receiver)
 Register a CoreReceiver from an input node. More...
 
bool receiverEmpty () final
 Test emptiness in all graph receivers. More...
 
std::set< CoreReceiver< GraphInputs > *> receivers () override
 Get a set of CoreReceiver built from the input nodes. More...
 
behavior::Nodenode () override
 Get a node from the graph, that does not exist, throw an error in every case. More...
 
- Public Member Functions inherited from hh::core::CoreReceiver< GraphInputs >
 CoreReceiver (std::string_view const &name, NodeType const type, size_t const numberThreads)
 Constructor with node name, node type and number of threads for the node. More...
 
 ~CoreReceiver () override
 Default destructor.
 
virtual size_t queueSize ()
 Interface to get the number of element to be treated by this node for this type, by default return 0. More...
 

Private Member Functions

void registerNode (const std::shared_ptr< CoreNode > &coreNode)
 Register a node inside the graph. More...
 
void duplicateInsideNodes (CoreGraph< GraphOutput, GraphInputs... > const &rhs)
 Duplicate inside nodes, called by CoreExecutionPipeline. More...
 
template<class ... InputNodeTypes>
void addReceiversToSource (CoreMultiReceivers< InputNodeTypes... > *inputCoreNode)
 Add receivers to source and do the connection. More...
 
template<class InputNodeType , class ... InputNodeTypes>
void addSourceNotifierInputCoreNode (CoreMultiReceivers< InputNodeTypes... > *inputCoreNode)
 Add an input node to the source. More...
 
template<class InputNodeType >
void addReceiverToSource (CoreReceiver< InputNodeType > *inputCoreNode)
 If the input core node is compatible, connect it to the source. More...
 
template<class InputNodeType >
void duplicateInputNodes (CoreReceiver< InputNodeType > *inputCoreNode)
 Duplicate input nodes, and do the connections for the source compatible type. More...
 
void printCluster (AbstractPrinter *printer, std::shared_ptr< CoreNode > const &node)
 Specialized method if the input node is in a cluster. More...
 

Private Attributes

Graph< GraphOutput, GraphInputs... > * graph_ = nullptr
 User graph.
 
std::unique_ptr< std::set< CoreNode * > > inputsCoreNodes_ = nullptr
 Input node's core.
 
std::unique_ptr< std::set< CoreSender< GraphOutput > * > > outputCoreNodes_ = nullptr
 Output node's core.
 
std::unique_ptr< AbstractSchedulerscheduler_ = nullptr
 Scheduler.
 
std::shared_ptr< CoreGraphSource< GraphInputs... > > source_ = nullptr
 Outer graph's source.
 
std::shared_ptr< CoreGraphSink< GraphOutput > > sink_ = nullptr
 Inner graph's source.
 
int graphId_ = 0
 Graph Id.
 
int deviceId_ = 0
 Device Id used for computation on devices.
 

Additional Inherited Members

- Protected Member Functions inherited from hh::core::CoreNode
void addUniqueInsideNode (const std::shared_ptr< CoreNode > &coreNode)
 Add a node to the inside nodes. More...
 
void incrementWaitDuration (std::chrono::duration< uint64_t, std::micro > const &wait)
 Increment wait duration. More...
 
void incrementExecutionDuration (std::chrono::duration< uint64_t, std::micro > const &exec)
 Increment execution duration. More...
 

Detailed Description

template<class GraphOutput, class ... GraphInputs>
class hh::core::CoreGraph< GraphOutput, GraphInputs >

Core associated to the Graph.

Internal representation of a graph in the hedgehog library. Hold nodes that's inside. If the graph is an outer graph, i.e. not inside another graph, it will have two special nodes: source and sink. The source is used to register the input nodes and to send data to them. The sink is used to gather data out of the output nodes, and make them available outside of the graph. When the graph is registered into another graph, the source and the sink are removed and the proper connections are made to the outer graph's nodes. A default scheduler is set to spawn the threads and join them at the end, and uses the OS to schedule threads.

Template Parameters
GraphOutputGraph output type
GraphInputsGraph input types

Definition at line 63 of file core_graph.h.

Constructor & Destructor Documentation

◆ CoreGraph() [1/2]

template<class GraphOutput, class ... GraphInputs>
hh::core::CoreGraph< GraphOutput, GraphInputs >::CoreGraph ( Graph< GraphOutput, GraphInputs... > *  graph,
NodeType const  type,
std::string_view const &  name,
std::unique_ptr< AbstractScheduler scheduler = std::make_unique<DefaultScheduler>() 
)
inline

CoreGraph constructor.

Parameters
graphUser graph
typeGraph's type
nameGraph's name
schedulerGraph's scheduler, by default a DefaultScheduler

Definition at line 80 of file core_graph.h.

◆ CoreGraph() [2/2]

template<class GraphOutput, class ... GraphInputs>
hh::core::CoreGraph< GraphOutput, GraphInputs >::CoreGraph ( CoreGraph< GraphOutput, GraphInputs... > const &  rhs)
inline

Core graph copy constructor.

Parameters
rhsCoreGraph to copy

Definition at line 110 of file core_graph.h.

Here is the call graph for this function:

Member Function Documentation

◆ addEdge()

template<class GraphOutput, class ... GraphInputs>
template<class UserDefinedSender , class UserDefinedMultiReceiver , class Output = typename UserDefinedSender::output_t, class Inputs = typename UserDefinedMultiReceiver::inputs_t, class IsSender = typename std::enable_if_t< std::is_base_of_v< behavior::Sender<Output>, UserDefinedSender > >, class IsMultiReceiver = typename std::enable_if_t< std::is_base_of_v< typename helper::HelperMultiReceiversType<Inputs>::type, UserDefinedMultiReceiver > >>
void hh::core::CoreGraph< GraphOutput, GraphInputs >::addEdge ( std::shared_ptr< UserDefinedSender >  from,
std::shared_ptr< UserDefinedMultiReceiver >  to 
)
inline

Add a directed edge from a compatible "from" node to "to" node.

Template Parameters
UserDefinedSenderSender type that should derive from Sender
UserDefinedMultiReceiverReceiver type that should derive from MultiReceivers
OutputSender output type
InputsTuple with MultiReceivers input types
IsSenderDefined if UserDefinedSender is derived from Sender
IsMultiReceiverDefined if UserDefinedMultiReceiver is derived from MultiReceivers
Parameters
fromNode that will send the data
toNode that will receiver the data

Definition at line 287 of file core_graph.h.

Here is the call graph for this function:

◆ addNotifier()

template<class GraphOutput, class ... GraphInputs>
void hh::core::CoreGraph< GraphOutput, GraphInputs >::addNotifier ( CoreNotifier notifier)
inlineoverridevirtual

Add a notifier to the graph, ie, to all input nodes.

Parameters
notifierCoreNotifier to add to all graph's input nodes

Implements hh::core::CoreSlot.

Definition at line 664 of file core_graph.h.

Here is the call graph for this function:

◆ addReceiver()

template<class GraphOutput, class ... GraphInputs>
void hh::core::CoreGraph< GraphOutput, GraphInputs >::addReceiver ( CoreReceiver< GraphOutput > *  receiver)
inlineoverridevirtual

Add a receiver to the graph, i.e, add a receiver to all output nodes.

Parameters
receiverReceiver to add to all output nodes

Implements hh::core::CoreSender< GraphOutput >.

Definition at line 608 of file core_graph.h.

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

◆ addReceiversToSource()

template<class GraphOutput, class ... GraphInputs>
template<class ... InputNodeTypes>
void hh::core::CoreGraph< GraphOutput, GraphInputs >::addReceiversToSource ( CoreMultiReceivers< InputNodeTypes... > *  inputCoreNode)
inlineprivate

Add receivers to source and do the connection.

Template Parameters
InputNodeTypesNode input types
Parameters
inputCoreNodeNode to add to the source

Definition at line 871 of file core_graph.h.

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

◆ addReceiverToSource()

template<class GraphOutput, class ... GraphInputs>
template<class InputNodeType >
void hh::core::CoreGraph< GraphOutput, GraphInputs >::addReceiverToSource ( CoreReceiver< InputNodeType > *  inputCoreNode)
inlineprivate

If the input core node is compatible, connect it to the source.

Template Parameters
InputNodeTypeInput node's type
Parameters
inputCoreNodeInput node to connect to the source

Definition at line 895 of file core_graph.h.

Here is the call graph for this function:

◆ addSlot()

template<class GraphOutput, class ... GraphInputs>
void hh::core::CoreGraph< GraphOutput, GraphInputs >::addSlot ( CoreSlot slot)
inlineoverridevirtual

Add a slot to a graph, i.e, to all output nodes.

Parameters
slotCoreSlot to add to all graph's output nodes

Implements hh::core::CoreNotifier.

Definition at line 637 of file core_graph.h.

Here is the call graph for this function:

◆ addSourceNotifierInputCoreNode()

template<class GraphOutput, class ... GraphInputs>
template<class InputNodeType , class ... InputNodeTypes>
void hh::core::CoreGraph< GraphOutput, GraphInputs >::addSourceNotifierInputCoreNode ( CoreMultiReceivers< InputNodeTypes... > *  inputCoreNode)
inlineprivate

Add an input node to the source.

Template Parameters
InputNodeTypeSpecific input type to make the connection
InputNodeTypesAll node's input types
Parameters
inputCoreNodeCoreMultiReceivers to connect to the source

Definition at line 884 of file core_graph.h.

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

◆ broadcastAndNotifyToAllInputs()

template<class GraphOutput, class ... GraphInputs>
template<class Input , class = typename std::enable_if_t<traits::Contains<Input, GraphInputs...>::value>>
void hh::core::CoreGraph< GraphOutput, GraphInputs >::broadcastAndNotifyToAllInputs ( std::shared_ptr< Input > &  data)
inline

Broadcast data and notify all input nodes.

Template Parameters
InputData input type
Parameters
dataData pushed into the graph, broadcast to all inputs

Definition at line 442 of file core_graph.h.

Here is the call graph for this function:

◆ clone()

template<class GraphOutput, class ... GraphInputs>
std::shared_ptr<CoreNode> hh::core::CoreGraph< GraphOutput, GraphInputs >::clone ( )
inlineoverridevirtual

Clone a core graph calling the graph copy constructor.

Returns
A cloned of this

Implements hh::core::CoreNode.

Definition at line 137 of file core_graph.h.

◆ createCluster()

template<class GraphOutput, class ... GraphInputs>
void hh::core::CoreGraph< GraphOutput, GraphInputs >::createCluster ( [[maybe_unused] ]std::shared_ptr< std::multimap< CoreNode *, std::shared_ptr< CoreNode >>> &  insideNodesGraph)
inlineoverride

Create all clusters for inside nodes and launch the threads, not gathered into insideNodesGraph.

Parameters
insideNodesGraphnot used

Definition at line 567 of file core_graph.h.

Here is the call graph for this function:

◆ deviceId() [1/2]

template<class GraphOutput, class ... GraphInputs>
int hh::core::CoreGraph< GraphOutput, GraphInputs >::deviceId ( )
inlineoverridevirtual

Device id accessor.

Returns
Device id

Reimplemented from hh::core::CoreNode.

Definition at line 148 of file core_graph.h.

◆ deviceId() [2/2]

template<class GraphOutput, class ... GraphInputs>
void hh::core::CoreGraph< GraphOutput, GraphInputs >::deviceId ( int  deviceId)
inlineoverridevirtual

Device id setter.

Parameters
deviceIdGraph's device id to set

Reimplemented from hh::core::CoreNode.

Definition at line 175 of file core_graph.h.

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

◆ duplicateInputNodes()

template<class GraphOutput, class ... GraphInputs>
template<class InputNodeType >
void hh::core::CoreGraph< GraphOutput, GraphInputs >::duplicateInputNodes ( CoreReceiver< InputNodeType > *  inputCoreNode)
inlineprivate

Duplicate input nodes, and do the connections for the source compatible type.

Template Parameters
InputNodeTypeSpecific Input node type
Parameters
inputCoreNodeInput node to connect to the source

Definition at line 908 of file core_graph.h.

Here is the call graph for this function:

◆ duplicateInsideNodes()

template<class GraphOutput, class ... GraphInputs>
void hh::core::CoreGraph< GraphOutput, GraphInputs >::duplicateInsideNodes ( CoreGraph< GraphOutput, GraphInputs... > const &  rhs)
inlineprivate

Duplicate inside nodes, called by CoreExecutionPipeline.

Parameters
rhsCoreGraph to duplicate

Definition at line 802 of file core_graph.h.

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

◆ executeGraph()

template<class GraphOutput, class ... GraphInputs>
void hh::core::CoreGraph< GraphOutput, GraphInputs >::executeGraph ( )
inline

Execute the graph.

Do the duplication of inside nodes and launch the threads

Definition at line 504 of file core_graph.h.

Here is the call graph for this function:

◆ getBlockingResult()

template<class GraphOutput, class ... GraphInputs>
std::shared_ptr<GraphOutput> hh::core::CoreGraph< GraphOutput, GraphInputs >::getBlockingResult ( )
inline

Get data out of the graph.

  • If the graph is not terminated:
    • If an output data is available: the output data is returned,
    • If no output data is available: the call is blocking until an output data is available
  • If the graph is terminated : return nullptr
    Attention
    If finishPushingData is not called there is a risk of deadlock
    Returns
    An output data or nullptr

Definition at line 549 of file core_graph.h.

Here is the call graph for this function:

◆ getSenders()

template<class GraphOutput, class ... GraphInputs>
std::set<CoreSender < GraphOutput>*> hh::core::CoreGraph< GraphOutput, GraphInputs >::getSenders ( )
inlineoverridevirtual

Get the senders from the graphs, gather them from the output nodes.

Returns
Set of CoreSender from the graph's output nodes

Implements hh::core::CoreSender< GraphOutput >.

Definition at line 741 of file core_graph.h.

◆ getSlots()

template<class GraphOutput, class ... GraphInputs>
std::set<CoreSlot *> hh::core::CoreGraph< GraphOutput, GraphInputs >::getSlots ( )
inlineoverridevirtual

Get the slots from the graphs, gather them from the input nodes.

Returns
Set of CoreSlot from the graph's input nodes

Implements hh::core::CoreNode.

Definition at line 753 of file core_graph.h.

◆ graphId() [1/2]

template<class GraphOutput, class ... GraphInputs>
int hh::core::CoreGraph< GraphOutput, GraphInputs >::graphId ( )
inlineoverridevirtual

Graph id accessor.

Returns
Graph id

Reimplemented from hh::core::CoreNode.

Definition at line 152 of file core_graph.h.

Here is the caller graph for this function:

◆ graphId() [2/2]

template<class GraphOutput, class ... GraphInputs>
void hh::core::CoreGraph< GraphOutput, GraphInputs >::graphId ( size_t  graphId)
inline

Graph id setter.

Parameters
graphIdGraph id

Definition at line 171 of file core_graph.h.

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

◆ hasNotifierConnected()

template<class GraphOutput, class ... GraphInputs>
bool hh::core::CoreGraph< GraphOutput, GraphInputs >::hasNotifierConnected ( )
inlineoverridevirtual

Test notifier for the graph, should not be used, connection is made to the input nodes.

Returns
nothing, throw an error

Implements hh::core::CoreSlot.

Definition at line 696 of file core_graph.h.

◆ ids()

template<class GraphOutput, class ... GraphInputs>
std::vector<std::pair<std::string, std::string> > hh::core::CoreGraph< GraphOutput, GraphInputs >::ids ( ) const
inlinefinalvirtual

Get ids of input nodes (vector<pair<nodeId, nodeIdCluster>>)

Returns
Ids of input nodes (vector<pair<nodeId, nodeIdCluster>>)

Reimplemented from hh::core::CoreNode.

Definition at line 494 of file core_graph.h.

Here is the call graph for this function:

◆ input()

template<class GraphOutput, class ... GraphInputs>
template<class UserDefinedMultiReceiver , class InputsMR = typename UserDefinedMultiReceiver::inputs_t, class InputsG = typename behavior::MultiReceivers<GraphInputs...>::inputs_t, class isMultiReceiver = typename std::enable_if_t< std::is_base_of_v<typename helper::HelperMultiReceiversType<InputsMR>::type, UserDefinedMultiReceiver> >, class isInputCompatible = typename std::enable_if_t<traits::is_included_v<InputsMR, InputsG>>>
void hh::core::CoreGraph< GraphOutput, GraphInputs >::input ( std::shared_ptr< UserDefinedMultiReceiver >  inputNode)
inline

Set a node as input for the graph.

Template Parameters
UserDefinedMultiReceiverNode's type
InputsMRTuple of UserDefinedMultiReceiver's input type
InputsGTuple of Graph's input type
isMultiReceiverDefined if UserDefinedMultiReceiver is derived from MultiReceiver
isInputCompatibleDefined if UserDefinedMultiReceiver and Graph (this) are compatible
Parameters
inputNodeNode to set as Graph's input

Definition at line 360 of file core_graph.h.

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

◆ inputsCoreNodes()

template<class GraphOutput, class ... GraphInputs>
std::unique_ptr<std::set<CoreNode *> > const& hh::core::CoreGraph< GraphOutput, GraphInputs >::inputsCoreNodes ( ) const
inline

Input node's cores accessor.

Returns
Input node's cores

Definition at line 156 of file core_graph.h.

Here is the caller graph for this function:

◆ maxExecutionTime()

template<class GraphOutput, class ... GraphInputs>
std::chrono::duration<uint64_t, std::micro> hh::core::CoreGraph< GraphOutput, GraphInputs >::maxExecutionTime ( ) const
inlineoverridevirtual

Compute the maximum execution time for the graph's inside nodes.

Returns
The maximum execution time for the graph's inside nodes

Reimplemented from hh::core::CoreNode.

Definition at line 179 of file core_graph.h.

Here is the call graph for this function:

◆ maxWaitTime()

template<class GraphOutput, class ... GraphInputs>
std::chrono::duration<uint64_t, std::micro> hh::core::CoreGraph< GraphOutput, GraphInputs >::maxWaitTime ( ) const
inlineoverridevirtual

Compute the maximum wait time for the graph's inside nodes.

Returns
The maximum wait time for the graph's inside nodes

Reimplemented from hh::core::CoreNode.

Definition at line 223 of file core_graph.h.

Here is the call graph for this function:

◆ minExecutionTime()

template<class GraphOutput, class ... GraphInputs>
std::chrono::duration<uint64_t, std::micro> hh::core::CoreGraph< GraphOutput, GraphInputs >::minExecutionTime ( ) const
inlineoverridevirtual

Compute the minimum execution time for the graph's inside nodes.

Returns
The minimum execution time for the graph's inside nodes

Reimplemented from hh::core::CoreNode.

Definition at line 202 of file core_graph.h.

Here is the call graph for this function:

◆ minWaitTime()

template<class GraphOutput, class ... GraphInputs>
std::chrono::duration<uint64_t, std::micro> hh::core::CoreGraph< GraphOutput, GraphInputs >::minWaitTime ( ) const
inlineoverridevirtual

Compute the minimum wait time for the graph's inside nodes.

Returns
The minimum wait time for the graph's inside nodes

Reimplemented from hh::core::CoreNode.

Definition at line 244 of file core_graph.h.

Here is the call graph for this function:

◆ node()

template<class GraphOutput, class ... GraphInputs>
behavior::Node* hh::core::CoreGraph< GraphOutput, GraphInputs >::node ( )
inlineoverridevirtual

User graph accessor.

Returns
User graph node

Implements hh::core::CoreNode.

Definition at line 144 of file core_graph.h.

◆ notifyAllTerminated()

template<class GraphOutput, class ... GraphInputs>
void hh::core::CoreGraph< GraphOutput, GraphInputs >::notifyAllTerminated ( )
inlineoverridevirtual

Notify termination to all connected nodes, not possible for a graph, throw an error in every case.

Exceptions
std::runtime_errorA graph do not send data

Implements hh::core::CoreNotifier.

Definition at line 655 of file core_graph.h.

◆ numberInputNodes()

template<class GraphOutput, class ... GraphInputs>
size_t hh::core::CoreGraph< GraphOutput, GraphInputs >::numberInputNodes ( ) const
inlineoverridevirtual

Return the number of input nodes connected, a graph should not have such a connection, throws in every case.

Returns
nothing, throw an error

Implements hh::core::CoreSlot.

Definition at line 705 of file core_graph.h.

◆ output()

template<class GraphOutput, class ... GraphInputs>
void hh::core::CoreGraph< GraphOutput, GraphInputs >::output ( std::shared_ptr< behavior::Sender< GraphOutput >>  outputNode)
inline

Set a node as output for the graph.

Template Parameters
UserDefinedSenderNode's type
IsSenderDefined if UserDefinedSender is derived from sender and has the same output as Graph's output
Parameters
outputNodeNode to set as Graph's output

Definition at line 398 of file core_graph.h.

Here is the call graph for this function:

◆ outputCoreNodes()

template<class GraphOutput, class ... GraphInputs>
std::unique_ptr<std::set<CoreSender < GraphOutput> *> > const& hh::core::CoreGraph< GraphOutput, GraphInputs >::outputCoreNodes ( ) const
inline

Output node's CoreSender accessor.

Returns
Output node's CoreSender

Definition at line 161 of file core_graph.h.

Here is the caller graph for this function:

◆ printCluster()

template<class GraphOutput, class ... GraphInputs>
void hh::core::CoreGraph< GraphOutput, GraphInputs >::printCluster ( AbstractPrinter printer,
std::shared_ptr< CoreNode > const &  node 
)
inlineprivate

Specialized method if the input node is in a cluster.

Parameters
printerPrinter visitor to print the cluster
nodeMain node cluster

Definition at line 930 of file core_graph.h.

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

◆ registerNode()

template<class GraphOutput, class ... GraphInputs>
void hh::core::CoreGraph< GraphOutput, GraphInputs >::registerNode ( const std::shared_ptr< CoreNode > &  coreNode)
inlineprivate

Register a node inside the graph.

Parameters
coreNodeNode to register inside the graph

Definition at line 792 of file core_graph.h.

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

◆ removeNotifier()

template<class GraphOutput, class ... GraphInputs>
void hh::core::CoreGraph< GraphOutput, GraphInputs >::removeNotifier ( CoreNotifier notifier)
inlineoverridevirtual

Remove a notifier from the graph, ie, from all input nodes.

Parameters
notifierCoreNotifier to remove from all graph's input nodes

Implements hh::core::CoreSlot.

Definition at line 680 of file core_graph.h.

Here is the call graph for this function:

◆ removeReceiver()

template<class GraphOutput, class ... GraphInputs>
void hh::core::CoreGraph< GraphOutput, GraphInputs >::removeReceiver ( CoreReceiver< GraphOutput > *  receiver)
inlineoverridevirtual

Remove a receiver from the graph, i.e, remove a receiver from all output nodes.

Parameters
receiverReceiver to remove from all output nodes

Implements hh::core::CoreSender< GraphOutput >.

Definition at line 617 of file core_graph.h.

Here is the call graph for this function:

◆ removeSlot()

template<class GraphOutput, class ... GraphInputs>
void hh::core::CoreGraph< GraphOutput, GraphInputs >::removeSlot ( CoreSlot slot)
inlineoverridevirtual

Remove a slot from a graph, i.e, from all output nodes.

Parameters
slotCoreSlot to remove from all graph's output nodes

Implements hh::core::CoreNotifier.

Definition at line 646 of file core_graph.h.

Here is the call graph for this function:

◆ sendAndNotify()

template<class GraphOutput, class ... GraphInputs>
void hh::core::CoreGraph< GraphOutput, GraphInputs >::sendAndNotify ( [[maybe_unused] ]std::shared_ptr< GraphOutput >  ptr)
inlineoverride

Send a data and notify receivers, not possible for a graph, throws an error in every case.

Exceptions
std::runtime_errorA graph do not send data
Parameters
ptrptr to send to receivers

Definition at line 627 of file core_graph.h.

Here is the caller graph for this function:

◆ source()

template<class GraphOutput, class ... GraphInputs>
std::shared_ptr<CoreGraphSource<GraphInputs...> > const& hh::core::CoreGraph< GraphOutput, GraphInputs >::source ( ) const
inline

Source accessor.

Returns
Graph's source

Definition at line 167 of file core_graph.h.

◆ visit()

template<class GraphOutput, class ... GraphInputs>
void hh::core::CoreGraph< GraphOutput, GraphInputs >::visit ( AbstractPrinter printer)
inlineoverridevirtual

Special visit method for a CoreGraph.

Parameters
printerPrinter visitor to print the CoreGraph

Implements hh::core::CoreNode.

Definition at line 574 of file core_graph.h.

Here is the call graph for this function:

◆ waitForNotification()

template<class GraphOutput, class ... GraphInputs>
bool hh::core::CoreGraph< GraphOutput, GraphInputs >::waitForNotification ( )
inlineoverridevirtual

A graph can't wait for notification, throws an error in all case.

Exceptions
std::runtime_errorA graph do not wait for notification
Returns
nothing, throw an error

Implements hh::core::CoreSlot.

Definition at line 730 of file core_graph.h.


The documentation for this class was generated from the following file: