diff options
Diffstat (limited to 'Carpet/CarpetLib/src/dist.cc')
-rw-r--r-- | Carpet/CarpetLib/src/dist.cc | 18 |
1 files changed, 3 insertions, 15 deletions
diff --git a/Carpet/CarpetLib/src/dist.cc b/Carpet/CarpetLib/src/dist.cc index 1af4bcf38..7ac6f73f6 100644 --- a/Carpet/CarpetLib/src/dist.cc +++ b/Carpet/CarpetLib/src/dist.cc @@ -1,9 +1,9 @@ #include <cassert> +#include <mpi.h> #ifdef _OPENMP # include <omp.h> #endif -#include <mpi.h> #include "cctk.h" #include "cctk_Parameters.h" @@ -66,33 +66,21 @@ namespace dist { } } - // Local number of threads - int num_threads_worker () + // Set number of threads + void set_num_threads (int const num_threads) { - DECLARE_CCTK_PARAMETERS; - int num_threads_; #ifdef _OPENMP if (num_threads > 0) { // Set number of threads which should be used // TODO: do this at startup, not in this routine omp_set_num_threads (num_threads); } -#pragma omp parallel - { -#pragma omp single nowait - { - num_threads_ = omp_get_num_threads(); - } - } #else if (num_threads > 0 and num_threads != 1) { CCTK_WARN (CCTK_WARN_ABORT, "OpenMP is not enabled. Cannot set the number of threads."); } - num_threads_ = 1; #endif - assert (num_threads_ >= 1); - return num_threads_; } // Global number of threads |