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

Middle class used to propose a default definition of CoreExecute::callExecute for DefaultExecutionPipeline. More...

#include "core_default_execution_pipeline.h"

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

Public Member Functions

 CoreDefaultExecutionPipelineExecute (std::string_view const &name, AbstractExecutionPipeline< GraphOutput, GraphInputs... > *executionPipeline, std::shared_ptr< CoreGraph< GraphOutput, GraphInputs... >> coreBaseGraph, size_t numberGraphs, std::vector< int > const &deviceIds, bool automaticStart=false)
 CoreDefaultExecutionPipelineExecute constructor. More...
 
void callExecute ([[maybe_unused]]std::shared_ptr< GraphInput > data) override
 Definition of CoreExecute::callExecute for CoreDefaultExecutionPipeline. More...
 
- Public Member Functions inherited from hh::core::CoreExecutionPipeline< GraphOutput, GraphInputs... >
 CoreExecutionPipeline ()=delete
 Deleted Default constructor.
 
 CoreExecutionPipeline (std::string_view const &name, AbstractExecutionPipeline< GraphOutput, GraphInputs... > *executionPipeline, std::shared_ptr< CoreGraph< GraphOutput, GraphInputs... >> coreBaseGraph, size_t numberGraphs, std::vector< int > const &deviceIds, bool automaticStart)
 The core execution pipeline constructor. More...
 
virtual ~CoreExecutionPipeline ()=default
 Default destructor.
 
behavior::Nodenode () override
 Return the user's node. More...
 
std::vector< int > const & deviceIds () const
 Device ids accessor. More...
 
size_t numberGraphs () const
 Number of execution pipeline's graphs accessor. More...
 
std::string id () const override
 Execution pipeline id, i.e switch id accessor. More...
 
AbstractExecutionPipeline< GraphOutput, GraphInputs... > * executionPipeline () const
 User execution pipeline accessor. More...
 
int deviceId () override
 Get a device id, not possible for an execution pipeline, throw an error in every case. More...
 
std::set< CoreSender< GraphOutput > *> getSenders () override
 Execution pipeline's senders accessor. More...
 
std::shared_ptr< CoreGraph< GraphOutput, GraphInputs... > > baseCoreGraph ()
 Return the core of the base graph. More...
 
void addReceiver (CoreReceiver< GraphOutput > *receiver) override
 Add a receiver to the execution pipeline, to all inside graphs. More...
 
void addSlot (CoreSlot *slot) override
 Add a slot to a execution pipeline, i.e. to all inside graphs. More...
 
void visit (AbstractPrinter *printer) override
 Special visit method for an execution pipeline, visit also all inside graphs. More...
 
void createCluster ([[maybe_unused]]std::shared_ptr< std::multimap< CoreNode *, std::shared_ptr< CoreNode >>> &) override
 Create inner graphs clusters and launch the threads.
 
std::chrono::duration< uint64_t, std::micro > maxExecutionTime () const override
 Return the maximum execution time of all inside graphs. More...
 
std::chrono::duration< uint64_t, std::micro > minExecutionTime () const override
 Return the minimum execution time of all inside graphs. More...
 
std::chrono::duration< uint64_t, std::micro > maxWaitTime () const override
 Return the maximum wait time of all inside graphs. More...
 
std::chrono::duration< uint64_t, std::micro > minWaitTime () const override
 Return the minimum wait time of all inside graphs. More...
 
- Public Member Functions inherited from hh::core::CoreTask< GraphOutput, GraphInputs... >
 CoreTask (std::string_view const &name, size_t const numberThreads, NodeType const type, AbstractTask< GraphOutput, TaskInputs... > *task, bool automaticStart)
 CoreTask constructor (Used for AbstractTask and StateManager) More...
 
 ~CoreTask () override
 Core Task destructor.
 
bool automaticStart () const
 Automatic start property accessor. More...
 
void automaticStart (bool automaticStart)
 Automatic start property accessor. More...
 
std::shared_ptr< NvtxProfiler > & nvtxProfiler ()
 NVTX profiler accessor. More...
 
AbstractTask< GraphOutput, TaskInputs... > * task () const
 Node accessor. More...
 
void copyInnerStructure (CoreTask< GraphOutput, TaskInputs... > *rhs)
 Copy the inner structure from rhs to this CoreTask. More...
 
void createCluster (std::shared_ptr< std::multimap< CoreNode *, std::shared_ptr< CoreNode >>> &insideNodesGraph) override
 Create a cluster for a CoreTask. More...
 
void run () override
 Main loop for the CoreTask.
 
void operateReceiver ()
 Operate a CoreTasks's receiver for a specific type, thread safe. More...
 
bool waitForNotification () override
 Wait method for notification. More...
 
std::shared_ptr< AbstractTask< GraphOutput, TaskInputs... > > createCopyFromThis ()
 Create a copy from this instance. More...
 
- Public Member Functions inherited from hh::core::CoreQueueSender< GraphOutput >
 CoreQueueSender (std::string_view const &name, NodeType const type, size_t const numberThreads)
 CoreQueueSender constructor. More...
 
 ~CoreQueueSender () override
 CoreQueueSender destructor.
 
virtual std::shared_ptr< std::set< CoreQueueReceiver< GraphOutput > *> > const & destinations () const
 Destination accessor. More...
 
void removeReceiver (CoreReceiver< GraphOutput > *receiver) override
 Remove a receiver from the set of receivers. More...
 
void sendAndNotify (std::shared_ptr< GraphOutput > ptr) final
 Send a data to the list of destinations, and notify them. More...
 
void copyInnerStructure (CoreQueueSender< GraphOutput > *rhs)
 Copy the inner structure of a CoreQueueSender (destinations, and notifier) More...
 
- 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.
 
- 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::shared_ptr< CoreNodeclone ()=0
 Virtual constructor for copy. More...
 
virtual std::vector< std::pair< std::string, std::string > > ids () const
 Input node ids [nodeId, nodeIdCluster] 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...
 
virtual int graphId ()
 Graph id accessor. 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...
 
virtual void deviceId (int deviceId)
 Device id setter. More...
 
virtual void setInside ()
 Set the node as inside, (inside a graph)
 
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 postRun ()
 Method defining what to do after the run.
 
virtual void joinThreads ()
 Define what is done when the thread is joined.
 
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::CoreQueueNotifier
 CoreQueueNotifier (std::string_view const &name, NodeType const type, size_t const numberThreads)
 CoreQueueNotifier constructor. More...
 
 ~CoreQueueNotifier () override
 CoreQueueNotifier destructor.
 
std::shared_ptr< std::set< CoreSlot * > > const & slots () const
 Connected slots accessor. More...
 
void removeSlot (CoreSlot *slot) override
 Remove a slot from the set of connected slots. More...
 
void notifyAllTerminated () override
 Notify all slots that the node is terminated.
 
void copyInnerStructure (CoreQueueNotifier *rhs)
 Copy the inner structure of the notifier (set of slots and connections) More...
 
- Public Member Functions inherited from hh::core::CoreQueueMultiReceivers< TaskInputs... >
 CoreQueueMultiReceivers (std::string_view const &name, NodeType const type, size_t const numberThreads)
 CoreQueueMultiReceivers constructor. More...
 
 ~CoreQueueMultiReceivers () override
 CoreQueueMultiReceivers destructor.
 
bool receiversEmpty () final
 Test emptiness of all receivers. More...
 
size_t totalQueueSize () final
 Sums the queue sizes for all receivers. More...
 
std::set< CoreSlot *> getSlots () final
 Return a set of slots, {this}. More...
 
CoreQueueSlotqueueSlot () final
 Return the node's slot. More...
 
void copyInnerStructure (CoreQueueMultiReceivers< NodeInputs... > *rhs)
 Copy the inner structure of all receivers and the slot from rhs to this. More...
 
- Public Member Functions inherited from hh::core::CoreMultiReceivers< NodeInputs... >
 CoreMultiReceivers (std::string_view const &name, NodeType const type, size_t const numberThreads)
 CoreMultiReceivers constructor. More...
 
 ~CoreMultiReceivers () override
 CoreMultiReceivers destructor.
 
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::CoreQueueSlot
 CoreQueueSlot (std::string_view const &name, NodeType const type, size_t const numberThreads)
 CoreQueueSlot constructor. More...
 
 ~CoreQueueSlot () override
 CoreQueueSlot destructor.
 
std::shared_ptr< std::condition_variable > const & notifyConditionVariable () const
 Condition variable accessor. More...
 
std::shared_ptr< std::mutex > const & slotMutex () const
 Mutex accessor. More...
 
size_t numberInputNodes () const final
 Number of CoreNotifier linked accessor. More...
 
void addNotifier (CoreNotifier *notifier) final
 Add a notifier to set of CoreNotifier. More...
 
void removeNotifier (CoreNotifier *notifier) final
 Remove a notifier from set of CoreNotifier. More...
 
bool hasNotifierConnected () final
 Test if CoreNotifier are linked to this CoreQueueSlot. More...
 
void wakeUp () final
 Wake up and notify a node connected to the condition variable CoreQueueSlot::notifyConditionVariable_.
 
void lockUniqueMutex ()
 Lock the mutex.
 
void unlockUniqueMutex ()
 Unlock the mutex.
 
void copyInnerStructure (CoreQueueSlot *rhs)
 Copy the inner structure of the receiver (mutex, condition variable and set of notifiers) More...
 
- Public Member Functions inherited from hh::core::CoreQueueReceiver< NodeInputs >
 CoreQueueReceiver (std::string_view const &name, NodeType const type, size_t const numberThreads)
 CoreQueueReceiver constructor. More...
 
 ~CoreQueueReceiver () override
 CoreQueueReceiver default destructor.
 
size_t queueSize () override
 Return the current waiting data queue size. More...
 
size_t maxQueueSize ()
 Return the maximum current waiting data queue size registered. More...
 
void addSender (CoreSender< NodeInputs > *sender) final
 Add a CoreSender to this. More...
 
void removeSender (CoreSender< NodeInputs > *sender) final
 Remove a CoreSender from this. More...
 
void receive (std::shared_ptr< NodeInputs > data) final
 Receive a data from a CoreQueueSender, and store it into the waiting queue. More...
 
bool receiverEmpty () final
 Test emptiness on the queue. More...
 
std::set< CoreReceiver< NodeInputs > *> receivers () override
 Receivers accessor. More...
 
std::shared_ptr< NodeInputs > popFront ()
 Return the front element of the queue and return it. More...
 
void copyInnerStructure (CoreQueueReceiver< NodeInputs > *rhs)
 Copy the CoreQueueReceiver inner structure (queue and senders list) from rhs to this. More...
 
- Public Member Functions inherited from hh::core::CoreReceiver< NodeInputs >
 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.
 
- Public Member Functions inherited from hh::core::CoreExecute< TaskInputs >
virtual void callExecute (std::shared_ptr< TaskInputs > data)=0
 Wrapper to call the user-defined Execute::execute. More...
 

Private Member Functions

template<class Input >
bool callSendToGraph (std::shared_ptr< Input > &data, size_t const &graphId)
 Wrapper to the user-defined SwitchRule::sendToGraph. More...
 

Additional Inherited Members

- Protected Member Functions inherited from hh::core::CoreExecutionPipeline< GraphOutput, GraphInputs... >
bool callCanTerminate (bool lock) override
 Can terminate for the ep, specialised to not call user's defined one. More...
 
- Protected Member Functions inherited from hh::core::CoreQueueSender< GraphOutput >
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...
 
- 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...
 
- Protected Member Functions inherited from hh::core::CoreQueueSlot
std::shared_ptr< std::set< CoreNotifier * > > const & notifiers () const
 Protected accessor to the set of notifiers connected to the CoreQueueSlot. More...
 
- Protected Attributes inherited from hh::core::CoreExecutionPipeline< GraphOutput, GraphInputs... >
std::shared_ptr< CoreSwitch< GraphInputs... > > coreSwitch_
 Switch use to divert the data to the graphs.
 
std::vector< std::shared_ptr< CoreGraph< GraphOutput, GraphInputs... > > > epGraphs_
 Core Copies of the graphs (actual memory is stored here)
 

Detailed Description

template<class GraphInput, class GraphOutput, class ... GraphInputs>
class hh::core::CoreDefaultExecutionPipelineExecute< GraphInput, GraphOutput, GraphInputs >

Middle class used to propose a default definition of CoreExecute::callExecute for DefaultExecutionPipeline.

Template Parameters
GraphInputType of data to send to CoreExecute::callExecute
GraphOutputGraph's output type
GraphInputsGraph's inputs type

Definition at line 38 of file core_default_execution_pipeline.h.

Constructor & Destructor Documentation

◆ CoreDefaultExecutionPipelineExecute()

template<class GraphInput, class GraphOutput, class ... GraphInputs>
hh::core::CoreDefaultExecutionPipelineExecute< GraphInput, GraphOutput, GraphInputs >::CoreDefaultExecutionPipelineExecute ( std::string_view const &  name,
AbstractExecutionPipeline< GraphOutput, GraphInputs... > *  executionPipeline,
std::shared_ptr< CoreGraph< GraphOutput, GraphInputs... >>  coreBaseGraph,
size_t  numberGraphs,
std::vector< int > const &  deviceIds,
bool  automaticStart = false 
)
inline

CoreDefaultExecutionPipelineExecute constructor.

Parameters
nameExecution pipeline name
executionPipelineUser's execution pipeline instance
coreBaseGraphBase graph's core
numberGraphsNumber of graphs i nthe execution pipeline
deviceIdsDevice Ids corresponding of each copy of the graph
automaticStartAutomatic start property for the graph

Definition at line 47 of file core_default_execution_pipeline.h.

Member Function Documentation

◆ callExecute()

template<class GraphInput, class GraphOutput, class ... GraphInputs>
void hh::core::CoreDefaultExecutionPipelineExecute< GraphInput, GraphOutput, GraphInputs >::callExecute ( [[maybe_unused] ]std::shared_ptr< GraphInput >  data)
inlineoverride

Definition of CoreExecute::callExecute for CoreDefaultExecutionPipeline.

Send the data to the graph if the data should be send

Parameters
dataData to be sent

Definition at line 63 of file core_default_execution_pipeline.h.

◆ callSendToGraph()

template<class GraphInput, class GraphOutput, class ... GraphInputs>
template<class Input >
bool hh::core::CoreDefaultExecutionPipelineExecute< GraphInput, GraphOutput, GraphInputs >::callSendToGraph ( std::shared_ptr< Input > &  data,
size_t const &  graphId 
)
inlineprivate

Wrapper to the user-defined SwitchRule::sendToGraph.

Template Parameters
InputData type
Parameters
dataData to be send to the graph
graphIdGraph Id to test
Returns
True if the data should be sent to the graph graphId, else False

Definition at line 79 of file core_default_execution_pipeline.h.


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