Created
October 9, 2018 19:28
-
-
Save singhbalwinder/8fcdd2b385ac2a7231fc3c9e73fb5172 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/csh | |
set echo verbose | |
set run_time = 00:15:00 | |
set project = | |
set ntasks = 1 | |
set nthrds = 1 | |
## ==================================================================== | |
# Set CASE related variables | |
## ==================================================================== | |
setenv CASE test_def_cascade_09212018_1task | |
setenv MACH cascade | |
setenv COMPILER intel | |
setenv COMPSET FC5AV1C-L | |
setenv RES ne30_ne30 | |
setenv MAKE_J 24 | |
setenv mods 'none' #$locdir/mods_$CASE #'none' for no mods directory | |
## ==================================================================== | |
# Define directories | |
## ==================================================================== | |
setenv PTMP /dtemp/st49401/$LOGNAME/csmruns | |
setenv SRCROOT /dtemp/st49401/sing201/users/blaz/E3SM | |
setenv CASEROOT ~$LOGNAME/CSM/CMIP5/$CASE | |
setenv RUNDIR {$PTMP}/$CASE/run | |
setenv BLDDIR {$PTMP}/$CASE/bld | |
## ==================================================================== | |
# create new case | |
## ==================================================================== | |
rm -rf $CASEROOT | |
cd $SRCROOT/cime/scripts | |
echo '==== GIT STATUS OF THE SRC ====' | |
git st | |
git rev-parse HEAD | |
echo '==== GIT STATUS ENDS ====' | |
./create_newcase -case $CASEROOT -mach $MACH -res $RES -compset $COMPSET -compiler $COMPILER -project $project || echo 'create_newcase failed' && exit -1 | |
## ==================================================================== | |
# Modify xml file through xmlchange commands | |
## ==================================================================== | |
#batch options: | |
cd $CASEROOT | |
if ( $?queue) then | |
./xmlchange --force -file env_batch.xml -id JOB_QUEUE -val $queue || exit -1 | |
endif | |
if ( $?run_time ) then | |
./xmlchange -file env_batch.xml -id JOB_WALLCLOCK_TIME -val $run_time || exit -1 | |
endif | |
if ( $?project ) then | |
./xmlchange -file env_batch.xml -id PROJECT_REQUIRED -val TRUE || exit -1 | |
./xmlchange -file env_batch.xml -id PROJECT -val $project || exit -1 | |
endif | |
#tasks and threads: | |
cd $CASEROOT | |
if ( $ntasks > 0 ) then | |
foreach icomp ('NTASKS_ATM' 'NTASKS_LND' 'NTASKS_ICE' 'NTASKS_OCN' 'NTASKS_CPL' 'NTASKS_GLC' 'NTASKS_ROF' 'NTASKS_WAV' 'NTASKS_ESP') | |
./xmlchange -file env_mach_pes.xml -id $icomp -val $ntasks || echo 'Error setting tasks for component:' $icomp && exit -1 | |
end | |
endif | |
if ( $nthrds > 0 ) then | |
foreach icomp ('NTHRDS_ATM' 'NTHRDS_LND' 'NTHRDS_ICE' 'NTHRDS_OCN' 'NTHRDS_CPL' 'NTHRDS_GLC' 'NTHRDS_ROF' 'NTHRDS_WAV' 'NTHRDS_ESP') | |
./xmlchange -file env_mach_pes.xml -id $icomp -val $nthrds || echo 'Error setting thrds for component:' $icomp && exit -1 | |
end | |
endif | |
#build-time options: | |
cd $CASEROOT | |
./xmlchange -file env_build.xml -id EXEROOT -val $BLDDIR || exit -1 | |
#./xmlchange -file env_build.xml -id DEBUG -val 'TRUE' || exit -1 | |
#run-time options: | |
cd $CASEROOT | |
./xmlchange -file env_run.xml -id GMAKE_J -val $MAKE_J || exit -1 | |
./xmlchange -file env_run.xml -id RESUBMIT -val '0' || exit -1 | |
./xmlchange -file env_run.xml -id STOP_N -val '1' || exit -1 | |
./xmlchange -file env_run.xml -id STOP_OPTION -val 'nsteps' || exit -1 | |
./xmlchange -file env_run.xml -id REST_N -val '1' || exit -1 | |
./xmlchange -file env_run.xml -id REST_OPTION -val 'nmonths'|| exit -1 | |
./xmlchange -file env_run.xml -id RUNDIR -val $RUNDIR || exit -1 | |
cat <<EOF >! user_nl_cam | |
&camexp | |
/ | |
EOF | |
cat <<EOF >! user_nl_clm | |
&clmexp | |
/ | |
EOF | |
#------------------------ | |
## configure/Build/Submit | |
#------------------------ | |
#config: | |
cd $CASEROOT | |
./case.setup || echo 'case setup FAILED ' && exit -1 | |
#build: | |
cd $CASEROOT | |
if ( $mods != 'none' ) then | |
ln -sf ${mods}/* SourceMods/src.cam || echo 'Error while linking mods directory' && exit -1 | |
endif | |
./case.build || echo 'case build FAILED' && exit -1 | |
./case.submit || echo 'case submit FAILED' && exit -1 | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment