nemo.cfg 4.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108
  1. # Platform dependent configuration functions for the 'cenaero' machine
  2. # (hpc.cenaero.be)
  3. function configure()
  4. {
  5. # This function should configure all settings/modules needed to
  6. # later prepare the NEMO run directory and set variables used
  7. # in the run script
  8. # Configure paths for building/running NEMO
  9. nemo_src_dir=${HOME}/modeles/NEMO/3.6
  10. run_dir=$GLOBALSCRATCH/nemo/run/${exp_name}
  11. ini_data_dir=$GLOBALSCRATCH/DATA/nemo
  12. # File for standard output.
  13. # NOTE: This will be modified for restart jobs!
  14. #stdout_file=${start_dir}/out/${PBS_JOBNAME}.out
  15. # Resubmit this job for automatic restarts? [true/false]
  16. # Also, add options for the resubmit command here.
  17. resubmit_job=true
  18. # Configure and load modules
  19. pre_load_modules_cmd="module purge"
  20. module_list="module load intel/compilerpro/13.0.1.117 openmpi/1.6.4/intel-13.0.1.117 hdf5/1.8.15p1_intel13_ompi1.6.4 netcdf/intel/4.3.3.1_ompi1.6.4 cdo/intel/1.5.4"
  21. module load ${module_list}
  22. }
  23. function configure_opa()
  24. {
  25. # Configure paths for NEMO IC
  26. [ -f ${ini_data_dir}/INIT/${nem_grid}/coordinates.nc ] && ln -s ${ini_data_dir}/INIT/${nem_grid}/coordinates.nc
  27. [ -f ${ini_data_dir}/INIT/${nem_grid}/bathy_meter.nc ] && ln -s ${ini_data_dir}/INIT/${nem_grid}/bathy_meter.nc
  28. [ -f ${ini_data_dir}/INIT/${nem_grid}/runoff_core_monthly.nc ] && ln -s ${ini_data_dir}/INIT/${nem_grid}/runoff_core_monthly.nc runoffs_depth.nc
  29. [ -f ${ini_data_dir}/INIT/${nem_grid}/ahmcoef.nc ] && ln -s ${ini_data_dir}/INIT/${nem_grid}/ahmcoef.nc
  30. [ -f ${ini_data_dir}/INIT/${nem_grid}/mask_itf.nc ] && ln -s ${ini_data_dir}/INIT/${nem_grid}/mask_itf.nc
  31. [ -f ${ini_data_dir}/INIT/${nem_grid}/K1rowdrg.nc ] && ln -s ${ini_data_dir}/INIT/${nem_grid}/K1rowdrg.nc
  32. [ -f ${ini_data_dir}/INIT/${nem_grid}/M2rowdrg.nc ] && ln -s ${ini_data_dir}/INIT/${nem_grid}/M2rowdrg.nc
  33. [ -f ${ini_data_dir}/INIT/${nem_grid}/data_1m_potential_temperature_nomask.nc ] && ln -s ${ini_data_dir}/INIT/${nem_grid}/data_1m_potential_temperature_nomask.nc temperature.nc
  34. [ -f ${ini_data_dir}/INIT/${nem_grid}/data_1m_salinity_nomask.nc ] && ln -s ${ini_data_dir}/INIT/${nem_grid}/data_1m_salinity_nomask.nc salinity.nc
  35. [ -f ${ini_data_dir}/INIT/${nem_grid}/subbasins.nc ] && ln -s ${ini_data_dir}/INIT/${nem_grid}/subbasins.nc
  36. [ -f ${ini_data_dir}/INIT/${nem_grid}/resto.nc ] && ln -s ${ini_data_dir}/INIT/${nem_grid}/resto.nc
  37. [ -f ${ini_data_dir}/INIT/${nem_grid}/chlorophyll.nc ] && ln -s ${ini_data_dir}/INIT/${nem_grid}/chlorophyll.nc
  38. [ -f ${ini_data_dir}/INIT/${nem_grid}/geothermal_heating.nc ] && ln -s ${ini_data_dir}/INIT/${nem_grid}/geothermal_heating.nc
  39. # Configure paths for NEMO Forcings
  40. ln -sf ${ini_data_dir}/BC/${nem_grid}/${nem_forcing_set}/*.nc .
  41. [ -f ${ini_data_dir}/BC/${nem_grid}/weights_core_orca2_bicubic_noc.nc ] && ln -s ${ini_data_dir}/BC/${nem_grid}/weights_core_orca2_bicubic_noc.nc
  42. [ -f ${ini_data_dir}/BC/${nem_grid}/weights_core_orca2_bilinear_noc.nc ] && ln -s ${ini_data_dir}/BC/${nem_grid}/weights_core_orca2_bilinear_noc.nc
  43. }
  44. function configure_xios()
  45. {
  46. # Configure paths for XIOS files
  47. ln -sf ${ctrl_file_dir}/*.xml .
  48. }
  49. function launch()
  50. {
  51. # Compute and check the node distribution
  52. info "======================="
  53. info "Node/proc distribution:"
  54. info "-----------------------"
  55. info "XIOS: ${xio_numproc}"
  56. info "NEMO: ${nem_numproc}"
  57. info "======================="
  58. cmd="mpirun"
  59. while (( "$#" ))
  60. do
  61. nranks=$1
  62. executable=./$(basename $2)
  63. shift
  64. shift
  65. cmd+=" -np $nranks $executable"
  66. while (( "$#" )) && [ "$1" != "--" ]
  67. do
  68. cmd+=" $1"
  69. shift
  70. done
  71. shift || true
  72. (( "$#" )) && cmd+=" :"
  73. done
  74. export OMP_NUM_THREADS=1
  75. $cmd
  76. }
  77. function finalise()
  78. {
  79. # This function should execute of any post run functionality, e.g.
  80. # platform dependent cleaning or a resubmit
  81. if ${resubmit_job} && [ $(date -d "${leg_end_date}" +%s) -lt $(date -d "${run_end_date}" +%s) ]
  82. then
  83. info "Resubmitting job ${start_dir}/${script_name} for leg $((leg_number+1))"
  84. # Need to go to start_dir to find the run script
  85. cd ${start_dir}
  86. # Submit command
  87. sbatch ./${script_name}
  88. fi
  89. }