123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120 |
- #!/usr/bin/env bash
- set -ue
- qhead_str="#PBS "
- walltimestr="-l walltime="
- walltime=[[[PLT:ACTIVE:WALLTIME]]]
- nppnstr="-l mppnppn="
- nppn=[[[PLT:ACTIVE:PROC_PER_NODE]]]
- exp_name_str="-N "
- exp_name=[[[MOD:GENERAL:EXP_NAME]]]
- mppstr="-l mppwidth="
- run_type=[[[PLT:ACTIVE:RUN_COMPONENTS]]]
- case "$run_type" in
- "ifs")
- ifs_mpp=[[[MOD:IFS:NUMPROC]]]
- amip_mpp=$nppn
- mpp=$(($ifs_mpp+$amip_mpp))
- script=ece-esm.sh
- ;;
- "nemo")
- nemo_mpp=[[[MOD:NEM:NUMPROC]]]
- xios_mpp=[[[MOD:XIO:NUMPROC]]]
- if [ $xios_mpp -lt $nppn ]; then
- xios_mpp=$nppn
- fi
- mpp=$(($nemo_mpp+$xios_mpp))
- script=ece-nemo.sh
- ;;
-
- "ifs+nemo")
- ifs_mpp=[[[MOD:IFS:NUMPROC]]]
- nemo_mpp=[[[MOD:NEM:NUMPROC]]]
- xios_mpp=[[[MOD:XIO:NUMPROC]]]
- if [ $xios_mpp -lt $nppn ]; then
- xios_mpp=$nppn
- fi
- rnf_mpp=$nppn
- mpp=$(($ifs_mpp+$nemo_mpp+$xios_mpp+$rnf_mpp))
- script=ece-esm.sh
- ;;
-
- "ifs+tm5")
- ifs_mpp=[[[MOD:IFS:NUMPROC]]]
- amip_mpp=$nppn
- tm5_numproc_x=[[[MOD:TM5:NUMPROC_X]]]
- tm5_numproc_y=[[[MOD:TM5:NUMPROC_Y]]]
- tm5_mpp=$(($tm5_numproc_x*$tm5_numproc_y))
- # TM5 max. no. of processors is usually a strange number
- # like 45 or 90, so check if it is an integer number of nodes
- tm5chk=$(($tm5_mpp%$nppn)) # MOD(tm5_mpp, nppn)
- if [ $tm5chk -ne 0 ]; then
- tm5nodes=$((1+$tm5_mpp/$nppn))
- tm5_mpp=$(($tm5nodes*$nppn))
- fi
- mpp=$(($ifs_mpp+$amip_mpp+$tm5_mpp))
- script=ece-esm.sh
- ;;
-
- "ifs+nemo+tm5")
- ifs_mpp=[[[MOD:IFS:NUMPROC]]]
- nemo_mpp=[[[MOD:NEM:NUMPROC]]]
- xios_mpp=[[[MOD:XIO:NUMPROC]]]
- if [ $xios_mpp -lt $nppn ]; then
- xios_mpp=$nppn
- fi
- rnf_mpp=$nppn
- tm5_numproc_x=[[[MOD:TM5:NUMPROC_X]]]
- tm5_numproc_y=[[[MOD:TM5:NUMPROC_Y]]]
- tm5_mpp=$(($tm5_numproc_x*$tm5_numproc_y))
- # TM5 max. no. of processors is usually a strange number
- # like 45 or 90, so check if it is an integer number of nodes
- tm5chk=$(($tm5_mpp%$nppn)) # MOD(tm5_mpp, nppn)
- if [ $tm5chk -ne 0 ]; then
- tm5nodes=$((1+$tm5_mpp/$nppn))
- tm5_mpp=$(($tm5nodes*$nppn))
- fi
- mpp=$(($ifs_mpp+$nemo_mpp+$xios_mpp+$rnf_mpp+$tm5_mpp))
- script=ece-esm.sh
- ;;
-
- esac
- cat > head.tmp << EOF
- #!/usr/bin/env bash
- ${qhead_str}${walltimestr}${walltime}
- ${qhead_str}${nppnstr}${nppn}
- ${qhead_str}${mppstr}${mpp}
- ${qhead_str}${exp_name_str}${exp_name}
- ${qhead_str} -j oe
- cd \$PBS_O_WORKDIR
- # modules needed for parallel hdf5 for TM5
- #source /opt/modules/default/etc/modules.sh
- #module swap cray-mpich cray-mpich/7.0.4
- #module swap hdf5 hdf5-parallel/1.8.11
- #module swap netcdf netcdf-hdf5parallel/4.3.0
- EOF
- script_size=`wc -l $script | cut -d " " -f 1`
- tail -$(($script_size-1)) $script > tail.tmp
- cat head.tmp tail.tmp > ${exp_name}.sh
- chmod +x ${exp_name}.sh
- rm head.tmp tail.tmp
- qsub -j oe -o ${exp_name}.1.log ${exp_name}.sh
- exit 0
|