zenobe.cfg.tmpl 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132
  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 grib api paths
  21. export GRIB_DEFINITION_PATH=[[[PLT:ACTIVE:ECEARTH_SRC_DIR]]]/util/grib_table_126:[[[PLT:ACTIVE:GRIBAPI_BASE_DIR]]]/[[[PLT:ACTIVE:GRIBAPI_DEFINITION_SUBDIR]]]
  22. export GRIB_SAMPLES_PATH=[[[PLT:ACTIVE:GRIBAPI_BASE_DIR]]]/[[[PLT:ACTIVE:GRIBAPI_SAMPLES_SUBDIR]]]
  23. export GRIB_BIN_PATH=[[[PLT:ACTIVE:GRIBAPI_BASE_DIR]]]/[[[PLT:ACTIVE:GRIBAPI_BIN_SUBDIR]]]
  24. # Configure number of processors per node
  25. proc_per_node=[[[PLT:ACTIVE:PROC_PER_NODE]]]
  26. # Configure and load modules
  27. pre_load_modules_cmd="[[[PLT:ACTIVE:PRE_LOAD_MODULES_CMD]]]"
  28. module_list="[[[PLT:ACTIVE:MODULE_LIST]]]"
  29. if [ -n "${pre_load_modules_cmd}" ]
  30. then
  31. ${pre_load_modules_cmd}
  32. fi
  33. if [ -n "${module_list}" ]
  34. then
  35. module load ${module_list}
  36. fi
  37. # Add directories to the shared library search path
  38. if [ -n "[[[PLT:ACTIVE:ADD_TO_LD_LIBRARY_PATH]]]" ]
  39. then
  40. export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}"[[[PLT:ACTIVE:ADD_TO_LD_LIBRARY_PATH]]]"
  41. fi
  42. }
  43. function launch()
  44. {
  45. # Compute and check the node distribution
  46. info "======================="
  47. info "Node/proc distribution:"
  48. info "-----------------------"
  49. info "IFS: ${ifs_numproc}"
  50. info "NEMO: ${nem_numproc}"
  51. info "XIOS: ${xio_numproc}"
  52. info "======================="
  53. cmd="mpirun"
  54. while (( "$#" ))
  55. do
  56. nranks=$1
  57. executable=./$(basename $2)
  58. shift
  59. shift
  60. cmd+=" -n $nranks $executable"
  61. while (( "$#" )) && [ "$1" != "--" ]
  62. do
  63. cmd+=" $1"
  64. shift
  65. done
  66. shift || true
  67. (( "$#" )) && cmd+=" :"
  68. done
  69. #export OMP_NUM_THREADS=1
  70. #export OMP_NUM_THREADS=1
  71. #export I_MPI_ADJUST_BCAST=3
  72. #export PSM2_MTU=8196
  73. #export PSM2_MEMORY=large
  74. #export PSM2_MQ_RNDV_HFI_THRESH=1
  75. #export I_MPI_DEBUG=5
  76. #export I_MPI_FABRIC=tmi
  77. pwd
  78. echo $cmd
  79. #exit
  80. $cmd
  81. }
  82. function finalise()
  83. {
  84. # This function should execute of any post run functionality, e.g.
  85. # platform dependent cleaning or a resubmit
  86. if ${resubmit_job} && [ $(date -d "${leg_end_date}" +%s) -lt $(date -d "${run_end_date}" +%s) ]
  87. then
  88. info "Resubmitting job for leg $((leg_number+1))"
  89. # Need to go to start_dir to find the run script
  90. cd ${PBS_O_WORKDIR} # same as $start_dir
  91. cp ./${PBS_JOBNAME} ./${PBS_JOBNAME}.$$
  92. sed "s:force_run_from_scratch=true:force_run_from_scratch=false:" \
  93. <./${PBS_JOBNAME}.$$ \
  94. >./${PBS_JOBNAME}
  95. cp -f ./${PBS_JOBNAME} ./${PBS_JOBNAME}.$$
  96. sed "s:special_restart=true:special_restart=false:" \
  97. <./${PBS_JOBNAME}.$$ \
  98. >./${PBS_JOBNAME}
  99. \rm -f ./${PBS_JOBNAME}.$$
  100. # Submit command
  101. set -x
  102. qsub ./${PBS_JOBNAME}
  103. set +x
  104. else
  105. info "Not resubmitting."
  106. fi
  107. }