21 #ifndef GRPPI_TBB_REDUCE_H 22 #define GRPPI_TBB_REDUCE_H 52 template <
typename InputIt,
typename Identity,
typename Combiner>
54 InputIt first, InputIt last,
56 Combiner && combine_op)
58 auto identityVal = identity;
59 return tbb::parallel_reduce(tbb::blocked_range<InputIt>( first, last ), identityVal,
60 [&](
const tbb::blocked_range<InputIt> &r,
typename std::iterator_traits<InputIt>::value_type temp){
61 for(InputIt i=r.begin(); i!= r.end(); ++i){
62 temp = combine_op( temp, *i);
66 [&](
typename std::iterator_traits<InputIt>::value_type a,
typename std::iterator_traits<InputIt>::value_type b) ->
typename std::iterator_traits<InputIt>::value_type
Definition: callable_traits.h:24
TBB parallel execution policy.
Definition: parallel_execution_tbb.h:37
auto reduce(parallel_execution_native &ex, InputIt first, InputIt last, Identity identity, Combiner &&combine_op)
Invoke Reduce pattern with identity value on a data sequence with parallel native execution...
Definition: native/reduce.h:51