From 9b03e2596f34e2ca9a2212c340b3e6fe1bf8468f Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Wed, 8 Aug 2012 16:49:28 -0400 Subject: Carpet: Move CCTK_INFO calls out of OpenMP parallel region --- Carpet/Carpet/src/SetupGH.cc | 55 ++++++++++++++++++++++---------------------- 1 file 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 mask(CPU_SETSIZE, false); + cpu_set_t cpumask; +#pragma omp parallel if (thread == dist::thread_num()) { - vector 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= 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= 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"); -- cgit v1.2.3