问题
I am using the Parallel Pattern Library. The class combinable plays the role of reduction clause in openMP, and enables to merge results from parallel calculations.
Does .combine(max()) exists (btw, could you point at some ref with allowed operations with combine, did not find that)?
Thanks and regards.
回答1:
Yes, you can pass std::max
to combineable::combine
, one thing you have to take into account when passing template functions as predicates is that you have to explicitly name the type:
combineable<T> max;
// .. do processing
max.combine(std::max<T>);
You can find all the official MSDN docs about combine
(and all the other PPL stuff) here.
来源:https://stackoverflow.com/questions/10365017/c-ppl-parallel-work-function-max-in-reduction-class-combinable