|
| 1 | +#!/bin/bash |
| 2 | + |
| 3 | +# Set run options |
| 4 | +#============================================= |
| 5 | +resolution=ne1024pg2_r0125_oRRS18to6v3 |
| 6 | +compset=F2010-SCREAM-HR-DYAMOND2 |
| 7 | +checkout_date=20201127 #the date you *checked out* the code |
| 8 | +branch=ad0e203 #actual git hash of branch to check out |
| 9 | +run_descriptor=SCREAMv0 #will be SCREAMv0 for production run |
| 10 | +repo=scream |
| 11 | +machine=cori-knl |
| 12 | +compiler=intel |
| 13 | +stop_option="ndays" |
| 14 | +stop_n="4" |
| 15 | +rest_n="1" |
| 16 | +walltime="29:00:00" |
| 17 | +queue="regular" |
| 18 | +debug_compile='FALSE' |
| 19 | +date_string=`date` |
| 20 | + |
| 21 | +# Setup processor layout |
| 22 | +nnodes_atm=1536 |
| 23 | +nnodes_ocn=1536 |
| 24 | +nthreads=16 |
| 25 | +mpi_tasks_per_node=8 |
| 26 | +ntasks_atm=$(expr ${nnodes_atm} \* ${mpi_tasks_per_node}) |
| 27 | +ntasks_ocn=$(expr ${nnodes_ocn} \* ${mpi_tasks_per_node}) |
| 28 | +total_tasks_per_node=$(expr ${mpi_tasks_per_node} \* ${nthreads}) |
| 29 | +if [ ${ntasks_ocn} -ne ${ntasks_atm} ]; then |
| 30 | + nnodes=$(expr ${nnodes_atm} + ${nnodes_ocn}) |
| 31 | +else |
| 32 | + nnodes=${nnodes_atm} |
| 33 | +fi |
| 34 | +pelayout=${nnodes}x${mpi_tasks_per_node}x${nthreads} |
| 35 | + |
| 36 | +# Who to send email updates on run status to |
| 37 | + |
| 38 | + |
| 39 | +# Set flags specific to running this script |
| 40 | +do_download=true |
| 41 | +do_newcase=true |
| 42 | +do_setup=true |
| 43 | +do_build=true |
| 44 | +do_submit=true |
| 45 | + |
| 46 | +case_name=SCREAMv0.SCREAM-DY2.ne1024pg2.${date_string} |
| 47 | + |
| 48 | +# Set paths |
| 49 | +#code_root=${HOME}/gitwork/scream/ |
| 50 | +code_root=${CSCRATCH}/E3SM_code/screamv0_20201127/ |
| 51 | +case_root=${CSCRATCH}/e3sm_scratch/cori-knl/${case_name} |
| 52 | + |
| 53 | +###################################################################################### |
| 54 | +### USERS PROBABLY DON'T NEED TO CHANGE ANYTHING BELOW HERE EXCEPT user_nl_* FILES ### |
| 55 | +###################################################################################### |
| 56 | + |
| 57 | +# Make directories created by this script world-readable: |
| 58 | +#============================================= |
| 59 | +umask 022 |
| 60 | + |
| 61 | +# Download code |
| 62 | +#============================================= |
| 63 | +if [ "${do_download}" == "true" ]; then |
| 64 | + |
| 65 | + echo "Cloning repository repo = $repo into branch = $branch under code_root = $code_root" |
| 66 | + cdir=`pwd` |
| 67 | + mkdir -p $code_root/ |
| 68 | + |
| 69 | + # This will put repository, with all code, in directory $tag_name |
| 70 | + git clone [email protected]:E3SM-Project/ ${repo}.git $code_root |
| 71 | + |
| 72 | + # Setup git hooks |
| 73 | + rm -rf $code_root/.git/hooks |
| 74 | + git clone [email protected]:E3SM-Project/E3SM-Hooks.git $code_root/.git/hooks |
| 75 | + cd $code_root |
| 76 | + git config commit.template $code_root/.git/hooks/commit.template |
| 77 | + |
| 78 | + # Bring in all submodule components |
| 79 | + git submodule update --init --recursive |
| 80 | + |
| 81 | + # Check out desired branch |
| 82 | + git checkout ${branch} |
| 83 | + cd ${cdir} |
| 84 | + |
| 85 | +fi |
| 86 | + |
| 87 | +# Create case |
| 88 | +#============================================= |
| 89 | +if [ "${do_newcase}" == "true" ]; then |
| 90 | + ${code_root}/cime/scripts/create_newcase \ |
| 91 | + --case ${case_root} \ |
| 92 | + --compset ${compset} --res ${resolution} \ |
| 93 | + --machine ${machine} --compiler ${compiler} \ |
| 94 | + --queue ${queue} \ |
| 95 | + --walltime ${walltime} |
| 96 | +fi |
| 97 | + |
| 98 | +# Copy this script to case directory |
| 99 | +#============================================= |
| 100 | +cp -v `basename $0` ${case_root}/ |
| 101 | + |
| 102 | +# Setup |
| 103 | +#============================================= |
| 104 | +if [ "${do_setup}" == "true" ]; then |
| 105 | + cd ${case_root} |
| 106 | + |
| 107 | + # Set run length |
| 108 | + ./xmlchange STOP_OPTION=${stop_option},STOP_N=${stop_n} |
| 109 | + ./xmlchange REST_N=${rest_n} |
| 110 | + |
| 111 | + # Set processor layout |
| 112 | + if [ ${ntasks_ocn} -ne ${ntasks_atm} ]; then |
| 113 | + ./xmlchange NTASKS=${ntasks_ocn} |
| 114 | + ./xmlchange NTASKS_ATM=${ntasks_atm} |
| 115 | + ./xmlchange ROOTPE_ATM=${ntasks_ocn} |
| 116 | + else |
| 117 | + ./xmlchange NTASKS=${ntasks_atm} |
| 118 | + fi |
| 119 | + ./xmlchange NTHRDS_ATM=${nthreads} |
| 120 | + ./xmlchange MAX_MPITASKS_PER_NODE=${mpi_tasks_per_node} |
| 121 | + ./xmlchange MAX_TASKS_PER_NODE=${total_tasks_per_node} |
| 122 | + |
| 123 | + # Flag for debug compile |
| 124 | + ./xmlchange --id DEBUG --val ${debug_compile} |
| 125 | + |
| 126 | + # Set PIO format, use PIO version 2, and increase PIO buffer size |
| 127 | + ./xmlchange PIO_NETCDF_FORMAT="64bit_data" |
| 128 | + ./xmlchange PIO_VERSION="2" |
| 129 | + ./xmlchange PIO_BUFFER_SIZE_LIMIT=134217728 |
| 130 | + |
| 131 | + # Edit CAM namelist to set dycore options for new grid |
| 132 | + cat <<EOF >> user_nl_eam |
| 133 | +
|
| 134 | + !*** By default the model dumps hundreds of vars in h0. Don't do that. *** |
| 135 | + empty_htapes=.true. |
| 136 | + !*** Outputs for DYAMOND (note fincl can only go to 10) *** |
| 137 | + nhtfrq = 12,12,12,12,-3,-3,-3,-3,-3,-3 !output freq: 12 steps=15 mi, -3=3hrs |
| 138 | + mfilt = 96,96,96,96,8,8,8,8,8,8 !new file freq: daily in all cases |
| 139 | + fincl1 = 'CLDLOW:I', 'CLDMED:I', 'CLDHGH:I', 'CLDTOT:I', 'TMCLDLIQ:I', |
| 140 | + 'TMCLDICE:I', 'TMRAINQM:I', 'TMCLDRIM:I', 'TMQ:I', 'CAPE:I', 'CIN:I' |
| 141 | + fincl2 = 'PS:I', 'TS:I', 'TREFHT:I', 'QREFHT:I', 'PRECT:I','PRECSL:I', |
| 142 | + 'WINDSPD_10M:I', 'TAUX:I', 'TAUY:I', 'SHFLX:I', 'LHFLX:I' |
| 143 | + fincl3 = 'FSNTOA:I', 'FLNT:I','FLNTC:I','FSNTOAC:I', 'FSNS:I', 'FSDS:I', |
| 144 | + 'FLNS:I', 'FLDS:I' |
| 145 | + fincl4 = 'RH200:I', 'RH500:I', 'RH700:I', 'RH850:I', |
| 146 | + 'OMEGA200:I', 'OMEGA500:I', 'OMEGA700:I', 'OMEGA850:I', |
| 147 | + 'Z200:I', 'Z500:I', 'Z700:I', 'Z850:I' |
| 148 | + !*** 3 hrly (mostly 3d) variables below here *** |
| 149 | + fincl5 = 'PS:I', 'PSL:I', 'TMNUMLIQ:I', 'TMNUMICE:I', 'TMNUMRAI:I' |
| 150 | + fincl6 = 'U:I', 'V:I' |
| 151 | + fincl7 = 'T:I', 'Q:I', |
| 152 | + fincl8 = 'CLDLIQ:I', 'CLDICE:I' |
| 153 | + fincl9 = 'CLOUD:I','OMEGA:I' |
| 154 | + fincl10= 'EMIS:I', 'TOT_ICLD_VISTAU:I' |
| 155 | + !*** Rad Freq: 4x75sec=5 min which divides 15 min output freq *** |
| 156 | + iradsw = 4 |
| 157 | + iradlw = 4 |
| 158 | +
|
| 159 | +EOF |
| 160 | + |
| 161 | + cat <<EOF >> user_nl_elm |
| 162 | +
|
| 163 | +
|
| 164 | +EOF |
| 165 | + |
| 166 | + # Finally, run setup |
| 167 | + ./case.setup |
| 168 | + |
| 169 | + # The run location is determined in the bowels of CIME |
| 170 | + # Symlink to that location from user-chosen $case_root (=current dir) |
| 171 | + ln -s `./xmlquery -value RUNDIR` run |
| 172 | + |
| 173 | + |
| 174 | + # This disables the logic that sets tprof_n and tprof_options internally. |
| 175 | + #./xmlchange --file env_run.xml TPROF_TOTAL=-1 |
| 176 | + #echo "tprof_n = 1" >> user_nl_cpl |
| 177 | + #echo "tprof_option = 'nsteps'" >> user_nl_cpl |
| 178 | +fi |
| 179 | + |
| 180 | +# Build |
| 181 | +#============================================= |
| 182 | +if [ "${do_build}" == "true" ]; then |
| 183 | + cd ${case_root} |
| 184 | + ./case.build |
| 185 | + |
| 186 | + # Set file striping on run dir for writing large files |
| 187 | + ls -l run > /dev/null #just using this command as a check that run dir exists |
| 188 | + lfs setstripe -S 1m -c 64 run |
| 189 | + lfs getstripe run >& lfs_run.txt |
| 190 | +fi |
| 191 | + |
| 192 | +# Run |
| 193 | +#============================================= |
| 194 | +if [ "${do_submit}" == "true" ]; then |
| 195 | + cd ${case_root} |
| 196 | + ./case.submit --batch-args="--mail-type=ALL --mail-user=${email_address}" |
| 197 | +fi |
| 198 | + |
| 199 | +echo "Done working in ${case_root}" |
0 commit comments