Changeset 657
- Timestamp:
- 04/17/12 18:06:51 (12 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/libIGCM/libIGCM_sys/libIGCM_sys_obelix.ksh
r651 r657 1 #!/bin/ksh 1 #!/bin/ksh 2 2 3 3 #************************************************************** … … 9 9 # IPSL (2006) 10 10 # This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC 11 # 11 # 12 12 #************************************************************** 13 13 14 14 #========================================================= 15 15 # The documentation of this file can be automatically generated 16 # if you use the prefix #D- for comments to be extracted. 16 # if you use the prefix #D- for comments to be extracted. 17 17 # Extract with command: cat lib* | grep "^#D-" | cut -c "4-" 18 18 #========================================================= … … 22 22 #D-#================================================== 23 23 #D- 24 #D- This ksh library if a layer under some usefull 24 #D- This ksh library if a layer under some usefull 25 25 #D-environment variables and shell commands. 26 26 #D-All those definitions depend on host particularities. … … 62 62 63 63 #===================================================== 64 # Host and user names 64 # Host and user names 65 65 # $hostname ou hostname 66 typeset MASTER=${MASTER:=$( hostname )} 66 # $hostname ou hostname 67 typeset HOST=${HOST:=$( hostname )} 67 68 # $username ou whoami 68 69 typeset LOGIN=${LOGIN:=$( whoami )} 70 # $hostname of the MASTER job 71 typeset MASTER=${MASTER:=$( hostname )} 69 72 70 73 #D- … … 77 80 # RSYNC_opt args to rsync 78 81 typeset -r RSYNC_opt="-va" 82 # ie storage filesystem 83 typeset -r STOREHOST=${MASTER} 79 84 80 85 #==================================================== … … 91 96 # Host specific DIRECTORIES 92 97 #==================================================== 98 99 #==================================================== 100 #- MirrorlibIGCM for frontend 101 typeset -r MirrorlibIGCM=${MirrorlibIGCM:=false} 102 103 #==================================================== 104 #- libIGCM_POST for frontend 105 typeset -r libIGCM_POST=${libIGCM} 93 106 94 107 #==================================================== … … 99 112 #- SCRATCHDIR (=> ${R_DONNEES}) 100 113 if [ X${PBS_O_WORKDIR} != X ] ; then 101 102 #==${WORKDIR} 114 typeset -r SCRATCHDIR=/scratch/$PBS_O_LOGNAME.$PBS_JOBID 115 #==${WORKDIR} 103 116 # cf /usr/Local/Env sur obelix 104 117 else 105 118 typeset -r SCRATCHDIR=/tmp 106 119 fi 107 120 #FOR DEBUG RUN : … … 111 124 #- SUBMIT_DIR : submission dir 112 125 if [ X${PBS_O_WORKDIR} != X ] ; then 113 126 typeset -r SUBMIT_DIR=${SUBMIT_DIR:=${PBS_O_WORKDIR}} 114 127 else 115 128 typeset -r SUBMIT_DIR=${SUBMIT_DIR:=${PWD}} 116 129 fi 117 #==================================================== 118 #- ARCHIVE 130 131 #==================================================== 132 #- ARCHIVE (dedicated to large files) 119 133 typeset -r ARCHIVE=${ARCHIVE:=/home/scratch01/${LOGIN}} 120 134 121 #==================================================== 122 #- libIGCM_POST 123 typeset -r libIGCM_POST=${libIGCM} 135 #- ARCHIVE (dedicated to small/medium files) 136 typeset -r STORAGE=${ARCHIVE} 124 137 125 138 #==================================================== … … 132 145 133 146 #==================================================== 147 #- R_FIG (hosting figures : monitoring and atlas, and/or small files) 148 typeset -r R_FIG=${STORAGE}/IGCM_OUT 149 150 #==================================================== 151 #- R_BUF (ONLY FOR double copy an scratch) 152 typeset -r R_BUF=${SCRATCHDIR}/IGCM_OUT 153 154 #==================================================== 155 #- BIG_DIR : BIG_DIR to store files waiting for rebuild 156 typeset -r BIG_DIR=${BIG_DIR:=${SCRATCHDIR}/REBUILD} 157 158 #==================================================== 134 159 #- OUT_POST 135 160 typeset -r R_OUT_POST=${R_OUT} … … 138 163 #- RUN_DIR_PATH : Temporary working directory (=> TMP) 139 164 typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${SCRATCHDIR}/tmp$$} 140 141 #====================================================142 #- BIG_DIR : BIG_DIR to store files waiting for rebuild143 typeset -r BIG_DIR=${BIG_DIR:=${SCRATCHDIR}/REBUILD}144 165 145 166 #==================================================== … … 155 176 #- Max number of arguments passed to nco operator or demigration command 156 177 UNIX_MAX_LIMIT=360 178 179 #==================================================== 180 #- Number of core per node (max number of OpenMP task) 181 NUM_COREPERNODE=1 182 183 #==================================================== 184 #- Default number of MPI task for IPSL coupled model 185 #- required for backward compatibility 186 #- 187 DEFAULT_NUM_PROC_OCE=1 188 DEFAULT_NUM_PROC_CPL=1 189 (( DEFAULT_NUM_PROC_ATM = BATCH_NUM_PROC_TOT - DEFAULT_NUM_PROC_OCE - DEFAULT_NUM_PROC_CPL )) 190 DEFAULT_NUM_PROC_TOTAL=${BATCH_NUM_PROC_TOT} 157 191 158 192 #D-#================================================== … … 166 200 #D- 167 201 function IGCM_sys_RshMaster { 168 169 170 202 IGCM_debug_PushStack "IGCM_sys_RshMaster" $@ 203 204 ssh obelix3 exec /bin/ksh <<-EOF 171 205 export libIGCM=${libIGCM} 172 206 export DEBUG_debug=${DEBUG_debug} … … 175 209 ${@} 176 210 EOF 177 178 179 180 181 211 if [ $? -gt 0 ] ; then 212 echo "IGCM_sys_RshMaster : erreur." 213 IGCM_debug_Exit "IGCM_sys_RshMaster" 214 fi 215 IGCM_debug_PopStack "IGCM_sys_RshMaster" 182 216 } 183 217 … … 188 222 #D- 189 223 function IGCM_sys_RshArchive { 190 191 224 IGCM_debug_PushStack "IGCM_sys_RshArchive" $@ 225 /bin/ksh <<-EOF 192 226 ${@} 193 227 EOF 194 195 196 197 198 228 if [ $? -gt 0 ] ; then 229 echo "IGCM_sys_RshArchive : erreur." 230 IGCM_debug_Exit "IGCM_sys_RshArchive" 231 fi 232 IGCM_debug_PopStack "IGCM_sys_RshArchive" 199 233 } 200 234 … … 206 240 (( RshPNum = 0 )) 207 241 function IGCM_sys_RshPost { 208 209 210 211 212 213 214 215 216 217 218 242 IGCM_debug_PushStack "IGCM_sys_RshPost" $@ 243 if ( $DEBUG_sys ) ; then 244 echo "IGCM_sys_RshPost :" $@ 245 fi 246 ssh obelix3 exec /bin/ksh $@ > out_RshPost.${RshPNum} 247 if [ $? -gt 0 ] ; then 248 echo "IGCM_sys_RshPost : erreur." 249 IGCM_debug_Exit "IGCM_sys_RshPost" 250 fi 251 (( RshPNum = RshPNum + 1 )) 252 IGCM_debug_PopStack "IGCM_sys_RshPost" 219 253 } 220 254 … … 225 259 #D- 226 260 function IGCM_sys_SendMail { 227 228 229 230 231 232 233 234 235 236 237 261 IGCM_debug_PushStack "IGCM_sys_SendMail" $@ 262 if ( $DEBUG_sys ) ; then 263 echo "IGCM_sys_SendMail :" $@ 264 fi 265 266 if ( ${ExitFlag} ) ; then 267 status=failed 268 else 269 status=completed 270 fi 271 cat << END_MAIL > job_end.mail 238 272 Dear ${LOGIN}, 239 273 … … 245 279 END_MAIL 246 280 247 248 249 250 251 252 253 254 255 256 257 281 if [ ! -z ${config_UserChoices_MailName} ] ; then 282 mailx -s "${config_UserChoices_JobName} ${status}" ${config_UserChoices_MailName} < job_end.mail 283 elif [ -f ~/.forward ] ; then 284 mailx -s "${config_UserChoices_JobName} ${status}" $( cat ~/.forward ) < job_end.mail 285 fi 286 287 if [ $? -gt 0 ] ; then 288 echo "IGCM_sys_SendMail : erreur." 289 IGCM_debug_Exit "IGCM_sys_SendMail" 290 fi 291 IGCM_debug_PopStack "IGCM_sys_SendMail" 258 292 } 259 293 … … 264 298 #D- 265 299 function IGCM_sys_Mkdir { 266 267 268 269 270 271 272 273 274 275 276 300 IGCM_debug_PushStack "IGCM_sys_Mkdir" $@ 301 if ( $DEBUG_sys ) ; then 302 echo "IGCM_sys_Mkdir :" $@ 303 fi 304 if [ ! -d ${1} ]; then 305 \mkdir -p $1 306 if [ $? -gt 0 ] ; then 307 echo "IGCM_sys_Mkdir : erreur." 308 IGCM_debug_Exit "IGCM_sys_Mkdir" 309 fi 310 fi 277 311 # vérification : 278 279 280 281 282 312 if [ ! -d ${1} ] ; then 313 echo "IGCM_sys_Mkdir : erreur." 314 IGCM_debug_Exit "IGCM_sys_Mkdir" 315 fi 316 IGCM_debug_PopStack "IGCM_sys_Mkdir" 283 317 } 284 318 … … 289 323 #D- 290 324 function IGCM_sys_MkdirArchive { 291 292 293 294 325 IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@ 326 if ( $DEBUG_sys ) ; then 327 echo "IGCM_sys_MkdirArchive :" $@ 328 fi 295 329 #- creation de repertoire sur le serveur fichier 296 if [ ! -d ${1} ]; then297 298 299 300 301 302 303 330 if [ ! -d ${1} ]; then 331 \mkdir -p $1 332 if [ $? -gt 0 ] ; then 333 echo "IGCM_sys_MkdirArchive : erreur." 334 IGCM_debug_Exit "IGCM_sys_MkdirArchive" 335 fi 336 fi 337 IGCM_debug_PopStack "IGCM_sys_MkdirArchive" 304 338 } 305 339 … … 310 344 #D- 311 345 function IGCM_sys_MkdirWork { 312 313 314 315 346 IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@ 347 if ( $DEBUG_sys ) ; then 348 echo "IGCM_sys_MkdirWork :" $@ 349 fi 316 350 #- creation de repertoire sur le serveur fichier 317 if [ ! -d ${1} ]; then318 319 320 321 322 323 324 351 if [ ! -d ${1} ]; then 352 \mkdir -p $1 353 if [ $? -gt 0 ] ; then 354 echo "IGCM_sys_MkdirWork : erreur." 355 IGCM_debug_Exit "IGCM_sys_MkdirWork" 356 fi 357 fi 358 IGCM_debug_PopStack "IGCM_sys_MkdirWork" 325 359 } 326 360 … … 331 365 #D- 332 366 function IGCM_sys_Cd { 333 334 335 336 337 338 339 340 341 342 367 IGCM_debug_PushStack "IGCM_sys_Cd" $@ 368 if ( $DEBUG_sys ) ; then 369 echo "IGCM_sys_Cd :" $@ 370 fi 371 \cd $1 372 if [ $? -gt 0 ] ; then 373 echo "IGCM_sys_Cd : erreur." 374 IGCM_debug_Exit "IGCM_sys_Cd" 375 fi 376 IGCM_debug_PopStack "IGCM_sys_Cd" 343 377 } 344 378 … … 349 383 #D- 350 384 function IGCM_sys_Chmod { 351 352 353 354 355 356 357 358 359 360 361 362 363 364 385 IGCM_debug_PushStack "IGCM_sys_Chmod" -- $@ 386 if ( $DEBUG_sys ) ; then 387 echo "IGCM_sys_Chmod :" $@ 388 fi 389 if [ $DRYRUN -le 1 ]; then 390 \chmod $@ 391 if [ $? -gt 0 ] ; then 392 echo "IGCM_sys_Chmod : erreur." 393 IGCM_debug_Exit "IGCM_sys_Chmod" 394 fi 395 else 396 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 397 fi 398 IGCM_debug_PopStack "IGCM_sys_Chmod" 365 399 } 366 400 … … 371 405 #D- 372 406 function IGCM_sys_FileSize { 373 374 375 376 377 378 379 380 381 382 407 IGCM_debug_PushStack "IGCM_sys_FileSize" $@ 408 409 typeset sizeF 410 set +A sizeF -- $( ls -la ${1} ) 411 if [ $? -gt 0 ] ; then 412 IGCM_debug_Exit "IGCM_sys_FileSize" 413 fi 414 eval ${2}=${sizeF[4]} 415 416 IGCM_debug_PopStack "IGCM_sys_FileSize" 383 417 } 384 418 … … 389 423 #D- 390 424 function IGCM_sys_TestDir { 391 392 393 394 395 396 397 398 399 425 IGCM_debug_PushStack "IGCM_sys_TestDir" $@ 426 if ( $DEBUG_sys ) ; then 427 echo "IGCM_sys_TestDir :" $@ 428 fi 429 typeset ExistFlag 430 ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 ) 431 IGCM_debug_PopStack "IGCM_sys_TestDir" 432 433 return ${ExistFlag} 400 434 } 401 435 … … 406 440 #D- 407 441 function IGCM_sys_TestDirArchive { 408 409 410 411 412 413 414 415 416 442 IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@ 443 if ( $DEBUG_sys ) ; then 444 echo "IGCM_sys_TestDirArchive :" $@ 445 fi 446 typeset ExistFlag 447 ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 ) 448 IGCM_debug_PopStack "IGCM_sys_TestDirArchive" 449 450 return ${ExistFlag} 417 451 } 418 452 … … 423 457 #D- 424 458 function IGCM_sys_TestFileArchive { 425 IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@ 426 typeset ExistFlag 427 ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 ) 428 IGCM_debug_PopStack "IGCM_sys_TestFileArchive" 429 430 return ${ExistFlag} 459 IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@ 460 typeset ExistFlag 461 ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 ) 462 IGCM_debug_PopStack "IGCM_sys_TestFileArchive" 463 464 return ${ExistFlag} 465 } 466 467 #D-#================================================== 468 #D-function IGCM_sys_TestFileBuffer 469 #D-* Purpose: Test file that must NOT EXISTS on Buffer 470 #D-* Examples: 471 #D- 472 function IGCM_sys_TestFileBuffer { 473 IGCM_debug_PushStack "IGCM_sys_TestFileBuffer" $@ 474 typeset ExistFlag 475 ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 ) 476 IGCM_debug_PopStack "IGCM_sys_TestFileBuffer" 477 478 return ${ExistFlag} 431 479 } 432 480 … … 437 485 #D- 438 486 function IGCM_sys_CountFileArchive { 439 IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@ 440 ls ${@} 2>/dev/null | wc -l 441 if [ $? -gt 0 ] ; then 442 echo "IGCM_sys_CountFileArchive : erreur." 443 fi 444 IGCM_debug_PopStack "IGCM_sys_CountFileArchive" 487 IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@ 488 ls ${@} 2>/dev/null | wc -l 489 if [ $? -gt 0 ] ; then 490 echo "IGCM_sys_CountFileArchive : erreur." 491 fi 492 IGCM_debug_PopStack "IGCM_sys_CountFileArchive" 493 } 494 495 #D-#================================================== 496 #D-function IGCM_sys_CountFileBuffer 497 #D-* Purpose: Count files on Scratch filesystem 498 #D-* Examples: 499 #D- 500 function IGCM_sys_CountFileBuffer { 501 IGCM_debug_PushStack "IGCM_sys_CountFileBuffer" $@ 502 ls ${@} 2>/dev/null | wc -l 503 if [ $? -gt 0 ] ; then 504 echo "IGCM_sys_CountFileBuffer : erreur." 505 fi 506 IGCM_debug_PopStack "IGCM_sys_CountFileBuffer" 445 507 } 446 508 … … 451 513 #D- 452 514 function IGCM_sys_Tree { 453 454 455 456 457 458 459 460 515 IGCM_debug_PushStack "IGCM_sys_Tree" $@ 516 if ( $DEBUG_sys ) ; then 517 echo "IGCM_sys_Tree :" $@ 518 fi 519 520 \tree -f $@ 521 522 IGCM_debug_PopStack "IGCM_sys_Tree" 461 523 } 462 524 463 525 #D-#================================================== 464 526 #D-function IGCM_sys_Tar 465 #D-* Purpose: master un-tar command527 #D-* Purpose: master tar command 466 528 #D-* Examples: 467 529 #D- 468 530 function IGCM_sys_Tar { 469 470 471 472 473 474 475 476 477 478 479 531 IGCM_debug_PushStack "IGCM_sys_Tar" $@ 532 if ( $DEBUG_sys ) ; then 533 echo "IGCM_sys_Tar :" $@ 534 fi 535 \tar cf $@ 536 if [ $? -gt 0 ] ; then 537 echo "IGCM_sys_Tar : erreur." 538 IGCM_debug_Exit "IGCM_sys_Tar" 539 fi 540 541 IGCM_debug_PopStack "IGCM_sys_Tar" 480 542 } 481 543 … … 486 548 #D- 487 549 function IGCM_sys_UnTar { 488 489 490 491 492 493 494 495 496 497 550 IGCM_debug_PushStack "IGCM_sys_UnTar" $@ 551 if ( $DEBUG_sys ) ; then 552 echo "IGCM_sys_UnTar :" $@ 553 fi 554 \tar xvf $1 555 if [ $? -gt 0 ] ; then 556 echo "IGCM_sys_UnTar : erreur." 557 IGCM_debug_Exit "IGCM_sys_UnTar" 558 fi 559 IGCM_debug_PopStack "IGCM_sys_UnTar" 498 560 } 499 561 … … 504 566 #D- 505 567 function IGCM_sys_Qsub { 506 507 508 509 568 IGCM_debug_PushStack "IGCM_sys_Qsub" $@ 569 if ( $DEBUG_sys ) ; then 570 echo "IGCM_sys_Qsub :" $@ 571 fi 510 572 # /usr/local/bin/qsub -q short -o ${Script_Output} -N ${config_UserChoices_JobName}.${CumulPeriod} < $1 511 512 513 514 515 516 573 /usr/local/bin/qsub -q medium -o ${Script_Output} -N ${config_UserChoices_JobName}.${CumulPeriod} < $1 574 if [ $? -gt 0 ] ; then 575 echo "IGCM_sys_Qsub : erreur." 576 IGCM_debug_Exit "IGCM_sys_Qsub" 577 fi 578 IGCM_debug_PopStack "IGCM_sys_Qsub" 517 579 } 518 580 … … 523 585 #D- 524 586 function IGCM_sys_QsubPost { 525 526 527 528 529 530 531 532 533 534 587 IGCM_debug_PushStack "IGCM_sys_QsubPost" $@ 588 if ( $DEBUG_sys ) ; then 589 echo "IGCM_sys_QsubPost :" $@ 590 fi 591 /usr/local/bin/qsub -q medium -o ${POST_DIR}/${Script_Post_Output}.out ${libIGCM_POST}/$1.job -v ${listVarEnv} 592 if [ $? -gt 0 ] ; then 593 echo "IGCM_sys_QsubPost : erreur " $@ 594 IGCM_debug_Exit "IGCM_sys_QsubPost" 595 fi 596 IGCM_debug_PopStack "IGCM_sys_QsubPost" 535 597 } 536 598 537 599 #D-************************* 538 #D- File transfer functions 600 #D- File transfer functions 539 601 #D-************************* 540 602 #D- … … 546 608 #D- Error values and explanations can depend on your system version. 547 609 function IGCM_sys_Rsync_out { 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 0) return;; 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 } 651 610 RET=$1 611 if [ ! $RET ] ; then 612 echo "rsync error !" 613 fi 614 615 if [ $MYLANG = "fr" ]; then 616 case $RET in 617 0) return ;; 618 1) echo "Erreur de rsync ; RERR_SYNTAX : " 619 echo "Erreur de syntaxe ou d'utilisation." 620 return;; 621 2) echo "Erreur de rsync ; RERR_PROTOCOL : " 622 echo "Incompatibilité de protocole." 623 return;; 624 3) echo "Erreur de rsync ; RERR_FILESELECT 3" 625 echo "Erreurs lors de la sélection des fichiers d'entrée sortie et" 626 echo "répertoires" 627 return;; 628 4) echo "Erreur de rsync ; RERR_UNSUPPORTED" 629 echo "Action demandée non supportée : une tentative de manipulation de" 630 echo "fichiers 64-bits sur une plate-forme qui ne les supporte pas a" 631 echo "été faite ; ou une option qui est supportée par le client mais" 632 echo "pas par le serveur a été spécifiée." 633 return;; 634 10) echo "Erreur de rsync ; RERR_SOCKETIO" 635 echo "Erreur dans le socket d'entrée sortie" 636 return;; 637 11) echo "Erreur de rsync ; RERR_FILEIO" 638 echo "Erreur d'entrée sortie fichier" 639 return;; 640 12) echo "Erreur de rsync ; RERR_STREAMIO" 641 echo "Erreur dans flux de donnée du protocole rsync" 642 return;; 643 13) echo "Erreur de rsync ; RERR_MESSAGEIO" 644 echo "Erreur avec les diagnostics du programme" 645 return;; 646 14) echo "Erreur de rsync ; RERR_IPC" 647 echo "Erreur dans le code IPC" 648 return;; 649 20) echo "Erreur de rsync ; RERR_SIGNAL" 650 echo "SIGUSR1 ou SIGINT reçu" 651 return;; 652 21) echo "Erreur de rsync ; RERR_WAITCHILD" 653 echo "Une erreur retournée par waitpid()" 654 return;; 655 22) echo "Erreur de rsync ; RERR_MALLOC" 656 echo "Erreur lors de l'allocation des tampons de mémoire de coeur" 657 return;; 658 23) echo "" 659 echo "Erreur fichier inexistant" 660 return;; 661 30) echo "Erreur de rsync ; RERR_TIMEOUT" 662 echo "Temps d'attente écoulé dans l'envoi/réception de données" 663 return;; 664 *) echo "Erreur de rsync : code de retour de rsync inconnu :" $RET 665 return;; 666 esac 667 elif [ $MYLANG = "en" ] ; then 668 case $RET in 669 0) return;; 670 1) echo "rsync error : Syntax or usage error " 671 return;; 672 2) echo "rsync error : Protocol incompatibility " 673 return;; 674 3) echo "rsync error : Errors selecting input/output files, dirs" 675 return;; 676 4) echo "rsync error : Requested action not supported: an attempt" 677 echo "was made to manipulate 64-bit files on a platform that cannot support" 678 echo "them; or an option was specified that is supported by the client and" 679 echo "not by the server." 680 return;; 681 5) echo "rsync error : Error starting client-server protocol" 682 return;; 683 10) echo "rsync error : Error in socket I/O " 684 return;; 685 11) echo "rsync error : Error in file I/O " 686 return;; 687 12) echo "rsync error : Error in rsync protocol data stream " 688 return;; 689 13) echo "rsync error : Errors with program diagnostics " 690 return;; 691 14) echo "rsync error : Error in IPC code " 692 return;; 693 20) echo "rsync error : Received SIGUSR1 or SIGINT " 694 return;; 695 21) echo "rsync error : Some error returned by waitpid() " 696 return;; 697 22) echo "rsync error : Error allocating core memory buffers " 698 return;; 699 23) echo "rsync error : Partial transfer due to error" 700 return;; 701 24) echo "rsync error : Partial transfer due to vanished source files" 702 return;; 703 30) echo "rsync error : Timeout in data send/receive " 704 return;; 705 *) echo "rsync error : return code of rsync unknown :" $RET 706 return;; 707 esac 708 else 709 echo "unknown language $MYLANG." 710 return 711 fi 712 } 713 652 714 #D-#================================================== 653 715 #D-function IGCM_sys_Cp … … 656 718 #D- 657 719 function IGCM_sys_Cp { 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 720 IGCM_debug_PushStack "IGCM_sys_Cp" $@ 721 if ( $DEBUG_sys ) ; then 722 echo "IGCM_sys_Cp :" $@ 723 fi 724 725 typeset RET 726 727 echo cp --preserve=timestamps $@ > out_rsync 2>&1 728 \cp --preserve=timestamps $@ >> out_rsync 2>&1 729 RET=$? 730 731 if [ ${RET} -gt 0 ] ; then 732 echo "IGCM_sys_Cp : error." 733 cat out_rsync 734 IGCM_debug_Exit "IGCM_sys_Cp" 735 else 736 rm out_rsync 737 fi 738 IGCM_debug_PopStack "IGCM_sys_Cp" 677 739 } 678 740 … … 683 745 #D- 684 746 function IGCM_sys_Rm { 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 747 IGCM_debug_PushStack "IGCM_sys_Rm" -- $@ 748 if ( $DEBUG_sys ) ; then 749 echo "IGCM_sys_Rm :" $@ 750 fi 751 752 typeset RET 753 754 echo rm $@ > out_rsync 2>&1 755 \rm $@ >> out_rsync 2>&1 756 RET=$? 757 758 if [ ${RET} -gt 0 ] ; then 759 echo "IGCM_sys_Rm : error." 760 cat out_rsync 761 IGCM_debug_Exit "IGCM_sys_Rm" 762 else 763 rm out_rsync 764 fi 765 IGCM_debug_PopStack "IGCM_sys_Rm" 704 766 } 705 767 … … 711 773 #D- 712 774 function IGCM_sys_RmRunDir { 713 714 715 716 717 718 719 720 721 722 723 724 725 726 727 728 729 730 775 IGCM_debug_PushStack "IGCM_sys_RmRunDir" -- $@ 776 if ( $DEBUG_sys ) ; then 777 echo "IGCM_sys_RmRunDir :" $@ 778 fi 779 780 typeset RET 781 782 echo rm $@ > out_rsync 2>&1 783 \rm $@ >> out_rsync 2>&1 784 RET=$? 785 786 if [ ${RET} -gt 0 ] ; then 787 echo "IGCM_sys_RmRunDir : error." 788 cat out_rsync 789 IGCM_debug_Exit "IGCM_sys_RmRunDir" 790 fi 791 792 IGCM_debug_PopStack "IGCM_sys_RmRunDir" 731 793 } 732 794 … … 737 799 #D- 738 800 function IGCM_sys_Mv { 739 IGCM_debug_PushStack "IGCM_sys_Mv" $@ 740 if ( $DEBUG_sys ) ; then 741 echo "IGCM_sys_Mv :" $@ 742 fi 743 744 if [ $DRYRUN = 0 ]; then 745 746 typeset RET 747 748 echo mv $@ > out_rsync 2>&1 749 \mv $@ >> out_rsync 2>&1 750 RET=$? 751 752 if [ ${RET} -gt 0 ] ; then 753 echo "IGCM_sys_Mv : error in mv." 754 cat out_rsync 755 IGCM_debug_Exit "IGCM_sys_Mv" 756 else 757 rm out_rsync 758 fi 801 IGCM_debug_PushStack "IGCM_sys_Mv" $@ 802 if ( $DEBUG_sys ) ; then 803 echo "IGCM_sys_Mv :" $@ 804 fi 805 806 if [ $DRYRUN = 0 ]; then 807 808 typeset RET 809 810 echo mv $@ > out_rsync 2>&1 811 \mv $@ >> out_rsync 2>&1 812 RET=$? 813 814 if [ ${RET} -gt 0 ] ; then 815 echo "IGCM_sys_Mv : error in mv." 816 cat out_rsync 817 IGCM_debug_Exit "IGCM_sys_Mv" 759 818 else 760 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 761 fi 762 763 IGCM_debug_PopStack "IGCM_sys_Mv" 819 rm out_rsync 820 fi 821 else 822 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 823 fi 824 825 IGCM_debug_PopStack "IGCM_sys_Mv" 764 826 } 765 827 … … 770 832 #D- 771 833 function IGCM_sys_Put_Dir { 772 IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@ 773 if ( $DEBUG_sys ) ; then 774 echo "IGCM_sys_Put_Dir :" $@ 775 fi 776 if [ $DRYRUN = 0 ]; then 777 if [ ! -d ${1} ] ; then 778 echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ." 779 IGCM_debug_PopStack "IGCM_sys_Put_Dir" 780 return 781 fi 782 783 typeset RET 784 785 # Only if we use rsync 786 #IGCM_sys_TestDirArchive $( dirname $2 ) 787 # 788 #USUAL WAY 789 \cp -R $1 $2 > out_rsync 2>&1 790 RET=$? 791 792 if [ ${RET} -gt 0 ] ; then 793 echo "IGCM_sys_Put_Dir : error." 794 cat out_rsync 795 IGCM_debug_Exit "IGCM_sys_Put_Dir" 796 else 797 rm out_rsync 798 fi 834 IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@ 835 if ( $DEBUG_sys ) ; then 836 echo "IGCM_sys_Put_Dir :" $@ 837 fi 838 if [ $DRYRUN = 0 ]; then 839 if [ ! -d ${1} ] ; then 840 echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ." 841 IGCM_debug_PopStack "IGCM_sys_Put_Dir" 842 return 843 fi 844 845 typeset RET 846 847 # Only if we use rsync 848 #IGCM_sys_TestDirArchive $( dirname $2 ) 849 # 850 #USUAL WAY 851 \cp -R $1 $2 > out_rsync 2>&1 852 RET=$? 853 854 if [ ${RET} -gt 0 ] ; then 855 echo "IGCM_sys_Put_Dir : error." 856 cat out_rsync 857 IGCM_debug_Exit "IGCM_sys_Put_Dir" 799 858 else 800 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 801 fi 802 IGCM_debug_PopStack "IGCM_sys_Put_Dir" 859 rm out_rsync 860 fi 861 else 862 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 863 fi 864 IGCM_debug_PopStack "IGCM_sys_Put_Dir" 803 865 } 804 866 … … 809 871 #D- 810 872 function IGCM_sys_Get_Dir { 811 IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@ 812 if ( $DEBUG_sys ) ; then 813 echo "IGCM_sys_Get_Dir :" $@ 814 fi 815 if [ $DRYRUN = 0 ]; then 816 if [ ! -d ${1} ] ; then 817 echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ." 818 IGCM_debug_PopStack "IGCM_sys_Get_Dir" 819 return 820 fi 821 822 typeset RET 823 824 #USUAL WAY 825 \cp -R $1 $2 > out_rsync 2>&1 826 RET=$? 827 828 if [ ${RET} -gt 0 ] ; then 829 echo "IGCM_sys_Get_Dir : error." 830 cat out_rsync 831 IGCM_debug_Exit "IGCM_sys_Get_Dir" 832 else 833 rm out_rsync 834 fi 873 IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@ 874 if ( $DEBUG_sys ) ; then 875 echo "IGCM_sys_Get_Dir :" $@ 876 fi 877 if [ $DRYRUN = 0 ]; then 878 if [ ! -d ${1} ] ; then 879 echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ." 880 IGCM_debug_PopStack "IGCM_sys_Get_Dir" 881 return 882 fi 883 884 typeset RET 885 886 #USUAL WAY 887 \cp -R $1 $2 > out_rsync 2>&1 888 RET=$? 889 890 if [ ${RET} -gt 0 ] ; then 891 echo "IGCM_sys_Get_Dir : error." 892 cat out_rsync 893 IGCM_debug_Exit "IGCM_sys_Get_Dir" 835 894 else 836 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 837 fi 838 IGCM_debug_PopStack "IGCM_sys_Get_Dir" 895 rm out_rsync 896 fi 897 else 898 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 899 fi 900 IGCM_debug_PopStack "IGCM_sys_Get_Dir" 839 901 } 840 902 … … 845 907 #D- 846 908 function IGCM_sys_Get_Master { 847 IGCM_debug_PushStack "IGCM_sys_Get_Master" $@ 848 if ( $DEBUG_sys ) ; then 849 echo "IGCM_sys_Get_Master :" $@ 850 fi 851 if [ $DRYRUN = 0 ]; then 852 if ( [ ! -d ${1} ] && [ ! -f ${1} ] ) ; then 853 echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ." 854 IGCM_debug_PopStack "IGCM_sys_Get_Master" 855 return 856 fi 857 858 typeset RET 859 860 #USUAL WAY 861 cp -R $1 $2 > out_rsync 2>&1 862 RET=$? 863 864 if [ ${RET} -gt 0 ] ; then 865 echo "IGCM_sys_Get_Master : error." 866 cat out_rsync 867 IGCM_debug_Exit "IGCM_sys_Get_Master" 868 else 869 rm out_rsync 870 fi 909 IGCM_debug_PushStack "IGCM_sys_Get_Master" $@ 910 if ( $DEBUG_sys ) ; then 911 echo "IGCM_sys_Get_Master :" $@ 912 fi 913 if [ $DRYRUN = 0 ]; then 914 if ( [ ! -d ${1} ] && [ ! -f ${1} ] ) ; then 915 echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ." 916 IGCM_debug_PopStack "IGCM_sys_Get_Master" 917 return 918 fi 919 920 typeset RET 921 922 #USUAL WAY 923 cp -R $1 $2 > out_rsync 2>&1 924 RET=$? 925 926 if [ ${RET} -gt 0 ] ; then 927 echo "IGCM_sys_Get_Master : error." 928 cat out_rsync 929 IGCM_debug_Exit "IGCM_sys_Get_Master" 871 930 else 872 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 873 fi 874 IGCM_debug_PopStack "IGCM_sys_Get_Master" 931 rm out_rsync 932 fi 933 else 934 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 935 fi 936 IGCM_debug_PopStack "IGCM_sys_Get_Master" 875 937 } 876 938 … … 882 944 #D- 883 945 function IGCM_sys_Put_Rest { 884 IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@ 885 if ( $DEBUG_sys ) ; then 886 echo "IGCM_sys_Put_Rest :" $@ 887 fi 888 if [ $DRYRUN = 0 ]; then 889 890 IGCM_sys_TestDirArchive $( dirname $2 ) 891 892 if [ ! -f ${1} ] ; then 893 echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ." 894 IGCM_debug_Exit "IGCM_sys_Put_Rest" 895 fi 896 if [ X${JobType} = XRUN ] ; then 897 IGCM_sys_Chmod 444 ${1} 898 fi 899 900 typeset RET 901 902 echo ${RSYNC} ${RSYNC_opt} $1 $2 > out_rsync 2>&1 903 ${RSYNC} ${RSYNC_opt} $1 $2 >> out_rsync 2>&1 904 RET=$? 905 IGCM_sys_Rsync_out $RET 906 907 ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 908 (( RET=RET+$? )) 909 910 if [ ${RET} -gt 0 ] ; then 911 echo "IGCM_sys_Put_Rest : error." 912 cat out_rsync 913 IGCM_debug_Exit "IGCM_sys_Put_Rest" 914 else 915 rm out_rsync 916 fi 946 IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@ 947 if ( $DEBUG_sys ) ; then 948 echo "IGCM_sys_Put_Rest :" $@ 949 fi 950 if [ $DRYRUN = 0 ]; then 951 952 IGCM_sys_TestDirArchive $( dirname $2 ) 953 954 if [ ! -f ${1} ] ; then 955 echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ." 956 IGCM_debug_Exit "IGCM_sys_Put_Rest" 957 fi 958 if [ X${JobType} = XRUN ] ; then 959 IGCM_sys_Chmod 444 ${1} 960 fi 961 962 typeset RET 963 964 echo ${RSYNC} ${RSYNC_opt} $1 $2 > out_rsync 2>&1 965 ${RSYNC} ${RSYNC_opt} $1 $2 >> out_rsync 2>&1 966 RET=$? 967 IGCM_sys_Rsync_out $RET 968 969 ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 970 (( RET=RET+$? )) 971 972 if [ ${RET} -gt 0 ] ; then 973 echo "IGCM_sys_Put_Rest : error." 974 cat out_rsync 975 IGCM_debug_Exit "IGCM_sys_Put_Rest" 917 976 else 918 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 919 fi 920 IGCM_debug_PopStack "IGCM_sys_Put_Rest" 977 rm out_rsync 978 fi 979 else 980 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 981 fi 982 IGCM_debug_PopStack "IGCM_sys_Put_Rest" 983 } 984 985 #D-#================================================== 986 #D-function IGCM_sys_PutBuffer_Rest 987 #D-* Purpose: Put computied restarts on ${SCRATCHDIR}. 988 #D- File and target directory must exist. 989 #D-* Examples: 990 #D- 991 function IGCM_sys_PutBuffer_Rest { 992 IGCM_debug_PushStack "IGCM_sys_PutBuffer_Rest" $@ 993 if ( $DEBUG_sys ) ; then 994 echo "IGCM_sys_PutBuffer_Rest :" $@ 995 fi 996 if [ $DRYRUN = 0 ]; then 997 if [ ! -f ${1} ] ; then 998 echo "ERROR : IGCM_sys_PutBuffer_Rest ${1} DOES NOT EXIST ." 999 IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" 1000 fi 1001 1002 typeset RET 1003 # 1004 if [ X${JobType} = XRUN ] ; then 1005 IGCM_sys_Chmod 444 ${1} 1006 fi 1007 1008 # 1009 # USUAL WAY 1010 \cp $1 $2 > out_rsync 2>&1 1011 RET=$? 1012 1013 if [ ${RET} -gt 0 ] ; then 1014 echo "IGCM_sys_PutBuffer_Rest : error." 1015 cat out_rsync 1016 IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" 1017 else 1018 \rm out_rsync 1019 fi 1020 else 1021 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1022 fi 1023 IGCM_debug_PopStack "IGCM_sys_PutBuffer_Rest" 921 1024 } 922 1025 … … 927 1030 #D- 928 1031 function IGCM_sys_Put_Out { 929 IGCM_debug_PushStack "IGCM_sys_Put_Out" $@ 930 if ( $DEBUG_sys ) ; then 931 echo "IGCM_sys_Put_Out :" $@ 932 fi 933 if [ $DRYRUN = 0 ]; then 934 if [ -f ${1} ] ; then 935 if [ ! -d $( dirname $2 ) ] ; then 936 IGCM_sys_MkdirArchive $( dirname $2 ) 937 fi 938 else 939 echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ." 940 IGCM_debug_PopStack "IGCM_sys_Put_Out" 941 return 1 942 fi 943 944 typeset RET 945 # 946 if [ X${JobType} = XRUN ] ; then 947 if [ X${3} = X ] ; then 948 IGCM_sys_Chmod 444 ${1} 949 fi 950 fi 951 # 952 953 echo ${RSYNC} ${RSYNC_opt} $1 $2 > out_rsync 2>&1 954 ${RSYNC} ${RSYNC_opt} $1 $2 >> out_rsync 2>&1 955 RET=$? 956 IGCM_sys_Rsync_out $RET 957 958 ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 959 (( RET=RET+$? )) 960 961 if [ ${RET} -gt 0 ] ; then 962 echo "IGCM_sys_Put_Out : error." 963 cat out_rsync 964 IGCM_debug_Exit "IGCM_sys_Put_Out" 965 else 966 rm out_rsync 967 fi 1032 IGCM_debug_PushStack "IGCM_sys_Put_Out" $@ 1033 if ( $DEBUG_sys ) ; then 1034 echo "IGCM_sys_Put_Out :" $@ 1035 fi 1036 if [ $DRYRUN = 0 ]; then 1037 if [ -f ${1} ] ; then 1038 if [ ! -d $( dirname $2 ) ] ; then 1039 IGCM_sys_MkdirArchive $( dirname $2 ) 1040 fi 968 1041 else 969 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 970 fi 971 IGCM_debug_PopStack "IGCM_sys_Put_Out" 972 return 0 1042 echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ." 1043 IGCM_debug_PopStack "IGCM_sys_Put_Out" 1044 return 1 1045 fi 1046 1047 typeset RET 1048 # 1049 if [ X${JobType} = XRUN ] ; then 1050 if [ X${3} = X ] ; then 1051 IGCM_sys_Chmod 444 ${1} 1052 fi 1053 fi 1054 # 1055 1056 echo ${RSYNC} ${RSYNC_opt} $1 $2 > out_rsync 2>&1 1057 ${RSYNC} ${RSYNC_opt} $1 $2 >> out_rsync 2>&1 1058 RET=$? 1059 IGCM_sys_Rsync_out $RET 1060 1061 ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 1062 (( RET=RET+$? )) 1063 1064 if [ ${RET} -gt 0 ] ; then 1065 echo "IGCM_sys_Put_Out : error." 1066 cat out_rsync 1067 IGCM_debug_Exit "IGCM_sys_Put_Out" 1068 else 1069 rm out_rsync 1070 fi 1071 else 1072 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1073 fi 1074 IGCM_debug_PopStack "IGCM_sys_Put_Out" 1075 return 0 1076 } 1077 1078 #D-#================================================== 1079 #D-function IGCM_sys_PutBuffer_Out 1080 #D-* Purpose: Copy a file on ${SCRATCHDIR} after having chmod it in readonly 1081 #D-* Examples: 1082 #D- 1083 function IGCM_sys_PutBuffer_Out { 1084 IGCM_debug_PushStack "IGCM_sys_PutBuffer_Out" $@ 1085 if ( $DEBUG_sys ) ; then 1086 echo "IGCM_sys_PutBuffer_Out :" $@ 1087 fi 1088 if [ $DRYRUN = 0 ]; then 1089 if [ ! -f ${1} ] ; then 1090 echo "WARNING : IGCM_sys_PutBuffer_Out ${1} DOES NOT EXIST ." 1091 IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out" 1092 return 1 1093 fi 1094 # 1095 IGCM_sys_Mkdir $( dirname $2 ) 1096 # 1097 typeset RET 1098 1099 if [ X${JobType} = XRUN ] ; then 1100 if [ X${3} = X ] ; then 1101 IGCM_sys_Chmod 444 ${1} 1102 fi 1103 fi 1104 # 1105 # USUAL WAY 1106 \cp $1 $2 > out_rsync 2>&1 1107 RET=$? 1108 1109 if [ ${RET} -gt 0 ] ; then 1110 echo "IGCM_sys_PutBuffer_Out : error." 1111 cat out_rsync 1112 IGCM_debug_Exit "IGCM_sys_PutBuffer_Out" 1113 else 1114 \rm out_rsync 1115 fi 1116 else 1117 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1118 fi 1119 IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out" 1120 return 0 973 1121 } 974 1122 … … 979 1127 #D- IGCM_sys_Get /l Array_contain_myfiles /destpath/ 980 1128 function IGCM_sys_Get { 981 982 983 984 985 986 987 988 989 1129 IGCM_debug_PushStack "IGCM_sys_Get" $@ 1130 1131 typeset DEST RET dm_liste ifile target 1132 1133 if ( $DEBUG_sys ) ; then 1134 echo "IGCM_sys_Get :" $@ 1135 fi 1136 if [ $DRYRUN -le 2 ]; then 1137 if [ X${1} = X'/l' ] ; then 990 1138 # test if the first file is present in the old computation : 991 992 993 994 995 996 997 998 999 1000 1001 1002 1003 1004 1005 1006 1007 1008 1009 1010 1139 eval set +A dm_liste \${${2}} 1140 else 1141 dm_liste=${1} 1142 fi 1143 eval DEST=\${${#}} 1144 1145 # test if the (first) file is present in the old computation : 1146 IGCM_sys_TestFileArchive ${dm_liste[0]} 1147 RET=$? 1148 if [ ${RET} -gt 0 ] ; then 1149 echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ." 1150 IGCM_debug_Exit "IGCM_sys_Get" 1151 #return 1152 fi 1153 1154 (( RET=0 )) 1155 for target in ${dm_liste[*]} ; do 1156 \cp ${target} ${DEST} >> out_rsync 2>&1 1157 (( RET=RET+$? )) 1158 done 1011 1159 1012 1160 # echo ${RSYNC} ${RSYNC_opt} $@ > out_rsync 2>&1 1013 1161 # ${RSYNC} ${RSYNC_opt} $@ >> out_rsync 2>&1 1014 # RET=$? 1015 # IGCM_sys_Rsync_out $RET 1016 1017 # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 1018 # (( RET=RET+$? )) 1019 1020 if [ ${RET} -gt 0 ] ; then 1021 echo "IGCM_sys_Get : copy error." 1022 cat out_rsync 1023 IGCM_debug_Exit "IGCM_sys_Get" 1024 else 1025 rm out_rsync 1026 fi 1162 # RET=$? 1163 # IGCM_sys_Rsync_out $RET 1164 1165 # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 1166 # (( RET=RET+$? )) 1167 1168 if [ ${RET} -gt 0 ] ; then 1169 echo "IGCM_sys_Get : copy error." 1170 cat out_rsync 1171 IGCM_debug_Exit "IGCM_sys_Get" 1027 1172 else 1028 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1029 fi 1030 IGCM_debug_PopStack "IGCM_sys_Get" 1173 rm out_rsync 1174 fi 1175 else 1176 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1177 fi 1178 IGCM_debug_PopStack "IGCM_sys_Get" 1179 } 1180 1181 #D-#================================================== 1182 #D-function IGCM_sys_GetBuffer 1183 #D-* Purpose: Get a file from ${SCRATCHDIR} 1184 #D-* Examples: IGCM_sys_GetBuffer myfile /destpath/myfile_with_PREFIX 1185 #D- IGCM_sys_GetBuffer /l Array_contain_myfiles /destpath/ 1186 function IGCM_sys_GetBuffer { 1187 IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@ 1188 1189 typeset DEST RET buf_liste ifile target file_work 1190 1191 if ( $DEBUG_sys ) ; then 1192 echo "IGCM_sys_GetBuffer :" $@ 1193 fi 1194 if [ $DRYRUN -le 2 ]; then 1195 if [ X${1} = X'/l' ] ; then 1196 # test if the first file is present in the old computation : 1197 eval set +A buf_liste \${${2}} 1198 else 1199 eval set +A buf_liste ${1} 1200 fi 1201 eval DEST=\${${#}} 1202 1203 #USUAL WAY 1204 if [ X${1} = X'/l' ] ; then 1205 (( RET=0 )) 1206 for target in ${buf_liste[*]} ; do 1207 local_file=$( basename ${target} ) 1208 \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 1209 (( RET = RET + $? )) 1210 done 1211 else 1212 \cp ${buf_liste} ${DEST} >> out_rsync 2>&1 1213 RET=$? 1214 fi 1215 1216 if [ ${RET} -gt 0 ] ; then 1217 echo "IGCM_sys_GetBuffer : copy error." 1218 cat out_rsync 1219 IGCM_debug_Exit "IGCM_sys_GetBuffer" 1220 else 1221 \rm out_rsync 1222 fi 1223 else 1224 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1225 fi 1226 IGCM_debug_PopStack "IGCM_sys_GetBuffer" 1227 } 1228 1229 #D-#================================================== 1230 #D-function IGCM_sys_GetDate_FichWork 1231 #D-* Purpose: donne la date filesys d'un fichier sur le filesystem WORK 1232 #D-* Examples: 1233 #D- 1234 function IGCM_sys_GetDate_FichWork { 1235 IGCM_debug_PushStack "IGCM_sys_FichWork" $@ 1236 if ( $DEBUG_sys ) ; then 1237 echo "IGCM_sys_GetDate_FichWork :" $@ 1238 fi 1239 typeset dateF 1240 set +A dateF -- $( ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} ) 1241 eval ${2}=${dateF[5]} 1242 1243 # donne la date filesys d'un fichier sur la machine work 1244 IGCM_debug_PopStack "IGCM_sys_FichWork" 1245 } 1246 1247 #D-#================================================== 1248 #D-function IGCM_sys_GetDate_FichArchive 1249 #D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 1250 #D-* Examples: 1251 #D- 1252 function IGCM_sys_GetDate_FichArchive { 1253 IGCM_debug_PushStack "IGCM_sys_FichArchive" $@ 1254 if ( $DEBUG_sys ) ; then 1255 echo "IGCM_sys_GetDate_FichArchive :" $@ 1256 fi 1257 typeset dateF 1258 set +A dateF -- $( ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} ) 1259 eval ${2}=${dateF[5]} 1260 1261 IGCM_debug_PopStack "IGCM_sys_FichArchive" 1031 1262 } 1032 1263 … … 1037 1268 #D- 1038 1269 function IGCM_sys_Dods_Rm { 1039 1040 1041 1042 1270 if ( $DEBUG_sys ) ; then 1271 echo "IGCM_sys_Dods_Rm :" $@ 1272 fi 1273 return 0 1043 1274 } 1044 1275 … … 1050 1281 #D- 1051 1282 function IGCM_sys_Dods_Cp { 1052 1053 1054 1055 1283 if ( $DEBUG_sys ) ; then 1284 echo "IGCM_sys_Dods_Cp :" $@ 1285 fi 1286 return 0 1056 1287 } 1057 1288 … … 1062 1293 #D- 1063 1294 function IGCM_sys_Put_Dods { 1064 IGCM_debug_PushStack "IGCM_sys_Put_Dods" $@ 1065 if ( $DEBUG_sys ) ; then 1066 echo "IGCM_sys_Put_Dods :" $@ 1067 fi 1068 if [ $DRYRUN = 0 ]; then 1069 RET=0 1070 1071 if [ ${RET} -gt 0 ] ; then 1072 echo "IGCM_sys_Put_Dods : error." 1073 IGCM_debug_Exit "IGCM_sys_Put_Dods" 1074 fi 1075 else 1076 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1077 fi 1078 IGCM_debug_PopStack "IGCM_sys_Put_Dods" 1079 } 1080 1081 #D-#================================================== 1082 #D-function IGCM_sys_GetDate_FichWork 1083 #D-* Purpose: donne la date filesys d'un fichier sur le filesystem WORK 1084 #D-* Examples: 1085 #D- 1086 function IGCM_sys_GetDate_FichWork { 1087 IGCM_debug_PushStack "IGCM_sys_FichWork" $@ 1088 if ( $DEBUG_sys ) ; then 1089 echo "IGCM_sys_GetDate_FichWork :" $@ 1090 fi 1091 typeset dateF 1092 set +A dateF -- $( ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} ) 1093 eval ${2}=${dateF[5]} 1094 1095 # donne la date filesys d'un fichier sur la machine work 1096 IGCM_debug_PopStack "IGCM_sys_FichWork" 1097 } 1098 1099 #D-#================================================== 1100 #D-function IGCM_sys_GetDate_FichArchive 1101 #D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 1102 #D-* Examples: 1103 #D- 1104 function IGCM_sys_GetDate_FichArchive { 1105 IGCM_debug_PushStack "IGCM_sys_FichArchive" $@ 1106 if ( $DEBUG_sys ) ; then 1107 echo "IGCM_sys_GetDate_FichArchive :" $@ 1108 fi 1109 typeset dateF 1110 set +A dateF -- $( ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} ) 1111 eval ${2}=${dateF[5]} 1112 1113 IGCM_debug_PopStack "IGCM_sys_FichArchive" 1295 IGCM_debug_PushStack "IGCM_sys_Put_Dods" $@ 1296 if ( $DEBUG_sys ) ; then 1297 echo "IGCM_sys_Put_Dods :" $@ 1298 fi 1299 if [ $DRYRUN = 0 ]; then 1300 RET=0 1301 1302 if [ ${RET} -gt 0 ] ; then 1303 echo "IGCM_sys_Put_Dods : error." 1304 IGCM_debug_Exit "IGCM_sys_Put_Dods" 1305 fi 1306 else 1307 ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 1308 fi 1309 IGCM_debug_PopStack "IGCM_sys_Put_Dods" 1114 1310 } 1115 1311 … … 1118 1314 1119 1315 function IGCM_sys_rebuild { 1120 IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@ 1121 if ( $DEBUG_sys ) ; then 1122 echo "IGCM_sys_rebuild :" $@ 1123 fi 1124 /home/users/igcmg/rebuild/bin/rebuild -f -o $@ 1125 if [ $? -gt 0 ] ; then 1126 echo "IGCM_sys_rebuild : erreur ${@}." 1127 IGCM_debug_Exit "rebuild" 1128 fi 1129 1130 IGCM_debug_PopStack "IGCM_sys_rebuild" 1131 } 1132 1133 ############################################################## 1134 # NCO OPERATOR 1135 1136 function IGCM_sys_ncap2 { 1137 IGCM_debug_PushStack "IGCM_sys_ncap2" -- $@ 1138 if ( $DEBUG_sys ) ; then 1139 echo "IGCM_sys_ncap2 :" $@ 1140 fi 1141 /usr/local/bin/ncap2 "$@" 1142 if [ $? -gt 0 ] ; then 1143 echo "IGCM_sys_ncap2 : erreur ${@}." 1144 IGCM_debug_Exit "ncap2" 1145 fi 1146 1147 IGCM_debug_PopStack "IGCM_sys_ncap2" 1148 } 1149 1150 function IGCM_sys_ncatted { 1151 IGCM_debug_PushStack "IGCM_sys_ncatted" -- $@ 1152 if ( $DEBUG_sys ) ; then 1153 echo "IGCM_sys_ncatted :" $@ 1154 fi 1155 /usr/local/bin/ncatted "$@" 1156 if [ $? -gt 0 ] ; then 1157 echo "IGCM_sys_ncatted : erreur ${@}." 1158 IGCM_debug_Exit "ncatted" 1159 fi 1160 1161 IGCM_debug_PopStack "IGCM_sys_ncatted" 1162 } 1163 1164 function IGCM_sys_ncbo { 1165 IGCM_debug_PushStack "IGCM_sys_ncbo" -- $@ 1166 if ( $DEBUG_sys ) ; then 1167 echo "IGCM_sys_ncbo :" $@ 1168 fi 1169 /usr/local/bin/ncbo $@ 1170 if [ $? -gt 0 ] ; then 1171 echo "IGCM_sys_ncbo : erreur ${@}." 1172 IGCM_debug_Exit "ncbo" 1173 fi 1174 1175 IGCM_debug_PopStack "IGCM_sys_ncbo" 1176 } 1177 1178 function IGCM_sys_ncdiff { 1179 IGCM_debug_PushStack "IGCM_sys_ncdiff" -- $@ 1180 if ( $DEBUG_sys ) ; then 1181 echo "IGCM_sys_ncdiff :" $@ 1182 fi 1183 /usr/local/bin/ncdiff $@ 1184 if [ $? -gt 0 ] ; then 1185 echo "IGCM_sys_ncdiff : erreur ${@}." 1186 IGCM_debug_Exit "ncdiff" 1187 fi 1188 1189 IGCM_debug_PopStack "IGCM_sys_ncdiff" 1190 } 1191 1192 function IGCM_sys_ncea { 1193 IGCM_debug_PushStack "IGCM_sys_ncea" -- $@ 1194 if ( $DEBUG_sys ) ; then 1195 echo "IGCM_sys_ncea :" $@ 1196 fi 1197 /usr/local/bin/ncea $@ 1198 if [ $? -gt 0 ] ; then 1199 echo "IGCM_sys_ncea : erreur ${@}." 1200 IGCM_debug_Exit "ncea" 1201 fi 1202 1203 IGCM_debug_PopStack "IGCM_sys_ncea" 1204 } 1205 1206 function IGCM_sys_ncecat { 1207 IGCM_debug_PushStack "IGCM_sys_ncecat" -- $@ 1208 if ( $DEBUG_sys ) ; then 1209 echo "IGCM_sys_ncecat :" $@ 1210 fi 1211 /usr/local/bin/ncecat $@ 1212 if [ $? -gt 0 ] ; then 1213 echo "IGCM_sys_ncecat : erreur ${@}." 1214 IGCM_debug_Exit "ncecat" 1215 fi 1216 1217 IGCM_debug_PopStack "IGCM_sys_ncecat" 1218 } 1219 1220 function IGCM_sys_ncflint { 1221 IGCM_debug_PushStack "IGCM_sys_ncflint" -- $@ 1222 if ( $DEBUG_sys ) ; then 1223 echo "IGCM_sys_ncflint :" $@ 1224 fi 1225 /usr/local/bin/ncflint $@ 1226 if [ $? -gt 0 ] ; then 1227 echo "IGCM_sys_ncflint : erreur ${@}." 1228 IGCM_debug_Exit "ncflint" 1229 fi 1230 1231 IGCM_debug_PopStack "IGCM_sys_ncflint" 1232 } 1233 1234 function IGCM_sys_ncks { 1235 IGCM_debug_PushStack "IGCM_sys_ncks" -- $@ 1236 if ( $DEBUG_sys ) ; then 1237 echo "IGCM_sys_ncks :" $@ 1238 fi 1239 /usr/local/bin/ncks $@ 1240 if [ $? -gt 0 ] ; then 1241 echo "IGCM_sys_ncks : erreur ${@}." 1242 IGCM_debug_Exit "ncks" 1243 fi 1244 1245 IGCM_debug_PopStack "IGCM_sys_ncks" 1246 } 1247 1248 function IGCM_sys_ncpdq { 1249 IGCM_debug_PushStack "IGCM_sys_ncpdq" -- $@ 1250 if ( $DEBUG_sys ) ; then 1251 echo "IGCM_sys_ncpdq :" $@ 1252 fi 1253 /usr/local/bin/ncpdq $@ 1254 if [ $? -gt 0 ] ; then 1255 echo "IGCM_sys_ncpdq : erreur ${@}." 1256 IGCM_debug_Exit "ncpdq" 1257 fi 1258 1259 IGCM_debug_PopStack "IGCM_sys_ncpdq" 1260 } 1261 1262 function IGCM_sys_ncra { 1263 IGCM_debug_PushStack "IGCM_sys_ncra" -- $@ 1264 if ( $DEBUG_sys ) ; then 1265 echo "IGCM_sys_ncra :" $@ 1266 fi 1267 /usr/local/bin/ncra $@ 1268 if [ $? -gt 0 ] ; then 1269 echo "IGCM_sys_ncra : erreur ${@}." 1270 IGCM_debug_Exit "ncra" 1271 fi 1272 1273 IGCM_debug_PopStack "IGCM_sys_ncra" 1274 } 1275 1276 function IGCM_sys_ncrcat { 1277 IGCM_debug_PushStack "IGCM_sys_ncrcat" -- $@ 1278 if ( $DEBUG_sys ) ; then 1279 echo "IGCM_sys_ncrcat :" $@ 1280 fi 1281 /usr/local/bin/ncrcat $@ 1282 if [ $? -gt 0 ] ; then 1283 echo "IGCM_sys_ncrcat : erreur ${@}." 1284 # IGCM_debug_Exit "ncrcat" 1285 fi 1286 1287 IGCM_debug_PopStack "IGCM_sys_ncrcat" 1288 } 1289 1290 function IGCM_sys_ncrename { 1291 IGCM_debug_PushStack "IGCM_sys_ncrename" -- $@ 1292 if ( $DEBUG_sys ) ; then 1293 echo "IGCM_sys_ncrename :" $@ 1294 fi 1295 /usr/local/bin/ncrename $@ 1296 if [ $? -gt 0 ] ; then 1297 echo "IGCM_sys_ncrename : erreur ${@}." 1298 IGCM_debug_Exit "ncrename" 1299 fi 1300 1301 IGCM_debug_PopStack "IGCM_sys_ncrename" 1302 } 1303 1304 function IGCM_sys_ncwa { 1305 IGCM_debug_PushStack "IGCM_sys_ncwa" -- $@ 1306 if ( $DEBUG_sys ) ; then 1307 echo "IGCM_sys_ncwa :" $@ 1308 fi 1309 /usr/local/bin/ncwa $@ 1310 if [ $? -gt 0 ] ; then 1311 echo "IGCM_sys_ncwa : erreur ${@}." 1312 IGCM_debug_Exit "ncwa" 1313 fi 1314 1315 IGCM_debug_PopStack "IGCM_sys_ncwa" 1316 } 1317 1318 ############################################################## 1319 # CDO OPERATOR 1320 1321 function IGCM_sys_cdo { 1322 IGCM_debug_PushStack "IGCM_sys_cdo" -- $@ 1323 1324 \cdo $@ 1325 if [ $? -gt 0 ] ; then 1326 echo "IGCM_sys_cdo : erreur ${@}." 1327 IGCM_debug_PopStack "IGCM_sys_cdo" 1328 return 1 1329 else 1330 IGCM_debug_PopStack "IGCM_sys_cdo" 1331 return 0 1332 fi 1333 1334 IGCM_debug_PopStack "IGCM_sys_cdo" 1316 IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@ 1317 if ( $DEBUG_sys ) ; then 1318 echo "IGCM_sys_rebuild :" $@ 1319 fi 1320 /home/users/igcmg/rebuild/bin/rebuild -f -o $@ 1321 if [ $? -gt 0 ] ; then 1322 echo "IGCM_sys_rebuild : erreur ${@}." 1323 IGCM_debug_Exit "rebuild" 1324 fi 1325 1326 IGCM_debug_PopStack "IGCM_sys_rebuild" 1335 1327 } 1336 1328 … … 1339 1331 1340 1332 function IGCM_sys_activ_variables { 1341 1342 1343 1344 1345 1333 IGCM_debug_PushStack "IGCM_sys_activ_variables" 1334 if ( $DEBUG_sys ) ; then 1335 echo "IGCM_sys_activ_variables" 1336 fi 1337 IGCM_debug_PopStack "IGCM_sys_activ_variables" 1346 1338 } 1347 1339 … … 1350 1342 1351 1343 function IGCM_sys_desactiv_variables { 1352 1353 1354 1355 1356 1344 IGCM_debug_PushStack "IGCM_sys_desactiv_variables" 1345 if ( $DEBUG_sys ) ; then 1346 echo "IGCM_sys_desactiv_variables" 1347 fi 1348 IGCM_debug_PopStack "IGCM_sys_desactiv_variables" 1357 1349 } 1358 1350 … … 1361 1353 1362 1354 function IGCM_sys_build_run_file { 1363 IGCM_debug_PushStack "IGCM_sys_build_run_file" $@ 1364 if ( $DEBUG_sys ) ; then 1365 echo "IGCM_sys_build_run_file" 1366 fi 1367 IGCM_debug_PopStack "IGCM_sys_build_run_file" 1355 1356 IGCM_debug_Print 3 " dummy function : IGCM_sys_build_run_file " 1357 1358 } 1359 1360 ############################################################ 1361 # Build MPI/OMP scripts 1362 function IGCM_sys_build_execution_scripts 1363 { 1364 IGCM_debug_PushStack "IGCM_sys_build_execution_scripts" $@ 1365 if ( $DEBUG_sys ) ; then 1366 echo "IGCM_sys_build_execution_scripts " $@ 1367 fi 1368 typeset nodes listnodes init_node start_num init_exec comp ExeNameIn ExeNameOut 1369 typeset node_num_current node_current comp_proc_mpi_loc comp_proc_omp_loc 1370 typeset num_corempi nombre_restant_node nombre_restant_comp 1371 1372 if [ ! -f ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} ] ; then 1373 IGCM_debug_Exit "IGCM_sys_titane build_execution_scripts : Job_${config_UserChoices_JobName} doesn't exist in SUBMIT_DIR : ${SUBMIT_DIR} " 1374 fi 1375 1376 if ( ${OK_PARA_MPMD} ) ; then 1377 1378 if [ -f run_file ] ; then 1379 IGCM_sys_Rm -f run_file 1380 fi 1381 touch run_file 1382 1383 if ( ${OK_PARA_OMP} ) ; then 1384 1385 # Hosts treatment 1386 1387 ${HOST_MPIRUN_COMMAND} hostname | sort | uniq > hosts.tmp 1388 1389 i=0 1390 rm -f hosts 1391 IGCM_debug_Print 1 "sys Obelix, Hosts avaible :" 1392 for nodes in `cat hosts.tmp` ; do 1393 host[$i]=$nodes 1394 echo "${host[$i]} slots=1 max_slots=1" >> hosts 1395 IGCM_debug_Print 1 ${host[$i]} 1396 i=$((i+1)) 1397 done 1398 rm -f hosts.tmp 1399 1400 listnodes=${host[*]} 1401 1402 EXECUTION="${HOST_MPIRUN_COMMAND} -hostfile hosts" 1403 1404 # Initialisation 1405 1406 init_node=y 1407 node_num_current=0 1408 start_num=0 1409 init_exec=n 1410 1411 # Test : if oasis is there, we put it at the first position 1412 1413 for comp in ${config_ListOfComponents[*]} ; do 1414 1415 if [ "X${comp}" = "XCPL" ] ; then 1416 1417 eval ExeNameIn=\${config_Executable_${comp}[0]} 1418 eval ExeNameOut=\${config_Executable_${comp}[1]} 1419 1420 echo "#!/bin/ksh" > script_${ExeNameOut}.ksh 1421 echo "" >> script_${ExeNameOut}.ksh 1422 #echo "export KMP_STACKSIZE=3g" >> script_${ExeNameOut}.ksh 1423 #echo "export KMP_LIBRARY=turnaround" >> script_${ExeNameOut}.ksh 1424 #echo "export MKL_SERIAL=YES" >> script_${ExeNameOut}.ksh 1425 echo "./${ExeNameOut} > out_${ExeNameOut}.out 2>out_${ExeNameOut}.err" >> script_${ExeNameOut}.ksh 1426 IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh 1427 1428 init_node=n 1429 1430 (( nombre_restant_node = NUM_COREPERNODE - 1 )) 1431 node_num_current=0 1432 node_current=${host[${node_num_current}]} 1433 1434 EXECUTION="${EXECUTION} -H ${node_current} -np 1 ./script_${ExeNameOut}.ksh" 1435 1436 init_exec=y 1437 start_num=1 1438 1439 fi 1440 1441 done 1442 1443 # Then loop on the components (except for oasis) 1444 1445 for comp in ${config_ListOfComponents[*]} ; do 1446 1447 eval ExeNameIn=\${config_Executable_${comp}[0]} 1448 eval ExeNameOut=\${config_Executable_${comp}[1]} 1449 1450 # Only if we really have an executable for the component : 1451 if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${comp}" != "XCPL" ] ) ; then 1452 1453 eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} 1454 eval comp_proc_omp_loc=\${${comp}_PROC_OMP} 1455 1456 echo "#!/bin/ksh" > script_${ExeNameOut}.ksh 1457 # echo "set -vx" >> script_${ExeNameOut}.ksh 1458 echo "" >> script_${ExeNameOut}.ksh 1459 #echo "export KMP_STACKSIZE=3g" >> script_${ExeNameOut}.ksh 1460 #echo "export KMP_LIBRARY=turnaround" >> script_${ExeNameOut}.ksh 1461 #echo "export MKL_SERIAL=YES" >> script_${ExeNameOut}.ksh 1462 echo "OMP_NUM_THREADS=${comp_proc_omp_loc}" >> script_${ExeNameOut}.ksh 1463 echo "(( MYMPIRANK = OMPI_COMM_WORLD_RANK - ${start_num})) " >> script_${ExeNameOut}.ksh 1464 echo "./${ExeNameOut} > out_${ExeNameOut}.out.\${MYMPIRANK} 2>out_${ExeNameOut}.err.\${MYMPIRANK}" >> script_${ExeNameOut}.ksh 1465 IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh 1466 1467 node_num=0 1468 1469 # We define the number of MPI process to be assigned for the component 1470 1471 nombre_restant_comp=${comp_proc_mpi_loc} 1472 1473 # Loop on the allocated nodes 1474 1475 for node in ${listnodes} ; do 1476 1477 # We go to the current node 1478 if [ ${node_num} = ${node_num_current} ] ; then 1479 1480 node_current=${host[${node_num_current}]} 1481 1482 # If first time on the node : initialisation 1483 1484 if [ ${init_node} = y ] ; then 1485 nombre_restant_node=${NUM_COREPERNODE} 1486 fi 1487 1488 # Test on the number of OMP threads 1489 1490 if [ ${comp_proc_omp_loc} -gt ${nombre_restant_node} ] ; then 1491 (( node_num = node_num + 1 )) 1492 node_num_current=${node_num} 1493 init_node=y 1494 continue 1495 fi 1496 1497 # Number of MPI process to assign 1498 1499 (( num_corempi = nombre_restant_node / comp_proc_omp_loc )) 1500 1501 if [ ${num_corempi} -gt ${nombre_restant_comp} ] ; then 1502 num_corempi=${nombre_restant_comp} 1503 fi 1504 1505 (( nombre_restant_node = nombre_restant_node - num_corempi * comp_proc_omp_loc )) 1506 (( nombre_restant_comp = nombre_restant_comp - num_corempi )) 1507 1508 if [ ${init_exec} = y ] ; then 1509 EXECUTION="${EXECUTION} : -H ${node_current} -np ${num_corempi} ./script_${ExeNameOut}.ksh" 1510 else 1511 EXECUTION="${EXECUTION} -H ${node_current} -np ${num_corempi} ./script_${ExeNameOut}.ksh" 1512 init_exec=y 1513 fi 1514 1515 (( start_num = num_corempi + start_num )) 1516 1517 else 1518 1519 (( node_num = node_num + 1 )) 1520 continue 1521 fi 1522 1523 # Test on the number of core/process remaining on the node/component 1524 1525 if [ ${nombre_restant_node} = 0 ] ; then 1526 (( node_num = node_num + 1 )) 1527 node_num_current=${node_num} 1528 init_node=y 1529 1530 if [ ${nombre_restant_comp} = 0 ] ; then 1531 break 1 1532 fi 1533 else 1534 1535 node_num_current=${node_num} 1536 init_node=n 1537 1538 if [ ${nombre_restant_comp} = 0 ] ; then 1539 break 1 1540 fi 1541 fi 1542 done 1543 fi 1544 done 1545 1546 else 1547 1548 # Then first loop on the components for the coupler ie oasis 1549 1550 ## the coupler ie oasis must be the first one 1551 for comp in ${config_ListOfComponents[*]} ; do 1552 1553 eval ExeNameOut=\${config_Executable_${comp}[1]} 1554 1555 # for CPL component only 1556 if [ "X${comp}" = "XCPL" ] ; then 1557 eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} 1558 echo "-np ${comp_proc_mpi_loc} ./${ExeNameOut} " >> run_file 1559 fi 1560 done 1561 1562 # Then second loop on the components 1563 1564 for comp in ${config_ListOfComponents[*]} ; do 1565 1566 eval ExeNameOut=\${config_Executable_${comp}[1]} 1567 1568 # Only if we really have an executable for the component and not the coupler ie oasis: 1569 if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${comp}" != "XCPL" ] ) ; then 1570 eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} 1571 echo "-np ${comp_proc_mpi_loc} ./${ExeNameOut}" >> run_file 1572 fi 1573 done 1574 IGCM_sys_Chmod u+x run_file 1575 1576 EXECUTION="${HOST_MPIRUN_COMMAND} --app ./run_file" 1577 1578 fi 1579 1580 else # Only one executable. launch it. 1581 1582 for comp in ${config_ListOfComponents[*]} ; do 1583 1584 # Only if we really have an executable for the component : 1585 eval ExeNameOut=\${config_Executable_${comp}[1]} 1586 if ( [ "X${ExeNameOut}" != X\"\" ] ) ; then 1587 1588 echo "#!/bin/ksh" > script_${ExeNameOut}.ksh 1589 echo "" >> script_${ExeNameOut}.ksh 1590 if ( ${OK_PARA_OMP} ) ; then 1591 eval comp_proc_omp_loc=\${${comp}_PROC_OMP} 1592 echo "OMP_NUM_THREADS=${comp_proc_omp_loc}" >> script_${ExeNameOut}.ksh 1593 fi 1594 if ( ${OK_PARA_MPI} ) ; then 1595 # Default : mpirun used if nb_proc gt 1 1596 # pour sortie out/err par process 1597 # echo "./${ExeNameOut} > out_${ExeNameOut}.out.\${OMPI_COMM_WORLD_RANK} 2>out_${ExeNameOut}.err.\${OMPI_COMM_WORLD_RANK}" >> script_${ExeNameOut}.ksh 1598 echo "./${ExeNameOut}" >> script_${ExeNameOut}.ksh 1599 IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh 1600 EXECUTION="${HOST_MPIRUN_COMMAND} ./script_${ExeNameOut}.ksh" 1601 else 1602 # Default : mpirun is NOT used if nb_proc eq 1 1603 # pour sortie out/err par process 1604 # echo "./${ExeNameOut} > out_${ExeNameOut}.out 2>out_${ExeNameOut}.err" >> script_${ExeNameOut}.ksh 1605 echo "./${ExeNameOut}" >> script_${ExeNameOut}.ksh 1606 IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh 1607 EXECUTION="time ./script_${ExeNameOut}.ksh" 1608 fi 1609 fi 1610 done 1611 1612 fi 1613 1614 IGCM_debug_Print 1 "sys Obelix : La commande d execution est " 1615 IGCM_debug_Print 1 $EXECUTION 1616 1617 IGCM_debug_PopStack "IGCM_sys_build_execution_scripts" 1368 1618 } 1369 1619 … … 1371 1621 # Check of space available on temporary filesytems 1372 1622 function IGCM_sys_check_quota { 1373 IGCM_debug_PushStack "IGCM_sys_check_quota" 1374 if ( $DEBUG_sys ) ; then 1375 echo "IGCM_sys_check_quota" 1376 fi 1377 IGCM_debug_PopStack "IGCM_sys_check_quota" 1378 } 1623 IGCM_debug_PushStack "IGCM_sys_check_quota" 1624 if ( $DEBUG_sys ) ; then 1625 echo "IGCM_sys_check_quota" 1626 fi 1627 IGCM_debug_PopStack "IGCM_sys_check_quota" 1628 } 1629 1630 ############################################################## 1631 # NCO OPERATOR 1632 1633 function IGCM_sys_ncap2 { 1634 IGCM_debug_PushStack "IGCM_sys_ncap2" -- $@ 1635 if ( $DEBUG_sys ) ; then 1636 echo "IGCM_sys_ncap2 :" $@ 1637 fi 1638 /usr/local/bin/ncap2 "$@" 1639 if [ $? -gt 0 ] ; then 1640 echo "IGCM_sys_ncap2 : erreur ${@}." 1641 IGCM_debug_Exit "ncap2" 1642 fi 1643 1644 IGCM_debug_PopStack "IGCM_sys_ncap2" 1645 } 1646 1647 function IGCM_sys_ncatted { 1648 IGCM_debug_PushStack "IGCM_sys_ncatted" -- $@ 1649 if ( $DEBUG_sys ) ; then 1650 echo "IGCM_sys_ncatted :" $@ 1651 fi 1652 /usr/local/bin/ncatted "$@" 1653 if [ $? -gt 0 ] ; then 1654 echo "IGCM_sys_ncatted : erreur ${@}." 1655 IGCM_debug_Exit "ncatted" 1656 fi 1657 1658 IGCM_debug_PopStack "IGCM_sys_ncatted" 1659 } 1660 1661 function IGCM_sys_ncbo { 1662 IGCM_debug_PushStack "IGCM_sys_ncbo" -- $@ 1663 if ( $DEBUG_sys ) ; then 1664 echo "IGCM_sys_ncbo :" $@ 1665 fi 1666 /usr/local/bin/ncbo $@ 1667 if [ $? -gt 0 ] ; then 1668 echo "IGCM_sys_ncbo : erreur ${@}." 1669 IGCM_debug_Exit "ncbo" 1670 fi 1671 1672 IGCM_debug_PopStack "IGCM_sys_ncbo" 1673 } 1674 1675 function IGCM_sys_ncdiff { 1676 IGCM_debug_PushStack "IGCM_sys_ncdiff" -- $@ 1677 if ( $DEBUG_sys ) ; then 1678 echo "IGCM_sys_ncdiff :" $@ 1679 fi 1680 /usr/local/bin/ncdiff $@ 1681 if [ $? -gt 0 ] ; then 1682 echo "IGCM_sys_ncdiff : erreur ${@}." 1683 IGCM_debug_Exit "ncdiff" 1684 fi 1685 1686 IGCM_debug_PopStack "IGCM_sys_ncdiff" 1687 } 1688 1689 function IGCM_sys_ncea { 1690 IGCM_debug_PushStack "IGCM_sys_ncea" -- $@ 1691 if ( $DEBUG_sys ) ; then 1692 echo "IGCM_sys_ncea :" $@ 1693 fi 1694 /usr/local/bin/ncea $@ 1695 if [ $? -gt 0 ] ; then 1696 echo "IGCM_sys_ncea : erreur ${@}." 1697 IGCM_debug_Exit "ncea" 1698 fi 1699 1700 IGCM_debug_PopStack "IGCM_sys_ncea" 1701 } 1702 1703 function IGCM_sys_ncecat { 1704 IGCM_debug_PushStack "IGCM_sys_ncecat" -- $@ 1705 if ( $DEBUG_sys ) ; then 1706 echo "IGCM_sys_ncecat :" $@ 1707 fi 1708 /usr/local/bin/ncecat $@ 1709 if [ $? -gt 0 ] ; then 1710 echo "IGCM_sys_ncecat : erreur ${@}." 1711 IGCM_debug_Exit "ncecat" 1712 fi 1713 1714 IGCM_debug_PopStack "IGCM_sys_ncecat" 1715 } 1716 1717 function IGCM_sys_ncflint { 1718 IGCM_debug_PushStack "IGCM_sys_ncflint" -- $@ 1719 if ( $DEBUG_sys ) ; then 1720 echo "IGCM_sys_ncflint :" $@ 1721 fi 1722 /usr/local/bin/ncflint $@ 1723 if [ $? -gt 0 ] ; then 1724 echo "IGCM_sys_ncflint : erreur ${@}." 1725 IGCM_debug_Exit "ncflint" 1726 fi 1727 1728 IGCM_debug_PopStack "IGCM_sys_ncflint" 1729 } 1730 1731 function IGCM_sys_ncks { 1732 IGCM_debug_PushStack "IGCM_sys_ncks" -- $@ 1733 if ( $DEBUG_sys ) ; then 1734 echo "IGCM_sys_ncks :" $@ 1735 fi 1736 /usr/local/bin/ncks $@ 1737 if [ $? -gt 0 ] ; then 1738 echo "IGCM_sys_ncks : erreur ${@}." 1739 IGCM_debug_Exit "ncks" 1740 fi 1741 1742 IGCM_debug_PopStack "IGCM_sys_ncks" 1743 } 1744 1745 function IGCM_sys_ncpdq { 1746 IGCM_debug_PushStack "IGCM_sys_ncpdq" -- $@ 1747 if ( $DEBUG_sys ) ; then 1748 echo "IGCM_sys_ncpdq :" $@ 1749 fi 1750 /usr/local/bin/ncpdq $@ 1751 if [ $? -gt 0 ] ; then 1752 echo "IGCM_sys_ncpdq : erreur ${@}." 1753 IGCM_debug_Exit "ncpdq" 1754 fi 1755 1756 IGCM_debug_PopStack "IGCM_sys_ncpdq" 1757 } 1758 1759 function IGCM_sys_ncra { 1760 IGCM_debug_PushStack "IGCM_sys_ncra" -- $@ 1761 if ( $DEBUG_sys ) ; then 1762 echo "IGCM_sys_ncra :" $@ 1763 fi 1764 /usr/local/bin/ncra $@ 1765 if [ $? -gt 0 ] ; then 1766 echo "IGCM_sys_ncra : erreur ${@}." 1767 IGCM_debug_Exit "ncra" 1768 fi 1769 1770 IGCM_debug_PopStack "IGCM_sys_ncra" 1771 } 1772 1773 function IGCM_sys_ncrcat { 1774 IGCM_debug_PushStack "IGCM_sys_ncrcat" -- $@ 1775 if ( $DEBUG_sys ) ; then 1776 echo "IGCM_sys_ncrcat :" $@ 1777 fi 1778 /usr/local/bin/ncrcat $@ 1779 if [ $? -gt 0 ] ; then 1780 echo "IGCM_sys_ncrcat : erreur ${@}." 1781 # IGCM_debug_Exit "ncrcat" 1782 fi 1783 1784 IGCM_debug_PopStack "IGCM_sys_ncrcat" 1785 } 1786 1787 function IGCM_sys_ncrename { 1788 IGCM_debug_PushStack "IGCM_sys_ncrename" -- $@ 1789 if ( $DEBUG_sys ) ; then 1790 echo "IGCM_sys_ncrename :" $@ 1791 fi 1792 /usr/local/bin/ncrename $@ 1793 if [ $? -gt 0 ] ; then 1794 echo "IGCM_sys_ncrename : erreur ${@}." 1795 IGCM_debug_Exit "ncrename" 1796 fi 1797 1798 IGCM_debug_PopStack "IGCM_sys_ncrename" 1799 } 1800 1801 function IGCM_sys_ncwa { 1802 IGCM_debug_PushStack "IGCM_sys_ncwa" -- $@ 1803 if ( $DEBUG_sys ) ; then 1804 echo "IGCM_sys_ncwa :" $@ 1805 fi 1806 /usr/local/bin/ncwa $@ 1807 if [ $? -gt 0 ] ; then 1808 echo "IGCM_sys_ncwa : erreur ${@}." 1809 IGCM_debug_Exit "ncwa" 1810 fi 1811 1812 IGCM_debug_PopStack "IGCM_sys_ncwa" 1813 } 1814 1815 ############################################################## 1816 # CDO OPERATOR 1817 1818 function IGCM_sys_cdo { 1819 IGCM_debug_PushStack "IGCM_sys_cdo" -- $@ 1820 1821 \cdo $@ 1822 if [ $? -gt 0 ] ; then 1823 echo "IGCM_sys_cdo : erreur ${@}." 1824 IGCM_debug_PopStack "IGCM_sys_cdo" 1825 return 1 1826 else 1827 IGCM_debug_PopStack "IGCM_sys_cdo" 1828 return 0 1829 fi 1830 1831 IGCM_debug_PopStack "IGCM_sys_cdo" 1832 }
Note: See TracChangeset
for help on using the changeset viewer.