Skip to content

Commit

Permalink
merge to master
Browse files Browse the repository at this point in the history
  • Loading branch information
jedwards4b committed Aug 31, 2016
2 parents 2df47af + ea7c23a commit 35e2094
Show file tree
Hide file tree
Showing 15 changed files with 246 additions and 224 deletions.
6 changes: 6 additions & 0 deletions cime_config/config_tests.xml
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ LII CLM initial condition interpolation test
<STOP_N>22</STOP_N>
<CCSM_TCOST>0</CCSM_TCOST>
<DOUT_S>FALSE</DOUT_S>
<BUILD_THREADED>TRUE</BUILD_THREADED>
</test>

<test NAME="ERP">
Expand All @@ -179,6 +180,7 @@ LII CLM initial condition interpolation test
<STOP_OPTION>ndays</STOP_OPTION>
<STOP_N>11</STOP_N>
<DOUT_S>FALSE</DOUT_S>
<BUILD_THREADED>TRUE</BUILD_THREADED>
</test>

<test NAME="ERS">
Expand Down Expand Up @@ -393,6 +395,10 @@ LII CLM initial condition interpolation test
<INFO_DBUG>1</INFO_DBUG>
<CCSM_TCOST>-1</CCSM_TCOST>
<DOUT_S>FALSE</DOUT_S>
<CONTINUE_RUN>FALSE</CONTINUE_RUN>
<REST_OPTION>none</REST_OPTION>
<HIST_OPTION>$STOP_OPTION</HIST_OPTION>
<HIST_N>$STOP_N</HIST_N>
</test>

<test NAME="NCR">
Expand Down
12 changes: 11 additions & 1 deletion driver_cpl/cime_config/config_component.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2956,12 +2956,22 @@

<entry id="CCSM_CPRNC">
<type>char</type>
<default_value>/UNSET</default_value>
<default_value>UNSET</default_value>
<group>test</group>
<file>env_test.xml</file>
<desc>standard full pathname of the cprnc executable</desc>
</entry>

<entry id="USER_MODS_FULLPATH">
<type>char</type>
<default_value>UNSET</default_value>
<group>user_mods</group>
<file>env_case.xml</file>
<desc>path to user mods under TESTS_MODS_DIR or USER_MODS_DIR</desc>
</entry>



<!-- ===================================================================== -->
<!-- component coupling options and frequencies -->
<!-- ===================================================================== -->
Expand Down
13 changes: 10 additions & 3 deletions scripts/Tools/component_generate_baseline
Original file line number Diff line number Diff line change
Expand Up @@ -35,18 +35,25 @@ OR
parser.add_argument("-b", "--baseline-dir",
help="Use custom baseline dir")

parser.add_argument("-o", "--allow-baseline-overwrite", action="store_true",
help="By default an attempt to overwrite an existing baseline directory "
"will raise an error. Specifying this option allows "
"existing baseline directories to be silently overwritten.")

args = parser.parse_args(args[1:])

CIME.utils.handle_standard_logging_options(args)

return args.caseroot, args.baseline_dir
return args.caseroot, args.baseline_dir, args.allow_baseline_overwrite

###############################################################################
def _main_func(description):
###############################################################################
caseroot, baseline_dir = parse_command_line(sys.argv, description)
caseroot, baseline_dir, allow_baseline_overwrite = \
parse_command_line(sys.argv, description)
with Case(caseroot) as case:
success, comments = generate_baseline(case, baseline_dir)
success, comments = generate_baseline(case, baseline_dir,
allow_baseline_overwrite)
print comments

sys.exit(0 if success else 1)
Expand Down
2 changes: 1 addition & 1 deletion scripts/create_test
Original file line number Diff line number Diff line change
Expand Up @@ -257,7 +257,7 @@ OR
args.no_batch = True

if args.test_id is None:
args.test_id = CIME.utils.get_utc_timestamp()
args.test_id = CIME.utils.get_timestamp()

if args.testfile is not None:
with open(args.testfile, "r") as fd:
Expand Down
157 changes: 42 additions & 115 deletions utils/python/CIME/SystemTests/nck.py
Original file line number Diff line number Diff line change
@@ -1,126 +1,53 @@
"""
Implementation of the CIME NCK test. This class inherits from SystemTestsCommon
Implementation of the CIME NCK test: Tests multi-instance
This does two runs: In the first, we use one instance per component; in the
second, we use two instances per components. NTASKS are changed in each run so
that the number of tasks per instance is the same for both runs.
Build two exectuables for this test, the first is a default build the
second halves the number of tasks and runs two instances for each component
Lay all of the components out sequentially
"""
import shutil

from CIME.XML.standard_module_setup import *
from CIME.SystemTests.system_tests_compare_two import SystemTestsCompareTwo
from CIME.case_setup import case_setup
import CIME.utils
from CIME.SystemTests.system_tests_common import SystemTestsCommon

logger = logging.getLogger(__name__)

class NCK(SystemTestsCommon):
class NCK(SystemTestsCompareTwo):

def __init__(self, case):
"""
initialize a test object
"""
SystemTestsCommon.__init__(self, case)

def build_phase(self, sharedlib_only=False, model_only=False):
'''
build can be called once (sharedlib_only and model_only both False)
or twice (once with each true)
This test requires a sharedlib build for both phases
we must handle both cases correctly
'''
exeroot = self._case.get_value("EXEROOT")
cime_model = CIME.utils.get_model()
if not model_only:
machpes1 = os.path.join("LockedFiles","env_mach_pes.orig.xml")
if os.path.isfile(machpes1):
shutil.copy(machpes1,"env_mach_pes.xml")
else:
shutil.copy("env_mach_pes.xml", machpes1)

# Build two exectuables for this test, the first is a default build, the
# second halves the number of tasks and runs two instances for each component
# Lay all of the components out sequentially
for bld in range(1,3):
logging.warn("Starting bld %s"%bld)
machpes = os.path.join("LockedFiles","env_mach_pes.NCK%s.xml"%bld)
if model_only:
# This file should have been created in the sharedlib_only phase
shutil.copy(machpes,"env_mach_pes.xml")
self._case.read_xml()
else:
for comp in ['ATM','OCN','WAV','GLC','ICE','ROF','LND']:
self._case.set_value("NINST_%s"%comp, bld)
ntasks = self._case.get_value("NTASKS_%s"%comp)
if(bld == 1):
if ( ntasks > 1 ):
self._case.set_value("NTASKS_%s"%comp, int(ntasks/2))
else:
self._case.set_value("NTASKS_%s"%comp, ntasks*2)
self._case.flush()

case_setup(self._case, test_mode=True, reset=True)
if not sharedlib_only:
self.clean_build()

self.build_indv(sharedlib_only=sharedlib_only, model_only=model_only)
if not model_only:
shutil.copy("env_mach_pes.xml", machpes)
if not sharedlib_only:
shutil.move("%s/%s.exe"%(exeroot,cime_model),"%s/%s.exe.NCK%s"%(exeroot,cime_model,bld))
shutil.copy("env_build.xml",os.path.join("LockedFiles","env_build.NCK%s.xml"%bld))

# Because mira/cetus interprets its run script differently than
# other systems we need to copy the original env_mach_pes.xml back
# shutil.copy(machpes1,"env_mach_pes.xml")
# shutil.copy("env_mach_pes.xml",
# os.path.join("LockedFiles","env_mach_pes.xml"))

def run_phase(self):
os.chdir(self._caseroot)

exeroot = self._case.get_value("EXEROOT")
cime_model = CIME.utils.get_model()

# Reset beginning test settings
expect(os.path.exists("LockedFiles/env_mach_pes.NCK1.xml"),
"ERROR: LockedFiles/env_mach_pes.NCK1.xml does not exist\n"
" this would been produced in the build - must run case.test_build")

shutil.copy("LockedFiles/env_mach_pes.NCK1.xml", "env_mach_pes.xml")
shutil.copy("env_mach_pes.xml", "LockedFiles/env_mach_pes.xml")
shutil.copy("%s/%s.exe.NCK1" % (exeroot, cime_model),
"%s/%s.exe" % (exeroot, cime_model))
shutil.copy("LockedFiles/env_build.NCK1.xml", "env_build.xml")
shutil.copy("env_build.xml", "LockedFiles/env_build.xml")

stop_n = self._case.get_value("STOP_N")
stop_option = self._case.get_value("STOP_OPTION")

self._case.set_value("HIST_N", stop_n)
self._case.set_value("HIST_OPTION", stop_option)
self._case.set_value("CONTINUE_RUN", False)
self._case.set_value("REST_OPTION", "none")
self._case.flush()

#======================================================================
# do an initial run test with NINST 1
#======================================================================
logger.info("default: doing a %s %s with NINST1" % (stop_n, stop_option))
self.run_indv()

#======================================================================
# do an initial run test with NINST 2
# want to run on same pe counts per instance and same cpl pe count
#======================================================================

os.remove("%s/%s.exe" % (exeroot, cime_model))
shutil.copy("%s/%s.exe.NCK2" % (exeroot, cime_model),
"%s/%s.exe" % (exeroot, cime_model))
shutil.copy("LockedFiles/env_build.NCK2.xml", "env_build.xml")
shutil.copy("env_build.xml", "LockedFiles/env_build.xml")
shutil.copy("LockedFiles/env_mach_pes.NCK2.xml", "env_mach_pes.xml")
shutil.copy("env_mach_pes.xml", "LockedFiles/env_mach_pes.xml")

logger.info("default: doing a %s %s with NINST2" % (stop_n, stop_option))
self.run_indv(suffix="multiinst")
self._component_compare_test("base", "multiinst")
self._comp_classes = []
SystemTestsCompareTwo.__init__(self, case,
separate_builds = True,
run_two_suffix = 'multiinst',
run_one_description = 'one instance',
run_two_description = 'two instances')

def _common_setup(self):
# We start by halving the number of tasks for both cases. This ensures
# that we use the same number of tasks per instance in both cases: For
# the two-instance case, we'll double this halved number, so you may
# think that the halving was unnecessary; but it's needed in case the
# original NTASKS was odd. (e.g., for NTASKS originally 15, we want to
# use NTASKS = int(15/2) * 2 = 14 tasks for case two.)
self._comp_classes = self._case.get_value("COMP_CLASSES").split(',')
self._comp_classes.remove("DRV")
for comp in self._comp_classes:
ntasks = self._case.get_value("NTASKS_%s"%comp)
if ( ntasks > 1 ):
self._case.set_value("NTASKS_%s"%comp, int(ntasks/2))

def _case_one_setup(self):
for comp in self._comp_classes:
self._case.set_value("NINST_%s"%comp, 1)

case_setup(self._case, test_mode=True, reset=True)

def _case_two_setup(self):
for comp in self._comp_classes:
self._case.set_value("NINST_%s"%comp, 2)
ntasks = self._case.get_value("NTASKS_%s"%comp)
self._case.set_value("NTASKS_%s"%comp, ntasks*2)

case_setup(self._case, test_mode=True, reset=True)
9 changes: 0 additions & 9 deletions utils/python/CIME/SystemTests/system_tests_common.py
Original file line number Diff line number Diff line change
Expand Up @@ -152,9 +152,6 @@ def run(self):
logger.warning(excmsg)
append_status(excmsg, sfile="TestStatus.log")

# Always try to report, should NOT throw an exception
self.report()

# Writing the run status should be the very last thing due to wait_for_tests
time_taken = time.time() - start_time
status = TEST_PASS_STATUS if success else TEST_FAIL_STATUS
Expand Down Expand Up @@ -225,12 +222,6 @@ def _coupler_log_indicates_run_complete(self):
logger.info("%s is not compressed, assuming run failed"%newestcpllogfile)
return False

def report(self):
"""
Please explain what kind of things happen in report
"""
pass

def _component_compare_move(self, suffix):
comments = move(self._case, suffix)
append_status(comments, sfile="TestStatus.log")
Expand Down
2 changes: 1 addition & 1 deletion utils/python/CIME/XML/pes.py
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ def find_pes_layout(self, grid, compset, machine, pesize_opts='M'):
pes_ntasks, pes_nthrds, pes_rootpe, other_settings = {}, {}, {}, {}
for node in pe_select:
vid = node.tag
logger.warn("vid is %s"%vid)
logger.debug("vid is %s"%vid)
if "ntasks" in vid:
for child in node:
pes_ntasks[child.tag.upper()] = child.text
Expand Down
25 changes: 13 additions & 12 deletions utils/python/CIME/case.py
Original file line number Diff line number Diff line change
Expand Up @@ -321,37 +321,37 @@ def _set_compset_and_pesfile(self, compset_name, user_compset=False, pesfile=Non

# Determine the compsets file for this component
compsets_filename = files.get_value("COMPSETS_SPEC_FILE", {"component":component})
pes_filename = files.get_value("PES_SPEC_FILE" , {"component":component})
tests_filename = files.get_value("TESTS_SPEC_FILE" , {"component":component}, resolved=False)
tests_mods_dir = files.get_value("TESTS_MODS_DIR" , {"component":component}, resolved=False)
user_mods_dir = files.get_value("USER_MODS_DIR" , {"component":component}, resolved=False)

# If the file exists, read it and see if there is a match for the compset alias or longname
if (os.path.isfile(compsets_filename)):
compsets = Compsets(compsets_filename)
match = compsets.get_compset_match(name=compset_name)
pesfile = files.get_value("PES_SPEC_FILE" , {"component":component})
if match is not None:
self._pesfile = pes_filename
self._pesfile = pesfile
self._compsetsfile = compsets_filename
self._compsetname = match
self.set_value("COMPSETS_SPEC_FILE" ,
tests_filename = files.get_value("TESTS_SPEC_FILE" , {"component":component}, resolved=False)
tests_mods_dir = files.get_value("TESTS_MODS_DIR" , {"component":component}, resolved=False)
user_mods_dir = files.get_value("USER_MODS_DIR" , {"component":component}, resolved=False)
self.set_lookup_value("COMPSETS_SPEC_FILE" ,
files.get_value("COMPSETS_SPEC_FILE", {"component":component}, resolved=False))
self.set_value("TESTS_SPEC_FILE" , tests_filename)
self.set_value("TESTS_MODS_DIR" , tests_mods_dir)
self.set_value("USER_MODS_DIR" , user_mods_dir)
self.set_value("PES_SPEC_FILE" ,
self.set_lookup_value("TESTS_SPEC_FILE" , tests_filename)
self.set_lookup_value("TESTS_MODS_DIR" , tests_mods_dir)
self.set_lookup_value("USER_MODS_DIR" , user_mods_dir)
self.set_lookup_value("PES_SPEC_FILE" ,
files.get_value("PES_SPEC_FILE" , {"component":component}, resolved=False))
logger.info("Compset longname is %s " %(match))
logger.info("Compset specification file is %s" %(compsets_filename))
logger.info("Pes specification file is %s" %(pes_filename))
logger.info("Pes specification file is %s" %(pesfile))
return

if user_compset is True:
#Do not error out for user_compset
logger.warn("Could not find a compset match for either alias or longname in %s" %(compset_name))
self._compsetname = compset_name
self._pesfile = pesfile
self.set_value("PES_SPEC_FILE", pesfile)
self.set_lookup_value("PES_SPEC_FILE", pesfile)
else:
expect(False,
"Could not find a compset match for either alias or longname in %s" %(compset_name))
Expand Down Expand Up @@ -821,6 +821,7 @@ def apply_user_mods(self, user_mods_dir=None):
else:
user_mods_path = self.get_value('USER_MODS_DIR')
user_mods_path = os.path.join(user_mods_path, user_mods_dir)
self.set_value("USER_MODS_FULLPATH",user_mods_path)
ninst_vals = {}
for i in xrange(1,len(self._component_classes)):
comp_class = self._component_classes[i]
Expand Down
17 changes: 2 additions & 15 deletions utils/python/CIME/case_run.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@

from CIME.XML.standard_module_setup import *
from CIME.case_submit import submit
from CIME.XML.files import Files
from CIME.XML.component import Component
from CIME.XML.machines import Machines
from CIME.utils import append_status, touch, gzip_existing_file
from CIME.check_lockedfiles import check_lockedfiles
Expand Down Expand Up @@ -329,19 +327,8 @@ def save_logs(case, lid):

caseroot = case.get_value("CASEROOT")
rundir = case.get_value("RUNDIR")

# get components
files = Files()
config_file = files.get_value("CONFIG_DRV_FILE")
component = Component(config_file)
comps = [x.lower() for x in component.get_valid_model_components()]
comps = [x.replace('drv', 'cpl') for x in comps]
model = [case.get_value("MODEL")]
comps = comps + model

# for each component, compress log files and copy to logdir
for comp in comps:
logfile = os.path.join(rundir, comp + '.log.' + lid)
logfiles = glob.glob(os.path.join(rundir,"*.log.%s"%(lid)))
for logfile in logfiles:
if os.path.isfile(logfile):
logfile_gz = gzip_existing_file(logfile)
shutil.copy(logfile_gz,
Expand Down
6 changes: 5 additions & 1 deletion utils/python/CIME/case_setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -258,12 +258,16 @@ def _case_setup_impl(case, caseroot, casebaseid, clean=False, test_mode=False, r

_build_usernl_files(case, "drv", "cpl")

if case.get_value("TEST"):
user_mods_path = case.get_value("USER_MODS_USE_CASE")
if user_mods_path is not None:
apply_user_mods(caseroot, user_mods_path=user_mods_path, ninst=ninst)
elif case.get_value("TEST"):
test_mods = parse_test_name(casebaseid)[6]
if test_mods is not None:
user_mods_path = os.path.join(case.get_value("TESTS_MODS_DIR"), test_mods)
apply_user_mods(caseroot, user_mods_path=user_mods_path, ninst=ninst)


# Run preview namelists for scripts
logger.info("preview_namelists")
preview_namelists(case)
Expand Down
Loading

0 comments on commit 35e2094

Please sign in to comment.