From bcbbca0f42ba0799262864f033747f1c26942028 Mon Sep 17 00:00:00 2001 From: Erik Schnetter Date: Thu, 7 Jun 2012 17:20:59 -0500 Subject: Carpet: Update setting CPU affinity --- Carpet/Carpet/src/SetupGH.cc | 70 ++++++++++++++++++++++++++------------------ 1 file changed, 41 insertions(+), 29 deletions(-) diff --git a/Carpet/Carpet/src/SetupGH.cc b/Carpet/Carpet/src/SetupGH.cc index 25448abf1..c4515edb0 100644 --- a/Carpet/Carpet/src/SetupGH.cc +++ b/Carpet/Carpet/src/SetupGH.cc @@ -394,46 +394,58 @@ namespace Carpet { for (int n=0; n= mynthreads * num_host_procs) { - // It seems that all cores are available to all processes on - // this host. Split the cores evenly across the processes. - int skip_cores = 0; - for (int i=0; i= mynthreads * num_host_procs; + int my_host_index = 0; + if (other_procs_need_cores) { + // It seems that all cores are available to all processes + // on this host. Split the cores evenly across the + // processes. + for (int i=0; i= 0) { + int const num_cores_per_thread = num_cores / mynthreads; + // Choose cores for this process + int const first_core_index = + my_host_index * mynthreads * num_cores_per_thread; + vector available_cores; + for (int n=0; n