class to create a data-parallel pipeline scheduling framework More...
#include <taskflow/algorithm/data_pipeline.hpp>
Public Types | |
| using | data_t |
| internal storage type for each data token (default std::variant) | |
Public Member Functions | |
| DataPipeline (size_t num_lines, Ps &&... ps) | |
| constructs a data-parallel pipeline object | |
| DataPipeline (size_t num_lines, std::tuple< Ps... > &&ps) | |
| constructs a data-parallel pipeline object | |
| size_t | num_lines () const noexcept |
| queries the number of parallel lines | |
| constexpr size_t | num_pipes () const noexcept |
| queries the number of pipes | |
| void | reset () |
| resets the pipeline | |
| size_t | num_tokens () const noexcept |
| queries the number of generated tokens in the pipeline | |
| Graph & | graph () |
| obtains the graph object associated with the pipeline construct | |
class to create a data-parallel pipeline scheduling framework
| Ps | data pipe types |
Similar to tf::Pipeline, a tf::DataPipeline is a composable graph object for users to create a data-parallel pipeline scheduling framework using a module task in a taskflow. The only difference is that tf::DataPipeline provides a data abstraction for users to quickly express dataflow in a pipeline. The following example creates a data-parallel pipeline of three stages that generate dataflow from void to int, std::string, and void.
The pipeline schedules five tokens over four parallel lines in a circular fashion, as depicted below:
| using tf::DataPipeline< Ps >::data_t |
internal storage type for each data token (default std::variant)
| tf::DataPipeline< Ps >::DataPipeline | ( | size_t | num_lines, |
| Ps &&... | ps ) |
constructs a data-parallel pipeline object
| num_lines | the number of parallel lines |
| ps | a list of pipes |
Constructs a data-parallel pipeline of up to num_lines parallel lines to schedule tokens through the given linear chain of pipes. The first pipe must define a serial direction (tf::PipeType::SERIAL) or an exception will be thrown.
| tf::DataPipeline< Ps >::DataPipeline | ( | size_t | num_lines, |
| std::tuple< Ps... > && | ps ) |
constructs a data-parallel pipeline object
| num_lines | the number of parallel lines |
| ps | a tuple of pipes |
Constructs a data-parallel pipeline of up to num_lines parallel lines to schedule tokens through the given linear chain of pipes stored in a std::tuple. The first pipe must define a serial direction (tf::PipeType::SERIAL) or an exception will be thrown.
| Graph & tf::DataPipeline< Ps >::graph | ( | ) |
obtains the graph object associated with the pipeline construct
This method is primarily used as an opaque data structure for creating a module task of this pipeline.
|
noexcept |
queries the number of parallel lines
The function returns the number of parallel lines given by the user upon the construction of the pipeline. The number of lines represents the maximum parallelism this pipeline can achieve.
|
constexprnoexcept |
queries the number of pipes
The Function returns the number of pipes given by the user upon the construction of the pipeline.
|
noexcept |
queries the number of generated tokens in the pipeline
The number represents the total scheduling tokens that has been generated by the pipeline so far.
| void tf::DataPipeline< Ps >::reset | ( | ) |
resets the pipeline
Resetting the pipeline to the initial state. After resetting a pipeline, its token identifier will start from zero as if the pipeline was just constructed.