ExecutionStream Implementation. More...
#include <stream.hpp>
Public Member Functions | |
ExecutionStream (std::shared_ptr< ExecutionGraphParameters > params) | |
Construct a new execution stream. More... | |
NodeID | Add (const IExecutionGraph::Function &function, const std::vector< IExecutionGraph::NodeID > dependencies=std::vector< IExecutionGraph::NodeID >(0)) override |
Adds a function to the execution stream. More... | |
Status | Sync (const IExecutionGraph::NodeID node=-1) override |
Synchronises the execution of the stream. More... | |
Status | GetLastError () override |
Get the Last Error found during the execution. More... | |
virtual | ~ExecutionStream () |
destroys the stream | |
![]() | |
virtual | ~IExecutionGraph ()=default |
Additional Inherited Members | |
![]() | |
enum | Type { None = 0 , STREAM } |
Enum with the multiple implementations of the IExecutionGraph. More... | |
typedef int | NodeID |
Underlying type for the NodeID. | |
typedef std::function< Status()> | Function |
Underlying type for the auxiliar functions. More... | |
![]() | |
static std::shared_ptr< IExecutionGraph > | Create (const IExecutionGraph::Type type, const std::shared_ptr< ExecutionGraphParameters > params) |
Factory method to create a new implementation. More... | |
ExecutionStream Implementation.
This implementation is used to create execution graphs for asynchronous running in a linear queue fashion, quite similar to CUDA Streams.
All functions and their arguments added to the ExecutionStream must be accesible all the time that the graph is active. Otherwise, it may lead to catastrophic errors.
|
explicit |
Construct a new execution stream.
params | parameters of the stream. |
|
overridevirtual |
Adds a function to the execution stream.
This adds a new function to the graph for further execution. It is enqueued last in a queue. You cannot specify the dependencies since it is implemented through an execution queue
function | auxiliar function to add for execution. It is a lambda function with all elements passed by value (recommended) and all the variables used must be reachable. |
dependencies | unused since it is implemented as a FIFO. |
Implements cynq::IExecutionGraph.
|
overridevirtual |
Get the Last Error found during the execution.
It returns the last error that happened during the execution.
Implements cynq::IExecutionGraph.
|
overridevirtual |
Synchronises the execution of the stream.
It synchronises the execution of the stream partially or completely. This is a blocking call, meaning that it will wait until the execution is completed. If the node passed by argument already executed, it returns immediately. Otherwise, it will wait until a notification of completion.
node | wait until the node is completed (defaults to: -1), which means that it will block until the entire stream execution is completed. |
Implements cynq::IExecutionGraph.