csc-puhti-intel.cfg.tmpl 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186
  1. # Platform dependent configuration functions for the 'rhino' machine
  2. # (KNMI, NL)
  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. export ecearth_src_dir=[[[PLT:ACTIVE:ECEARTH_SRC_DIR]]]
  10. export run_dir=[[[PLT:ACTIVE:RUN_DIR]]]
  11. export ini_data_dir=[[[PLT:ACTIVE:INI_DATA_DIR]]]
  12. # File for standard output.
  13. # NOTE: This will be modified for restart jobs!
  14. stdout_file=${start_dir}/out/$(basename ${SLURM_JOB_NAME}).out
  15. # Resubmit this job for automatic restarts? [true/false]
  16. # Also, add options for the resubmit command here.
  17. resubmit_job=[[[PLT:ACTIVE:RESUBMIT_JOB]]]
  18. resubmit_opt="[[[PLT:ACTIVE:RESUBMIT_OPT]]]"
  19. # Configure grib api paths
  20. export GRIB_DEFINITION_PATH=[[[PLT:ACTIVE:ECEARTH_SRC_DIR]]]/util/grib_table_126:[[[PLT:ACTIVE:GRIBAPI_BASE_DIR]]]/[[[PLT:ACTIVE:GRIBAPI_DEFINITION_SUBDIR]]]
  21. export GRIB_SAMPLES_PATH=[[[PLT:ACTIVE:GRIBAPI_BASE_DIR]]]/[[[PLT:ACTIVE:GRIBAPI_SAMPLES_SUBDIR]]]
  22. export GRIB_BIN_PATH=[[[PLT:ACTIVE:GRIBAPI_BASE_DIR]]]/[[[PLT:ACTIVE:GRIBAPI_BIN_SUBDIR]]]
  23. # Configure GRIBEX paths
  24. export LOCAL_DEFINITION_TEMPLATES=[[[PLT:ACTIVE:GRIBEX_DEFINITION_PATH]]]
  25. #export ECMWF_LOCAL_TABLE_PATH=[[[PLT:ACTIVE:GRIBEX_DEFINITION_PATH]]]
  26. # Configure number of processors per node
  27. proc_per_node=[[[PLT:ACTIVE:PROC_PER_NODE]]]
  28. # Configure and load modules
  29. pre_load_modules_cmd="[[[PLT:ACTIVE:PRE_LOAD_MODULES_CMD]]]"
  30. module_list="[[[PLT:ACTIVE:MODULE_LIST]]]"
  31. if [ -n "${module_list}" ]
  32. then
  33. set +u
  34. if [ -n "${pre_load_modules_cmd}" ]
  35. then
  36. ${pre_load_modules_cmd}
  37. fi
  38. for m in "${module_list}"
  39. do
  40. eval $(/usr/bin/modulecmd sh add $m)
  41. done
  42. set -u
  43. fi
  44. module list
  45. module avail
  46. module load netcdf/4.7.0
  47. module load netcdf-fortran/4.4.4
  48. # Add directories to the shared library search path
  49. if [ -n "[[[PLT:ACTIVE:ADD_TO_LD_LIBRARY_PATH]]]" ]
  50. then
  51. export LD_LIBRARY_PATH=${LD_LIBRARY_PATH:+${LD_LIBRARY_PATH}:}"[[[PLT:ACTIVE:ADD_TO_LD_LIBRARY_PATH]]]"
  52. fi
  53. export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/users/bergmant/libs/lib
  54. echo $LD_LIBRARY_PATH
  55. ulimit -s unlimited
  56. ulimit -n 2048
  57. ulimit -c unlimited
  58. #ulimit -a
  59. }
  60. function launch_atos()
  61. {
  62. # version using srun
  63. # banner launch
  64. cmd="srun --kill-on-bad-exit=1"
  65. export I_MPI_PMI_LIBRARY=/usr/lib64/libpmi.so
  66. export I_MPI_FAST_COLLECTIVES=1
  67. export I_MPI_EXTRA_FILESYSTEM=on
  68. export I_MPI_EXTRA_FILESYSTEM_LIST=lustre
  69. export OMP_PROC_BIND=true
  70. export KMP_AFFINITY=verbose,compact,granularity=fine
  71. export KMP_AFFINITY=compact,granularity=fine
  72. export PMI_TIME=10
  73. export MKL_NUM_THREADS=1
  74. export OMP_STACKSIZE=256m
  75. export MXM_LOG_LEVEL=ERROR
  76. export OMPI_MCA_hwloc_base_binding_policy=none
  77. CONF_FILE=$1
  78. NODESET=$2
  79. NBTASKS=$3
  80. BINDING=$4
  81. export OMP_NUM_THREADS=$5
  82. export TIME="launch timing : %e elapsed %U user %S system"
  83. NBNODES=`nodeset -c $NODESET`
  84. ls /usr/bin
  85. #/usr/bin/time
  86. $cmd --nodes=$NBNODES --nodelist=$NODESET --ntasks=$NBTASKS --distribution=block --cpu_bind=$BINDING -l --multi-prog $CONF_FILE
  87. }
  88. function launch()
  89. {
  90. # version using srun
  91. echo $#
  92. #cmd="srun "
  93. _task1=-1
  94. NBTASKS=0
  95. rm -rf conf.txt
  96. while (( "$#" ))
  97. do
  98. nranks=$1
  99. executable=./$(basename $2)
  100. shift
  101. shift
  102. _task0=$((_task1+1))
  103. _task1=$((_task0+nranks-1))
  104. cmd="${_task0}-${_task1} ${executable}"
  105. NBTASKS=$((NBTASKS+nranks))
  106. while (( "$#" )) && [ "$1" != "--" ]
  107. do
  108. cmd+=" $1"
  109. shift
  110. done
  111. echo ${cmd} >>conf.txt
  112. shift || true
  113. done
  114. export CONF_FILE=conf.txt
  115. cp /users/bergmant/r5133_tm5_pisces/runtime/classic/conf.txt ./stat.conf.txt
  116. cat $CONF_FILE
  117. export OMP_NUM_THREADS=1
  118. echo $NBTASKS
  119. pwd
  120. echo pwd
  121. echo $cmd
  122. srun --multi-prog $CONF_FILE
  123. }
  124. function finalise()
  125. {
  126. # This function should execute of any post run functionality, e.g.
  127. # platform dependent cleaning or a resubmit
  128. if ${resubmit_job} && [ $(date -d "${leg_end_date}" +%s) -lt $(date -d "${run_end_date}" +%s) ]
  129. then
  130. info "Resubmitting job for leg $((leg_number+1))"
  131. info "No implemented yet!"
  132. # # Need to go to start_dir to find the run script
  133. # cd ${start_dir}
  134. # # Submit command
  135. # # Note: This does not work if you specify a job name with sbatch -J jobname!
  136. # sbatch -N ${SLURM_JOB_NUM_NODES} \
  137. # -n $((ifs_numproc + nem_numproc + tm5_numproc)) \
  138. # --exclusive \
  139. # --ntasks-per-node=${proc_per_node} \
  140. # -o ${run_dir}/$(basename ${stdout_file}).$(printf %03d $((leg_number+1))) \
  141. # -e ${run_dir}/$(basename ${stdout_file}).$(printf %03d $((leg_number+1))) \
  142. # -d ${SLURM_JOB_ID} \
  143. # ${resubmit_opt} \
  144. # ./${SLURM_JOB_NAME}
  145. fi
  146. }
  147. function postprocess()
  148. {
  149. # This function submits a script to postprocess the IFS output
  150. data_dir=`pwd`/$1
  151. script_file="$1/postprocess"
  152. cat >"${script_file}" <<EOF
  153. #! /bin/bash
  154. cd "${start_dir}/../../../postprocessing"
  155. ./postprocess_leg "${data_dir}" "${data_dir}/postprocessed"
  156. EOF
  157. sbatch -N 1 --exclusive \
  158. -o ${data_dir}/$(basename ${stdout_file}).$(printf %03d $((leg_number+1))) \
  159. -e ${data_dir}/$(basename ${stdout_file}).$(printf %03d $((leg_number+1))) \
  160. "${script_file}"
  161. }