Skip to content

Commit

Permalink
Allow running on NERSC debug queue, but don't use DEBUG build option
Browse files Browse the repository at this point in the history
Temporary fix for using CRUNCEPv7
  • Loading branch information
dmricciuto committed Apr 20, 2018
1 parent 03bd485 commit 3b2bccb
Show file tree
Hide file tree
Showing 4 changed files with 1,342 additions and 37 deletions.
31 changes: 21 additions & 10 deletions global_fullrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
help="Perform a clean build")
parser.add_option("--compiler", dest="compiler", default = '', \
help = "compiler to use (pgi*, gnu)")
parser.add_option("--debug", dest="debug", default=False, \
parser.add_option("--debugq", dest="debug", default=False, \
action="store_true", help='Use debug queue and options')
parser.add_option("--dailyrunoff", dest="dailyrunoff", default=False, \
action="store_true", help="Write daily output for hydrology")
Expand Down Expand Up @@ -123,6 +123,8 @@
help = 'To turn on CN with CLM4me', action="store_true")
parser.add_option("--cruncep", dest="cruncep", default=False, \
action="store_true", help = 'Use CRU-NCEP meteorology')
parser.add_option("--cruncepv7", dest="cruncepv7", default=False, \
help = "use cru-ncep data", action="store_true")
parser.add_option("--cplhist", dest="cplhist", default=False, \
help= "use CPLHIST forcing", action="store_true")
parser.add_option("--gswp3", dest="gswp3", default=False, \
Expand Down Expand Up @@ -237,7 +239,7 @@ def get_regional_bounds(myregion):
ccsm_input = '/lustre/or-hydra/cades-ccsi/proj-shared/project_acme/ACME_inputdata/'
elif (options.machine == 'edison' or 'cori' in options.machine):
ccsm_input = '/project/projectdirs/acme/inputdata'

print options.machine
#default compilers
if (options.compiler == ''):
if (options.machine == 'titan' or options.machine == 'metis'):
Expand Down Expand Up @@ -289,18 +291,23 @@ def get_regional_bounds(myregion):
caseroot = os.path.abspath(options.caseroot)


if (options.cruncep or options.gswp3 or options.princeton):
if (options.cruncep or options.cruncepv7 or options.gswp3 or options.princeton):
startyear = 1901
endyear = 1920
site_endyear = 2010
if (options.cruncep):
site_endyear = 2013
elif (options.cruncepv7):
site_endyear = 2016
elif (options.gswp3):
site_endyear = 2010
elif (options.princeton):
site_endyear = 2012
if (options.livneh):
startyear = 1950
endyear = 1969
site_endyear = 2013
if (options.daymet):
startyear = 1980
endyear = 2010
site_endyear = 2010
else:
#Qian input data
startyear = 1948
Expand All @@ -318,7 +325,7 @@ def get_regional_bounds(myregion):

if (translen == -1):
translen = endyear-1850+1 #length of transient run
if (options.cpl_bypass and (options.cruncep or options.gswp3 or options.princeton)):
if (options.cpl_bypass and (options.cruncep or options.cruncepv7 or options.gswp3 or options.princeton)):
translen = site_endyear-1850+1

fsplen = int(ny_fin)
Expand Down Expand Up @@ -374,7 +381,7 @@ def get_regional_bounds(myregion):
if (options.C14):
basecmd = basecmd+' --C14 '
if (options.debug):
basecmd = basecmd+' --debug'
basecmd = basecmd+' --debugq'
if (options.monthly_metdata != ''):
basecmd = basecmd+' --monthly_metdata '+options.monthly_metdata
if (options.nofire):
Expand All @@ -397,6 +404,8 @@ def get_regional_bounds(myregion):
basecmd = basecmd+' --CH4'
if (options.cruncep):
basecmd = basecmd+' --cruncep'
if (options.cruncepv7):
basecmd = basecmd+' --cruncepv7'
if (options.gswp3):
basecmd = basecmd+' --gswp3'
if (options.princeton):
Expand Down Expand Up @@ -527,7 +536,7 @@ def get_regional_bounds(myregion):
cmd_trns = cmd_trns+' --dailyrunoff'

#transient phase 2 (CRU-NCEP only, without coupler bypass)
if ((options.cruncep or options.gswp3) and not options.cpl_bypass):
if ((options.cruncep or options.gswp3 or options.cruncepv7) and not options.cpl_bypass):
basecase=basecase.replace('1850','20TR')+'_phase1'
thistranslen = site_endyear - 1921 + 1
cmd_trns2 = basecmd+' --trans2 --finidat_case '+basecase+ \
Expand All @@ -552,7 +561,7 @@ def get_regional_bounds(myregion):
if (options.notrans == False):
print('\nSetting up transient case\n')
os.system(cmd_trns)
if ((options.cruncep or options.gswp3) and not options.cpl_bypass):
if ((options.cruncep or options.gswp3 or options.cruncepv7) and not options.cpl_bypass):
print('\nSetting up transient case phase 2\n')
os.system(cmd_trns2)

Expand Down Expand Up @@ -605,6 +614,8 @@ def get_regional_bounds(myregion):
if ("perl" in s or "python" in s):
timestr=str(int(float(options.walltime)))+':'+str(int((float(options.walltime)- \
int(float(options.walltime)))*60))+':00'
if (options.debug):
timestr='00:30:00'
output.write("#!/bin/csh -f\n")
if (mysubmit_type == 'qsub'):
output.write('#PBS -l walltime='+timestr+'\n')
Expand Down
50 changes: 35 additions & 15 deletions runcase.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,8 @@
action="store_true", help="Write daily output for hydrology")
parser.add_option("--diags", dest="diags", default=False, \
action="store_true", help="Write special outputs for diagnostics")
parser.add_option("--debug", dest="debug", default=False, \
action="store_true", help='Use debug queue and options')
parser.add_option("--debugq", dest="debug", default=False, \
action="store_true", help='Use debug queue')
parser.add_option("--runroot", dest="runroot", default="", \
help="Directory where the run would be created")
parser.add_option('--project', dest='project',default='', \
Expand Down Expand Up @@ -69,6 +69,8 @@
"Currently supports ONLY *CLM45(CN) compsets")
parser.add_option("--cruncep", dest="cruncep", default=False, \
help = "use cru-ncep data", action="store_true")
parser.add_option("--cruncepv7", dest="cruncepv7", default=False, \
help = "use cru-ncep data", action="store_true")
parser.add_option("--cplhist", dest="cplhist", default=False, \
help= "use CPLHIST forcing", action="store_true")
parser.add_option("--gswp3", dest="gswp3", default=False, \
Expand All @@ -81,7 +83,7 @@
action="store_true", help = "Daymet correction to GSWP3 precip (CONUS only)")
parser.add_option("--machine", dest="machine", default = '', \
help = "machine to\n")
parser.add_option("--compiler", dest="compiler", default='gnu', \
parser.add_option("--compiler", dest="compiler", default='', \
help = "compiler to use (pgi, gnu)")
parser.add_option("--mpilib", dest="mpilib", default="mpi-serial", \
help = "mpi library (openmpi*, mpich, ibm, mpi-serial)")
Expand Down Expand Up @@ -405,7 +407,7 @@

#CRU-NCEP 2 transient phases
if ('CRU' in compset or options.cruncep or options.gswp3 or \
options.princeton or options.cplhist):
options.cruncepv7 or options.princeton or options.cplhist):
use_reanalysis = True
else:
use_reanalysis = False
Expand Down Expand Up @@ -673,13 +675,15 @@

#create new case
cmd = './create_newcase --case '+casename+' --mach '+options.machine+' --compset '+ \
options.compset+' --res '+options.res+' --compiler '+options.compiler+' --mpilib '+ \
options.compset+' --res '+options.res+' --mpilib '+ \
options.mpilib+' > create_newcase.log'+' --walltime '+str(options.walltime)+ \
':00:00'
if (options.mymodel == 'CLM5'):
cmd = cmd+' --run-unsupported'
if (options.project != ''):
cmd = cmd+' --project '+options.project
if (options.compiler != ''):
cmd = cmd+' --compiler '+options.compiler
resut = os.system(cmd)

if (os.path.isdir(casename)):
Expand All @@ -696,13 +700,13 @@
result = os.system('./xmlchange EXEROOT='+exeroot)
if (options.mymodel == 'ELM'):
result = os.system('./xmlchange MOSART_MODE=NULL')
if (options.debug):
result = os.system('./xmlchange DEBUG=TRUE')
#if (options.debug):
# result = os.system('./xmlchange DEBUG=TRUE')

#clm 4_5 cn config options
clmcn_opts = "'-phys clm4_5'"
if (options.mymodel == 'ELM'):
os.system("./xmlchange CLM_CONFIG_OPTS="+clmcn_opts)
#clmcn_opts = "'-phys clm4_5 -cppdefs -DMODAL_AER'"
#if (options.mymodel == 'ELM'):
# os.system("./xmlchange CLM_CONFIG_OPTS="+clmcn_opts)

if (options.machine == 'userdefined'):
os.system("./xmlchange COMPILER="+options.compiler)
Expand Down Expand Up @@ -889,8 +893,13 @@
if (options.ad_spinup):
output.write(" hist_mfilt = "+str(options.hist_mfilt)+", "+str(options.hist_mfilt)+"\n")
else:
if (options.dailyrunoff or options.dailyvars):
if (options.dailyrunoff):
#include daily variables related to runoff only
output.write(" hist_mfilt = "+ str(options.hist_mfilt)+",365\n")
if (options.dailyvars):
#include daily column and PFT level output
output.write(" hist_dov2xy = .true., .true., .false.\n")
output.write(" hist_mfilt = "+ str(options.hist_mfilt)+",365,365\n")
else:
output.write(" hist_mfilt = "+ str(options.hist_mfilt)+"\n")

Expand All @@ -899,13 +908,17 @@
output.write(" hist_nhtfrq = "+ str(options.hist_nhtfrq)+", "+str(options.hist_nhtfrq)+"\n")
else:
if (options.dailyvars):
output.write(" hist_nhtfrq = "+ str(options.hist_nhtfrq)+",-24\n")
output.write(" hist_nhtfrq = "+ str(options.hist_nhtfrq)+",-24,-24\n")
h1varst = "fincl2 = "
h2varst = "fincl3 = "
for v in var_list_hourly:
h1varst = h1varst+"'"+v+"',"
for v in var_list_daily:
h1varst = h1varst+"'"+v+"',"
output.write(h1varst+"\n")
for v in var_list_pft:
h2varst = h2varst+"'"+v+"',"
output.write(h1varst[:-1]+"\n")
output.write(h2varst[:-1]+"\n")
elif (options.dailyrunoff):
output.write(" hist_nhtfrq = "+ str(options.hist_nhtfrq)+",-24\n")
output.write(" hist_fincl2 = 'TBOT','QBOT','RAIN','SNOW','QBOT','PBOT','WIND','FPSN','QVEGT'," \
Expand Down Expand Up @@ -1046,7 +1059,12 @@
output.write(" spinup_mortality_factor = 10\n")
if (cpl_bypass):
if (use_reanalysis):
if (options.cruncep):
if (options.cruncepv7):
output.write(" metdata_type = 'cru-ncep'\n")
output.write(" metdata_bypass = '"+options.ccsm_input+"/atm/datm7/" \
+"atm_forcing.datm7.cruncep_qianFill.0.5d.V7.c160715" + \
"/cpl_bypass_full'\n")
elif (options.cruncep):
if (options.livneh):
output.write(" metdata_type = 'cru-ncep_livneh'\n")
output.write(" metdata_bypass = '"+options.ccsm_input+"/atm/datm7/" \
Expand Down Expand Up @@ -1217,7 +1235,7 @@
elif ('streams' in s):
continue #do nothing
elif ('taxmode' in s):
if (options.cruncep):
if (options.cruncep or options.cruncepv7):
taxst = "taxmode = 'cycle', 'cycle', 'cycle', 'extend', 'extend'"
else:
taxst = "taxmode = 'cycle', 'extend', 'extend'"
Expand Down Expand Up @@ -1352,6 +1370,8 @@
output_run = open(PTCLMdir+'/scripts/'+myscriptsdir+'/ensemble_run_'+casename+'.pbs','w')
timestr=str(int(float(options.walltime)))+':'+str(int((float(options.walltime)- \
int(float(options.walltime)))*60))+':00'
if (options.debug):
timestr='00:30:00'
output_run.write("#!/bin/csh -f\n")
if (mysubmit_type == 'qsub'):
output_run.write('#PBS -l walltime='+timestr+'\n')
Expand Down
28 changes: 16 additions & 12 deletions site_fullrun.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,11 @@
help="Perform a clean build")
parser.add_option("--model_root", dest="csmdir", default='', \
help = "base CESM directory")
parser.add_option("--compiler", dest="compiler", default = 'gnu', \
parser.add_option("--compiler", dest="compiler", default = '', \
help = "compiler to use (pgi*, gnu)")
parser.add_option("--diags", dest="diags", default=False, \
action="store_true", help="Write special outputs for diagnostics")
parser.add_option("--debug", dest="debug", default=False, \
parser.add_option("--debugq", dest="debug", default=False, \
action="store_true", help='Use debug queue and options')
parser.add_option("--hist_mfilt_trans", dest="hist_mfilt", default="365", \
help = 'number of output timesteps per file (transient only)')
Expand Down Expand Up @@ -210,13 +210,13 @@ def submit(fname, project='', submit_type='qsub', job_depend=''):
elif (options.machine == 'edison' or 'cori' in options.machine):
ccsm_input = '/project/projectdirs/acme/inputdata'

if (options.compiler != ''):
if (options.machine == 'titan'):
options.compiler = 'pgi'
if (options.machine == 'eos' or options.machine == 'edison' or 'cori' in options.machine):
options.compiler = 'intel'
if (options.machine == 'cades'):
options.compiler = 'gnu'
#if (options.compiler != ''):
# if (options.machine == 'titan'):
# options.compiler = 'pgi'
# if (options.machine == 'eos' or options.machine == 'edison' or 'cori' in options.machine):
# options.compiler = 'intel'
# if (options.machine == 'cades'):
# options.compiler = 'gnu'


mycaseid = options.mycaseid
Expand Down Expand Up @@ -375,7 +375,7 @@ def submit(fname, project='', submit_type='qsub', job_depend=''):
if (options.C14):
basecmd = basecmd+' --C14 '
if (options.debug):
basecmd = basecmd+' --debug'
basecmd = basecmd+' --debugq'
if (options.ninst > 1):
basecmd = basecmd+' --ninst '+str(options.ninst)
if (options.nofire):
Expand Down Expand Up @@ -419,7 +419,8 @@ def submit(fname, project='', submit_type='qsub', job_depend=''):
basecmd = basecmd + ' --np '+str(options.np)
basecmd = basecmd + ' --tstep '+str(options.tstep)
basecmd = basecmd + ' --co2_file '+options.co2_file
basecmd = basecmd + ' --compiler '+options.compiler
if (options.compiler != ''):
basecmd = basecmd + ' --compiler '+options.compiler
basecmd = basecmd + ' --mpilib '+options.mpilib
basecmd = basecmd+' --caseroot '+caseroot
basecmd = basecmd+' --runroot '+runroot
Expand Down Expand Up @@ -648,7 +649,8 @@ def submit(fname, project='', submit_type='qsub', job_depend=''):
case_list.append('ad_spinup')
case_list.append('iniadjust')
case_list.append('fn_spinup')
case_list.append('spinup_diags')
if (options.diags):
case_list.append('spinup_diags')
if (options.notrans == False):
case_list.append('transient')
if (options.diags):
Expand All @@ -674,6 +676,8 @@ def submit(fname, project='', submit_type='qsub', job_depend=''):
output.write("#!/bin/csh -f\n")
timestr=str(int(float(options.walltime)))+':'+str(int((float(options.walltime)- \
int(float(options.walltime)))*60))+':00'
if (options.debug):
timestr = '00:30:00'
if (mysubmit_type == 'qsub'):
output.write('#PBS -l walltime='+timestr+'\n')
else:
Expand Down
Loading

0 comments on commit 3b2bccb

Please sign in to comment.