# Can one safely use an OpenMP parallel loop with Armadillo?

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?

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).