From 25e361f5a72f423fa12dcf00b0b79d14b9d9d22d Mon Sep 17 00:00:00 2001 From: Jim Edwards Date: Fri, 28 Oct 2016 06:31:13 -0600 Subject: [PATCH] add aprun fix for using less than full node of tasks --- utils/python/CIME/XML/env_mach_pes.py | 2 -- utils/python/CIME/XML/env_mach_specific.py | 6 ++++-- utils/python/CIME/case.py | 6 ++++++ 3 files changed, 10 insertions(+), 4 deletions(-) diff --git a/utils/python/CIME/XML/env_mach_pes.py b/utils/python/CIME/XML/env_mach_pes.py index f84fe03abe4..7a23f2cb6ac 100644 --- a/utils/python/CIME/XML/env_mach_pes.py +++ b/utils/python/CIME/XML/env_mach_pes.py @@ -95,8 +95,6 @@ def get_total_tasks(self, comp_classes): pstrid = self.get_value("PSTRID_%s"%comp) tt = rootpe + (ntasks - 1) * pstrid + 1 total_tasks = max(tt, total_tasks) - if total_tasks < self.get_value("PES_PER_NODE"): # all PEs fit in 1 node - self.set_value("PES_PER_NODE", total_tasks) return total_tasks def get_tasks_per_node(self, total_tasks, max_thread_count): diff --git a/utils/python/CIME/XML/env_mach_specific.py b/utils/python/CIME/XML/env_mach_specific.py index b04140111ac..817c294b248 100644 --- a/utils/python/CIME/XML/env_mach_specific.py +++ b/utils/python/CIME/XML/env_mach_specific.py @@ -409,7 +409,9 @@ def get_mpirun(self, case, attribs, check_members=None, job="case.run"): default=arg_node.get("default")) args[arg_node.get("name")] = arg_value - executable = self.get_node("executable", root=the_match) + exec_node = self.get_node("executable", root=the_match) + expect(exec_node is not None,"No executable found") + executable = exec_node.text - return executable.text, args + return executable, args diff --git a/utils/python/CIME/case.py b/utils/python/CIME/case.py index 30498762bbb..8e57fdf05e7 100644 --- a/utils/python/CIME/case.py +++ b/utils/python/CIME/case.py @@ -987,6 +987,12 @@ def get_mpirun_cmd(self, job="case.run"): } executable, args = env_mach_specific.get_mpirun(self, mpi_attribs, job=job) + # special case for aprun if using < 1 full node + if executable == "aprun": + totalpes = self.get_value("TOTALPES") + pes_per_node = self.get_value("PES_PER_NODE") + if totalpes < pes_per_node: + args["tasks_per_node"] = "-N "+str(totalpes) mpi_arg_string = " ".join(args.values())