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

TBB parallel execution policy. More...

#include <parallel_execution_tbb.h>

Public Member Functions

 parallel_execution_tbb () noexcept
 Default construct a TBB parallel execution policy. More...
 
 parallel_execution_tbb (int concurrency_degree, bool order=true) noexcept
 Constructs a TBB parallel execution policy. More...
 
void set_concurrency_degree (int degree) noexcept
 Set number of grppi threads. More...
 
int concurrency_degree () const noexcept
 Get number of grppi threads. More...
 
void enable_ordering () noexcept
 Enable ordering. More...
 
void disable_ordering () noexcept
 Disable ordering. More...
 
bool is_ordered () const noexcept
 Is execution ordered. More...
 
void set_queue_attributes (int size, queue_mode mode, int tokens) noexcept
 Sets the attributes for the queues built through make_queue<T>() More...
 
template<typename T >
mpmc_queue< T > make_queue () const
 Makes a communication queue for elements of type T. Constructs a queue using the attributes that can be set via set_queue_attributes(). The value is returned via move semantics. More...
 
int tokens () const noexcept
 
template<typename ... InputIterators, typename OutputIterator , typename Transformer >
void map (std::tuple< InputIterators... > firsts, OutputIterator first_out, std::size_t sequence_size, Transformer transform_op) const
 Applies a transformation to multiple sequences leaving the result in another sequence using available TBB parallelism. More...
 
template<typename InputIterator , typename Identity , typename Combiner >
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 >
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 >
void stencil (std::tuple< InputIterators... > firsts, OutputIterator first_out, std::size_t sequence_size, StencilTransformer &&transform_op, Neighbourhood &&neighbour_op) const
 Applies a transformation 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 md_divide-conquer. 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 md_divide-conquer. 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 coming from another context that uses mpmc_queues as communication channels. More...
 
template<typename Input , typename Transformer , typename Predicate , template< typename T, typename P > class Iteration, typename ... OtherTransformers, requires_iteration< Iteration< Transformer, Predicate >> , requires_pipeline< Transformer > >
auto make_filter (Iteration< Transformer, Predicate > &&, OtherTransformers &&...) const
 

Detailed Description

TBB parallel execution policy.

This policy uses Intel Threading Building Blocks as implementation back end.

Constructor & Destructor Documentation

◆ parallel_execution_tbb() [1/2]

grppi::parallel_execution_tbb::parallel_execution_tbb ( )
inlinenoexcept

Default construct a TBB parallel execution policy.

Creates a TBB parallel execution object.

The concurrency degree is determined by the platform.

◆ parallel_execution_tbb() [2/2]

grppi::parallel_execution_tbb::parallel_execution_tbb ( int  concurrency_degree,
bool  order = true 
)
inlinenoexcept

Constructs a TBB parallel execution policy.

Creates a TBB parallel execution object selecting the concurrency degree.

Parameters
concurrency_degreeNumber of threads used for parallel algorithms.
orderWhether ordered executions is enabled or disabled.

Member Function Documentation

◆ concurrency_degree()

int grppi::parallel_execution_tbb::concurrency_degree ( ) const
inlinenoexcept

Get number of grppi threads.

◆ disable_ordering()

void grppi::parallel_execution_tbb::disable_ordering ( )
inlinenoexcept

Disable ordering.

◆ divide_conquer() [1/2]

template<typename Input , typename Divider , typename Predicate , typename Solver , typename Combiner >
auto grppi::parallel_execution_tbb::divide_conquer ( Input &&  input,
Divider &&  divide_op,
Predicate &&  predicate_op,
Solver &&  solve_op,
Combiner &&  combine_op 
) const

Invoke md_divide-conquer.

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.

◆ divide_conquer() [2/2]

template<typename Input , typename Divider , typename Solver , typename Combiner >
auto grppi::parallel_execution_tbb::divide_conquer ( Input &&  input,
Divider &&  divide_op,
Solver &&  solve_op,
Combiner &&  combine_op 
) const

Invoke md_divide-conquer.

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.

◆ enable_ordering()

void grppi::parallel_execution_tbb::enable_ordering ( )
inlinenoexcept

Enable ordering.

◆ is_ordered()

bool grppi::parallel_execution_tbb::is_ordered ( ) const
inlinenoexcept

Is execution ordered.

◆ make_filter()

template<typename Input , typename Transformer , typename Predicate , template< typename T, typename P > class Iteration, typename ... OtherTransformers, requires_iteration< Iteration< Transformer, Predicate >> , requires_pipeline< Transformer > >
auto grppi::parallel_execution_tbb::make_filter ( Iteration< Transformer, Predicate > &&  ,
OtherTransformers &&  ... 
) const

◆ make_queue()

template<typename T >
mpmc_queue<T> grppi::parallel_execution_tbb::make_queue ( ) const
inline

Makes a communication queue for elements of type T. Constructs a queue using the attributes that can be set via set_queue_attributes(). The value is returned via move semantics.

◆ map()

template<typename ... InputIterators, typename OutputIterator , typename Transformer >
void grppi::parallel_execution_tbb::map ( std::tuple< InputIterators... >  firsts,
OutputIterator  first_out,
std::size_t  sequence_size,
Transformer  transform_op 
) const

Applies a transformation to multiple sequences leaving the result in another sequence using available TBB parallelism.

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.

◆ map_reduce()

template<typename ... InputIterators, typename Identity , typename Transformer , typename Combiner >
auto grppi::parallel_execution_tbb::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.

◆ pipeline() [1/2]

template<typename Generator , typename ... Transformers>
void grppi::parallel_execution_tbb::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.

◆ pipeline() [2/2]

template<typename InputType , typename Transformer , typename OutputType >
void grppi::parallel_execution_tbb::pipeline ( mpmc_queue< InputType > &  input_queue,
Transformer &&  transform_op,
mpmc_queue< OutputType > &  output_queue 
) const
inline

Invoke Pipeline pattern coming 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.

◆ reduce()

template<typename InputIterator , typename Identity , typename Combiner >
auto grppi::parallel_execution_tbb::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.

◆ set_concurrency_degree()

void grppi::parallel_execution_tbb::set_concurrency_degree ( int  degree)
inlinenoexcept

Set number of grppi threads.

◆ set_queue_attributes()

void grppi::parallel_execution_tbb::set_queue_attributes ( int  size,
queue_mode  mode,
int  tokens 
)
inlinenoexcept

Sets the attributes for the queues built through make_queue<T>()

◆ stencil()

template<typename ... InputIterators, typename OutputIterator , typename StencilTransformer , typename Neighbourhood >
void grppi::parallel_execution_tbb::stencil ( std::tuple< InputIterators... >  firsts,
OutputIterator  first_out,
std::size_t  sequence_size,
StencilTransformer &&  transform_op,
Neighbourhood &&  neighbour_op 
) const

Applies a transformation 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.

◆ tokens()

int grppi::parallel_execution_tbb::tokens ( ) const
inlinenoexcept

\brien Get num of tokens.


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