Ignore:
Timestamp:
03/07/12 10:39:55 (12 years ago)
Author:
mafoipsl
Message:

First try to merge libIGCM_MPI_OpenMP branch with libIGCM trunk revision 569. Tested on vargas with PackFrequency?=NONE included into config.card.

Location:
branches/libIGCM_MPI_OpenMP
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • branches/libIGCM_MPI_OpenMP

  • branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_vargas.ksh

    r558 r571  
    8181typeset -r RSYNC_opt="-va" 
    8282# ie storage filesystem 
    83 typeset -r RHOST=gaya.idris.fr 
     83typeset -r STOREHOST=gaya.idris.fr 
    8484typeset -r REMOTE_RSYNC=/u/rech/ces/rces452/RSYNC/bin/rsync 
    8585 
     
    118118#- OUT 
    119119typeset -r R_OUT=${ARCHIVE}/IGCM_OUT 
     120 
     121#==================================================== 
     122#- R_BUF  Buffer to pack files 
     123typeset -r R_BUF=${WORKDIR}/BUFFER_IGCM 
    120124 
    121125#==================================================== 
     
    149153 
    150154#D-#================================================== 
     155#D-function IGCM_sys_RshMaster 
     156#D-* Purpose: Connection to frontend machine. 
     157#D-* Examples: 
     158#D- 
     159(( RshMNum = 0 )) 
     160function IGCM_sys_RshMaster { 
     161    IGCM_debug_PushStack "IGCM_sys_RshMaster" $@ 
     162 
     163    typeset THEFILE OUTFILE ERR 
     164 
     165    RshDIR=${WORKDIR}/RUN_DIR/${config_UserChoices_TagName}/${config_UserChoices_JobName}.${$} 
     166    if [ ! -d ${RshDIR} ] ; then 
     167        IGCM_sys_Mkdir ${RshDIR} 
     168    fi 
     169    THEFILE=${RshDIR}/file_sys_RshMaster_$$_${RshMNum} 
     170    echo '#!/bin/ksh' > ${THEFILE} 
     171    echo "export libIGCM=${libIGCM} > /dev/null 2>&1" >> ${THEFILE} 
     172    echo "export DEBUG_debug=${DEBUG_debug} > /dev/null 2>&1" >> ${THEFILE} 
     173    echo ". ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh > /dev/null 2>&1" >> ${THEFILE} 
     174    echo ". ${libIGCM}/libIGCM_card/libIGCM_card.ksh > /dev/null 2>&1" >> ${THEFILE} 
     175    echo "${@} " >> ${THEFILE} 
     176 
     177    # No frontend queue on brodie : just rsh the job on the frontend with submission. 
     178    sed -e "s@IGCM_sys_Qsub\(.*\)@\1@" ${THEFILE} > ${THEFILE}_ 
     179 
     180    chmod u+x  ${THEFILE}_ 
     181 
     182    OUTFILE=${RshDIR}/out_RshMaster.$$.${RshMNum} 
     183    (( RshMNum = RshMNum + 1 )) 
     184 
     185    rsh ${MASTER} 'bash -c "nohup '${THEFILE}'_ > '${OUTFILE}' 2>&1 &"' 
     186    if [ $? -gt 0 ] ; then 
     187        echo "IGCM_sys_RshMaster : erreur." 
     188        IGCM_debug_Exit "IGCM_sys_RshMaster" 
     189    fi 
     190    IGCM_debug_PopStack "IGCM_sys_RshMaster" 
     191} 
     192 
     193#D-#================================================== 
    151194#D-function IGCM_sys_RshArchive 
    152195#D-* Purpose: Archive rsh command 
     
    155198function IGCM_sys_RshArchive { 
    156199    IGCM_debug_PushStack "IGCM_sys_RshArchive" $@ 
    157     rsh gaya exec /bin/ksh <<-EOF 
     200    rsh ${STOREHOST} exec /bin/ksh <<-EOF 
    158201    ${@} 
    159202EOF 
     
    177220 
    178221    # keep standard input to keep it for postpone if ulam don't answer 
    179     cat >/tmp/tmp_IGCM_sys_RshPost_$$ 
     222    cat >/tmp/tmp_IGCM_sys_RshPost_$$_${LOGNAME} 
    180223 
    181224    ## Add submission for old postponed files only if command is a Qsub 
    182225    ## 
    183226    ISITQSUB=0 
    184     grep Qsub /tmp/tmp_IGCM_sys_RshPost_$$ >/dev/null 2>&1 && ISITQSUB=1 
     227    grep Qsub /tmp/tmp_IGCM_sys_RshPost_$$_${LOGNAME} >/dev/null 2>&1 && ISITQSUB=1 
    185228    if  ( [ ${ISITQSUB} -gt 0 ] ) ; then  
    186229      if [ -d ${SUBMIT_DIR}/POSTPONE ] ; then 
     
    201244    RETURN=0 
    202245    # rsh ulam command 
    203     rsh ulam exec /bin/ksh </tmp/tmp_IGCM_sys_RshPost_$$ 
     246    rsh ulam exec /bin/ksh </tmp/tmp_IGCM_sys_RshPost_$$_${LOGNAME} 
    204247    RETURN=$? 
    205248 
    206249    # keep standard input for postpone if ulam don't answer 
    207250    if ( [ ${RETURN} -gt 0 ] ) ; then 
    208         IGCM_debug_Print 2 "Postpone tmp_IGCM_sys_RshPost_$$" 
     251        IGCM_debug_Print 2 "Postpone tmp_IGCM_sys_RshPost_$$_${LOGNAME}" 
    209252        [ -d ${SUBMIT_DIR}/POSTPONE ] || mkdir ${SUBMIT_DIR}/POSTPONE 
    210         mv /tmp/tmp_IGCM_sys_RshPost_$$ ${SUBMIT_DIR}/POSTPONE 
     253        mv /tmp/tmp_IGCM_sys_RshPost_$$_${LOGNAME} ${SUBMIT_DIR}/POSTPONE 
     254    else 
     255        IGCM_sys_Rm /tmp/tmp_IGCM_sys_RshPost_$$_${LOGNAME} 
    211256    fi 
    212257    IGCM_debug_PopStack "IGCM_sys_RshPost" 
     
    290335    fi 
    291336    #- creation de repertoire sur le serveur fichier 
    292     rsh gaya -n mkdir -p $1 
     337    rsh ${STOREHOST} -n mkdir -p $1 
    293338 
    294339    if [ $? -gt 0 ] ; then 
     
    413458 
    414459#D-#================================================== 
     460#D-function IGCM_sys_IsFileArchived 
     461#D-* Purpose: Test file that must NOT EXISTS on Archive 
     462#D-* always true on vargas. 
     463#D-* Examples: 
     464#D- 
     465function IGCM_sys_IsFileArchived { 
     466  IGCM_debug_PushStack "IGCM_sys_IsFileArchived" $@ 
     467  if ( $DEBUG_sys ) ; then 
     468    echo "IGCM_sys_IsFileArchived :" $@ 
     469  fi 
     470  typeset IsArchivedFlag 
     471  IsArchivedFlag=$( echo 0 ) 
     472  IGCM_debug_PopStack "IGCM_sys_IsFileArchived" 
     473 
     474  return ${IsArchivedFlag} 
     475} 
     476 
     477#D-#================================================== 
    415478#D-function IGCM_sys_TestFileArchive 
    416479#D-* Purpose: Test file that must NOT EXISTS on Archive 
     
    427490 
    428491#D-#================================================== 
     492#D-function IGCM_sys_TestFileBuffer 
     493#D-* Purpose: Test file that must NOT EXISTS on Buffer 
     494#D-* Examples: 
     495#D- 
     496function IGCM_sys_TestFileBuffer { 
     497  IGCM_debug_PushStack "IGCM_sys_TestFileBuffer" $@ 
     498  typeset ExistFlag 
     499  ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 ) 
     500  IGCM_debug_PopStack "IGCM_sys_TestFileBuffer" 
     501 
     502  return ${ExistFlag} 
     503} 
     504 
     505#D-#================================================== 
    429506#D-function IGCM_sys_CountFileArchive 
    430507#D-* Purpose: Count files on Archive filesystem 
     
    441518 
    442519#D-#================================================== 
     520#D-function IGCM_sys_CountFileBuffer 
     521#D-* Purpose: Count files on Scratch filesystem 
     522#D-* Examples: 
     523#D- 
     524function IGCM_sys_CountFileBuffer { 
     525  IGCM_debug_PushStack "IGCM_sys_CountFileBuffer" $@ 
     526  ls ${@} 2>/dev/null | wc -l 
     527  if [ $? -gt 0 ] ; then 
     528    echo "IGCM_sys_CountFileBuffer : erreur." 
     529  fi 
     530  IGCM_debug_PopStack "IGCM_sys_CountFileBuffer" 
     531} 
     532 
     533#D-#================================================== 
    443534#D-function IGCM_sys_Tree 
    444535#D-* Purpose: Tree directories with files on ${ARCHIVE} 
     
    466557        echo "IGCM_sys_Tar :" $@ 
    467558    fi 
    468     \tar cvf $@ 
     559    \tar cf $@ 
    469560    if [ $? -gt 0 ] ; then 
    470561        echo "IGCM_sys_Tar : erreur." 
    471562        IGCM_debug_Exit "IGCM_sys_Tar" 
    472563    fi 
    473     \tar tvf $1 
    474  
    475564    IGCM_debug_PopStack "IGCM_sys_Tar" 
    476565} 
     
    532621    fi 
    533622    cd ${POST_DIR} 
     623    echo MAF QsubPost vargas 
    534624    /opt/ibmll/LoadL/full/bin/llsubmit ${libIGCM_POST}/$1.job 
    535625    cd - 
     
    742832        cat out_rsync 
    743833        IGCM_debug_Exit "IGCM_sys_Cp" 
     834     else 
     835         \rm out_rsync 
    744836    fi 
    745837    IGCM_debug_PopStack "IGCM_sys_Cp" 
     
    784876            cat out_rsync 
    785877            IGCM_debug_Exit "IGCM_sys_Mv" 
     878        else 
     879            \rm out_rsync 
    786880        fi 
    787881    else 
     
    815909        # 
    816910        #USUAL WAY 
    817         rcp -r $1 gaya:$2 > out_rsync 2>&1 
     911        rcp -r $1 ${STOREHOST}:$2 > out_rsync 2>&1 
    818912        RET=$? 
    819913 
     
    822916            cat out_rsync 
    823917            IGCM_debug_Exit "IGCM_sys_Put_Dir" 
     918        else 
     919            \rm out_rsync 
    824920        fi 
    825921    else 
     
    849945 
    850946        #USUAL WAY 
    851         rcp -rp gaya:$1 $2 > out_rsync 2>&1 
     947        rcp -rp ${STOREHOST}:$1 $2 > out_rsync 2>&1 
    852948        RET=$? 
    853949 
     
    894990 
    895991#       #RSYNC WITH NETWORK RSH CALL 
    896 #       echo ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1 
    897 #       ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1 
     992#       echo ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 
     993#       ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 
    898994 
    899995#       #RSYNC WITH NFS USE 
     
    9111007            cat out_rsync 
    9121008            IGCM_debug_Exit "IGCM_sys_Put_Rest" 
     1009        else 
     1010            \rm out_rsync 
    9131011        fi 
    9141012    else 
     
    9161014    fi 
    9171015    IGCM_debug_PopStack "IGCM_sys_Put_Rest" 
     1016} 
     1017 
     1018#D-#================================================== 
     1019#D-function IGCM_sys_PutBuffer_Rest 
     1020#D-* Purpose: Put computied restarts on ${SCRATCHDIR}. 
     1021#D-           File and target directory must exist. 
     1022#D-* Examples: 
     1023#D- 
     1024function IGCM_sys_PutBuffer_Rest { 
     1025  IGCM_debug_PushStack "IGCM_sys_PutBuffer_Rest" $@ 
     1026  if ( $DEBUG_sys ) ; then 
     1027    echo "IGCM_sys_PutBuffer_Rest :" $@ 
     1028  fi 
     1029  if [ $DRYRUN = 0 ]; then 
     1030    if [ ! -f ${1} ] ; then 
     1031      echo "ERROR : IGCM_sys_PutBuffer_Rest ${1} DOES NOT EXIST ." 
     1032      IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" 
     1033    fi 
     1034 
     1035    typeset RET 
     1036    # 
     1037    if [ X${JobType} = XRUN ] ; then 
     1038      IGCM_sys_Chmod 444 ${1} 
     1039    fi 
     1040 
     1041    # 
     1042    # USUAL WAY 
     1043    \cp $1 $2 > out_rsync 2>&1 
     1044    RET=$? 
     1045 
     1046    if [ ${RET} -gt 0 ] ; then 
     1047      echo "IGCM_sys_PutBuffer_Rest : error." 
     1048      cat out_rsync 
     1049      IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" 
     1050    else 
     1051      \rm out_rsync 
     1052    fi 
     1053  else 
     1054    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 
     1055  fi 
     1056  IGCM_debug_PopStack "IGCM_sys_PutBuffer_Rest" 
    9181057} 
    9191058 
     
    9511090 
    9521091#       #RSYNC WITH NETWORK RSH CALL 
    953 #       echo ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} > out_rsync 2>&1 
    954 #       ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${RHOST}:${2} >> out_rsync 2>&1 
     1092#       echo ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 
     1093#       ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 
    9551094 
    9561095#       #RSYNC WITH NFS USE 
     
    9681107            cat out_rsync 
    9691108            IGCM_debug_Exit "IGCM_sys_Put_Out" 
     1109        else 
     1110            \rm out_rsync 
    9701111        fi 
    9711112        IGCM_sys_Rm out_rsync 
     
    9751116    IGCM_debug_PopStack "IGCM_sys_Put_Out" 
    9761117    return 0 
     1118} 
     1119 
     1120#D-#================================================== 
     1121#D-function IGCM_sys_PutBuffer_Out 
     1122#D-* Purpose: Copy a file on ${SCRATCHDIR} after having chmod it in readonly 
     1123#D-* Examples: 
     1124#D- 
     1125function IGCM_sys_PutBuffer_Out { 
     1126  IGCM_debug_PushStack "IGCM_sys_PutBuffer_Out" $@ 
     1127  if ( $DEBUG_sys ) ; then 
     1128    echo "IGCM_sys_PutBuffer_Out :" $@ 
     1129  fi 
     1130  if [ $DRYRUN = 0 ]; then 
     1131    if [ ! -f ${1} ] ; then 
     1132      echo "WARNING : IGCM_sys_PutBuffer_Out ${1} DOES NOT EXIST ." 
     1133      IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out" 
     1134      return 1 
     1135    fi 
     1136    # 
     1137    IGCM_sys_Mkdir $( dirname $2 ) 
     1138    # 
     1139    typeset RET 
     1140 
     1141    if [ X${JobType} = XRUN ] ; then 
     1142      if [ X${3} = X ] ; then 
     1143        IGCM_sys_Chmod 444 ${1} 
     1144      fi 
     1145    fi 
     1146    # 
     1147    # USUAL WAY 
     1148    \cp $1 $2 > out_rsync 2>&1 
     1149    RET=$? 
     1150 
     1151    if [ ${RET} -gt 0 ] ; then 
     1152      echo "IGCM_sys_PutBuffer_Out : error." 
     1153      cat out_rsync 
     1154      IGCM_debug_Exit "IGCM_sys_PutBuffer_Out" 
     1155    else 
     1156      \rm out_rsync 
     1157    fi 
     1158  else 
     1159    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 
     1160  fi 
     1161  IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out" 
     1162  return 0 
    9771163} 
    9781164 
     
    10251211 
    10261212#       #RSYNC WITH NETWORK RSH CALL 
    1027 #       echo ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1 
    1028 #       ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1 
     1213#       echo ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1 
     1214#       ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1 
    10291215 
    10301216#       #RSYNC WITH NFS USE 
     
    10421228            cat out_rsync 
    10431229            IGCM_debug_Exit "IGCM_sys_Get" 
     1230        else 
     1231            \rm out_rsync 
    10441232        fi 
    10451233    else 
     
    10471235    fi 
    10481236    IGCM_debug_PopStack "IGCM_sys_Get" 
     1237} 
     1238 
     1239#D-#================================================== 
     1240#D-function IGCM_sys_GetBuffer 
     1241#D-* Purpose: Get a file from ${SCRATCHDIR} 
     1242#D-* Examples: IGCM_sys_GetBuffer myfile /destpath/myfile_with_PREFIX 
     1243#D-            IGCM_sys_GetBuffer /l Array_contain_myfiles /destpath/ 
     1244function IGCM_sys_GetBuffer { 
     1245  IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@ 
     1246 
     1247  typeset DEST RET buf_liste ifile target file_work 
     1248 
     1249  if ( $DEBUG_sys ) ; then 
     1250    echo "IGCM_sys_GetBuffer :" $@ 
     1251  fi 
     1252  if [ $DRYRUN -le 2 ]; then 
     1253    if [ X${1} = X'/l' ] ; then 
     1254      # test if the first file is present in the old computation : 
     1255      eval set +A buf_liste \${${2}} 
     1256    else 
     1257      eval set +A buf_liste ${1} 
     1258    fi 
     1259    eval DEST=\${${#}} 
     1260 
     1261    #USUAL WAY 
     1262    if [ X${1} = X'/l' ] ; then 
     1263      (( RET=0 )) 
     1264      for target in ${buf_liste[*]} ; do 
     1265        local_file=$( basename ${target} ) 
     1266        \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 
     1267        (( RET = RET + $? )) 
     1268      done 
     1269    else 
     1270      \cp ${buf_liste} ${DEST} >> out_rsync 2>&1 
     1271      RET=$? 
     1272    fi 
     1273 
     1274    if [ ${RET} -gt 0 ] ; then 
     1275      echo "IGCM_sys_GetBuffer : copy error." 
     1276      cat out_rsync 
     1277      IGCM_debug_Exit "IGCM_sys_GetBuffer" 
     1278    else 
     1279      \rm out_rsync 
     1280    fi 
     1281  else 
     1282    ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack 
     1283  fi 
     1284  IGCM_debug_PopStack "IGCM_sys_GetBuffer" 
    10491285} 
    10501286 
     
    10611297        echo "IGCM_sys_GetDate_FichWork :" $@ 
    10621298    fi 
     1299    typeset dateF 
     1300    set +A dateF -- $( rsh ${MASTER} -n /opt/freeware/bin/ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} ) 
     1301    eval ${2}=${dateF[5]} 
     1302 
    10631303    # donne la date filesys d'un fichier sur la machine work 
    10641304    IGCM_debug_PopStack "IGCM_sys_FichWork" 
     
    10751315        echo "IGCM_sys_GetDate_FichArchive :" $@ 
    10761316    fi 
     1317    typeset dateF 
     1318    set +A dateF -- $( rsh ${STOREHOST} -n ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} ) 
     1319    eval ${2}=${dateF[5]} 
     1320 
    10771321    IGCM_debug_PopStack "IGCM_sys_FichArchive" 
    10781322} 
Note: See TracChangeset for help on using the changeset viewer.