fmi-voima_pbs.cfg.tmpl 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120
  1. #!/usr/bin/env bash
  2. set -ue
  3. qhead_str="#PBS "
  4. walltimestr="-l walltime="
  5. walltime=[[[PLT:ACTIVE:WALLTIME]]]
  6. nppnstr="-l mppnppn="
  7. nppn=[[[PLT:ACTIVE:PROC_PER_NODE]]]
  8. exp_name_str="-N "
  9. exp_name=[[[MOD:GENERAL:EXP_NAME]]]
  10. mppstr="-l mppwidth="
  11. run_type=[[[PLT:ACTIVE:RUN_COMPONENTS]]]
  12. case "$run_type" in
  13. "ifs")
  14. ifs_mpp=[[[MOD:IFS:NUMPROC]]]
  15. amip_mpp=$nppn
  16. mpp=$(($ifs_mpp+$amip_mpp))
  17. script=ece-esm.sh
  18. ;;
  19. "nemo")
  20. nemo_mpp=[[[MOD:NEM:NUMPROC]]]
  21. xios_mpp=[[[MOD:XIO:NUMPROC]]]
  22. if [ $xios_mpp -lt $nppn ]; then
  23. xios_mpp=$nppn
  24. fi
  25. mpp=$(($nemo_mpp+$xios_mpp))
  26. script=ece-nemo.sh
  27. ;;
  28. "ifs+nemo")
  29. ifs_mpp=[[[MOD:IFS:NUMPROC]]]
  30. nemo_mpp=[[[MOD:NEM:NUMPROC]]]
  31. xios_mpp=[[[MOD:XIO:NUMPROC]]]
  32. if [ $xios_mpp -lt $nppn ]; then
  33. xios_mpp=$nppn
  34. fi
  35. rnf_mpp=$nppn
  36. mpp=$(($ifs_mpp+$nemo_mpp+$xios_mpp+$rnf_mpp))
  37. script=ece-esm.sh
  38. ;;
  39. "ifs+tm5")
  40. ifs_mpp=[[[MOD:IFS:NUMPROC]]]
  41. amip_mpp=$nppn
  42. tm5_numproc_x=[[[MOD:TM5:NUMPROC_X]]]
  43. tm5_numproc_y=[[[MOD:TM5:NUMPROC_Y]]]
  44. tm5_mpp=$(($tm5_numproc_x*$tm5_numproc_y))
  45. # TM5 max. no. of processors is usually a strange number
  46. # like 45 or 90, so check if it is an integer number of nodes
  47. tm5chk=$(($tm5_mpp%$nppn)) # MOD(tm5_mpp, nppn)
  48. if [ $tm5chk -ne 0 ]; then
  49. tm5nodes=$((1+$tm5_mpp/$nppn))
  50. tm5_mpp=$(($tm5nodes*$nppn))
  51. fi
  52. mpp=$(($ifs_mpp+$amip_mpp+$tm5_mpp))
  53. script=ece-esm.sh
  54. ;;
  55. "ifs+nemo+tm5")
  56. ifs_mpp=[[[MOD:IFS:NUMPROC]]]
  57. nemo_mpp=[[[MOD:NEM:NUMPROC]]]
  58. xios_mpp=[[[MOD:XIO:NUMPROC]]]
  59. if [ $xios_mpp -lt $nppn ]; then
  60. xios_mpp=$nppn
  61. fi
  62. rnf_mpp=$nppn
  63. tm5_numproc_x=[[[MOD:TM5:NUMPROC_X]]]
  64. tm5_numproc_y=[[[MOD:TM5:NUMPROC_Y]]]
  65. tm5_mpp=$(($tm5_numproc_x*$tm5_numproc_y))
  66. # TM5 max. no. of processors is usually a strange number
  67. # like 45 or 90, so check if it is an integer number of nodes
  68. tm5chk=$(($tm5_mpp%$nppn)) # MOD(tm5_mpp, nppn)
  69. if [ $tm5chk -ne 0 ]; then
  70. tm5nodes=$((1+$tm5_mpp/$nppn))
  71. tm5_mpp=$(($tm5nodes*$nppn))
  72. fi
  73. mpp=$(($ifs_mpp+$nemo_mpp+$xios_mpp+$rnf_mpp+$tm5_mpp))
  74. script=ece-esm.sh
  75. ;;
  76. esac
  77. cat > head.tmp << EOF
  78. #!/usr/bin/env bash
  79. ${qhead_str}${walltimestr}${walltime}
  80. ${qhead_str}${nppnstr}${nppn}
  81. ${qhead_str}${mppstr}${mpp}
  82. ${qhead_str}${exp_name_str}${exp_name}
  83. ${qhead_str} -j oe
  84. cd \$PBS_O_WORKDIR
  85. # modules needed for parallel hdf5 for TM5
  86. #source /opt/modules/default/etc/modules.sh
  87. #module swap cray-mpich cray-mpich/7.0.4
  88. #module swap hdf5 hdf5-parallel/1.8.11
  89. #module swap netcdf netcdf-hdf5parallel/4.3.0
  90. EOF
  91. script_size=`wc -l $script | cut -d " " -f 1`
  92. tail -$(($script_size-1)) $script > tail.tmp
  93. cat head.tmp tail.tmp > ${exp_name}.sh
  94. chmod +x ${exp_name}.sh
  95. rm head.tmp tail.tmp
  96. qsub -j oe -o ${exp_name}.1.log ${exp_name}.sh
  97. exit 0