问题
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