Skip to content

Commit

Permalink
Rewrite PET using the new SystemTestsCompareTwo infrastructure
Browse files Browse the repository at this point in the history
Test suite: None
Test baseline: N/A
Test namelist changes: N/A
Test status: N/A

Fixes: None

User interface changes?: No

Code review: None
  • Loading branch information
billsacks committed Aug 17, 2016
1 parent 4560c5a commit ba2135f
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 41 deletions.
5 changes: 4 additions & 1 deletion scripts/Testing/Testcases/config_tests.xml
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,10 @@ LII CLM initial condition interpolation test
<INFO_DBUG>1</INFO_DBUG>
<BFBFLAG>TRUE</BFBFLAG>
<BUILD_THREADED>TRUE</BUILD_THREADED>
<REST_OPTION>never</REST_OPTION>
<CONTINUE_RUN>FALSE</CONTINUE_RUN>
<REST_OPTION>none</REST_OPTION>
<HIST_OPTION>$STOP_OPTION</HIST_OPTION>
<HIST_N>$STOP_N</HIST_N>
<CCSM_TCOST>1</CCSM_TCOST>
<DOUT_S>FALSE</DOUT_S>
</test>
Expand Down
58 changes: 18 additions & 40 deletions utils/python/CIME/SystemTests/pet.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,63 +6,41 @@
(2) do another initial run with nthrds=1 for all components (suffix: single_thread)
"""

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

logger = logging.getLogger(__name__)

class PET(SystemTestsCommon):
class PET(SystemTestsCompareTwo):

_COMPONENT_LIST = ('ATM','CPL','OCN','WAV','GLC','ICE','ROF','LND')

def __init__(self, case):
"""
initialize a test object
"""
SystemTestsCommon.__init__(self, case)
SystemTestsCompareTwo.__init__(self, case,
separate_builds = False,
run_two_suffix = 'single_thread',
run_one_description = 'default threading',
run_two_description = 'threads set to 1')

def build_phase(self, sharedlib_only=False, model_only=False):
def _case_one_setup(self):
# first make sure that all components have threaded settings
for comp in ['ATM','CPL','OCN','WAV','GLC','ICE','ROF','LND']:
for comp in self._COMPONENT_LIST:
if self._case.get_value("NTHRDS_%s"%comp) <= 1:
self._case.set_value("NTHRDS_%s"%comp, 2)
self._case.flush()

# TODO(wjs, 2016-08-16) Is this needed? I'm thinking it may be because
# we changed the number of threads, but I'm not sure
case_setup(self._case, reset=True)

self.clean_build()
self.build_indv(sharedlib_only=sharedlib_only, model_only=model_only)

def _pet_first_phase(self):
#Do a run with default threading
self._case.set_value("CONTINUE_RUN",False)
self._case.set_value("REST_OPTION","none")
self._case.set_value("HIST_OPTION","$STOP_OPTION")
self._case.set_value("HIST_N","$STOP_N")
self._case.flush()

stop_n = self._case.get_value("STOP_N")
stop_option = self._case.get_value("STOP_OPTION")
logger.info("doing a %d %s initial test with default threading, no restarts written"
% (stop_n, stop_option))

self.run_indv()

def _pet_second_phase(self):
def _case_two_setup(self):
#Do a run with all threads set to 1
for comp in ['ATM','CPL','OCN','WAV','GLC','ICE','ROF','LND']:
for comp in self._COMPONENT_LIST:
self._case.set_value("NTHRDS_%s"%comp, 1)
self._case.flush()
shutil.copy("env_mach_pes.xml", os.path.join("LockedFiles","env_mach_pes.xml"))

stop_n = self._case.get_value("STOP_N")
stop_option = self._case.get_value("STOP_OPTION")
logger.info("doing a %d %s initial test with threads set to 1, no restarts written"
% (stop_n, stop_option))

self.run_indv(suffix="single_thread")
self._component_compare_test("base", "single_thread")

def run_phase(self):
self._pet_first_phase()
self._pet_second_phase()
# TODO(wjs, 2016-08-16) Is this needed? I'm thinking it may be because
# we changed the number of threads, but I'm not sure
case_setup(self._case, reset=True)

0 comments on commit ba2135f

Please sign in to comment.