Hedgehog
3.1.0
A library to generate hybrid pipeline workflow systems
|
Base node for computation. More...
#include "abstract_task.h"
Public Member Functions | |
AbstractTask () | |
Default constructor (Task with one thread named "Task") | |
AbstractTask (std::string const &name, size_t const numberThreads=1, bool const automaticStart=false) | |
AbstractTask main constructor. | |
AbstractTask (std::shared_ptr< hh::core::CoreTask< Separator, AllTypes... > > coreTask) | |
Construct a task from a user-defined core. | |
~AbstractTask () override=default | |
Default task destructor. | |
size_t | graphId () const |
Belonging graph id accessor. | |
bool | canTerminate () const override |
Default termination rule, it terminates if there is no predecessor connection and there is no input data. | |
![]() | |
TaskNode (std::shared_ptr< hh::core::abstraction::TaskNodeAbstraction > core) | |
Constructor using a core. | |
~TaskNode () override=default | |
Default destructor. | |
std::shared_ptr< AbstractMemoryManager > const & | memoryManager () const |
Memory manager accessor. | |
void | connectMemoryManager (std::shared_ptr< AbstractMemoryManager > mm) |
Connect a memory manager to a task. | |
std::shared_ptr< ManagedMemory > | getManagedMemory () |
Get a managed memory for the memory manager attached to the task, can block if none are available at the time of the call. | |
virtual void | initialize () |
initialize step for the task | |
virtual void | shutdown () |
shutdown step for the task | |
virtual std::string | extraPrintingInformation () const |
Print extra information for the task. | |
![]() | |
Node (std::shared_ptr< hh::core::abstraction::NodeAbstraction > core) | |
Constructor's node. | |
virtual | ~Node ()=default |
Default destructor. | |
std::shared_ptr< hh::core::abstraction::NodeAbstraction > const & | core () const |
Core accessor. | |
std::string | name () const |
Node's name accessor. | |
![]() | |
CanTerminate ()=default | |
Default constructor. | |
virtual | ~CanTerminate ()=default |
Default destructor. | |
virtual bool | canTerminate () const =0 |
Termination condition. | |
![]() | |
Cleanable ()=default | |
Default constructor. | |
~Cleanable ()=default | |
Default destructor. | |
virtual void | clean () |
Clean a node. | |
![]() | |
Copyable (size_t const numberThreads) | |
Copyable constructor, set the number of threads for a node. | |
virtual | ~Copyable ()=default |
Default destructor. | |
size_t | numberThreads () const |
Number of threads accessor. | |
std::vector< AbstractTask< Separator, AllTypes... > const * > | group () const |
Get the group of nodes that hold the current nodes. | |
virtual std::shared_ptr< AbstractTask< Separator, AllTypes... > > | copy () |
Copy method called to either create a group of node or duplicate a node when an execution pipeline is created. | |
Protected Member Functions | |
std::shared_ptr< hh::core::CoreTask< Separator, AllTypes... > > const & | coreTask () const |
Accessor to the core task. | |
int | deviceId () |
Accessor to device id linked to the task (default 0 for CPU task) | |
Private Attributes | |
std::shared_ptr< hh::core::CoreTask< Separator, AllTypes... > > const | coreTask_ = nullptr |
Task core. | |
Base node for computation.
Hedgehog Graph's node made for processing data from the their overloaded execute method from Execute::execute.
An AbstractTask can be bound to multiple threads, forming a group of tasks. The base AbstractTask will be copied n-1 times and each of them will be bound to a thread. The AbstractTask::copy method must be overloaded to use this functionality. Also, if the AbstractTask is part of a Graph that will be duplicated with an AbstractExecutionPipeline, AbstractTask::copy method needs to be overloaded.
A MemoryManager could be linked to a task:
The default order of execution is:
Only Execute::execute method needs to be overloaded for each AbstractTask input type.
Separator | Separator position between input types and output types |
AllTypes | List of input and output types |
Definition at line 108 of file abstract_task.h.
|
inline |
Default constructor (Task with one thread named "Task")
Definition at line 120 of file abstract_task.h.
|
inlineexplicit |
AbstractTask main constructor.
Construct a task with a name, its number of threads (default 1) and if the task should start automatically or not (default should not start automatically)
name | Task name |
numberThreads | Task number of threads |
automaticStart | Flag to start the execution of the task without data (sending automatically nullptr to each of the input types) |
std::runtime_error | the number of threads == 0 or the core is not of the right type (do not derive from CoreTask) |
Definition at line 130 of file abstract_task.h.
|
inlineexplicit |
Construct a task from a user-defined core.
A custom core can be used to customize how the task behaves internally. For example, by default any input is stored in a std::queue, it can be changed to a std::priority_queue instead through the core.
coreTask | Custom core used to change the behavior of the task |
Definition at line 147 of file abstract_task.h.
|
overridedefault |
Default task destructor.
|
inlineoverridevirtual |
Default termination rule, it terminates if there is no predecessor connection and there is no input data.
Implements hh::behavior::CanTerminate.
Definition at line 165 of file abstract_task.h.
|
inlineprotected |
|
inlineprotected |
Accessor to device id linked to the task (default 0 for CPU task)
Definition at line 176 of file abstract_task.h.
|
inline |
Belonging graph id accessor.
Definition at line 161 of file abstract_task.h.
|
private |
Task core.
Definition at line 117 of file abstract_task.h.