diff options
author | Roland Haas <rhaas@caltech.edu> | 2012-04-09 16:21:38 -0700 |
---|---|---|
committer | Barry Wardell <barry.wardell@gmail.com> | 2012-09-11 18:23:14 +0100 |
commit | 13b119ae15e14186fc7b5a72db8153d62bcc8d0e (patch) | |
tree | 1d7059d1179177da4549acf03f087fe2bdf43b0d /Carpet/CarpetLib/src/dist.cc | |
parent | ce2a2d08051a0a423761f986b33ec0b42bcae29a (diff) |
CarpetLib: store OpenMP thread number in dist object
Diffstat (limited to 'Carpet/CarpetLib/src/dist.cc')
-rw-r--r-- | Carpet/CarpetLib/src/dist.cc | 4 |
1 files changed, 4 insertions, 0 deletions
diff --git a/Carpet/CarpetLib/src/dist.cc b/Carpet/CarpetLib/src/dist.cc index d773d644e..ad0d46696 100644 --- a/Carpet/CarpetLib/src/dist.cc +++ b/Carpet/CarpetLib/src/dist.cc @@ -39,6 +39,7 @@ namespace dist { int num_threads_ = -1; int total_num_threads_ = -1; + int thread_num_ = -1; @@ -464,6 +465,7 @@ namespace dist { { num_threads_ = omp_get_num_threads(); } + thread_num_ = omp_get_thread_num(); } int const max_threads = omp_get_max_threads(); if (max_threads != num_threads_) { @@ -473,8 +475,10 @@ namespace dist { } #else num_threads_ = 1; + thread_num_ = 0; #endif assert (num_threads_ >= 1); + assert (thread_num_ >= 0 and thread_num_ < num_threads_); MPI_Allreduce (const_cast <int *> (& num_threads_), & total_num_threads_, 1, MPI_INT, |