c++ PPL parallel work - function max() in reduction class 'combinable'

元气小坏坏 提交于 2019-12-13 01:28:34

问题


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

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!