From 203bfc2492ab15d79010443aa7321cc4fdd609df Mon Sep 17 00:00:00 2001 From: Balazs Gerofi Date: Thu, 21 Sep 2017 15:30:37 +0900 Subject: [PATCH] mcexec: limit nr. of threads for non-OpenMP partitioned execution --- executer/user/mcexec.c | 15 ++++++++++++++- 1 file changed, 14 insertions(+), 1 deletion(-) diff --git a/executer/user/mcexec.c b/executer/user/mcexec.c index 31942848..9cf96045 100644 --- a/executer/user/mcexec.c +++ b/executer/user/mcexec.c @@ -2158,7 +2158,20 @@ int main(int argc, char **argv) n_threads = atoi(getenv("OMP_NUM_THREADS")) + 4; } else { - n_threads = ncpu; + /* + * When running with partitioned execution, do not allow + * more threads then the corresponding number of CPUs. + */ + if (nr_processes > 0) { + n_threads = (ncpu / nr_processes) + 4; + + if (n_threads == 0) { + n_threads = 2; + } + } + else { + n_threads = ncpu; + } } /*