3 ms·
OpenMP is still the fastest and easiest way to multithreading in C and C++. Got a for loop with no loop-carried dependencies? #pragma omp parallel for for(...
by robmccoll 12y ago
OpenMP is still the fastest and easiest way to multithreading in C and C++. Got a for loop with no loop-carried dependencies?
#pragma omp parallel for
for(...)
The Wikipedia page isn't a bad starting point: http://en.m.wikipedia.org/wiki/OpenMP http://en.m.wikipedia.org/wiki/OpenMP
- SoapSeller 12y agoOpenMP is terrible. While you can argue whether introducing pragmas as control structure is a good idea or not, the performance issues with high load(>80% total cpu) and the caveats(two OpenMP versions in same app, multiple threads running OpenMP paralleled code & etc) are just not worth it. TBB[0] is much better option(especially with C++11, where you can use lambdas to warp your to-be-paralleled-code and don't have to put it elsewhere), and you get all sort of goodies with it(e.g. thread-safe-containers). [0] https://www.threadingbuildingblocks.org/ https://www.threadingbuildingblocks.org/
- TillE 12y agoI've had no trouble using OpenMP (with Visual C++ and GCC), though I admit I haven't rigorously benchmarked it compared to other solutions. As far as I know, it's just syntactic sugar over a pretty simple thread pool model. What are the performance issues at high load?
- goalieca 12y agoMany years ago I had benchmarked openmp in comparison to other frameworks. IT was very easy but poorly performing.