#include <limits>
#include <dispenso/detail/pipeline_impl.h>
Go to the source code of this file.
Typedefs | |
template<typename T > | |
using | dispenso::OpResult = detail::OpResult< T > |
Functions | |
template<typename F > | |
auto | dispenso::stage (F &&f, ssize_t limit) |
template<typename... Stages> | |
void | dispenso::pipeline (ThreadPool &pool, Stages &&... sIn) |
template<typename... Stages> | |
void | dispenso::pipeline (Stages &&... sIn) |
Variables | |
constexpr ssize_t | dispenso::kStageNoLimit = std::numeric_limits<ssize_t>::max() |
A file providing utilities for parallel pipelining of work.
Definition in file pipeline.h.
using dispenso::OpResult = typedef detail::OpResult<T> |
OpResult is like a poor-man's std::optional for those who wish to use dispenso pipeline filtering in C++14. In C++17 and beyond, it is recommended to use std::optional instead. OpResult has implicit construct from T, just like std::optional, and move/copy constructors and operators, bool conversion, and value() function, but otherwise provides less functionality than std::optional.
Definition at line 29 of file pipeline.h.
void dispenso::pipeline | ( | Stages &&... | sIn | ) |
Pipeline work in stages. Pipelines allow stages to specify parallelism limits by using the stage
function, or a function-like object can simply be passed directly, indicating a serial stage. Even if stages are serial, there can be parallelism between stages, so in a 3 stage serial pipeline, the expected runtime is the max of the 3 stages runtimes (note that this is in the absence of pipeline overheads and with an infinitely long workstream. In practice speedup is somewhat less). Work will be run on dispenso's global thread pool. This function will block until the entire pipeline has completed.
sIn | The stages to run. The first stage must be a Generator stage, the last must be a Sink stage, and intermediate stages are Transform stages.
|
Definition at line 108 of file pipeline.h.
void dispenso::pipeline | ( | ThreadPool & | pool, |
Stages &&... | sIn | ||
) |
Pipeline work in stages. Pipelines allow stages to specify parallelism limits by using the stage
function, or a function-like object can simply be passed directly, indicating a serial stage. Even if stages are serial, there can be parallelism between stages, so in a 3 stage serial pipeline, the expected runtime is the max of the 3 stages runtimes (note that this is in the absence of pipeline overheads and with an infinitely long workstream. In practice speedup is somewhat less). This function will block until the entire pipeline has completed.
pool | The ThreadPool to run the work in. This inherently determines the upper bound for parallelism of the pipeline. |
sIn | The stages to run. The first stage must be a Generator stage, the last must be a Sink stage, and intermediate stages are Transform stages.
|
Definition at line 77 of file pipeline.h.
auto dispenso::stage | ( | F && | f, |
ssize_t | limit | ||
) |
Create a stage for use in the pipeline function.
f | A function-like object that can accept the result of the previous stage (if any), and which produces the output for the next stage (if any). |
limit | How many threads may concurrently run work for this stage. Values larger than the number of threads in the associated thread pool of the used ConcurrentTaskSet will be capped to the size of the pool. |
Definition at line 48 of file pipeline.h.
|
constexpr |
A simple constant representing maximum parallelism for a stage. This number has no particular significance, and is simply here for convenience.
Definition at line 35 of file pipeline.h.