zenobe.cfg.tmpl 3.6 KB

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