diff --git a/Carpet/CarpetLib/src/dist.cc b/Carpet/CarpetLib/src/dist.cc index c870990..2e8edba 100644 --- a/Carpet/CarpetLib/src/dist.cc +++ b/Carpet/CarpetLib/src/dist.cc @@ -1,4 +1,5 @@ #include +#include #include #ifdef _OPENMP @@ -95,6 +96,11 @@ namespace dist { // Set number of threads which should be used // TODO: do this at startup, not in this routine omp_set_num_threads (num_threads); + } else if (num_threads == -2) { + if (not getenv ("OMP_NUM_THREADS")) { + // use only one thread of OMP_NUM_THREADS is not set + omp_set_num_threads (1); + } } #else if (num_threads > 0 and num_threads != 1) {