zenobe.cfg.tmpl 3.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  1. # Platform dependent configuration functions for the 'zenobe' machine
  2. #(zenobe.hpc.cenaero.be)
  3. function configure()
  4. {
  5. # This function should configure all settings/modules needed to
  6. # later prepare the EC-Earth run directory and set variables used
  7. # in the run script
  8. # Configure paths for building/running EC-Earth
  9. ecearth_src_dir=[[[PLT:ACTIVE:ECEARTH_SRC_DIR]]]
  10. run_dir=[[[PLT:ACTIVE:RUN_DIR]]]
  11. ini_data_dir=[[[PLT:ACTIVE:INI_DATA_DIR]]]
  12. archive_dir=/SCRATCH/acad/ecearth/${USER}/archive/${exp_name}
  13. # File for standard output.
  14. # NOTE: This will be modified for restart jobs!
  15. stdout_file=${PBS_O_WORKDIR-$PWD}/${PBS_JOBNAME-"local"}_${PBS_JOBID-"id"}.log
  16. # Resubmit this job for automatic restarts? [true/false]
  17. # Also, add options for the resubmit command here.
  18. resubmit_job=[[[PLT:ACTIVE:RESUBMIT_JOB]]]
  19. resubmit_opt="[[[PLT:ACTIVE:RESUBMIT_OPT]]]"
  20. # Configure number of processors per node
  21. proc_per_node=[[[PLT:ACTIVE:PROC_PER_NODE]]]
  22. # Configure and load modules
  23. pre_load_modules_cmd="[[[PLT:ACTIVE:PRE_LOAD_MODULES_CMD]]]"
  24. module_list="[[[PLT:ACTIVE:MODULE_LIST]]]"
  25. if [ -n "${pre_load_modules_cmd}" ]
  26. then
  27. ${pre_load_modules_cmd}
  28. fi
  29. module load ${module_list}
  30. # Configure GRIBEX paths
  31. export LOCAL_DEFINITION_TEMPLATES=[[[PLT:ACTIVE:GRIBEX_DEFINITION_PATH]]]/gribtemplates
  32. export ECMWF_LOCAL_TABLE_PATH=[[[PLT:ACTIVE:GRIBEX_DEFINITION_PATH]]]/gribtables
  33. # Configure grib api paths
  34. export GRIB_DEFINITION_PATH=[[[PLT:ACTIVE:GRIBAPI_BASE_DIR]]]/[[[PLT:ACTIVE:GRIBAPI_DEFINITION_SUBDIR]]]
  35. export GRIB_SAMPLES_PATH=[[[PLT:ACTIVE:GRIBAPI_BASE_DIR]]]/[[[PLT:ACTIVE:GRIBAPI_SAMPLES_SUBDIR]]]
  36. export GRIB_BIN_PATH=[[[PLT:ACTIVE:GRIBAPI_BASE_DIR]]]/[[[PLT:ACTIVE:GRIBAPI_BIN_SUBDIR]]]
  37. # Add directories to the shared library search path
  38. export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}"[[[PLT:ACTIVE:ADD_TO_LD_LIBRARY_PATH]]]"
  39. }
  40. function launch()
  41. {
  42. # Compute and check the node distribution
  43. info "======================="
  44. info "Node/proc distribution:"
  45. info "-----------------------"
  46. info "IFS: ${ifs_numproc}"
  47. info "NEMO: ${nem_numproc}"
  48. info "XIOS: ${xio_numproc}"
  49. info "======================="
  50. cmd="mpirun"
  51. while (( "$#" ))
  52. do
  53. nranks=$1
  54. executable=./$(basename $2)
  55. shift
  56. shift
  57. cmd+=" -n $nranks $executable"
  58. while (( "$#" )) && [ "$1" != "--" ]
  59. do
  60. cmd+=" $1"
  61. shift
  62. done
  63. shift || true
  64. (( "$#" )) && cmd+=" :"
  65. done
  66. #export OMP_NUM_THREADS=1
  67. pwd
  68. echo $cmd
  69. #exit
  70. $cmd
  71. }
  72. function finalise()
  73. {
  74. # This function should execute of any post run functionality, e.g.
  75. # platform dependent cleaning or a resubmit
  76. if ${resubmit_job} && [ $(date -d "${leg_end_date}" +%s) -lt $(date -d "${run_end_date}" +%s) ]
  77. then
  78. info "Resubmitting job for leg $((leg_number+1))"
  79. # Need to go to start_dir to find the run script
  80. cd ${PBS_O_WORKDIR} # same as $start_dir
  81. cp ./${PBS_JOBNAME} ./${PBS_JOBNAME}.$$
  82. sed "s:force_run_from_scratch=true:force_run_from_scratch=false:" \
  83. <./${PBS_JOBNAME}.$$ \
  84. >./${PBS_JOBNAME}
  85. cp -f ./${PBS_JOBNAME} ./${PBS_JOBNAME}.$$
  86. sed "s:special_restart=true:special_restart=false:" \
  87. <./${PBS_JOBNAME}.$$ \
  88. >./${PBS_JOBNAME}
  89. \rm -f ./${PBS_JOBNAME}.$$
  90. # Submit command
  91. set -x
  92. qsub ./${PBS_JOBNAME}
  93. set +x
  94. else
  95. info "Not resubmitting."
  96. fi
  97. }