21 #ifndef GRPPI_TBB_MAPREDUCE_H 22 #define GRPPI_TBB_MAPREDUCE_H 55 template <
typename InputIt,
typename Transformer,
typename Identity,
typename Combiner>
61 Identity out = identity;
63 int numElements = last - first;
67 auto begin = first + (elemperthr * i);
68 auto end = first + (elemperthr * (i+1));
72 partialOuts[i] =
map_reduce(s, begin, end, partialOuts[i], std::forward<Transformer>(transform_op), std::forward<Combiner>(combine_op));
78 partialOuts[0] =
map_reduce(s, first, (first+elemperthr), partialOuts[0], std::forward<Transformer>(transform_op), std::forward<Combiner>(combine_op));
81 for(
auto & res : partialOuts){
82 out = combine_op(out, res);
Definition: callable_traits.h:24
Result map_reduce(parallel_execution_native &ex, InputIt first, InputIt last, Result identity, Transformer &&transform_op, Combiner &&combine_op)
Invoke Map/reduce pattern on a data sequence with native parallel execution.
Definition: native/mapreduce.h:53
TBB parallel execution policy.
Definition: parallel_execution_tbb.h:37
int concurrency_degree() const noexcept
Get number of grppi trheads.
Definition: parallel_execution_tbb.h:73
Sequential execution policy.
Definition: sequential_execution.h:31