Skip to content

Commit

Permalink
Merge pull request #376 from ESMCI/jgfouca/changes_from_acme
Browse files Browse the repository at this point in the history
Jgfouca/changes from acme
  • Loading branch information
jedwards4b authored Aug 10, 2016
2 parents c86398e + 38e2f8a commit 84122dd
Show file tree
Hide file tree
Showing 5 changed files with 75 additions and 37 deletions.
26 changes: 0 additions & 26 deletions scripts/Testing/Testcases/HOMME_script

This file was deleted.

62 changes: 62 additions & 0 deletions utils/python/CIME/SystemTests/homme.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
"""
CIME HOMME test. This class inherits from SystemTestsCommon
"""
from CIME.XML.standard_module_setup import *
from CIME.SystemTests.system_tests_common import SystemTestsCommon
from CIME.build import post_build

import shutil

logger = logging.getLogger(__name__)

class HOMME(SystemTestsCommon):

def __init__(self, case):
"""
initialize an object interface to the SMS system test
"""
SystemTestsCommon.__init__(self, case)

def build_phase(self, sharedlib_only=False, model_only=False):
if not sharedlib_only:
# Build HOMME
srcroot = self._case.get_value("SRCROOT")
mach = self._case.get_value("MACH")
procs = self._case.get_value("TOTALPES")
exeroot = self._case.get_value("EXEROOT")
baseline = self._case.get_value("CCSM_BASELINE")
basegen = self._case.get_value("BASEGEN_CASE")
basecmp = self._case.get_value("BASECMP_CASE")
generate = self._case.get_value("GENERATE_BASELINE")

basename = basegen if generate else basecmp
cmake_cmd = "cmake -C %s/components/homme/cmake/machineFiles/%s.cmake -DUSE_NUM_PROCS=%s %s/components/homme -DHOMME_BASELINE_DIR=%s/%s >& homme.bldlog" % (srcroot, mach, procs, srcroot, baseline, basename)

run_cmd_no_fail(cmake_cmd, from_dir=exeroot)
run_cmd_no_fail("make -j8 >> homme.bldlog 2>&1", from_dir=exeroot)

post_build(self._case, [os.path.join(exeroot, "homme.bldlog")])

def run_phase(self):

rundir = self._case.get_value("RUNDIR")
exeroot = self._case.get_value("EXEROOT")
baseline = self._case.get_value("CCSM_BASELINE")
compare = self._case.get_value("COMPARE_BASELINE")
generate = self._case.get_value("GENERATE_BASELINE")
basegen = self._case.get_value("BASEGEN_CASE")

log = os.path.join(rundir, "homme.log")
if os.path.exists(log):
os.remove(log)

if generate:
full_baseline_dir = os.path.join(baseline, basegen, "tests", "baseline")
run_cmd_no_fail("make -j 4 baseline >& %s" % log, from_dir=exeroot)
if os.path.isdir(full_baseline_dir):
shutil.rmtree(full_baseline_dir)
shutil.copytree(os.path.join(exeroot, "tests", "baseline"), full_baseline_dir)
elif compare:
run_cmd_no_fail("make -j 4 check >& %s" % log, from_dir=exeroot)
else:
run_cmd_no_fail("make -j 4 baseline >& %s" % log, from_dir=exeroot)
4 changes: 2 additions & 2 deletions utils/python/CIME/SystemTests/system_tests_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -431,8 +431,8 @@ def build_phase(self, sharedlib_only=False, model_only=False):
f.write(self._script)

os.chmod(modelexe, 0755)
self._case.set_value("BUILD_COMPLETE", True)
self._case.flush()

build.post_build(self._case, [])

def run_phase(self):
self.run_indv(suffix=None)
Expand Down
18 changes: 10 additions & 8 deletions utils/python/CIME/build.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,8 @@
logger = logging.getLogger(__name__)

def stringify_bool(val):
expect(type(val) is bool, "Wrong type")
val = False if val is None else val
expect(type(val) is bool, "Wrong type for val '%s'" % repr(val))
return "TRUE" if val else "FALSE"

###############################################################################
Expand Down Expand Up @@ -130,7 +131,8 @@ def post_build(case, logs):
# Set XML to indicate build complete
case.set_value("BUILD_COMPLETE", True)
case.set_value("BUILD_STATUS", 0)
case.set_value("SMP_BUILD", os.environ["SMP_VALUE"])
if "SMP_VALUE" in os.environ:
case.set_value("SMP_BUILD", os.environ["SMP_VALUE"])
case.flush()

if os.path.exists("LockedFiles/env_build.xml"):
Expand Down Expand Up @@ -231,10 +233,10 @@ def case_build(caseroot, case, sharedlib_only=False, model_only=False):
os.environ["CAM_CONFIG_OPTS"] = cam_config_opts if cam_config_opts is not None else ""
os.environ["PIO_CONFIG_OPTS"] = pio_config_opts if pio_config_opts is not None else ""
os.environ["OCN_SUBMODEL"] = ocn_submodel if ocn_submodel is not None else ""
os.environ["PROFILE_PAPI_ENABLE"] = stringify_bool(profile_papi_enable) if profile_papi_enable is not None else ""
os.environ["CLM_USE_PETSC"] = stringify_bool(clm_use_petsc) if clm_use_petsc is not None else ""
os.environ["CISM_USE_TRILINOS"] = stringify_bool(cism_use_trilinos) if cism_use_trilinos is not None else ""
os.environ["MPASLI_USE_ALBANY"] = stringify_bool(mpasli_use_albany) if mpasli_use_albany is not None else ""
os.environ["PROFILE_PAPI_ENABLE"] = stringify_bool(profile_papi_enable)
os.environ["CLM_USE_PETSC"] = stringify_bool(clm_use_petsc)
os.environ["CISM_USE_TRILINOS"] = stringify_bool(cism_use_trilinos)
os.environ["MPASLI_USE_ALBANY"] = stringify_bool(mpasli_use_albany)

# This is a timestamp for the build , not the same as the testid,
# and this case may not be a test anyway. For a production
Expand Down Expand Up @@ -268,9 +270,9 @@ def case_build(caseroot, case, sharedlib_only=False, model_only=False):
# the future there may be others -- so USE_ALBANY will be true if
# ANY of those are true.

use_albany = mpasli_use_albany
use_albany = stringify_bool(mpasli_use_albany)
case.set_value("USE_ALBANY", use_albany)
os.environ["USE_ALBANY"] = stringify_bool(use_albany)
os.environ["USE_ALBANY"] = use_albany

# Load modules
env_module = case.get_env("mach_specific")
Expand Down
2 changes: 1 addition & 1 deletion utils/python/update_acme_tests.py
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@
"HOMME_P24.f19_g16_rx1.A",
"NCK.f19_g16_rx1.A",
"SMS.ne30_f19_g16_rx1.A",
"ERS_Ld5.T62_oQU120.C_MPAS_NORMAL_YEAR",
"ERS_Ld5.T62_oQU120.CMPASO-NYF",
"ERS.f09_g16_g.MPASLI_ONLY",
"ERS_Ld5.ne16_ne16.FC5ATMMODCOSP",
"SMS.T62_oQU120_ais20.MPAS_LISIO_TEST",
Expand Down

0 comments on commit 84122dd

Please sign in to comment.