[428] | 1 | #!/bin/ksh |
---|
| 2 | |
---|
| 3 | #************************************************************** |
---|
| 4 | # Author: Sébastien Denvil |
---|
| 5 | # Contact: Sebastien.Denvil__at__ipsl.jussieu.fr |
---|
[1061] | 6 | # $Revision:: $ Revision of last commit |
---|
| 7 | # $Author:: $ Author of last commit |
---|
| 8 | # $Date:: $ Date of last commit |
---|
[428] | 9 | # IPSL (2006) |
---|
| 10 | # This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC |
---|
| 11 | # |
---|
| 12 | #************************************************************** |
---|
| 13 | |
---|
| 14 | #========================================================= |
---|
| 15 | # The documentation of this file can be automatically generated |
---|
[809] | 16 | # if you use the prefix #D- for comments to be extracted. |
---|
[428] | 17 | # Extract with command: cat lib* | grep "^#D-" | cut -c "4-" |
---|
| 18 | #========================================================= |
---|
| 19 | |
---|
| 20 | #D-#================================================== |
---|
| 21 | #D-LibIGCM_sys for IITM IBM machine |
---|
| 22 | #D-#================================================== |
---|
| 23 | #D- |
---|
[809] | 24 | #D- This ksh library if a layer under some usefull |
---|
[428] | 25 | #D-environment variables and shell commands. |
---|
| 26 | #D-All those definitions depend on host particularities. |
---|
| 27 | #D-It manages a stack mechanism and test validity of operations. |
---|
| 28 | #D-All function described bellow must be prefixed by IGCM_sys. |
---|
| 29 | |
---|
| 30 | #==================================================== |
---|
| 31 | # libIGCM_sys PARAMETERS |
---|
| 32 | #==================================================== |
---|
| 33 | |
---|
| 34 | #==================================================== |
---|
| 35 | # set DEBUG_sys to true to output calls of function |
---|
| 36 | typeset -r DEBUG_sys=${DEBUG_sys:=true} |
---|
| 37 | |
---|
| 38 | #==================================================== |
---|
| 39 | # Turn in dry run mode ? (sys_Put_Rest, sys_Put_Out, sys_Get) |
---|
| 40 | typeset -r DRYRUN=${DRYRUN:=0} |
---|
| 41 | |
---|
| 42 | # YOU MUST COMPILE YOUR EXE FILES FOR DRYRUN MODE ! |
---|
| 43 | # ------------------------------------------------------------------------------------- |
---|
| 44 | # | DRYRUN= | Date computations, | sys_Get | Exe | sys_Put_Out; sys_Put_Rest | |
---|
[809] | 45 | # | | Cp/Exe/param/files | | | | |
---|
| 46 | # | | Chmod Qsub | | | | |
---|
[428] | 47 | # ------------------------------------------------------------------------------------- |
---|
| 48 | # | 0 | yes | yes | yes | yes | |
---|
| 49 | # ------------------------------------------------------------------------------------- |
---|
| 50 | # | 1 | yes | yes | yes | no | |
---|
| 51 | # ------------------------------------------------------------------------------------- |
---|
| 52 | # | 2 | yes | yes | no | no | |
---|
| 53 | # ------------------------------------------------------------------------------------- |
---|
| 54 | # | 3 | yes | no | no | no | |
---|
| 55 | # ------------------------------------------------------------------------------------- |
---|
| 56 | |
---|
| 57 | #===================================================== |
---|
| 58 | # Global Variables : |
---|
| 59 | #===================================================== |
---|
| 60 | # Language : "fr" or "en" |
---|
| 61 | typeset -r MYLANG="fr" |
---|
| 62 | |
---|
| 63 | #===================================================== |
---|
[809] | 64 | # Host and user names |
---|
[428] | 65 | # $hostname ou hostname |
---|
| 66 | typeset HOST=${HOST:=$( hostname )} |
---|
| 67 | # $username ou whoami |
---|
| 68 | typeset LOGIN=${LOGIN:=$( whoami )} |
---|
| 69 | # $hostname of the MASTER job |
---|
[810] | 70 | ntypeset -r MASTER=iitm01 |
---|
[428] | 71 | |
---|
| 72 | #D- |
---|
| 73 | #D-#================================================== |
---|
| 74 | #D-Program used in libIGCM |
---|
| 75 | #D-#================================================== |
---|
| 76 | |
---|
[810] | 77 | # Submit command |
---|
| 78 | typeset SUBMIT=${SUBMIT:=/usr/lpp/LoadL/full/bin/llsubmit} |
---|
[428] | 79 | # rsync with path |
---|
| 80 | typeset -r RSYNC=/usr/bin/rsync |
---|
| 81 | # RSYNC_opt args to rsync |
---|
| 82 | typeset -r RSYNC_opt="-va" |
---|
[810] | 83 | # ie storage filesystem |
---|
| 84 | typeset -r STOREHOST=iitm01 |
---|
| 85 | typeset -r REMOTE_RSYNC=/usr/bin/rsync |
---|
[428] | 86 | |
---|
| 87 | #==================================================== |
---|
[810] | 88 | # Source default environment |
---|
| 89 | #==================================================== |
---|
| 90 | ##. /etc/profile |
---|
| 91 | |
---|
| 92 | #==================================================== |
---|
| 93 | # Set environment tools (ferret, nco, cdo) |
---|
| 94 | #==================================================== |
---|
| 95 | # Not applicable here |
---|
| 96 | |
---|
| 97 | #==================================================== |
---|
[428] | 98 | # Host specific DIRECTORIES |
---|
| 99 | #==================================================== |
---|
| 100 | |
---|
| 101 | #==================================================== |
---|
[810] | 102 | #- Mirror libIGCM from iitm to a post-processing machine |
---|
| 103 | typeset -r MirrorlibIGCM=${MirrorlibIGCM:=false} |
---|
| 104 | |
---|
| 105 | #==================================================== |
---|
| 106 | #- libIGCM_POST for frontend |
---|
| 107 | typeset -r libIGCM_POST=${libIGCM} |
---|
| 108 | |
---|
| 109 | #==================================================== |
---|
[428] | 110 | #- R_EXE (==> BIN_DIR = ${MODIPSL}/bin ) |
---|
| 111 | typeset -r R_EXE="${MODIPSL}/bin" |
---|
| 112 | |
---|
| 113 | #==================================================== |
---|
| 114 | #- SUBMIT_DIR : submission dir |
---|
| 115 | typeset SUBMIT_DIR=${SUBMIT_DIR:=${LOADL_STEP_INITDIR}} |
---|
| 116 | |
---|
| 117 | #==================================================== |
---|
[725] | 118 | #- IN |
---|
| 119 | typeset -r R_IN=${R_IN:=/gpfs1/home/sabin} |
---|
| 120 | typeset -r R_IN_ECMWF=${R_IN_ECMWF:=/gpfs1/home/sabin} |
---|
| 121 | |
---|
| 122 | #==================================================== |
---|
[428] | 123 | #- RUN_DIR_PATH : Temporary working directory (=> TMP) |
---|
| 124 | typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${ARCHIVE}/RUN/${LOADL_STEP_ID}} |
---|
| 125 | |
---|
| 126 | #==================================================== |
---|
| 127 | #- HOST_MPIRUN_COMMAND |
---|
[810] | 128 | typeset -r HOST_MPIRUN_COMMAND=${HOST_MPIRUN_COMMAND:="/usr/bin/time poe"} |
---|
[428] | 129 | |
---|
| 130 | #==================================================== |
---|
| 131 | #- Max number of arguments passed to nco operator or demigration command |
---|
| 132 | UNIX_MAX_LIMIT=360 |
---|
| 133 | |
---|
[810] | 134 | #==================================================== |
---|
| 135 | #- set PackDefault true on curie |
---|
| 136 | PackDefault=false |
---|
| 137 | |
---|
| 138 | #==================================================== |
---|
| 139 | #- Number of core per node (max number of OpenMP task) |
---|
| 140 | NUM_COREPERNODE=2 |
---|
| 141 | |
---|
| 142 | #==================================================== |
---|
| 143 | #- Default number of MPI task for IPSL coupled model |
---|
| 144 | #- required for backward compatibility |
---|
| 145 | #- |
---|
| 146 | DEFAULT_NUM_PROC_OCE=5 |
---|
| 147 | DEFAULT_NUM_PROC_CPL=1 |
---|
| 148 | (( DEFAULT_NUM_PROC_ATM = BATCH_NUM_PROC_TOT - DEFAULT_NUM_PROC_OCE - DEFAULT_NUM_PROC_CPL )) |
---|
| 149 | DEFAULT_NUM_PROC_TOTAL=${BATCH_NUM_PROC_TOT} |
---|
| 150 | |
---|
[428] | 151 | #D-#================================================== |
---|
[1057] | 152 | #D-function IGCM_sys_defineArchives |
---|
| 153 | #D-* Purpose: |
---|
| 154 | #D-* Define ARCHIVE : Dedicated to large files |
---|
| 155 | #D-* Define STORAGE : Dedicated to small/medium files |
---|
| 156 | #D-* Define R_OUT : Output tree located on ARCHIVE |
---|
| 157 | #D-* Define R_FIG : Output tree located on STORAGE hosting figures (monitoring and atlas, and/or small files) |
---|
| 158 | #D-* Define R_BUF : Output tree located on STORAGE hosting files waiting for rebuild or pack processes |
---|
| 159 | #D-* if SpaceName=TEST nothing special will hapen |
---|
[725] | 160 | #D-* Examples: |
---|
| 161 | #D- |
---|
[1057] | 162 | function IGCM_sys_defineArchives { |
---|
| 163 | IGCM_debug_PushStack "IGCM_sys_defineArchives" |
---|
| 164 | |
---|
[1060] | 165 | if [ ! X${config_UserChoices_ARCHIVE} = X ]; then |
---|
[1057] | 166 | #==================================================== |
---|
| 167 | #- ARCHIVE (dedicated to large files) |
---|
[1060] | 168 | typeset ARCHIVE=${config_UserChoices_ARCHIVE} |
---|
[1057] | 169 | else |
---|
| 170 | #==================================================== |
---|
| 171 | #- ARCHIVE (dedicated to large files) |
---|
| 172 | typeset ARCHIVE=$( echo ${HOME} | sed -e "s/gpfs1/gpfs3/" ) |
---|
| 173 | fi |
---|
| 174 | |
---|
[1060] | 175 | if [ ! X${config_UserChoices_STORAGE} = X ]; then |
---|
[1057] | 176 | #==================================================== |
---|
| 177 | #- STORAGE (dedicated to small/medium files) |
---|
[1060] | 178 | typeset STORAGE=${config_UserChoices_STORAGE} |
---|
[1057] | 179 | else |
---|
| 180 | #==================================================== |
---|
| 181 | #- STORAGE (dedicated to small/medium files) |
---|
| 182 | typeset STORAGE=${ARCHIVE} |
---|
| 183 | fi |
---|
| 184 | |
---|
| 185 | # ON OBELIX NO SPECIAL CASE WHEN X${config_UserChoices_SpaceName} = XTEST |
---|
| 186 | |
---|
| 187 | #==================================================== |
---|
| 188 | #- R_OUT |
---|
| 189 | typeset R_OUT=${ARCHIVE}/IGCM_OUT |
---|
| 190 | |
---|
| 191 | #==================================================== |
---|
| 192 | #- R_FIG (hosting figures : monitoring and atlas, and/or small files) |
---|
| 193 | typeset R_FIG=${WORKDIR}/IGCM_OUT |
---|
| 194 | |
---|
| 195 | #==================================================== |
---|
| 196 | #- R_BUF (ONLY FOR double copy an scratch) |
---|
| 197 | typeset -r R_BUF=${WORKDIR}/IGCM_OUT |
---|
| 198 | |
---|
| 199 | IGCM_debug_Print 1 "R_OUT has been defined = ${R_OUT}" |
---|
| 200 | IGCM_debug_Print 1 "R_BUF has been defined = ${R_BUF}" |
---|
| 201 | IGCM_debug_Print 1 "R_FIG has been defined = ${R_FIG}" |
---|
| 202 | |
---|
| 203 | IGCM_debug_PopStack "IGCM_sys_defineArchives" |
---|
[725] | 204 | } |
---|
| 205 | |
---|
| 206 | #D-#================================================== |
---|
[428] | 207 | #D-function IGCM_sys_RshMaster |
---|
| 208 | #D-* Purpose: Just a fake command to wrapp |
---|
| 209 | #D- IGCM_card call in post-treatment |
---|
| 210 | #D- Ulam do not see brodie filesystem |
---|
| 211 | #D- Cesium do not see all mercure filesystem |
---|
| 212 | #D- That's why we need this hack. |
---|
| 213 | #D-* Examples: |
---|
| 214 | #D- |
---|
| 215 | function IGCM_sys_RshMaster { |
---|
[810] | 216 | IGCM_debug_PushStack "IGCM_sys_RshMaster" $@ |
---|
| 217 | /bin/ksh <<-EOF |
---|
| 218 | export libIGCM=${libIGCM} |
---|
| 219 | export DEBUG_debug=${DEBUG_debug} |
---|
| 220 | . ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh |
---|
| 221 | . ${libIGCM}/libIGCM_card/libIGCM_card.ksh |
---|
[428] | 222 | ${@} |
---|
| 223 | EOF |
---|
[810] | 224 | if [ $? -gt 0 ] ; then |
---|
| 225 | echo "IGCM_sys_RshMaster : erreur." |
---|
| 226 | IGCM_debug_Exit "IGCM_sys_RshMaster" |
---|
| 227 | fi |
---|
| 228 | IGCM_debug_PopStack "IGCM_sys_RshMaster" |
---|
[428] | 229 | } |
---|
| 230 | |
---|
| 231 | #D-#================================================== |
---|
| 232 | #D-function IGCM_sys_RshArchive |
---|
| 233 | #D-* Purpose: Archive rsh command |
---|
| 234 | #D-* Examples: |
---|
| 235 | #D- |
---|
| 236 | function IGCM_sys_RshArchive { |
---|
[810] | 237 | IGCM_debug_PushStack "IGCM_sys_RshArchive" $@ |
---|
[811] | 238 | /bin/ksh <<-EOF |
---|
[428] | 239 | ${@} |
---|
| 240 | EOF |
---|
[811] | 241 | status=$? |
---|
[810] | 242 | if [ ${status} -gt 0 ] ; then |
---|
| 243 | IGCM_debug_Print 2 "IGCM_sys_RshArchive : command failed error code ${status}" |
---|
| 244 | IGCM_debug_Exit "IGCM_sys_RshArchive" |
---|
| 245 | fi |
---|
| 246 | IGCM_debug_PopStack "IGCM_sys_RshArchive" |
---|
[428] | 247 | } |
---|
| 248 | |
---|
| 249 | #D-#================================================== |
---|
| 250 | #D-function IGCM_sys_RshPost |
---|
| 251 | #D-* Purpose: Post-process rsh command |
---|
| 252 | #D-* Examples: |
---|
| 253 | #D- |
---|
| 254 | function IGCM_sys_RshPost { |
---|
[810] | 255 | IGCM_debug_PushStack "IGCM_sys_RshPost" $@ |
---|
| 256 | if ( $DEBUG_sys ) ; then |
---|
| 257 | echo "IGCM_sys_RshPost :" $@ |
---|
| 258 | fi |
---|
| 259 | |
---|
| 260 | # keep standard input to keep it for postpone if ulam don't answer |
---|
| 261 | cat >/tmp/tmp_IGCM_sys_RshPost_$$_${LOGNAME} |
---|
| 262 | |
---|
| 263 | /bin/ksh </tmp/tmp_IGCM_sys_RshPost_$$_${LOGNAME} |
---|
| 264 | if [ $? -gt 0 ] ; then |
---|
| 265 | echo "IGCM_sys_RshPost : erreur." |
---|
| 266 | IGCM_debug_Exit "IGCM_sys_RshPost" |
---|
| 267 | fi |
---|
| 268 | # delete temporary file |
---|
| 269 | \rm /tmp/tmp_IGCM_sys_RshPost_$$_${LOGNAME} |
---|
| 270 | |
---|
| 271 | IGCM_debug_PopStack "IGCM_sys_RshPost" |
---|
[428] | 272 | } |
---|
| 273 | |
---|
| 274 | #D-#================================================== |
---|
| 275 | #D-function IGCM_sys_SendMail |
---|
| 276 | #D-* Purpose: Send mail when simulation is over |
---|
| 277 | #D-* Examples: |
---|
| 278 | #D- |
---|
| 279 | function IGCM_sys_SendMail { |
---|
[810] | 280 | IGCM_debug_PushStack "IGCM_sys_SendMail" $@ |
---|
| 281 | if ( $DEBUG_sys ) ; then |
---|
| 282 | echo "IGCM_sys_SendMail :" $@ |
---|
| 283 | fi |
---|
[437] | 284 | |
---|
[922] | 285 | if [ X${1} = XAccounting ] ; then |
---|
| 286 | status=Accounting |
---|
| 287 | mailText=jobAccounting.mail |
---|
| 288 | elif ( ${ExitFlag} ) ; then |
---|
[810] | 289 | status=failed |
---|
[922] | 290 | mailText=jobEnd.mail |
---|
[810] | 291 | else |
---|
| 292 | status=completed |
---|
[922] | 293 | mailText=jobEnd.mail |
---|
[810] | 294 | fi |
---|
| 295 | |
---|
[922] | 296 | # Update selected mail template |
---|
| 297 | while read -r line; do |
---|
| 298 | eval echo $line >> mail.txt ; |
---|
| 299 | done < ${libIGCM}/libIGCM_sys/${mailText} |
---|
[437] | 300 | |
---|
[810] | 301 | if [ ! -z ${config_UserChoices_MailName} ] ; then |
---|
[922] | 302 | mailx -s "${config_UserChoices_JobName} ${status}" ${config_UserChoices_MailName} < mail.txt |
---|
[810] | 303 | elif [ -f ~/.forward ] ; then |
---|
[922] | 304 | mailx -s "${config_UserChoices_JobName} ${status}" $( cat ~/.forward ) < mail.txt |
---|
[810] | 305 | else |
---|
[922] | 306 | mailx -s "${config_UserChoices_JobName} ${status}" ${USER} < mail.txt |
---|
[810] | 307 | fi |
---|
[428] | 308 | |
---|
[810] | 309 | sleep 10 |
---|
[922] | 310 | rm -f mail.txt |
---|
[810] | 311 | |
---|
| 312 | IGCM_debug_PopStack "IGCM_sys_SendMail" |
---|
[428] | 313 | } |
---|
| 314 | |
---|
| 315 | #D-#================================================== |
---|
| 316 | #D-function IGCM_sys_Mkdir |
---|
| 317 | #D-* Purpose: Master locale mkdir command |
---|
| 318 | #D-* Examples: |
---|
| 319 | #D- |
---|
| 320 | function IGCM_sys_Mkdir { |
---|
[810] | 321 | IGCM_debug_PushStack "IGCM_sys_Mkdir" $@ |
---|
| 322 | if ( $DEBUG_sys ) ; then |
---|
| 323 | echo "IGCM_sys_Mkdir :" $@ |
---|
| 324 | fi |
---|
| 325 | if [ ! -d ${1} ]; then |
---|
| 326 | \mkdir -p $1 |
---|
| 327 | if [ $? -gt 0 ] ; then |
---|
[786] | 328 | echo "IGCM_sys_Mkdir : erreur." |
---|
| 329 | IGCM_debug_Exit "IGCM_sys_Mkdir" |
---|
[428] | 330 | fi |
---|
[810] | 331 | fi |
---|
| 332 | # vérification : |
---|
| 333 | if [ ! -d ${1} ] ; then |
---|
| 334 | echo "IGCM_sys_Mkdir : erreur." |
---|
| 335 | IGCM_debug_Exit "IGCM_sys_Mkdir" |
---|
| 336 | fi |
---|
| 337 | IGCM_debug_PopStack "IGCM_sys_Mkdir" |
---|
[428] | 338 | } |
---|
| 339 | |
---|
| 340 | #D-#================================================== |
---|
| 341 | #D-function IGCM_sys_MkdirArchive |
---|
| 342 | #D-* Purpose: Mkdir on Archive |
---|
| 343 | #D-* Examples: |
---|
| 344 | #D- |
---|
| 345 | function IGCM_sys_MkdirArchive { |
---|
[810] | 346 | IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@ |
---|
| 347 | if ( $DEBUG_sys ) ; then |
---|
| 348 | echo "IGCM_sys_MkdirArchive :" $@ |
---|
| 349 | fi |
---|
| 350 | #- creation de repertoire sur le serveur fichier |
---|
| 351 | mkdir -p $1 |
---|
| 352 | status=$? |
---|
[428] | 353 | |
---|
[810] | 354 | if [ ${status} -gt 0 ] ; then |
---|
| 355 | IGCM_debug_Print 2 "IGCM_sys_MkdirArchive : mkdir failed error code ${status}" |
---|
| 356 | IGCM_debug_Exit "IGCM_sys_MkdirArchive" |
---|
| 357 | fi |
---|
| 358 | IGCM_debug_PopStack "IGCM_sys_MkdirArchive" |
---|
[428] | 359 | } |
---|
| 360 | |
---|
| 361 | #D-#================================================== |
---|
| 362 | #D-function IGCM_sys_MkdirWork |
---|
| 363 | #D-* Purpose: Mkdir on Work |
---|
| 364 | #D-* Examples: |
---|
| 365 | #D- |
---|
| 366 | function IGCM_sys_MkdirWork { |
---|
[810] | 367 | IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@ |
---|
| 368 | if ( $DEBUG_sys ) ; then |
---|
| 369 | echo "IGCM_sys_MkdirWork :" $@ |
---|
| 370 | fi |
---|
| 371 | #- creation de repertoire sur le serveur fichier |
---|
| 372 | if [ ! -d ${1} ]; then |
---|
| 373 | \mkdir -p $1 |
---|
| 374 | if [ $? -gt 0 ] ; then |
---|
| 375 | echo "IGCM_sys_MkdirWork : erreur." |
---|
| 376 | IGCM_debug_Exit "IGCM_sys_MkdirWork" |
---|
[428] | 377 | fi |
---|
[810] | 378 | fi |
---|
| 379 | IGCM_debug_PopStack "IGCM_sys_MkdirWork" |
---|
[428] | 380 | } |
---|
| 381 | |
---|
| 382 | #D-#================================================== |
---|
| 383 | #D-function IGCM_sys_Cd |
---|
| 384 | #D-* Purpose: master cd command |
---|
| 385 | #D-* Examples: |
---|
| 386 | #D- |
---|
| 387 | function IGCM_sys_Cd { |
---|
[810] | 388 | IGCM_debug_PushStack "IGCM_sys_Cd" $@ |
---|
| 389 | if ( $DEBUG_sys ) ; then |
---|
| 390 | echo "IGCM_sys_Cd :" $@ |
---|
| 391 | fi |
---|
| 392 | \cd $1 |
---|
| 393 | if [ $? -gt 0 ] ; then |
---|
| 394 | echo "IGCM_sys_Cd : erreur." |
---|
| 395 | IGCM_debug_Exit "IGCM_sys_Cd" |
---|
| 396 | fi |
---|
| 397 | IGCM_debug_PopStack "IGCM_sys_Cd" |
---|
[428] | 398 | } |
---|
| 399 | |
---|
| 400 | #D-#================================================== |
---|
| 401 | #D-function IGCM_sys_Chmod |
---|
| 402 | #D-* Purpose: Chmod |
---|
| 403 | #D-* Examples: |
---|
| 404 | #D- |
---|
| 405 | function IGCM_sys_Chmod { |
---|
[1057] | 406 | IGCM_debug_PushStack "IGCM_sys_Chmod" $@ |
---|
[810] | 407 | if ( $DEBUG_sys ) ; then |
---|
| 408 | echo "IGCM_sys_Chmod :" $@ |
---|
| 409 | fi |
---|
| 410 | \chmod $@ |
---|
| 411 | if [ $? -gt 0 ] ; then |
---|
| 412 | echo "IGCM_sys_Chmod : erreur." |
---|
| 413 | IGCM_debug_Exit "IGCM_sys_Chmod" |
---|
| 414 | fi |
---|
| 415 | IGCM_debug_PopStack "IGCM_sys_Chmod" |
---|
[428] | 416 | } |
---|
| 417 | |
---|
| 418 | #D-#================================================== |
---|
| 419 | #D-function IGCM_sys_FileSize |
---|
| 420 | #D-* Purpose: Filesize |
---|
| 421 | #D-* Examples: |
---|
| 422 | #D- |
---|
| 423 | function IGCM_sys_FileSize { |
---|
[810] | 424 | IGCM_debug_PushStack "IGCM_sys_FileSize" $@ |
---|
[428] | 425 | |
---|
[810] | 426 | typeset sizeF |
---|
| 427 | set +A sizeF -- $( ls -la ${1} ) |
---|
| 428 | if [ $? -gt 0 ] ; then |
---|
| 429 | IGCM_debug_Exit "IGCM_sys_FileSize" |
---|
| 430 | fi |
---|
| 431 | eval ${2}=${sizeF[4]} |
---|
[428] | 432 | |
---|
[810] | 433 | IGCM_debug_PopStack "IGCM_sys_FileSize" |
---|
[428] | 434 | } |
---|
| 435 | |
---|
| 436 | #D-#================================================== |
---|
| 437 | #D-function IGCM_sys_TestDir |
---|
| 438 | #D-* Purpose: Test Directory that must exists |
---|
| 439 | #D-* Examples: |
---|
| 440 | #D- |
---|
| 441 | function IGCM_sys_TestDir { |
---|
[810] | 442 | IGCM_debug_PushStack "IGCM_sys_TestDir" $@ |
---|
| 443 | if ( $DEBUG_sys ) ; then |
---|
| 444 | echo "IGCM_sys_TestDir :" $@ |
---|
| 445 | fi |
---|
| 446 | typeset ExistFlag |
---|
| 447 | ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 ) |
---|
| 448 | IGCM_debug_PopStack "IGCM_sys_TestDir" |
---|
[428] | 449 | |
---|
[810] | 450 | return ${ExistFlag} |
---|
[428] | 451 | } |
---|
| 452 | |
---|
| 453 | #D-#================================================== |
---|
| 454 | #D-function IGCM_sys_TestDirArchive |
---|
| 455 | #D-* Purpose: Test Directory that must exists on Archive |
---|
| 456 | #D-* Examples: |
---|
| 457 | #D- |
---|
| 458 | function IGCM_sys_TestDirArchive { |
---|
[810] | 459 | IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@ |
---|
| 460 | if ( $DEBUG_sys ) ; then |
---|
| 461 | echo "IGCM_sys_TestDirArchive :" $@ |
---|
| 462 | fi |
---|
| 463 | typeset ExistFlag |
---|
| 464 | ExistFlag=$( IGCM_sys_RshArchive "[ -d $1 ] && echo 0 || echo 1" ) |
---|
| 465 | IGCM_debug_PopStack "IGCM_sys_TestDirArchive" |
---|
| 466 | return ${ExistFlag} |
---|
| 467 | } |
---|
[428] | 468 | |
---|
[810] | 469 | #D-#================================================== |
---|
| 470 | #D-function IGCM_sys_IsFileArchived |
---|
| 471 | #D-* Purpose: Test file that must NOT EXISTS on Archive |
---|
| 472 | #D-* Examples: |
---|
| 473 | #D- |
---|
| 474 | function IGCM_sys_IsFileArchived { |
---|
| 475 | IGCM_debug_PushStack "IGCM_sys_IsFileArchived" $@ |
---|
| 476 | if ( $DEBUG_sys ) ; then |
---|
| 477 | echo "IGCM_sys_IsFileArchived :" $@ |
---|
| 478 | fi |
---|
| 479 | typeset IsArchivedFlag |
---|
[818] | 480 | IsArchivedFlag=$( [ "X$( echo $@ | grep \/gpfs3 )" != "X" ] && echo 0 || echo 1 ) |
---|
[810] | 481 | IGCM_debug_PopStack "IGCM_sys_IsFileArchived" |
---|
| 482 | |
---|
| 483 | return ${IsArchivedFlag} |
---|
[428] | 484 | } |
---|
| 485 | |
---|
| 486 | #D-#================================================== |
---|
| 487 | #D-function IGCM_sys_TestFileArchive |
---|
| 488 | #D-* Purpose: Test file that must NOT EXISTS on Archive |
---|
| 489 | #D-* Examples: |
---|
| 490 | #D- |
---|
| 491 | function IGCM_sys_TestFileArchive { |
---|
[810] | 492 | IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@ |
---|
| 493 | typeset ExistFlag |
---|
| 494 | ExistFlag=$( IGCM_sys_RshArchive "[ -f $1 ] && echo 0 || echo 1" ) |
---|
| 495 | IGCM_debug_PopStack "IGCM_sys_TestFileArchive" |
---|
[428] | 496 | |
---|
[810] | 497 | return ${ExistFlag} |
---|
[428] | 498 | } |
---|
| 499 | |
---|
| 500 | #D-#================================================== |
---|
[810] | 501 | #D-function IGCM_sys_TestFileBuffer |
---|
| 502 | #D-* Purpose: Test file that must NOT EXISTS on Buffer |
---|
| 503 | #D-* Examples: |
---|
| 504 | #D- |
---|
| 505 | function IGCM_sys_TestFileBuffer { |
---|
| 506 | IGCM_debug_PushStack "IGCM_sys_TestFileBuffer" $@ |
---|
| 507 | typeset ExistFlag |
---|
| 508 | ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 ) |
---|
| 509 | IGCM_debug_PopStack "IGCM_sys_TestFileBuffer" |
---|
| 510 | |
---|
| 511 | return ${ExistFlag} |
---|
| 512 | } |
---|
| 513 | |
---|
| 514 | #D-#================================================== |
---|
[428] | 515 | #D-function IGCM_sys_CountFileArchive |
---|
| 516 | #D-* Purpose: Count files on Archive filesystem |
---|
| 517 | #D-* Examples: |
---|
| 518 | #D- |
---|
| 519 | function IGCM_sys_CountFileArchive { |
---|
[810] | 520 | IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@ |
---|
| 521 | #Command depends on targeted file system |
---|
| 522 | DEBUG_sys=false IGCM_sys_IsFileArchived $1 |
---|
| 523 | if [ $? = 0 ] ; then |
---|
[428] | 524 | IGCM_sys_RshArchive "ls ${@} 2>/dev/null | wc -l" |
---|
[810] | 525 | status=$? |
---|
| 526 | else |
---|
| 527 | ls ${@} 2>/dev/null | wc -l |
---|
| 528 | status=$? |
---|
| 529 | fi |
---|
| 530 | if [ ${status} -gt 0 ] ; then |
---|
| 531 | echo "IGCM_sys_CountFileArchive : erreur." |
---|
| 532 | fi |
---|
| 533 | IGCM_debug_PopStack "IGCM_sys_CountFileArchive" |
---|
[428] | 534 | } |
---|
| 535 | |
---|
| 536 | #D-#================================================== |
---|
[810] | 537 | #D-function IGCM_sys_CountFileBuffer |
---|
| 538 | #D-* Purpose: Count files on Scratch filesystem |
---|
| 539 | #D-* Examples: |
---|
| 540 | #D- |
---|
| 541 | function IGCM_sys_CountFileBuffer { |
---|
| 542 | IGCM_debug_PushStack "IGCM_sys_CountFileBuffer" $@ |
---|
| 543 | ls ${@} 2>/dev/null | wc -l |
---|
| 544 | if [ $? -gt 0 ] ; then |
---|
| 545 | echo "IGCM_sys_CountFileBuffer : erreur." |
---|
| 546 | fi |
---|
| 547 | IGCM_debug_PopStack "IGCM_sys_CountFileBuffer" |
---|
| 548 | } |
---|
| 549 | |
---|
| 550 | #D-#================================================== |
---|
[428] | 551 | #D-function IGCM_sys_Tree |
---|
| 552 | #D-* Purpose: Tree directories with files on ${ARCHIVE} |
---|
| 553 | #D-* Examples: IGCM_sys_Tree ${R_IN} ${R_OUT} |
---|
| 554 | #D- |
---|
| 555 | function IGCM_sys_Tree { |
---|
[810] | 556 | IGCM_debug_PushStack "IGCM_sys_Tree" $@ |
---|
| 557 | if ( $DEBUG_sys ) ; then |
---|
| 558 | echo "IGCM_sys_Tree :" $@ |
---|
| 559 | fi |
---|
[428] | 560 | |
---|
[811] | 561 | \tree -f $@ |
---|
[428] | 562 | |
---|
[810] | 563 | IGCM_debug_PopStack "IGCM_sys_Tree" |
---|
[428] | 564 | } |
---|
| 565 | |
---|
| 566 | #D-#================================================== |
---|
| 567 | #D-function IGCM_sys_Tar |
---|
[810] | 568 | #D-* Purpose: master tar command |
---|
[428] | 569 | #D-* Examples: |
---|
| 570 | #D- |
---|
| 571 | function IGCM_sys_Tar { |
---|
[810] | 572 | IGCM_debug_PushStack "IGCM_sys_Tar" $@ |
---|
| 573 | if ( $DEBUG_sys ) ; then |
---|
| 574 | echo "IGCM_sys_Tar :" $@ |
---|
| 575 | fi |
---|
| 576 | \tar cf $@ |
---|
| 577 | if [ $? -gt 0 ] ; then |
---|
| 578 | echo "IGCM_sys_Tar : erreur." |
---|
| 579 | IGCM_debug_Exit "IGCM_sys_Tar" |
---|
| 580 | fi |
---|
| 581 | IGCM_debug_PopStack "IGCM_sys_Tar" |
---|
[428] | 582 | } |
---|
| 583 | |
---|
| 584 | #D-#================================================== |
---|
| 585 | #D-function IGCM_sys_UnTar |
---|
| 586 | #D-* Purpose: master un-tar command |
---|
| 587 | #D-* Examples: |
---|
| 588 | #D- |
---|
| 589 | function IGCM_sys_UnTar { |
---|
[810] | 590 | IGCM_debug_PushStack "IGCM_sys_UnTar" $@ |
---|
| 591 | if ( $DEBUG_sys ) ; then |
---|
| 592 | echo "IGCM_sys_UnTar :" $@ |
---|
| 593 | fi |
---|
| 594 | \tar xvf $1 |
---|
| 595 | if [ $? -gt 0 ] ; then |
---|
| 596 | echo "IGCM_sys_UnTar : erreur." |
---|
| 597 | IGCM_debug_Exit "IGCM_sys_UnTar" |
---|
| 598 | fi |
---|
| 599 | IGCM_debug_PopStack "IGCM_sys_UnTar" |
---|
[428] | 600 | } |
---|
| 601 | |
---|
| 602 | #D-#================================================== |
---|
| 603 | #D-function IGCM_sys_Qsub |
---|
| 604 | #D-* Purpose: Qsub new job |
---|
| 605 | #D-* Examples: |
---|
| 606 | #D- |
---|
| 607 | function IGCM_sys_Qsub { |
---|
[810] | 608 | IGCM_debug_PushStack "IGCM_sys_Qsub" $@ |
---|
| 609 | |
---|
[811] | 610 | typeset status |
---|
[810] | 611 | |
---|
| 612 | if ( $DEBUG_sys ) ; then |
---|
| 613 | echo "IGCM_sys_Qsub :" $@ |
---|
| 614 | fi |
---|
| 615 | # We have to change output/error file |
---|
| 616 | [ ${#@} = 1 ] && REP_FOR_JOB=${SUBMIT_DIR} |
---|
| 617 | [ ${#@} = 2 ] && REP_FOR_JOB=${2} |
---|
| 618 | sed -e "s:\# \@ output *= .*:\# \@ output = ${Script_Output}:" \ |
---|
[811] | 619 | -e "s:\# \@ error *= .*:\# \@ error = ${Script_Output}:" \ |
---|
| 620 | $1 > ${REP_FOR_JOB}/JOB_FOR_IGCM |
---|
[948] | 621 | cd $REP_FOR_JOB ; /usr/lpp/LoadL/full/bin/llsubmit JOB_FOR_IGCM > /tmp/out_command.$$ 2>&1 ; status=$? ; cd - ; |
---|
[810] | 622 | |
---|
[948] | 623 | cat /tmp/out_command.$$ |
---|
[811] | 624 | if [ ${status} -gt 0 ] ; then |
---|
| 625 | IGCM_debug_Print 2 "IGCM_sys_Qsub $1 : error code ${status}" |
---|
[810] | 626 | IGCM_debug_Exit "IGCM_sys_Qsub" |
---|
| 627 | else |
---|
[948] | 628 | JobID=$( gawk {'print $4'} /tmp/out_command.$$ | tail -1 | sed -e s/\"//g ) |
---|
[810] | 629 | IGCM_sys_Rm ${REP_FOR_JOB}/JOB_FOR_IGCM |
---|
| 630 | fi |
---|
| 631 | IGCM_debug_PopStack "IGCM_sys_Qsub" |
---|
[428] | 632 | } |
---|
| 633 | |
---|
| 634 | #D-#================================================== |
---|
| 635 | #D-function IGCM_sys_QsubPost |
---|
| 636 | #D-* Purpose: Qsub new job on scalaire |
---|
| 637 | #D-* Examples: |
---|
| 638 | #D- |
---|
| 639 | function IGCM_sys_QsubPost { |
---|
[810] | 640 | IGCM_debug_PushStack "IGCM_sys_QsubPost" $@ |
---|
| 641 | |
---|
[811] | 642 | typeset status |
---|
[810] | 643 | |
---|
| 644 | if ( $DEBUG_sys ) ; then |
---|
| 645 | echo "IGCM_sys_QsubPost :" $@ |
---|
| 646 | fi |
---|
| 647 | # We have to change output/error file |
---|
| 648 | [ ${#@} = 1 ] && REP_FOR_JOB=${POST_DIR} |
---|
| 649 | [ ${#@} = 2 ] && REP_FOR_JOB=${2} |
---|
| 650 | |
---|
| 651 | sed -e "s:\# \@ output *= .*:\# \@ output = ${Script_Post_Output}.out:" \ |
---|
[811] | 652 | -e "s:\# \@ error *= .*:\# \@ error = ${Script_Post_Output}.out:" \ |
---|
| 653 | ${libIGCM_POST}/$1.job > ${REP_FOR_JOB}/JOB_FOR_IGCM |
---|
[810] | 654 | |
---|
[948] | 655 | cd $REP_FOR_JOB ; /usr/lpp/LoadL/full/bin/llsubmit JOB_FOR_IGCM > /tmp/out_command.$$ 2>&1 ; status=$? ; cd - ; |
---|
| 656 | |
---|
| 657 | cat /tmp/out_command.$$ |
---|
[811] | 658 | if [ ${status} -gt 0 ] ; then |
---|
| 659 | IGCM_debug_Print 2 "IGCM_sys_QsubPost $1 : error code ${status}" |
---|
[810] | 660 | IGCM_debug_Exit "IGCM_sys_QsubPost" |
---|
| 661 | else |
---|
[948] | 662 | JobID=$( gawk {'print $4'} /tmp/out_command.$$ | tail -1 | sed -e s/\"//g ) |
---|
[810] | 663 | IGCM_sys_Rm ${REP_FOR_JOB}/JOB_FOR_IGCM |
---|
| 664 | fi |
---|
| 665 | IGCM_debug_PopStack "IGCM_sys_QsubPost" |
---|
[428] | 666 | } |
---|
| 667 | |
---|
| 668 | #D-************************* |
---|
[809] | 669 | #D- File transfer functions |
---|
[428] | 670 | #D-************************* |
---|
| 671 | #D- |
---|
| 672 | |
---|
| 673 | #D-#================================================== |
---|
| 674 | #D-function IGCM_sys_Rsync_out |
---|
| 675 | #D-* Purpose: treat return val of rsync |
---|
| 676 | #D-* Examples: IGCM_sys_Rsync_out out_RET_rsync |
---|
| 677 | #D- Error values and explanations can depend on your system version. |
---|
| 678 | function IGCM_sys_Rsync_out { |
---|
[810] | 679 | status=$1 |
---|
| 680 | if [ ! $status ] ; then |
---|
| 681 | echo "rsync error !" |
---|
| 682 | fi |
---|
[428] | 683 | |
---|
[810] | 684 | if [ $MYLANG = "fr" ]; then |
---|
| 685 | case $status in |
---|
| 686 | 0) return ;; |
---|
| 687 | 1) echo "Erreur de rsync ; RERR_SYNTAX : " |
---|
| 688 | echo "Erreur de syntaxe ou d'utilisation." |
---|
| 689 | return;; |
---|
| 690 | 2) echo "Erreur de rsync ; RERR_PROTOCOL : " |
---|
| 691 | echo "Incompatibilité de protocole." |
---|
| 692 | return;; |
---|
| 693 | 3) echo "Erreur de rsync ; RERR_FILESELECT 3" |
---|
| 694 | echo "Erreurs lors de la sélection des fichiers d'entrée sortie et" |
---|
| 695 | echo "répertoires" |
---|
| 696 | return;; |
---|
| 697 | 4) echo "Erreur de rsync ; RERR_UNSUPPORTED" |
---|
| 698 | echo "Action demandée non supportée : une tentative de manipulation de" |
---|
| 699 | echo "fichiers 64-bits sur une plate-forme qui ne les supporte pas a" |
---|
| 700 | echo "été faite ; ou une option qui est supportée par le client mais" |
---|
| 701 | echo "pas par le serveur a été spécifiée." |
---|
| 702 | return;; |
---|
| 703 | 10) echo "Erreur de rsync ; RERR_SOCKETIO" |
---|
| 704 | echo "Erreur dans le socket d'entrée sortie" |
---|
| 705 | return;; |
---|
| 706 | 11) echo "Erreur de rsync ; RERR_FILEIO" |
---|
| 707 | echo "Erreur d'entrée sortie fichier" |
---|
| 708 | return;; |
---|
| 709 | 12) echo "Erreur de rsync ; RERR_STREAMIO" |
---|
| 710 | echo "Erreur dans flux de donnée du protocole rsync" |
---|
| 711 | return;; |
---|
| 712 | 13) echo "Erreur de rsync ; RERR_MESSAGEIO" |
---|
| 713 | echo "Erreur avec les diagnostics du programme" |
---|
| 714 | return;; |
---|
| 715 | 14) echo "Erreur de rsync ; RERR_IPC" |
---|
| 716 | echo "Erreur dans le code IPC" |
---|
| 717 | return;; |
---|
| 718 | 20) echo "Erreur de rsync ; RERR_SIGNAL" |
---|
| 719 | echo "SIGUSR1 ou SIGINT reçu" |
---|
| 720 | return;; |
---|
| 721 | 21) echo "Erreur de rsync ; RERR_WAITCHILD" |
---|
| 722 | echo "Une erreur retournée par waitpid()" |
---|
| 723 | return;; |
---|
| 724 | 22) echo "Erreur de rsync ; RERR_MALLOC" |
---|
| 725 | echo "Erreur lors de l'allocation des tampons de mémoire de coeur" |
---|
| 726 | return;; |
---|
| 727 | 23) echo "" |
---|
| 728 | echo "Erreur fichier inexistant" |
---|
| 729 | return;; |
---|
| 730 | 30) echo "Erreur de rsync ; RERR_TIMEOUT" |
---|
| 731 | echo "Temps d'attente écoulé dans l'envoi/réception de données" |
---|
| 732 | return;; |
---|
| 733 | *) echo "Erreur de rsync : code de retour de rsync inconnu :" $status |
---|
| 734 | return;; |
---|
| 735 | esac |
---|
| 736 | elif [ $MYLANG = "en" ] ; then |
---|
| 737 | case $status in |
---|
| 738 | 0) return;; |
---|
| 739 | 1) echo "rsync error : Syntax or usage error " |
---|
| 740 | return;; |
---|
| 741 | 2) echo "rsync error : Protocol incompatibility " |
---|
| 742 | return;; |
---|
| 743 | 3) echo "rsync error : Errors selecting input/output files, dirs" |
---|
| 744 | return;; |
---|
| 745 | 4) echo "rsync error : Requested action not supported: an attempt" |
---|
| 746 | echo "was made to manipulate 64-bit files on a platform that cannot support" |
---|
| 747 | echo "them; or an option was specified that is supported by the client and" |
---|
| 748 | echo "not by the server." |
---|
| 749 | return;; |
---|
| 750 | 5) echo "rsync error : Error starting client-server protocol" |
---|
| 751 | return;; |
---|
| 752 | 10) echo "rsync error : Error in socket I/O " |
---|
| 753 | return;; |
---|
| 754 | 11) echo "rsync error : Error in file I/O " |
---|
| 755 | return;; |
---|
| 756 | 12) echo "rsync error : Error in rsync protocol data stream " |
---|
| 757 | return;; |
---|
| 758 | 13) echo "rsync error : Errors with program diagnostics " |
---|
| 759 | return;; |
---|
| 760 | 14) echo "rsync error : Error in IPC code " |
---|
| 761 | return;; |
---|
| 762 | 20) echo "rsync error : Received SIGUSR1 or SIGINT " |
---|
| 763 | return;; |
---|
| 764 | 21) echo "rsync error : Some error returned by waitpid() " |
---|
| 765 | return;; |
---|
| 766 | 22) echo "rsync error : Error allocating core memory buffers " |
---|
| 767 | return;; |
---|
| 768 | 23) echo "rsync error : Partial transfer due to error" |
---|
| 769 | return;; |
---|
| 770 | 24) echo "rsync error : Partial transfer due to vanished source files" |
---|
| 771 | return;; |
---|
| 772 | 30) echo "rsync error : Timeout in data send/receive " |
---|
| 773 | return;; |
---|
| 774 | *) echo "rsync error : return code of rsync unknown :" $status |
---|
| 775 | return;; |
---|
| 776 | esac |
---|
| 777 | else |
---|
| 778 | echo "unknown language $MYLANG." |
---|
| 779 | return |
---|
| 780 | fi |
---|
[428] | 781 | } |
---|
| 782 | |
---|
| 783 | #D-#================================================== |
---|
[810] | 784 | #D-function IGCM_sys_Miror_libIGCM |
---|
| 785 | #D-* Purpose: Mirror libIGCM PATH and lib to frontend |
---|
| 786 | #D-* Examples: |
---|
| 787 | #D- |
---|
| 788 | function IGCM_sys_Mirror_libIGCM { |
---|
| 789 | IGCM_debug_PushStack "IGCM_sys_Mirror_libIGCM" |
---|
| 790 | if ( $DEBUG_sys ) ; then |
---|
| 791 | echo "IGCM_sys_Mirror_libIGCM" |
---|
| 792 | fi |
---|
| 793 | |
---|
| 794 | typeset status |
---|
| 795 | |
---|
| 796 | mkdir -p ${HOME}/MIRROR/${PATHlibIGCM} |
---|
| 797 | |
---|
[938] | 798 | echo ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} > /tmp/out_command.$$ 2>&1 |
---|
| 799 | ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} >> /tmp/out_command.$$ 2>&1 |
---|
[810] | 800 | status=$? |
---|
| 801 | |
---|
| 802 | if [ ${status} -gt 0 ] ; then |
---|
| 803 | echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on frontend." |
---|
[938] | 804 | cat /tmp/out_command.$$ |
---|
[810] | 805 | fi |
---|
| 806 | IGCM_debug_PopStack "IGCM_sys_Mirror_libIGCM" |
---|
| 807 | } |
---|
| 808 | |
---|
| 809 | #D-#================================================== |
---|
[428] | 810 | #D-function IGCM_sys_Cp |
---|
| 811 | #D-* Purpose: generic cp |
---|
| 812 | #D-* Examples: |
---|
| 813 | #D- |
---|
| 814 | function IGCM_sys_Cp { |
---|
[810] | 815 | IGCM_debug_PushStack "IGCM_sys_Cp" $@ |
---|
| 816 | if ( $DEBUG_sys ) ; then |
---|
| 817 | echo "IGCM_sys_Cp :" $@ |
---|
| 818 | fi |
---|
[428] | 819 | |
---|
[810] | 820 | typeset status |
---|
[428] | 821 | |
---|
[938] | 822 | echo cp $@ > /tmp/out_command.$$ 2>&1 |
---|
| 823 | \cp $@ >> /tmp/out_command.$$ 2>&1 |
---|
[810] | 824 | status=$? |
---|
[428] | 825 | |
---|
[810] | 826 | if [ ${status} -gt 0 ] ; then |
---|
| 827 | echo "IGCM_sys_Cp : error code ${status}" |
---|
[938] | 828 | cat /tmp/out_command.$$ |
---|
[810] | 829 | IGCM_debug_Exit "IGCM_sys_Cp" |
---|
| 830 | else |
---|
[938] | 831 | \rm /tmp/out_command.$$ |
---|
[810] | 832 | fi |
---|
| 833 | IGCM_debug_PopStack "IGCM_sys_Cp" |
---|
[428] | 834 | } |
---|
| 835 | |
---|
| 836 | #D-#================================================== |
---|
| 837 | #D-function IGCM_sys_Rm |
---|
| 838 | #D-* Purpose: generic rm |
---|
| 839 | #D-* Examples: |
---|
| 840 | #D- |
---|
| 841 | function IGCM_sys_Rm { |
---|
[1057] | 842 | IGCM_debug_PushStack "IGCM_sys_Rm" $@ |
---|
[810] | 843 | if ( $DEBUG_sys ) ; then |
---|
| 844 | echo "IGCM_sys_Rm :" $@ |
---|
| 845 | fi |
---|
[428] | 846 | |
---|
[810] | 847 | typeset status |
---|
[428] | 848 | |
---|
[938] | 849 | echo rm $@ > /tmp/out_command.$$ 2>&1 |
---|
| 850 | \rm $@ >> /tmp/out_command.$$ 2>&1 |
---|
[810] | 851 | status=$? |
---|
[428] | 852 | |
---|
[810] | 853 | if [ ${status} -gt 0 ] ; then |
---|
| 854 | echo "IGCM_sys_Rm : error code ${status}" |
---|
[938] | 855 | cat /tmp/out_command.$$ |
---|
[810] | 856 | IGCM_debug_Exit "IGCM_sys_Rm" |
---|
| 857 | else |
---|
[938] | 858 | \rm /tmp/out_command.$$ |
---|
[810] | 859 | fi |
---|
| 860 | IGCM_debug_PopStack "IGCM_sys_Rm" |
---|
[428] | 861 | } |
---|
| 862 | |
---|
| 863 | #D-#================================================== |
---|
| 864 | #D-function IGCM_sys_RmRunDir |
---|
| 865 | #D-* Purpose: rm tmpdir (dummy function most of the time batch |
---|
| 866 | #D- scheduler will do the job) |
---|
| 867 | #D-* Examples: |
---|
| 868 | #D- |
---|
| 869 | function IGCM_sys_RmRunDir { |
---|
[1057] | 870 | IGCM_debug_PushStack "IGCM_sys_RmRunDir" $@ |
---|
[810] | 871 | if ( $DEBUG_sys ) ; then |
---|
| 872 | echo "IGCM_sys_RmRunDir :" $@ |
---|
| 873 | fi |
---|
[428] | 874 | |
---|
[810] | 875 | typeset status |
---|
[428] | 876 | |
---|
[938] | 877 | echo rm $@ > /tmp/out_command.$$ 2>&1 |
---|
| 878 | \rm $@ >> /tmp/out_command.$$ 2>&1 |
---|
[810] | 879 | status=$? |
---|
[428] | 880 | |
---|
[810] | 881 | if [ ${status} -gt 0 ] ; then |
---|
| 882 | echo "IGCM_sys_RmRunDir : rm error code is ${status}." |
---|
[938] | 883 | cat /tmp/out_command.$$ |
---|
[810] | 884 | IGCM_debug_Exit "IGCM_sys_RmRunDir" |
---|
| 885 | else |
---|
[938] | 886 | \rm /tmp/out_command.$$ |
---|
[810] | 887 | fi |
---|
| 888 | IGCM_debug_PopStack "IGCM_sys_RmRunDir" |
---|
[428] | 889 | } |
---|
| 890 | |
---|
| 891 | #D-#================================================== |
---|
| 892 | #D-function IGCM_sys_Mv |
---|
| 893 | #D-* Purpose: generic move |
---|
| 894 | #D-* Examples: |
---|
| 895 | #D- |
---|
| 896 | function IGCM_sys_Mv { |
---|
[810] | 897 | IGCM_debug_PushStack "IGCM_sys_Mv" $@ |
---|
| 898 | if ( $DEBUG_sys ) ; then |
---|
| 899 | echo "IGCM_sys_Mv :" $@ |
---|
| 900 | fi |
---|
[428] | 901 | |
---|
[810] | 902 | if [ $DRYRUN = 0 ]; then |
---|
[428] | 903 | |
---|
[810] | 904 | typeset status |
---|
[786] | 905 | |
---|
[938] | 906 | echo mv $@ > /tmp/out_command.$$ 2>&1 |
---|
| 907 | \mv $@ >> /tmp/out_command.$$ 2>&1 |
---|
[810] | 908 | status=$? |
---|
[786] | 909 | |
---|
[810] | 910 | if [ ${status} -gt 0 ] ; then |
---|
| 911 | echo "IGCM_sys_Mv : error code ${status}" |
---|
[938] | 912 | cat /tmp/out_command.$$ |
---|
[810] | 913 | IGCM_debug_Exit "IGCM_sys_Mv" |
---|
[428] | 914 | else |
---|
[938] | 915 | \rm /tmp/out_command.$$ |
---|
[428] | 916 | fi |
---|
[810] | 917 | fi |
---|
[428] | 918 | |
---|
[810] | 919 | IGCM_debug_PopStack "IGCM_sys_Mv" |
---|
[428] | 920 | } |
---|
| 921 | |
---|
| 922 | #D-#================================================== |
---|
| 923 | #D-function IGCM_sys_Put_Dir |
---|
| 924 | #D-* Purpose: Copy a complete directory on $(ARCHIVE) |
---|
| 925 | #D-* Examples: |
---|
| 926 | #D- |
---|
| 927 | function IGCM_sys_Put_Dir { |
---|
[810] | 928 | IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@ |
---|
| 929 | if ( $DEBUG_sys ) ; then |
---|
| 930 | echo "IGCM_sys_Put_Dir :" $@ |
---|
| 931 | fi |
---|
| 932 | if [ $DRYRUN = 0 ]; then |
---|
| 933 | if [ ! -d ${1} ] ; then |
---|
| 934 | echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ." |
---|
| 935 | IGCM_debug_PopStack "IGCM_sys_Put_Dir" |
---|
| 936 | return |
---|
[428] | 937 | fi |
---|
| 938 | |
---|
[810] | 939 | typeset status |
---|
[428] | 940 | |
---|
[810] | 941 | # Only if we use rsync |
---|
| 942 | #IGCM_sys_TestDirArchive $( dirname $2 ) |
---|
| 943 | # |
---|
| 944 | #USUAL WAY |
---|
[938] | 945 | \cp -r $1 $2 > /tmp/out_command.$$ 2>&1 |
---|
[810] | 946 | status=$? |
---|
[428] | 947 | |
---|
[810] | 948 | if [ ${status} -gt 0 ] ; then |
---|
| 949 | IGCM_debug_Print 2 "IGCM_sys_Put_Dir : cp failed error code ${status}" |
---|
[938] | 950 | cat /tmp/out_command.$$ |
---|
[810] | 951 | IGCM_debug_Exit "IGCM_sys_Put_Dir" |
---|
[428] | 952 | else |
---|
[938] | 953 | \rm /tmp/out_command.$$ |
---|
[428] | 954 | fi |
---|
[810] | 955 | fi |
---|
| 956 | IGCM_debug_PopStack "IGCM_sys_Put_Dir" |
---|
[428] | 957 | } |
---|
| 958 | |
---|
| 959 | #D-#================================================== |
---|
| 960 | #D-function IGCM_sys_Get_Dir |
---|
[810] | 961 | #D-* Purpose: Copy a complete directory from ${ARCHIVE} |
---|
[428] | 962 | #D-* Examples: |
---|
| 963 | #D- |
---|
| 964 | function IGCM_sys_Get_Dir { |
---|
[810] | 965 | IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@ |
---|
| 966 | if ( $DEBUG_sys ) ; then |
---|
| 967 | echo "IGCM_sys_Get_Dir :" $@ |
---|
| 968 | fi |
---|
| 969 | if [ $DRYRUN = 0 ]; then |
---|
| 970 | if [ ! -d ${1} ] ; then |
---|
| 971 | echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ." |
---|
| 972 | IGCM_debug_PopStack "IGCM_sys_Get_Dir" |
---|
| 973 | return |
---|
[428] | 974 | fi |
---|
| 975 | |
---|
[810] | 976 | typeset status |
---|
[428] | 977 | |
---|
[811] | 978 | #USUAL WAY |
---|
[938] | 979 | \cp -ur $1 $2 > /tmp/out_command.$$ 2>&1 |
---|
[810] | 980 | status=$? |
---|
[428] | 981 | |
---|
[810] | 982 | if [ ${status} -gt 0 ] ; then |
---|
| 983 | IGCM_debug_Print 2 "IGCM_sys_Get_Dir : cp failed error code ${status}" |
---|
[938] | 984 | cat /tmp/out_command.$$ |
---|
[810] | 985 | IGCM_debug_Exit "IGCM_sys_Get_Dir" |
---|
[428] | 986 | else |
---|
[938] | 987 | \rm /tmp/out_command.$$ |
---|
[428] | 988 | fi |
---|
[810] | 989 | fi |
---|
| 990 | IGCM_debug_PopStack "IGCM_sys_Get_Dir" |
---|
[428] | 991 | } |
---|
| 992 | |
---|
| 993 | #D-#================================================== |
---|
| 994 | #D-function IGCM_sys_Get_Master |
---|
| 995 | #D-* Purpose: Copy a complete directory from MASTER filesystem |
---|
| 996 | #D-* Examples: |
---|
| 997 | #D- |
---|
| 998 | function IGCM_sys_Get_Master { |
---|
[810] | 999 | IGCM_debug_PushStack "IGCM_sys_Get_Master" $@ |
---|
| 1000 | if ( $DEBUG_sys ) ; then |
---|
| 1001 | echo "IGCM_sys_Get_Master :" $@ |
---|
| 1002 | fi |
---|
| 1003 | if [ $DRYRUN = 0 ]; then |
---|
| 1004 | if ( [ ! -d ${1} ] && [ ! -f ${1} ] ) ; then |
---|
| 1005 | echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ." |
---|
| 1006 | IGCM_debug_PopStack "IGCM_sys_Get_Master" |
---|
| 1007 | return |
---|
[428] | 1008 | fi |
---|
| 1009 | |
---|
[810] | 1010 | typeset NB_ESSAI DELAI status i |
---|
| 1011 | # number of tentative |
---|
| 1012 | NB_ESSAI=3 |
---|
| 1013 | # time delay between tentative |
---|
| 1014 | DELAI=2 |
---|
[428] | 1015 | |
---|
[810] | 1016 | i=0 |
---|
| 1017 | while [ $i -lt $NB_ESSAI ] ; do |
---|
[938] | 1018 | \cp -urL $1 $2 > /tmp/out_command.$$ 2>&1 |
---|
[810] | 1019 | status=$? |
---|
| 1020 | if [ ${status} -gt 0 ]; then |
---|
| 1021 | IGCM_debug_Print 2 "IGCM_sys_Get_Master : cp failed error code ${status} ${i}/${NB_ESSAI}" |
---|
| 1022 | IGCM_debug_Print 2 "IGCM_sys_Get_Master : sleep ${DELAI} seconds and try again." |
---|
| 1023 | sleep $DELAI |
---|
| 1024 | else |
---|
| 1025 | break |
---|
| 1026 | fi |
---|
| 1027 | (( i = i + 1 )) |
---|
| 1028 | done |
---|
[428] | 1029 | |
---|
[810] | 1030 | if [ ${status} -gt 0 ] ; then |
---|
| 1031 | echo "IGCM_sys_Get_Master : error." |
---|
[938] | 1032 | cat /tmp/out_command.$$ |
---|
[810] | 1033 | IGCM_debug_Exit "IGCM_sys_Get_Master" |
---|
[428] | 1034 | else |
---|
[938] | 1035 | \rm /tmp/out_command.$$ |
---|
[428] | 1036 | fi |
---|
[810] | 1037 | fi |
---|
| 1038 | IGCM_debug_PopStack "IGCM_sys_Get_Master" |
---|
[428] | 1039 | } |
---|
| 1040 | |
---|
[810] | 1041 | #==================================================== |
---|
| 1042 | #- Call IGCM_sys_Mirror_libIGCM now ! |
---|
| 1043 | if ( $MirrorlibIGCM ) ; then |
---|
| 1044 | IGCM_sys_Mirror_libIGCM |
---|
| 1045 | fi |
---|
| 1046 | |
---|
[428] | 1047 | #D-#================================================== |
---|
| 1048 | #D-function IGCM_sys_Put_Rest |
---|
[810] | 1049 | #D-* Purpose: Put computied restarts on ${ARCHIVE}. |
---|
[428] | 1050 | #D- File and target directory must exist. |
---|
| 1051 | #D-* Examples: |
---|
| 1052 | #D- |
---|
| 1053 | function IGCM_sys_Put_Rest { |
---|
[810] | 1054 | IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@ |
---|
| 1055 | if ( $DEBUG_sys ) ; then |
---|
| 1056 | echo "IGCM_sys_Put_Rest :" $@ |
---|
| 1057 | fi |
---|
| 1058 | if [ $DRYRUN = 0 ]; then |
---|
| 1059 | if [ ! -f ${1} ] ; then |
---|
| 1060 | echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ." |
---|
| 1061 | IGCM_debug_Exit "IGCM_sys_Put_Rest" |
---|
[428] | 1062 | fi |
---|
| 1063 | |
---|
[810] | 1064 | typeset status |
---|
| 1065 | # |
---|
| 1066 | if [ X${JobType} = XRUN ] ; then |
---|
| 1067 | IGCM_sys_Chmod 444 ${1} |
---|
| 1068 | fi |
---|
| 1069 | # |
---|
| 1070 | # Only if we use rsync |
---|
| 1071 | #IGCM_sys_MkdirArchive $( dirname $2 ) |
---|
| 1072 | # |
---|
| 1073 | #USUAL WAY |
---|
[938] | 1074 | \cp $1 $2 > /tmp/out_command.$$ 2>&1 |
---|
[810] | 1075 | status=$? |
---|
[428] | 1076 | |
---|
[810] | 1077 | if [ ${status} -gt 0 ] ; then |
---|
| 1078 | echo "IGCM_sys_Put_Rest : cp failed error code ${status}" |
---|
[938] | 1079 | cat /tmp/out_command.$$ |
---|
[810] | 1080 | IGCM_debug_Exit "IGCM_sys_Put_Rest" |
---|
[428] | 1081 | else |
---|
[938] | 1082 | \rm /tmp/out_command.$$ |
---|
[428] | 1083 | fi |
---|
[810] | 1084 | fi |
---|
| 1085 | IGCM_debug_PopStack "IGCM_sys_Put_Rest" |
---|
[428] | 1086 | } |
---|
| 1087 | |
---|
| 1088 | #D-#================================================== |
---|
[810] | 1089 | #D-function IGCM_sys_PutBuffer_Rest |
---|
| 1090 | #D-* Purpose: Put computied restarts on ${SCRATCHDIR}. |
---|
| 1091 | #D- File and target directory must exist. |
---|
| 1092 | #D-* Examples: |
---|
| 1093 | #D- |
---|
| 1094 | function IGCM_sys_PutBuffer_Rest { |
---|
| 1095 | IGCM_debug_PushStack "IGCM_sys_PutBuffer_Rest" $@ |
---|
| 1096 | if ( $DEBUG_sys ) ; then |
---|
| 1097 | echo "IGCM_sys_PutBuffer_Rest :" $@ |
---|
| 1098 | fi |
---|
| 1099 | if [ $DRYRUN = 0 ]; then |
---|
| 1100 | if [ ! -f ${1} ] ; then |
---|
| 1101 | echo "ERROR : IGCM_sys_PutBuffer_Rest ${1} DOES NOT EXIST ." |
---|
| 1102 | IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" |
---|
| 1103 | fi |
---|
| 1104 | |
---|
| 1105 | typeset status |
---|
| 1106 | # |
---|
| 1107 | if [ X${JobType} = XRUN ] ; then |
---|
| 1108 | IGCM_sys_Chmod 444 ${1} |
---|
| 1109 | fi |
---|
| 1110 | |
---|
| 1111 | # |
---|
| 1112 | # USUAL WAY |
---|
[938] | 1113 | \cp $1 $2 > /tmp/out_command.$$ 2>&1 |
---|
[810] | 1114 | status=$? |
---|
| 1115 | |
---|
| 1116 | if [ ${status} -gt 0 ] ; then |
---|
| 1117 | echo "IGCM_sys_PutBuffer_Rest : error code ${status}" |
---|
| 1118 | [ -f ${2} ] && ls -l ${2} |
---|
| 1119 | [ -f ${2}/${1} ] && ls -l ${2}/${1} |
---|
[938] | 1120 | cat /tmp/out_command.$$ |
---|
[810] | 1121 | IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" |
---|
| 1122 | else |
---|
[938] | 1123 | \rm /tmp/out_command.$$ |
---|
[810] | 1124 | fi |
---|
| 1125 | fi |
---|
| 1126 | IGCM_debug_PopStack "IGCM_sys_PutBuffer_Rest" |
---|
| 1127 | } |
---|
| 1128 | |
---|
| 1129 | #D-#================================================== |
---|
[801] | 1130 | #D-function IGCM_sys_PrepareTaredRestart |
---|
| 1131 | #D-* Purpose: Prepare tared restart to be access by computing job. Identity here. |
---|
| 1132 | #D-* Examples: |
---|
| 1133 | #D- |
---|
| 1134 | function IGCM_sys_PrepareTaredRestart { |
---|
| 1135 | IGCM_debug_PushStack "IGCM_sys_PrepareTaredRestart" $@ |
---|
[918] | 1136 | |
---|
[801] | 1137 | IGCM_debug_PopStack "IGCM_sys_PrepareTaredRestart" |
---|
| 1138 | } |
---|
| 1139 | |
---|
| 1140 | #D-#================================================== |
---|
[428] | 1141 | #D-function IGCM_sys_Put_Out |
---|
[810] | 1142 | #D-* Purpose: Copy a file on ${ARCHIVE} after having chmod it in readonly |
---|
[428] | 1143 | #D-* Examples: |
---|
| 1144 | #D- |
---|
| 1145 | function IGCM_sys_Put_Out { |
---|
[810] | 1146 | IGCM_debug_PushStack "IGCM_sys_Put_Out" $@ |
---|
| 1147 | if ( $DEBUG_sys ) ; then |
---|
| 1148 | echo "IGCM_sys_Put_Out :" $@ |
---|
| 1149 | fi |
---|
| 1150 | |
---|
| 1151 | typeset status |
---|
| 1152 | |
---|
| 1153 | if [ $DRYRUN = 0 ]; then |
---|
| 1154 | if [ ! -f ${1} ] ; then |
---|
| 1155 | echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ." |
---|
| 1156 | IGCM_debug_PopStack "IGCM_sys_Put_Out" |
---|
| 1157 | return 1 |
---|
[428] | 1158 | fi |
---|
[810] | 1159 | # |
---|
| 1160 | IGCM_sys_MkdirArchive $( dirname $2 ) |
---|
| 1161 | # |
---|
| 1162 | if [ X${JobType} = XRUN ] ; then |
---|
| 1163 | if [ X${3} = X ] ; then |
---|
| 1164 | IGCM_sys_Chmod 444 ${1} |
---|
[786] | 1165 | fi |
---|
[810] | 1166 | fi |
---|
| 1167 | # |
---|
| 1168 | #USUAL WAY |
---|
[938] | 1169 | \cp $1 $2 > /tmp/out_command.$$ 2>&1 |
---|
[810] | 1170 | status=$? |
---|
| 1171 | |
---|
| 1172 | if [ ${status} -gt 0 ] ; then |
---|
| 1173 | IGCM_debug_Print 2 "IGCM_sys_Put_Out : cp failed error code ${status}" |
---|
[938] | 1174 | cat /tmp/out_command.$$ |
---|
[810] | 1175 | IGCM_debug_Exit "IGCM_sys_Put_Out" |
---|
| 1176 | else |
---|
[938] | 1177 | \rm /tmp/out_command.$$ |
---|
[810] | 1178 | fi |
---|
| 1179 | fi |
---|
| 1180 | IGCM_debug_PopStack "IGCM_sys_Put_Out" |
---|
| 1181 | return 0 |
---|
| 1182 | } |
---|
| 1183 | |
---|
| 1184 | #D-#================================================== |
---|
| 1185 | #D-function IGCM_sys_PutBuffer_Out |
---|
| 1186 | #D-* Purpose: Copy a file on ${WORKDIR} after having chmod it in readonly |
---|
| 1187 | #D-* Examples: |
---|
| 1188 | #D- |
---|
| 1189 | function IGCM_sys_PutBuffer_Out { |
---|
| 1190 | IGCM_debug_PushStack "IGCM_sys_PutBuffer_Out" $@ |
---|
| 1191 | if ( $DEBUG_sys ) ; then |
---|
| 1192 | echo "IGCM_sys_PutBuffer_Out :" $@ |
---|
| 1193 | fi |
---|
| 1194 | |
---|
| 1195 | typeset NB_ESSAI DELAI status i exist skip |
---|
| 1196 | |
---|
| 1197 | # number of tentative |
---|
| 1198 | NB_ESSAI=3 |
---|
| 1199 | # time delay between tentative |
---|
| 1200 | DELAI=2 |
---|
| 1201 | |
---|
| 1202 | if [ $DRYRUN = 0 ]; then |
---|
| 1203 | if [ ! -f ${1} ] ; then |
---|
| 1204 | echo "WARNING : IGCM_sys_PutBuffer_Out ${1} DOES NOT EXIST ." |
---|
| 1205 | IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out" |
---|
| 1206 | return 1 |
---|
| 1207 | fi |
---|
| 1208 | # |
---|
| 1209 | IGCM_sys_Mkdir $( dirname $2 ) |
---|
| 1210 | # |
---|
| 1211 | |
---|
| 1212 | exist=false |
---|
| 1213 | skip=false |
---|
| 1214 | if [ -f $2 ] ; then |
---|
| 1215 | IGCM_debug_Print 1 "$2 already exist" |
---|
| 1216 | exist=true |
---|
| 1217 | if [ "X$( diff $1 $2 )" = X ] ; then |
---|
| 1218 | IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy" |
---|
| 1219 | status=0 |
---|
| 1220 | skip=true |
---|
| 1221 | else |
---|
| 1222 | IGCM_debug_Print 2 "$1 and $2 are not the same file, we force the copy" |
---|
| 1223 | skip=false |
---|
| 1224 | fi |
---|
| 1225 | fi |
---|
| 1226 | # |
---|
| 1227 | if ( [ X${exist} = Xtrue ] && [ X${skip} = Xfalse ] ) ; then |
---|
| 1228 | IGCM_sys_Chmod u+w $2 |
---|
| 1229 | fi |
---|
| 1230 | |
---|
| 1231 | if [ X${skip} = Xfalse ] ; then |
---|
| 1232 | i=0 |
---|
| 1233 | while [ $i -lt $NB_ESSAI ] ; do |
---|
| 1234 | # USUAL WAY |
---|
[938] | 1235 | \cp $1 $2 > /tmp/out_command.$$ 2>&1 |
---|
[810] | 1236 | status=$? |
---|
| 1237 | if [ ${status} -gt 0 ]; then |
---|
| 1238 | IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : cp failed error code ${status} ${i}/${NB_ESSAI}" |
---|
| 1239 | IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : sleep ${DELAI} seconds and try again." |
---|
| 1240 | [ -f ${2} ] && ls -l ${2} |
---|
| 1241 | [ -f ${2}/${1} ] && ls -l ${2}/${1} |
---|
| 1242 | sleep $DELAI |
---|
| 1243 | else |
---|
| 1244 | break |
---|
| 1245 | fi |
---|
| 1246 | (( i = i + 1 )) |
---|
| 1247 | done |
---|
| 1248 | fi |
---|
| 1249 | |
---|
| 1250 | if [ ${status} -gt 0 ] ; then |
---|
| 1251 | echo "IGCM_sys_PutBuffer_Out : error." |
---|
| 1252 | [ -f ${2} ] && ls -l ${2} |
---|
| 1253 | [ -f ${2}/${1} ] && ls -l ${2}/${1} |
---|
[938] | 1254 | cat /tmp/out_command.$$ |
---|
[810] | 1255 | IGCM_debug_Exit "IGCM_sys_PutBuffer_Out" |
---|
| 1256 | else |
---|
| 1257 | |
---|
[786] | 1258 | if [ X${JobType} = XRUN ] ; then |
---|
[810] | 1259 | if [ X${3} = X ] ; then |
---|
| 1260 | [ -f ${2} ] && IGCM_sys_Chmod 444 ${2} |
---|
| 1261 | [ -f ${2}/${1} ] && IGCM_sys_Chmod 444 ${2}/${1} |
---|
| 1262 | fi |
---|
[786] | 1263 | fi |
---|
[428] | 1264 | |
---|
[938] | 1265 | \rm /tmp/out_command.$$ |
---|
[428] | 1266 | fi |
---|
[810] | 1267 | fi |
---|
| 1268 | IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out" |
---|
| 1269 | return 0 |
---|
[428] | 1270 | } |
---|
| 1271 | |
---|
| 1272 | #D-#================================================== |
---|
| 1273 | #D-function IGCM_sys_Get |
---|
| 1274 | #D-* Purpose: Get a file from ${ARCHIVE} |
---|
| 1275 | #D-* Examples: IGCM_sys_Get myfile /destpath/myfile_with_PREFIX |
---|
| 1276 | #D- IGCM_sys_Get /l Array_contain_myfiles /destpath/ |
---|
| 1277 | function IGCM_sys_Get { |
---|
[810] | 1278 | IGCM_debug_PushStack "IGCM_sys_Get" $@ |
---|
[428] | 1279 | |
---|
[810] | 1280 | typeset DEST status dm_liste |
---|
[428] | 1281 | |
---|
[810] | 1282 | if ( $DEBUG_sys ) ; then |
---|
| 1283 | echo "IGCM_sys_Get :" $@ |
---|
| 1284 | fi |
---|
| 1285 | if [ $DRYRUN -le 2 ]; then |
---|
| 1286 | if [ X${1} = X'/l' ] ; then |
---|
| 1287 | eval set +A dm_liste \${${2}} |
---|
| 1288 | else |
---|
| 1289 | dm_liste=${1} |
---|
[428] | 1290 | fi |
---|
[810] | 1291 | eval DEST=\${${#}} |
---|
[428] | 1292 | |
---|
[810] | 1293 | # test if the (first) file is present in the old computation : |
---|
| 1294 | DEBUG_sys=false IGCM_sys_IsFileArchived ${dm_liste[0]} |
---|
| 1295 | if [ $? = 0 ] ; then |
---|
[786] | 1296 | IGCM_sys_TestFileArchive ${dm_liste[0]} |
---|
[810] | 1297 | status=$? |
---|
| 1298 | else |
---|
| 1299 | IGCM_sys_TestFileBuffer ${dm_liste[0]} |
---|
| 1300 | status=$? |
---|
| 1301 | fi |
---|
[428] | 1302 | |
---|
[810] | 1303 | if [ ${status} -gt 0 ] ; then |
---|
| 1304 | echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ." |
---|
| 1305 | IGCM_debug_Exit "IGCM_sys_Get" |
---|
| 1306 | return |
---|
| 1307 | fi |
---|
[428] | 1308 | |
---|
[810] | 1309 | #USUAL WAY |
---|
[938] | 1310 | \cp ${dm_liste[*]} ${DEST} > /tmp/out_command.$$ 2>&1 |
---|
[810] | 1311 | status=$? |
---|
| 1312 | |
---|
| 1313 | if [ ${status} -gt 0 ] ; then |
---|
| 1314 | IGCM_debug_Print 2 "IGCM_sys_Get : cp failed error code ${status}" |
---|
[938] | 1315 | cat /tmp/out_command.$$ |
---|
[810] | 1316 | IGCM_debug_Exit "IGCM_sys_Get" |
---|
| 1317 | else |
---|
[938] | 1318 | \rm /tmp/out_command.$$ |
---|
[810] | 1319 | fi |
---|
| 1320 | fi |
---|
| 1321 | IGCM_debug_PopStack "IGCM_sys_Get" |
---|
| 1322 | } |
---|
| 1323 | |
---|
| 1324 | #D-#================================================== |
---|
| 1325 | #D-function IGCM_sys_GetBuffer |
---|
| 1326 | #D-* Purpose: Get a file from ${SCRATCHDIR} |
---|
| 1327 | #D-* Examples: IGCM_sys_GetBuffer myfile /destpath/myfile_with_PREFIX |
---|
| 1328 | #D- IGCM_sys_GetBuffer /l Array_contain_myfiles /destpath/ |
---|
| 1329 | function IGCM_sys_GetBuffer { |
---|
| 1330 | IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@ |
---|
| 1331 | |
---|
| 1332 | typeset DEST buf_liste target file_work |
---|
| 1333 | typeset NB_ESSAI DELAI status i |
---|
| 1334 | |
---|
| 1335 | if ( $DEBUG_sys ) ; then |
---|
| 1336 | echo "IGCM_sys_GetBuffer :" $@ |
---|
| 1337 | fi |
---|
| 1338 | |
---|
| 1339 | # number of tentative |
---|
| 1340 | NB_ESSAI=3 |
---|
| 1341 | # time delay between tentative |
---|
| 1342 | DELAI=2 |
---|
| 1343 | |
---|
| 1344 | if [ $DRYRUN -le 2 ]; then |
---|
| 1345 | if [ X${1} = X'/l' ] ; then |
---|
| 1346 | eval set +A buf_liste \${${2}} |
---|
| 1347 | else |
---|
| 1348 | eval set +A buf_liste ${1} |
---|
| 1349 | fi |
---|
| 1350 | eval DEST=\${${#}} |
---|
| 1351 | |
---|
| 1352 | #USUAL WAY |
---|
| 1353 | if [ X${1} = X'/l' ] ; then |
---|
| 1354 | for target in ${buf_liste[*]} ; do |
---|
| 1355 | local_file=$( basename ${target} ) |
---|
| 1356 | i=0 |
---|
| 1357 | while [ $i -lt $NB_ESSAI ] ; do |
---|
[938] | 1358 | \cp ${target} ${DEST}/${local_file} >> /tmp/out_command.$$ 2>&1 |
---|
[810] | 1359 | status=$? |
---|
| 1360 | if [ ${status} -gt 0 ]; then |
---|
| 1361 | IGCM_debug_Print 2 "IGCM_sys_GetBuffer : cp failed error code ${status} ${i}/${NB_ESSAI}" |
---|
| 1362 | IGCM_debug_Print 2 "IGCM_sys_GetBuffer : sleep ${DELAI} seconds and try again." |
---|
| 1363 | sleep $DELAI |
---|
| 1364 | else |
---|
| 1365 | break |
---|
| 1366 | fi |
---|
| 1367 | (( i = i + 1 )) |
---|
| 1368 | done |
---|
| 1369 | if [ ${status} -gt 0 ] ; then |
---|
| 1370 | echo "IGCM_sys_Get : error" |
---|
[938] | 1371 | cat /tmp/out_command.$$ |
---|
| 1372 | \rm /tmp/out_command.$$ |
---|
[810] | 1373 | IGCM_debug_Exit "IGCM_sys_GetBuffer" |
---|
| 1374 | else |
---|
[938] | 1375 | \rm /tmp/out_command.$$ |
---|
[810] | 1376 | fi |
---|
| 1377 | done |
---|
| 1378 | else |
---|
| 1379 | i=0 |
---|
| 1380 | while [ $i -lt $NB_ESSAI ] ; do |
---|
[938] | 1381 | \cp ${buf_liste} ${DEST} >> /tmp/out_command.$$ 2>&1 |
---|
[810] | 1382 | status=$? |
---|
| 1383 | if [ ${status} -gt 0 ]; then |
---|
| 1384 | IGCM_debug_Print 2 "IGCM_sys_GetBuffer : cp failed error code ${status} ${i}/${NB_ESSAI}" |
---|
| 1385 | IGCM_debug_Print 2 "IGCM_sys_GetBuffer : sleep ${DELAI} seconds and try again." |
---|
| 1386 | sleep $DELAI |
---|
| 1387 | else |
---|
| 1388 | break |
---|
| 1389 | fi |
---|
| 1390 | (( i = i + 1 )) |
---|
| 1391 | done |
---|
| 1392 | if [ ${status} -gt 0 ] ; then |
---|
| 1393 | echo "IGCM_sys_Get : error" |
---|
[938] | 1394 | cat /tmp/out_command.$$ |
---|
| 1395 | \rm /tmp/out_command.$$ |
---|
[810] | 1396 | IGCM_debug_Exit "IGCM_sys_GetBuffer" |
---|
| 1397 | else |
---|
[938] | 1398 | \rm /tmp/out_command.$$ |
---|
[786] | 1399 | fi |
---|
[428] | 1400 | fi |
---|
[810] | 1401 | fi |
---|
| 1402 | IGCM_debug_PopStack "IGCM_sys_GetBuffer" |
---|
[428] | 1403 | } |
---|
| 1404 | |
---|
| 1405 | #D-#================================================== |
---|
| 1406 | #D-function IGCM_sys_GetDate_FichWork |
---|
| 1407 | #D-* Purpose: donne la date filesys d'un fichier sur le filesystem WORK |
---|
| 1408 | #D-* Examples: |
---|
| 1409 | #D- |
---|
| 1410 | function IGCM_sys_GetDate_FichWork { |
---|
[810] | 1411 | IGCM_debug_PushStack "IGCM_sys_FichWork" $@ |
---|
| 1412 | if ( $DEBUG_sys ) ; then |
---|
| 1413 | echo "IGCM_sys_GetDate_FichWork :" $@ |
---|
| 1414 | fi |
---|
| 1415 | # donne la date filesys d'un fichier sur la machine work |
---|
| 1416 | IGCM_debug_PopStack "IGCM_sys_FichWork" |
---|
[428] | 1417 | } |
---|
| 1418 | |
---|
| 1419 | #D-#================================================== |
---|
| 1420 | #D-function IGCM_sys_GetDate_FichArchive |
---|
[809] | 1421 | #D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE |
---|
[428] | 1422 | #D-* Examples: |
---|
| 1423 | #D- |
---|
| 1424 | function IGCM_sys_GetDate_FichArchive { |
---|
[810] | 1425 | IGCM_debug_PushStack "IGCM_sys_FichArchive" $@ |
---|
| 1426 | if ( $DEBUG_sys ) ; then |
---|
| 1427 | echo "IGCM_sys_GetDate_FichArchive :" $@ |
---|
| 1428 | fi |
---|
| 1429 | IGCM_debug_PopStack "IGCM_sys_FichArchive" |
---|
[428] | 1430 | } |
---|
| 1431 | |
---|
[810] | 1432 | #D-#================================================== |
---|
[811] | 1433 | #D-function IGCM_sys_Dods_Rm |
---|
| 1434 | #D-* Purpose: DO NOTHING ! Put ${ARCHIVE} files on DODS internet protocole. |
---|
| 1435 | #D-* Examples: |
---|
| 1436 | #D- |
---|
| 1437 | function IGCM_sys_Dods_Rm { |
---|
| 1438 | if ( $DEBUG_sys ) ; then |
---|
| 1439 | echo "IGCM_sys_Dods_Rm :" $@ |
---|
| 1440 | fi |
---|
| 1441 | return 0 |
---|
| 1442 | } |
---|
| 1443 | |
---|
| 1444 | #D-#================================================== |
---|
| 1445 | #D-function IGCM_sys_Dods_Cp |
---|
| 1446 | #D-* Purpose: Copy $(ARCHIVE) files on DODS internet protocole. |
---|
| 1447 | #D-* Examples: |
---|
| 1448 | #D- |
---|
| 1449 | function IGCM_sys_Dods_Cp { |
---|
| 1450 | if ( $DEBUG_sys ) ; then |
---|
| 1451 | echo "IGCM_sys_Dods_Cp :" $@ |
---|
| 1452 | fi |
---|
| 1453 | return 0 |
---|
| 1454 | } |
---|
| 1455 | |
---|
| 1456 | #D-#================================================== |
---|
[810] | 1457 | #D-function IGCM_sys_Put_Dods |
---|
| 1458 | #D-* Purpose: Put ${ARCHIVE} files on DODS internet protocole. Dummy function here |
---|
| 1459 | #D-* Examples: |
---|
| 1460 | #D- |
---|
| 1461 | function IGCM_sys_Put_Dods { |
---|
| 1462 | IGCM_debug_PushStack "IGCM_sys_Put_Dods" $@ |
---|
| 1463 | if ( $DEBUG_sys ) ; then |
---|
| 1464 | echo "IGCM_sys_Put_Dods :" $@ |
---|
| 1465 | fi |
---|
| 1466 | IGCM_debug_PopStack "IGCM_sys_Put_Dods" |
---|
| 1467 | } |
---|
| 1468 | |
---|
[428] | 1469 | ############################################################## |
---|
| 1470 | # REBUILD OPERATOR |
---|
| 1471 | |
---|
[810] | 1472 | #D-#================================================== |
---|
| 1473 | #D-function IGCM_sys_rebuild |
---|
| 1474 | #D-* Purpose: rebuild parallel files |
---|
| 1475 | #D-* Examples: |
---|
| 1476 | #D- |
---|
[428] | 1477 | function IGCM_sys_rebuild { |
---|
[1057] | 1478 | IGCM_debug_PushStack "IGCM_sys_rebuild" $@ |
---|
[810] | 1479 | if ( $DEBUG_sys ) ; then |
---|
| 1480 | echo "IGCM_sys_rebuild :" $@ |
---|
| 1481 | fi |
---|
| 1482 | |
---|
| 1483 | typeset NB_ESSAI DELAI status i firstArg |
---|
| 1484 | # number of tentative |
---|
| 1485 | NB_ESSAI=3 |
---|
| 1486 | # time delay between tentative |
---|
| 1487 | DELAI=2 |
---|
| 1488 | |
---|
| 1489 | i=0 |
---|
| 1490 | while [ $i -lt $NB_ESSAI ] ; do |
---|
[938] | 1491 | /gpfs1/home/sebastien/REBUILD/rebuild -f -o $@ > /tmp/out_command.$$ 2>&1 |
---|
[810] | 1492 | status=$? |
---|
| 1493 | if [ ${status} -gt 0 ] ; then |
---|
| 1494 | IGCM_debug_Print 2 "IGCM_sys_rebuild : error code ${status}" |
---|
[938] | 1495 | cat /tmp/out_command.$$ |
---|
| 1496 | \rm /tmp/out_command.$$ |
---|
[810] | 1497 | IGCM_debug_Print 2 "IGCM_sys_rebuild : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
| 1498 | firstArg=${1} |
---|
| 1499 | \rm ${firstArg} |
---|
| 1500 | sleep $DELAI |
---|
| 1501 | else |
---|
[938] | 1502 | \rm /tmp/out_command.$$ |
---|
[810] | 1503 | break |
---|
[428] | 1504 | fi |
---|
[810] | 1505 | (( i = i + 1 )) |
---|
| 1506 | done |
---|
[428] | 1507 | |
---|
[810] | 1508 | if [ ${status} -gt 0 ] ; then |
---|
| 1509 | echo "IGCM_sys_rebuild : rebuild error code is ${status}" |
---|
| 1510 | IGCM_debug_Exit "rebuild" |
---|
| 1511 | fi |
---|
| 1512 | |
---|
| 1513 | IGCM_debug_PopStack "IGCM_sys_rebuild" |
---|
[428] | 1514 | } |
---|
| 1515 | |
---|
[810] | 1516 | #D-#================================================== |
---|
| 1517 | #D-function IGCM_sys_rebuild_station |
---|
[922] | 1518 | #D-* Purpose: rebuild parallel files describing station |
---|
[810] | 1519 | #D-* Examples: |
---|
| 1520 | #D- |
---|
| 1521 | function IGCM_sys_rebuild_station { |
---|
[1057] | 1522 | IGCM_debug_PushStack "IGCM_sys_rebuild_station" $@ |
---|
[810] | 1523 | typeset i list_opt file_in file_out prefix_invert list_invert |
---|
| 1524 | if ( $DEBUG_sys ) ; then |
---|
| 1525 | echo "IGCM_sys_rebuild_station :" $@ |
---|
| 1526 | fi |
---|
| 1527 | list_opt=$@ |
---|
| 1528 | |
---|
| 1529 | # Invert Axis : t,x -> x,t |
---|
| 1530 | # t,pres,x -> x,t,pres |
---|
| 1531 | # So that we can concatenate along x |
---|
| 1532 | i=0 |
---|
| 1533 | for file_in in ${list_opt} ; do |
---|
| 1534 | (( i = i + 1)) |
---|
| 1535 | [ ${i} = 1 ] && file_out=${file_in} && continue |
---|
[1046] | 1536 | # detect time counter and do the job only if present |
---|
| 1537 | var_unlim=$(ncdump -h ${file_in} | grep UNLIMITED | cut -d ' ' -f 1) |
---|
| 1538 | if [ X${var_unlim} = Xtime_counter ] ; then |
---|
| 1539 | prefix_invert=$( basename ${file_in} .nc ) |
---|
| 1540 | IGCM_sys_ncpdq -a x,time_counter -a x,time_counter,presnivs ${file_in} ${prefix_invert}_xt.nc |
---|
| 1541 | list_invert[${#list_invert[*]}]=${prefix_invert}_xt.nc |
---|
| 1542 | fi |
---|
[810] | 1543 | done |
---|
| 1544 | |
---|
| 1545 | # Concatenate |
---|
| 1546 | IGCM_sys_ncrcat ${list_invert[*]} histstn_xt.nc |
---|
| 1547 | |
---|
| 1548 | # Re-ivert file |
---|
| 1549 | IGCM_sys_ncpdq -a time_counter,x -a time_counter,presnivs,x histstn_xt.nc ${file_out} |
---|
| 1550 | |
---|
[922] | 1551 | # Station re-ordering is too expansive to be run within libIGCM |
---|
[810] | 1552 | # This is due to (ncpdq - nrcat - ncpdq) I/O sequence. |
---|
| 1553 | # This re-ordering must be done "in memory" by the cmorization process |
---|
| 1554 | # Anyway this is the best sequence using (ncpdq - nrcat - ncpdq) |
---|
| 1555 | # BEGIN reordering |
---|
| 1556 | |
---|
| 1557 | # Only LMDZ text output contains the exact ordering of the station. |
---|
| 1558 | # We isolate this in the code below: |
---|
| 1559 | # 0 38 -157.5000000000000 70.98591549295774 |
---|
| 1560 | # 0 54 27.49999999999999 67.18309859154928 |
---|
| 1561 | # 0 56 -62.50000000000001 82.39436619718309 |
---|
| 1562 | # 0 79 12.49999999999999 78.59154929577466 |
---|
| 1563 | # 0 116 -165.0000000000000 76.05633802816901 |
---|
| 1564 | # 0 117 130.0000000000000 70.98591549295774 |
---|
| 1565 | # 0 118 110.0000000000000 87.46478873239437 |
---|
| 1566 | # 1 40 4.999999999999995 51.97183098591550 |
---|
| 1567 | # typeset iStation iProc list_opt file_in file_out prefix_invert |
---|
| 1568 | # typeset -Z4 j4 |
---|
| 1569 | # typeset -Z3 j3 |
---|
| 1570 | |
---|
| 1571 | # unset list_opt |
---|
| 1572 | # set +A list_opt $@ |
---|
| 1573 | |
---|
| 1574 | # Filename after rebuild |
---|
| 1575 | # file_out=${list_opt[0]} |
---|
| 1576 | # Prefix of output files |
---|
| 1577 | # prefix_invert=$( basename ${file_out} .nc ) |
---|
| 1578 | # Number of procs |
---|
| 1579 | # num_proc=$( grep -i mpi_size ${PREFIX}_${Exe_Output} | wc -l ) |
---|
| 1580 | |
---|
| 1581 | # iProc=0 |
---|
| 1582 | # while [ ${iProc} -lt ${num_proc} ] ; do |
---|
| 1583 | # Array containing Station as a number |
---|
| 1584 | # unset proc_stn |
---|
[912] | 1585 | # set +A proc_stn $( grep "iophy_mpi rank ip lon lat $iProc" ${PREFIX}_${Exe_Output} | sed -e "s/iophy_mpi rank ip lon lat //g" | gawk ' {print $2}' ) |
---|
[810] | 1586 | # Number of stations produced by processor proc |
---|
| 1587 | # stationLast=${#proc_stn[*]} |
---|
| 1588 | # Proc number on 4 digits |
---|
| 1589 | # j4=${iProc} |
---|
| 1590 | # Init |
---|
| 1591 | # iStation=0 |
---|
| 1592 | # while [ ${iStation} -lt ${stationLast} ] ; do |
---|
| 1593 | # Station number on 3 digits |
---|
| 1594 | # j3=${proc_stn[${iStation}]} |
---|
| 1595 | # Extract station |
---|
| 1596 | # Invert Axis : t,x -> x,t |
---|
| 1597 | # t,pres,x -> x,t,pres |
---|
| 1598 | # So that we can concatenate along x |
---|
| 1599 | # IGCM_sys_ncpdq -a x,time_counter -a x,time_counter,presnivs -d x,$iStation,$iStation ${prefix_invert}_${j4}.nc ${prefix_invert}_stn_${j3}.nc |
---|
| 1600 | # (( iStation = iStation + 1 )) |
---|
| 1601 | # done |
---|
| 1602 | # (( iProc = iProc + 1 )) |
---|
| 1603 | # done |
---|
| 1604 | |
---|
| 1605 | # Concatenate all station along x |
---|
| 1606 | # IGCM_sys_ncrcat ${prefix_invert}_stn_???.nc ${prefix_invert}_xt.nc |
---|
| 1607 | |
---|
| 1608 | # Re-invert file |
---|
| 1609 | # IGCM_sys_ncpdq -a time_counter,x -a time_counter,presnivs,x ${prefix_invert}_xt.nc ${file_out} |
---|
| 1610 | |
---|
| 1611 | # END reordering |
---|
| 1612 | |
---|
| 1613 | IGCM_debug_PopStack "IGCM_sys_rebuild_station" |
---|
| 1614 | } |
---|
| 1615 | |
---|
[428] | 1616 | ############################################################ |
---|
| 1617 | # Activate Running Environnment Variables |
---|
| 1618 | |
---|
[810] | 1619 | #D-#================================================== |
---|
| 1620 | #D-function IGCM_sys_desactiv_variables |
---|
| 1621 | #D-* Purpose: set environement variables prior to execution |
---|
| 1622 | #D-* Examples: |
---|
| 1623 | #D- |
---|
[428] | 1624 | function IGCM_sys_activ_variables { |
---|
[810] | 1625 | IGCM_debug_PushStack "IGCM_sys_activ_variables" |
---|
| 1626 | if ( $DEBUG_sys ) ; then |
---|
[811] | 1627 | echo "IGCM_sys_activ_variables" |
---|
[810] | 1628 | fi |
---|
[428] | 1629 | |
---|
| 1630 | # -------------------------------------------------------------------- |
---|
| 1631 | #D- MPI specifications |
---|
| 1632 | # -------------------------------------------------------------------- |
---|
| 1633 | |
---|
| 1634 | # -------------------------------------------------------------------- |
---|
| 1635 | #D- Other specifications |
---|
| 1636 | # -------------------------------------------------------------------- |
---|
| 1637 | |
---|
[810] | 1638 | IGCM_debug_PopStack "IGCM_sys_activ_variables" |
---|
[428] | 1639 | } |
---|
| 1640 | |
---|
| 1641 | ############################################################ |
---|
| 1642 | # Desactivate Running Environnment Variables |
---|
| 1643 | |
---|
[810] | 1644 | #D-#================================================== |
---|
| 1645 | #D-function IGCM_sys_desactiv_variables |
---|
| 1646 | #D-* Purpose: unset environement variables after execution |
---|
| 1647 | #D-* Examples: |
---|
| 1648 | #D- |
---|
[428] | 1649 | function IGCM_sys_desactiv_variables { |
---|
[810] | 1650 | IGCM_debug_PushStack "IGCM_sys_desactiv_variables" |
---|
| 1651 | if ( $DEBUG_sys ) ; then |
---|
[811] | 1652 | echo "IGCM_sys_desactiv_variables" |
---|
[810] | 1653 | fi |
---|
[428] | 1654 | # -------------------------------------------------------------------- |
---|
| 1655 | #D- MPI specifications |
---|
| 1656 | # -------------------------------------------------------------------- |
---|
| 1657 | |
---|
| 1658 | # -------------------------------------------------------------------- |
---|
| 1659 | #D- Other specifications |
---|
| 1660 | # -------------------------------------------------------------------- |
---|
| 1661 | |
---|
[810] | 1662 | IGCM_debug_PopStack "IGCM_sys_desactiv_variables" |
---|
| 1663 | } |
---|
[809] | 1664 | |
---|
[810] | 1665 | ############################################################ |
---|
| 1666 | # Build MPI/OMP scripts run file (dummy function) |
---|
| 1667 | |
---|
| 1668 | #D-#================================================== |
---|
| 1669 | #D-function IGCM_sys_build_run_file |
---|
| 1670 | #D-* Purpose: build run file (deprecated) |
---|
| 1671 | #D-* Examples: |
---|
| 1672 | #D- |
---|
| 1673 | function IGCM_sys_build_run_file { |
---|
| 1674 | |
---|
[811] | 1675 | IGCM_debug_Print 3 " dummy function : IGCM_sys_build_run_file " |
---|
[810] | 1676 | |
---|
[428] | 1677 | } |
---|
| 1678 | |
---|
| 1679 | ############################################################ |
---|
[810] | 1680 | # Build MPI/OMP scripts |
---|
[428] | 1681 | |
---|
[810] | 1682 | #D-#================================================== |
---|
| 1683 | #D-function IGCM_sys_build_execution_scripts |
---|
| 1684 | #D-* Purpose: build execution scripts to be launch by ${HOST_MPIRUN_COMMAND} |
---|
| 1685 | #D-* Examples: |
---|
| 1686 | #D- |
---|
| 1687 | function IGCM_sys_build_execution_scripts |
---|
| 1688 | { |
---|
| 1689 | IGCM_debug_PushStack "IGCM_sys_build_execution_scripts" $@ |
---|
| 1690 | if ( $DEBUG_sys ) ; then |
---|
| 1691 | echo "IGCM_sys_build_execution_scripts " $@ |
---|
| 1692 | fi |
---|
| 1693 | |
---|
| 1694 | typeset NbNodes_Job NbProc_Job comp_proc_mpi_loc comp_proc_omp_loc mpi_count |
---|
| 1695 | |
---|
| 1696 | if [ ! -f ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} ] ; then |
---|
| 1697 | IGCM_debug_Exit "IGCM_sys_iitm build_execution_scripts : Job_${config_UserChoices_JobName} don't exist in SUBMIT_DIR : ${SUBMIT_DIR} " |
---|
| 1698 | fi |
---|
| 1699 | |
---|
| 1700 | if ( ${OK_PARA_MPMD} ) ; then |
---|
| 1701 | |
---|
| 1702 | if [ -f run_file ] ; then |
---|
| 1703 | IGCM_sys_Rm -f run_file |
---|
| 1704 | fi |
---|
| 1705 | touch run_file |
---|
| 1706 | |
---|
| 1707 | if ( ${OK_PARA_OMP} ) ; then |
---|
| 1708 | # NEW : 2 Noeuds |
---|
| 1709 | # @ task_geometry={(0)(1,2,3)} |
---|
| 1710 | # Nombre de processus demandes |
---|
| 1711 | echo "Job_${config_UserChoices_JobName} includes task_geometry = \c" |
---|
| 1712 | cat ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} | grep "task_geometry" | sed -e "s/[^(]*([^(]*/(/g" |
---|
| 1713 | echo "Job_${config_UserChoices_JobName} includes task_geometry with NbNodes = \c" |
---|
| 1714 | cat ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} | grep "task_geometry" | sed -e "s/[^(]*([^(]*/(/g" | wc -c |
---|
| 1715 | NbNodes_Job=$(( $( cat ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} | grep "task_geometry" | sed -e "s/[^(]*([^(]*/(/g" | wc -c ) - 1 )) |
---|
| 1716 | |
---|
| 1717 | if [ ${NbNodes_Job} -eq 0 ] ; then |
---|
| 1718 | IGCM_debug_Print 2 "Error in Job_${config_UserChoices_JobName} ressources : no task_geometry defined with OpenMP run." |
---|
| 1719 | exit 1 |
---|
| 1720 | fi |
---|
| 1721 | else |
---|
| 1722 | |
---|
| 1723 | # OLD : |
---|
| 1724 | # @ total_tasks = 3 |
---|
| 1725 | # @ environment = "BATCH_NUM_PROC_TOT=3" |
---|
| 1726 | # Pas d OpenMP |
---|
| 1727 | # @ resources = ConsumableCpus(1) |
---|
| 1728 | |
---|
| 1729 | echo "Job_${config_UserChoices_JobName} includes total_tasks = \c" |
---|
| 1730 | cat ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} | grep "total_tasks" | sed -e "s/.*total_tasks = //" |
---|
| 1731 | NbProc_Job=$( cat ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} | grep "total_tasks" | sed -e "s/.*total_tasks = //" ) |
---|
| 1732 | NbProc_Job=${NbProc_Job:=0} |
---|
| 1733 | if [ ${NbProc_Job} -eq 0 ] ; then |
---|
| 1734 | IGCM_debug_Print 2 "Error in Job_${config_UserChoices_JobName} ressources : no total_tasks defined with MPI only run." |
---|
| 1735 | exit 1 |
---|
| 1736 | fi |
---|
| 1737 | if ( $( egrep '^# *@ *resources *= *ConsumableCpus\(1\)' ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} >/dev/null 2>&1 ) ) ; then |
---|
| 1738 | IGCM_debug_Print 2 "ressources = ConsumableCpus(1) line found into Job_${config_UserChoices_JobName}" |
---|
| 1739 | else |
---|
| 1740 | IGCM_debug_Print 2 "Error in Job_${config_UserChoices_JobName} ressources = line not found. Job should include resources = ConsumableCpus(1) " |
---|
| 1741 | exit 1 |
---|
| 1742 | fi |
---|
| 1743 | fi |
---|
| 1744 | |
---|
| 1745 | # run_file construction |
---|
| 1746 | |
---|
| 1747 | # Then first loop on the components for the coupler ie oasis |
---|
| 1748 | |
---|
| 1749 | ### the coupler ie oasis must be the first one |
---|
| 1750 | for comp in ${config_ListOfComponents[*]} ; do |
---|
| 1751 | |
---|
| 1752 | eval ExeNameIn=\${config_Executable_${comp}[0]} |
---|
| 1753 | eval ExeNameOut=\${config_Executable_${comp}[1]} |
---|
| 1754 | |
---|
| 1755 | # for CPL component only |
---|
| 1756 | if [ "X${comp}" = "XCPL" ] ; then |
---|
| 1757 | |
---|
| 1758 | eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} |
---|
| 1759 | eval comp_proc_omp_loc=\${${comp}_PROC_OMP} |
---|
| 1760 | |
---|
| 1761 | if ( ${OK_PARA_MPI} ) ; then |
---|
| 1762 | |
---|
| 1763 | (( mpi_count = 1 )) |
---|
| 1764 | until [ ${mpi_count} -gt ${comp_proc_mpi_loc} ] ; do |
---|
| 1765 | if ( ${OK_PARA_OMP} ) ; then |
---|
| 1766 | echo "env OMP_NUM_THREADS=${comp_proc_omp_loc} ./${ExeNameOut} " >> run_file |
---|
| 1767 | else |
---|
| 1768 | echo "./${ExeNameOut}" >> run_file |
---|
| 1769 | fi |
---|
| 1770 | (( mpi_count = mpi_count + 1 )) |
---|
| 1771 | done |
---|
| 1772 | else |
---|
| 1773 | if ( ${OK_PARA_OMP} ) ; then |
---|
| 1774 | echo "env OMP_NUM_THREADS=${comp_proc_omp_loc} ./${ExeNameOut} " >> run_file |
---|
| 1775 | else |
---|
| 1776 | echo "./${ExeNameOut} " >> run_file |
---|
| 1777 | fi |
---|
| 1778 | fi |
---|
| 1779 | fi |
---|
| 1780 | done |
---|
| 1781 | |
---|
| 1782 | # Then second loop on the components |
---|
| 1783 | |
---|
| 1784 | for comp in ${config_ListOfComponents[*]} ; do |
---|
| 1785 | |
---|
| 1786 | eval ExeNameIn=\${config_Executable_${comp}[0]} |
---|
| 1787 | eval ExeNameOut=\${config_Executable_${comp}[1]} |
---|
| 1788 | |
---|
| 1789 | # Only if we really have an executable for the component and not the coupler ie oasis: |
---|
| 1790 | if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${comp}" != "XCPL" ] ) ; then |
---|
| 1791 | |
---|
| 1792 | eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} |
---|
| 1793 | eval comp_proc_omp_loc=\${${comp}_PROC_OMP} |
---|
| 1794 | |
---|
| 1795 | if ( ${OK_PARA_MPI} ) ; then |
---|
| 1796 | |
---|
| 1797 | (( mpi_count = 1 )) |
---|
| 1798 | until [ ${mpi_count} -gt ${comp_proc_mpi_loc} ] ; do |
---|
| 1799 | if ( ${OK_PARA_OMP} ) ; then |
---|
| 1800 | echo "env OMP_NUM_THREADS=${comp_proc_omp_loc} ./${ExeNameOut} " >> run_file |
---|
| 1801 | else |
---|
| 1802 | echo "./${ExeNameOut}" >> run_file |
---|
| 1803 | fi |
---|
| 1804 | (( mpi_count = mpi_count + 1 )) |
---|
| 1805 | done |
---|
| 1806 | else |
---|
| 1807 | if ( ${OK_PARA_OMP} ) ; then |
---|
| 1808 | echo "env OMP_NUM_THREADS=${comp_proc_omp_loc} ./${ExeNameOut} " >> run_file |
---|
| 1809 | else |
---|
| 1810 | # to be tested : no MPI only OpenMP into MPMD mode |
---|
| 1811 | echo "./${ExeNameOut} " >> run_file |
---|
| 1812 | fi |
---|
| 1813 | fi |
---|
| 1814 | fi |
---|
| 1815 | done |
---|
| 1816 | |
---|
| 1817 | EXECUTION="${HOST_MPIRUN_COMMAND} -pgmmodel mpmd -cmdfile ./run_file" |
---|
| 1818 | |
---|
| 1819 | IGCM_sys_Chmod u+x run_file |
---|
[428] | 1820 | if ( $DEBUG_sys ) ; then |
---|
[810] | 1821 | echo "run_file contains : " |
---|
| 1822 | cat run_file |
---|
[428] | 1823 | fi |
---|
| 1824 | |
---|
[810] | 1825 | else # Only one executable. launch it. |
---|
[428] | 1826 | |
---|
[810] | 1827 | for comp in ${config_ListOfComponents[*]} ; do |
---|
[428] | 1828 | |
---|
[810] | 1829 | # Only if we really have an executable for the component : |
---|
| 1830 | eval ExeNameOut=\${config_Executable_${comp}[1]} |
---|
| 1831 | if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${ExeNameOut}" != "Xinca.dat" ] ) ; then |
---|
| 1832 | EXECUTION="${HOST_MPIRUN_COMMAND} ./${ExeNameOut}" |
---|
| 1833 | fi |
---|
[786] | 1834 | |
---|
[810] | 1835 | done |
---|
[428] | 1836 | |
---|
[810] | 1837 | fi |
---|
[428] | 1838 | |
---|
[811] | 1839 | IGCM_debug_Print 1 "sys iitm : execution command is" |
---|
[810] | 1840 | IGCM_debug_Print 1 "$EXECUTION" |
---|
[428] | 1841 | |
---|
[810] | 1842 | IGCM_debug_PopStack "IGCM_sys_build_execution_scripts" |
---|
[428] | 1843 | } |
---|
[651] | 1844 | |
---|
[933] | 1845 | #D-#================================================== |
---|
| 1846 | #D-function IGCM_sys_check_path |
---|
| 1847 | #D-* Purpose: check that RUN_DIR_PATH that will be removed on some machine |
---|
| 1848 | #D-* do not point to an important use directory. Stop immediately in that case. |
---|
| 1849 | #D-* Examples: |
---|
| 1850 | #D- |
---|
| 1851 | function IGCM_sys_check_path { |
---|
| 1852 | IGCM_debug_PushStack "IGCM_sys_check_path" |
---|
| 1853 | if ( $DEBUG_sys ) ; then |
---|
| 1854 | echo "IGCM_sys_check_path" |
---|
| 1855 | fi |
---|
[810] | 1856 | |
---|
[933] | 1857 | if ( [ X${RUN_DIR_PATH} = X${HOME} ] || [ X${RUN_DIR_PATH} = X${WORKDIR} ] || [ X${RUN_DIR_PATH} = X${ARCHIVE} ] ) ; then |
---|
| 1858 | IGCM_debug_Print 1 "Variable RUN_DIR_PATH is pointing to an important directory : ${RUN_DIR_PATH}" |
---|
| 1859 | IGCM_debug_Print 1 "Please check the RUN_DIR_PATH definition in your Job : Job_${config_UserChoices_JobName}" |
---|
[936] | 1860 | IGCM_debug_Exit "This will stop the job" |
---|
[933] | 1861 | fi |
---|
| 1862 | IGCM_debug_PopStack "IGCM_sys_check_path" |
---|
| 1863 | } |
---|
| 1864 | |
---|
[810] | 1865 | #D-#================================================== |
---|
| 1866 | #D-function IGCM_sys_check_quota. Dummy call here |
---|
| 1867 | #D-* Purpose: check user quota. Stop the simulation if quota above 90% |
---|
| 1868 | #D-* Examples: |
---|
| 1869 | #D- |
---|
[651] | 1870 | function IGCM_sys_check_quota { |
---|
[810] | 1871 | IGCM_debug_PushStack "IGCM_sys_check_quota" |
---|
| 1872 | if ( $DEBUG_sys ) ; then |
---|
| 1873 | echo "IGCM_sys_check_quota" |
---|
| 1874 | fi |
---|
| 1875 | IGCM_debug_PopStack "IGCM_sys_check_quota" |
---|
| 1876 | } |
---|
| 1877 | |
---|
| 1878 | #D-#================================================== |
---|
| 1879 | #D-function IGCM_sys_CountJobInQueue |
---|
| 1880 | #D-* Purpose: Check if job_name is currently |
---|
| 1881 | #D- running or in queue |
---|
| 1882 | #D-* Examples: IGCM_sys_CountJobInQueue ${JobName} NbRun |
---|
| 1883 | #D- |
---|
| 1884 | function IGCM_sys_CountJobInQueue { |
---|
| 1885 | IGCM_debug_PushStack "IGCM_sys_CountJobInQueue" |
---|
| 1886 | if ( $DEBUG_sys ) ; then |
---|
| 1887 | echo "IGCM_sys_CountJobInQueue" |
---|
| 1888 | fi |
---|
| 1889 | |
---|
| 1890 | # Print only the full (-W) JobName (%jn) |
---|
| 1891 | NbRun=$( llq -W -f %jn | grep -c "$1" ) |
---|
| 1892 | |
---|
| 1893 | eval ${2}=${NbRun} |
---|
| 1894 | |
---|
| 1895 | IGCM_debug_PopStack "IGCM_sys_CountJobInQueue" |
---|
| 1896 | } |
---|
| 1897 | |
---|
| 1898 | ############################################################## |
---|
| 1899 | # NCO OPERATOR |
---|
| 1900 | |
---|
| 1901 | #D-#================================================== |
---|
| 1902 | #D-function IGCM_sys_ncap2 |
---|
| 1903 | #D-* Purpose: encapsulate ncap2 call so as to manage error code and retry |
---|
| 1904 | #D-* Examples: |
---|
| 1905 | #D- |
---|
| 1906 | function IGCM_sys_ncap2 { |
---|
[1057] | 1907 | IGCM_debug_PushStack "IGCM_sys_ncap2" $@ |
---|
[810] | 1908 | if ( $DEBUG_sys ) ; then |
---|
| 1909 | echo "IGCM_sys_ncap2 :" $@ |
---|
| 1910 | fi |
---|
| 1911 | |
---|
| 1912 | typeset NB_ESSAI DELAI status i |
---|
| 1913 | # number of tentative |
---|
| 1914 | NB_ESSAI=3 |
---|
| 1915 | # time delay between tentative |
---|
| 1916 | DELAI=2 |
---|
| 1917 | |
---|
| 1918 | i=0 |
---|
| 1919 | while [ $i -lt $NB_ESSAI ] ; do |
---|
[938] | 1920 | ncap2 "$@" > /tmp/out_command.$$ 2>&1 |
---|
[810] | 1921 | status=$? |
---|
| 1922 | if [ ${status} -gt 0 ] ; then |
---|
| 1923 | IGCM_debug_Print 2 "IGCM_sys_ncap2 : error code ${status}" |
---|
[938] | 1924 | cat /tmp/out_command.$$ |
---|
| 1925 | \rm /tmp/out_command.$$ |
---|
[810] | 1926 | IGCM_debug_Print 2 "IGCM_sys_ncap2 : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
| 1927 | sleep $DELAI |
---|
| 1928 | else |
---|
[938] | 1929 | \rm /tmp/out_command.$$ |
---|
[810] | 1930 | break |
---|
[651] | 1931 | fi |
---|
[810] | 1932 | (( i = i + 1 )) |
---|
| 1933 | done |
---|
| 1934 | |
---|
| 1935 | if [ ${status} -gt 0 ] ; then |
---|
[811] | 1936 | echo "IGCM_sys_ncap2 : ncap2 error" |
---|
| 1937 | IGCM_debug_Exit "ncap2" |
---|
[810] | 1938 | fi |
---|
| 1939 | |
---|
| 1940 | IGCM_debug_PopStack "IGCM_sys_ncap2" |
---|
[651] | 1941 | } |
---|
[810] | 1942 | |
---|
| 1943 | #D-#================================================== |
---|
| 1944 | #D-function IGCM_sys_ncatted |
---|
| 1945 | #D-* Purpose: encapsulate ncatted call so as to manage error code and retry |
---|
| 1946 | #D-* Examples: |
---|
| 1947 | #D- |
---|
| 1948 | function IGCM_sys_ncatted { |
---|
[1057] | 1949 | IGCM_debug_PushStack "IGCM_sys_ncatted" $@ |
---|
[810] | 1950 | if ( $DEBUG_sys ) ; then |
---|
| 1951 | echo "IGCM_sys_ncatted :" $@ |
---|
| 1952 | fi |
---|
| 1953 | |
---|
| 1954 | typeset NB_ESSAI DELAI status i |
---|
| 1955 | # number of tentative |
---|
| 1956 | NB_ESSAI=3 |
---|
| 1957 | # time delay between tentative |
---|
| 1958 | DELAI=2 |
---|
| 1959 | |
---|
| 1960 | i=0 |
---|
| 1961 | while [ $i -lt $NB_ESSAI ] ; do |
---|
[938] | 1962 | ncatted "$@" > /tmp/out_command.$$ 2>&1 |
---|
[810] | 1963 | status=$? |
---|
| 1964 | if [ ${status} -gt 0 ] ; then |
---|
| 1965 | IGCM_debug_Print 2 "IGCM_sys_ncatted : error code ${status}" |
---|
[938] | 1966 | cat /tmp/out_command.$$ |
---|
| 1967 | \rm /tmp/out_command.$$ |
---|
[810] | 1968 | IGCM_debug_Print 2 "IGCM_sys_ncatted : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
| 1969 | sleep $DELAI |
---|
| 1970 | else |
---|
[938] | 1971 | \rm /tmp/out_command.$$ |
---|
[810] | 1972 | break |
---|
| 1973 | fi |
---|
| 1974 | (( i = i + 1 )) |
---|
| 1975 | done |
---|
| 1976 | |
---|
| 1977 | if [ ${status} -gt 0 ] ; then |
---|
[811] | 1978 | echo "IGCM_sys_ncatted : ncatted error" |
---|
| 1979 | IGCM_debug_Exit "ncatted" |
---|
[810] | 1980 | fi |
---|
| 1981 | |
---|
| 1982 | IGCM_debug_PopStack "IGCM_sys_ncatted" |
---|
| 1983 | } |
---|
| 1984 | |
---|
| 1985 | #D-#================================================== |
---|
| 1986 | #D-function IGCM_sys_ncbo |
---|
| 1987 | #D-* Purpose: encapsulate ncbo call so as to manage error code and retry |
---|
| 1988 | #D-* Examples: |
---|
| 1989 | #D- |
---|
| 1990 | function IGCM_sys_ncbo { |
---|
[1057] | 1991 | IGCM_debug_PushStack "IGCM_sys_ncbo" $@ |
---|
[810] | 1992 | if ( $DEBUG_sys ) ; then |
---|
| 1993 | echo "IGCM_sys_ncbo :" $@ |
---|
| 1994 | fi |
---|
| 1995 | |
---|
| 1996 | typeset NB_ESSAI DELAI status i |
---|
| 1997 | # number of tentative |
---|
| 1998 | NB_ESSAI=3 |
---|
| 1999 | # time delay between tentative |
---|
| 2000 | DELAI=2 |
---|
| 2001 | |
---|
| 2002 | i=0 |
---|
| 2003 | while [ $i -lt $NB_ESSAI ] ; do |
---|
[938] | 2004 | ncbo $@ > /tmp/out_command.$$ 2>&1 |
---|
[810] | 2005 | status=$? |
---|
| 2006 | if [ ${status} -gt 0 ] ; then |
---|
| 2007 | IGCM_debug_Print 2 "IGCM_sys_ncbo : error code ${status}" |
---|
[938] | 2008 | cat /tmp/out_command.$$ |
---|
| 2009 | \rm /tmp/out_command.$$ |
---|
[810] | 2010 | IGCM_debug_Print 2 "IGCM_sys_ncbo : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
| 2011 | sleep $DELAI |
---|
| 2012 | else |
---|
[938] | 2013 | \rm /tmp/out_command.$$ |
---|
[810] | 2014 | break |
---|
| 2015 | fi |
---|
| 2016 | (( i = i + 1 )) |
---|
| 2017 | done |
---|
| 2018 | |
---|
| 2019 | if [ ${status} -gt 0 ] ; then |
---|
[811] | 2020 | echo "IGCM_sys_ncbo : ncbo error" |
---|
| 2021 | IGCM_debug_Exit "ncbo" |
---|
[810] | 2022 | fi |
---|
| 2023 | |
---|
| 2024 | IGCM_debug_PopStack "IGCM_sys_ncbo" |
---|
| 2025 | } |
---|
| 2026 | |
---|
| 2027 | #D-#================================================== |
---|
| 2028 | #D-function IGCM_sys_ncdif |
---|
| 2029 | #D-* Purpose: encapsulate ncdiff call so as to manage error code and retry |
---|
| 2030 | #D-* Examples: |
---|
| 2031 | #D- |
---|
| 2032 | function IGCM_sys_ncdiff { |
---|
[1057] | 2033 | IGCM_debug_PushStack "IGCM_sys_ncdiff" $@ |
---|
[810] | 2034 | if ( $DEBUG_sys ) ; then |
---|
| 2035 | echo "IGCM_sys_ncdiff :" $@ |
---|
| 2036 | fi |
---|
| 2037 | |
---|
| 2038 | typeset NB_ESSAI DELAI status i |
---|
| 2039 | # number of tentative |
---|
| 2040 | NB_ESSAI=3 |
---|
| 2041 | # time delay between tentative |
---|
| 2042 | DELAI=2 |
---|
| 2043 | |
---|
| 2044 | i=0 |
---|
| 2045 | while [ $i -lt $NB_ESSAI ] ; do |
---|
[938] | 2046 | ncdiff $@ > /tmp/out_command.$$ 2>&1 |
---|
[810] | 2047 | status=$? |
---|
| 2048 | if [ ${status} -gt 0 ] ; then |
---|
| 2049 | IGCM_debug_Print 2 "IGCM_sys_ncdiff : error code ${status}" |
---|
[938] | 2050 | cat /tmp/out_command.$$ |
---|
| 2051 | \rm /tmp/out_command.$$ |
---|
[810] | 2052 | IGCM_debug_Print 2 "IGCM_sys_ncdiff : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
| 2053 | sleep $DELAI |
---|
| 2054 | else |
---|
[938] | 2055 | \rm /tmp/out_command.$$ |
---|
[810] | 2056 | break |
---|
| 2057 | fi |
---|
| 2058 | (( i = i + 1 )) |
---|
| 2059 | done |
---|
| 2060 | |
---|
| 2061 | if [ ${status} -gt 0 ] ; then |
---|
[811] | 2062 | echo "IGCM_sys_ncdiff : ncdiff error" |
---|
| 2063 | IGCM_debug_Exit "ncdiff" |
---|
[810] | 2064 | fi |
---|
| 2065 | |
---|
| 2066 | IGCM_debug_PopStack "IGCM_sys_ncdiff" |
---|
| 2067 | } |
---|
| 2068 | |
---|
| 2069 | #D-#================================================== |
---|
| 2070 | #D-function IGCM_sys_ncea |
---|
| 2071 | #D-* Purpose: encapsulate ncea call so as to manage error code and retry |
---|
| 2072 | #D-* Examples: |
---|
| 2073 | #D- |
---|
| 2074 | function IGCM_sys_ncea { |
---|
[1057] | 2075 | IGCM_debug_PushStack "IGCM_sys_ncea" $@ |
---|
[810] | 2076 | if ( $DEBUG_sys ) ; then |
---|
| 2077 | echo "IGCM_sys_ncea :" $@ |
---|
| 2078 | fi |
---|
| 2079 | |
---|
| 2080 | typeset NB_ESSAI DELAI status i |
---|
| 2081 | # number of tentative |
---|
| 2082 | NB_ESSAI=3 |
---|
| 2083 | # time delay between tentative |
---|
| 2084 | DELAI=2 |
---|
| 2085 | |
---|
| 2086 | i=0 |
---|
| 2087 | while [ $i -lt $NB_ESSAI ] ; do |
---|
[938] | 2088 | ncea $@ > /tmp/out_command.$$ 2>&1 |
---|
[810] | 2089 | status=$? |
---|
| 2090 | if [ ${status} -gt 0 ] ; then |
---|
| 2091 | IGCM_debug_Print 2 "IGCM_sys_ncea : error code ${status}" |
---|
[938] | 2092 | cat /tmp/out_command.$$ |
---|
| 2093 | \rm /tmp/out_command.$$ |
---|
[810] | 2094 | IGCM_debug_Print 2 "IGCM_sys_ncea : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
| 2095 | sleep $DELAI |
---|
| 2096 | else |
---|
[938] | 2097 | \rm /tmp/out_command.$$ |
---|
[810] | 2098 | break |
---|
| 2099 | fi |
---|
| 2100 | (( i = i + 1 )) |
---|
| 2101 | done |
---|
| 2102 | |
---|
| 2103 | if [ ${status} -gt 0 ] ; then |
---|
[811] | 2104 | echo "IGCM_sys_ncea : ncea error" |
---|
| 2105 | IGCM_debug_Exit "ncea" |
---|
[810] | 2106 | fi |
---|
| 2107 | |
---|
| 2108 | IGCM_debug_PopStack "IGCM_sys_ncea" |
---|
| 2109 | } |
---|
| 2110 | |
---|
| 2111 | #D-#================================================== |
---|
| 2112 | #D-function IGCM_sys_ncecat |
---|
| 2113 | #D-* Purpose: encapsulate ncecat call so as to manage error code and retry |
---|
| 2114 | #D-* Examples: |
---|
| 2115 | #D- |
---|
| 2116 | function IGCM_sys_ncecat { |
---|
[1057] | 2117 | IGCM_debug_PushStack "IGCM_sys_ncecat" $@ |
---|
[810] | 2118 | if ( $DEBUG_sys ) ; then |
---|
| 2119 | echo "IGCM_sys_ncecat :" $@ |
---|
| 2120 | fi |
---|
| 2121 | |
---|
| 2122 | typeset NB_ESSAI DELAI status i |
---|
| 2123 | # number of tentative |
---|
| 2124 | NB_ESSAI=3 |
---|
| 2125 | # time delay between tentative |
---|
| 2126 | DELAI=2 |
---|
| 2127 | |
---|
| 2128 | i=0 |
---|
| 2129 | while [ $i -lt $NB_ESSAI ] ; do |
---|
[938] | 2130 | ncecat $@ > /tmp/out_command.$$ 2>&1 |
---|
[810] | 2131 | status=$? |
---|
| 2132 | if [ ${status} -gt 0 ] ; then |
---|
| 2133 | IGCM_debug_Print 2 "IGCM_sys_ncecat : error code ${status}" |
---|
[938] | 2134 | cat /tmp/out_command.$$ |
---|
| 2135 | \rm /tmp/out_command.$$ |
---|
[810] | 2136 | IGCM_debug_Print 2 "IGCM_sys_ncecat : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
| 2137 | sleep $DELAI |
---|
| 2138 | else |
---|
[938] | 2139 | \rm /tmp/out_command.$$ |
---|
[810] | 2140 | break |
---|
| 2141 | fi |
---|
| 2142 | (( i = i + 1 )) |
---|
| 2143 | done |
---|
| 2144 | |
---|
| 2145 | if [ ${status} -gt 0 ] ; then |
---|
[811] | 2146 | echo "IGCM_sys_ncecat : ncecat error" |
---|
| 2147 | IGCM_debug_Exit "ncecat" |
---|
[810] | 2148 | fi |
---|
| 2149 | |
---|
| 2150 | IGCM_debug_PopStack "IGCM_sys_ncecat" |
---|
| 2151 | } |
---|
| 2152 | |
---|
| 2153 | #D-#================================================== |
---|
| 2154 | #D-function IGCM_sys_ncflint |
---|
| 2155 | #D-* Purpose: encapsulate ncflint call so as to manage error code and retry |
---|
| 2156 | #D-* Examples: |
---|
| 2157 | #D- |
---|
| 2158 | function IGCM_sys_ncflint { |
---|
[1057] | 2159 | IGCM_debug_PushStack "IGCM_sys_ncflint" $@ |
---|
[810] | 2160 | if ( $DEBUG_sys ) ; then |
---|
| 2161 | echo "IGCM_sys_ncflint :" $@ |
---|
| 2162 | fi |
---|
| 2163 | |
---|
| 2164 | typeset NB_ESSAI DELAI status i |
---|
| 2165 | # number of tentative |
---|
| 2166 | NB_ESSAI=3 |
---|
| 2167 | # time delay between tentative |
---|
| 2168 | DELAI=2 |
---|
| 2169 | |
---|
| 2170 | i=0 |
---|
| 2171 | while [ $i -lt $NB_ESSAI ] ; do |
---|
[938] | 2172 | ncflint $@ > /tmp/out_command.$$ 2>&1 |
---|
[810] | 2173 | status=$? |
---|
| 2174 | if [ ${status} -gt 0 ] ; then |
---|
| 2175 | IGCM_debug_Print 2 "IGCM_sys_ncflint : error code ${status}" |
---|
[938] | 2176 | cat /tmp/out_command.$$ |
---|
| 2177 | \rm /tmp/out_command.$$ |
---|
[810] | 2178 | IGCM_debug_Print 2 "IGCM_sys_ncflint : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
| 2179 | sleep $DELAI |
---|
| 2180 | else |
---|
[938] | 2181 | \rm /tmp/out_command.$$ |
---|
[810] | 2182 | break |
---|
| 2183 | fi |
---|
| 2184 | (( i = i + 1 )) |
---|
| 2185 | done |
---|
| 2186 | |
---|
| 2187 | if [ ${status} -gt 0 ] ; then |
---|
[811] | 2188 | echo "IGCM_sys_ncflint : ncflint error" |
---|
| 2189 | IGCM_debug_Exit "ncflint" |
---|
[810] | 2190 | fi |
---|
| 2191 | |
---|
| 2192 | IGCM_debug_PopStack "IGCM_sys_ncflint" |
---|
| 2193 | } |
---|
| 2194 | |
---|
| 2195 | #D-#================================================== |
---|
| 2196 | #D-function IGCM_sys_ncks |
---|
| 2197 | #D-* Purpose: encapsulate ncks call so as to manage error code and retry |
---|
| 2198 | #D-* Examples: |
---|
| 2199 | #D- |
---|
| 2200 | function IGCM_sys_ncks { |
---|
[1057] | 2201 | IGCM_debug_PushStack "IGCM_sys_ncks" $@ |
---|
[810] | 2202 | if ( $DEBUG_sys ) ; then |
---|
| 2203 | echo "IGCM_sys_ncks :" $@ |
---|
| 2204 | fi |
---|
| 2205 | |
---|
| 2206 | typeset NB_ESSAI DELAI status i |
---|
| 2207 | # number of tentative |
---|
| 2208 | NB_ESSAI=3 |
---|
| 2209 | # time delay between tentative |
---|
| 2210 | DELAI=2 |
---|
| 2211 | |
---|
| 2212 | i=0 |
---|
| 2213 | while [ $i -lt $NB_ESSAI ] ; do |
---|
[938] | 2214 | ncks $@ > /tmp/out_command.$$ 2>&1 |
---|
[810] | 2215 | status=$? |
---|
| 2216 | if [ ${status} -gt 0 ] ; then |
---|
| 2217 | IGCM_debug_Print 2 "IGCM_sys_ncks : error code ${status}" |
---|
[938] | 2218 | cat /tmp/out_command.$$ |
---|
| 2219 | \rm /tmp/out_command.$$ |
---|
[810] | 2220 | IGCM_debug_Print 2 "IGCM_sys_ncks : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
| 2221 | sleep $DELAI |
---|
| 2222 | else |
---|
[938] | 2223 | \rm /tmp/out_command.$$ |
---|
[810] | 2224 | break |
---|
| 2225 | fi |
---|
| 2226 | (( i = i + 1 )) |
---|
| 2227 | done |
---|
| 2228 | |
---|
| 2229 | if [ ${status} -gt 0 ] ; then |
---|
[811] | 2230 | echo "IGCM_sys_ncks : ncks error" |
---|
| 2231 | IGCM_debug_Exit "ncks" |
---|
[810] | 2232 | fi |
---|
| 2233 | |
---|
| 2234 | IGCM_debug_PopStack "IGCM_sys_ncks" |
---|
| 2235 | } |
---|
| 2236 | |
---|
| 2237 | #D-#================================================== |
---|
| 2238 | #D-function IGCM_sys_ncpdq |
---|
| 2239 | #D-* Purpose: encapsulate ncpdq call so as to manage error code and retry |
---|
| 2240 | #D-* Examples: |
---|
| 2241 | #D- |
---|
| 2242 | function IGCM_sys_ncpdq { |
---|
[1057] | 2243 | IGCM_debug_PushStack "IGCM_sys_ncpdq" $@ |
---|
[810] | 2244 | if ( $DEBUG_sys ) ; then |
---|
| 2245 | echo "IGCM_sys_ncpdq :" $@ |
---|
| 2246 | fi |
---|
| 2247 | |
---|
| 2248 | typeset NB_ESSAI DELAI status i |
---|
| 2249 | # number of tentative |
---|
| 2250 | NB_ESSAI=3 |
---|
| 2251 | # time delay between tentative |
---|
| 2252 | DELAI=2 |
---|
| 2253 | |
---|
| 2254 | i=0 |
---|
| 2255 | while [ $i -lt $NB_ESSAI ] ; do |
---|
[938] | 2256 | ncpdq $@ > /tmp/out_command.$$ 2>&1 |
---|
[810] | 2257 | status=$? |
---|
| 2258 | if [ ${status} -gt 0 ] ; then |
---|
| 2259 | IGCM_debug_Print 2 "IGCM_sys_ncpdq : error code ${status}" |
---|
[938] | 2260 | cat /tmp/out_command.$$ |
---|
| 2261 | \rm /tmp/out_command.$$ |
---|
[810] | 2262 | IGCM_debug_Print 2 "IGCM_sys_ncpdq : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
| 2263 | sleep $DELAI |
---|
| 2264 | else |
---|
[938] | 2265 | \rm /tmp/out_command.$$ |
---|
[810] | 2266 | break |
---|
| 2267 | fi |
---|
| 2268 | (( i = i + 1 )) |
---|
| 2269 | done |
---|
| 2270 | |
---|
| 2271 | if [ ${status} -gt 0 ] ; then |
---|
[811] | 2272 | echo "IGCM_sys_ncpdq : ncpdq error" |
---|
| 2273 | IGCM_debug_Exit "ncpdq" |
---|
[810] | 2274 | fi |
---|
| 2275 | |
---|
| 2276 | IGCM_debug_PopStack "IGCM_sys_ncpdq" |
---|
| 2277 | } |
---|
| 2278 | |
---|
| 2279 | #D-#================================================== |
---|
| 2280 | #D-function IGCM_sys_ncra |
---|
| 2281 | #D-* Purpose: encapsulate ncra call so as to manage error code and retry |
---|
| 2282 | #D-* Examples: |
---|
| 2283 | #D- |
---|
| 2284 | function IGCM_sys_ncra { |
---|
[1057] | 2285 | IGCM_debug_PushStack "IGCM_sys_ncra" $@ |
---|
[810] | 2286 | if ( $DEBUG_sys ) ; then |
---|
| 2287 | echo "IGCM_sys_ncra :" $@ |
---|
| 2288 | fi |
---|
| 2289 | |
---|
| 2290 | typeset NB_ESSAI DELAI status i |
---|
| 2291 | # number of tentative |
---|
| 2292 | NB_ESSAI=3 |
---|
| 2293 | # time delay between tentative |
---|
| 2294 | DELAI=2 |
---|
| 2295 | |
---|
| 2296 | i=0 |
---|
| 2297 | while [ $i -lt $NB_ESSAI ] ; do |
---|
[938] | 2298 | ncra $@ > /tmp/out_command.$$ 2>&1 |
---|
[810] | 2299 | status=$? |
---|
| 2300 | if [ ${status} -gt 0 ] ; then |
---|
| 2301 | IGCM_debug_Print 2 "IGCM_sys_ncra : error code ${status}" |
---|
[938] | 2302 | cat /tmp/out_command.$$ |
---|
| 2303 | \rm /tmp/out_command.$$ |
---|
[810] | 2304 | IGCM_debug_Print 2 "IGCM_sys_ncra : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
| 2305 | sleep $DELAI |
---|
| 2306 | else |
---|
[938] | 2307 | \rm /tmp/out_command.$$ |
---|
[810] | 2308 | break |
---|
| 2309 | fi |
---|
| 2310 | (( i = i + 1 )) |
---|
| 2311 | done |
---|
| 2312 | |
---|
| 2313 | if [ ${status} -gt 0 ] ; then |
---|
[811] | 2314 | echo "IGCM_sys_ncra : ncra error" |
---|
| 2315 | IGCM_debug_Exit "ncra" |
---|
[810] | 2316 | fi |
---|
| 2317 | |
---|
| 2318 | IGCM_debug_PopStack "IGCM_sys_ncra" |
---|
| 2319 | } |
---|
| 2320 | |
---|
| 2321 | #D-#================================================== |
---|
| 2322 | #D-function IGCM_sys_ncrcat |
---|
| 2323 | #D-* Purpose: encapsulate ncrcat call so as to manage error code and retry |
---|
| 2324 | #D-* Examples: |
---|
| 2325 | #D- |
---|
| 2326 | function IGCM_sys_ncrcat { |
---|
[1057] | 2327 | IGCM_debug_PushStack "IGCM_sys_ncrcat" $@ |
---|
[810] | 2328 | if ( $DEBUG_sys ) ; then |
---|
| 2329 | echo "IGCM_sys_ncrcat :" $@ |
---|
| 2330 | fi |
---|
| 2331 | |
---|
| 2332 | typeset NB_ESSAI DELAI status i lastArg |
---|
| 2333 | # number of tentative |
---|
| 2334 | NB_ESSAI=3 |
---|
| 2335 | # time delay between tentative |
---|
| 2336 | DELAI=2 |
---|
| 2337 | |
---|
| 2338 | i=0 |
---|
| 2339 | while [ $i -lt $NB_ESSAI ] ; do |
---|
[938] | 2340 | ncrcat $@ > /tmp/out_command.$$ 2>&1 |
---|
[810] | 2341 | status=$? |
---|
| 2342 | if [ ${status} -gt 0 ] ; then |
---|
| 2343 | IGCM_debug_Print 2 "IGCM_sys_ncrcat : error code ${status}" |
---|
[938] | 2344 | cat /tmp/out_command.$$ |
---|
| 2345 | \rm /tmp/out_command.$$ |
---|
[810] | 2346 | IGCM_debug_Print 2 "IGCM_sys_ncrcat : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
| 2347 | sleep $DELAI |
---|
[938] | 2348 | elif [ ! "X$( grep "WARNING Intra-file non-monotonicity" /tmp/out_command.$$ )" = "X" ] ; then |
---|
[810] | 2349 | IGCM_debug_Print 2 "IGCM_sys_ncrcat : WARNING Intra-file non-monotonicity" |
---|
[938] | 2350 | cat /tmp/out_command.$$ |
---|
[810] | 2351 | # remove files having corrupted time axis |
---|
| 2352 | eval lastArg=\${$#} |
---|
| 2353 | IGCM_debug_Print 2 "IGCM_sys_ncrcat : Delete ${lastArg}" |
---|
| 2354 | \rm ${lastArg} |
---|
[938] | 2355 | \rm /tmp/out_command.$$ |
---|
[810] | 2356 | IGCM_debug_Print 2 "IGCM_sys_ncrcat : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
| 2357 | sleep $DELAI |
---|
| 2358 | else |
---|
[938] | 2359 | \rm /tmp/out_command.$$ |
---|
[810] | 2360 | break |
---|
| 2361 | fi |
---|
| 2362 | (( i = i + 1 )) |
---|
| 2363 | done |
---|
| 2364 | |
---|
| 2365 | if [ ${status} -gt 0 ] ; then |
---|
[811] | 2366 | echo "IGCM_sys_ncrcat : ncrcat error" |
---|
[810] | 2367 | #IGCM_debug_Exit "ncrcat" |
---|
| 2368 | fi |
---|
| 2369 | |
---|
| 2370 | IGCM_debug_PopStack "IGCM_sys_ncrcat" |
---|
| 2371 | } |
---|
| 2372 | |
---|
| 2373 | #D-#================================================== |
---|
| 2374 | #D-function IGCM_sys_ncrename |
---|
| 2375 | #D-* Purpose: encapsulate ncrename call so as to manage error code and retry |
---|
| 2376 | #D-* Examples: |
---|
| 2377 | #D- |
---|
| 2378 | function IGCM_sys_ncrename { |
---|
[1057] | 2379 | IGCM_debug_PushStack "IGCM_sys_ncrename" $@ |
---|
[810] | 2380 | if ( $DEBUG_sys ) ; then |
---|
| 2381 | echo "IGCM_sys_ncrename :" $@ |
---|
| 2382 | fi |
---|
| 2383 | |
---|
| 2384 | typeset NB_ESSAI DELAI status i |
---|
| 2385 | # number of tentative |
---|
| 2386 | NB_ESSAI=3 |
---|
| 2387 | # time delay between tentative |
---|
| 2388 | DELAI=2 |
---|
| 2389 | |
---|
| 2390 | i=0 |
---|
| 2391 | while [ $i -lt $NB_ESSAI ] ; do |
---|
[938] | 2392 | ncrename $@ > /tmp/out_command.$$ 2>&1 |
---|
[810] | 2393 | status=$? |
---|
| 2394 | if [ ${status} -gt 0 ] ; then |
---|
| 2395 | IGCM_debug_Print 2 "IGCM_sys_ncrename : error code ${status}" |
---|
[938] | 2396 | cat /tmp/out_command.$$ |
---|
| 2397 | \rm /tmp/out_command.$$ |
---|
[810] | 2398 | IGCM_debug_Print 2 "IGCM_sys_ncrename : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
| 2399 | sleep $DELAI |
---|
| 2400 | else |
---|
[938] | 2401 | \rm /tmp/out_command.$$ |
---|
[810] | 2402 | break |
---|
| 2403 | fi |
---|
| 2404 | (( i = i + 1 )) |
---|
| 2405 | done |
---|
| 2406 | |
---|
| 2407 | if [ ${status} -gt 0 ] ; then |
---|
[811] | 2408 | echo "IGCM_sys_ncrename : ncrename error" |
---|
| 2409 | IGCM_debug_Exit "ncrename" |
---|
[810] | 2410 | fi |
---|
| 2411 | |
---|
| 2412 | IGCM_debug_PopStack "IGCM_sys_ncrename" |
---|
| 2413 | } |
---|
| 2414 | |
---|
| 2415 | #D-#================================================== |
---|
| 2416 | #D-function IGCM_sys_ncwa |
---|
| 2417 | #D-* Purpose: encapsulate ncwa call so as to manage error code and retry |
---|
| 2418 | #D-* Examples: |
---|
| 2419 | #D- |
---|
| 2420 | function IGCM_sys_ncwa { |
---|
[1057] | 2421 | IGCM_debug_PushStack "IGCM_sys_ncwa" $@ |
---|
[810] | 2422 | if ( $DEBUG_sys ) ; then |
---|
| 2423 | echo "IGCM_sys_ncwa :" $@ |
---|
| 2424 | fi |
---|
| 2425 | |
---|
| 2426 | typeset NB_ESSAI DELAI status i |
---|
| 2427 | # number of tentative |
---|
| 2428 | NB_ESSAI=3 |
---|
| 2429 | # time delay between tentative |
---|
| 2430 | DELAI=2 |
---|
| 2431 | |
---|
| 2432 | i=0 |
---|
| 2433 | while [ $i -lt $NB_ESSAI ] ; do |
---|
[938] | 2434 | ncwa $@ > /tmp/out_command.$$ 2>&1 |
---|
[810] | 2435 | status=$? |
---|
| 2436 | if [ ${status} -gt 0 ] ; then |
---|
| 2437 | IGCM_debug_Print 2 "IGCM_sys_ncwa : error code ${status}" |
---|
[938] | 2438 | cat /tmp/out_command.$$ |
---|
| 2439 | \rm /tmp/out_command.$$ |
---|
[810] | 2440 | IGCM_debug_Print 2 "IGCM_sys_ncwa : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again." |
---|
| 2441 | sleep $DELAI |
---|
| 2442 | else |
---|
[938] | 2443 | \rm /tmp/out_command.$$ |
---|
[810] | 2444 | break |
---|
| 2445 | fi |
---|
| 2446 | (( i = i + 1 )) |
---|
| 2447 | done |
---|
| 2448 | |
---|
| 2449 | if [ ${status} -gt 0 ] ; then |
---|
[811] | 2450 | echo "IGCM_sys_ncwa : ncwa error" |
---|
| 2451 | IGCM_debug_Exit "ncwa" |
---|
[810] | 2452 | fi |
---|
| 2453 | |
---|
| 2454 | IGCM_debug_PopStack "IGCM_sys_ncwa" |
---|
| 2455 | } |
---|
| 2456 | |
---|
| 2457 | ############################################################## |
---|
| 2458 | # CDO OPERATOR |
---|
| 2459 | |
---|
| 2460 | #D-#================================================== |
---|
| 2461 | #D-function IGCM_sys_cdo |
---|
| 2462 | #D-* Purpose: encapsulate cdo call so as to manage error code and retry |
---|
| 2463 | #D-* Examples: |
---|
| 2464 | #D- |
---|
| 2465 | function IGCM_sys_cdo { |
---|
[1057] | 2466 | IGCM_debug_PushStack "IGCM_sys_cdo" $@ |
---|
[810] | 2467 | if ( $DEBUG_sys ) ; then |
---|
| 2468 | echo "IGCM_sys_cdo :" $@ |
---|
| 2469 | fi |
---|
| 2470 | |
---|
| 2471 | typeset status |
---|
| 2472 | |
---|
[938] | 2473 | \cdo $@ > /tmp/out_command.$$ 2>&1 |
---|
[810] | 2474 | status=$? |
---|
| 2475 | if [ ${status} -gt 0 ] ; then |
---|
| 2476 | echo "IGCM_sys_cdo : error code ${status}" |
---|
[938] | 2477 | cat /tmp/out_command.$$ |
---|
| 2478 | \rm /tmp/out_command.$$ |
---|
[810] | 2479 | IGCM_debug_PopStack "IGCM_sys_cdo" |
---|
| 2480 | return 1 |
---|
| 2481 | else |
---|
| 2482 | IGCM_debug_PopStack "IGCM_sys_cdo" |
---|
| 2483 | return 0 |
---|
| 2484 | fi |
---|
| 2485 | |
---|
| 2486 | IGCM_debug_PopStack "IGCM_sys_cdo" |
---|
| 2487 | } |
---|