aboutsummaryrefslogtreecommitdiff
path: root/Carpet/Carpet/src/SetupGH.cc
diff options
context:
space:
mode:
authorRoland Haas <rhaas@caltech.edu>2012-04-09 16:22:00 -0700
committerBarry Wardell <barry.wardell@gmail.com>2012-09-11 18:23:14 +0100
commit88275a3e018f803b833594fa33d43696d54a9a1b (patch)
tree63177b83e5f8dbc050820248704aea8eb99cb3f3 /Carpet/Carpet/src/SetupGH.cc
parent13b119ae15e14186fc7b5a72db8153d62bcc8d0e (diff)
Carpet: get thread number from CarpetLib's dist object
Diffstat (limited to 'Carpet/Carpet/src/SetupGH.cc')
-rw-r--r--Carpet/Carpet/src/SetupGH.cc5
1 files changed, 3 insertions, 2 deletions
diff --git a/Carpet/Carpet/src/SetupGH.cc b/Carpet/Carpet/src/SetupGH.cc
index da68b3162..d0a2bf375 100644
--- a/Carpet/Carpet/src/SetupGH.cc
+++ b/Carpet/Carpet/src/SetupGH.cc
@@ -200,6 +200,7 @@ namespace Carpet {
dist::set_num_threads (num_threads);
int const mynthreads = dist::num_threads();
int const nthreads_total = dist::total_num_threads();
+ int const mythreadnum = dist::thread_num();
char const * const CACTUS_NUM_PROCS = getenv ("CACTUS_NUM_PROCS");
int const cactus_num_procs =
CACTUS_NUM_PROCS ? atoi (CACTUS_NUM_PROCS) : 0;
@@ -241,7 +242,7 @@ namespace Carpet {
"Although OpenMP is enabled, neither the environment variable OMP_NUM_THREADS nor the parameter Carpet::num_threads are set. A system-specific default value is used instead.");
}
CCTK_VInfo (CCTK_THORNSTRING,
- "This process contains %d threads", mynthreads);
+ "This process contains %d threads, this is thread %d", mynthreads, mythreadnum);
if (not CACTUS_NUM_THREADS) {
CCTK_VWarn (CCTK_WARN_COMPLAIN, __LINE__, __FILE__, CCTK_THORNSTRING,
"Although OpenMP is enabled, the environment variable CACTUS_NUM_THREADS is not set.");
@@ -356,7 +357,7 @@ namespace Carpet {
{
cpu_set_t cpumask;
CPU_ZERO(&cpumask);
- CPU_SET(n0 + omp_get_thread_num(), &cpumask);
+ CPU_SET(n0 + mythreadnum, &cpumask);
int const ierr = sched_setaffinity(0, sizeof(cpumask), &cpumask);
assert (not ierr);
}