- Timestamp:
- 03/07/12 10:39:55 (12 years ago)
- Location:
- branches/libIGCM_MPI_OpenMP
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
branches/libIGCM_MPI_OpenMP
-
Property
svn:mergeinfo
set to
False
/trunk/libIGCM merged eligible
-
Property
svn:mergeinfo
set to
False
-
branches/libIGCM_MPI_OpenMP/libIGCM_sys/libIGCM_sys_vargas.ksh
r558 r571 81 81 typeset -r RSYNC_opt="-va" 82 82 # ie storage filesystem 83 typeset -r RHOST=gaya.idris.fr83 typeset -r STOREHOST=gaya.idris.fr 84 84 typeset -r REMOTE_RSYNC=/u/rech/ces/rces452/RSYNC/bin/rsync 85 85 … … 118 118 #- OUT 119 119 typeset -r R_OUT=${ARCHIVE}/IGCM_OUT 120 121 #==================================================== 122 #- R_BUF Buffer to pack files 123 typeset -r R_BUF=${WORKDIR}/BUFFER_IGCM 120 124 121 125 #==================================================== … … 149 153 150 154 #D-#================================================== 155 #D-function IGCM_sys_RshMaster 156 #D-* Purpose: Connection to frontend machine. 157 #D-* Examples: 158 #D- 159 (( RshMNum = 0 )) 160 function 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-#================================================== 151 194 #D-function IGCM_sys_RshArchive 152 195 #D-* Purpose: Archive rsh command … … 155 198 function IGCM_sys_RshArchive { 156 199 IGCM_debug_PushStack "IGCM_sys_RshArchive" $@ 157 rsh gayaexec /bin/ksh <<-EOF200 rsh ${STOREHOST} exec /bin/ksh <<-EOF 158 201 ${@} 159 202 EOF … … 177 220 178 221 # 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} 180 223 181 224 ## Add submission for old postponed files only if command is a Qsub 182 225 ## 183 226 ISITQSUB=0 184 grep Qsub /tmp/tmp_IGCM_sys_RshPost_$$ >/dev/null 2>&1 && ISITQSUB=1227 grep Qsub /tmp/tmp_IGCM_sys_RshPost_$$_${LOGNAME} >/dev/null 2>&1 && ISITQSUB=1 185 228 if ( [ ${ISITQSUB} -gt 0 ] ) ; then 186 229 if [ -d ${SUBMIT_DIR}/POSTPONE ] ; then … … 201 244 RETURN=0 202 245 # 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} 204 247 RETURN=$? 205 248 206 249 # keep standard input for postpone if ulam don't answer 207 250 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}" 209 252 [ -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} 211 256 fi 212 257 IGCM_debug_PopStack "IGCM_sys_RshPost" … … 290 335 fi 291 336 #- creation de repertoire sur le serveur fichier 292 rsh gaya-n mkdir -p $1337 rsh ${STOREHOST} -n mkdir -p $1 293 338 294 339 if [ $? -gt 0 ] ; then … … 413 458 414 459 #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- 465 function 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-#================================================== 415 478 #D-function IGCM_sys_TestFileArchive 416 479 #D-* Purpose: Test file that must NOT EXISTS on Archive … … 427 490 428 491 #D-#================================================== 492 #D-function IGCM_sys_TestFileBuffer 493 #D-* Purpose: Test file that must NOT EXISTS on Buffer 494 #D-* Examples: 495 #D- 496 function 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-#================================================== 429 506 #D-function IGCM_sys_CountFileArchive 430 507 #D-* Purpose: Count files on Archive filesystem … … 441 518 442 519 #D-#================================================== 520 #D-function IGCM_sys_CountFileBuffer 521 #D-* Purpose: Count files on Scratch filesystem 522 #D-* Examples: 523 #D- 524 function 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-#================================================== 443 534 #D-function IGCM_sys_Tree 444 535 #D-* Purpose: Tree directories with files on ${ARCHIVE} … … 466 557 echo "IGCM_sys_Tar :" $@ 467 558 fi 468 \tar c vf $@559 \tar cf $@ 469 560 if [ $? -gt 0 ] ; then 470 561 echo "IGCM_sys_Tar : erreur." 471 562 IGCM_debug_Exit "IGCM_sys_Tar" 472 563 fi 473 \tar tvf $1474 475 564 IGCM_debug_PopStack "IGCM_sys_Tar" 476 565 } … … 532 621 fi 533 622 cd ${POST_DIR} 623 echo MAF QsubPost vargas 534 624 /opt/ibmll/LoadL/full/bin/llsubmit ${libIGCM_POST}/$1.job 535 625 cd - … … 742 832 cat out_rsync 743 833 IGCM_debug_Exit "IGCM_sys_Cp" 834 else 835 \rm out_rsync 744 836 fi 745 837 IGCM_debug_PopStack "IGCM_sys_Cp" … … 784 876 cat out_rsync 785 877 IGCM_debug_Exit "IGCM_sys_Mv" 878 else 879 \rm out_rsync 786 880 fi 787 881 else … … 815 909 # 816 910 #USUAL WAY 817 rcp -r $1 gaya:$2 > out_rsync 2>&1911 rcp -r $1 ${STOREHOST}:$2 > out_rsync 2>&1 818 912 RET=$? 819 913 … … 822 916 cat out_rsync 823 917 IGCM_debug_Exit "IGCM_sys_Put_Dir" 918 else 919 \rm out_rsync 824 920 fi 825 921 else … … 849 945 850 946 #USUAL WAY 851 rcp -rp gaya:$1 $2 > out_rsync 2>&1947 rcp -rp ${STOREHOST}:$1 $2 > out_rsync 2>&1 852 948 RET=$? 853 949 … … 894 990 895 991 # #RSYNC WITH NETWORK RSH CALL 896 # echo ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${ RHOST}:${2} > out_rsync 2>&1897 # ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${ RHOST}:${2} >> out_rsync 2>&1992 # 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 898 994 899 995 # #RSYNC WITH NFS USE … … 911 1007 cat out_rsync 912 1008 IGCM_debug_Exit "IGCM_sys_Put_Rest" 1009 else 1010 \rm out_rsync 913 1011 fi 914 1012 else … … 916 1014 fi 917 1015 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- 1024 function 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" 918 1057 } 919 1058 … … 951 1090 952 1091 # #RSYNC WITH NETWORK RSH CALL 953 # echo ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${ RHOST}:${2} > out_rsync 2>&1954 # ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${ RHOST}:${2} >> out_rsync 2>&11092 # 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 955 1094 956 1095 # #RSYNC WITH NFS USE … … 968 1107 cat out_rsync 969 1108 IGCM_debug_Exit "IGCM_sys_Put_Out" 1109 else 1110 \rm out_rsync 970 1111 fi 971 1112 IGCM_sys_Rm out_rsync … … 975 1116 IGCM_debug_PopStack "IGCM_sys_Put_Out" 976 1117 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- 1125 function 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 977 1163 } 978 1164 … … 1025 1211 1026 1212 # #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>&11028 # ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${ RHOST}:"${dm_liste}" ${RHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&11213 # 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 1029 1215 1030 1216 # #RSYNC WITH NFS USE … … 1042 1228 cat out_rsync 1043 1229 IGCM_debug_Exit "IGCM_sys_Get" 1230 else 1231 \rm out_rsync 1044 1232 fi 1045 1233 else … … 1047 1235 fi 1048 1236 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/ 1244 function 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" 1049 1285 } 1050 1286 … … 1061 1297 echo "IGCM_sys_GetDate_FichWork :" $@ 1062 1298 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 1063 1303 # donne la date filesys d'un fichier sur la machine work 1064 1304 IGCM_debug_PopStack "IGCM_sys_FichWork" … … 1075 1315 echo "IGCM_sys_GetDate_FichArchive :" $@ 1076 1316 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 1077 1321 IGCM_debug_PopStack "IGCM_sys_FichArchive" 1078 1322 }
Note: See TracChangeset
for help on using the changeset viewer.