aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorErik Schnetter <schnetter@gmail.com>2012-08-08 16:49:28 -0400
committerErik Schnetter <schnetter@gmail.com>2012-08-08 16:49:28 -0400
commit9b03e2596f34e2ca9a2212c340b3e6fe1bf8468f (patch)
treedff3b2ab7a045d399f07c3e89e89fbe0b1857964
parent4ae061131c1da2a4a944a1139117cec0c4eac02e (diff)
Carpet: Move CCTK_INFO calls out of OpenMP parallel region
-rw-r--r--Carpet/Carpet/src/SetupGH.cc55
1 files changed, 27 insertions, 28 deletions
diff --git a/Carpet/Carpet/src/SetupGH.cc b/Carpet/Carpet/src/SetupGH.cc
index 6369c059d..95f30ec5d 100644
--- a/Carpet/Carpet/src/SetupGH.cc
+++ b/Carpet/Carpet/src/SetupGH.cc
@@ -494,41 +494,40 @@ namespace Carpet {
}
}
-#pragma omp parallel
for (int thread=0; thread<mynthreads; ++thread) {
+ vector<bool> mask(CPU_SETSIZE, false);
+ cpu_set_t cpumask;
+#pragma omp parallel
if (thread == dist::thread_num()) {
- vector<bool> mask(CPU_SETSIZE, false);
- cpu_set_t cpumask;
int const ierr = sched_getaffinity (0, sizeof cpumask, &cpumask);
assert (not ierr);
- for (int n=0; n<CPU_SETSIZE; ++n) {
- if (CPU_ISSET(n, &cpumask)) {
- mask.at(n) = true;
- }
+ }
+ for (int n=0; n<CPU_SETSIZE; ++n) {
+ if (CPU_ISSET(n, &cpumask)) {
+ mask.at(n) = true;
}
-
- ostringstream buf;
- int num_cores = 0;
- bool isfirst = true;
- int first_active = -1;
- for (int n=0; n<CPU_SETSIZE; ++n) {
- if (mask.at(n)) ++num_cores;
- if (first_active == -1 and mask.at(n)) {
- if (not isfirst) buf << ", ";
- isfirst = false;
- buf << n;
- first_active = n;
- } else if (first_active >= 0 and not mask.at(n)) {
- if (n-1 > first_active) buf << "-" << n-1;
- first_active = -1;
- }
+ }
+
+ ostringstream buf;
+ int num_cores = 0;
+ bool isfirst = true;
+ int first_active = -1;
+ for (int n=0; n<CPU_SETSIZE; ++n) {
+ if (mask.at(n)) ++num_cores;
+ if (first_active == -1 and mask.at(n)) {
+ if (not isfirst) buf << ", ";
+ isfirst = false;
+ buf << n;
+ first_active = n;
+ } else if (first_active >= 0 and not mask.at(n)) {
+ if (n-1 > first_active) buf << "-" << n-1;
+ first_active = -1;
}
- CCTK_VInfo (CCTK_THORNSTRING,
- "Thread %d runs on %d core%s: %s",
- thread,
- num_cores, num_cores==1 ? "" : "s", buf.str().c_str());
}
-#pragma omp barrier
+ CCTK_VInfo (CCTK_THORNSTRING,
+ "Thread %d runs on %d core%s: %s",
+ thread,
+ num_cores, num_cores==1 ? "" : "s", buf.str().c_str());
}
#else
CCTK_INFO ("Cannot determine core affinity");