Ignore:
Timestamp:
03/30/12 16:57:50 (12 years ago)
Author:
sdipsl
Message:
  • adapt curie system for the pack
  • homogenize curie and titane system. Easier to maintain
Location:
trunk/libIGCM/libIGCM_sys
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/libIGCM/libIGCM_sys/libIGCM_sys_curie.ksh

    r622 r623  
    1414#========================================================= 
    1515# 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. 
    1717# Extract with command: cat lib* | grep "^#D-" | cut -c "4-" 
    1818#========================================================= 
    1919 
    2020#D-#================================================== 
    21 #D-LibIGCM_sys for Titane 
    22 #D-#================================================== 
    23 #D- 
    24 #D- This ksh library if a layer under some usefull  
     21#D-LibIGCM_sys for Curie 
     22#D-#================================================== 
     23#D- 
     24#D- This ksh library if a layer under some usefull 
    2525#D-environment variables and shell commands. 
    2626#D-All those definitions depend on host particularities. 
     
    8080typeset -r RSYNC_opt="-va" 
    8181# ie storage filesystem 
    82 typeset -r RHOST=curie 
     82typeset -r STOREHOST=${MASTER} 
    8383 
    8484#==================================================== 
     
    101101#==================================================== 
    102102 
     103# ============ CESIUM START ============ # 
     104 
     105#==================================================== 
     106#- Mirror libIGCM from titane to cesium if needed 
     107#ROOTSYS=$( echo ${libIGCM} | gawk -F"/" '{print $3}' ) 
     108#if [ ! ${ROOTSYS} = "home" ] ; then 
     109#  typeset -r MirrorlibIGCM=${MirrorlibIGCM:=true} 
     110#else 
     111#  typeset -r MirrorlibIGCM=${MirrorlibIGCM:=false} 
     112#fi 
     113 
     114#==================================================== 
     115#- libIGCM_POST 
     116#if ( ${MirrorlibIGCM} ) ; then 
     117#  PATHlibIGCM=$( echo ${libIGCM} | gawk -F"${LOGIN}/" '{print $2}' | sed -e "s&/libIGCM&&" ) 
     118#  typeset -r libIGCM_POST=${HOME}/MIRROR/${PATHlibIGCM}/libIGCM 
     119#else 
     120#  typeset -r libIGCM_POST=${libIGCM} 
     121#fi 
     122 
     123# ============ CESIUM  END  ============ # 
     124 
     125#==================================================== 
     126#- MirrorlibIGCM for frontend 
     127typeset -r MirrorlibIGCM=${MirrorlibIGCM:=false} 
     128 
     129#==================================================== 
     130#- libIGCM_POST for frontend 
     131typeset -r libIGCM_POST=${libIGCM} 
     132 
    103133#==================================================== 
    104134#- R_EXE   (==> BIN_DIR = ${MODIPSL}/bin ) 
     
    110140 
    111141#==================================================== 
    112 #- ARCHIVE 
     142#- ARCHIVE (dedicated to large files) 
    113143typeset -r ARCHIVE=${CCCSTOREDIR} 
    114144 
    115 #==================================================== 
    116 typeset -r MirrorlibIGCM=${MirrorlibIGCM:=false} 
    117  
    118 #==================================================== 
    119 #- libIGCM_POST 
    120 typeset -r libIGCM_POST=${libIGCM} 
     145#- ARCHIVE (dedicated to small/medium files) 
     146typeset -r STORAGE=${CCCWORKDIR} 
    121147 
    122148#==================================================== 
     
    126152 
    127153#==================================================== 
    128 #- OUT 
     154#- R_OUT 
    129155typeset -r R_OUT=${ARCHIVE}/IGCM_OUT 
    130156 
    131157#==================================================== 
    132 #- OUT_SCR (ONLY FOR double copy an scratch) 
    133 typeset -r R_OUT_SCR=${SCRATCHDIR}/IGCM_OUT 
     158#- R_FIG (hosting figures : monitoring and atlas, and/or small files) 
     159typeset -r R_FIG=${STORAGE}/IGCM_OUT 
     160 
     161#==================================================== 
     162#- R_BUF (ONLY FOR double copy an scratch) 
     163typeset -r R_BUF=${SCRATCHDIR}/IGCM_OUT 
     164 
     165#==================================================== 
     166#- BIG_DIR : BIG_DIR to store files waiting for rebuild 
     167typeset -r BIG_DIR=${BIG_DIR:=${SCRATCHDIR}/REBUILD} 
    134168 
    135169#==================================================== 
    136170#- OUT_POST 
    137 typeset -r R_OUT_POST=${SCRATCHDIR}/IGCM_OUT_POST 
     171typeset -r R_OUT_POST=${SCRATCHDIR}/IGCM_OUT 
    138172 
    139173#==================================================== 
    140174#- RUN_DIR_PATH : Temporary working directory (=> TMP) 
    141175if [ ! X${BRIDGE_MSUB_NPROC} = X1 ] ; then 
    142     typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${SCRATCHDIR}/RUN_DIR/${BRIDGE_MSUB_JOBID}} 
     176  typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${SCRATCHDIR}/RUN_DIR/${BRIDGE_MSUB_JOBID}} 
    143177else 
    144     typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${SCRATCHDIR}/TMPDIR_IGCM/${BRIDGE_MSUB_JOBID}} 
     178  typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${SCRATCHDIR}/TMPDIR_IGCM/${BRIDGE_MSUB_JOBID}} 
    145179fi 
    146  
    147 #==================================================== 
    148 #- BIG_DIR : BIG_DIR to store files waiting for rebuild 
    149 typeset -r BIG_DIR=${BIG_DIR:=${SCRATCHDIR}/REBUILD} 
    150180 
    151181#==================================================== 
     
    157187UNIX_MAX_LIMIT=360 
    158188 
     189#==================================================== 
     190#- set PackDefault true on curie 
     191PackDefault=true 
     192 
    159193NUM_COREPERNODE=8 
    160          
     194 
     195#==================================================== 
     196#- Default number of MPI task for IPSL coupled model 
     197#- required for backward compatibility 
     198#- 
     199DEFAULT_NUM_PROC_OCE=5 
     200DEFAULT_NUM_PROC_CPL=1 
     201DEFAULT_NUM_PROC_ATM=26 
     202DEFAULT_NUM_PROC_TOTAL=32 
    161203 
    162204#D-#================================================== 
    163205#D-function IGCM_sys_RshMaster 
    164 #D-* Purpose: Just a fake command to wrapp 
    165 #D-           IGCM_card call in post-treatment 
    166 #D-           Ulam do not see brodie filesystem 
    167 #D-           Cesium do not see all mercure filesystem 
    168 #D-           That's why we need this hack. 
     206#D-* Purpose: Connection to frontend machine. 
    169207#D-* Examples: 
    170208#D- 
    171209function IGCM_sys_RshMaster { 
    172     IGCM_debug_PushStack "IGCM_sys_RshMaster" $@ 
    173     /bin/ksh <<-EOF 
     210  IGCM_debug_PushStack "IGCM_sys_RshMaster" $@ 
     211  /bin/ksh <<-EOF 
    174212    export libIGCM=${libIGCM} 
    175213    export DEBUG_debug=${DEBUG_debug} 
     
    178216    ${@} 
    179217EOF 
    180     if [ $? -gt 0 ] ; then 
    181         echo "IGCM_sys_RshMaster : erreur." 
    182         IGCM_debug_Exit "IGCM_sys_RshMaster" 
    183     fi 
    184     IGCM_debug_PopStack "IGCM_sys_RshMaster" 
     218  if [ $? -gt 0 ] ; then 
     219    echo "IGCM_sys_RshMaster : erreur." 
     220    IGCM_debug_Exit "IGCM_sys_RshMaster" 
     221  fi 
     222  IGCM_debug_PopStack "IGCM_sys_RshMaster" 
    185223} 
    186224 
     
    191229#D- 
    192230function IGCM_sys_RshArchive { 
    193     IGCM_debug_PushStack "IGCM_sys_RshArchive" $@ 
    194     /bin/ksh <<-EOF 
     231  IGCM_debug_PushStack "IGCM_sys_RshArchive" $@ 
     232  /bin/ksh <<-EOF 
    195233    ${@} 
    196234EOF 
    197     if [ $? -gt 0 ] ; then 
    198         echo "IGCM_sys_RshArchive : erreur." 
    199         IGCM_debug_Exit "IGCM_sys_RshArchive" 
    200     fi 
    201     IGCM_debug_PopStack "IGCM_sys_RshArchive" 
     235  if [ $? -gt 0 ] ; then 
     236    echo "IGCM_sys_RshArchive : erreur." 
     237    IGCM_debug_Exit "IGCM_sys_RshArchive" 
     238  fi 
     239  IGCM_debug_PopStack "IGCM_sys_RshArchive" 
    202240} 
    203241 
     
    208246#D- 
    209247function IGCM_sys_RshPost { 
    210     IGCM_debug_PushStack "IGCM_sys_RshPost" $@ 
    211     if ( $DEBUG_sys ) ; then 
    212         echo "IGCM_sys_RshPost :" $@ 
    213     fi 
    214  
    215         /bin/ksh ${@} 
    216         if [ $? -gt 0 ] ; then 
    217             echo "IGCM_sys_RshPost : erreur." 
    218             IGCM_debug_Exit "IGCM_sys_RshPost" 
    219         fi 
    220     IGCM_debug_PopStack "IGCM_sys_RshPost" 
     248  IGCM_debug_PushStack "IGCM_sys_RshPost" $@ 
     249  if ( $DEBUG_sys ) ; then 
     250    echo "IGCM_sys_RshPost :" $@ 
     251  fi 
     252 
     253  #echo cat tmp_IGCM_sys_RshPost_$$ INITIAL 
     254  #cat tmp_IGCM_sys_RshPost_$$ 
     255  # keep standard input (stdin) for the loop onto temporary file 
     256  cat >tmp_IGCM_sys_RshPost_$$ 
     257 
     258# ============ FRONTEND START ============ # 
     259 
     260  /bin/ksh <tmp_IGCM_sys_RshPost_$$ 
     261  if [ $? -gt 0 ] ; then 
     262    echo "IGCM_sys_RshPost : erreur." 
     263    IGCM_debug_Exit "IGCM_sys_RshPost" 
     264  fi 
     265  # delete temporary file 
     266  \rm tmp_IGCM_sys_RshPost_$$ 
     267 
     268# ============ FRONTEND  END  ============ # 
     269 
     270# ============ CESIUM START ============ # 
     271#  typeset NB_ESSAI DELAI status i 
     272#  if [ "X$( grep rebuild_from tmp_IGCM_sys_RshPost_$$ )" != "X" ] ; then 
     273#    #little hack so that rebuild submission is done on titane not an cesium 
     274# 
     275#    libIGCM_POST_sed=$( echo $libIGCM_POST | sed 's/\//\\\//g' ) 
     276#    POST_DIR_sed=$( echo ${POST_DIR} | sed 's/\//\\\//g' ) 
     277#    sed "s/IGCM_sys_QsubPost/IGCM_sys_Qsub/g" tmp_IGCM_sys_RshPost_$$ > tmp.txt 
     278#    sed "s/ rebuild_fromWorkdir/ ${libIGCM_POST_sed}\/rebuild_fromWorkdir.job/g" tmp.txt > tmp_IGCM_sys_RshPost_$$ 
     279#    sed "s/ rebuild_fromArchive/ ${libIGCM_POST_sed}\/rebuild_fromArchive.job/g" tmp_IGCM_sys_RshPost_$$ > tmp.txt 
     280#    sed "s/Script_Post_Output=/Script_Output=${POST_DIR_sed}\//g" tmp.txt > tmp_IGCM_sys_RshPost_$$ 
     281#    \mv tmp.txt tmp_IGCM_sys_RshPost_$$ 
     282# 
     283#    echo cat tmp_IGCM_sys_RshPost_$$ AFTER 
     284#    cat tmp_IGCM_sys_RshPost_$$ 
     285# 
     286#    /bin/ksh <tmp_IGCM_sys_RshPost_$$ 
     287#    if [ $? -gt 0 ] ; then 
     288#      echo "IGCM_sys_RshPost : erreur." 
     289#      IGCM_debug_Exit "IGCM_sys_RshPost" 
     290#    fi 
     291#    # delete temporary file 
     292#    \rm tmp_IGCM_sys_RshPost_$$ 
     293# 
     294#  else 
     295#    # number of tentative 
     296#    NB_ESSAI=10 
     297#    # time delay between tentative 
     298#    DELAI=10 
     299#    i=0 
     300#    while [ $i -ne $NB_ESSAI ] ; do 
     301#      ssh -t titane996 ssh cesium /bin/ksh <tmp_IGCM_sys_RshPost_$$ 
     302#      status=$? 
     303#      if [ ${status} -ne 0 ]; 
     304#      then 
     305#       sleep $DELAI 
     306#      else 
     307#       break 
     308#      fi 
     309#      let i=$i+1 
     310#    done 
     311#    # delete temporary file 
     312#    \rm tmp_IGCM_sys_RshPost_$$ 
     313# 
     314#    if [ ${status} -gt 0 ] ; then 
     315#      echo "IGCM_sys_RshPost : erreur." 
     316#      IGCM_debug_Exit "IGCM_sys_RshPost" 
     317#    fi 
     318#  fi 
     319 
     320# ============ CESIUM  END  ============ # 
     321 
     322  IGCM_debug_PopStack "IGCM_sys_RshPost" 
    221323} 
    222324 
     
    227329#D- 
    228330function IGCM_sys_SendMail { 
    229     IGCM_debug_PushStack "IGCM_sys_SendMail" $@ 
    230     if ( $DEBUG_sys ) ; then 
    231        echo "IGCM_sys_SendMail :" $@ 
    232     fi 
    233  
    234     if ( ${ExitFlag} ) ; then 
    235         status=failed 
    236     else 
    237         status=completed 
    238     fi 
    239  
    240     cat  << END_MAIL > job_end.mail 
     331  IGCM_debug_PushStack "IGCM_sys_SendMail" $@ 
     332  if ( $DEBUG_sys ) ; then 
     333    echo "IGCM_sys_SendMail :" $@ 
     334  fi 
     335 
     336  if ( ${ExitFlag} ) ; then 
     337    status=failed 
     338  else 
     339    status=completed 
     340  fi 
     341 
     342  cat  << END_MAIL > job_end.mail 
    241343Dear ${LOGIN}, 
    242344 
     
    245347  Job ended   : ${DateEnd} 
    246348  Output files are available in ${R_SAVE} 
     349  Files to be rebuild are temporarily available in ${REBUILD_DIR} 
     350  Pre-packed files are temporarily available in ${R_BUFR} 
    247351  Script files, Script Outputs and Debug files (if necessary) are available in ${SUBMIT_DIR} 
    248352END_MAIL 
    249353 
    250354    if [ ! -z ${config_UserChoices_MailName} ] ; then 
    251         mail -s "${config_UserChoices_JobName} ${status}" ${config_UserChoices_MailName} < job_end.mail 
     355        mail -s "${config_UserChoices_JobName} ${status}" ${config_UserChoices_MailName} < job_end.mail 
    252356    elif [ -f ~/.forward ] ; then 
    253         mail -s "${config_UserChoices_JobName} ${status}" $( cat ~/.forward ) < job_end.mail 
    254     else 
    255     mail -s "${config_UserChoices_JobName} ${status}" ${USER} < job_end.mail 
    256     fi 
    257  
    258     if [ $? -gt 0 ] ; then 
    259         echo "IGCM_sys_SendMail : erreur." 
    260         IGCM_debug_Exit "IGCM_sys_SendMail" 
    261     fi 
    262     IGCM_debug_PopStack "IGCM_sys_SendMail" 
     357        mail -s "${config_UserChoices_JobName} ${status}" $( cat ~/.forward ) < job_end.mail 
     358    fi 
     359    sleep 10 
     360    rm -f job_end.mail 
     361 
     362  if [ $? -gt 0 ] ; then 
     363    echo "IGCM_sys_SendMail : erreur." 
     364    IGCM_debug_Exit "IGCM_sys_SendMail" 
     365  fi 
     366  IGCM_debug_PopStack "IGCM_sys_SendMail" 
    263367} 
    264368 
     
    269373#D- 
    270374function IGCM_sys_Mkdir { 
    271     IGCM_debug_PushStack "IGCM_sys_Mkdir" $@ 
    272     if ( $DEBUG_sys ) ; then 
    273         echo "IGCM_sys_Mkdir :" $@ 
    274     fi 
    275     if [ ! -d ${1} ]; then 
    276         \mkdir -p $1 
    277         if [ $? -gt 0 ] ; then 
    278             echo "IGCM_sys_Mkdir : erreur." 
    279             IGCM_debug_Exit "IGCM_sys_Mkdir" 
    280         fi 
    281     fi 
    282     # verification : 
    283     if [ ! -d ${1} ] ; then 
    284         echo "IGCM_sys_Mkdir : erreur." 
    285         IGCM_debug_Exit "IGCM_sys_Mkdir" 
    286     fi 
    287     IGCM_debug_PopStack "IGCM_sys_Mkdir" 
     375  IGCM_debug_PushStack "IGCM_sys_Mkdir" $@ 
     376  if ( $DEBUG_sys ) ; then 
     377    echo "IGCM_sys_Mkdir :" $@ 
     378  fi 
     379  if [ ! -d ${1} ]; then 
     380    \mkdir -p $1 
     381    if [ $? -gt 0 ] ; then 
     382      echo "IGCM_sys_Mkdir : erreur." 
     383      IGCM_debug_Exit "IGCM_sys_Mkdir" 
     384    fi 
     385  fi 
     386  # vérification : 
     387  if [ ! -d ${1} ] ; then 
     388    echo "IGCM_sys_Mkdir : erreur." 
     389    IGCM_debug_Exit "IGCM_sys_Mkdir" 
     390  fi 
     391  IGCM_debug_PopStack "IGCM_sys_Mkdir" 
    288392} 
    289393 
     
    294398#D- 
    295399function IGCM_sys_MkdirArchive { 
    296     IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@ 
    297     if ( $DEBUG_sys ) ; then 
    298         echo "IGCM_sys_MkdirArchive :" $@ 
    299     fi 
    300     #- creation de repertoire sur le serveur fichier 
    301     if [ ! -d ${1} ]; then  
    302         \mkdir -p $1 
    303         if [ $? -gt 0 ] ; then 
    304             echo "IGCM_sys_MkdirArchive : erreur." 
    305             IGCM_debug_Exit "IGCM_sys_MkdirArchive" 
    306         fi 
    307     fi 
    308     IGCM_debug_PopStack "IGCM_sys_MkdirArchive" 
     400  IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@ 
     401  if ( $DEBUG_sys ) ; then 
     402    echo "IGCM_sys_MkdirArchive :" $@ 
     403  fi 
     404  #- creation de repertoire sur le serveur fichier 
     405  if [ ! -d ${1} ]; then 
     406    \mkdir -p $1 
     407    if [ $? -gt 0 ] ; then 
     408      echo "IGCM_sys_MkdirArchive : erreur." 
     409      IGCM_debug_Exit "IGCM_sys_MkdirArchive" 
     410    fi 
     411  fi 
     412  IGCM_debug_PopStack "IGCM_sys_MkdirArchive" 
    309413} 
    310414 
     
    315419#D- 
    316420function IGCM_sys_MkdirWork { 
    317     IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@ 
    318     if ( $DEBUG_sys ) ; then 
    319         echo "IGCM_sys_MkdirWork :" $@ 
    320     fi 
    321     #- creation de repertoire sur le serveur fichier 
    322     if [ ! -d ${1} ]; then  
    323         \mkdir -p $1 
    324         if [ $? -gt 0 ] ; then 
    325             echo "IGCM_sys_MkdirWork : erreur." 
    326             IGCM_debug_Exit "IGCM_sys_MkdirWork" 
    327         fi 
    328     fi 
    329     IGCM_debug_PopStack "IGCM_sys_MkdirWork" 
     421  IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@ 
     422  if ( $DEBUG_sys ) ; then 
     423    echo "IGCM_sys_MkdirWork :" $@ 
     424  fi 
     425  #- creation de repertoire sur le serveur fichier 
     426  if [ ! -d ${1} ]; then 
     427    \mkdir -p $1 
     428    if [ $? -gt 0 ] ; then 
     429      echo "IGCM_sys_MkdirWork : erreur." 
     430      IGCM_debug_Exit "IGCM_sys_MkdirWork" 
     431    fi 
     432  fi 
     433  IGCM_debug_PopStack "IGCM_sys_MkdirWork" 
    330434} 
    331435 
     
    336440#D- 
    337441function IGCM_sys_Cd { 
    338     IGCM_debug_PushStack "IGCM_sys_Cd" $@ 
    339     if ( $DEBUG_sys ) ; then 
    340         echo "IGCM_sys_Cd :" $@ 
    341     fi 
    342     \cd $1 
    343     if [ $? -gt 0 ] ; then 
    344         echo "IGCM_sys_Cd : erreur." 
    345         IGCM_debug_Exit "IGCM_sys_Cd" 
    346     fi 
    347     IGCM_debug_PopStack "IGCM_sys_Cd" 
     442  IGCM_debug_PushStack "IGCM_sys_Cd" $@ 
     443  if ( $DEBUG_sys ) ; then 
     444    echo "IGCM_sys_Cd :" $@ 
     445  fi 
     446  \cd $1 
     447  if [ $? -gt 0 ] ; then 
     448    echo "IGCM_sys_Cd : erreur." 
     449    IGCM_debug_Exit "IGCM_sys_Cd" 
     450  fi 
     451  IGCM_debug_PopStack "IGCM_sys_Cd" 
    348452} 
    349453 
     
    354458#D- 
    355459function IGCM_sys_Chmod { 
    356     IGCM_debug_PushStack "IGCM_sys_Chmod" -- $@ 
    357     if ( $DEBUG_sys ) ; then 
    358         echo "IGCM_sys_Chmod :" $@ 
    359     fi 
    360     if [ $DRYRUN -le 1 ]; then 
    361         \chmod $@ 
    362         if [ $? -gt 0 ] ; then 
    363             echo "IGCM_sys_Chmod : erreur." 
    364             IGCM_debug_Exit "IGCM_sys_Chmod" 
    365         fi 
    366     else 
    367         ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 
    368     fi 
    369     IGCM_debug_PopStack "IGCM_sys_Chmod" 
     460  IGCM_debug_PushStack "IGCM_sys_Chmod" -- $@ 
     461  if ( $DEBUG_sys ) ; then 
     462    echo "IGCM_sys_Chmod :" $@ 
     463  fi 
     464  if [ $DRYRUN -le 1 ]; then 
     465    \chmod $@ 
     466    if [ $? -gt 0 ] ; then 
     467      echo "IGCM_sys_Chmod : erreur." 
     468      IGCM_debug_Exit "IGCM_sys_Chmod" 
     469    fi 
     470  else 
     471    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 
     472  fi 
     473  IGCM_debug_PopStack "IGCM_sys_Chmod" 
    370474} 
    371475 
     
    376480#D- 
    377481function IGCM_sys_FileSize { 
    378     IGCM_debug_PushStack "IGCM_sys_FileSize" $@ 
    379  
    380     typeset sizeF 
    381     set +A sizeF -- $( ls -la ${1} ) 
    382     if [ $? -gt 0 ] ; then 
    383         IGCM_debug_Exit "IGCM_sys_FileSize" 
    384     fi 
    385     eval ${2}=${sizeF[4]} 
    386  
    387     IGCM_debug_PopStack "IGCM_sys_FileSize" 
     482  IGCM_debug_PushStack "IGCM_sys_FileSize" $@ 
     483 
     484  typeset sizeF 
     485  set +A sizeF -- $( ls -la ${1} ) 
     486  if [ $? -gt 0 ] ; then 
     487    IGCM_debug_Exit "IGCM_sys_FileSize" 
     488  fi 
     489  eval ${2}=${sizeF[4]} 
     490 
     491  IGCM_debug_PopStack "IGCM_sys_FileSize" 
    388492} 
    389493 
     
    394498#D- 
    395499function IGCM_sys_TestDir { 
    396     IGCM_debug_PushStack "IGCM_sys_TestDir" $@ 
    397     if ( $DEBUG_sys ) ; then 
    398         echo "IGCM_sys_TestDir :" $@ 
    399     fi 
    400     typeset ExistFlag 
    401     ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 ) 
    402     IGCM_debug_PopStack "IGCM_sys_TestDir" 
    403  
    404     return ${ExistFlag} 
     500  IGCM_debug_PushStack "IGCM_sys_TestDir" $@ 
     501  if ( $DEBUG_sys ) ; then 
     502    echo "IGCM_sys_TestDir :" $@ 
     503  fi 
     504  typeset ExistFlag 
     505  ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 ) 
     506  IGCM_debug_PopStack "IGCM_sys_TestDir" 
     507 
     508  return ${ExistFlag} 
    405509} 
    406510 
     
    411515#D- 
    412516function IGCM_sys_TestDirArchive { 
    413     IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@ 
    414     if ( $DEBUG_sys ) ; then 
    415         echo "IGCM_sys_TestDirArchive :" $@ 
    416     fi 
    417     typeset ExistFlag 
    418     ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 ) 
    419     IGCM_debug_PopStack "IGCM_sys_TestDirArchive" 
    420  
    421     return ${ExistFlag} 
     517  IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@ 
     518  if ( $DEBUG_sys ) ; then 
     519    echo "IGCM_sys_TestDirArchive :" $@ 
     520  fi 
     521  typeset ExistFlag 
     522  ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 ) 
     523  IGCM_debug_PopStack "IGCM_sys_TestDirArchive" 
     524 
     525  return ${ExistFlag} 
     526} 
     527 
     528#D-#================================================== 
     529#D-function IGCM_sys_IsFileArchived 
     530#D-* Purpose: Test file that must NOT EXISTS on Archive 
     531#D-* Examples: 
     532#D- 
     533function IGCM_sys_IsFileArchived { 
     534  IGCM_debug_PushStack "IGCM_sys_IsFileArchived" $@ 
     535  if ( $DEBUG_sys ) ; then 
     536    echo "IGCM_sys_IsFileArchived :" $@ 
     537  fi 
     538  typeset IsArchivedFlag 
     539  IsArchivedFlag=$( [ X$( echo $1 | grep ^\/ccc\/store ) != X ] && echo 0 || echo 1 ) 
     540  IGCM_debug_PopStack "IGCM_sys_IsFileArchived" 
     541 
     542  return ${IsArchivedFlag} 
    422543} 
    423544 
     
    428549#D- 
    429550function IGCM_sys_TestFileArchive { 
    430     IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@ 
    431     typeset ExistFlag 
    432     ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 ) 
    433     IGCM_debug_PopStack "IGCM_sys_TestFileArchive" 
    434  
    435     return ${ExistFlag} 
     551  IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@ 
     552  if ( $DEBUG_sys ) ; then 
     553    echo "IGCM_sys_TestFileArchive :" $@ 
     554  fi 
     555  typeset ExistFlag 
     556  ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 ) 
     557  IGCM_debug_PopStack "IGCM_sys_TestFileArchive" 
     558 
     559  return ${ExistFlag} 
     560} 
     561 
     562#D-#================================================== 
     563#D-function IGCM_sys_TestFileBuffer 
     564#D-* Purpose: Test file that must NOT EXISTS on Buffer 
     565#D-* Examples: 
     566#D- 
     567function IGCM_sys_TestFileBuffer { 
     568  IGCM_debug_PushStack "IGCM_sys_TestFileBuffer" $@ 
     569  typeset ExistFlag 
     570  ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 ) 
     571  IGCM_debug_PopStack "IGCM_sys_TestFileBuffer" 
     572 
     573  return ${ExistFlag} 
    436574} 
    437575 
     
    442580#D- 
    443581function IGCM_sys_CountFileArchive { 
    444     IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@ 
    445     ls ${@} 2>/dev/null | wc -l 
    446     if [ $? -gt 0 ] ; then 
    447         echo "IGCM_sys_CountFileArchive : erreur." 
    448     fi 
    449     IGCM_debug_PopStack "IGCM_sys_CountFileArchive" 
     582  IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@ 
     583  ls ${@} 2>/dev/null | wc -l 
     584  if [ $? -gt 0 ] ; then 
     585    echo "IGCM_sys_CountFileArchive : erreur." 
     586  fi 
     587  IGCM_debug_PopStack "IGCM_sys_CountFileArchive" 
     588} 
     589 
     590#D-#================================================== 
     591#D-function IGCM_sys_CountFileBuffer 
     592#D-* Purpose: Count files on Scratch filesystem 
     593#D-* Examples: 
     594#D- 
     595function IGCM_sys_CountFileBuffer { 
     596  IGCM_debug_PushStack "IGCM_sys_CountFileBuffer" $@ 
     597  ls ${@} 2>/dev/null | wc -l 
     598  if [ $? -gt 0 ] ; then 
     599    echo "IGCM_sys_CountFileBuffer : erreur." 
     600  fi 
     601  IGCM_debug_PopStack "IGCM_sys_CountFileBuffer" 
    450602} 
    451603 
     
    456608#D- 
    457609function IGCM_sys_Tree { 
    458     IGCM_debug_PushStack "IGCM_sys_Tree" $@ 
    459     if ( $DEBUG_sys ) ; then 
    460         echo "IGCM_sys_Tree :" $@ 
    461     fi 
    462  
    463     \ls -lR ${@} 
    464  
    465     IGCM_debug_PopStack "IGCM_sys_Tree" 
     610  IGCM_debug_PushStack "IGCM_sys_Tree" $@ 
     611  if ( $DEBUG_sys ) ; then 
     612    echo "IGCM_sys_Tree :" $@ 
     613  fi 
     614 
     615  \ls -lR ${@} 
     616 
     617  IGCM_debug_PopStack "IGCM_sys_Tree" 
    466618} 
    467619 
    468620#D-#================================================== 
    469621#D-function IGCM_sys_Tar 
    470 #D-* Purpose: master un-tar command 
     622#D-* Purpose: master tar command 
    471623#D-* Examples: 
    472624#D- 
    473625function IGCM_sys_Tar { 
    474     IGCM_debug_PushStack "IGCM_sys_Tar" $@ 
    475     if ( $DEBUG_sys ) ; then 
    476         echo "IGCM_sys_Tar :" $@ 
    477     fi 
    478     \tar xvf $1 
    479     if [ $? -gt 0 ] ; then 
    480         echo "IGCM_sys_Tar : erreur." 
    481         IGCM_debug_Exit "IGCM_sys_Tar" 
    482     fi 
    483     IGCM_debug_PopStack "IGCM_sys_Tar" 
     626  IGCM_debug_PushStack "IGCM_sys_Tar" $@ 
     627  if ( $DEBUG_sys ) ; then 
     628    echo "IGCM_sys_Tar :" $@ 
     629  fi 
     630  \tar cf $@ 
     631  if [ $? -gt 0 ] ; then 
     632    echo "IGCM_sys_Tar : erreur." 
     633    IGCM_debug_Exit "IGCM_sys_Tar" 
     634  fi 
     635  IGCM_debug_PopStack "IGCM_sys_Tar" 
    484636} 
    485637 
     
    490642#D- 
    491643function IGCM_sys_UnTar { 
    492     IGCM_debug_PushStack "IGCM_sys_UnTar" $@ 
    493     if ( $DEBUG_sys ) ; then 
    494         echo "IGCM_sys_UnTar :" $@ 
    495     fi 
    496     \tar xvf $1 
    497     if [ $? -gt 0 ] ; then 
    498         echo "IGCM_sys_UnTar : erreur." 
    499         IGCM_debug_Exit "IGCM_sys_UnTar" 
    500     fi 
    501     IGCM_debug_PopStack "IGCM_sys_UnTar" 
     644  IGCM_debug_PushStack "IGCM_sys_UnTar" $@ 
     645  if ( $DEBUG_sys ) ; then 
     646    echo "IGCM_sys_UnTar :" $@ 
     647  fi 
     648  \tar xvf $1 
     649  if [ $? -gt 0 ] ; then 
     650    echo "IGCM_sys_UnTar : erreur." 
     651    IGCM_debug_Exit "IGCM_sys_UnTar" 
     652  fi 
     653  IGCM_debug_PopStack "IGCM_sys_UnTar" 
    502654} 
    503655 
     
    508660#D- 
    509661function IGCM_sys_Qsub { 
    510     IGCM_debug_PushStack "IGCM_sys_Qsub" $@ 
    511     if ( $DEBUG_sys ) ; then 
    512         echo "IGCM_sys_Qsub :" $@ 
    513     fi 
    514  
    515     if [ ${config_UserChoices_JobName}.${CumulPeriod} = "." ] ; then 
    516         /usr/bin/ccc_msub -o ${Script_Output} -e ${Script_Output} < $1 
    517     else 
    518         /usr/bin/ccc_msub -o ${Script_Output} -e ${Script_Output} -r ${config_UserChoices_JobName}.${CumulPeriod} < $1 
    519     fi 
    520  
    521     if [ $? -gt 0 ] ; then 
    522         echo "IGCM_sys_Qsub : erreur " $@ 
    523         IGCM_debug_Exit "IGCM_sys_Qsub" 
    524     fi 
    525     IGCM_debug_PopStack "IGCM_sys_Qsub" 
     662  IGCM_debug_PushStack "IGCM_sys_Qsub" $@ 
     663  if ( $DEBUG_sys ) ; then 
     664    echo "IGCM_sys_Qsub :" $@ 
     665  fi 
     666  typeset options 
     667  if [ ${config_UserChoices_JobName}.${CumulPeriod} = "." ] ; then 
     668    options=" -o ${Script_Output} -e ${Script_Output}" 
     669  else 
     670    options=" -o ${Script_Output} -e ${Script_Output} -r ${config_UserChoices_JobName}.${CumulPeriod}" 
     671  fi 
     672 
     673  /usr/local/bin/ccc_msub ${options} < $1 
     674  if [ $? -gt 0 ] ; then 
     675    echo "IGCM_sys_Qsub : erreur ${options} $1" 
     676    IGCM_debug_Exit "IGCM_sys_Qsub" 
     677  fi 
     678  IGCM_debug_PopStack "IGCM_sys_Qsub" 
    526679} 
    527680 
     
    532685#D- 
    533686function IGCM_sys_QsubPost { 
    534     IGCM_debug_PushStack "IGCM_sys_QsubPost" $@ 
    535     if ( $DEBUG_sys ) ; then 
    536         echo "IGCM_sys_QsubPost :" $@ 
    537     fi 
    538     /usr/bin/ccc_msub -o ${POST_DIR}/${Script_Post_Output}.out -e ${POST_DIR}/${Script_Post_Output}.out ${libIGCM_POST}/$1.job 
    539     if [ $? -gt 0 ] ; then 
    540         echo "IGCM_sys_QsubPost : erreur " $@ 
    541         IGCM_debug_Exit "IGCM_sys_QsubPost" 
    542     fi 
    543     IGCM_debug_PopStack "IGCM_sys_QsubPost" 
     687  IGCM_debug_PushStack "IGCM_sys_QsubPost" $@ 
     688  if ( $DEBUG_sys ) ; then 
     689    echo "IGCM_sys_QsubPost :" $@ 
     690  fi 
     691  /usr/bin/ccc_msub -o ${POST_DIR}/${Script_Post_Output}.out -e ${POST_DIR}/${Script_Post_Output}.out ${libIGCM_POST}/$1.job 
     692  if [ $? -gt 0 ] ; then 
     693    echo "IGCM_sys_QsubPost : erreur " $@ 
     694    IGCM_debug_Exit "IGCM_sys_QsubPost" 
     695  fi 
     696  IGCM_debug_PopStack "IGCM_sys_QsubPost" 
    544697} 
    545698 
    546699#D-************************* 
    547 #D- File transfer functions  
     700#D- File transfer functions 
    548701#D-************************* 
    549702#D- 
     
    555708#D-  Error values and explanations can depend on your system version. 
    556709function IGCM_sys_Rsync_out { 
    557     RET=$1 
    558     if [ ! $RET ] ; then 
    559         echo "rsync error !" 
    560     fi 
    561  
    562     if [ $MYLANG = "fr" ]; then 
    563         case $RET in 
    564             0)  return ;; 
    565             1)  echo "Erreur de rsync ; RERR_SYNTAX : " 
    566                 echo "Erreur de syntaxe ou d'utilisation." 
    567                 return;; 
    568             2)  echo "Erreur de rsync ; RERR_PROTOCOL : " 
    569                 echo "Incompatibilité de protocole." 
    570                 return;; 
    571             3)  echo "Erreur de rsync ; RERR_FILESELECT 3" 
    572                 echo "Erreurs  lors  de  la  sélection des fichiers d'entrée sortie et" 
    573                 echo "répertoires" 
    574                 return;; 
    575             4)  echo "Erreur de rsync ; RERR_UNSUPPORTED" 
    576                 echo "Action demandée non supportée : une tentative de manipulation de" 
    577                 echo "fichiers  64-bits  sur une plate-forme qui ne les supporte pas a" 
    578                 echo "été faite ; ou une option qui est supportée par le  client  mais" 
    579                 echo "pas par le serveur a été spécifiée." 
    580                 return;; 
    581             10) echo "Erreur de rsync ; RERR_SOCKETIO" 
    582                 echo "Erreur dans le socket d'entrée sortie" 
    583                 return;; 
    584             11) echo "Erreur de rsync ; RERR_FILEIO" 
    585                 echo "Erreur d'entrée sortie fichier" 
    586                 return;; 
    587             12) echo "Erreur de rsync ; RERR_STREAMIO" 
    588                 echo "Erreur dans flux de donnée du protocole rsync" 
    589                 return;; 
    590             13) echo "Erreur de rsync ; RERR_MESSAGEIO" 
    591                 echo "Erreur avec les diagnostics du programme" 
    592                 return;; 
    593             14) echo "Erreur de rsync ; RERR_IPC" 
    594                 echo "Erreur dans le code IPC" 
    595                 return;; 
    596             20) echo "Erreur de rsync ; RERR_SIGNAL" 
    597                 echo "SIGUSR1 ou SIGINT reçu" 
    598                 return;; 
    599             21) echo "Erreur de rsync ; RERR_WAITCHILD" 
    600                 echo "Une erreur retournée par waitpid()" 
    601                 return;; 
    602             22) echo "Erreur de rsync ; RERR_MALLOC" 
    603                 echo "Erreur lors de l'allocation des tampons de mémoire de coeur" 
    604                 return;; 
    605             23) echo "" 
    606                 echo "Erreur fichier inexistant" 
    607                 return;; 
    608             30) echo "Erreur de rsync ; RERR_TIMEOUT" 
    609                 echo "Temps d'attente écoulé dans l'envoi/réception de données" 
    610                 return;; 
    611             *)  echo "Erreur de rsync : code de retour de rsync inconnu :" $RET 
    612                 return;; 
    613         esac 
    614     elif [ $MYLANG = "en" ] ; then 
    615         case $RET in 
    616             0)  return;;                 
    617             1)  echo "rsync error : Syntax or usage error " 
    618                 return;; 
    619             2)  echo "rsync error : Protocol incompatibility " 
    620                 return;; 
    621             3)  echo "rsync error : Errors selecting input/output files, dirs" 
    622                 return;; 
    623             4)  echo "rsync error : Requested action not supported: an attempt" 
    624                 echo "was made to manipulate 64-bit files on a platform that cannot support" 
    625                 echo "them; or an option was specified that is supported by the client and" 
    626                 echo "not by the server." 
    627                 return;; 
    628             5)  echo "rsync error : Error starting client-server protocol" 
    629                 return;; 
    630             10) echo "rsync error : Error in socket I/O " 
    631                 return;; 
    632             11) echo "rsync error : Error in file I/O " 
    633                 return;; 
    634             12) echo "rsync error : Error in rsync protocol data stream " 
    635                 return;; 
    636             13) echo "rsync error : Errors with program diagnostics " 
    637                 return;; 
    638             14) echo "rsync error : Error in IPC code " 
    639                 return;; 
    640             20) echo "rsync error : Received SIGUSR1 or SIGINT " 
    641                 return;; 
    642             21) echo "rsync error : Some error returned by waitpid() " 
    643                 return;; 
    644             22) echo "rsync error : Error allocating core memory buffers " 
    645                 return;; 
    646             23) echo "rsync error : Partial transfer due to error" 
    647                 return;; 
    648             24) echo "rsync error : Partial transfer due to vanished source files" 
    649                 return;; 
    650             30) echo "rsync error : Timeout in data send/receive " 
    651                 return;; 
    652             *)  echo "rsync error : return code of rsync unknown :" $RET 
    653                 return;; 
    654         esac 
    655     else 
    656         echo "unknown language $MYLANG." 
    657         return 
    658     fi 
    659 } 
    660      
     710  RET=$1 
     711  if [ ! $RET ] ; then 
     712    echo "rsync error !" 
     713  fi 
     714 
     715  if [ $MYLANG = "fr" ]; then 
     716    case $RET in 
     717    0)  return ;; 
     718    1)  echo "Erreur de rsync ; RERR_SYNTAX : " 
     719      echo "Erreur de syntaxe ou d'utilisation." 
     720      return;; 
     721    2)  echo "Erreur de rsync ; RERR_PROTOCOL : " 
     722      echo "Incompatibilité de protocole." 
     723      return;; 
     724    3)  echo "Erreur de rsync ; RERR_FILESELECT 3" 
     725      echo "Erreurs  lors  de  la  sélection des fichiers d'entrée sortie et" 
     726      echo "répertoires" 
     727      return;; 
     728    4)  echo "Erreur de rsync ; RERR_UNSUPPORTED" 
     729      echo "Action demandée non supportée : une tentative de manipulation de" 
     730      echo "fichiers  64-bits  sur une plate-forme qui ne les supporte pas a" 
     731      echo "été faite ; ou une option qui est supportée par le  client  mais" 
     732      echo "pas par le serveur a été spécifiée." 
     733      return;; 
     734    10) echo "Erreur de rsync ; RERR_SOCKETIO" 
     735      echo "Erreur dans le socket d'entrée sortie" 
     736      return;; 
     737    11) echo "Erreur de rsync ; RERR_FILEIO" 
     738      echo "Erreur d'entrée sortie fichier" 
     739      return;; 
     740    12) echo "Erreur de rsync ; RERR_STREAMIO" 
     741      echo "Erreur dans flux de donnée du protocole rsync" 
     742      return;; 
     743    13) echo "Erreur de rsync ; RERR_MESSAGEIO" 
     744      echo "Erreur avec les diagnostics du programme" 
     745      return;; 
     746    14) echo "Erreur de rsync ; RERR_IPC" 
     747      echo "Erreur dans le code IPC" 
     748      return;; 
     749    20) echo "Erreur de rsync ; RERR_SIGNAL" 
     750      echo "SIGUSR1 ou SIGINT reçu" 
     751      return;; 
     752    21) echo "Erreur de rsync ; RERR_WAITCHILD" 
     753      echo "Une erreur retournée par waitpid()" 
     754      return;; 
     755    22) echo "Erreur de rsync ; RERR_MALLOC" 
     756      echo "Erreur lors de l'allocation des tampons de mémoire de coeur" 
     757      return;; 
     758    23) echo "" 
     759      echo "Erreur fichier inexistant" 
     760      return;; 
     761    30) echo "Erreur de rsync ; RERR_TIMEOUT" 
     762      echo "Temps d'attente écoulé dans l'envoi/réception de données" 
     763      return;; 
     764    *)  echo "Erreur de rsync : code de retour de rsync inconnu :" $RET 
     765      return;; 
     766    esac 
     767  elif [ $MYLANG = "en" ] ; then 
     768    case $RET in 
     769    0)  return;; 
     770    1)  echo "rsync error : Syntax or usage error " 
     771      return;; 
     772    2)  echo "rsync error : Protocol incompatibility " 
     773      return;; 
     774    3)  echo "rsync error : Errors selecting input/output files, dirs" 
     775      return;; 
     776    4)  echo "rsync error : Requested action not supported: an attempt" 
     777      echo "was made to manipulate 64-bit files on a platform that cannot support" 
     778      echo "them; or an option was specified that is supported by the client and" 
     779      echo "not by the server." 
     780      return;; 
     781    5)  echo "rsync error : Error starting client-server protocol" 
     782      return;; 
     783    10) echo "rsync error : Error in socket I/O " 
     784      return;; 
     785    11) echo "rsync error : Error in file I/O " 
     786      return;; 
     787    12) echo "rsync error : Error in rsync protocol data stream " 
     788      return;; 
     789    13) echo "rsync error : Errors with program diagnostics " 
     790      return;; 
     791    14) echo "rsync error : Error in IPC code " 
     792      return;; 
     793    20) echo "rsync error : Received SIGUSR1 or SIGINT " 
     794      return;; 
     795    21) echo "rsync error : Some error returned by waitpid() " 
     796      return;; 
     797    22) echo "rsync error : Error allocating core memory buffers " 
     798      return;; 
     799    23) echo "rsync error : Partial transfer due to error" 
     800      return;; 
     801    24) echo "rsync error : Partial transfer due to vanished source files" 
     802      return;; 
     803    30) echo "rsync error : Timeout in data send/receive " 
     804      return;; 
     805    *)  echo "rsync error : return code of rsync unknown :" $RET 
     806      return;; 
     807    esac 
     808  else 
     809    echo "unknown language $MYLANG." 
     810    return 
     811  fi 
     812} 
    661813 
    662814#D-#================================================== 
     
    666818#D- 
    667819function IGCM_sys_Mirror_libIGCM { 
    668     IGCM_debug_PushStack "IGCM_sys_Mirror_libIGCM" 
    669     if ( $DEBUG_sys ) ; then 
    670         echo "IGCM_sys_Mirror_libIGCM" 
    671     fi 
    672  
    673     typeset RET DEST 
    674  
    675     mkdir -p ${HOME}/MIRROR/${PATHlibIGCM} 
    676  
    677     echo ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} > out_rsync 2>&1 
    678     ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} >> out_rsync 2>&1 
    679     RET=$? 
    680  
    681     if [ ${RET} -gt 0 ] ; then 
    682         echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on cesium." 
    683         cat out_rsync 
    684     fi 
    685     IGCM_debug_PopStack "IGCM_sys_Mirror_libIGCM" 
     820  IGCM_debug_PushStack "IGCM_sys_Mirror_libIGCM" 
     821  if ( $DEBUG_sys ) ; then 
     822    echo "IGCM_sys_Mirror_libIGCM" 
     823  fi 
     824 
     825  typeset RET DEST 
     826 
     827  mkdir -p ${HOME}/MIRROR/${PATHlibIGCM} 
     828 
     829  echo ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} > out_rsync 2>&1 
     830  ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} >> out_rsync 2>&1 
     831  RET=$? 
     832 
     833  if [ ${RET} -gt 0 ] ; then 
     834    echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on cesium." 
     835    cat out_rsync 
     836  fi 
     837  IGCM_debug_PopStack "IGCM_sys_Mirror_libIGCM" 
    686838} 
    687839 
     
    689841#- Call IGCM_sys_Mirror_libIGCM now ! 
    690842if ( $MirrorlibIGCM ) ; then 
    691     IGCM_sys_Mirror_libIGCM 
     843  IGCM_sys_Mirror_libIGCM 
    692844fi 
    693845 
     
    698850#D- 
    699851function IGCM_sys_Cp { 
    700     IGCM_debug_PushStack "IGCM_sys_Cp" $@ 
    701     if ( $DEBUG_sys ) ; then 
    702         echo "IGCM_sys_Cp :" $@ 
    703     fi 
    704  
    705     typeset RET 
    706  
    707     echo cp $@ > out_rsync 2>&1 
    708     \cp $@ >> out_rsync 2>&1 
    709     RET=$? 
    710  
    711     if [ ${RET} -gt 0 ] ; then 
    712         echo "IGCM_sys_Cp : error." 
    713         cat out_rsync 
    714         IGCM_debug_Exit "IGCM_sys_Cp" 
    715      else 
    716         \rm out_rsync 
    717     fi 
    718     IGCM_debug_PopStack "IGCM_sys_Cp" 
     852  IGCM_debug_PushStack "IGCM_sys_Cp" $@ 
     853  if ( $DEBUG_sys ) ; then 
     854    echo "IGCM_sys_Cp :" $@ 
     855  fi 
     856 
     857  typeset RET 
     858 
     859  echo cp $@ > out_rsync 2>&1 
     860  \cp $@ >> out_rsync 2>&1 
     861  RET=$? 
     862 
     863  if [ ${RET} -gt 0 ] ; then 
     864    echo "IGCM_sys_Cp : error." 
     865    cat out_rsync 
     866    IGCM_debug_Exit "IGCM_sys_Cp" 
     867  else 
     868    \rm out_rsync 
     869  fi 
     870  IGCM_debug_PopStack "IGCM_sys_Cp" 
    719871} 
    720872 
     
    725877#D- 
    726878function IGCM_sys_Rm { 
    727     IGCM_debug_PushStack "IGCM_sys_Rm" -- $@ 
    728     if ( $DEBUG_sys ) ; then 
    729         echo "IGCM_sys_Rm :" $@ 
    730     fi 
    731  
    732     typeset RET 
    733  
    734     echo rm $@ > out_rsync 2>&1 
    735     \rm $@ >> out_rsync 2>&1 
    736     RET=$? 
    737  
    738     if [ ${RET} -gt 0 ] ; then 
    739         echo "IGCM_sys_Rm : error." 
    740         cat out_rsync 
    741         IGCM_debug_Exit "IGCM_sys_Rm" 
    742     else 
    743         \rm out_rsync 
    744     fi 
    745     IGCM_debug_PopStack "IGCM_sys_Rm" 
     879  IGCM_debug_PushStack "IGCM_sys_Rm" -- $@ 
     880  if ( $DEBUG_sys ) ; then 
     881    echo "IGCM_sys_Rm :" $@ 
     882  fi 
     883 
     884  typeset RET 
     885 
     886  echo rm $@ > out_rsync 2>&1 
     887  \rm $@ >> out_rsync 2>&1 
     888  RET=$? 
     889 
     890  if [ ${RET} -gt 0 ] ; then 
     891    echo "IGCM_sys_Rm : error." 
     892    cat out_rsync 
     893    IGCM_debug_Exit "IGCM_sys_Rm" 
     894  else 
     895    \rm out_rsync 
     896  fi 
     897  IGCM_debug_PopStack "IGCM_sys_Rm" 
    746898} 
    747899 
     
    753905#D- 
    754906function IGCM_sys_RmRunDir { 
    755     IGCM_debug_PushStack "IGCM_sys_RmRunDir" -- $@ 
    756     if ( $DEBUG_sys ) ; then 
    757         echo "IGCM_sys_RmRunDir :" $@ 
    758     fi 
    759  
    760     typeset RET 
    761  
    762     echo rm $@ > out_rsync 2>&1 
    763     \rm $@ >> out_rsync 2>&1 
    764     RET=$? 
    765  
    766     if [ ${RET} -gt 0 ] ; then 
    767         echo "IGCM_sys_RmRunDir : error." 
    768         cat out_rsync 
    769         IGCM_debug_Exit "IGCM_sys_RmRunDir" 
    770     else 
    771         \rm out_rsync 
    772     fi 
    773  
    774     IGCM_debug_PopStack "IGCM_sys_RmRunDir" 
     907  IGCM_debug_PushStack "IGCM_sys_RmRunDir" -- $@ 
     908  if ( $DEBUG_sys ) ; then 
     909    echo "IGCM_sys_RmRunDir :" $@ 
     910  fi 
     911 
     912  typeset RET 
     913 
     914  echo rm $@ > out_rsync 2>&1 
     915  \rm $@ >> out_rsync 2>&1 
     916  RET=$? 
     917 
     918  if [ ${RET} -gt 0 ] ; then 
     919    echo "IGCM_sys_RmRunDir : error." 
     920    cat out_rsync 
     921    IGCM_debug_Exit "IGCM_sys_RmRunDir" 
     922  else 
     923    \rm out_rsync 
     924  fi 
     925  IGCM_debug_PopStack "IGCM_sys_RmRunDir" 
    775926} 
    776927 
     
    781932#D- 
    782933function IGCM_sys_Mv { 
    783     IGCM_debug_PushStack "IGCM_sys_Mv" $@ 
    784     if ( $DEBUG_sys ) ; then 
    785         echo "IGCM_sys_Mv :" $@ 
    786     fi 
    787  
    788     if [ $DRYRUN = 0 ]; then 
    789  
    790         typeset RET 
    791              
    792         echo mv $@ > out_rsync 2>&1 
    793         \mv $@ >> out_rsync 2>&1 
    794         RET=$? 
    795      
    796         if [ ${RET} -gt 0 ] ; then 
    797             echo "IGCM_sys_Mv : error in mv." 
    798             cat out_rsync 
    799             IGCM_debug_Exit "IGCM_sys_Mv" 
    800         else 
    801             \rm out_rsync 
    802         fi 
     934  IGCM_debug_PushStack "IGCM_sys_Mv" $@ 
     935  if ( $DEBUG_sys ) ; then 
     936    echo "IGCM_sys_Mv :" $@ 
     937  fi 
     938 
     939  if [ $DRYRUN = 0 ]; then 
     940 
     941    typeset RET 
     942 
     943    echo mv $@ > out_rsync 2>&1 
     944    \mv $@ >> out_rsync 2>&1 
     945    RET=$? 
     946 
     947    if [ ${RET} -gt 0 ] ; then 
     948      echo "IGCM_sys_Mv : error in mv." 
     949      cat out_rsync 
     950      IGCM_debug_Exit "IGCM_sys_Mv" 
    803951    else 
    804         ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 
    805     fi 
    806  
    807     IGCM_debug_PopStack "IGCM_sys_Mv" 
     952      \rm out_rsync 
     953    fi 
     954  else 
     955    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 
     956  fi 
     957 
     958  IGCM_debug_PopStack "IGCM_sys_Mv" 
    808959} 
    809960 
     
    814965#D- 
    815966function IGCM_sys_Put_Dir { 
    816     IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@ 
    817     if ( $DEBUG_sys ) ; then 
    818         echo "IGCM_sys_Put_Dir :" $@ 
    819     fi 
    820     if [ $DRYRUN = 0 ]; then 
    821         if [ ! -d ${1} ] ; then 
    822             echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ." 
    823             IGCM_debug_PopStack "IGCM_sys_Put_Dir" 
    824             return 
    825         fi 
    826  
    827         typeset RET 
    828  
    829         # Only if we use rsync 
    830         #IGCM_sys_TestDirArchive $( dirname $2 ) 
    831         # 
    832         #USUAL WAY 
    833         \cp -r $1 $2 > out_rsync 2>&1 
    834         RET=$? 
    835  
    836         if [ ${RET} -gt 0 ] ; then 
    837             echo "IGCM_sys_Put_Dir : error." 
    838             cat out_rsync 
    839             IGCM_debug_Exit "IGCM_sys_Put_Dir" 
    840         else 
    841             \rm out_rsync 
    842         fi 
     967  IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@ 
     968  if ( $DEBUG_sys ) ; then 
     969    echo "IGCM_sys_Put_Dir :" $@ 
     970  fi 
     971  if [ $DRYRUN = 0 ]; then 
     972    if [ ! -d ${1} ] ; then 
     973      echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ." 
     974      IGCM_debug_PopStack "IGCM_sys_Put_Dir" 
     975      return 
     976    fi 
     977 
     978    typeset RET 
     979 
     980    # Only if we use rsync 
     981    #IGCM_sys_TestDirArchive $( dirname $2 ) 
     982    # 
     983    #USUAL WAY 
     984    \cp -r $1 $2 > out_rsync 2>&1 
     985    RET=$? 
     986 
     987    if [ ${RET} -gt 0 ] ; then 
     988      echo "IGCM_sys_Put_Dir : error." 
     989      cat out_rsync 
     990      IGCM_debug_Exit "IGCM_sys_Put_Dir" 
    843991    else 
    844         ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 
    845     fi 
    846     IGCM_debug_PopStack "IGCM_sys_Put_Dir" 
     992      \rm out_rsync 
     993    fi 
     994  else 
     995    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 
     996  fi 
     997  IGCM_debug_PopStack "IGCM_sys_Put_Dir" 
    847998} 
    848999 
    8491000#D-#================================================== 
    8501001#D-function IGCM_sys_Get_Dir 
    851 #D-* Purpose: Copy a complete directory from $(ARCHIVE) 
     1002#D-* Purpose: Copy a complete directory from ${ARCHIVE} 
    8521003#D-* Examples: 
    8531004#D- 
    8541005function IGCM_sys_Get_Dir { 
    855     IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@ 
    856     if ( $DEBUG_sys ) ; then 
    857         echo "IGCM_sys_Get_Dir :" $@ 
    858     fi 
    859     if [ $DRYRUN = 0 ]; then 
    860 #       if [ ! -d ${1} ] ; then 
    861 #           echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ." 
    862 #           IGCM_debug_PopStack "IGCM_sys_Get_Dir" 
    863 #           return 
    864 #       fi 
    865  
    866         typeset RET 
    867  
    868         # Only if we use rsync 
    869         #IGCM_sys_TestDirArchive $( dirname $2 ) 
    870         # 
    871         #USUAL WAY 
     1006  IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@ 
     1007  if ( $DEBUG_sys ) ; then 
     1008    echo "IGCM_sys_Get_Dir :" $@ 
     1009  fi 
     1010  if [ $DRYRUN = 0 ]; then 
     1011#    if [ ! -d ${1} ] ; then 
     1012#      echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ." 
     1013#      IGCM_debug_PopStack "IGCM_sys_Get_Dir" 
     1014#      return 
     1015#    fi 
     1016 
     1017    typeset RET 
     1018 
     1019        # Only if we use rsync 
     1020        #IGCM_sys_TestDirArchive $( dirname $2 ) 
     1021        # 
     1022        #USUAL WAY 
    8721023        # add get (to demigrate all offline files) to reduce time of this command : 
    873         ccc_hsm get $1/* 
    874         \cp -r $1 $2 > out_rsync 2>&1 
    875         RET=$? 
    876  
    877         if [ ${RET} -gt 0 ] ; then 
    878             echo "IGCM_sys_Get_Dir : error." 
    879             cat out_rsync 
    880             IGCM_debug_Exit "IGCM_sys_Get_Dir" 
    881         else 
    882             \rm out_rsync 
    883         fi 
     1024    ccc_hsm get $1/* 
     1025    \cp -r $1 $2 > out_rsync 2>&1 
     1026    RET=$? 
     1027 
     1028    if [ ${RET} -gt 0 ] ; then 
     1029      echo "IGCM_sys_Get_Dir : error." 
     1030      cat out_rsync 
     1031      IGCM_debug_Exit "IGCM_sys_Get_Dir" 
    8841032    else 
    885         ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 
    886     fi 
    887     IGCM_debug_PopStack "IGCM_sys_Get_Dir" 
     1033      \rm out_rsync 
     1034    fi 
     1035  else 
     1036    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 
     1037  fi 
     1038  IGCM_debug_PopStack "IGCM_sys_Get_Dir" 
    8881039} 
    8891040 
     
    8941045#D- 
    8951046function IGCM_sys_Get_Master { 
    896     IGCM_debug_PushStack "IGCM_sys_Get_Master" $@ 
    897     if ( $DEBUG_sys ) ; then 
    898         echo "IGCM_sys_Get_Master :" $@ 
    899     fi 
    900     if [ $DRYRUN = 0 ]; then 
    901         if [ ! -d ${1} ] ; then 
    902             echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ." 
    903             IGCM_debug_PopStack "IGCM_sys_Get_Master" 
    904             return 
    905         fi 
    906  
    907         typeset RET 
    908  
    909         #USUAL WAY 
    910         \cp -r $1 $2 > out_rsync 2>&1 
    911         RET=$? 
    912  
    913         if [ ${RET} -gt 0 ] ; then 
    914             echo "IGCM_sys_Get_Master : error." 
    915             cat out_rsync 
    916             IGCM_debug_Exit "IGCM_sys_Get_Master" 
    917         fi 
     1047  IGCM_debug_PushStack "IGCM_sys_Get_Master" $@ 
     1048  if ( $DEBUG_sys ) ; then 
     1049    echo "IGCM_sys_Get_Master :" $@ 
     1050  fi 
     1051  if [ $DRYRUN = 0 ]; then 
     1052    if [ ! -d ${1} ] ; then 
     1053      echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ." 
     1054      IGCM_debug_PopStack "IGCM_sys_Get_Master" 
     1055      return 
     1056    fi 
     1057 
     1058    typeset RET 
     1059 
     1060    #USUAL WAY 
     1061    \cp -r $1 $2 > out_rsync 2>&1 
     1062    RET=$? 
     1063 
     1064    if [ ${RET} -gt 0 ] ; then 
     1065      echo "IGCM_sys_Get_Master : error." 
     1066      cat out_rsync 
     1067      IGCM_debug_Exit "IGCM_sys_Get_Master" 
    9181068    else 
    919         ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 
    920     fi 
    921     IGCM_debug_PopStack "IGCM_sys_Get_Master" 
     1069      \rm out_rsync 
     1070    fi 
     1071  else 
     1072    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 
     1073  fi 
     1074  IGCM_debug_PopStack "IGCM_sys_Get_Master" 
    9221075} 
    9231076 
    9241077#D-#================================================== 
    9251078#D-function IGCM_sys_Put_Rest 
    926 #D-* Purpose: Put computied restarts on $(ARCHIVE). 
     1079#D-* Purpose: Put computied restarts on ${ARCHIVE}. 
    9271080#D-           File and target directory must exist. 
    9281081#D-* Examples: 
    9291082#D- 
    9301083function IGCM_sys_Put_Rest { 
    931     IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@ 
    932     if ( $DEBUG_sys ) ; then 
    933         echo "IGCM_sys_Put_Rest :" $@ 
    934     fi 
    935     if [ $DRYRUN = 0 ]; then 
    936         if [ ! -f ${1} ] ; then 
    937             echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ." 
    938             IGCM_debug_Exit "IGCM_sys_Put_Rest" 
    939         fi 
    940  
    941         typeset RET 
    942         # 
    943         if [ X${JobType} = XRUN ] ; then 
    944             IGCM_sys_Chmod 444 ${1} 
    945         fi 
    946         # 
    947         IGCM_sys_TestDirArchive $( dirname $2 ) 
    948         # 
    949         # USUAL WAY 
    950         \cp $1 $2 > out_rsync 2>&1 
    951         RET=$? 
    952  
    953 #       #RSYNC WITH NETWORK SSH CALL 
    954 #       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1 
    955 #       ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1 
    956  
    957 #       #RSYNC WITH NFS USE 
    958 #       echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 
    959 #       ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 
    960  
    961 #       RET=$? 
    962 #       IGCM_sys_Rsync_out $RET 
    963  
    964 #       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
    965 #       (( RET=RET+$? )) 
    966  
    967         if [ ${RET} -gt 0 ] ; then 
    968             echo "IGCM_sys_Put_Rest : error." 
    969             cat out_rsync 
    970             IGCM_debug_Exit "IGCM_sys_Put_Rest" 
    971         else 
    972             \rm out_rsync 
    973         fi 
     1084  IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@ 
     1085  if ( $DEBUG_sys ) ; then 
     1086    echo "IGCM_sys_Put_Rest :" $@ 
     1087  fi 
     1088  if [ $DRYRUN = 0 ]; then 
     1089    if [ ! -f ${1} ] ; then 
     1090      echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ." 
     1091      IGCM_debug_Exit "IGCM_sys_Put_Rest" 
     1092    fi 
     1093 
     1094    typeset RET 
     1095    # 
     1096    if [ X${JobType} = XRUN ] ; then 
     1097      IGCM_sys_Chmod 444 ${1} 
     1098    fi 
     1099 
     1100    # 
     1101    # USUAL WAY 
     1102    \cp $1 $2 > out_rsync 2>&1 
     1103    RET=$? 
     1104 
     1105#       #RSYNC WITH NETWORK SSH CALL 
     1106#       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 
     1107#       ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 
     1108 
     1109#       #RSYNC WITH NFS USE 
     1110#       echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 
     1111#       ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 
     1112 
     1113#       RET=$? 
     1114#       IGCM_sys_Rsync_out $RET 
     1115 
     1116#       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
     1117#       (( RET=RET+$? )) 
     1118 
     1119    if [ ${RET} -gt 0 ] ; then 
     1120      echo "IGCM_sys_Put_Rest : error." 
     1121      cat out_rsync 
     1122      IGCM_debug_Exit "IGCM_sys_Put_Rest" 
    9741123    else 
    975         ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 
    976     fi 
    977     IGCM_debug_PopStack "IGCM_sys_Put_Rest" 
     1124      \rm out_rsync 
     1125    fi 
     1126  else 
     1127    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 
     1128  fi 
     1129  IGCM_debug_PopStack "IGCM_sys_Put_Rest" 
     1130} 
     1131 
     1132#D-#================================================== 
     1133#D-function IGCM_sys_PutBuffer_Rest 
     1134#D-* Purpose: Put computied restarts on ${SCRATCHDIR}. 
     1135#D-           File and target directory must exist. 
     1136#D-* Examples: 
     1137#D- 
     1138function IGCM_sys_PutBuffer_Rest { 
     1139  IGCM_debug_PushStack "IGCM_sys_PutBuffer_Rest" $@ 
     1140  if ( $DEBUG_sys ) ; then 
     1141    echo "IGCM_sys_PutBuffer_Rest :" $@ 
     1142  fi 
     1143  if [ $DRYRUN = 0 ]; then 
     1144    if [ ! -f ${1} ] ; then 
     1145      echo "ERROR : IGCM_sys_PutBuffer_Rest ${1} DOES NOT EXIST ." 
     1146      IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" 
     1147    fi 
     1148 
     1149    typeset RET 
     1150    # 
     1151    if [ X${JobType} = XRUN ] ; then 
     1152      IGCM_sys_Chmod 444 ${1} 
     1153    fi 
     1154 
     1155    # 
     1156    # USUAL WAY 
     1157    \cp $1 $2 > out_rsync 2>&1 
     1158    RET=$? 
     1159 
     1160    if [ ${RET} -gt 0 ] ; then 
     1161      echo "IGCM_sys_PutBuffer_Rest : error." 
     1162      cat out_rsync 
     1163      IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" 
     1164    else 
     1165      \rm out_rsync 
     1166    fi 
     1167  else 
     1168    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 
     1169  fi 
     1170  IGCM_debug_PopStack "IGCM_sys_PutBuffer_Rest" 
    9781171} 
    9791172 
    9801173#D-#================================================== 
    9811174#D-function IGCM_sys_Put_Out 
    982 #D-* Purpose: Copy a file on $(ARCHIVE) after have chmod it in readonly 
     1175#D-* Purpose: Copy a file on ${ARCHIVE} after having chmod it in readonly 
    9831176#D-* Examples: 
    9841177#D- 
    9851178function IGCM_sys_Put_Out { 
    986     IGCM_debug_PushStack "IGCM_sys_Put_Out" $@ 
    987     if ( $DEBUG_sys ) ; then 
    988         echo "IGCM_sys_Put_Out :" $@ 
    989     fi 
    990     if [ $DRYRUN = 0 ]; then 
    991         if [ ! -f ${1} ] ; then 
    992             echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ." 
    993             IGCM_debug_PopStack "IGCM_sys_Put_Out" 
    994             return 1 
    995         fi 
    996         # 
    997         IGCM_sys_MkdirArchive $( dirname $2 ) 
    998         # 
    999         typeset RET 
    1000  
    1001         #===================================================== 
    1002         #         COMMENT OUT DOUBLE COPY ON SCRATCHDIR 
    1003         #===================================================== 
    1004  
    1005         #echo ${2} | grep "${R_OUT}" > /dev/null 2>&1 
    1006         #if [ $? -eq 0 ] ; then 
    1007         #    typeset WORKPATH FILEPATH 
    1008         #    WORKPATH=$( dirname $2 | sed -e "s|${R_OUT}|${R_OUT_SCR}|" ) 
    1009         #    IGCM_sys_MkdirWork ${WORKPATH}  
    1010         #    FILEPATH=${WORKPATH}/$( basename $2 ) 
    1011         #    # 
    1012         #    IGCM_sys_Cp ${1} ${FILEPATH} 
    1013         #fi 
    1014  
    1015         if [ X${JobType} = XRUN ] ; then 
    1016             if [ X${3} = X ] ; then 
    1017                 IGCM_sys_Chmod 444 ${1} 
    1018             fi 
    1019         fi 
    1020         # 
    1021         # USUAL WAY 
    1022         \cp $1 $2 > out_rsync 2>&1 
    1023         RET=$? 
    1024  
    1025 #       #RSYNC WITH NETWORK SSH CALL 
    1026 #       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1 
    1027 #       ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1 
    1028  
    1029 #       #RSYNC WITH NFS USE 
    1030 #       echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 
    1031 #       ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 
    1032  
    1033 #       RET=$? 
    1034 #       IGCM_sys_Rsync_out $RET 
    1035  
    1036 #       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
    1037 #       (( RET=RET+$? )) 
    1038  
    1039         if [ ${RET} -gt 0 ] ; then 
    1040             echo "IGCM_sys_Put_Out : error." 
    1041             cat out_rsync 
    1042             IGCM_debug_Exit "IGCM_sys_Put_Out" 
    1043         else 
    1044             \rm out_rsync 
    1045         fi 
     1179  IGCM_debug_PushStack "IGCM_sys_Put_Out" $@ 
     1180  if ( $DEBUG_sys ) ; then 
     1181    echo "IGCM_sys_Put_Out :" $@ 
     1182  fi 
     1183  if [ $DRYRUN = 0 ]; then 
     1184    if [ ! -f ${1} ] ; then 
     1185      echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ." 
     1186      IGCM_debug_PopStack "IGCM_sys_Put_Out" 
     1187      return 1 
     1188    fi 
     1189    # 
     1190    IGCM_sys_MkdirArchive $( dirname $2 ) 
     1191    # 
     1192    typeset RET 
     1193 
     1194    #===================================================== 
     1195    #         COMMENT OUT DOUBLE COPY ON SCRATCHDIR 
     1196    #===================================================== 
     1197 
     1198    #echo ${2} | grep "${R_OUT}" > /dev/null 2>&1 
     1199    #if [ $? -eq 0 ] ; then 
     1200    #    typeset WORKPATH FILEPATH 
     1201    #    WORKPATH=$( dirname $2 | sed -e "s|${R_OUT}|${R_BUF}|" ) 
     1202    #    IGCM_sys_MkdirWork ${WORKPATH} 
     1203    #    FILEPATH=${WORKPATH}/$( basename $2 ) 
     1204    #    # 
     1205    #    IGCM_sys_Cp ${1} ${FILEPATH} 
     1206    #fi 
     1207 
     1208    if [ X${JobType} = XRUN ] ; then 
     1209      if [ X${3} = X ] ; then 
     1210        IGCM_sys_Chmod 444 ${1} 
     1211      fi 
     1212    fi 
     1213    # 
     1214    # USUAL WAY 
     1215    \cp $1 $2 > out_rsync 2>&1 
     1216    RET=$? 
     1217 
     1218#       #RSYNC WITH NETWORK SSH CALL 
     1219#       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 
     1220#       ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 
     1221 
     1222#       #RSYNC WITH NFS USE 
     1223#       echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 
     1224#       ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 
     1225 
     1226#       RET=$? 
     1227#       IGCM_sys_Rsync_out $RET 
     1228 
     1229#       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
     1230#       (( RET=RET+$? )) 
     1231 
     1232    if [ ${RET} -gt 0 ] ; then 
     1233      echo "IGCM_sys_Put_Out : error." 
     1234      cat out_rsync 
     1235      IGCM_debug_Exit "IGCM_sys_Put_Out" 
    10461236    else 
    1047         ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 
    1048     fi 
    1049     IGCM_debug_PopStack "IGCM_sys_Put_Out" 
    1050     return 0 
     1237      \rm out_rsync 
     1238    fi 
     1239  else 
     1240    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 
     1241  fi 
     1242  IGCM_debug_PopStack "IGCM_sys_Put_Out" 
     1243  return 0 
     1244} 
     1245 
     1246#D-#================================================== 
     1247#D-function IGCM_sys_PutBuffer_Out 
     1248#D-* Purpose: Copy a file on ${SCRATCHDIR} after having chmod it in readonly 
     1249#D-* Examples: 
     1250#D- 
     1251function IGCM_sys_PutBuffer_Out { 
     1252  IGCM_debug_PushStack "IGCM_sys_PutBuffer_Out" $@ 
     1253  if ( $DEBUG_sys ) ; then 
     1254    echo "IGCM_sys_PutBuffer_Out :" $@ 
     1255  fi 
     1256  if [ $DRYRUN = 0 ]; then 
     1257    if [ ! -f ${1} ] ; then 
     1258      echo "WARNING : IGCM_sys_PutBuffer_Out ${1} DOES NOT EXIST ." 
     1259      IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out" 
     1260      return 1 
     1261    fi 
     1262    # 
     1263    IGCM_sys_Mkdir $( dirname $2 ) 
     1264    # 
     1265    typeset RET 
     1266 
     1267    if [ X${JobType} = XRUN ] ; then 
     1268      if [ X${3} = X ] ; then 
     1269        IGCM_sys_Chmod 444 ${1} 
     1270      fi 
     1271    fi 
     1272    # 
     1273    # USUAL WAY 
     1274    \cp $1 $2 > out_rsync 2>&1 
     1275    RET=$? 
     1276 
     1277    if [ ${RET} -gt 0 ] ; then 
     1278      echo "IGCM_sys_PutBuffer_Out : error." 
     1279      cat out_rsync 
     1280      IGCM_debug_Exit "IGCM_sys_PutBuffer_Out" 
     1281    else 
     1282      \rm out_rsync 
     1283    fi 
     1284  else 
     1285    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 
     1286  fi 
     1287  IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out" 
     1288  return 0 
    10511289} 
    10521290 
     
    10571295#D-            IGCM_sys_Get /l Array_contain_myfiles /destpath/ 
    10581296function IGCM_sys_Get { 
    1059     IGCM_debug_PushStack "IGCM_sys_Get" $@ 
    1060  
    1061     typeset DEST RET dm_liste ifile target file_work  
    1062  
    1063     if ( $DEBUG_sys ) ; then 
    1064         echo "IGCM_sys_Get :" $@ 
    1065     fi 
    1066     if [ $DRYRUN -le 2 ]; then 
    1067         if [ X${1} = X'/l' ] ; then 
    1068             # test if the first file is present in the old computation : 
    1069             eval set +A dm_liste \${${2}} 
    1070         else 
    1071             eval set +A dm_liste ${1} 
    1072         fi 
    1073         eval DEST=\${${#}} 
    1074  
    1075         #===================================================== 
    1076         #         COMMENT OUT DOUBLE COPY ON SCRATCHDIR 
    1077         #===================================================== 
    1078  
    1079         # Is it an R_OUT file (not R_IN) ? 
    1080         #echo ${dm_liste[0]} | grep "${R_OUT}" > /dev/null 2>&1 
    1081         #if [ $? -eq 0 ] ; then 
    1082         #    # Yes  ? then we try to get it in SCRATCHDIR 
    1083         #    set +A file_work $( echo ${dm_liste[*]} | sed -e "s|${R_OUT}|${R_OUT_SCR}|g" ) 
    1084         #    if [ -f ${file_work[0]} ] ; then 
    1085         #       IGCM_sys_Cp ${file_work[*]} ${DEST} 
    1086         #       IGCM_debug_PopStack "IGCM_sys_Get" 
    1087         #       return 
    1088         #    fi 
    1089         #fi 
    1090  
    1091         # test if the (first) file is present in the old computation : 
    1092         IGCM_sys_TestFileArchive ${dm_liste[0]} 
    1093         RET=$? 
    1094         if [ ${RET} -gt 0 ] ; then 
    1095             echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ." 
    1096             IGCM_debug_Exit "IGCM_sys_Get" 
    1097         fi 
    1098  
    1099         ccc_hsm get ${dm_liste[*]} > out_rsync 2>&1 
    1100         RET=$? 
    1101  
    1102         if [ ${RET} -gt 0 ] ; then 
    1103             echo "WARNING IGCM_sys_Get : demigration error." 
    1104             cat out_rsync 
    1105             echo "WARNING IGCM_sys_Get : will stop later if the cp fails." 
    1106         fi 
    1107  
    1108         #if [ ${RET} -gt 0 ] ; then 
    1109         #    if [ ! "X$( grep "Lost dmusrcmd connection" out_rsync )" = "X" ] ; then 
    1110         #       cat out_rsync 
    1111         #       echo "WARNING IGCM_sys_Get : Lost dmusrcmd connection : " 
    1112         #       sleep 30 
    1113         #       echo "We try another time" 
    1114         #       dmget ${dm_liste[*]} > out_rsync 2>&1 
    1115         #       RET=$? 
    1116         #       if [ ${RET} -gt 0 ] ; then 
    1117         #           echo "ERROR IGCM_sys_Get : again demigration error :" 
    1118         #           cat out_rsync 
    1119         #           IGCM_debug_Exit "IGCM_sys_Get" 
    1120         #       fi 
    1121         #    else 
    1122         #       echo "ERROR IGCM_sys_Get : demigration error :" 
    1123         #       cat out_rsync 
    1124         #       IGCM_debug_Exit "IGCM_sys_Get" 
    1125         #    fi 
    1126         #fi 
    1127  
    1128         #USUAL WAY 
    1129         if [ X${1} = X'/l' ] ; then 
    1130             (( RET=0 )) 
    1131             for target in ${dm_liste[*]} ; do 
    1132                 local_file=$( basename ${target} ) 
    1133                 \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 
    1134                 (( RET = RET + $? )) 
    1135             done 
    1136         else 
    1137             \cp ${dm_liste} ${DEST} >> out_rsync 2>&1 
    1138             RET=$? 
    1139         fi 
    1140  
    1141 #       #RSYNC WITH NETWORK SSH CALL 
    1142 #       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1 
    1143 #       ${RSYNC} ${RSYNC_opt} -e ssh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1 
    1144  
    1145 #       #RSYNC WITH NFS USE 
    1146 #       echo ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1 
    1147 #       ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> out_rsync 2>&1 
    1148  
    1149 #       RET=$? 
    1150 #       IGCM_sys_Rsync_out $RET 
    1151  
    1152 #       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
    1153 #       (( RET=RET+$? )) 
    1154  
    1155         if [ ${RET} -gt 0 ] ; then 
    1156             echo "IGCM_sys_Get : copy error." 
    1157             cat out_rsync 
    1158             IGCM_debug_Exit "IGCM_sys_Get" 
    1159         else 
    1160             \rm out_rsync 
    1161         fi 
     1297  IGCM_debug_PushStack "IGCM_sys_Get" $@ 
     1298 
     1299  typeset DEST RET dm_liste ifile target file_work 
     1300 
     1301  if ( $DEBUG_sys ) ; then 
     1302    echo "IGCM_sys_Get :" $@ 
     1303  fi 
     1304  if [ $DRYRUN -le 2 ]; then 
     1305    if [ X${1} = X'/l' ] ; then 
     1306      # test if the first file is present in the old computation : 
     1307      eval set +A dm_liste \${${2}} 
    11621308    else 
    1163         ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 
    1164     fi 
    1165     IGCM_debug_PopStack "IGCM_sys_Get" 
    1166 } 
    1167  
    1168 ############################################################## A FINIR !! 
     1309      eval set +A dm_liste ${1} 
     1310    fi 
     1311    eval DEST=\${${#}} 
     1312 
     1313    #===================================================== 
     1314    #         COMMENT OUT DOUBLE COPY ON SCRATCHDIR 
     1315    #===================================================== 
     1316 
     1317    # Is it an R_OUT file (not R_IN) ? 
     1318    #echo ${dm_liste[0]} | grep "${R_OUT}" > /dev/null 2>&1 
     1319    #if [ $? -eq 0 ] ; then 
     1320    #    # Yes  ? then we try to get it in SCRATCHDIR 
     1321    #    set +A file_work $( echo ${dm_liste[*]} | sed -e "s|${R_OUT}|${R_BUF}|g" ) 
     1322    #    if [ -f ${file_work[0]} ] ; then 
     1323    #   IGCM_sys_Cp ${file_work[*]} ${DEST} 
     1324    #   IGCM_debug_PopStack "IGCM_sys_Get" 
     1325    #   return 
     1326    #    fi 
     1327    #fi 
     1328 
     1329    # test if the (first) file is present in the old computation : 
     1330    IGCM_sys_TestFileArchive ${dm_liste[0]} 
     1331    RET=$? 
     1332    if [ ${RET} -gt 0 ] ; then 
     1333      echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ." 
     1334      IGCM_debug_Exit "IGCM_sys_Get" 
     1335    fi 
     1336 
     1337    ccc_hsm get ${dm_liste[*]} > out_rsync 2>&1 
     1338    RET=$? 
     1339    if [ ${RET} -gt 0 ] ; then 
     1340      echo "WARNING IGCM_sys_Get : demigration error." 
     1341      cat out_rsync 
     1342      echo "WARNING IGCM_sys_Get : will stop later if the cp fails." 
     1343    fi 
     1344 
     1345    #if [ ${RET} -gt 0 ] ; then 
     1346    #    if [ ! "X$( grep "Lost dmusrcmd connection" out_rsync )" = "X" ] ; then 
     1347    #   cat out_rsync 
     1348    #   echo "WARNING IGCM_sys_Get : Lost dmusrcmd connection : " 
     1349    #   sleep 30 
     1350    #   echo "We try another time" 
     1351    ##  dmget ${dm_liste[*]} > out_rsync 2>&1 
     1352    #   ccc_hsm get ${dm_liste[*]} > out_rsync 2>&1 
     1353    #   RET=$? 
     1354    #   if [ ${RET} -gt 0 ] ; then 
     1355    #       echo "ERROR IGCM_sys_Get : again demigration error :" 
     1356    #       cat out_rsync 
     1357    #       IGCM_debug_Exit "IGCM_sys_Get" 
     1358    #   fi 
     1359    #    else 
     1360    #   echo "ERROR IGCM_sys_Get : demigration error :" 
     1361    #   cat out_rsync 
     1362    #   IGCM_debug_Exit "IGCM_sys_Get" 
     1363    #    fi 
     1364    #fi 
     1365 
     1366    #USUAL WAY 
     1367    if [ X${1} = X'/l' ] ; then 
     1368      (( RET=0 )) 
     1369      for target in ${dm_liste[*]} ; do 
     1370        local_file=$( basename ${target} ) 
     1371        \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 
     1372        (( RET = RET + $? )) 
     1373      done 
     1374    else 
     1375      \cp ${dm_liste} ${DEST} >> out_rsync 2>&1 
     1376      RET=$? 
     1377    fi 
     1378 
     1379#       #RSYNC WITH NETWORK SSH CALL 
     1380#       echo ${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1 
     1381#       ${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1 
     1382 
     1383#       #RSYNC WITH NFS USE 
     1384#       echo ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1 
     1385#       ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> out_rsync 2>&1 
     1386 
     1387#       RET=$? 
     1388#       IGCM_sys_Rsync_out $RET 
     1389 
     1390#       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
     1391#       (( RET=RET+$? )) 
     1392 
     1393    if [ ${RET} -gt 0 ] ; then 
     1394      echo "IGCM_sys_Get : copy error." 
     1395      cat out_rsync 
     1396      IGCM_debug_Exit "IGCM_sys_Get" 
     1397    else 
     1398      \rm out_rsync 
     1399    fi 
     1400  else 
     1401    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 
     1402  fi 
     1403  IGCM_debug_PopStack "IGCM_sys_Get" 
     1404} 
     1405 
     1406#D-#================================================== 
     1407#D-function IGCM_sys_GetBuffer 
     1408#D-* Purpose: Get a file from ${SCRATCHDIR} 
     1409#D-* Examples: IGCM_sys_GetBuffer myfile /destpath/myfile_with_PREFIX 
     1410#D-            IGCM_sys_GetBuffer /l Array_contain_myfiles /destpath/ 
     1411function IGCM_sys_GetBuffer { 
     1412  IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@ 
     1413 
     1414  typeset DEST RET buf_liste ifile target file_work 
     1415 
     1416  if ( $DEBUG_sys ) ; then 
     1417    echo "IGCM_sys_GetBuffer :" $@ 
     1418  fi 
     1419  if [ $DRYRUN -le 2 ]; then 
     1420    if [ X${1} = X'/l' ] ; then 
     1421      # test if the first file is present in the old computation : 
     1422      eval set +A buf_liste \${${2}} 
     1423    else 
     1424      eval set +A buf_liste ${1} 
     1425    fi 
     1426    eval DEST=\${${#}} 
     1427 
     1428    #USUAL WAY 
     1429    if [ X${1} = X'/l' ] ; then 
     1430      (( RET=0 )) 
     1431      for target in ${buf_liste[*]} ; do 
     1432        local_file=$( basename ${target} ) 
     1433        \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 
     1434        (( RET = RET + $? )) 
     1435      done 
     1436    else 
     1437      \cp ${buf_liste} ${DEST} >> out_rsync 2>&1 
     1438      RET=$? 
     1439    fi 
     1440 
     1441    if [ ${RET} -gt 0 ] ; then 
     1442      echo "IGCM_sys_GetBuffer : copy error." 
     1443      cat out_rsync 
     1444      IGCM_debug_Exit "IGCM_sys_GetBuffer" 
     1445    else 
     1446      \rm out_rsync 
     1447    fi 
     1448  else 
     1449    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 
     1450  fi 
     1451  IGCM_debug_PopStack "IGCM_sys_GetBuffer" 
     1452} 
    11691453 
    11701454#D-#================================================== 
     
    11741458#D- 
    11751459function IGCM_sys_GetDate_FichWork { 
    1176     IGCM_debug_PushStack "IGCM_sys_FichWork" $@ 
    1177     if ( $DEBUG_sys ) ; then 
    1178         echo "IGCM_sys_GetDate_FichWork :" $@ 
    1179     fi 
     1460  IGCM_debug_PushStack "IGCM_sys_FichWork" $@ 
     1461  if ( $DEBUG_sys ) ; then 
     1462    echo "IGCM_sys_GetDate_FichWork :" $@ 
     1463  fi 
     1464  typeset dateF 
     1465  set +A dateF -- $( ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} ) 
     1466  eval ${2}=${dateF[5]} 
     1467 
    11801468    # donne la date filesys d'un fichier sur la machine work 
    1181     IGCM_debug_PopStack "IGCM_sys_FichWork" 
     1469  IGCM_debug_PopStack "IGCM_sys_FichWork" 
    11821470} 
    11831471 
    11841472#D-#================================================== 
    11851473#D-function IGCM_sys_GetDate_FichArchive 
    1186 #D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE  
     1474#D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 
    11871475#D-* Examples: 
    11881476#D- 
    11891477function IGCM_sys_GetDate_FichArchive { 
    1190     IGCM_debug_PushStack "IGCM_sys_FichArchive" $@ 
    1191     if ( $DEBUG_sys ) ; then 
    1192         echo "IGCM_sys_GetDate_FichArchive :" $@ 
    1193     fi 
    1194     IGCM_debug_PopStack "IGCM_sys_FichArchive" 
     1478  IGCM_debug_PushStack "IGCM_sys_FichArchive" $@ 
     1479  if ( $DEBUG_sys ) ; then 
     1480    echo "IGCM_sys_GetDate_FichArchive :" $@ 
     1481  fi 
     1482  typeset dateF 
     1483  set +A dateF -- $( ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} ) 
     1484  eval ${2}=${dateF[5]} 
     1485 
     1486  IGCM_debug_PopStack "IGCM_sys_FichArchive" 
     1487} 
     1488 
     1489#D-#================================================== 
     1490#D-function IGCM_sys_Dods_Rm 
     1491#D-* Purpose: DO NOTHING ! Put ${ARCHIVE} files on DODS internet protocole. 
     1492#D-* Examples: 
     1493#D- 
     1494function IGCM_sys_Dods_Rm { 
     1495  if ( $DEBUG_sys ) ; then 
     1496    echo "IGCM_sys_Dods_Rm :" $@ 
     1497  fi 
     1498  typeset RET 
     1499  RET=0 
     1500  if [ $DRYRUN = 0 ]; then 
     1501 
     1502#    if [ ! -d /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} ] ; then 
     1503#      echo "WARNING : IGCM_sys_Dods_Rm /dmnfs/cont003/dods/public/${LOGIN}/${R_DODS}/${1} DOES NOT EXIST ." 
     1504#      echo "Nothing has been done." 
     1505#      return 
     1506#    fi 
     1507 
     1508    /ccc/cont003/home/dsm/p86maf/bin/dods_rm public/${LOGIN}/${R_DODS}/${1} # > out_dods_rm 2>&1 
     1509    RET=$? 
     1510 
     1511#       if [ ${RET} -gt 0 ] ; then 
     1512#           echo "IGCM_sys_Dods_Rm : error." 
     1513#           cat out_dods_rm 
     1514#           IGCM_debug_Exit "IGCM_sys_Dods_Rm" 
     1515#       else 
     1516#           rm out_dods_rm 
     1517#       fi 
     1518 
     1519  else 
     1520    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 
     1521  fi 
     1522  return $RET 
     1523} 
     1524 
     1525#D-#================================================== 
     1526#D-function IGCM_sys_Dods_Cp 
     1527#D-* Purpose: Copy $(ARCHIVE) files on DODS internet protocole. 
     1528#D-* Examples: 
     1529#D- 
     1530function IGCM_sys_Dods_Cp { 
     1531  if ( $DEBUG_sys ) ; then 
     1532    echo "IGCM_sys_Dods_Cp :" $@ 
     1533  fi 
     1534  typeset RET 
     1535  RET=0 
     1536  if [ $DRYRUN = 0 ]; then 
     1537 
     1538#    if [ ! -d ${R_SAVE}/${1} ] ; then 
     1539#      echo "WARNING : IGCM_sys_Dods_Cp ${R_SAVE}/${1} DOES NOT EXIST ." 
     1540#      echo "Nothing has been done." 
     1541#      return 
     1542#    fi 
     1543 
     1544    /ccc/cont003/home/dsm/p86maf/bin/dods_cp ${1} public/${LOGIN}/${R_DODS} # > out_dods_cp 2>&1 
     1545    RET=$? 
     1546 
     1547#       if [ ${RET} -gt 0 ] ; then 
     1548#           echo "IGCM_sys_Dods_Cp : error." 
     1549#           cat out_dods_cp 
     1550#           IGCM_debug_Exit "IGCM_sys_Dods_Cp" 
     1551#       else 
     1552#           rm out_dods_cp 
     1553#       fi 
     1554 
     1555  else 
     1556    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 
     1557  fi 
     1558  return $RET 
     1559} 
     1560 
     1561#D-#================================================== 
     1562#D-function IGCM_sys_Put_Dods 
     1563#D-* Purpose: Put $(ARCHIVE) files on DODS internet protocole. 
     1564#D-* Examples: 
     1565#D- 
     1566function IGCM_sys_Put_Dods { 
     1567  IGCM_debug_PushStack "IGCM_sys_Put_Dods" $@ 
     1568  if ( $DEBUG_sys ) ; then 
     1569    echo "IGCM_sys_Put_Dods :" $@ 
     1570  fi 
     1571  set -vx 
     1572  typeset RET 
     1573  if [ $DRYRUN = 0 ]; then 
     1574    if ( [ ! -d ${R_SAVE}/${1} ] && [ ! -d ${R_FIGR}/${1} ] ) ; then 
     1575      echo "WARNING IGCM_sys_Put_Dods : None of the following directories exist. Exactly one should." 
     1576      echo "WARNING IGCM_sys_Put_Dods : ${R_SAVE}/${1} DOES NOT EXIST." 
     1577      echo "WARNING IGCM_sys_Put_Dods : ${R_FIGR}/${1} DOES NOT EXIST." 
     1578      IGCM_debug_PopStack "IGCM_sys_Put_Dods" 
     1579      return 
     1580    fi 
     1581 
     1582    if ( [ -d ${R_SAVE}/${1} ] && [ -d ${R_FIGR}/${1} ] ) ; then 
     1583      echo "WARNING IGCM_sys_Put_Dods : Both of the following directories exist. Exactly one should." 
     1584      echo "WARNING IGCM_sys_Put_Dods : ${R_SAVE}/${1} EXISTS." 
     1585      echo "WARNING IGCM_sys_Put_Dods : ${R_FIGR}/${1} EXISTS." 
     1586      IGCM_debug_PopStack "IGCM_sys_Put_Dods" 
     1587      return 
     1588    fi 
     1589    # 
     1590    if [ -d ${R_SAVE}/${1} ] ; then 
     1591      cd ${R_SAVE} 
     1592    elif [ -d ${R_FIGR}/${1} ] ; then 
     1593      cd ${R_FIGR} 
     1594    fi 
     1595 
     1596    IGCM_sys_Dods_Rm ${1} 
     1597    IGCM_sys_Dods_Cp ${1} 
     1598    RET=0 
     1599 
     1600    if [ ${RET} -gt 0 ] ; then 
     1601      echo "IGCM_sys_Put_Dods : error." 
     1602      IGCM_debug_Exit "IGCM_sys_Put_Dods" 
     1603    fi 
     1604  else 
     1605    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 
     1606  fi 
     1607  IGCM_debug_PopStack "IGCM_sys_Put_Dods" 
    11951608} 
    11961609 
     
    11991612 
    12001613function IGCM_sys_rebuild { 
    1201     IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@ 
    1202     if ( $DEBUG_sys ) ; then 
    1203         echo "IGCM_sys_rebuild :" $@ 
    1204     fi 
    1205     ~p86ipsl/CESIUM/bin/rebuild -f -o $@ 
    1206     if [ $? -gt 0 ] ; then 
    1207        echo "IGCM_sys_rebuild : erreur ${@}." 
    1208        IGCM_debug_Exit "rebuild" 
    1209     fi 
    1210  
    1211     IGCM_debug_PopStack "IGCM_sys_rebuild" 
     1614  IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@ 
     1615  if ( $DEBUG_sys ) ; then 
     1616    echo "IGCM_sys_rebuild :" $@ 
     1617  fi 
     1618  ~p86ipsl/CESIUM/bin/rebuild -f -o $@ 
     1619  if [ $? -gt 0 ] ; then 
     1620    echo "IGCM_sys_rebuild : erreur ${@}." 
     1621    IGCM_debug_Exit "rebuild" 
     1622  fi 
     1623 
     1624  IGCM_debug_PopStack "IGCM_sys_rebuild" 
    12121625} 
    12131626 
     
    12161629 
    12171630function IGCM_sys_activ_variables { 
    1218     IGCM_debug_PushStack "IGCM_sys_activ_variables" 
    1219     if ( $DEBUG_sys ) ; then 
    1220         echo "IGCM_sys_activ_variables" 
    1221     fi 
    1222  
    1223     ulimit -s unlimited 
    1224  
    1225     IGCM_debug_PopStack "IGCM_sys_activ_variables" 
     1631  IGCM_debug_PushStack "IGCM_sys_activ_variables" 
     1632  if ( $DEBUG_sys ) ; then 
     1633    echo "IGCM_sys_activ_variables" 
     1634  fi 
     1635 
     1636  ulimit -s unlimited 
     1637 
     1638  IGCM_debug_PopStack "IGCM_sys_activ_variables" 
    12261639} 
    12271640 
     
    12301643 
    12311644function IGCM_sys_desactiv_variables { 
    1232     IGCM_debug_PushStack "IGCM_sys_desactiv_variables" 
    1233     if ( $DEBUG_sys ) ; then 
    1234         echo "IGCM_sys_desactiv_variables" 
    1235     fi 
    1236     IGCM_debug_PopStack "IGCM_sys_desactiv_variables" 
    1237 } 
    1238  
     1645  IGCM_debug_PushStack "IGCM_sys_desactiv_variables" 
     1646  if ( $DEBUG_sys ) ; then 
     1647    echo "IGCM_sys_desactiv_variables" 
     1648  fi 
     1649  IGCM_debug_PopStack "IGCM_sys_desactiv_variables" 
     1650} 
     1651 
     1652############################################################ 
     1653# Build MPI/OMP scripts run file (dummy function) 
    12391654 
    12401655function IGCM_sys_build_run_file { 
    1241 ############################################################ 
    1242 # Build run file 
    1243  
    1244  IGCM_debug_Print 1 "Dummy IGCM_sys_build_run_file" 
     1656 
     1657IGCM_debug_Print 3 " dummy function : IGCM_sys_build_run_file " 
    12451658 
    12461659} 
     
    12481661############################################################ 
    12491662# Build MPI/OMP scripts 
    1250 function IGCM_sys_build_execution_scripts  
     1663function IGCM_sys_build_execution_scripts 
    12511664{ 
    1252     IGCM_debug_PushStack "IGCM_sys_build_execution_scripts" $@ 
    1253     if ( $DEBUG_sys ) ; then 
    1254         echo "IGCM_sys_build_execution_scripts " $@ 
    1255     fi 
     1665  IGCM_debug_PushStack "IGCM_sys_build_execution_scripts" $@ 
     1666  if ( $DEBUG_sys ) ; then 
     1667    echo "IGCM_sys_build_execution_scripts " $@ 
     1668  fi 
    12561669 
    12571670    # Verification with MSUB parameter 
    1258         EXECUTION=${HOST_MPIRUN_COMMAND} 
    1259  
    1260     if ( ${OK_PARA_MPMD} ) ; then 
    1261  
    1262         if [ -f run_file ] ; then 
    1263             IGCM_sys_Rm -f run_file 
    1264         fi 
    1265         touch run_file 
     1671  EXECUTION=${HOST_MPIRUN_COMMAND} 
     1672 
     1673  if ( ${OK_PARA_MPMD} ) ; then 
     1674 
     1675    if [ -f run_file ] ; then 
     1676      IGCM_sys_Rm -f run_file 
     1677    fi 
     1678    touch run_file 
    12661679 
    12671680# run_file construction 
     
    12721685    for comp in ${config_ListOfComponents[*]} ; do 
    12731686 
    1274         eval ExeNameIn=\${config_Executable_${comp}[0]} 
    1275         eval ExeNameOut=\${config_Executable_${comp}[1]} 
     1687      eval ExeNameIn=\${config_Executable_${comp}[0]} 
     1688      eval ExeNameOut=\${config_Executable_${comp}[1]} 
    12761689 
    12771690        # for CPL component only 
    1278         if [ "X${comp}" = "XCPL" ] ; then 
    1279  
    1280             eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} 
    1281             eval comp_proc_omp_loc=\${${comp}_PROC_OMP} 
    1282             echo "${comp_proc_mpi_loc} ./${ExeNameOut}" >> run_file 
    1283         fi 
     1691      if [ "X${comp}" = "XCPL" ] ; then 
     1692 
     1693        eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} 
     1694        eval comp_proc_omp_loc=\${${comp}_PROC_OMP} 
     1695        echo "${comp_proc_mpi_loc} ./${ExeNameOut}" >> run_file 
     1696      fi 
    12841697    done 
    12851698 
     
    12881701    for comp in ${config_ListOfComponents[*]} ; do 
    12891702 
    1290         eval ExeNameIn=\${config_Executable_${comp}[0]} 
    1291         eval ExeNameOut=\${config_Executable_${comp}[1]} 
     1703      eval ExeNameIn=\${config_Executable_${comp}[0]} 
     1704      eval ExeNameOut=\${config_Executable_${comp}[1]} 
    12921705 
    12931706        # Only if we really have an executable for the component and not the coupler ie oasis: 
    1294         if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${comp}" != "XCPL" ] ) ; then 
    1295  
    1296             eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} 
    1297             eval comp_proc_omp_loc=\${${comp}_PROC_OMP} 
    1298             echo "${comp_proc_mpi_loc} ./${ExeNameOut}" >> run_file 
    1299         fi 
     1707      if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${comp}" != "XCPL" ] ) ; then 
     1708 
     1709        eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} 
     1710        eval comp_proc_omp_loc=\${${comp}_PROC_OMP} 
     1711        echo "${comp_proc_mpi_loc} ./${ExeNameOut}" >> run_file 
     1712      fi 
    13001713    done 
    13011714 
     
    13081721    fi 
    13091722 
    1310 else # Only one executable. launch it. 
    1311  
    1312     #  
     1723  else # Only one executable. launch it. 
     1724 
     1725    # 
    13131726    for comp in ${config_ListOfComponents[*]} ; do 
    13141727 
    1315         eval ExeNameIn=\${config_Executable_${comp}[0]} 
    1316         eval ExeNameOut=\${config_Executable_${comp}[1]} 
    1317  
    1318         if  [ "X${ExeNameOut}" != X\"\" ] ; then 
    1319             if ( ${OK_PARA_MPI} ) ; then 
    1320                 eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} 
    1321                 EXECUTION="${EXECUTION} -n ${comp_proc_mpi_loc} ./${ExeNameOut}" 
    1322             else 
    1323                 EXECUTION="${EXECUTION} ./${ExeNameOut}" 
    1324             fi 
    1325             if ( ${OK_PARA_OMP} ) ; then 
    1326                 eval comp_proc_omp_loc=\${${comp}_PROC_OMP} 
    1327                 EXECUTION="export OMP_NUM_THREADS=${comp_proc_omp_loc} ; ${EXECUTION} " 
    1328             fi 
     1728      eval ExeNameIn=\${config_Executable_${comp}[0]} 
     1729      eval ExeNameOut=\${config_Executable_${comp}[1]} 
     1730 
     1731      if  [ "X${ExeNameOut}" != X\"\" ] ; then 
     1732        if ( ${OK_PARA_MPI} ) ; then 
     1733          eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} 
     1734          EXECUTION="${EXECUTION} -n ${comp_proc_mpi_loc} ./${ExeNameOut}" 
     1735        else 
     1736          EXECUTION="${EXECUTION} ./${ExeNameOut}" 
    13291737        fi 
     1738        if ( ${OK_PARA_OMP} ) ; then 
     1739          eval comp_proc_omp_loc=\${${comp}_PROC_OMP} 
     1740          EXECUTION="export OMP_NUM_THREADS=${comp_proc_omp_loc} ; ${EXECUTION} " 
     1741        fi 
     1742      fi 
    13301743 
    13311744    done 
    13321745 
    1333 fi 
    1334  
    1335     IGCM_debug_Print 1 "sys Curie : execution command is " 
    1336     IGCM_debug_Print 1 "$EXECUTION" 
    1337  
    1338     IGCM_debug_PopStack "IGCM_sys_build_execution_scripts" 
    1339 } 
    1340  
    1341  
     1746  fi 
     1747 
     1748  IGCM_debug_Print 1 "sys Curie : execution command is " 
     1749  IGCM_debug_Print 1 "$EXECUTION" 
     1750 
     1751  IGCM_debug_PopStack "IGCM_sys_build_execution_scripts" 
     1752} 
    13421753 
    13431754############################################################## 
    13441755# NCO OPERATOR 
    13451756 
     1757function IGCM_sys_ncap2 { 
     1758  IGCM_debug_PushStack "IGCM_sys_ncap2" -- $@ 
     1759  if ( $DEBUG_sys ) ; then 
     1760    echo "IGCM_sys_ncap2 :" $@ 
     1761  fi 
     1762  ncap2 "$@" 
     1763  if [ $? -gt 0 ] ; then 
     1764    echo "IGCM_sys_ncap2 : erreur ${@}." 
     1765    IGCM_debug_Exit "ncap2" 
     1766  fi 
     1767 
     1768  IGCM_debug_PopStack "IGCM_sys_ncap2" 
     1769} 
     1770 
    13461771function IGCM_sys_ncatted { 
    1347     IGCM_debug_PushStack "IGCM_sys_ncatted" -- $@ 
    1348     if ( $DEBUG_sys ) ; then 
    1349         echo "IGCM_sys_ncatted :" $@ 
    1350     fi 
    1351     ncatted "$@" 
    1352     if [ $? -gt 0 ] ; then 
    1353        echo "IGCM_sys_ncatted : erreur ${@}." 
    1354        IGCM_debug_Exit "ncatted" 
    1355     fi 
    1356  
    1357     IGCM_debug_PopStack "IGCM_sys_ncatted" 
     1772  IGCM_debug_PushStack "IGCM_sys_ncatted" -- $@ 
     1773  if ( $DEBUG_sys ) ; then 
     1774    echo "IGCM_sys_ncatted :" $@ 
     1775  fi 
     1776  ncatted "$@" 
     1777  if [ $? -gt 0 ] ; then 
     1778    echo "IGCM_sys_ncatted : erreur ${@}." 
     1779    IGCM_debug_Exit "ncatted" 
     1780  fi 
     1781 
     1782  IGCM_debug_PopStack "IGCM_sys_ncatted" 
    13581783} 
    13591784 
    13601785function IGCM_sys_ncbo { 
    1361     IGCM_debug_PushStack "IGCM_sys_ncbo" -- $@ 
    1362     if ( $DEBUG_sys ) ; then 
    1363         echo "IGCM_sys_ncbo :" $@ 
    1364     fi 
    1365     ncbo $@ 
    1366     if [ $? -gt 0 ] ; then 
    1367        echo "IGCM_sys_ncbo : erreur ${@}." 
    1368        IGCM_debug_Exit "ncbo" 
    1369     fi 
    1370  
    1371     IGCM_debug_PopStack "IGCM_sys_ncbo" 
     1786  IGCM_debug_PushStack "IGCM_sys_ncbo" -- $@ 
     1787  if ( $DEBUG_sys ) ; then 
     1788    echo "IGCM_sys_ncbo :" $@ 
     1789  fi 
     1790  ncbo $@ 
     1791  if [ $? -gt 0 ] ; then 
     1792    echo "IGCM_sys_ncbo : erreur ${@}." 
     1793    IGCM_debug_Exit "ncbo" 
     1794  fi 
     1795 
     1796  IGCM_debug_PopStack "IGCM_sys_ncbo" 
    13721797} 
    13731798 
    13741799function IGCM_sys_ncdiff { 
    1375     IGCM_debug_PushStack "IGCM_sys_ncdiff" -- $@ 
    1376     if ( $DEBUG_sys ) ; then 
    1377         echo "IGCM_sys_ncdiff :" $@ 
    1378     fi 
    1379     ncdiff $@ 
    1380     if [ $? -gt 0 ] ; then 
    1381        echo "IGCM_sys_ncdiff : erreur ${@}." 
    1382        IGCM_debug_Exit "ncdiff" 
    1383     fi 
    1384  
    1385     IGCM_debug_PopStack "IGCM_sys_ncdiff" 
     1800  IGCM_debug_PushStack "IGCM_sys_ncdiff" -- $@ 
     1801  if ( $DEBUG_sys ) ; then 
     1802    echo "IGCM_sys_ncdiff :" $@ 
     1803  fi 
     1804  ncdiff $@ 
     1805  if [ $? -gt 0 ] ; then 
     1806    echo "IGCM_sys_ncdiff : erreur ${@}." 
     1807    IGCM_debug_Exit "ncdiff" 
     1808  fi 
     1809 
     1810  IGCM_debug_PopStack "IGCM_sys_ncdiff" 
    13861811} 
    13871812 
    13881813function IGCM_sys_ncea { 
    1389     IGCM_debug_PushStack "IGCM_sys_ncea" -- $@ 
    1390     if ( $DEBUG_sys ) ; then 
    1391         echo "IGCM_sys_ncea :" $@ 
    1392     fi 
    1393     ncea $@ 
    1394     if [ $? -gt 0 ] ; then 
    1395        echo "IGCM_sys_ncea : erreur ${@}." 
    1396        IGCM_debug_Exit "ncea" 
    1397     fi 
    1398  
    1399     IGCM_debug_PopStack "IGCM_sys_ncea" 
     1814  IGCM_debug_PushStack "IGCM_sys_ncea" -- $@ 
     1815  if ( $DEBUG_sys ) ; then 
     1816    echo "IGCM_sys_ncea :" $@ 
     1817  fi 
     1818  ncea $@ 
     1819  if [ $? -gt 0 ] ; then 
     1820    echo "IGCM_sys_ncea : erreur ${@}." 
     1821    IGCM_debug_Exit "ncea" 
     1822  fi 
     1823 
     1824  IGCM_debug_PopStack "IGCM_sys_ncea" 
    14001825} 
    14011826 
    14021827function IGCM_sys_ncecat { 
    1403     IGCM_debug_PushStack "IGCM_sys_ncecat" -- $@ 
    1404     if ( $DEBUG_sys ) ; then 
    1405         echo "IGCM_sys_ncecat :" $@ 
    1406     fi 
    1407     ncecat $@ 
    1408     if [ $? -gt 0 ] ; then 
    1409        echo "IGCM_sys_ncecat : erreur ${@}." 
    1410        IGCM_debug_Exit "ncecat" 
    1411     fi 
    1412  
    1413     IGCM_debug_PopStack "IGCM_sys_ncecat" 
     1828  IGCM_debug_PushStack "IGCM_sys_ncecat" -- $@ 
     1829  if ( $DEBUG_sys ) ; then 
     1830    echo "IGCM_sys_ncecat :" $@ 
     1831  fi 
     1832  ncecat $@ 
     1833  if [ $? -gt 0 ] ; then 
     1834    echo "IGCM_sys_ncecat : erreur ${@}." 
     1835    IGCM_debug_Exit "ncecat" 
     1836  fi 
     1837 
     1838  IGCM_debug_PopStack "IGCM_sys_ncecat" 
    14141839} 
    14151840 
    14161841function IGCM_sys_ncflint { 
    1417     IGCM_debug_PushStack "IGCM_sys_ncflint" -- $@ 
    1418     if ( $DEBUG_sys ) ; then 
    1419         echo "IGCM_sys_ncflint :" $@ 
    1420     fi 
    1421     ncflint $@ 
    1422     if [ $? -gt 0 ] ; then 
    1423        echo "IGCM_sys_ncflint : erreur ${@}." 
    1424        IGCM_debug_Exit "ncflint" 
    1425     fi 
    1426  
    1427     IGCM_debug_PopStack "IGCM_sys_ncflint" 
     1842  IGCM_debug_PushStack "IGCM_sys_ncflint" -- $@ 
     1843  if ( $DEBUG_sys ) ; then 
     1844    echo "IGCM_sys_ncflint :" $@ 
     1845  fi 
     1846  ncflint $@ 
     1847  if [ $? -gt 0 ] ; then 
     1848    echo "IGCM_sys_ncflint : erreur ${@}." 
     1849    IGCM_debug_Exit "ncflint" 
     1850  fi 
     1851 
     1852  IGCM_debug_PopStack "IGCM_sys_ncflint" 
    14281853} 
    14291854 
    14301855function IGCM_sys_ncks { 
    1431     IGCM_debug_PushStack "IGCM_sys_ncks" -- $@ 
    1432     if ( $DEBUG_sys ) ; then 
    1433         echo "IGCM_sys_ncks :" $@ 
    1434     fi 
    1435     ncks $@ 
    1436     if [ $? -gt 0 ] ; then 
    1437        echo "IGCM_sys_ncks : erreur ${@}." 
    1438        IGCM_debug_Exit "ncks" 
    1439     fi 
    1440  
    1441     IGCM_debug_PopStack "IGCM_sys_ncks" 
     1856  IGCM_debug_PushStack "IGCM_sys_ncks" -- $@ 
     1857  if ( $DEBUG_sys ) ; then 
     1858    echo "IGCM_sys_ncks :" $@ 
     1859  fi 
     1860  ncks $@ 
     1861  if [ $? -gt 0 ] ; then 
     1862    echo "IGCM_sys_ncks : erreur ${@}." 
     1863    IGCM_debug_Exit "ncks" 
     1864  fi 
     1865 
     1866  IGCM_debug_PopStack "IGCM_sys_ncks" 
    14421867} 
    14431868 
    14441869function IGCM_sys_ncpdq { 
    1445     IGCM_debug_PushStack "IGCM_sys_ncpdq" -- $@ 
    1446     if ( $DEBUG_sys ) ; then 
    1447         echo "IGCM_sys_ncpdq :" $@ 
    1448     fi 
    1449     ncpdq $@ 
    1450     if [ $? -gt 0 ] ; then 
    1451        echo "IGCM_sys_ncpdq : erreur ${@}." 
    1452        IGCM_debug_Exit "ncpdq" 
    1453     fi 
    1454  
    1455     IGCM_debug_PopStack "IGCM_sys_ncpdq" 
     1870  IGCM_debug_PushStack "IGCM_sys_ncpdq" -- $@ 
     1871  if ( $DEBUG_sys ) ; then 
     1872    echo "IGCM_sys_ncpdq :" $@ 
     1873  fi 
     1874  ncpdq $@ 
     1875  if [ $? -gt 0 ] ; then 
     1876    echo "IGCM_sys_ncpdq : erreur ${@}." 
     1877    IGCM_debug_Exit "ncpdq" 
     1878  fi 
     1879 
     1880  IGCM_debug_PopStack "IGCM_sys_ncpdq" 
    14561881} 
    14571882 
    14581883function IGCM_sys_ncra { 
    1459     IGCM_debug_PushStack "IGCM_sys_ncra" -- $@ 
    1460     if ( $DEBUG_sys ) ; then 
    1461         echo "IGCM_sys_ncra :" $@ 
    1462     fi 
    1463     ncra $@ 
    1464     if [ $? -gt 0 ] ; then 
    1465        echo "IGCM_sys_ncra : erreur ${@}." 
    1466        IGCM_debug_Exit "ncra" 
    1467     fi 
    1468  
    1469     IGCM_debug_PopStack "IGCM_sys_ncra" 
     1884  IGCM_debug_PushStack "IGCM_sys_ncra" -- $@ 
     1885  if ( $DEBUG_sys ) ; then 
     1886    echo "IGCM_sys_ncra :" $@ 
     1887  fi 
     1888  ncra $@ 
     1889  if [ $? -gt 0 ] ; then 
     1890    echo "IGCM_sys_ncra : erreur ${@}." 
     1891    IGCM_debug_Exit "ncra" 
     1892  fi 
     1893 
     1894  IGCM_debug_PopStack "IGCM_sys_ncra" 
    14701895} 
    14711896 
    14721897function IGCM_sys_ncrcat { 
    1473     IGCM_debug_PushStack "IGCM_sys_ncrcat" -- $@ 
    1474     if ( $DEBUG_sys ) ; then 
    1475         echo "IGCM_sys_ncrcat :" $@ 
    1476     fi 
    1477     ncrcat $@ 
    1478     if [ $? -gt 0 ] ; then 
    1479        echo "IGCM_sys_ncrcat : erreur ${@}." 
     1898  IGCM_debug_PushStack "IGCM_sys_ncrcat" -- $@ 
     1899  if ( $DEBUG_sys ) ; then 
     1900    echo "IGCM_sys_ncrcat :" $@ 
     1901  fi 
     1902  ncrcat $@ 
     1903  if [ $? -gt 0 ] ; then 
     1904    echo "IGCM_sys_ncrcat : erreur ${@}." 
    14801905#       IGCM_debug_Exit "ncrcat" 
    1481     fi 
    1482  
    1483     IGCM_debug_PopStack "IGCM_sys_ncrcat" 
     1906  fi 
     1907 
     1908  IGCM_debug_PopStack "IGCM_sys_ncrcat" 
    14841909} 
    14851910 
    14861911function IGCM_sys_ncrename { 
    1487     IGCM_debug_PushStack "IGCM_sys_ncrename" -- $@ 
    1488     if ( $DEBUG_sys ) ; then 
    1489         echo "IGCM_sys_ncrename :" $@ 
    1490     fi 
    1491     ncrename $@ 
    1492     if [ $? -gt 0 ] ; then 
    1493        echo "IGCM_sys_ncrename : erreur ${@}." 
    1494        IGCM_debug_Exit "ncrename" 
    1495     fi 
    1496  
    1497     IGCM_debug_PopStack "IGCM_sys_ncrename" 
     1912  IGCM_debug_PushStack "IGCM_sys_ncrename" -- $@ 
     1913  if ( $DEBUG_sys ) ; then 
     1914    echo "IGCM_sys_ncrename :" $@ 
     1915  fi 
     1916  ncrename $@ 
     1917  if [ $? -gt 0 ] ; then 
     1918    echo "IGCM_sys_ncrename : erreur ${@}." 
     1919    IGCM_debug_Exit "ncrename" 
     1920  fi 
     1921 
     1922  IGCM_debug_PopStack "IGCM_sys_ncrename" 
    14981923} 
    14991924 
    15001925function IGCM_sys_ncwa { 
    1501     IGCM_debug_PushStack "IGCM_sys_ncwa" -- $@ 
    1502     if ( $DEBUG_sys ) ; then 
    1503         echo "IGCM_sys_ncwa :" $@ 
    1504     fi 
    1505     ncwa $@ 
    1506     if [ $? -gt 0 ] ; then 
    1507        echo "IGCM_sys_ncwa : erreur ${@}." 
    1508        IGCM_debug_Exit "ncwa" 
    1509     fi 
    1510  
    1511     IGCM_debug_PopStack "IGCM_sys_ncwa" 
    1512 } 
     1926  IGCM_debug_PushStack "IGCM_sys_ncwa" -- $@ 
     1927  if ( $DEBUG_sys ) ; then 
     1928    echo "IGCM_sys_ncwa :" $@ 
     1929  fi 
     1930  ncwa $@ 
     1931  if [ $? -gt 0 ] ; then 
     1932    echo "IGCM_sys_ncwa : erreur ${@}." 
     1933    IGCM_debug_Exit "ncwa" 
     1934  fi 
     1935 
     1936  IGCM_debug_PopStack "IGCM_sys_ncwa" 
     1937} 
     1938 
     1939############################################################## 
     1940# CDO OPERATOR 
     1941 
     1942function IGCM_sys_cdo { 
     1943  IGCM_debug_PushStack "IGCM_sys_cdo" -- $@ 
     1944  if ( $DEBUG_sys ) ; then 
     1945    echo "IGCM_sys_cdo :" $@ 
     1946  fi 
     1947  \cdo $@ 
     1948  if [ $? -gt 0 ] ; then 
     1949    echo "IGCM_sys_cdo : erreur ${@}." 
     1950    IGCM_debug_PopStack "IGCM_sys_cdo" 
     1951    return 1 
     1952  else 
     1953    IGCM_debug_PopStack "IGCM_sys_cdo" 
     1954    return 0 
     1955  fi 
     1956 
     1957  IGCM_debug_PopStack "IGCM_sys_cdo" 
     1958} 
  • trunk/libIGCM/libIGCM_sys/libIGCM_sys_titane.ksh

    r621 r623  
    1414#========================================================= 
    1515# 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. 
    1717# Extract with command: cat lib* | grep "^#D-" | cut -c "4-" 
    1818#========================================================= 
     
    2222#D-#================================================== 
    2323#D- 
    24 #D- This ksh library if a layer under some usefull  
     24#D- This ksh library if a layer under some usefull 
    2525#D-environment variables and shell commands. 
    2626#D-All those definitions depend on host particularities. 
     
    4242# YOU MUST COMPILE YOUR EXE FILES FOR DRYRUN MODE ! 
    4343# ------------------------------------------------------------------------------------- 
    44 # | DRYRUN=  |  Date computations, | sys_Get    |  Exe    | sys_Put_Out; sys_Put_Rest | 
    45 # |          |  Cp/Exe param files |            |  Chmod  |                           | 
    46 # |          |      Qsub           |            |         |                           | 
     44# | DRYRUN=  |  Date computations, | sys_Get    |  Exe    | sys_Put_Out; sys_Put_Rest | 
     45# |          |  Cp/Exe param files |            |  Chmod  |                           | 
     46# |          |      Qsub           |            |         |                           | 
    4747# ------------------------------------------------------------------------------------- 
    48 # |    0     |       yes           |    yes     |  yes    |      yes                  | 
     48# |    0     |       yes           |    yes     |  yes    |      yes                  | 
    4949# ------------------------------------------------------------------------------------- 
    50 # |    1     |       yes           |    yes     |  yes    |      no                   | 
     50# |    1     |       yes           |    yes     |  yes    |      no                   | 
    5151# ------------------------------------------------------------------------------------- 
    52 # |    2     |       yes           |    yes     |  no     |      no                   | 
     52# |    2     |       yes           |    yes     |  no     |      no                   | 
    5353# ------------------------------------------------------------------------------------- 
    54 # |    3     |       yes           |    no      |  no     |      no                   | 
     54# |    3     |       yes           |    no      |  no     |      no                   | 
    5555# ------------------------------------------------------------------------------------- 
    5656 
     
    194194 
    195195NUM_COREPERNODE=8 
    196          
     196 
    197197#==================================================== 
    198198#- Default number of MPI task for IPSL coupled model 
     
    274274#  if [ "X$( grep rebuild_from tmp_IGCM_sys_RshPost_$$ )" != "X" ] ; then 
    275275#    #little hack so that rebuild submission is done on titane not an cesium 
    276 #     
     276# 
    277277#    libIGCM_POST_sed=$( echo $libIGCM_POST | sed 's/\//\\\//g' ) 
    278278#    POST_DIR_sed=$( echo ${POST_DIR} | sed 's/\//\\\//g' ) 
     
    282282#    sed "s/Script_Post_Output=/Script_Output=${POST_DIR_sed}\//g" tmp.txt > tmp_IGCM_sys_RshPost_$$ 
    283283#    \mv tmp.txt tmp_IGCM_sys_RshPost_$$ 
    284 #     
     284# 
    285285#    echo cat tmp_IGCM_sys_RshPost_$$ AFTER 
    286286#    cat tmp_IGCM_sys_RshPost_$$ 
     
    355355 
    356356    if [ ! -z ${config_UserChoices_MailName} ] ; then 
    357         mail -s "${config_UserChoices_JobName} ${status}" ${config_UserChoices_MailName} < job_end.mail 
     357        mail -s "${config_UserChoices_JobName} ${status}" ${config_UserChoices_MailName} < job_end.mail 
    358358    elif [ -f ~/.forward ] ; then 
    359         mail -s "${config_UserChoices_JobName} ${status}" $( cat ~/.forward ) < job_end.mail 
     359        mail -s "${config_UserChoices_JobName} ${status}" $( cat ~/.forward ) < job_end.mail 
    360360    fi 
    361361    sleep 10 
     
    405405  fi 
    406406  #- creation de repertoire sur le serveur fichier 
    407   if [ ! -d ${1} ]; then  
     407  if [ ! -d ${1} ]; then 
    408408    \mkdir -p $1 
    409409    if [ $? -gt 0 ] ; then 
     
    426426  fi 
    427427  #- creation de repertoire sur le serveur fichier 
    428   if [ ! -d ${1} ]; then  
     428  if [ ! -d ${1} ]; then 
    429429    \mkdir -p $1 
    430430    if [ $? -gt 0 ] ; then 
     
    716716#    fi 
    717717#    (( i = i + 1 )) 
    718 #  done  
     718#  done 
    719719# ============ CESIUM  END  ============ # 
    720720 
     
    727727 
    728728#D-************************* 
    729 #D- File transfer functions  
     729#D- File transfer functions 
    730730#D-************************* 
    731731#D- 
     
    796796  elif [ $MYLANG = "en" ] ; then 
    797797    case $RET in 
    798     0)  return;;                 
     798    0)  return;; 
    799799    1)  echo "rsync error : Syntax or usage error " 
    800800      return;; 
     
    969969 
    970970    typeset RET 
    971      
     971 
    972972    echo mv $@ > out_rsync 2>&1 
    973973    \mv $@ >> out_rsync 2>&1 
    974974    RET=$? 
    975      
     975 
    976976    if [ ${RET} -gt 0 ] ; then 
    977977      echo "IGCM_sys_Mv : error in mv." 
     
    11321132    RET=$? 
    11331133 
    1134 #       #RSYNC WITH NETWORK SSH CALL 
    1135 #       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 
    1136 #       ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 
    1137  
    1138      #RSYNC WITH NFS USE 
    1139      echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 
    1140      ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 
    1141  
    1142      RET=$? 
    1143      IGCM_sys_Rsync_out $RET 
    1144  
    1145      ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
    1146      (( RET=RET+$? )) 
     1134#       #RSYNC WITH NETWORK SSH CALL 
     1135#       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 
     1136#       ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 
     1137 
     1138     #RSYNC WITH NFS USE 
     1139     echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 
     1140     ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 
     1141 
     1142     RET=$? 
     1143     IGCM_sys_Rsync_out $RET 
     1144 
     1145     ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
     1146     (( RET=RET+$? )) 
    11471147 
    11481148    if [ ${RET} -gt 0 ] ; then 
     
    12291229    #    typeset WORKPATH FILEPATH 
    12301230    #    WORKPATH=$( dirname $2 | sed -e "s|${R_OUT}|${R_BUF}|" ) 
    1231     #    IGCM_sys_MkdirWork ${WORKPATH}  
     1231    #    IGCM_sys_MkdirWork ${WORKPATH} 
    12321232    #    FILEPATH=${WORKPATH}/$( basename $2 ) 
    12331233    #    # 
     
    12371237    if [ X${JobType} = XRUN ] ; then 
    12381238      if [ X${3} = X ] ; then 
    1239         IGCM_sys_Chmod 444 ${1} 
     1239        IGCM_sys_Chmod 444 ${1} 
    12401240      fi 
    12411241    fi 
     
    12451245    RET=$? 
    12461246 
    1247 #       #RSYNC WITH NETWORK SSH CALL 
    1248 #       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 
    1249 #       ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 
    1250  
    1251      #RSYNC WITH NFS USE 
    1252      echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 
    1253      ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 
    1254  
    1255      RET=$? 
    1256      IGCM_sys_Rsync_out $RET 
    1257  
    1258      ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
    1259      (( RET=RET+$? )) 
     1247#       #RSYNC WITH NETWORK SSH CALL 
     1248#       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 
     1249#       ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 
     1250 
     1251     #RSYNC WITH NFS USE 
     1252     echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 
     1253     ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 
     1254 
     1255     RET=$? 
     1256     IGCM_sys_Rsync_out $RET 
     1257 
     1258     ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
     1259     (( RET=RET+$? )) 
    12601260 
    12611261    if [ ${RET} -gt 0 ] ; then 
     
    12961296    if [ X${JobType} = XRUN ] ; then 
    12971297      if [ X${3} = X ] ; then 
    1298         IGCM_sys_Chmod 444 ${1} 
     1298        IGCM_sys_Chmod 444 ${1} 
    12991299      fi 
    13001300    fi 
     
    13261326  IGCM_debug_PushStack "IGCM_sys_Get" $@ 
    13271327 
    1328   typeset DEST RET dm_liste ifile target file_work  
     1328  typeset DEST RET dm_liste ifile target file_work 
    13291329 
    13301330  if ( $DEBUG_sys ) ; then 
     
    13831383    #   RET=$? 
    13841384    #   if [ ${RET} -gt 0 ] ; then 
    1385     #       echo "ERROR IGCM_sys_Get : again demigration error :" 
    1386     #       cat out_rsync 
    1387     #       IGCM_debug_Exit "IGCM_sys_Get" 
     1385    #       echo "ERROR IGCM_sys_Get : again demigration error :" 
     1386    #       cat out_rsync 
     1387    #       IGCM_debug_Exit "IGCM_sys_Get" 
    13881388    #   fi 
    13891389    #    else 
     
    13981398      (( RET=0 )) 
    13991399      for target in ${dm_liste[*]} ; do 
    1400         local_file=$( basename ${target} ) 
    1401         \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 
    1402         (( RET = RET + $? )) 
     1400        local_file=$( basename ${target} ) 
     1401        \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 
     1402        (( RET = RET + $? )) 
    14031403      done 
    14041404    else 
     
    14071407    fi 
    14081408 
    1409 #       #RSYNC WITH NETWORK SSH CALL 
    1410 #       echo ${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1 
    1411 #       ${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1 
    1412  
    1413      #RSYNC WITH NFS USE 
    1414      echo ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1 
    1415      ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> out_rsync 2>&1 
    1416  
    1417 #       RET=$? 
    1418      IGCM_sys_Rsync_out $RET 
    1419  
    1420      ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
    1421      (( RET=RET+$? )) 
     1409#       #RSYNC WITH NETWORK SSH CALL 
     1410#       echo ${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1 
     1411#       ${RSYNC} ${RSYNC_opt} -e ssh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1 
     1412 
     1413     #RSYNC WITH NFS USE 
     1414     echo ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1 
     1415     ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> out_rsync 2>&1 
     1416 
     1417#       RET=$? 
     1418     IGCM_sys_Rsync_out $RET 
     1419 
     1420     ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync 
     1421     (( RET=RET+$? )) 
    14221422 
    14231423    if [ ${RET} -gt 0 ] ; then 
     
    14421442  IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@ 
    14431443 
    1444   typeset DEST RET buf_liste ifile target file_work  
     1444  typeset DEST RET buf_liste ifile target file_work 
    14451445 
    14461446  if ( $DEBUG_sys ) ; then 
     
    14601460      (( RET=0 )) 
    14611461      for target in ${buf_liste[*]} ; do 
    1462         local_file=$( basename ${target} ) 
    1463         \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 
    1464         (( RET = RET + $? )) 
     1462        local_file=$( basename ${target} ) 
     1463        \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 
     1464        (( RET = RET + $? )) 
    14651465      done 
    14661466    else 
     
    15021502#D-#================================================== 
    15031503#D-function IGCM_sys_GetDate_FichArchive 
    1504 #D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE  
     1504#D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE 
    15051505#D-* Examples: 
    15061506#D- 
     
    15381538    /ccc/cont003/home/dsm/p86maf/bin/dods_rm public/${LOGIN}/${R_DODS}/${1} # > out_dods_rm 2>&1 
    15391539    RET=$? 
    1540      
     1540 
    15411541#       if [ ${RET} -gt 0 ] ; then 
    1542 #           echo "IGCM_sys_Dods_Rm : error." 
    1543 #           cat out_dods_rm 
    1544 #           IGCM_debug_Exit "IGCM_sys_Dods_Rm" 
     1542#           echo "IGCM_sys_Dods_Rm : error." 
     1543#           cat out_dods_rm 
     1544#           IGCM_debug_Exit "IGCM_sys_Dods_Rm" 
    15451545#       else 
    1546 #           rm out_dods_rm 
     1546#           rm out_dods_rm 
    15471547#       fi 
    15481548 
     
    15751575    RET=$? 
    15761576 
    1577 #       if [ ${RET} -gt 0 ] ; then 
    1578 #           echo "IGCM_sys_Dods_Cp : error." 
    1579 #           cat out_dods_cp 
    1580 #           IGCM_debug_Exit "IGCM_sys_Dods_Cp" 
    1581 #       else 
    1582 #           rm out_dods_cp 
    1583 #       fi 
     1577#       if [ ${RET} -gt 0 ] ; then 
     1578#           echo "IGCM_sys_Dods_Cp : error." 
     1579#           cat out_dods_cp 
     1580#           IGCM_debug_Exit "IGCM_sys_Dods_Cp" 
     1581#       else 
     1582#           rm out_dods_cp 
     1583#       fi 
    15841584 
    15851585  else 
     
    16271627    IGCM_sys_Dods_Cp ${1} 
    16281628    RET=0 
    1629      
     1629 
    16301630    if [ ${RET} -gt 0 ] ; then 
    16311631      echo "IGCM_sys_Put_Dods : error." 
     
    16701670  (( max_omp = 0 )) 
    16711671  for comp in ${config_ListOfComponents[*]} ; do 
    1672          
     1672 
    16731673    eval ExeNameIn=\${config_Executable_${comp}[0]} 
    16741674    eval ExeNameOut=\${config_Executable_${comp}[1]} 
    1675      
     1675 
    16761676    # Only if we really have an executable for the component : 
    16771677    if ( [ "X${ExeNameOut}" != X\"\" ] &&  [ "X${comp}" != "XCPL" ] ) ; then 
     
    17111711############################################################ 
    17121712# Build MPI/OMP scripts 
    1713 function IGCM_sys_build_execution_scripts  
     1713function IGCM_sys_build_execution_scripts 
    17141714{ 
    17151715  IGCM_debug_PushStack "IGCM_sys_build_execution_scripts" $@ 
     
    17171717    echo "IGCM_sys_build_execution_scripts " $@ 
    17181718  fi 
    1719   typeset nodes listnodes init_node start_num init_exec comp ExeNameIn ExeNameOut  
    1720   typeset node_num_current node_current comp_proc_mpi_loc comp_proc_omp_loc  
     1719  typeset nodes listnodes init_node start_num init_exec comp ExeNameIn ExeNameOut 
     1720  typeset node_num_current node_current comp_proc_mpi_loc comp_proc_omp_loc 
    17211721  typeset num_corempi nombre_restant_node nombre_restant_comp 
    17221722 
     
    17371737 
    17381738      ${HOST_MPIRUN_COMMAND} hostname | sort | uniq > hosts.tmp 
    1739          
     1739 
    17401740      i=0 
    17411741      rm -f hosts 
     
    17481748      done 
    17491749      rm -f hosts.tmp 
    1750              
     1750 
    17511751      listnodes=${host[*]} 
    1752              
    1753       EXECUTION="${HOST_MPIRUN_COMMAND} -hostfile hosts"  
    1754          
     1752 
     1753      EXECUTION="${HOST_MPIRUN_COMMAND} -hostfile hosts" 
     1754 
    17551755      # Initialisation 
    17561756 
     
    17611761 
    17621762      # Test : if oasis is there, we put it at the first position 
    1763              
     1763 
    17641764      for comp in ${config_ListOfComponents[*]} ; do 
    1765                  
     1765 
    17661766        if [ "X${comp}" = "XCPL" ]  ; then 
    1767                      
     1767 
    17681768          eval ExeNameIn=\${config_Executable_${comp}[0]} 
    17691769          eval ExeNameOut=\${config_Executable_${comp}[1]} 
    1770                      
     1770 
    17711771          echo "#!/bin/ksh" > script_${ExeNameOut}.ksh 
    17721772          echo ""  >> script_${ExeNameOut}.ksh 
     
    17761776          echo "./${ExeNameOut} > out_${ExeNameOut}.out 2>out_${ExeNameOut}.err"  >> script_${ExeNameOut}.ksh 
    17771777          IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh 
    1778                      
     1778 
    17791779          init_node=n 
    1780                      
     1780 
    17811781          (( nombre_restant_node = NUM_COREPERNODE - 1 )) 
    17821782          node_num_current=0 
    17831783          node_current=${host[${node_num_current}]} 
    1784                      
    1785           EXECUTION="${EXECUTION} -H ${node_current} -np 1 ./script_${ExeNameOut}.ksh"  
    1786                      
     1784 
     1785          EXECUTION="${EXECUTION} -H ${node_current} -np 1 ./script_${ExeNameOut}.ksh" 
     1786 
    17871787          init_exec=y 
    17881788          start_num=1 
    1789                      
     1789 
    17901790        fi 
    1791                  
     1791 
    17921792      done 
    1793              
     1793 
    17941794      # Then loop on the components (except for oasis) 
    17951795 
    17961796      for comp in ${config_ListOfComponents[*]} ; do 
    1797                  
     1797 
    17981798        eval ExeNameIn=\${config_Executable_${comp}[0]} 
    17991799        eval ExeNameOut=\${config_Executable_${comp}[1]} 
    1800                  
     1800 
    18011801        # Only if we really have an executable for the component : 
    18021802        if ( [ "X${ExeNameOut}" != X\"\" ] &&  [ "X${comp}" != "XCPL" ] ) ; then 
     
    18041804          eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} 
    18051805          eval comp_proc_omp_loc=\${${comp}_PROC_OMP} 
    1806                      
     1806 
    18071807          echo "#!/bin/ksh" > script_${ExeNameOut}.ksh 
    18081808          # echo "set -vx" >> script_${ExeNameOut}.ksh 
     
    18151815          echo "./${ExeNameOut} > out_${ExeNameOut}.out.\${MYMPIRANK} 2>out_${ExeNameOut}.err.\${MYMPIRANK}"  >> script_${ExeNameOut}.ksh 
    18161816          IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh 
    1817                      
     1817 
    18181818          node_num=0 
    1819                      
    1820           # We define the number of MPI process to be assigned for the component  
     1819 
     1820          # We define the number of MPI process to be assigned for the component 
    18211821 
    18221822          nombre_restant_comp=${comp_proc_mpi_loc} 
    1823                      
     1823 
    18241824          # Loop on the allocated nodes 
    18251825 
     
    18291829            if [ ${node_num} = ${node_num_current} ] ; then 
    18301830 
    1831               node_current=${host[${node_num_current}]} 
    1832  
    1833               # If first time on the node : initialisation  
     1831              node_current=${host[${node_num_current}]} 
     1832 
     1833              # If first time on the node : initialisation 
    18341834 
    18351835              if [ ${init_node} = y ] ; then 
    18361836                nombre_restant_node=${NUM_COREPERNODE} 
    1837               fi 
    1838                              
     1837              fi 
     1838 
    18391839              # Test on the number of OMP threads 
    18401840 
    1841               if [ ${comp_proc_omp_loc} -gt ${nombre_restant_node} ] ; then 
     1841              if [ ${comp_proc_omp_loc} -gt ${nombre_restant_node} ] ; then 
    18421842                (( node_num = node_num + 1 )) 
    18431843                node_num_current=${node_num} 
     
    18491849 
    18501850              (( num_corempi = nombre_restant_node / comp_proc_omp_loc )) 
    1851                              
    1852               if [ ${num_corempi} -gt ${nombre_restant_comp} ] ; then 
     1851 
     1852              if [ ${num_corempi} -gt ${nombre_restant_comp} ] ; then 
    18531853                num_corempi=${nombre_restant_comp} 
    18541854              fi 
    18551855 
    18561856              (( nombre_restant_node = nombre_restant_node - num_corempi * comp_proc_omp_loc )) 
    1857               (( nombre_restant_comp = nombre_restant_comp - num_corempi )) 
    1858                              
    1859               if [ ${init_exec} = y ] ; then 
     1857              (( nombre_restant_comp = nombre_restant_comp - num_corempi )) 
     1858 
     1859              if [ ${init_exec} = y ] ; then 
    18601860                EXECUTION="${EXECUTION} : -H ${node_current} -np ${num_corempi} ./script_${ExeNameOut}.ksh" 
    1861               else       
     1861              else 
    18621862                EXECUTION="${EXECUTION} -H ${node_current} -np ${num_corempi} ./script_${ExeNameOut}.ksh" 
    18631863                init_exec=y 
     
    18651865 
    18661866              ((  start_num = num_corempi + start_num )) 
    1867                              
     1867 
    18681868            else 
    1869                              
    1870               (( node_num = node_num + 1 ))  
    1871               continue 
     1869 
     1870              (( node_num = node_num + 1 )) 
     1871              continue 
    18721872            fi 
    1873                          
    1874             # Test on the number of core/process remaining on the node/component  
    1875                          
     1873 
     1874            # Test on the number of core/process remaining on the node/component 
     1875 
    18761876            if [ ${nombre_restant_node} = 0 ] ; then 
    18771877              (( node_num = node_num + 1 )) 
    1878               node_num_current=${node_num} 
    1879               init_node=y 
     1878              node_num_current=${node_num} 
     1879              init_node=y 
    18801880 
    18811881              if [ ${nombre_restant_comp} = 0 ] ; then 
     
    18851885 
    18861886              node_num_current=${node_num} 
    1887               init_node=n 
    1888                              
    1889               if [ ${nombre_restant_comp} = 0 ] ; then 
    1890                 break 1 
    1891               fi 
     1887              init_node=n 
     1888 
     1889              if [ ${nombre_restant_comp} = 0 ] ; then 
     1890                break 1 
     1891              fi 
    18921892            fi 
    18931893          done 
    18941894        fi 
    18951895      done 
    1896              
     1896 
    18971897    else 
    18981898 
     
    19001900 
    19011901        ## the coupler ie oasis must be the first one 
    1902         for comp in ${config_ListOfComponents[*]} ; do 
    1903              
    1904             eval ExeNameOut=\${config_Executable_${comp}[1]} 
    1905                  
    1906         # for CPL component only 
    1907             if [ "X${comp}" = "XCPL" ] ; then 
    1908                 eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} 
    1909                 echo "-np ${comp_proc_mpi_loc} ./${ExeNameOut} " >> run_file  
    1910             fi 
    1911         done 
     1902        for comp in ${config_ListOfComponents[*]} ; do 
     1903 
     1904            eval ExeNameOut=\${config_Executable_${comp}[1]} 
     1905 
     1906        # for CPL component only 
     1907            if [ "X${comp}" = "XCPL" ] ; then 
     1908                eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} 
     1909                echo "-np ${comp_proc_mpi_loc} ./${ExeNameOut} " >> run_file 
     1910            fi 
     1911        done 
    19121912 
    19131913        # Then second loop on the components 
    19141914 
    1915         for comp in ${config_ListOfComponents[*]} ; do 
    1916                  
    1917             eval ExeNameOut=\${config_Executable_${comp}[1]} 
    1918                  
     1915        for comp in ${config_ListOfComponents[*]} ; do 
     1916 
     1917            eval ExeNameOut=\${config_Executable_${comp}[1]} 
     1918 
    19191919            # Only if we really have an executable for the component and not the coupler ie oasis: 
    1920             if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${comp}" != "XCPL" ] ) ; then 
    1921                 eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} 
    1922                 echo "-np ${comp_proc_mpi_loc} ./${ExeNameOut} " >> run_file  
    1923             fi 
    1924         done 
    1925         IGCM_sys_Chmod u+x run_file 
    1926  
    1927         EXECUTION="${HOST_MPIRUN_COMMAND} --app ./run_file" 
    1928            
     1920            if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${comp}" != "XCPL" ] ) ; then 
     1921                eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} 
     1922                echo "-np ${comp_proc_mpi_loc} ./${ExeNameOut} " >> run_file 
     1923            fi 
     1924        done 
     1925        IGCM_sys_Chmod u+x run_file 
     1926 
     1927        EXECUTION="${HOST_MPIRUN_COMMAND} --app ./run_file" 
     1928 
    19291929    fi 
    19301930 
     
    19341934 
    19351935          # Only if we really have an executable for the component : 
    1936           eval ExeNameOut=\${config_Executable_${comp}[1]} 
    1937           if ( [ "X${ExeNameOut}" != X\"\" ] ) ; then    
    1938                  
    1939               echo "#!/bin/ksh" > script_${ExeNameOut}.ksh 
    1940               echo ""  >> script_${ExeNameOut}.ksh 
    1941               if ( ${OK_PARA_OMP} ) ; then  
    1942                   eval comp_proc_omp_loc=\${${comp}_PROC_OMP} 
    1943                   echo "OMP_NUM_THREADS=${comp_proc_omp_loc}" >> script_${ExeNameOut}.ksh        
    1944               fi 
    1945               if  ( ${OK_PARA_MPI} ) ; then  
     1936          eval ExeNameOut=\${config_Executable_${comp}[1]} 
     1937          if ( [ "X${ExeNameOut}" != X\"\" ] ) ; then 
     1938 
     1939              echo "#!/bin/ksh" > script_${ExeNameOut}.ksh 
     1940              echo ""  >> script_${ExeNameOut}.ksh 
     1941              if ( ${OK_PARA_OMP} ) ; then 
     1942                  eval comp_proc_omp_loc=\${${comp}_PROC_OMP} 
     1943                  echo "OMP_NUM_THREADS=${comp_proc_omp_loc}" >> script_${ExeNameOut}.ksh 
     1944              fi 
     1945              if  ( ${OK_PARA_MPI} ) ; then 
    19461946                  # Default : mpirun used if nb_proc gt 1 
    1947                   # pour sortie out/err par process 
    1948                   # echo "./${ExeNameOut} > out_${ExeNameOut}.out.\${OMPI_COMM_WORLD_RANK} 2>out_${ExeNameOut}.err.\${OMPI_COMM_WORLD_RANK}"  >> script_${ExeNameOut}.ksh 
    1949                   echo "./${ExeNameOut}" >> script_${ExeNameOut}.ksh 
    1950                   IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh 
    1951                   EXECUTION="${HOST_MPIRUN_COMMAND} ./script_${ExeNameOut}.ksh" 
    1952               else 
    1953                   # Default : mpirun is NOT used if nb_proc eq 1 
    1954                   # pour sortie out/err par process 
    1955                   # echo "./${ExeNameOut} > out_${ExeNameOut}.out 2>out_${ExeNameOut}.err" >> script_${ExeNameOut}.ksh 
    1956                   echo "./${ExeNameOut}" >> script_${ExeNameOut}.ksh 
    1957                   IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh 
    1958                   EXECUTION="time ./script_${ExeNameOut}.ksh" 
    1959               fi 
    1960           fi 
     1947                  # pour sortie out/err par process 
     1948                  # echo "./${ExeNameOut} > out_${ExeNameOut}.out.\${OMPI_COMM_WORLD_RANK} 2>out_${ExeNameOut}.err.\${OMPI_COMM_WORLD_RANK}"  >> script_${ExeNameOut}.ksh 
     1949                  echo "./${ExeNameOut}" >> script_${ExeNameOut}.ksh 
     1950                  IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh 
     1951                  EXECUTION="${HOST_MPIRUN_COMMAND} ./script_${ExeNameOut}.ksh" 
     1952              else 
     1953                  # Default : mpirun is NOT used if nb_proc eq 1 
     1954                  # pour sortie out/err par process 
     1955                  # echo "./${ExeNameOut} > out_${ExeNameOut}.out 2>out_${ExeNameOut}.err" >> script_${ExeNameOut}.ksh 
     1956                  echo "./${ExeNameOut}" >> script_${ExeNameOut}.ksh 
     1957                  IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh 
     1958                  EXECUTION="time ./script_${ExeNameOut}.ksh" 
     1959              fi 
     1960          fi 
    19611961      done 
    1962        
     1962 
    19631963  fi 
    19641964 
Note: See TracChangeset for help on using the changeset viewer.