GrPPI  0.3.1
Generic and Reusable Parallel Pattern Interface
Public Member Functions | List of all members
grppi::sequential_execution Class Reference

Sequential execution policy. More...

#include <sequential_execution.h>

Public Member Functions

constexpr sequential_execution () noexcept=default
 Default constructor. More...
 
constexpr void set_concurrency_degree (int n) const noexcept
 Set number of grppi threads. More...
 
constexpr int concurrency_degree () const noexcept
 Get number of grppi trheads. More...
 
constexpr void enable_ordering () const noexcept
 Enable ordering. More...
 
constexpr void disable_ordering () const noexcept
 Disable ordering. More...
 
constexpr bool is_ordered () const noexcept
 Is execution ordered. More...
 
template<typename... InputIterators, typename OutputIterator , typename Transformer >
constexpr void map (std::tuple< InputIterators... > firsts, OutputIterator first_out, std::size_t sequence_size, Transformer &&transform_op) const
 Applies a trasnformation to multiple sequences leaving the result in another sequence. More...
 
template<typename InputIterator , typename Identity , typename Combiner >
constexpr auto reduce (InputIterator first, std::size_t sequence_size, Identity &&identity, Combiner &&combine_op) const
 Applies a reduction to a sequence of data items. More...
 
template<typename... InputIterators, typename Identity , typename Transformer , typename Combiner >
constexpr auto map_reduce (std::tuple< InputIterators... > firsts, std::size_t sequence_size, Identity &&identity, Transformer &&transform_op, Combiner &&combine_op) const
 Applies a map/reduce operation to a sequence of data items. More...
 
template<typename... InputIterators, typename OutputIterator , typename StencilTransformer , typename Neighbourhood >
constexpr void stencil (std::tuple< InputIterators... > firsts, OutputIterator first_out, std::size_t sequence_size, StencilTransformer &&transform_op, Neighbourhood &&neighbour_op) const
 Applies a stencil to multiple sequences leaving the result in another sequence. More...
 
template<typename Input , typename Divider , typename Solver , typename Combiner >
auto divide_conquer (Input &&input, Divider &&divide_op, Solver &&solve_op, Combiner &&combine_op) const
 Invoke Divide/conquer pattern. More...
 
template<typename Input , typename Divider , typename Predicate , typename Solver , typename Combiner >
auto divide_conquer (Input &&input, Divider &&divide_op, Predicate &&predicate_op, Solver &&solve_op, Combiner &&combine_op) const
 Invoke Divide/conquer pattern. More...
 
template<typename Generator , typename... Transformers>
void pipeline (Generator &&generate_op, Transformers &&...transform_op) const
 Invoke Pipeline pattern. More...
 
template<typename InputType , typename Transformer , typename OutputType >
void pipeline (mpmc_queue< InputType > &input_queue, Transformer &&transform_op, mpmc_queue< OutputType > &output_queue) const
 Invoke Pipeline pattern comming from another context that uses mpmc_queues as communication channels. More...
 

Detailed Description

Sequential execution policy.

Constructor & Destructor Documentation

constexpr grppi::sequential_execution::sequential_execution ( )
defaultnoexcept

Default constructor.

Member Function Documentation

constexpr int grppi::sequential_execution::concurrency_degree ( ) const
inlinenoexcept

Get number of grppi trheads.

Note
Getting concurrency degree is always 1 for sequential execution.
constexpr void grppi::sequential_execution::disable_ordering ( ) const
inlinenoexcept

Disable ordering.

Note
Disabling ordering of sequential execution is always ignored.
template<typename Input , typename Divider , typename Solver , typename Combiner >
auto grppi::sequential_execution::divide_conquer ( Input &&  input,
Divider &&  divide_op,
Solver &&  solve_op,
Combiner &&  combine_op 
) const

Invoke Divide/conquer pattern.

Template Parameters
InputType used for the input problem.
DividerCallable type for the divider operation.
SolverCallable type for the solver operation.
CombinerCallable type for the combiner operation.
Parameters
exSequential execution policy object.
inputInput problem to be solved.
divider_opDivider operation.
solver_opSolver operation.
combine_opCombiner operation.
template<typename Input , typename Divider , typename Predicate , typename Solver , typename Combiner >
auto grppi::sequential_execution::divide_conquer ( Input &&  input,
Divider &&  divide_op,
Predicate &&  predicate_op,
Solver &&  solve_op,
Combiner &&  combine_op 
) const

Invoke Divide/conquer pattern.

Template Parameters
InputType used for the input problem.
DividerCallable type for the divider operation.
PredicateCallable type for the stop condition predicate.
SolverCallable type for the solver operation.
CombinerCallable type for the combiner operation.
Parameters
exSequential execution policy object.
inputInput problem to be solved.
divider_opDivider operation.
predicate_opPredicate operation.
solver_opSolver operation.
combine_opCombiner operation.
constexpr void grppi::sequential_execution::enable_ordering ( ) const
inlinenoexcept

Enable ordering.

Note
Enabling ordering of sequential execution is always ignored.
constexpr bool grppi::sequential_execution::is_ordered ( ) const
inlinenoexcept

Is execution ordered.

Note
Sequential execution is always ordered.
template<typename... InputIterators, typename OutputIterator , typename Transformer >
constexpr void grppi::sequential_execution::map ( std::tuple< InputIterators... >  firsts,
OutputIterator  first_out,
std::size_t  sequence_size,
Transformer &&  transform_op 
) const

Applies a trasnformation to multiple sequences leaving the result in another sequence.

Template Parameters
InputIteratorsIterator types for input sequences.
OutputIteratorIterator type for the output sequence.
TransformerCallable object type for the transformation.
Parameters
firstsTuple of iterators to input sequences.
first_outIterator to the output sequence.
sequence_sizeSize of the input sequences.
transform_opTransformation callable object.
Precondition
For every I iterators in the range [get<I>(firsts), next(get<I>(firsts),sequence_size)) are valid.
Iterators in the range [first_out, next(first_out,sequence_size)] are valid.
template<typename... InputIterators, typename Identity , typename Transformer , typename Combiner >
constexpr auto grppi::sequential_execution::map_reduce ( std::tuple< InputIterators... >  firsts,
std::size_t  sequence_size,
Identity &&  identity,
Transformer &&  transform_op,
Combiner &&  combine_op 
) const

Applies a map/reduce operation to a sequence of data items.

Template Parameters
InputIteratorIterator type for the input sequence.
IdentityType for the identity value.
TransformerCallable object type for the transformation.
CombinerCallable object type for the combination.
Parameters
firstIterator to the first element of the sequence.
sequence_sizeSize of the input sequence.
identityIdentity value for the reduction.
transform_opTransformation callable object.
combine_opCombination callable object.
Precondition
Iterators in the range [first,last) are valid.
Returns
The map/reduce result.
template<typename Generator , typename... Transformers>
void grppi::sequential_execution::pipeline ( Generator &&  generate_op,
Transformers &&...  transform_op 
) const

Invoke Pipeline pattern.

Template Parameters
GeneratorCallable type for the generator operation.
TransformersCallable types for the transformers in the pipeline.
Parameters
generate_opGenerator operation.
transform_opsTransformer operations.
template<typename InputType , typename Transformer , typename OutputType >
void grppi::sequential_execution::pipeline ( mpmc_queue< InputType > &  input_queue,
Transformer &&  transform_op,
mpmc_queue< OutputType > &  output_queue 
) const
inline

Invoke Pipeline pattern comming from another context that uses mpmc_queues as communication channels.

Template Parameters
InputTypeType of the input stream.
TransformersCallable types for the transformers in the pipeline.
InputTypeType of the output stream.
Parameters
input_queueInput stream communicator.
transform_opsTransformer operations.
output_queueInput stream communicator.
template<typename InputIterator , typename Identity , typename Combiner >
constexpr auto grppi::sequential_execution::reduce ( InputIterator  first,
std::size_t  sequence_size,
Identity &&  identity,
Combiner &&  combine_op 
) const

Applies a reduction to a sequence of data items.

Template Parameters
InputIteratorIterator type for the input sequence.
IdentityType for the identity value.
CombinerCallable object type for the combination.
Parameters
firstIterator to the first element of the sequence.
sequence_sizeSize of the input sequence.
lastIterator to one past the end of the sequence.
identityIdentity value for the reduction.
combine_opCombination callable object.
Precondition
Iterators in the range [first,last) are valid.
Returns
The reduction result
constexpr void grppi::sequential_execution::set_concurrency_degree ( int  n) const
inlinenoexcept

Set number of grppi threads.

Note
Setting concurrency degree is ignored for sequential execution.
template<typename... InputIterators, typename OutputIterator , typename StencilTransformer , typename Neighbourhood >
constexpr void grppi::sequential_execution::stencil ( std::tuple< InputIterators... >  firsts,
OutputIterator  first_out,
std::size_t  sequence_size,
StencilTransformer &&  transform_op,
Neighbourhood &&  neighbour_op 
) const

Applies a stencil to multiple sequences leaving the result in another sequence.

Template Parameters
InputIteratorsIterator types for input sequences.
OutputIteratorIterator type for the output sequence.
StencilTransformerCallable object type for the stencil transformation.
NeighbourhoodCallable object for generating neighbourhoods.
Parameters
firstsTuple of iterators to input sequences.
first_outIterator to the output sequence.
sequence_sizeSize of the input sequences.
transform_opStencil transformation callable object.
neighbour_opNeighbourhood callable object.
Precondition
For every I iterators in the range [get<I>(firsts), next(get<I>(firsts),sequence_size)) are valid.
Iterators in the range [first_out, next(first_out,sequence_size)] are valid.

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