Skip to content

Commit

Permalink
Merge pull request #1385 from jedwards4b/aprun_fix
Browse files Browse the repository at this point in the history
return only aprun args and use executable from xml
  • Loading branch information
jgfouca authored Apr 20, 2017
2 parents 4fb16a1 + 1c5d0ce commit 6dd85dd
Show file tree
Hide file tree
Showing 2 changed files with 15 additions and 15 deletions.
22 changes: 11 additions & 11 deletions scripts/lib/CIME/aprun.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ def _get_aprun_cmd_for_case_impl(ntasks, nthreads, rootpes, pstrids,
>>> machine = "titan"
>>> run_exe = "acme.exe"
>>> _get_aprun_cmd_for_case_impl(ntasks, nthreads, rootpes, pstrids, max_tasks_per_node, pes_per_node, pio_numtasks, pio_async_interface, compiler, machine, run_exe)
('aprun -S 4 -n 680 -N 8 -d 2 acme.exe : -S 2 -n 128 -N 4 -d 4 acme.exe ', 117)
(' -S 4 -n 680 -N 8 -d 2 acme.exe : -S 2 -n 128 -N 4 -d 4 acme.exe ', 117)
>>> compiler = "intel"
>>> _get_aprun_cmd_for_case_impl(ntasks, nthreads, rootpes, pstrids, max_tasks_per_node, pes_per_node, pio_numtasks, pio_async_interface, compiler, machine, run_exe)
('aprun -S 4 -cc numa_node -n 680 -N 8 -d 2 acme.exe : -S 2 -cc numa_node -n 128 -N 4 -d 4 acme.exe ', 117)
(' -S 4 -cc numa_node -n 680 -N 8 -d 2 acme.exe : -S 2 -cc numa_node -n 128 -N 4 -d 4 acme.exe ', 117)
"""
max_tasks_per_node = 1 if max_tasks_per_node < 1 else max_tasks_per_node
Expand Down Expand Up @@ -64,8 +64,8 @@ def _get_aprun_cmd_for_case_impl(ntasks, nthreads, rootpes, pstrids,
maxt[c1] = 1

# Compute task and thread settings for batch commands
tasks_per_node, task_count, thread_count, max_thread_count, total_node_count, aprun = \
0, 1, maxt[0], maxt[0], 0, "aprun"
tasks_per_node, task_count, thread_count, max_thread_count, total_node_count, aprun_args = \
0, 1, maxt[0], maxt[0], 0, ""
for c1 in xrange(1, total_tasks):
if maxt[c1] != thread_count:
tasks_per_node = min(pes_per_node, max_tasks_per_node / thread_count)
Expand All @@ -76,11 +76,11 @@ def _get_aprun_cmd_for_case_impl(ntasks, nthreads, rootpes, pstrids,
task_per_numa = int(math.ceil(tasks_per_node / 2.0))
# Option for Titan
if machine == "titan" and tasks_per_node > 1:
aprun += " -S %d" % task_per_numa
aprun_args += " -S %d" % task_per_numa
if compiler == "intel":
aprun += " -cc numa_node"
aprun_args += " -cc numa_node"

aprun += " -n %d -N %d -d %d %s :" % (task_count, tasks_per_node, thread_count, run_exe)
aprun_args += " -n %d -N %d -d %d %s :" % (task_count, tasks_per_node, thread_count, run_exe)

node_count = int(math.ceil(float(task_count) / tasks_per_node))
total_node_count += node_count
Expand All @@ -105,13 +105,13 @@ def _get_aprun_cmd_for_case_impl(ntasks, nthreads, rootpes, pstrids,

# Special option for Titan with intel compiler
if machine == "titan" and tasks_per_node > 1:
aprun += " -S %d" % task_per_numa
aprun_args += " -S %d" % task_per_numa
if compiler == "intel":
aprun += " -cc numa_node"
aprun_args += " -cc numa_node"

aprun += " -n %d -N %d -d %d %s " % (task_count, tasks_per_node, thread_count, run_exe)
aprun_args += " -n %d -N %d -d %d %s " % (task_count, tasks_per_node, thread_count, run_exe)

return aprun, total_node_count
return aprun_args, total_node_count

###############################################################################
def get_aprun_cmd_for_case(case, run_exe):
Expand Down
8 changes: 4 additions & 4 deletions scripts/lib/CIME/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ def _initialize_derived_attributes(self):
}

executable = env_mach_spec.get_mpirun(self, mpi_attribs, job="case.run", exe_only=True)[0]
if executable == "aprun":
if "aprun" in executable:
self.num_nodes = get_aprun_cmd_for_case(self, "acme.exe")[1]
self.spare_nodes = env_mach_pes.get_spare_nodes(self.num_nodes)
self.num_nodes += self.spare_nodes
Expand Down Expand Up @@ -1119,10 +1119,10 @@ 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 executable == "aprun":
aprun_cmd, num_nodes = get_aprun_cmd_for_case(self, run_exe)
if "aprun" in executable:
aprun_args, num_nodes = get_aprun_cmd_for_case(self, run_exe)
expect(num_nodes == self.num_nodes, "Not using optimized num nodes")
return aprun_cmd + " " + run_misc_suffix
return executable + aprun_args + " " + run_misc_suffix
else:
mpi_arg_string = " ".join(args.values())

Expand Down

0 comments on commit 6dd85dd

Please sign in to comment.