Skip to content

Commit

Permalink
Merge pull request #967 from jedwards4b/pio_namelist_fix
Browse files Browse the repository at this point in the history
Pio namelist fix
  • Loading branch information
jedwards4b authored Jan 4, 2017
2 parents ebe3e43 + 6d493bc commit 2fff644
Show file tree
Hide file tree
Showing 7 changed files with 37 additions and 20 deletions.
4 changes: 3 additions & 1 deletion cime_config/cesm/machines/config_compilers.xml
Original file line number Diff line number Diff line change
Expand Up @@ -978,7 +978,9 @@ using a fortran linker.
<FFLAGS>
<append> -vec-report </append>
</FFLAGS>

<CMAKE_OPTS>
<append DEBUG="TRUE"> -DPIO_ENABLE_LOGGING=ON </append>
</CMAKE_OPTS>
</compiler>

<compiler MACH="yellowstone" COMPILER="gnu">
Expand Down
1 change: 1 addition & 0 deletions cime_config/cesm/machines/config_machines.xml
Original file line number Diff line number Diff line change
Expand Up @@ -956,6 +956,7 @@
</module_system>
<environment_variables>
<env name="OMP_STACKSIZE">256M</env>
<env name="MPI_TYPE_DEPTH">16</env>
</environment_variables>
</machine>

Expand Down
2 changes: 1 addition & 1 deletion share/csm_share/shr/shr_pio_mod.F90
Original file line number Diff line number Diff line change
Expand Up @@ -531,7 +531,7 @@ subroutine shr_pio_read_component_namelist(nlfilename, Comm, pio_stride, pio_roo
if(pio_root == -99) pio_root = pio_default_root
if(pio_rearranger == -99) pio_rearranger = pio_default_rearranger
if(pio_numiotasks == -99) then
pio_numiotasks = min(pio_default_numiotasks,npes/pio_stride)
pio_numiotasks = npes/pio_stride
endif
endif

Expand Down
1 change: 1 addition & 0 deletions utils/python/CIME/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -799,6 +799,7 @@ def _set_pio_xml(self):
compset = self.get_value("COMPSET")
mpilib = self.get_value("MPILIB")
defaults = pioobj.get_defaults(grid=grid,compset=compset,mach=mach,compiler=compiler, mpilib=mpilib)

for vid, value in defaults.items():
self.set_value(vid,value)

Expand Down
6 changes: 3 additions & 3 deletions utils/python/CIME/case_run.py
Original file line number Diff line number Diff line change
Expand Up @@ -177,9 +177,9 @@ def resubmit_check(case):
submit(case, job=job, resubmit=True)

###############################################################################
def do_data_assimilation(da_script, cycle, data_assimilation_cycles, lid):
def do_data_assimilation(da_script, caseroot, cycle, lid):
###############################################################################
cmd = da_script + " 1> da.log.%s %d %d 2>&1" %(lid, cycle, data_assimilation_cycles)
cmd = da_script + " 1> da.log.%s %d %d 2>&1" %(lid, caseroot, cycle)
logger.debug("running %s" %da_script)
run_cmd_no_fail(cmd)
# disposeLog(case, 'da', lid) THIS IS UNDEFINED!
Expand Down Expand Up @@ -218,7 +218,7 @@ def case_run(case):
get_timing(case, lid) # Run the getTiming script

if data_assimilation:
do_data_assimilation(data_assimilation_script, cycle, data_assimilation_cycles, lid)
do_data_assimilation(data_assimilation_script, case.get_value("CASEROOT"), cycle, lid)

save_postrun_provenance(case)

Expand Down
18 changes: 12 additions & 6 deletions utils/python/CIME/case_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -188,16 +188,11 @@ def _case_setup_impl(case, caseroot, clean=False, test_mode=False, reset=False):

expect(not (case.get_value("BUILD_THREADED") and compiler == "nag"),
"it is not possible to run with OpenMP if using the NAG Fortran compiler")


cost_pes = env_mach_pes.get_cost_pes(pestot, thread_count, machine=case.get_value("MACH"))
case.set_value("COST_PES", cost_pes)

# create batch file
# create batch files
logger.info("Creating batch script case.run")

# Use BatchFactory to get the appropriate instance of a BatchMaker,
# use it to create our batch scripts
env_batch = case.get_env("batch")
num_nodes = env_mach_pes.get_total_nodes(pestot, thread_count)
tasks_per_node = env_mach_pes.get_tasks_per_node(pestot, thread_count)
Expand All @@ -212,6 +207,17 @@ def _case_setup_impl(case, caseroot, clean=False, test_mode=False, reset=False):
elif job != "case.test":
logger.info("Writing %s script from input template %s" % (job, input_batch_script))
env_batch.make_batch_script(input_batch_script, job, case, pestot, tasks_per_node, num_nodes, thread_count)
# Make sure pio settings are consistant
for comp in models:
pio_stride = case.get_value("PIO_STRIDE_%s"%comp)
pio_numtasks = case.get_value("PIO_NUMTASKS_%s"%comp)
ntasks = case.get_value("NTASKS_%s"%comp)
if pio_stride < 0 or pio_stride > ntasks:
pio_stride = min(ntasks, tasks_per_node)
case.set_value("PIO_STRIDE_%s"%comp, pio_stride)
if pio_numtasks < 0 or pio_numtasks > ntasks:
pio_numtasks = max(1, ntasks//pio_stride)
case.set_value("PIO_NUMTASKS_%s"%comp, pio_numtasks)

# Make a copy of env_mach_pes.xml in order to be able
# to check that it does not change once case.setup is invoked
Expand Down
25 changes: 16 additions & 9 deletions utils/python/CIME/preview_namelists.py
Original file line number Diff line number Diff line change
Expand Up @@ -72,27 +72,34 @@ def create_namelists(case):
else:
compname = case.get_value("COMP_%s" % model_str.upper())
cmd = os.path.join(config_dir, "buildnml")
logger.info(" Calling %s buildnml"%compname)
do_run_cmd = False
try:
mod = imp.load_source("buildnml", cmd)
mod.buildnml(case, caseroot, compname)

except SyntaxError as detail:
with open(cmd, 'r') as f:
first_line = f.readline()
if "python" in first_line:
logger.info(" Calling %s buildnml"%compname)
mod = imp.load_source("buildnml", cmd)
mod.buildnml(case, caseroot, compname)
else:
raise SyntaxError
except SyntaxError as detail:
if 'python' in first_line:
expect(False, detail)
else:
run_cmd_no_fail("%s %s" % (cmd, caseroot), verbose=False)
do_run_cmd = True
except AttributeError:
run_cmd_no_fail("%s %s" % (cmd, caseroot), verbose=False)
do_run_cmd = True
except:
raise

if do_run_cmd:
logger.info(" Running %s buildnml"%compname)
case.flush()
run_cmd_no_fail("%s %s" % (cmd, caseroot), verbose=False)
# refresh case xml object from file
case.read_xml()
logger.info("Finished creating component namelists")

# refresh case xml object from file
case.read_xml()

# Save namelists to docdir
if (not os.path.isdir(docdir)):
Expand Down

0 comments on commit 2fff644

Please sign in to comment.