lemaitre3.cfg.tmpl 3.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113
  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. #run_dir=/CECI/trsf/${USER}/run/ecearth/${exp_name}
  12. ini_data_dir=[[[PLT:ACTIVE:INI_DATA_DIR]]]
  13. # File for standard output.
  14. # NOTE: This will be modified for restart jobs!
  15. stdout_file=${SLURM_SUBMIT_DIR-$PWD}/${SLURM_JOB_NAME-"local"}_${SLURM_JOB_ID-"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 GRIBEX paths
  21. export LOCAL_DEFINITION_TEMPLATES=[[[PLT:ACTIVE:GRIBEX_DEFINITION_PATH]]]/gribtemplates
  22. export ECMWF_LOCAL_TABLE_PATH=[[[PLT:ACTIVE:GRIBEX_DEFINITION_PATH]]]/gribtables
  23. # Configure number of processors per node
  24. proc_per_node=[[[PLT:ACTIVE:PROC_PER_NODE]]]
  25. # Configure and load modules
  26. pre_load_modules_cmd="[[[PLT:ACTIVE:PRE_LOAD_MODULES_CMD]]]"
  27. module_list="[[[PLT:ACTIVE:MODULE_LIST]]]"
  28. if [ -n "${pre_load_modules_cmd}" ]
  29. then
  30. ${pre_load_modules_cmd}
  31. fi
  32. module load ${module_list}
  33. # Add directories to the shared library search path
  34. export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}"[[[PLT:ACTIVE:ADD_TO_LD_LIBRARY_PATH]]]"
  35. # Configure grib api paths
  36. export GRIB_DEFINITION_PATH=${EBROOTGRIB_API}/share/grib_api/definitions
  37. export GRIB_SAMPLES_PATH=${EBROOTGRIB_API}/share/grib_api/ifs_samples/grib1
  38. export GRIB_BIN_PATH=${EBROOTGRIB_API}/bin
  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. # Get number of MPI ranks and executable name
  54. nranks=$1
  55. executable=./$(basename $2)
  56. shift
  57. shift
  58. cmd+=" -n $nranks $executable"
  59. # Add any arguments to executable
  60. while (( "$#" )) && [ "$1" != "--" ]
  61. do
  62. cmd+=" $1"
  63. shift
  64. done
  65. shift || true
  66. # Add colon of more executables follow
  67. (( "$#" )) && cmd+=" :"
  68. done
  69. #export OMP_NUM_THREADS=1
  70. pwd
  71. echo $cmd
  72. #exit
  73. $cmd
  74. }
  75. function finalise()
  76. {
  77. # This function should execute of any post run functionality, e.g.
  78. # platform dependent cleaning or a resubmit
  79. if ${resubmit_job} && [ $(date -d "${leg_end_date}" +%s) -lt $(date -d "${run_end_date}" +%s) ]
  80. then
  81. info "Resubmitting job for leg $((leg_number+1))"
  82. # Need to go to start_dir to find the run script
  83. cd ${start_dir}
  84. # Submit command
  85. # Note: This does not work if you specify a job name with sbatch -J jobname!
  86. sbatch -N ${SLURM_JOB_NUM_NODES} \
  87. -o ${run_dir}/$(basename ${stdout_file}).$(printf %03d $((leg_number+1))) \
  88. -e ${run_dir}/$(basename ${stdout_file}).$(printf %03d $((leg_number+1))) \
  89. -d ${SLURM_JOB_ID} \
  90. ${resubmit_opt} \
  91. ./${SLURM_JOB_NAME}
  92. fi
  93. }