Skip to content

Commit

Permalink
NOAA-GFDL#98 fixes to build logic.
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicholas Hannah committed Jul 13, 2016
1 parent 5be6313 commit ab96165
Show file tree
Hide file tree
Showing 15 changed files with 1,563 additions and 380 deletions.
1,851 changes: 1,522 additions & 329 deletions ice_ocean_SIS2/Baltic/diag_table

Large diffs are not rendered by default.

6 changes: 3 additions & 3 deletions ice_ocean_SIS2/SIS2_bergs_cgrid/MOM_parameter_doc.layout
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ MASKTABLE = "MOM_mask_table" ! default = "MOM_mask_table"
! 4,6
! 1,2
! 3,6
NIPROC = 10 !
NIPROC = 8 !
! The number of processors in the x-direction. With
! STATIC_MEMORY_ this is set in MOM_memory.h at compile time.
NJPROC = 6 !
NJPROC = 16 !
! The number of processors in the x-direction. With
! STATIC_MEMORY_ this is set in MOM_memory.h at compile time.
LAYOUT = 10, 6 !
LAYOUT = 8, 16 !
! The processor layout that was acutally used.
IO_LAYOUT = 1, 1 ! default = 0
! The processor layout to be used, or 0,0 to automatically
Expand Down
4 changes: 2 additions & 2 deletions ice_ocean_SIS2/SIS2_bergs_cgrid/SIS_parameter_doc.layout
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ MASKTABLE = "MOM_mask_table" ! default = "MOM_mask_table"
! 4,6
! 1,2
! 3,6
NIPROC = 60 !
NIPROC = 128 !
! The number of processors in the x-direction. With
! STATIC_MEMORY_ this is set in SIS2_memory.h at compile time.
NJPROC = 1 !
! The number of processors in the x-direction. With
! STATIC_MEMORY_ this is set in SIS2_memory.h at compile time.
LAYOUT = 60, 1 !
LAYOUT = 128, 1 !
! The processor layout that was acutally used.
IO_LAYOUT = 1, 1 ! default = 0
! The processor layout to be used, or 0,0 to automatically
Expand Down
6 changes: 3 additions & 3 deletions ocean_only/benchmark/MOM_parameter_doc.layout
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ MASKTABLE = "MOM_mask_table" ! default = "MOM_mask_table"
! 4,6
! 1,2
! 3,6
NIPROC = 12 !
NIPROC = 16 !
! The number of processors in the x-direction. With
! STATIC_MEMORY_ this is set in MOM_memory.h at compile time.
NJPROC = 6 !
NJPROC = 8 !
! The number of processors in the x-direction. With
! STATIC_MEMORY_ this is set in MOM_memory.h at compile time.
LAYOUT = 12, 6 !
LAYOUT = 16, 8 !
! The processor layout that was acutally used.
IO_LAYOUT = 1, 1 ! default = 0
! The processor layout to be used, or 0,0 to automatically
Expand Down
2 changes: 1 addition & 1 deletion ocean_only/double_gyre/MOM_input
Original file line number Diff line number Diff line change
Expand Up @@ -342,7 +342,7 @@ DT_FORCING = 2400.0 ! [s] default = 1200.0
! The time step for changing forcing, coupling with other
! components, or potentially writing certain diagnostics.
! The default value is given by DT.
DAYMAX = 10.0 ! [days] default = 10.0
DAYMAX = 100.0 ! [days] default = 10.0
! The final time of the whole simulation, in units of
! TIMEUNIT seconds. This also sets the potential end
! time of the present run segment if the end time is
Expand Down
4 changes: 2 additions & 2 deletions ocean_only/double_gyre/MOM_parameter_doc.layout
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ MASKTABLE = "MOM_mask_table" ! default = "MOM_mask_table"
! 4,6
! 1,2
! 3,6
NIPROC = 2 !
NIPROC = 4 !
! The number of processors in the x-direction. With
! STATIC_MEMORY_ this is set in MOM_memory.h at compile time.
NJPROC = 4 !
! The number of processors in the x-direction. With
! STATIC_MEMORY_ this is set in MOM_memory.h at compile time.
LAYOUT = 2, 4 !
LAYOUT = 4, 4 !
! The processor layout that was acutally used.
IO_LAYOUT = 1, 1 ! default = 0
! The processor layout to be used, or 0,0 to automatically
Expand Down
2 changes: 1 addition & 1 deletion ocean_only/global_ALE/common/input.nml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@

&ocean_solo_nml
months = 0
days = 1
days = 10
date_init = 1,1,1,0,0,0
hours = 0
minutes = 0
Expand Down
6 changes: 3 additions & 3 deletions ocean_only/global_ALE/layer/MOM_parameter_doc.layout
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ MASKTABLE = "MOM_mask_table" ! default = "MOM_mask_table"
! 4,6
! 1,2
! 3,6
NIPROC = 8 !
NIPROC = 24 !
! The number of processors in the x-direction. With
! STATIC_MEMORY_ this is set in MOM_memory.h at compile time.
NJPROC = 8 !
NJPROC = 16 !
! The number of processors in the x-direction. With
! STATIC_MEMORY_ this is set in MOM_memory.h at compile time.
LAYOUT = 8, 8 !
LAYOUT = 24, 16 !
! The processor layout that was acutally used.
IO_LAYOUT = 1, 1 ! default = 0
! The processor layout to be used, or 0,0 to automatically
Expand Down
6 changes: 3 additions & 3 deletions ocean_only/global_ALE/z/MOM_parameter_doc.layout
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ MASKTABLE = "MOM_mask_table" ! default = "MOM_mask_table"
! 4,6
! 1,2
! 3,6
NIPROC = 8 !
NIPROC = 24 !
! The number of processors in the x-direction. With
! STATIC_MEMORY_ this is set in MOM_memory.h at compile time.
NJPROC = 8 !
NJPROC = 16 !
! The number of processors in the x-direction. With
! STATIC_MEMORY_ this is set in MOM_memory.h at compile time.
LAYOUT = 8, 8 !
LAYOUT = 24, 16 !
! The processor layout that was acutally used.
IO_LAYOUT = 1, 1 ! default = 0
! The processor layout to be used, or 0,0 to automatically
Expand Down
4 changes: 2 additions & 2 deletions ocean_only/nonBous_global/MOM_parameter_doc.layout
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ MASKTABLE = "MOM_mask_table" ! default = "MOM_mask_table"
! 4,6
! 1,2
! 3,6
NIPROC = 8 !
NIPROC = 4 !
! The number of processors in the x-direction. With
! STATIC_MEMORY_ this is set in MOM_memory.h at compile time.
NJPROC = 8 !
! The number of processors in the x-direction. With
! STATIC_MEMORY_ this is set in MOM_memory.h at compile time.
LAYOUT = 8, 8 !
LAYOUT = 4, 8 !
! The processor layout that was acutally used.
IO_LAYOUT = 1, 1 ! default = 0
! The processor layout to be used, or 0,0 to automatically
Expand Down
2 changes: 1 addition & 1 deletion ocean_only/resting/common/MOM_input
Original file line number Diff line number Diff line change
Expand Up @@ -431,7 +431,7 @@ MAXCPU = 2.88E+04 ! [wall-clock seconds] default = -1.0
! factor of the number of processors used.

! === module MOM_main (MOM_driver) ===
DAYMAX = 5.0 ! [days]
DAYMAX = 500.0 ! [days]
! The final time of the whole simulation, in units of
! TIMEUNIT seconds. This also sets the potential end
! time of the present run segment if the end time is
Expand Down
4 changes: 2 additions & 2 deletions ocean_only/resting/z/MOM_parameter_doc.layout
Original file line number Diff line number Diff line change
Expand Up @@ -44,13 +44,13 @@ MASKTABLE = "MOM_mask_table" ! default = "MOM_mask_table"
! 4,6
! 1,2
! 3,6
NIPROC = 2 !
NIPROC = 8 !
! The number of processors in the x-direction. With
! STATIC_MEMORY_ this is set in MOM_memory.h at compile time.
NJPROC = 1 !
! The number of processors in the x-direction. With
! STATIC_MEMORY_ this is set in MOM_memory.h at compile time.
LAYOUT = 2, 1 !
LAYOUT = 8, 1 !
! The processor layout that was acutally used.
IO_LAYOUT = 1, 1 ! default = 0
! The processor layout to be used, or 0,0 to automatically
Expand Down
2 changes: 1 addition & 1 deletion src/icebergs
32 changes: 9 additions & 23 deletions tools/tests/experiment.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,10 +92,7 @@ def __init__(self, id, compiler='gnu', build='repro', memory_type='dynamic'):
if self.variation is not None:
self.path = os.path.join(self.path, self.variation)

# Path to executable, may not exist yet.
rel_path = 'build/{}/{}/{}/MOM6'.format(self.compiler,
self.model_name, build)
self.exec_path = os.path.join(_mom_examples_path, rel_path)
self.exec_path = None

# Lists of available and unfinished diagnostics.
self.available_diags = self._parse_available_diags()
Expand All @@ -108,9 +105,8 @@ def __init__(self, id, compiler='gnu', build='repro', memory_type='dynamic'):
# It helps with testing and human readability if this is sorted.
self.available_diags.sort(key=lambda d: d.full_name)

# Whether this experiment has been built, run. Want to try to avoid
# Whether this experiment has been run. Want to try to avoid
# repeating this if possible.
self.has_built = False
self.has_run = False
# Another thing to avoid repeating.
self.has_dumped_diags = False
Expand All @@ -136,33 +132,22 @@ def _parse_available_diags(self):
diags.extend([Diagnostic(m, d, self.path) for m, d in matches])
return diags

def force_build_model(self):
"""
Do a clean build of the configuration.
"""

ret = self.model.build_shared(self.compiler, self.build)
if ret == 0:
ret = self.model.build_model(self.compiler, self.build,
self.memory_type)
if ret == 0:
self.has_built = True

return ret

def build_model(self):
"""
Build the configuration for this experiment.
"""
if not self.has_built:
return self.force_build_model()

if not self.exec_path:
ret, exe = self.model.build(self.compiler, self.build,
self.memory_type)
assert(ret == 0)
self.exec_path = exe

def run(self):
"""
Run the experiment if it hasn't already.
"""

self.build_model()
if not self.has_run:
return self.force_run()

Expand All @@ -171,6 +156,7 @@ def force_run(self):
Run the experiment.
"""

self.build_model()
assert(os.path.exists(self.exec_path))

ret = 0
Expand Down
12 changes: 8 additions & 4 deletions tools/tests/model.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,8 +51,11 @@ def __init__(self, name, mom_dir):
self.site = 'raijin'

def build(self, compiler, build, memory_type):
self.build_shared(compiler, build)
self.build_model(compiler, build, memory_type)
sret, shared_dir = self.build_shared(compiler, build)
mret, model_dir = self.build_model(compiler, build, memory_type)
exe = os.path.join(model_dir, 'MOM6')

return sret + mret, exe

def build_shared(self, compiler, build):
saved_path = os.getcwd()
Expand All @@ -75,7 +78,7 @@ def build_shared(self, compiler, build):
with open(os.path.join(shared_dir, 'build.out'), 'w') as f:
f.write(output)

return ret
return ret, shared_dir


def build_model(self, compiler='gnu', build='REPRO', memory_type='dynamic'):
Expand Down Expand Up @@ -113,4 +116,5 @@ def build_model(self, compiler='gnu', build='REPRO', memory_type='dynamic'):
with open(os.path.join(model_dir, 'build.out'), 'w') as f:
f.write(output)

return ret
return ret, model_dir

0 comments on commit ab96165

Please sign in to comment.