c++ ppl.h for parallel_for in linux [duplicate]

一曲冷凌霜 提交于 2021-01-29 14:33:20

问题


I made project in windows using c++ and now I am trying to build my project in linux(ubunt). However, I couldn't find ppl.h in linux. I used a lot of parallel_for in my project.

What is the replacement can I use?


回答1:


Parallel Patterns Library is Windows only. It is not useful for portable application, it is considered that OpenMP is best alternative for PPL. I.e. for the parallel for you can use following:

#ifdef _OPENMP
#pragma omp parallel for
#endif // _OPENMP
for(std::size_t i=0; i < foo; i++) {
  bar[i] = (baz[i] * quux[i]);
}

To enable OpenMP add -fopenmp flag for G++.

PS.

  • Microsoft VC++ OpenMP
  • Intel OpenMP
  • Clang OpenMP


来源:https://stackoverflow.com/questions/60753685/c-ppl-h-for-parallel-for-in-linux

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