CYNQ  0.3.0
Framework to develop FPGA applications in C++ with the easiness of PYNQ
cynq::ExecutionStream Class Reference

ExecutionStream Implementation. More...

#include <stream.hpp>

Inheritance diagram for cynq::ExecutionStream:
Collaboration diagram for cynq::ExecutionStream:

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
 
- Public Member Functions inherited from cynq::IExecutionGraph
virtual ~IExecutionGraph ()=default
 

Additional Inherited Members

- Public Types inherited from cynq::IExecutionGraph
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 Public Member Functions inherited from cynq::IExecutionGraph
static std::shared_ptr< IExecutionGraphCreate (const IExecutionGraph::Type type, const std::shared_ptr< ExecutionGraphParameters > params)
 Factory method to create a new implementation. More...
 

Detailed Description

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.

Constructor & Destructor Documentation

◆ ExecutionStream()

cynq::ExecutionStream::ExecutionStream ( std::shared_ptr< ExecutionGraphParameters params)
explicit

Construct a new execution stream.

Parameters
paramsparameters of the stream.

Member Function Documentation

◆ Add()

IExecutionGraph::NodeID cynq::ExecutionStream::Add ( const IExecutionGraph::Function function,
const std::vector< IExecutionGraph::NodeID dependencies = std::vector<IExecutionGraph::NodeID>(0) 
)
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

Parameters
functionauxiliar 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.
dependenciesunused since it is implemented as a FIFO.
Returns
NodeID id of the newly added node. If the NodeID is -1, it means that the function could not be added.

Implements cynq::IExecutionGraph.

◆ GetLastError()

Status cynq::ExecutionStream::GetLastError ( )
overridevirtual

Get the Last Error found during the execution.

It returns the last error that happened during the execution.

Returns
Status status object with the error

Implements cynq::IExecutionGraph.

◆ Sync()

Status cynq::ExecutionStream::Sync ( const IExecutionGraph::NodeID  node = -1)
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.

Parameters
nodewait until the node is completed (defaults to: -1), which means that it will block until the entire stream execution is completed.
Returns
Status

Implements cynq::IExecutionGraph.


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