1 | #!/bin/bash |
---|
2 | ###################### |
---|
3 | ## TITANE CEA ## |
---|
4 | ###################### |
---|
5 | #MSUB -r ipsl_pack # Nom du job |
---|
6 | #MSUB -eo |
---|
7 | #MSUB -n 1 # Reservation du processus |
---|
8 | #MSUB -T 86400 # Limite de temps elapsed du job |
---|
9 | #MSUB -p gen2211 |
---|
10 | #MSUB -q mono |
---|
11 | |
---|
12 | # ex : ./launch_ipsl_enlarge.sh |
---|
13 | |
---|
14 | # Est-on sur ulam (machine de l'IDRIS) ? |
---|
15 | is_idris_machine=`hostname | grep "ulam" | wc -l ` |
---|
16 | ON_IDRIS="no" |
---|
17 | if [ "x${is_idris_machine}" != "x0" ] |
---|
18 | then |
---|
19 | ON_IDRIS="yes" |
---|
20 | fi |
---|
21 | export ON_IDRIS=${ON_IDRIS} |
---|
22 | |
---|
23 | # gpdebug : pour option -f |
---|
24 | restartExecFromZero=0 |
---|
25 | while [ $# -gt 0 ] |
---|
26 | do |
---|
27 | echo "boucle sur les arguments du script ..." |
---|
28 | echo "@=$@" |
---|
29 | case $1 in |
---|
30 | -f) restartExecFromZero=1 |
---|
31 | echo "force restart from the beginning ..." |
---|
32 | ;; |
---|
33 | esac |
---|
34 | shift |
---|
35 | done |
---|
36 | export restartExecFromZero=${restartExecFromZero} |
---|
37 | # gpdebug : end |
---|
38 | |
---|
39 | export JOB_DIR=${LS_SUBCWD:-${PWD}} |
---|
40 | export EXE_DIR=${JOB_DIR} |
---|
41 | |
---|
42 | # export INPUT_DMF_DATA=/ccc/dmfbuf/import_data.2/ccrt/dmnfs12/cont003/bacasable # gpdebug : suppr |
---|
43 | # export OUTPUT_STORE=${SCRATCHDIR}/PSEUDO_DMNFS_STORE # gpdebug : suppr |
---|
44 | # export OUTPUT_WORK=${SCRATCHDIR}/PSEUDO_DMNFS_WORK # gpdebug : suppr |
---|
45 | |
---|
46 | SCRIPT_NAME=$(basename ${0} ) |
---|
47 | |
---|
48 | # export IGCM_DEM=${SCRATCHDIR}/IGCM_DEM # gpdebug : suppr |
---|
49 | # export IGCM_TMP=${SCRATCHDIR}/IGCM_DEM/tmp # gpdebug : suppr |
---|
50 | |
---|
51 | # On renseigne les variables d'environnement |
---|
52 | export scriptCallingLoad=$SCRIPT_NAME # sert a renseigner "load_ipslPack_env.sh" sur le script l'appelant |
---|
53 | . load_ipslPack_env.sh |
---|
54 | export IGCM_TMP="${IGCM_DEM}/tmp" # gpdebug : added |
---|
55 | |
---|
56 | |
---|
57 | export clean_tmp=${clean_tmp:-yes} |
---|
58 | export DEM_LOG=${JOB_DIR}/dem_${LSB_JOBID:-${$}}.log |
---|
59 | export LOG_LEV=2 |
---|
60 | |
---|
61 | export config_card=${IGCM_DEM}/config_card.liste |
---|
62 | |
---|
63 | |
---|
64 | ############## gpdebug : Pour gestion des erreurs ######################################### |
---|
65 | # Execute la function errorReceive() si reception d'un signal TERM |
---|
66 | trap 'DEM_errorReceive' TERM |
---|
67 | # liste des processus à détruire en cas d'erreur bloquante |
---|
68 | export listPID=$$ |
---|
69 | # fichier pour la transmission des messages d'erreur d'un fils au prog principal |
---|
70 | export errorMsgFile="${PWD}/errorMsg.txt" |
---|
71 | ############## gpdebug : fin ############################################################## |
---|
72 | |
---|
73 | source ${EXE_DIR}/DEM_utilities.sh |
---|
74 | |
---|
75 | DEM_log -0 "Demarrage de ${SCRIPT_NAME}" |
---|
76 | |
---|
77 | if [ "x${ON_IDRIS}" == "xno" ] |
---|
78 | then |
---|
79 | check_nco_version # verification de la version de nco ####################### |
---|
80 | else |
---|
81 | check_nco_version_idris # verification de la version de nco (sur la machine ulam de l'idris) |
---|
82 | check_netcdf_idris # verification du chargement du module netCDF (pour cmd ncdump) |
---|
83 | fi |
---|
84 | |
---|
85 | # gpdebug : si l'option -f est activee, on detruit tous les fichiers status |
---|
86 | if [ "x$restartExecFromZero" == "x1" ] |
---|
87 | then |
---|
88 | echo "Deleting all status files ..." |
---|
89 | for CONFIG in $( awk '{print $1}' ${IGCM_DEM}/config_card.liste ) |
---|
90 | do |
---|
91 | PATH_SIMU=$( dirname $CONFIG ) |
---|
92 | ListStatFileInSimu=`find $PATH_SIMU -type f -name "*status" ` |
---|
93 | if [ "x$ListStatFileInSimu" != "x" ] |
---|
94 | then |
---|
95 | for file in $ListStatFileInSimu |
---|
96 | do |
---|
97 | if [ -e $file ] |
---|
98 | then |
---|
99 | rm -f $file |
---|
100 | fi |
---|
101 | |
---|
102 | done |
---|
103 | fi |
---|
104 | done |
---|
105 | echo "Deletion done." |
---|
106 | fi |
---|
107 | # gpdebug : end |
---|
108 | |
---|
109 | export timeLaunchStartFile="${USER_OUTPUT_PROGRESS}/timeLaunchStartFile.txt" |
---|
110 | > $timeLaunchStartFile |
---|
111 | startTime=$( getDateMilliSeconds ) |
---|
112 | echo "launch time:$startTime" > $timeLaunchStartFile |
---|
113 | |
---|
114 | |
---|
115 | for CONFIG in $( awk '{print $1}' ${IGCM_DEM}/config_card.liste ) ; do |
---|
116 | |
---|
117 | DEM_state=$( DEM_read_state ${IGCM_DEM}/config_card.liste ${CONFIG} ) |
---|
118 | |
---|
119 | if [[ "${DEM_state}" != "WriteListTarDone" ]] ; then |
---|
120 | |
---|
121 | DEM_write_state ${IGCM_DEM}/config_card.liste ${CONFIG} PackRunning |
---|
122 | export PATH_SIMU=$( dirname $CONFIG ) |
---|
123 | ${EXE_DIR}/enlarge_my_files.sh ${INPUT_DMF_DATA} ${OUTPUT_STORE} ${OUTPUT_WORK} |
---|
124 | |
---|
125 | DEM_write_state ${IGCM_DEM}/config_card.liste ${CONFIG} PackDone |
---|
126 | |
---|
127 | else |
---|
128 | DEM_write_state ${IGCM_DEM}/config_card.liste ${CONFIG} TarRunning |
---|
129 | export PATH_SIMU=$( dirname $CONFIG ) |
---|
130 | ${EXE_DIR}/tar_full_simu.sh ${INPUT_DMF_DATA} ${OUTPUT_STORE} ${CONFIG} |
---|
131 | |
---|
132 | DEM_write_state ${IGCM_DEM}/config_card.liste ${CONFIG} TarDone |
---|
133 | |
---|
134 | |
---|
135 | fi |
---|
136 | |
---|
137 | done |
---|
138 | |
---|
139 | export timeEndFile="${USER_OUTPUT_PROGRESS}/timeEndFile.txt" |
---|
140 | > $timeEndFile |
---|
141 | |
---|
142 | DEM_log -0 "Fin de ${SCRIPT_NAME}" |
---|