[622] | 1 | #-Q- curie ###################### |
---|
| 2 | #-Q- curie ## CURIE TGCC/CEA ## |
---|
| 3 | #-Q- curie ###################### |
---|
[837] | 4 | #-Q- curie #MSUB -r PACKDEBUG # Nom du job |
---|
[1468] | 5 | #-Q- curie #MSUB -o PACKDEBUG.out_%I |
---|
| 6 | #-Q- curie #MSUB -e PACKDEBUG.out_%I |
---|
[622] | 7 | #-Q- curie #MSUB -n 1 # Reservation du processus |
---|
[880] | 8 | #-Q- curie #MSUB -T 3600 # Limite de temps elapsed du job |
---|
[1154] | 9 | #-Q- curie #MSUB -q ::default_node:: |
---|
[1274] | 10 | #-Q- curie #MSUB -c ::default_core:: |
---|
[704] | 11 | #-Q- curie #MSUB -Q normal |
---|
[837] | 12 | #-Q- curie #MSUB -A ::default_project:: |
---|
[681] | 13 | #-Q- curie set +x |
---|
[1437] | 14 | #-Q- irene ###################### |
---|
| 15 | #-Q- irene ## IRENE TGCC/CEA ## |
---|
| 16 | #-Q- irene ###################### |
---|
| 17 | #-Q- irene #MSUB -r PACKDEBUG # Job name |
---|
[1468] | 18 | #-Q- irene #MSUB -o PACKDEBUG.out_%I |
---|
| 19 | #-Q- irene #MSUB -e PACKDEBUG.out_%I |
---|
[1437] | 20 | #-Q- irene #MSUB -n 1 # Number of cores |
---|
| 21 | #-Q- irene #MSUB -T 3600 # Maximum elapsed time |
---|
[1468] | 22 | #-Q- irene #MSUB -q ::default_node:: |
---|
| 23 | #-Q- irene #MSUB -c ::default_core:: |
---|
[1437] | 24 | #-Q- irene #MSUB -Q normal |
---|
[1468] | 25 | #-Q- irene #MSUB -A ::default_post_project:: |
---|
[1460] | 26 | #-Q- irene #MSUB -m store,work,scratch |
---|
[1437] | 27 | #-Q- irene set +x |
---|
[1491] | 28 | #-Q- jeanzay #!/bin/ksh |
---|
| 29 | #-Q- jeanzay ###################### |
---|
| 30 | #-Q- jeanzay ## JEANZAY IDRIS ## |
---|
| 31 | #-Q- jeanzay ###################### |
---|
| 32 | #-Q- jeanzay #SBATCH --job-name=PACKDEBUG # Job Name |
---|
[1501] | 33 | #-Q- jeanzay #SBATCH --output=PACKDEBUG.out_%J # standard output |
---|
| 34 | #-Q- jeanzay #SBATCH --error=PACKDEBUG.out_%J # error output |
---|
[1494] | 35 | #-Q- jeanzay #SBATCH -N 1 # Number of core |
---|
| 36 | #-Q- jeanzay #SBATCH --partition=prepost # Post-processing partition |
---|
[1491] | 37 | #-Q- jeanzay #SBATCH --time=10:00:00 # Wall clock limit (seconds) |
---|
| 38 | #-Q- jeanzay #SBATCH --account ::default_project::@cpu |
---|
| 39 | #-Q- jeanzay set +x |
---|
[770] | 40 | #-Q- ada #!/bin/ksh |
---|
| 41 | #-Q- ada ####################### |
---|
[929] | 42 | #-Q- ada ## ADA IDRIS ## |
---|
[770] | 43 | #-Q- ada ####################### |
---|
[1409] | 44 | #-Q- ada # @ job_type = mpich |
---|
[848] | 45 | #-Q- ada # @ requirements = (Feature == "prepost") |
---|
[770] | 46 | #-Q- ada # Temps Elapsed max. d'une requete hh:mm:ss |
---|
| 47 | #-Q- ada # @ wall_clock_limit = 10:00:00 |
---|
| 48 | #-Q- ada # Nom du travail LoadLeveler |
---|
| 49 | #-Q- ada # @ job_name = PACKDEBUG |
---|
| 50 | #-Q- ada # Fichier de sortie standard du travail |
---|
| 51 | #-Q- ada # @ output = $(job_name).$(jobid) |
---|
| 52 | #-Q- ada # Fichier de sortie d'erreur du travail |
---|
| 53 | #-Q- ada # @ error = $(job_name).$(jobid) |
---|
| 54 | #-Q- ada # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.) |
---|
| 55 | #-Q- ada # @ notification = error |
---|
[1290] | 56 | #-Q- ada # @ environment = $DEBUG_debug ; $BigBrother ; $postProcessingStopLevel ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $POST_DIR ; $Script_Post_Output ; $SUBMIT_DIR ; $DateBegin ; $DateEnd ; $PeriodPack ; $StandAlone ; $MASTER ; wall_clock_limit=$(wall_clock_limit) |
---|
[770] | 57 | #-Q- ada # @ queue |
---|
[547] | 58 | #-Q- lxiv8 ###################### |
---|
| 59 | #-Q- lxiv8 ## OBELIX LSCE ## |
---|
| 60 | #-Q- lxiv8 ###################### |
---|
| 61 | #-Q- lxiv8 #PBS -N PACKDEBUG |
---|
| 62 | #-Q- lxiv8 #PBS -m a |
---|
| 63 | #-Q- lxiv8 #PBS -j oe |
---|
| 64 | #-Q- lxiv8 #PBS -q medium |
---|
| 65 | #-Q- lxiv8 #PBS -o PACKDEBUG.$$ |
---|
| 66 | #-Q- lxiv8 #PBS -S /bin/ksh |
---|
[1184] | 67 | #-Q- ifort_CICLAD ###################### |
---|
| 68 | #-Q- ifort_CICLAD ## CICLAD IPSL ## |
---|
| 69 | #-Q- ifort_CICLAD ###################### |
---|
| 70 | #-Q- ifort_CICLAD #PBS -N PACKDEBUG |
---|
| 71 | #-Q- ifort_CICLAD #PBS -m a |
---|
| 72 | #-Q- ifort_CICLAD #PBS -j oe |
---|
| 73 | #-Q- ifort_CICLAD #PBS -q std |
---|
| 74 | #-Q- ifort_CICLAD #PBS -S /bin/ksh |
---|
[547] | 75 | #-Q- default #!/bin/ksh |
---|
| 76 | #-Q- default ################## |
---|
| 77 | #-Q- default ## DEFAULT HOST ## |
---|
| 78 | #-Q- default ################## |
---|
| 79 | |
---|
| 80 | #************************************************************** |
---|
| 81 | # Author: Sebastien Denvil |
---|
| 82 | # Contact: Sebastien.Denvil__at__ipsl.jussieu.fr |
---|
| 83 | # $Revision:: $ Revision of last commit |
---|
| 84 | # $Author:: $ Author of last commit |
---|
| 85 | # $Date:: $ Date of last commit |
---|
| 86 | # IPSL (2006) |
---|
| 87 | # This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC |
---|
| 88 | # |
---|
| 89 | #************************************************************** |
---|
| 90 | |
---|
| 91 | #set -eu |
---|
| 92 | #set -vx |
---|
| 93 | |
---|
| 94 | date |
---|
| 95 | |
---|
[1356] | 96 | #D- Task type DO NOT CHANGE (computing, post-processing or checking) |
---|
[712] | 97 | TaskType=post-processing |
---|
| 98 | |
---|
[547] | 99 | ######################################################################## |
---|
| 100 | |
---|
| 101 | #D- Flag to determine if this job in a standalone mode |
---|
| 102 | #D- Default : value from AA_job if any |
---|
| 103 | StandAlone=${StandAlone:=true} |
---|
| 104 | |
---|
[554] | 105 | #D- Path to libIGCM |
---|
| 106 | #D- Default : value from AA_job if any |
---|
| 107 | # WARNING For StandAlone use : To run this script on some machine (ulam and cesium) |
---|
| 108 | # WARNING you must check MirrorlibIGCM variable in sys library. |
---|
| 109 | # WARNING If this variable is true, you must use libIGCM_POST path instead |
---|
| 110 | # WARNING of your running libIGCM directory. |
---|
| 111 | libIGCM=${libIGCM:=::modipsl::/libIGCM} |
---|
| 112 | |
---|
| 113 | #-D- $hostname of the MASTER job when SUBMIT_DIR is not visible on postprocessing computer. |
---|
[928] | 114 | MASTER=${MASTER:=ada|curie} |
---|
[554] | 115 | |
---|
[547] | 116 | #D- Flag to determine begin date for restart pack |
---|
| 117 | #D- Default : value from AA_job if any |
---|
[578] | 118 | DateBegin=${DateBegin:=20000101} |
---|
[547] | 119 | |
---|
| 120 | #D- Flag to determine end date for restart pack |
---|
| 121 | #D- Default : value from AA_job if any |
---|
[554] | 122 | DateEnd=${DateEnd:=20691231} |
---|
[547] | 123 | |
---|
| 124 | #D- Flag to determine pack period |
---|
| 125 | #D- Default : value from AA_job if any |
---|
[554] | 126 | PeriodPack=${PeriodPack:=10Y} |
---|
[547] | 127 | |
---|
[554] | 128 | #D- Uncomment to run interactively |
---|
| 129 | #D- For testing purpose, will be remove |
---|
| 130 | #SUBMIT_DIR=${PWD} |
---|
| 131 | #RUN_DIR_PATH=${SCRATCHDIR}/Pack_Test |
---|
[547] | 132 | |
---|
| 133 | #D- Increased verbosity (1, 2, 3) |
---|
| 134 | #D- Default : value from AA_job if any |
---|
| 135 | Verbosity=${Verbosity:=3} |
---|
| 136 | |
---|
| 137 | #D- Low level debug : to bypass lib test checks and stack construction |
---|
| 138 | #D- Default : value from AA_job if any |
---|
| 139 | DEBUG_debug=${DEBUG_debug:=false} |
---|
| 140 | |
---|
[554] | 141 | #D- Keep following comments for now. Will be remove. |
---|
| 142 | |
---|
[547] | 143 | #on veut archiver les fichiers restart |
---|
| 144 | #Dans le cadre du demenagement ils seront renommes |
---|
| 145 | #ATM/Restart/****.nc |
---|
| 146 | #OCE/Restart/****.nc |
---|
| 147 | #... |
---|
| 148 | #sous la forme |
---|
| 149 | #RESTART/ATM_****.nc |
---|
| 150 | #RESTART/OCE_****.nc |
---|
[590] | 151 | #Attention de bien conserver les dates d'origines |
---|
[547] | 152 | # |
---|
| 153 | #Dans le cadre de la production nouvelle chaine |
---|
| 154 | #ils auront directement le bon nom |
---|
| 155 | # |
---|
[590] | 156 | #On veut egalement que l'archive soit par periode de temps |
---|
| 157 | # cette periode est definie par la taille du pack donc connue |
---|
| 158 | # en entree du script (1M, 1Y, 5Y, 10Y etc...) |
---|
[547] | 159 | # |
---|
[590] | 160 | # $1= PATH/config_card d'une simulation avec |
---|
| 161 | # TagName/JobName/ExperimentName/SpaceName/DateBegin/DateEnd |
---|
[554] | 162 | # $2=PeriodPack en M/m ou Y/y |
---|
[547] | 163 | |
---|
| 164 | ######################################################################## |
---|
| 165 | |
---|
| 166 | . ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh |
---|
| 167 | . ${libIGCM}/libIGCM_card/libIGCM_card.ksh |
---|
| 168 | . ${libIGCM}/libIGCM_date/libIGCM_date.ksh |
---|
| 169 | #------- |
---|
| 170 | . ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh |
---|
[731] | 171 | . ${libIGCM}/libIGCM_config/libIGCM_config.ksh |
---|
[547] | 172 | . ${libIGCM}/libIGCM_post/libIGCM_post.ksh |
---|
[832] | 173 | #------- |
---|
[1192] | 174 | RUN_DIR=${RUN_DIR_PATH} |
---|
| 175 | IGCM_sys_MkdirWork ${RUN_DIR} |
---|
| 176 | IGCM_sys_Cd ${RUN_DIR} |
---|
| 177 | #------- |
---|
[832] | 178 | ( ${DEBUG_debug} ) && IGCM_debug_Check |
---|
| 179 | ( ${DEBUG_debug} ) && IGCM_card_Check |
---|
| 180 | ( ${DEBUG_debug} ) && IGCM_date_Check |
---|
[547] | 181 | |
---|
| 182 | ######################################################################## |
---|
| 183 | |
---|
| 184 | #set -vx |
---|
| 185 | |
---|
| 186 | # ------------------------------------------------------------------ |
---|
| 187 | # Test if all was right before proceeding further |
---|
| 188 | # ------------------------------------------------------------------ |
---|
[1206] | 189 | IGCM_debug_Verif_Exit |
---|
[547] | 190 | |
---|
| 191 | if [ ${StandAlone} = true ] ; then |
---|
| 192 | CARD_DIR=${SUBMIT_DIR} |
---|
| 193 | else |
---|
[647] | 194 | CARD_DIR=${RUN_DIR_PATH} |
---|
[640] | 195 | IGCM_sys_Get_Master ${SUBMIT_DIR}/config.card ${RUN_DIR_PATH} |
---|
| 196 | IGCM_sys_Get_Master ${SUBMIT_DIR}/run.card ${RUN_DIR_PATH} |
---|
| 197 | IGCM_sys_Get_Master ${SUBMIT_DIR}/COMP ${RUN_DIR_PATH} |
---|
| 198 | IGCM_sys_Get_Master ${SUBMIT_DIR}/POST ${RUN_DIR_PATH} |
---|
[547] | 199 | fi |
---|
| 200 | |
---|
[727] | 201 | #================================== |
---|
[547] | 202 | # First of all |
---|
| 203 | # |
---|
[727] | 204 | # Read libIGCM compatibility version in config.card |
---|
| 205 | # Read UserChoices section |
---|
| 206 | # Read Ensemble section |
---|
| 207 | # Read Post section |
---|
| 208 | # Define all netcdf output directories |
---|
| 209 | #================================== |
---|
| 210 | IGCM_config_CommonConfiguration ${CARD_DIR}/config.card |
---|
[658] | 211 | |
---|
[1198] | 212 | # ------------------------------------------------------------------ |
---|
| 213 | # Activate BigBrother so as to supervise this job |
---|
| 214 | # ------------------------------------------------------------------ |
---|
| 215 | IGCM_debug_BigBro_Initialize |
---|
| 216 | |
---|
| 217 | #================================== |
---|
| 218 | # Test and set up directories |
---|
| 219 | #================================== |
---|
[547] | 220 | IGCM_sys_TestDirArchive ${R_SAVE} |
---|
| 221 | [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive" |
---|
| 222 | |
---|
[554] | 223 | STORE_DEBUG=${R_SAVE}/DEBUG |
---|
| 224 | IGCM_sys_MkdirArchive ${STORE_DEBUG} |
---|
[547] | 225 | |
---|
[554] | 226 | # Switch to script variables meaning (try to be compatible with ipsl_pack TGCC moving procedure) |
---|
[547] | 227 | JobName=${config_UserChoices_JobName} |
---|
[590] | 228 | echo $JobName $DateBegin $DateEnd |
---|
[547] | 229 | |
---|
| 230 | # Clear txt file lists |
---|
| 231 | rm -f ${RUN_DIR}/liste_debug_files.txt |
---|
[616] | 232 | rm -f ${RUN_DIR}/liste_out_files.txt |
---|
[547] | 233 | rm -f ${RUN_DIR}/new_liste_debug_files.txt |
---|
| 234 | rm -f ${RUN_DIR}/liste_pack_*.txt |
---|
| 235 | |
---|
| 236 | # Create sorted debug list to work with |
---|
[590] | 237 | find ${R_BUFR}/*/Debug -type f | sort >> ${RUN_DIR}/liste_debug_files.txt |
---|
[547] | 238 | |
---|
[616] | 239 | # Rename debug files we will work with using symlinks. use ???_ prefix ie NF-2 |
---|
[547] | 240 | #gawk -F/ '{dest_name=$(NF-2)("_") $(NF); system("cp --preserve " $0 " "dest_name)}' ${RUN_DIR}/liste_debug_files.txt |
---|
| 241 | gawk -F/ '{dest_name=$(NF-2)("_") $(NF); system("ln -s " $0 " "dest_name)}' ${RUN_DIR}/liste_debug_files.txt |
---|
| 242 | |
---|
[616] | 243 | # Add out_ : output of execution files |
---|
| 244 | find ${R_BUFR}/Out -type f -name '*out_*' | sort >> ${RUN_DIR}/liste_out_files.txt |
---|
[547] | 245 | |
---|
[616] | 246 | # Rename out files we will work with using symlinks. use Out_ prefix ie NF-1 |
---|
| 247 | gawk -F/ '{dest_name=$(NF-1)("_") $(NF); system("ln -s " $0 " "dest_name)}' ${RUN_DIR}/liste_out_files.txt |
---|
| 248 | |
---|
| 249 | # List renamed debug files. Exclude Job_xxx files. |
---|
[617] | 250 | find ${RUN_DIR} -maxdepth 1 -mindepth 1 -name "???_*${JobName}*" -ls | sort -k 11 > ${RUN_DIR}/new_liste_debug_files.txt |
---|
[616] | 251 | |
---|
[547] | 252 | # ------------------------------------------------------------------ |
---|
| 253 | # Test if all was right before proceeding further |
---|
| 254 | # ------------------------------------------------------------------ |
---|
[1206] | 255 | IGCM_debug_Verif_Exit |
---|
[547] | 256 | |
---|
[565] | 257 | # Init loop |
---|
| 258 | date_begin_pack=${DateBegin} |
---|
| 259 | date_end_simulation=${DateEnd} |
---|
[547] | 260 | number_pack=1 |
---|
| 261 | |
---|
| 262 | IGCM_debug_PrintVariables 3 date_begin_pack |
---|
| 263 | IGCM_debug_PrintVariables 3 date_end_simulation |
---|
| 264 | |
---|
| 265 | while [ ${date_begin_pack} -le ${date_end_simulation} ] ; do |
---|
| 266 | |
---|
| 267 | IGCM_debug_PrintVariables 3 number_pack |
---|
| 268 | |
---|
[589] | 269 | DaysTemp=$( IGCM_date_DaysInCurrentPeriod ${date_begin_pack} ${PeriodPack} ) |
---|
[579] | 270 | date_end_pack=$( IGCM_date_AddDaysToGregorianDate ${date_begin_pack} $(( ${DaysTemp} - 1 )) ) |
---|
[547] | 271 | |
---|
[565] | 272 | for file in $( gawk '{print $11}' ${RUN_DIR}/new_liste_debug_files.txt ); do |
---|
[547] | 273 | extract_date_file=$( echo ${file} | sed -e "s/.*${JobName}_[0-9]*_//" ) |
---|
| 274 | date_file=$( echo ${extract_date_file} | sed 's/\([0-9]\{8\}\)_.*$/\1/g' ) |
---|
[590] | 275 | # echo pack n°${number_pack} ${date_file} ${date_begin_pack} ${date_end_pack} |
---|
| 276 | if [ ${date_file} -le ${date_end_pack} ] && [ ${date_file} -ge ${date_begin_pack} ] ; then |
---|
[617] | 277 | echo $( basename ${file} ) >> ${RUN_DIR}/liste_pack_${date_begin_pack}_${date_end_pack}.txt |
---|
| 278 | echo $( readlink ${file} ) >> ${RUN_DIR}/liste_remove_pack_${date_begin_pack}_${date_end_pack}.txt |
---|
[547] | 279 | fi |
---|
| 280 | done |
---|
| 281 | |
---|
[565] | 282 | # Create tar files |
---|
| 283 | IGCM_debug_Print 1 "Tar ongoing" |
---|
[617] | 284 | tar -cvf ${JobName}_${date_begin_pack}_${date_end_pack}_debug.tar --dereference --files-from ${RUN_DIR}/liste_pack_${date_begin_pack}_${date_end_pack}.txt |
---|
[1478] | 285 | # Test return code of tar |
---|
| 286 | [ $? != 0 ] && IGCM_debug_Exit "tar failed" |
---|
[565] | 287 | # Save it |
---|
| 288 | IGCM_sys_Put_Out ${JobName}_${date_begin_pack}_${date_end_pack}_debug.tar ${STORE_DEBUG} |
---|
| 289 | # Clean it |
---|
| 290 | IGCM_sys_Rm ${JobName}_${date_begin_pack}_${date_end_pack}_debug.tar |
---|
[765] | 291 | # ------------------------------------------------------------------ |
---|
| 292 | # Test if all was right before proceeding cleaning |
---|
| 293 | # ------------------------------------------------------------------ |
---|
[1206] | 294 | IGCM_debug_Verif_Exit |
---|
[565] | 295 | # Clean links |
---|
[617] | 296 | cat ${RUN_DIR}/liste_pack_${date_begin_pack}_${date_end_pack}.txt | xargs rm |
---|
[565] | 297 | # Clean files links pointed to |
---|
[617] | 298 | cat ${RUN_DIR}/liste_remove_pack_${date_begin_pack}_${date_end_pack}.txt | xargs rm |
---|
[565] | 299 | # Save the list of files that has been pack (tar) |
---|
[632] | 300 | #mv ${RUN_DIR}/liste_pack_${date_begin_pack}_${date_end_pack}.txt ${STORE_DEBUG} |
---|
[565] | 301 | IGCM_debug_Print 1 "Tar and cleaning done" |
---|
[547] | 302 | |
---|
| 303 | (( number_pack = number_pack + 1 )) |
---|
| 304 | |
---|
[565] | 305 | # Add 1 day to date_end_pack to have the new date_begin_pack |
---|
[578] | 306 | date_begin_pack=$( IGCM_date_AddDaysToGregorianDate ${date_end_pack} 1 ) |
---|
[565] | 307 | |
---|
[547] | 308 | done |
---|
[590] | 309 | |
---|
| 310 | # Clean RUN_DIR_PATH (necessary for cesium and titane only) |
---|
| 311 | IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH} |
---|
| 312 | |
---|
[1198] | 313 | # ------------------------------------------------------------------ |
---|
| 314 | # Finalize BigBrother to inform that the jobs end |
---|
| 315 | # ------------------------------------------------------------------ |
---|
| 316 | IGCM_debug_BigBro_Finalize |
---|
| 317 | |
---|
[590] | 318 | date |
---|