special_restart_example_ecconf.sh 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=${HOME}/modeles/ecearth/sources
  10. run_dir=/SCRATCH/acad/ecearth/${USER}/run/${exp_name}
  11. ini_data_dir=/SCRATCH/acad/ecearth/DATA
  12. # File for standard output.
  13. # NOTE: This will be modified for restart jobs!
  14. stdout_file=${PBS_O_WORKDIR-$PWD}/${PBS_JOBNAME-"local"}_${PBS_JOBID-"id"}.log
  15. # Resubmit this job for automatic restarts? [true/false]
  16. # Also, add options for the resubmit command here.
  17. resubmit_job=true
  18. resubmit_opt=""
  19. # Configure GRIBEX paths
  20. export LOCAL_DEFINITION_TEMPLATES=/projects/acad/ecearth/opt/gribex/lib/gribtemplates
  21. export ECMWF_LOCAL_TABLE_PATH=/projects/acad/ecearth/opt/gribex/lib/gribtables
  22. # Configure grib api paths
  23. export GRIB_DEFINITION_PATH=/projects/acad/ecearth/opt/grib_api/share/definitions
  24. export GRIB_SAMPLES_PATH=/projects/acad/ecearth/opt/grib_api/share/ifs_samples/grib1
  25. export GRIB_BIN_PATH=/projects/acad/ecearth/opt/grib_api/bin
  26. # Configure number of processors per node
  27. proc_per_node=24
  28. # Configure and load modules
  29. pre_load_modules_cmd="module purge"
  30. module_list="compiler compiler/intel/comp_and_lib/2016.2.181 intelmpi/5.1.3.181/64 hdf5/1.8.18-el6/intel_2016.2.181/intelmpi_5.1.3.181"
  31. if [ -n "${pre_load_modules_cmd}" ]
  32. then
  33. ${pre_load_modules_cmd}
  34. fi
  35. module load ${module_list}
  36. # Add directories to the shared library search path
  37. export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}"/projects/acad/ecearth/opt/grib_api/lib:/projects/acad/ecearth/opt/openjpeg/lib:/projects/acad/ecearth/opt/netcdf/4.4.1.1_ivy_2016.2.181/lib"
  38. }
  39. function launch()
  40. {
  41. # Compute and check the node distribution
  42. info "======================="
  43. info "Node/proc distribution:"
  44. info "-----------------------"
  45. info "IFS: ${ifs_numproc}"
  46. info "NEMO: ${nem_numproc}"
  47. info "XIOS: ${xio_numproc}"
  48. info "======================="
  49. cmd="mpirun"
  50. while (( "$#" ))
  51. do
  52. nranks=$1
  53. executable=./$(basename $2)
  54. shift
  55. shift
  56. cmd+=" -n $nranks $executable"
  57. while (( "$#" )) && [ "$1" != "--" ]
  58. do
  59. cmd+=" $1"
  60. shift
  61. done
  62. shift || true
  63. (( "$#" )) && cmd+=" :"
  64. done
  65. #export OMP_NUM_THREADS=1
  66. pwd
  67. echo $cmd
  68. #exit
  69. $cmd
  70. }
  71. function finalise()
  72. {
  73. # This function should execute of any post run functionality, e.g.
  74. # platform dependent cleaning or a resubmit
  75. if ${resubmit_job} && [ $(date -d "${leg_end_date}" +%s) -lt $(date -d "${run_end_date}" +%s) ]
  76. then
  77. info "Resubmitting job for leg $((leg_number+1))"
  78. # Need to go to start_dir to find the run script
  79. cd ${PBS_O_WORKDIR} # same as $start_dir
  80. cp ./${PBS_JOBNAME} ./${PBS_JOBNAME}.$$
  81. sed "s:force_run_from_scratch=true:force_run_from_scratch=false:" \
  82. <./${PBS_JOBNAME}.$$ \
  83. >./${PBS_JOBNAME}
  84. cp -f ./${PBS_JOBNAME} ./${PBS_JOBNAME}.$$
  85. sed "s:special_restart=true:special_restart=false:" \
  86. <./${PBS_JOBNAME}.$$ \
  87. >./${PBS_JOBNAME}
  88. \rm -f ./${PBS_JOBNAME}.$$
  89. # Submit command
  90. set -x
  91. qsub ./${PBS_JOBNAME}
  92. set +x
  93. else
  94. info "Not resubmitting."
  95. fi
  96. }