fmi-voima.cfg.tmpl 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126
  1. #!/bin/sh
  2. function configure()
  3. {
  4. # This function should configure all settings/modules needed to
  5. # later prepare the EC-Earth run directory and set variables used
  6. # in the run script
  7. # Configure paths for building/running EC-Earth
  8. export ecearth_src_dir=[[[PLT:ACTIVE:ECEARTH_SRC_DIR]]]
  9. export run_dir=[[[PLT:ACTIVE:RUN_DIR]]]
  10. export ini_data_dir=[[[PLT:ACTIVE:INI_DATA_DIR]]]
  11. if [ ! -d $ecearth_src_dir ]; then
  12. echo "ECEARTH_SRC_DIR in config_run.xml is not a directory!"
  13. exit 1
  14. fi
  15. if [ ! -d $ini_data_dir ]; then
  16. echo "INI_DATA_DIR in config_run.xml is not a directory!"
  17. exit 1
  18. fi
  19. # File for standard output.
  20. # NOTE: This will be modified for restart jobs!
  21. stdout_file=${PBS_O_WORKDIR}/out/${PBS_JOBNAME}.out
  22. # Resubmit this job for automatic restarts? [true/false]
  23. # Also, add options for the resubmit command here.
  24. resubmit_job=[[[PLT:ACTIVE:RESUBMIT_JOB]]]
  25. resubmit_opt="[[[PLT:ACTIVE:RESUBMIT_OPT]]]"
  26. # Configure GRIBEX paths
  27. export LOCAL_DEFINITION_TEMPLATES=[[[PLT:ACTIVE:GRIBEX_DEFINITION_PATH]]]
  28. # Configure GRIB API paths
  29. export GRIB_DEFINITION_PATH=[[[PLT:ACTIVE:ECEARTH_SRC_DIR]]]/util/grib_table_126:[[[PLT:ACTIVE:GRIBAPI_BASE_DIR]]]/[[[PLT:ACTIVE:GRIBAPI_DEFINITION_SUBDIR]]]
  30. export GRIB_SAMPLES_PATH=[[[PLT:ACTIVE:GRIBAPI_BASE_DIR]]]/[[[PLT:ACTIVE:GRIBAPI_SAMPLES_SUBDIR]]]
  31. export GRIB_BIN_PATH=[[[PLT:ACTIVE:GRIBAPI_BASE_DIR]]]/[[[PLT:ACTIVE:GRIBAPI_BIN_SUBDIR]]]
  32. # Configure number of processors per node
  33. proc_per_node=[[[PLT:ACTIVE:PROC_PER_NODE]]]
  34. # Configure and load modules
  35. pre_load_modules_cmd="[[[PLT:ACTIVE:PRE_LOAD_MODULES_CMD]]]"
  36. module_list="[[[PLT:ACTIVE:MODULE_LIST]]]"
  37. if [ -n "${module_list}" ]
  38. then
  39. set +u
  40. if [ -n "${pre_load_modules_cmd}" ]
  41. then
  42. ${pre_load_modules_cmd}
  43. fi
  44. for m in "${module_list}"
  45. do
  46. module add ${m}
  47. done
  48. set -u
  49. fi
  50. # Add directories to the shared library search path
  51. if [ -n "[[[PLT:ACTIVE:ADD_TO_LD_LIBRARY_PATH]]]" ]
  52. then
  53. export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}"[[[PLT:ACTIVE:ADD_TO_LD_LIBRARY_PATH]]]"
  54. fi
  55. ulimit -s unlimited
  56. }
  57. function launch()
  58. {
  59. # This function should launch the execution of a coupled experiment and handle
  60. # any configuration that for some reason couldnt go into the configuration
  61. # function
  62. cmd="aprun "
  63. while (( "$#" ))
  64. do
  65. nranks=$1
  66. executable=./$(basename $2)
  67. shift
  68. shift
  69. if [ $nranks -le $proc_per_node ]; then
  70. cmd+=" -n $nranks $executable "
  71. else
  72. cmd+=" -n $nranks -N $proc_per_node $executable "
  73. fi
  74. while (( "$#" )) && [ "$1" != "--" ]
  75. do
  76. cmd+=" $1"
  77. shift
  78. done
  79. shift || true
  80. (( "$#" )) && cmd+=" :"
  81. done
  82. echo $cmd
  83. $cmd
  84. }
  85. function finalise()
  86. {
  87. # This function should execute of any post run functionality, e.g.
  88. # platform dependent cleaning or a resubmit
  89. if ${resubmit_job} && [ $(date -d "${leg_end_date}" +%s) -lt $(date -d "${run_end_date}" +%s) ]
  90. then
  91. info "Resubmitting job for leg $((leg_number+1))"
  92. # Submit command
  93. cd ${PBS_O_WORKDIR}
  94. echo qsub -W depend=afterany:${PBS_JOBID} ${exp_name}.sh
  95. qsub -W depend=afterany:${PBS_JOBID} ${exp_name}.sh
  96. #qsub -j oe -m n \
  97. # -o ${run_dir}/$(basename ${stdout_file}).$(printf %03d $((leg_number+1))) \
  98. # ${resubmit_opt} \
  99. # -l mppwidth=$(qstat -f ${PBS_JOBID} | awk '/Resource_List.mppwidth/{print $3}') \
  100. # -W depend=afterok:${PBS_JOBID} \
  101. # ./${exp_name}.sh
  102. fi
  103. }