Hedgehog  3.1.0
A library to generate hybrid pipeline workflow systems
Loading...
Searching...
No Matches
abstract_execution_pipeline.h
Go to the documentation of this file.
1// NIST-developed software is provided by NIST as a public service. You may use, copy and distribute copies of the
2// software in any medium, provided that you keep intact this entire notice. You may improve, modify and create
3// derivative works of the software or any portion of the software, and you may copy and distribute such modifications
4// or works. Modified works should carry a notice stating that you changed the software and should note the date and
5// nature of any such change. Please explicitly acknowledge the National Institute of Standards and Technology as the
6// source of the software. NIST-developed software is expressly provided "AS IS." NIST MAKES NO WARRANTY OF ANY KIND,
7// EXPRESS, IMPLIED, IN FACT OR ARISING BY OPERATION OF LAW, INCLUDING, WITHOUT LIMITATION, THE IMPLIED WARRANTY OF
8// MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, NON-INFRINGEMENT AND DATA ACCURACY. NIST NEITHER REPRESENTS NOR
9// WARRANTS THAT THE OPERATION OF THE SOFTWARE WILL BE UNINTERRUPTED OR ERROR-FREE, OR THAT ANY DEFECTS WILL BE
10// CORRECTED. NIST DOES NOT WARRANT OR MAKE ANY REPRESENTATIONS REGARDING THE USE OF THE SOFTWARE OR THE RESULTS
11// THEREOF, INCLUDING BUT NOT LIMITED TO THE CORRECTNESS, ACCURACY, RELIABILITY, OR USEFULNESS OF THE SOFTWARE. You
12// are solely responsible for determining the appropriateness of using and distributing the software and you assume
13// all risks associated with its use, including but not limited to the risks and costs of program errors, compliance
14// with applicable laws, damage to or loss of data, programs or equipment, and the unavailability or interruption of
15// operation. This software is not intended to be used in any situation where a failure could cause risk of injury or
16// damage to property. The software developed by NIST employees is not subject to copyright protection within the
17// United States.
18
19#ifndef HEDGEHOG_ABSTRACT_EXECUTION_PIPELINE_H_
20#define HEDGEHOG_ABSTRACT_EXECUTION_PIPELINE_H_
21
22#include "../graph/graph.h"
23#include "../../behavior/copyable.h"
24#include "../../core/nodes/core_execution_pipeline.h"
25#include "../../behavior/switch/multi_switch_rules.h"
26
28namespace hh {
29
88template<size_t Separator, class ...AllTypes>
90 : public behavior::Node,
91 public behavior::Copyable<AbstractExecutionPipeline<Separator, AllTypes...>>,
92 public tool::BehaviorMultiReceiversTypeDeducer_t<tool::Inputs<Separator, AllTypes...>>,
93 public tool::BehaviorMultiSwitchRulesTypeDeducer_t<tool::Inputs<Separator, AllTypes...>>,
94 public tool::BehaviorMultiSendersTypeDeducer_t<tool::Outputs<Separator, AllTypes...>> {
95#ifndef DOXYGEN_SHOULD_SKIP_THIS
97 friend hh::core::CoreExecutionPipeline<Separator, AllTypes...>;
98#endif //DOXYGEN_SHOULD_SKIP_THIS
99 private:
100 std::shared_ptr<Graph<Separator, AllTypes...>>
101 graph_ = nullptr;
102
103 std::shared_ptr<core::CoreExecutionPipeline<Separator, AllTypes...>> const
105 public:
112 std::shared_ptr<Graph<Separator, AllTypes...>> const graph,
113 size_t const &numberGraphs,
114 std::string const name = "Execution pipeline")
115 : behavior::Node(
116 static_cast<std::shared_ptr<core::abstraction::NodeAbstraction>>(
117 static_cast<std::shared_ptr<core::abstraction::NodeAbstraction> const>(
118 std::make_shared<core::CoreExecutionPipeline<Separator, AllTypes...>>(
119 this, graph->coreGraph_, numberGraphs, name)))
120 ),
121 behavior::Copyable<AbstractExecutionPipeline<Separator, AllTypes...>>(1),
122 graph_(graph),
123 coreExecutionPipeline_(std::dynamic_pointer_cast<core::CoreExecutionPipeline<Separator,
124 AllTypes...>>(this->core())) {}
125
133 std::shared_ptr<Graph<Separator, AllTypes...>> const graph,
134 std::vector<int> const &deviceIds,
135 std::string const name = "Execution pipeline")
136 : behavior::Node(
137 std::make_shared<core::CoreExecutionPipeline<Separator, AllTypes...>>(this, graph->coreGraph_, deviceIds, name)
138 ),
139 behavior::Copyable<AbstractExecutionPipeline<Separator, AllTypes...>>(1),
140 graph_(graph),
141 coreExecutionPipeline_(std::dynamic_pointer_cast<core::CoreExecutionPipeline<Separator,
142 AllTypes...>>(this->core())) {}
143
145 ~AbstractExecutionPipeline() override = default;
146
147 private:
150 std::shared_ptr<Graph<Separator, AllTypes...>> const &graph() const {
151 return graph_;
152 }
153
157 graph_ = graph;
158 }
159};
160
161}
162
163#endif //HEDGEHOG_ABSTRACT_EXECUTION_PIPELINE_H_
Hedgehog main namespace.
Execution pipeline abstraction.
std::shared_ptr< core::CoreExecutionPipeline< Separator, AllTypes... > > const coreExecutionPipeline_
Execution Pipeline core.
void graph(std::shared_ptr< Graph< Separator, AllTypes... > > graph)
Base graph setter.
~AbstractExecutionPipeline() override=default
Default destructor.
AbstractExecutionPipeline(std::shared_ptr< Graph< Separator, AllTypes... > > const graph, size_t const &numberGraphs, std::string const name="Execution pipeline")
Create an execution pipeline that duplicates a graph, numberGraphs - 1 times. The graph id and the de...
std::shared_ptr< Graph< Separator, AllTypes... > > graph_
Original Graph that will be duplicated.
std::shared_ptr< Graph< Separator, AllTypes... > > const & graph() const
Accessor top the base graph.
AbstractExecutionPipeline(std::shared_ptr< Graph< Separator, AllTypes... > > const graph, std::vector< int > const &deviceIds, std::string const name="Execution pipeline")
Create an execution pipeline from a graph and the given device ids. If there are n device ids given,...
Hedgehog graph abstraction.
Definition: graph.h:137
Copy interface used to copy a node when either a group of nodes is created or a node is duplicated wh...
Definition: copyable.h:37
Copyable(size_t const numberThreads)
Copyable constructor, set the number of threads for a node.
Definition: copyable.h:44
Behavior abstraction for the base node.
Definition: node.h:32
std::string name() const
Node's name accessor.
Definition: node.h:53
Node(std::shared_ptr< hh::core::abstraction::NodeAbstraction > core)
Constructor's node.
Definition: node.h:40
std::shared_ptr< hh::core::abstraction::NodeAbstraction > const & core() const
Core accessor.
Definition: node.h:49