2 ms·
#pragma omp parallel for
by gpderetta 6y ago
#pragma omp parallel for
- oblio 6y agoWhat's the operational cost of doing that?
- gpderetta 6y agoWhat do you mean exactly? You need a C/C++/fortran compiler that supports openmp, which is most of the mainstream ones (I believe MSVC still only support an older standard, still more than enough for parallel for). Compilers that do not support openmp are supposed to ignore the pragma and the code will still run fine (although serially) and be fully compatible. Other than that and possibly passing the correct command line flag, openmp is fairly low friction. A parallel for can provide significant speedup for embassingly parallel problems and these days it even support custom random access iterators in C++. Of course it is more involved to express less embarrassingly parallelizable problems, but it is still doable.