20 #ifndef HEDGEHOG_CORE_DEFAULT_EXECUTION_PIPELINE_H 21 #define HEDGEHOG_CORE_DEFAULT_EXECUTION_PIPELINE_H 23 #include "../node/execution_pipeline/core_execution_pipeline.h" 24 #include "../../behavior/switch_rule.h" 29 #if defined (__clang__) 30 #pragma clang diagnostic push 31 #pragma clang diagnostic ignored "-Woverloaded-virtual" 33 template<
class GraphInput,
class GraphOutput,
class ...GraphInputs>
63 void callExecute([[maybe_unused]]std::shared_ptr<GraphInput> data)
override {
65 if (this->callSendToGraph<GraphInput>(data, graph->graphId())) {
84 #if defined (__clang__) 85 #pragma clang diagnostic pop 91 template<
class GraphOutput,
class ...GraphInputs>
106 std::string_view
const &
name,
119 name, executionPipeline, coreBaseGraph, numberGraphs, deviceIds, automaticStart),
121 name, executionPipeline, coreBaseGraph, numberGraphs, deviceIds, automaticStart)
156 std::shared_ptr<CoreNode>
clone()
override {
159 std::dynamic_pointer_cast<
CoreGraph<GraphOutput, GraphInputs...>>(
169 std::unique_lock<std::mutex> lock(*(this->
slotMutex()));
170 HLOG_SELF(2,
"Wait for notification")
177 "Check for notification: " << std::boolalpha
178 << (
bool) (!receiversEmpty) <<
"||" 180 << (
bool) callCanTerminate)
183 HLOG_SELF(2,
"Notification received")
193 (removeSwitchReceiver<GraphInputs>(graph.get()), ...);
200 graph->waitForTermination();
209 template<
class GraphInput>
211 for (
auto r : coreGraphReceiver->
receivers()) {
218 #endif //HEDGEHOG_CORE_DEFAULT_EXECUTION_PIPELINE_H Receiver Interface, receive one data type from CoreSender.
CoreDefaultExecutionPipeline(CoreDefaultExecutionPipeline< GraphOutput, GraphInputs... > const &rhs, std::shared_ptr< CoreGraph< GraphOutput, GraphInputs... >> baseGraph)
Constructor used to clone a CoreDefaultExecutionPipeline.
void callExecute([[maybe_unused]]std::shared_ptr< GraphInput > data) override
Definition of CoreExecute::callExecute for CoreDefaultExecutionPipeline.
std::vector< std::shared_ptr< CoreGraph< GraphOutput, GraphInputs... > > > epGraphs_
Core Copies of the graphs (actual memory is stored here)
bool callSendToGraph(std::shared_ptr< Input > &data, size_t const &graphId)
Wrapper to the user-defined SwitchRule::sendToGraph.
Graph Receiver for a type GraphInput.
std::shared_ptr< CoreSwitch< GraphInputs... > > coreSwitch_
Switch use to divert the data to the graphs.
Core Notifier interface, emit notification to CoreSlot.
std::shared_ptr< std::mutex > const & slotMutex() const
Mutex accessor.
bool waitForNotification() override
Define how the CoreDefaultExecutionPipeline wait for data.
bool isActive() const
Is active property accessor.
AbstractExecutionPipeline< GraphOutput, GraphInputs... > * executionPipeline() const
User execution pipeline accessor.
Sender for nodes possessing a queue of data.
Node core for the default execution pipeline.
Slot interface, receive notification from CoreNotifier.
virtual int graphId()
Graph id accessor.
CoreDefaultExecutionPipeline(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)
Node core for the default execution pipeline constructor.
NodeType
Hedgehog node's type.
size_t numberGraphs() const
Number of execution pipeline's graphs accessor.
Main Hedgehog core abstraction.
void postRun() override
Post Execute loop for CoreDefaultExecutionPipeline.
Notifier of CoreQueueSlot.
std::shared_ptr< std::condition_variable > const & notifyConditionVariable() const
Condition variable accessor.
std::shared_ptr< CoreNode > clone() override
CoreDefaultExecutionPipeline clone used if it is embedded in another CoreDefaultExecutionPipeline.
std::vector< int > const & deviceIds() const
Device ids accessor.
std::string_view const & name() const
Node name accessor.
void removeReceiver(CoreReceiver< GraphOutput > *receiver) override
Remove a receiver from the set of receivers.
bool receiversEmpty() final
Test emptiness of all receivers.
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.
Core associated to the Graph.
bool callCanTerminate(bool lock) override
Can terminate for the ep, specialised to not call user's defined one.
void removeSender(CoreSender< GraphInput > *sender) final
Remove a CoreSender from the graph.
bool automaticStart() const
Automatic start property accessor.
void receive(std::shared_ptr< NodeInputs > data) final
Receive a data from a CoreQueueSender, and store it into the waiting queue.
std::shared_ptr< NvtxProfiler > & nvtxProfiler()
NVTX profiler accessor.
std::set< CoreReceiver< GraphInput > * > receivers() override
Get a set of CoreReceiver built from the input nodes.
Behavior definition for dispatching data to a Graph managed by an AbstractExecutionPipeline.
std::shared_ptr< CoreGraph< GraphOutput, GraphInputs... > > baseCoreGraph()
Return the core of the base graph.
void removeSwitchReceiver(CoreGraphReceiver< GraphInput > *coreGraphReceiver)
Remove a specific Receiver of all input inside graph.
Middle class used to propose a default definition of CoreExecute::callExecute for DefaultExecutionPip...