I have a C++ code performing some Armadillo computations in a loop. I'd like to parallelize this loop with OpenMP. But Armadillo automatically uses OpenMP for some computations. So, would the OpenMP parallelized loop cause an issue if I don't disable the automatic Armadillo parallelization ? Or can I safely use the parallelized loop without disabling that?
1 Answer
Nested used of OpenMP is allowed. However, by default the second level will only get a single thread. If that's ok with you, you're good now. If you want the embedded level to be parallel too, set the environment variable OMP_NESTED=true
or a function call omp_set_nested(1)
.
-
$\begingroup$ Thanks! Would you know where is it documented? $\endgroup$ Dec 22, 2020 at 15:52
-
$\begingroup$ The first hit if I google OMP_NESTED is openmp.org/spec-html/5.0/openmpse57.html $\endgroup$– Ian BushDec 23, 2020 at 9:50