[70] | 1 | #!/bin/ksh |
---|
| 2 | |
---|
| 3 | #************************************************************** |
---|
| 4 | # Author: Sébastien Denvil |
---|
[373] | 5 | # Contact: Sebastien.Denvil__at__ipsl.jussieu.fr |
---|
| 6 | # $Revision:: $ Revision of last commit |
---|
| 7 | # $Author:: $ Author of last commit |
---|
| 8 | # $Date:: $ Date of last commit |
---|
[70] | 9 | # IPSL (2006) |
---|
| 10 | # This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC |
---|
| 11 | # |
---|
| 12 | #************************************************************** |
---|
| 13 | |
---|
| 14 | #========================================================= |
---|
| 15 | # The documentation of this file can be automatically generated |
---|
[619] | 16 | # if you use the prefix #D- for comments to be extracted. |
---|
[70] | 17 | # Extract with command: cat lib* | grep "^#D-" | cut -c "4-" |
---|
| 18 | #========================================================= |
---|
| 19 | |
---|
| 20 | #D-#================================================== |
---|
| 21 | #D-LibIGCM_sys for Vargas |
---|
| 22 | #D-#================================================== |
---|
| 23 | #D- |
---|
[619] | 24 | #D- This ksh library if a layer under some usefull |
---|
[70] | 25 | #D-environment variables and shell commands. |
---|
| 26 | #D-All those definitions depend on host particularities. |
---|
| 27 | #D-It manages a stack mechanism and test validity of operations. |
---|
| 28 | #D-All function described bellow must be prefixed by IGCM_sys. |
---|
| 29 | |
---|
| 30 | #==================================================== |
---|
| 31 | # libIGCM_sys PARAMETERS |
---|
| 32 | #==================================================== |
---|
| 33 | |
---|
| 34 | #==================================================== |
---|
| 35 | # set DEBUG_sys to true to output calls of function |
---|
| 36 | typeset -r DEBUG_sys=${DEBUG_sys:=true} |
---|
| 37 | |
---|
| 38 | #==================================================== |
---|
| 39 | # Turn in dry run mode ? (sys_Put_Rest, sys_Put_Out, sys_Get) |
---|
| 40 | typeset -r DRYRUN=${DRYRUN:=0} |
---|
| 41 | |
---|
| 42 | # YOU MUST COMPILE YOUR EXE FILES FOR DRYRUN MODE ! |
---|
| 43 | # ------------------------------------------------------------------------------------- |
---|
| 44 | # | DRYRUN= | Date computations, | sys_Get | Exe | sys_Put_Out; sys_Put_Rest | |
---|
| 45 | # | | Cp/Exe param files | | Chmod | | |
---|
| 46 | # | | Qsub | | | | |
---|
| 47 | # ------------------------------------------------------------------------------------- |
---|
| 48 | # | 0 | yes | yes | yes | yes | |
---|
| 49 | # ------------------------------------------------------------------------------------- |
---|
| 50 | # | 1 | yes | yes | yes | no | |
---|
| 51 | # ------------------------------------------------------------------------------------- |
---|
| 52 | # | 2 | yes | yes | no | no | |
---|
| 53 | # ------------------------------------------------------------------------------------- |
---|
| 54 | # | 3 | yes | no | no | no | |
---|
| 55 | # ------------------------------------------------------------------------------------- |
---|
| 56 | |
---|
| 57 | #===================================================== |
---|
| 58 | # Global Variables : |
---|
| 59 | #===================================================== |
---|
| 60 | # Language : "fr" or "en" |
---|
| 61 | typeset -r MYLANG="fr" |
---|
| 62 | |
---|
| 63 | #===================================================== |
---|
[619] | 64 | # Host and user names |
---|
[217] | 65 | # $hostname ou hostname |
---|
[228] | 66 | typeset HOST=${HOST:=$( hostname )} |
---|
[70] | 67 | # $username ou whoami |
---|
[228] | 68 | typeset LOGIN=${LOGIN:=$( whoami )} |
---|
[70] | 69 | # $hostname of the MASTER job |
---|
[77] | 70 | typeset -r MASTER=vargas |
---|
[70] | 71 | |
---|
| 72 | #D- |
---|
| 73 | #D-#================================================== |
---|
| 74 | #D-Program used in libIGCM |
---|
| 75 | #D-#================================================== |
---|
| 76 | |
---|
| 77 | # rsync with path |
---|
| 78 | typeset -r RSYNC=/usr/local/bin/rsync |
---|
| 79 | # RSYNC_opt args to rsync |
---|
| 80 | typeset -r RSYNC_opt="-va" |
---|
[192] | 81 | # ie storage filesystem |
---|
[537] | 82 | typeset -r STOREHOST=gaya.idris.fr |
---|
[70] | 83 | typeset -r REMOTE_RSYNC=/u/rech/ces/rces452/RSYNC/bin/rsync |
---|
| 84 | |
---|
| 85 | #==================================================== |
---|
| 86 | # Host specific DIRECTORIES |
---|
| 87 | #==================================================== |
---|
| 88 | |
---|
| 89 | #==================================================== |
---|
| 90 | #- R_EXE (==> BIN_DIR = ${MODIPSL}/bin ) |
---|
| 91 | typeset -r R_EXE="${MODIPSL}/bin" |
---|
| 92 | |
---|
| 93 | #==================================================== |
---|
| 94 | #- SUBMIT_DIR : submission dir |
---|
| 95 | typeset SUBMIT_DIR=${SUBMIT_DIR:=${LOADL_STEP_INITDIR}} |
---|
| 96 | |
---|
| 97 | #==================================================== |
---|
[725] | 98 | #- IN |
---|
| 99 | typeset -r R_IN=${R_IN:=/u/rech/psl/rpsl035/IGCM} |
---|
| 100 | typeset -r R_IN_ECMWF=${R_IN_ECMWF:=/u/rech/psl/rpsl376} |
---|
| 101 | |
---|
| 102 | #==================================================== |
---|
[70] | 103 | #- ARCHIVE |
---|
[132] | 104 | typeset -r ARCHIVE=$( echo ${HOME} | sed -e "s/homegpfs/u/" ) |
---|
[70] | 105 | |
---|
| 106 | #==================================================== |
---|
[619] | 107 | #- Mirror libIGCM from vargas to ulam |
---|
[70] | 108 | typeset -r MirrorlibIGCM=${MirrorlibIGCM:=true} |
---|
| 109 | |
---|
| 110 | #==================================================== |
---|
| 111 | #- libIGCM_POST |
---|
[109] | 112 | PATHlibIGCM=$( echo ${libIGCM} | gawk -F"${LOGIN}/" '{print $2}' | sed -e "s&/libIGCM&&" ) |
---|
[132] | 113 | typeset -r HOME_POST=$( echo ${HOME} | sed -e "s/homegpfs/home/" ) |
---|
[192] | 114 | typeset -r libIGCM_POST=${HOME_POST}/MIRROR/${PATHlibIGCM}/libIGCM |
---|
[70] | 115 | |
---|
| 116 | #==================================================== |
---|
| 117 | #- OUT |
---|
| 118 | typeset -r R_OUT=${ARCHIVE}/IGCM_OUT |
---|
| 119 | |
---|
| 120 | #==================================================== |
---|
[619] | 121 | #- R_BUF Buffer to pack files |
---|
| 122 | typeset -r R_BUF=${WORKDIR}/IGCM_OUT |
---|
| 123 | |
---|
| 124 | #==================================================== |
---|
| 125 | #- OUT_POST |
---|
[132] | 126 | typeset -r R_OUT_POST=$( echo ${HOME} | sed -e "s/homegpfs/workdir/" )/IGCM_OUT |
---|
[70] | 127 | |
---|
| 128 | #==================================================== |
---|
| 129 | #- RUN_DIR_PATH : Temporary working directory (=> TMP) |
---|
| 130 | typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${TMPDIR}} |
---|
| 131 | |
---|
| 132 | #==================================================== |
---|
[156] | 133 | #- BIG_DIR : BIG_DIR to store files waiting for rebuild |
---|
[423] | 134 | typeset -r BIG_DIR=${BIG_DIR:=${WORKDIR}/REBUILD} |
---|
[156] | 135 | |
---|
| 136 | #==================================================== |
---|
[70] | 137 | #- HOST_MPIRUN_COMMAND |
---|
| 138 | typeset -r HOST_MPIRUN_COMMAND=${HOST_MPIRUN_COMMAND:="time poe"} |
---|
| 139 | |
---|
| 140 | #==================================================== |
---|
| 141 | #- Max number of arguments passed to nco operator or demigration command |
---|
[619] | 142 | UNIX_MAX_LIMIT=120 |
---|
[70] | 143 | |
---|
[619] | 144 | #==================================================== |
---|
| 145 | #- Default number of MPI task for IPSL coupled model |
---|
| 146 | #- required for backward compatibility |
---|
| 147 | #- |
---|
| 148 | DEFAULT_NUM_PROC_OCE=5 |
---|
| 149 | DEFAULT_NUM_PROC_CPL=1 |
---|
[644] | 150 | [ X${BATCH_NUM_PROC_TOT} = X ] || (( DEFAULT_NUM_PROC_ATM = BATCH_NUM_PROC_TOT - DEFAULT_NUM_PROC_OCE - DEFAULT_NUM_PROC_CPL )) |
---|
[637] | 151 | DEFAULT_NUM_PROC_TOTAL=${BATCH_NUM_PROC_TOT} |
---|
[619] | 152 | |
---|
[70] | 153 | #D-#================================================== |
---|
[725] | 154 | #D-function IGCM_sys_ChangeArchive |
---|
| 155 | #D-* Purpose: Just a dummy call on this machine |
---|
| 156 | #D-* Examples: |
---|
| 157 | #D- |
---|
| 158 | function IGCM_sys_ChangeArchive { |
---|
| 159 | |
---|
| 160 | IGCM_debug_Print 1 " dummy function : IGCM_sys_ChangeArchive " |
---|
| 161 | |
---|
| 162 | } |
---|
| 163 | |
---|
| 164 | #D-#================================================== |
---|
[537] | 165 | #D-function IGCM_sys_RshMaster |
---|
| 166 | #D-* Purpose: Connection to frontend machine. |
---|
| 167 | #D-* Examples: |
---|
| 168 | #D- |
---|
| 169 | (( RshMNum = 0 )) |
---|
| 170 | function IGCM_sys_RshMaster { |
---|
[619] | 171 | IGCM_debug_PushStack "IGCM_sys_RshMaster" $@ |
---|
[537] | 172 | |
---|
[619] | 173 | typeset THEFILE OUTFILE ERR |
---|
[537] | 174 | |
---|
[619] | 175 | RshDIR=${WORKDIR}/RUN_DIR/${config_UserChoices_TagName}/${config_UserChoices_JobName}.${$} |
---|
| 176 | if [ ! -d ${RshDIR} ] ; then |
---|
| 177 | IGCM_sys_Mkdir ${RshDIR} |
---|
| 178 | fi |
---|
| 179 | THEFILE=${RshDIR}/file_sys_RshMaster_$$_${RshMNum} |
---|
| 180 | echo '#!/bin/ksh' > ${THEFILE} |
---|
| 181 | echo "export libIGCM=${libIGCM} > /dev/null 2>&1" >> ${THEFILE} |
---|
| 182 | echo "export DEBUG_debug=${DEBUG_debug} > /dev/null 2>&1" >> ${THEFILE} |
---|
| 183 | echo ". ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh > /dev/null 2>&1" >> ${THEFILE} |
---|
| 184 | echo ". ${libIGCM}/libIGCM_card/libIGCM_card.ksh > /dev/null 2>&1" >> ${THEFILE} |
---|
| 185 | echo "${@} " >> ${THEFILE} |
---|
[537] | 186 | |
---|
[634] | 187 | # No frontend queue on brodie : just rsh the job on the frontend with submission. |
---|
[619] | 188 | sed -e "s@IGCM_sys_Qsub\(.*\)@\1@" ${THEFILE} > ${THEFILE}_ |
---|
[537] | 189 | |
---|
[619] | 190 | chmod u+x ${THEFILE}_ |
---|
[537] | 191 | |
---|
[619] | 192 | OUTFILE=${RshDIR}/out_RshMaster.$$.${RshMNum} |
---|
| 193 | (( RshMNum = RshMNum + 1 )) |
---|
[537] | 194 | |
---|
[619] | 195 | rsh ${MASTER} 'bash -c "nohup '${THEFILE}'_ > '${OUTFILE}' 2>&1 &"' |
---|
| 196 | if [ $? -gt 0 ] ; then |
---|
| 197 | echo "IGCM_sys_RshMaster : erreur." |
---|
| 198 | IGCM_debug_Exit "IGCM_sys_RshMaster" |
---|
| 199 | fi |
---|
| 200 | IGCM_debug_PopStack "IGCM_sys_RshMaster" |
---|
[537] | 201 | } |
---|
| 202 | |
---|
| 203 | #D-#================================================== |
---|
[70] | 204 | #D-function IGCM_sys_RshArchive |
---|
| 205 | #D-* Purpose: Archive rsh command |
---|
| 206 | #D-* Examples: |
---|
| 207 | #D- |
---|
| 208 | function IGCM_sys_RshArchive { |
---|
[619] | 209 | IGCM_debug_PushStack "IGCM_sys_RshArchive" $@ |
---|
| 210 | rsh ${STOREHOST} exec /bin/ksh <<-EOF |
---|
[70] | 211 | ${@} |
---|
| 212 | EOF |
---|
[619] | 213 | if [ $? -gt 0 ] ; then |
---|
| 214 | echo "IGCM_sys_RshArchive : erreur." |
---|
| 215 | IGCM_debug_Exit "IGCM_sys_RshArchive" |
---|
| 216 | fi |
---|
| 217 | IGCM_debug_PopStack "IGCM_sys_RshArchive" |
---|
[70] | 218 | } |
---|
| 219 | |
---|
| 220 | #D-#================================================== |
---|
| 221 | #D-function IGCM_sys_RshPost |
---|
| 222 | #D-* Purpose: Post-process rsh command |
---|
| 223 | #D-* Examples: |
---|
| 224 | #D- |
---|
| 225 | function IGCM_sys_RshPost { |
---|
[619] | 226 | IGCM_debug_PushStack "IGCM_sys_RshPost" $@ |
---|
| 227 | if ( $DEBUG_sys ) ; then |
---|
| 228 | echo "IGCM_sys_RshPost :" $@ |
---|
| 229 | fi |
---|
[479] | 230 | |
---|
[619] | 231 | # keep standard input to keep it for postpone if ulam don't answer |
---|
| 232 | cat >/tmp/tmp_IGCM_sys_RshPost_$$_${LOGNAME} |
---|
[479] | 233 | |
---|
[619] | 234 | ## Add submission for old postponed files only if command is a Qsub |
---|
| 235 | ## |
---|
| 236 | ISITQSUB=0 |
---|
| 237 | grep Qsub /tmp/tmp_IGCM_sys_RshPost_$$_${LOGNAME} >/dev/null 2>&1 && ISITQSUB=1 |
---|
| 238 | if ( [ ${ISITQSUB} -gt 0 ] ) ; then |
---|
| 239 | if [ -d ${SUBMIT_DIR}/POSTPONE ] ; then |
---|
| 240 | for postponed_file in ${SUBMIT_DIR}/POSTPONE/* ; do |
---|
| 241 | if [ -f ${postponed_file} ] ; then |
---|
| 242 | IGCM_debug_Print 2 " submit postponed file : " ${postponed_file} |
---|
| 243 | rsh ulam exec /bin/ksh <${postponed_file} |
---|
| 244 | if [ $? -eq 0 ] ; then |
---|
| 245 | IGCM_sys_Rm ${postponed_file} |
---|
| 246 | else |
---|
| 247 | IGCM_debug_Print 2 "keep postponed file for an other submission :" ${postponed_file} |
---|
| 248 | fi |
---|
| 249 | fi |
---|
| 250 | done |
---|
[70] | 251 | fi |
---|
[619] | 252 | fi |
---|
[479] | 253 | |
---|
[619] | 254 | RETURN=0 |
---|
| 255 | # rsh ulam command |
---|
| 256 | rsh ulam exec /bin/ksh </tmp/tmp_IGCM_sys_RshPost_$$_${LOGNAME} |
---|
| 257 | RETURN=$? |
---|
[479] | 258 | |
---|
[619] | 259 | # keep standard input for postpone if ulam don't answer |
---|
| 260 | if ( [ ${RETURN} -gt 0 ] ) ; then |
---|
| 261 | IGCM_debug_Print 2 "Postpone tmp_IGCM_sys_RshPost_$$_${LOGNAME}" |
---|
| 262 | [ -d ${SUBMIT_DIR}/POSTPONE ] || mkdir ${SUBMIT_DIR}/POSTPONE |
---|
| 263 | mv /tmp/tmp_IGCM_sys_RshPost_$$_${LOGNAME} ${SUBMIT_DIR}/POSTPONE |
---|
| 264 | else |
---|
| 265 | IGCM_sys_Rm /tmp/tmp_IGCM_sys_RshPost_$$_${LOGNAME} |
---|
| 266 | fi |
---|
| 267 | IGCM_debug_PopStack "IGCM_sys_RshPost" |
---|
[70] | 268 | } |
---|
| 269 | |
---|
| 270 | #D-#================================================== |
---|
[153] | 271 | #D-function IGCM_sys_SendMail |
---|
| 272 | #D-* Purpose: Send mail when simulation is over |
---|
| 273 | #D-* Examples: |
---|
| 274 | #D- |
---|
| 275 | function IGCM_sys_SendMail { |
---|
[619] | 276 | IGCM_debug_PushStack "IGCM_sys_SendMail" $@ |
---|
| 277 | if ( $DEBUG_sys ) ; then |
---|
| 278 | echo "IGCM_sys_SendMail :" $@ |
---|
| 279 | fi |
---|
[437] | 280 | |
---|
[619] | 281 | if ( ${ExitFlag} ) ; then |
---|
| 282 | status=failed |
---|
| 283 | else |
---|
| 284 | status=completed |
---|
| 285 | fi |
---|
| 286 | cat << END_MAIL > job_end.mail |
---|
[437] | 287 | Dear ${LOGIN}, |
---|
| 288 | |
---|
[453] | 289 | Simulation ${config_UserChoices_JobName} is ${status} on supercomputer `hostname`. |
---|
[153] | 290 | Job started : ${DateBegin} |
---|
| 291 | Job ended : ${DateEnd} |
---|
[434] | 292 | Output files are available in ${R_SAVE} |
---|
[453] | 293 | Script files, Script Outputs and Debug files (if necessary) are available in ${SUBMIT_DIR} |
---|
[153] | 294 | END_MAIL |
---|
| 295 | |
---|
[619] | 296 | if [ ! -z ${config_UserChoices_MailName} ] ; then |
---|
| 297 | mailx -s "${config_UserChoices_JobName} ${status}" ${config_UserChoices_MailName} < job_end.mail |
---|
| 298 | elif [ -f ~/.forward ] ; then |
---|
| 299 | mailx -s "${config_UserChoices_JobName} ${status}" $( cat ~/.forward ) < job_end.mail |
---|
| 300 | else |
---|
| 301 | mailx -s "${config_UserChoices_JobName} ${status}" ${USER} < job_end.mail |
---|
| 302 | fi |
---|
[153] | 303 | |
---|
[619] | 304 | if [ $? -gt 0 ] ; then |
---|
| 305 | echo "IGCM_sys_SendMail : erreur." |
---|
| 306 | IGCM_debug_Exit "IGCM_sys_SendMail" |
---|
| 307 | fi |
---|
| 308 | IGCM_debug_PopStack "IGCM_sys_SendMail" |
---|
[153] | 309 | } |
---|
| 310 | |
---|
| 311 | #D-#================================================== |
---|
[70] | 312 | #D-function IGCM_sys_Mkdir |
---|
| 313 | #D-* Purpose: Master locale mkdir command |
---|
| 314 | #D-* Examples: |
---|
| 315 | #D- |
---|
| 316 | function IGCM_sys_Mkdir { |
---|
[619] | 317 | IGCM_debug_PushStack "IGCM_sys_Mkdir" $@ |
---|
| 318 | if ( $DEBUG_sys ) ; then |
---|
| 319 | echo "IGCM_sys_Mkdir :" $@ |
---|
| 320 | fi |
---|
| 321 | if [ ! -d ${1} ]; then |
---|
| 322 | \mkdir -p $1 |
---|
| 323 | if [ $? -gt 0 ] ; then |
---|
| 324 | echo "IGCM_sys_Mkdir : erreur." |
---|
| 325 | IGCM_debug_Exit "IGCM_sys_Mkdir" |
---|
[70] | 326 | fi |
---|
[619] | 327 | fi |
---|
[70] | 328 | # vérification : |
---|
[619] | 329 | if [ ! -d ${1} ] ; then |
---|
| 330 | echo "IGCM_sys_Mkdir : erreur." |
---|
| 331 | IGCM_debug_Exit "IGCM_sys_Mkdir" |
---|
| 332 | fi |
---|
| 333 | IGCM_debug_PopStack "IGCM_sys_Mkdir" |
---|
[70] | 334 | } |
---|
| 335 | |
---|
| 336 | #D-#================================================== |
---|
| 337 | #D-function IGCM_sys_MkdirArchive |
---|
| 338 | #D-* Purpose: Mkdir on Archive |
---|
| 339 | #D-* Examples: |
---|
| 340 | #D- |
---|
| 341 | function IGCM_sys_MkdirArchive { |
---|
[619] | 342 | IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@ |
---|
| 343 | if ( $DEBUG_sys ) ; then |
---|
| 344 | echo "IGCM_sys_MkdirArchive :" $@ |
---|
| 345 | fi |
---|
| 346 | #- creation de repertoire sur le serveur fichier |
---|
| 347 | rsh ${STOREHOST} -n mkdir -p $1 |
---|
[70] | 348 | |
---|
[619] | 349 | if [ $? -gt 0 ] ; then |
---|
| 350 | echo "IGCM_sys_MkdirArchive : erreur." |
---|
| 351 | IGCM_debug_Exit "IGCM_sys_MkdirArchive" |
---|
| 352 | fi |
---|
| 353 | IGCM_debug_PopStack "IGCM_sys_MkdirArchive" |
---|
[70] | 354 | } |
---|
| 355 | |
---|
| 356 | #D-#================================================== |
---|
| 357 | #D-function IGCM_sys_MkdirWork |
---|
| 358 | #D-* Purpose: Mkdir on Work |
---|
| 359 | #D-* Examples: |
---|
| 360 | #D- |
---|
| 361 | function IGCM_sys_MkdirWork { |
---|
[619] | 362 | IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@ |
---|
| 363 | if ( $DEBUG_sys ) ; then |
---|
| 364 | echo "IGCM_sys_MkdirWork :" $@ |
---|
| 365 | fi |
---|
| 366 | #- creation de repertoire sur le serveur fichier |
---|
| 367 | if [ ! -d ${1} ]; then |
---|
| 368 | \mkdir -p $1 |
---|
| 369 | if [ $? -gt 0 ] ; then |
---|
| 370 | echo "IGCM_sys_MkdirWork : erreur." |
---|
| 371 | IGCM_debug_Exit "IGCM_sys_MkdirWork" |
---|
[70] | 372 | fi |
---|
[619] | 373 | fi |
---|
| 374 | IGCM_debug_PopStack "IGCM_sys_MkdirWork" |
---|
[70] | 375 | } |
---|
| 376 | |
---|
| 377 | #D-#================================================== |
---|
| 378 | #D-function IGCM_sys_Cd |
---|
| 379 | #D-* Purpose: master cd command |
---|
| 380 | #D-* Examples: |
---|
| 381 | #D- |
---|
| 382 | function IGCM_sys_Cd { |
---|
[619] | 383 | IGCM_debug_PushStack "IGCM_sys_Cd" $@ |
---|
| 384 | if ( $DEBUG_sys ) ; then |
---|
| 385 | echo "IGCM_sys_Cd :" $@ |
---|
| 386 | fi |
---|
| 387 | \cd $1 |
---|
| 388 | if [ $? -gt 0 ] ; then |
---|
| 389 | echo "IGCM_sys_Cd : erreur." |
---|
| 390 | IGCM_debug_Exit "IGCM_sys_Cd" |
---|
| 391 | fi |
---|
| 392 | IGCM_debug_PopStack "IGCM_sys_Cd" |
---|
[70] | 393 | } |
---|
| 394 | |
---|
| 395 | #D-#================================================== |
---|
| 396 | #D-function IGCM_sys_Chmod |
---|
| 397 | #D-* Purpose: Chmod |
---|
| 398 | #D-* Examples: |
---|
| 399 | #D- |
---|
| 400 | function IGCM_sys_Chmod { |
---|
[619] | 401 | IGCM_debug_PushStack "IGCM_sys_Chmod" -- $@ |
---|
| 402 | if ( $DEBUG_sys ) ; then |
---|
| 403 | echo "IGCM_sys_Chmod :" $@ |
---|
| 404 | fi |
---|
| 405 | if [ $DRYRUN -le 1 ]; then |
---|
| 406 | \chmod $@ |
---|
| 407 | if [ $? -gt 0 ] ; then |
---|
| 408 | echo "IGCM_sys_Chmod : erreur." |
---|
| 409 | IGCM_debug_Exit "IGCM_sys_Chmod" |
---|
[70] | 410 | fi |
---|
[619] | 411 | else |
---|
| 412 | ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack |
---|
| 413 | fi |
---|
| 414 | IGCM_debug_PopStack "IGCM_sys_Chmod" |
---|
[70] | 415 | } |
---|
| 416 | |
---|
| 417 | #D-#================================================== |
---|
| 418 | #D-function IGCM_sys_FileSize |
---|
| 419 | #D-* Purpose: Filesize |
---|
| 420 | #D-* Examples: |
---|
| 421 | #D- |
---|
| 422 | function IGCM_sys_FileSize { |
---|
[619] | 423 | IGCM_debug_PushStack "IGCM_sys_FileSize" $@ |
---|
[70] | 424 | |
---|
[619] | 425 | typeset sizeF |
---|
| 426 | set +A sizeF -- $( ls -la ${1} ) |
---|
| 427 | if [ $? -gt 0 ] ; then |
---|
| 428 | IGCM_debug_Exit "IGCM_sys_FileSize" |
---|
| 429 | fi |
---|
| 430 | eval ${2}=${sizeF[4]} |
---|
[70] | 431 | |
---|
[619] | 432 | IGCM_debug_PopStack "IGCM_sys_FileSize" |
---|
[70] | 433 | } |
---|
| 434 | |
---|
| 435 | #D-#================================================== |
---|
| 436 | #D-function IGCM_sys_TestDir |
---|
| 437 | #D-* Purpose: Test Directory that must exists |
---|
| 438 | #D-* Examples: |
---|
| 439 | #D- |
---|
| 440 | function IGCM_sys_TestDir { |
---|
[619] | 441 | IGCM_debug_PushStack "IGCM_sys_TestDir" $@ |
---|
| 442 | if ( $DEBUG_sys ) ; then |
---|
| 443 | echo "IGCM_sys_TestDir :" $@ |
---|
| 444 | fi |
---|
| 445 | typeset ExistFlag |
---|
| 446 | ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 ) |
---|
| 447 | IGCM_debug_PopStack "IGCM_sys_TestDir" |
---|
[70] | 448 | |
---|
[619] | 449 | return ${ExistFlag} |
---|
[70] | 450 | } |
---|
| 451 | |
---|
| 452 | #D-#================================================== |
---|
| 453 | #D-function IGCM_sys_TestDirArchive |
---|
| 454 | #D-* Purpose: Test Directory that must exists on Archive |
---|
| 455 | #D-* Examples: |
---|
| 456 | #D- |
---|
| 457 | function IGCM_sys_TestDirArchive { |
---|
[619] | 458 | IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@ |
---|
| 459 | if ( $DEBUG_sys ) ; then |
---|
| 460 | echo "IGCM_sys_TestDirArchive :" $@ |
---|
| 461 | fi |
---|
| 462 | typeset ExistFlag |
---|
| 463 | ExistFlag=$( IGCM_sys_RshArchive "[ -d $1 ] && echo 0 || echo 1" ) |
---|
| 464 | IGCM_debug_PopStack "IGCM_sys_TestDirArchive" |
---|
[70] | 465 | |
---|
[619] | 466 | return ${ExistFlag} |
---|
[70] | 467 | } |
---|
| 468 | |
---|
| 469 | #D-#================================================== |
---|
[619] | 470 | #D-function IGCM_sys_IsFileArchived |
---|
| 471 | #D-* Purpose: Test file that must NOT EXISTS on Archive |
---|
| 472 | #D-* always true on vargas. |
---|
| 473 | #D-* Examples: |
---|
| 474 | #D- |
---|
| 475 | function IGCM_sys_IsFileArchived { |
---|
| 476 | IGCM_debug_PushStack "IGCM_sys_IsFileArchived" $@ |
---|
| 477 | if ( $DEBUG_sys ) ; then |
---|
| 478 | echo "IGCM_sys_IsFileArchived :" $@ |
---|
| 479 | fi |
---|
| 480 | typeset IsArchivedFlag |
---|
| 481 | IsArchivedFlag=$( echo 0 ) |
---|
| 482 | IGCM_debug_PopStack "IGCM_sys_IsFileArchived" |
---|
| 483 | |
---|
| 484 | return ${IsArchivedFlag} |
---|
| 485 | } |
---|
| 486 | |
---|
| 487 | #D-#================================================== |
---|
[70] | 488 | #D-function IGCM_sys_TestFileArchive |
---|
| 489 | #D-* Purpose: Test file that must NOT EXISTS on Archive |
---|
| 490 | #D-* Examples: |
---|
| 491 | #D- |
---|
| 492 | function IGCM_sys_TestFileArchive { |
---|
[619] | 493 | IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@ |
---|
| 494 | typeset ExistFlag |
---|
| 495 | ExistFlag=$( IGCM_sys_RshArchive "[ -f $1 ] && echo 0 || echo 1" ) |
---|
| 496 | IGCM_debug_PopStack "IGCM_sys_TestFileArchive" |
---|
[70] | 497 | |
---|
[619] | 498 | return ${ExistFlag} |
---|
[70] | 499 | } |
---|
| 500 | |
---|
| 501 | #D-#================================================== |
---|
[619] | 502 | #D-function IGCM_sys_TestFileBuffer |
---|
| 503 | #D-* Purpose: Test file that must NOT EXISTS on Buffer |
---|
| 504 | #D-* Examples: |
---|
| 505 | #D- |
---|
| 506 | function IGCM_sys_TestFileBuffer { |
---|
| 507 | IGCM_debug_PushStack "IGCM_sys_TestFileBuffer" $@ |
---|
| 508 | typeset ExistFlag |
---|
| 509 | ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 ) |
---|
| 510 | IGCM_debug_PopStack "IGCM_sys_TestFileBuffer" |
---|
| 511 | |
---|
| 512 | return ${ExistFlag} |
---|
| 513 | } |
---|
| 514 | |
---|
| 515 | #D-#================================================== |
---|
[70] | 516 | #D-function IGCM_sys_CountFileArchive |
---|
| 517 | #D-* Purpose: Count files on Archive filesystem |
---|
| 518 | #D-* Examples: |
---|
| 519 | #D- |
---|
| 520 | function IGCM_sys_CountFileArchive { |
---|
[619] | 521 | IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@ |
---|
| 522 | IGCM_sys_RshArchive "ls ${@} 2>/dev/null | wc -l" |
---|
| 523 | if [ $? -gt 0 ] ; then |
---|
| 524 | echo "IGCM_sys_CountFileArchive : erreur." |
---|
| 525 | fi |
---|
| 526 | IGCM_debug_PopStack "IGCM_sys_CountFileArchive" |
---|
[70] | 527 | } |
---|
| 528 | |
---|
| 529 | #D-#================================================== |
---|
[619] | 530 | #D-function IGCM_sys_CountFileBuffer |
---|
| 531 | #D-* Purpose: Count files on Scratch filesystem |
---|
| 532 | #D-* Examples: |
---|
| 533 | #D- |
---|
| 534 | function IGCM_sys_CountFileBuffer { |
---|
| 535 | IGCM_debug_PushStack "IGCM_sys_CountFileBuffer" $@ |
---|
| 536 | ls ${@} 2>/dev/null | wc -l |
---|
| 537 | if [ $? -gt 0 ] ; then |
---|
| 538 | echo "IGCM_sys_CountFileBuffer : erreur." |
---|
| 539 | fi |
---|
| 540 | IGCM_debug_PopStack "IGCM_sys_CountFileBuffer" |
---|
| 541 | } |
---|
| 542 | |
---|
| 543 | #D-#================================================== |
---|
[70] | 544 | #D-function IGCM_sys_Tree |
---|
| 545 | #D-* Purpose: Tree directories with files on ${ARCHIVE} |
---|
| 546 | #D-* Examples: IGCM_sys_Tree ${R_IN} ${R_OUT} |
---|
| 547 | #D- |
---|
| 548 | function IGCM_sys_Tree { |
---|
[619] | 549 | IGCM_debug_PushStack "IGCM_sys_Tree" $@ |
---|
| 550 | if ( $DEBUG_sys ) ; then |
---|
| 551 | echo "IGCM_sys_Tree :" $@ |
---|
| 552 | fi |
---|
[70] | 553 | |
---|
[619] | 554 | \mfls -r $@ |
---|
[70] | 555 | |
---|
[619] | 556 | IGCM_debug_PopStack "IGCM_sys_Tree" |
---|
[70] | 557 | } |
---|
| 558 | |
---|
| 559 | #D-#================================================== |
---|
| 560 | #D-function IGCM_sys_Tar |
---|
| 561 | #D-* Purpose: master un-tar command |
---|
| 562 | #D-* Examples: |
---|
| 563 | #D- |
---|
| 564 | function IGCM_sys_Tar { |
---|
[619] | 565 | IGCM_debug_PushStack "IGCM_sys_Tar" $@ |
---|
| 566 | if ( $DEBUG_sys ) ; then |
---|
| 567 | echo "IGCM_sys_Tar :" $@ |
---|
| 568 | fi |
---|
| 569 | \tar cf $@ |
---|
| 570 | if [ $? -gt 0 ] ; then |
---|
| 571 | echo "IGCM_sys_Tar : erreur." |
---|
| 572 | IGCM_debug_Exit "IGCM_sys_Tar" |
---|
| 573 | fi |
---|
| 574 | IGCM_debug_PopStack "IGCM_sys_Tar" |
---|
[70] | 575 | } |
---|
| 576 | |
---|
| 577 | #D-#================================================== |
---|
| 578 | #D-function IGCM_sys_UnTar |
---|
| 579 | #D-* Purpose: master un-tar command |
---|
| 580 | #D-* Examples: |
---|
| 581 | #D- |
---|
| 582 | function IGCM_sys_UnTar { |
---|
[619] | 583 | IGCM_debug_PushStack "IGCM_sys_UnTar" $@ |
---|
| 584 | if ( $DEBUG_sys ) ; then |
---|
| 585 | echo "IGCM_sys_UnTar :" $@ |
---|
| 586 | fi |
---|
| 587 | \tar xvf $1 |
---|
| 588 | if [ $? -gt 0 ] ; then |
---|
| 589 | echo "IGCM_sys_UnTar : erreur." |
---|
| 590 | IGCM_debug_Exit "IGCM_sys_UnTar" |
---|
| 591 | fi |
---|
| 592 | IGCM_debug_PopStack "IGCM_sys_UnTar" |
---|
[70] | 593 | } |
---|
| 594 | |
---|
| 595 | #D-#================================================== |
---|
| 596 | #D-function IGCM_sys_Qsub |
---|
| 597 | #D-* Purpose: Qsub new job |
---|
| 598 | #D-* Examples: |
---|
| 599 | #D- |
---|
| 600 | function IGCM_sys_Qsub { |
---|
[619] | 601 | IGCM_debug_PushStack "IGCM_sys_Qsub" $@ |
---|
[476] | 602 | |
---|
[619] | 603 | typeset ERROR |
---|
| 604 | ERROR=0 |
---|
| 605 | |
---|
| 606 | if ( $DEBUG_sys ) ; then |
---|
| 607 | echo "IGCM_sys_Qsub :" $@ |
---|
| 608 | fi |
---|
| 609 | # We have to change output/error file |
---|
| 610 | [ ${#@} = 1 ] && REP_FOR_JOB=$LOADL_STEP_INITDIR |
---|
| 611 | [ ${#@} = 2 ] && REP_FOR_JOB=$2 |
---|
| 612 | sed -e "s/\# \@ output *= .*/\# \@ output = ${Script_Output}/" -e "s/\# \@ error *= .*/\# \@ error = ${Script_Output}/" <$1 >${REP_FOR_JOB}/JOB_FOR_IGCM |
---|
| 613 | { |
---|
| 614 | [ ${#@} = 1 ] && ( cd $LOADL_STEP_INITDIR ; /usr/local/bin/llsubmit JOB_FOR_IGCM ; ERROR=$? ; cd - ; ) |
---|
| 615 | [ ${#@} = 2 ] && ( cd $2 ; /usr/local/bin/llsubmit JOB_FOR_IGCM ; ERROR=$? ; cd - ; ) |
---|
| 616 | } |
---|
| 617 | if [ ${ERROR} -gt 0 ] ; then |
---|
| 618 | echo "IGCM_sys_Qsub : erreur $@." |
---|
| 619 | IGCM_debug_Exit "IGCM_sys_Qsub" |
---|
| 620 | fi |
---|
| 621 | IGCM_sys_Rm ${REP_FOR_JOB}/JOB_FOR_IGCM |
---|
| 622 | IGCM_debug_PopStack "IGCM_sys_Qsub" |
---|
| 623 | |
---|
[70] | 624 | } |
---|
| 625 | |
---|
| 626 | #D-#================================================== |
---|
| 627 | #D-function IGCM_sys_QsubPost |
---|
| 628 | #D-* Purpose: Qsub new job on scalaire |
---|
| 629 | #D-* Examples: |
---|
| 630 | #D- |
---|
| 631 | function IGCM_sys_QsubPost { |
---|
[619] | 632 | IGCM_debug_PushStack "IGCM_sys_QsubPost" $@ |
---|
| 633 | if ( $DEBUG_sys ) ; then |
---|
| 634 | echo "IGCM_sys_QsubPost :" $@ |
---|
| 635 | fi |
---|
| 636 | cd ${POST_DIR} |
---|
| 637 | /opt/ibmll/LoadL/full/bin/llsubmit ${libIGCM_POST}/$1.job |
---|
| 638 | cd - |
---|
| 639 | if [ $? -gt 0 ] ; then |
---|
| 640 | echo "IGCM_sys_QsubPost : erreur " $@ |
---|
| 641 | IGCM_debug_Exit "IGCM_sys_QsubPost" |
---|
| 642 | fi |
---|
| 643 | IGCM_debug_PopStack "IGCM_sys_QsubPost" |
---|
[70] | 644 | } |
---|
| 645 | |
---|
| 646 | #D-************************* |
---|
[619] | 647 | #D- File transfer functions |
---|
[70] | 648 | #D-************************* |
---|
| 649 | #D- |
---|
| 650 | |
---|
| 651 | #D-#================================================== |
---|
| 652 | #D-function IGCM_sys_Rsync_out |
---|
| 653 | #D-* Purpose: treat return val of rsync |
---|
| 654 | #D-* Examples: IGCM_sys_Rsync_out out_RET_rsync |
---|
| 655 | #D- Error values and explanations can depend on your system version. |
---|
| 656 | function IGCM_sys_Rsync_out { |
---|
[719] | 657 | status=$1 |
---|
| 658 | if [ ! $status ] ; then |
---|
[619] | 659 | echo "rsync error !" |
---|
| 660 | fi |
---|
[70] | 661 | |
---|
[619] | 662 | if [ $MYLANG = "fr" ]; then |
---|
[719] | 663 | case $status in |
---|
[619] | 664 | 0) return ;; |
---|
| 665 | 1) echo "Erreur de rsync ; RERR_SYNTAX : " |
---|
| 666 | echo "Erreur de syntaxe ou d'utilisation." |
---|
| 667 | return;; |
---|
| 668 | 2) echo "Erreur de rsync ; RERR_PROTOCOL : " |
---|
| 669 | echo "Incompatibilité de protocole." |
---|
| 670 | return;; |
---|
| 671 | 3) echo "Erreur de rsync ; RERR_FILESELECT 3" |
---|
| 672 | echo "Erreurs lors de la sélection des fichiers d'entrée sortie et" |
---|
| 673 | echo "répertoires" |
---|
| 674 | return;; |
---|
| 675 | 4) echo "Erreur de rsync ; RERR_UNSUPPORTED" |
---|
| 676 | echo "Action demandée non supportée : une tentative de manipulation de" |
---|
| 677 | echo "fichiers 64-bits sur une plate-forme qui ne les supporte pas a" |
---|
| 678 | echo "été faite ; ou une option qui est supportée par le client mais" |
---|
| 679 | echo "pas par le serveur a été spécifiée." |
---|
| 680 | return;; |
---|
| 681 | 10) echo "Erreur de rsync ; RERR_SOCKETIO" |
---|
| 682 | echo "Erreur dans le socket d'entrée sortie" |
---|
| 683 | return;; |
---|
| 684 | 11) echo "Erreur de rsync ; RERR_FILEIO" |
---|
| 685 | echo "Erreur d'entrée sortie fichier" |
---|
| 686 | return;; |
---|
| 687 | 12) echo "Erreur de rsync ; RERR_STREAMIO" |
---|
| 688 | echo "Erreur dans flux de donnée du protocole rsync" |
---|
| 689 | return;; |
---|
| 690 | 13) echo "Erreur de rsync ; RERR_MESSAGEIO" |
---|
| 691 | echo "Erreur avec les diagnostics du programme" |
---|
| 692 | return;; |
---|
| 693 | 14) echo "Erreur de rsync ; RERR_IPC" |
---|
| 694 | echo "Erreur dans le code IPC" |
---|
| 695 | return;; |
---|
| 696 | 20) echo "Erreur de rsync ; RERR_SIGNAL" |
---|
| 697 | echo "SIGUSR1 ou SIGINT reçu" |
---|
| 698 | return;; |
---|
| 699 | 21) echo "Erreur de rsync ; RERR_WAITCHILD" |
---|
| 700 | echo "Une erreur retournée par waitpid()" |
---|
| 701 | return;; |
---|
| 702 | 22) echo "Erreur de rsync ; RERR_MALLOC" |
---|
| 703 | echo "Erreur lors de l'allocation des tampons de mémoire de coeur" |
---|
| 704 | return;; |
---|
| 705 | 23) echo "" |
---|
| 706 | echo "Erreur fichier inexistant" |
---|
| 707 | return;; |
---|
| 708 | 30) echo "Erreur de rsync ; RERR_TIMEOUT" |
---|
| 709 | echo "Temps d'attente écoulé dans l'envoi/réception de données" |
---|
| 710 | return;; |
---|
[719] | 711 | *) echo "Erreur de rsync : code de retour de rsync inconnu :" $status |
---|
[619] | 712 | return;; |
---|
| 713 | esac |
---|
| 714 | elif [ $MYLANG = "en" ] ; then |
---|
[719] | 715 | case $status in |
---|
[619] | 716 | 0) return;; |
---|
| 717 | 1) echo "rsync error : Syntax or usage error " |
---|
| 718 | return;; |
---|
| 719 | 2) echo "rsync error : Protocol incompatibility " |
---|
| 720 | return;; |
---|
| 721 | 3) echo "rsync error : Errors selecting input/output files, dirs" |
---|
| 722 | return;; |
---|
| 723 | 4) echo "rsync error : Requested action not supported: an attempt" |
---|
| 724 | echo "was made to manipulate 64-bit files on a platform that cannot support" |
---|
| 725 | echo "them; or an option was specified that is supported by the client and" |
---|
| 726 | echo "not by the server." |
---|
| 727 | return;; |
---|
| 728 | 5) echo "rsync error : Error starting client-server protocol" |
---|
| 729 | return;; |
---|
| 730 | 10) echo "rsync error : Error in socket I/O " |
---|
| 731 | return;; |
---|
| 732 | 11) echo "rsync error : Error in file I/O " |
---|
| 733 | return;; |
---|
| 734 | 12) echo "rsync error : Error in rsync protocol data stream " |
---|
| 735 | return;; |
---|
| 736 | 13) echo "rsync error : Errors with program diagnostics " |
---|
| 737 | return;; |
---|
| 738 | 14) echo "rsync error : Error in IPC code " |
---|
| 739 | return;; |
---|
| 740 | 20) echo "rsync error : Received SIGUSR1 or SIGINT " |
---|
| 741 | return;; |
---|
| 742 | 21) echo "rsync error : Some error returned by waitpid() " |
---|
| 743 | return;; |
---|
| 744 | 22) echo "rsync error : Error allocating core memory buffers " |
---|
| 745 | return;; |
---|
| 746 | 23) echo "rsync error : Partial transfer due to error" |
---|
| 747 | return;; |
---|
| 748 | 24) echo "rsync error : Partial transfer due to vanished source files" |
---|
| 749 | return;; |
---|
| 750 | 30) echo "rsync error : Timeout in data send/receive " |
---|
| 751 | return;; |
---|
[719] | 752 | *) echo "rsync error : return code of rsync unknown :" $status |
---|
[619] | 753 | return;; |
---|
| 754 | esac |
---|
| 755 | else |
---|
| 756 | echo "unknown language $MYLANG." |
---|
| 757 | return |
---|
| 758 | fi |
---|
[70] | 759 | } |
---|
| 760 | |
---|
| 761 | #D-#================================================== |
---|
| 762 | #D-function IGCM_sys_Miror_libIGCM |
---|
| 763 | #D-* Purpose: Mirror libIGCM PATH and lib to ulam |
---|
| 764 | #D-* Examples: |
---|
| 765 | #D- |
---|
| 766 | function IGCM_sys_Mirror_libIGCM { |
---|
[619] | 767 | IGCM_debug_PushStack "IGCM_sys_Mirror_libIGCM" |
---|
| 768 | if ( $DEBUG_sys ) ; then |
---|
| 769 | echo "IGCM_sys_Mirror_libIGCM" |
---|
| 770 | fi |
---|
[70] | 771 | |
---|
[719] | 772 | typeset status |
---|
[70] | 773 | |
---|
[619] | 774 | IGCM_sys_RshPost <<-EOF |
---|
[193] | 775 | mkdir -p ${HOME_POST}/MIRROR/${PATHlibIGCM} |
---|
[70] | 776 | EOF |
---|
[619] | 777 | rsh ulam -n hostname > /dev/null 2>&1 |
---|
[719] | 778 | status=$? |
---|
| 779 | if [ $status -eq 0 ] ; then |
---|
[619] | 780 | echo ${RSYNC} ${RSYNC_opt} -e "rsh " ${libIGCM} ulam:${HOME_POST}/MIRROR/${PATHlibIGCM} > out_rsync 2>&1 |
---|
| 781 | ${RSYNC} ${RSYNC_opt} -e "rsh " ${libIGCM} ulam:${HOME_POST}/MIRROR/${PATHlibIGCM} >> out_rsync 2>&1 |
---|
[719] | 782 | status=$? |
---|
[70] | 783 | |
---|
[719] | 784 | if [ ${status} -gt 0 ] ; then |
---|
[619] | 785 | echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on ulam." |
---|
| 786 | cat out_rsync |
---|
[70] | 787 | fi |
---|
[619] | 788 | IGCM_sys_Rm out_rsync |
---|
| 789 | else |
---|
| 790 | echo "No POST-TREATMENT avaible because ulam is down." |
---|
| 791 | fi |
---|
| 792 | IGCM_debug_PopStack "IGCM_sys_Mirror_libIGCM" |
---|
[70] | 793 | } |
---|
| 794 | |
---|
| 795 | #D-#================================================== |
---|
| 796 | #D-function IGCM_sys_Cp |
---|
| 797 | #D-* Purpose: generic cp |
---|
| 798 | #D-* Examples: |
---|
| 799 | #D- |
---|
| 800 | function IGCM_sys_Cp { |
---|
[619] | 801 | IGCM_debug_PushStack "IGCM_sys_Cp" $@ |
---|
| 802 | if ( $DEBUG_sys ) ; then |
---|
| 803 | echo "IGCM_sys_Cp :" $@ |
---|
| 804 | fi |
---|
[70] | 805 | |
---|
[719] | 806 | typeset status |
---|
[70] | 807 | |
---|
[619] | 808 | echo cp $@ > out_rsync 2>&1 |
---|
| 809 | \cp $@ >> out_rsync 2>&1 |
---|
[719] | 810 | status=$? |
---|
[70] | 811 | |
---|
[719] | 812 | if [ ${status} -gt 0 ] ; then |
---|
[619] | 813 | echo "IGCM_sys_Cp : error." |
---|
| 814 | cat out_rsync |
---|
| 815 | IGCM_debug_Exit "IGCM_sys_Cp" |
---|
| 816 | else |
---|
| 817 | \rm out_rsync |
---|
| 818 | fi |
---|
| 819 | IGCM_debug_PopStack "IGCM_sys_Cp" |
---|
[70] | 820 | } |
---|
| 821 | |
---|
| 822 | #D-#================================================== |
---|
[92] | 823 | #D-function IGCM_sys_Rm |
---|
| 824 | #D-* Purpose: generic rm |
---|
| 825 | #D-* Examples: |
---|
| 826 | #D- |
---|
| 827 | function IGCM_sys_Rm { |
---|
[619] | 828 | IGCM_debug_PushStack "IGCM_sys_Rm" -- $@ |
---|
| 829 | if ( $DEBUG_sys ) ; then |
---|
| 830 | echo "IGCM_sys_Rm :" $@ |
---|
| 831 | fi |
---|
[92] | 832 | |
---|
[719] | 833 | typeset status |
---|
[92] | 834 | |
---|
[619] | 835 | echo rm $@ > out_rsync 2>&1 |
---|
| 836 | \rm $@ >> out_rsync 2>&1 |
---|
[719] | 837 | status=$? |
---|
[92] | 838 | |
---|
[719] | 839 | if [ ${status} -gt 0 ] ; then |
---|
[619] | 840 | echo "IGCM_sys_Rm : error." |
---|
| 841 | cat out_rsync |
---|
| 842 | IGCM_debug_Exit "IGCM_sys_Rm" |
---|
| 843 | else |
---|
| 844 | \rm out_rsync |
---|
| 845 | fi |
---|
| 846 | IGCM_debug_PopStack "IGCM_sys_Rm" |
---|
[92] | 847 | } |
---|
| 848 | |
---|
| 849 | #D-#================================================== |
---|
[203] | 850 | #D-function IGCM_sys_RmRunDir |
---|
| 851 | #D-* Purpose: rm tmpdir (dummy function most of the time batch |
---|
| 852 | #D- scheduler will do the job) |
---|
| 853 | #D-* Examples: |
---|
| 854 | #D- |
---|
| 855 | function IGCM_sys_RmRunDir { |
---|
[619] | 856 | IGCM_debug_PushStack "IGCM_sys_RmRunDir" -- $@ |
---|
| 857 | if ( $DEBUG_sys ) ; then |
---|
| 858 | echo "IGCM_sys_RmRunDir :" $@ |
---|
| 859 | echo "Dummy call, let the scheduler do that." |
---|
| 860 | fi |
---|
| 861 | IGCM_debug_PopStack "IGCM_sys_RmRunDir" |
---|
[203] | 862 | } |
---|
| 863 | |
---|
| 864 | #D-#================================================== |
---|
[70] | 865 | #D-function IGCM_sys_Mv |
---|
| 866 | #D-* Purpose: generic move |
---|
| 867 | #D-* Examples: |
---|
| 868 | #D- |
---|
| 869 | function IGCM_sys_Mv { |
---|
[619] | 870 | IGCM_debug_PushStack "IGCM_sys_Mv" $@ |
---|
| 871 | if ( $DEBUG_sys ) ; then |
---|
| 872 | echo "IGCM_sys_Mv :" $@ |
---|
| 873 | fi |
---|
[70] | 874 | |
---|
[619] | 875 | if [ $DRYRUN = 0 ]; then |
---|
[70] | 876 | |
---|
[719] | 877 | typeset status |
---|
[619] | 878 | |
---|
| 879 | echo mv $@ > out_rsync 2>&1 |
---|
| 880 | \mv $@ >> out_rsync 2>&1 |
---|
[719] | 881 | status=$? |
---|
[619] | 882 | |
---|
[719] | 883 | if [ ${status} -gt 0 ] ; then |
---|
[619] | 884 | echo "IGCM_sys_Mv : error in mv." |
---|
| 885 | cat out_rsync |
---|
| 886 | IGCM_debug_Exit "IGCM_sys_Mv" |
---|
[173] | 887 | else |
---|
[619] | 888 | \rm out_rsync |
---|
[70] | 889 | fi |
---|
[619] | 890 | else |
---|
| 891 | ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack |
---|
| 892 | fi |
---|
[70] | 893 | |
---|
[619] | 894 | IGCM_debug_PopStack "IGCM_sys_Mv" |
---|
[70] | 895 | } |
---|
| 896 | |
---|
| 897 | #D-#================================================== |
---|
| 898 | #D-function IGCM_sys_Put_Dir |
---|
| 899 | #D-* Purpose: Copy a complete directory on $(ARCHIVE) |
---|
| 900 | #D-* Examples: |
---|
| 901 | #D- |
---|
| 902 | function IGCM_sys_Put_Dir { |
---|
[619] | 903 | IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@ |
---|
| 904 | if ( $DEBUG_sys ) ; then |
---|
| 905 | echo "IGCM_sys_Put_Dir :" $@ |
---|
| 906 | fi |
---|
| 907 | if [ $DRYRUN = 0 ]; then |
---|
| 908 | if [ ! -d ${1} ] ; then |
---|
| 909 | echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ." |
---|
| 910 | IGCM_debug_PopStack "IGCM_sys_Put_Dir" |
---|
| 911 | return |
---|
[70] | 912 | fi |
---|
| 913 | |
---|
[719] | 914 | typeset status |
---|
[70] | 915 | |
---|
[619] | 916 | # Only if we use rsync |
---|
| 917 | #IGCM_sys_TestDirArchive $( dirname $2 ) |
---|
| 918 | # |
---|
| 919 | #USUAL WAY |
---|
| 920 | rcp -r $1 ${STOREHOST}:$2 > out_rsync 2>&1 |
---|
[719] | 921 | status=$? |
---|
[70] | 922 | |
---|
[719] | 923 | if [ ${status} -gt 0 ] ; then |
---|
[619] | 924 | echo "IGCM_sys_Put_Dir : error." |
---|
| 925 | cat out_rsync |
---|
| 926 | IGCM_debug_Exit "IGCM_sys_Put_Dir" |
---|
[70] | 927 | else |
---|
[619] | 928 | \rm out_rsync |
---|
[70] | 929 | fi |
---|
[619] | 930 | else |
---|
| 931 | ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack |
---|
| 932 | fi |
---|
| 933 | IGCM_debug_PopStack "IGCM_sys_Put_Dir" |
---|
[70] | 934 | } |
---|
| 935 | |
---|
| 936 | #D-#================================================== |
---|
| 937 | #D-function IGCM_sys_Get_Dir |
---|
| 938 | #D-* Purpose: Copy a complete directory from $(ARCHIVE) |
---|
| 939 | #D-* Examples: |
---|
| 940 | #D- |
---|
| 941 | function IGCM_sys_Get_Dir { |
---|
[619] | 942 | IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@ |
---|
| 943 | if ( $DEBUG_sys ) ; then |
---|
| 944 | echo "IGCM_sys_Get_Dir :" $@ |
---|
| 945 | fi |
---|
| 946 | if [ $DRYRUN = 0 ]; then |
---|
| 947 | if [ ! -d ${1} ] ; then |
---|
| 948 | echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ." |
---|
| 949 | IGCM_debug_PopStack "IGCM_sys_Get_Dir" |
---|
| 950 | return |
---|
[70] | 951 | fi |
---|
| 952 | |
---|
[719] | 953 | typeset status |
---|
[70] | 954 | |
---|
[619] | 955 | #USUAL WAY |
---|
| 956 | rcp -rp ${STOREHOST}:$1 $2 > out_rsync 2>&1 |
---|
[719] | 957 | status=$? |
---|
[70] | 958 | |
---|
[719] | 959 | if [ ${status} -gt 0 ] ; then |
---|
[619] | 960 | echo "IGCM_sys_Get_Dir : error." |
---|
| 961 | cat out_rsync |
---|
| 962 | IGCM_debug_Exit "IGCM_sys_Get_Dir" |
---|
[70] | 963 | fi |
---|
[619] | 964 | else |
---|
| 965 | ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack |
---|
| 966 | fi |
---|
| 967 | IGCM_debug_PopStack "IGCM_sys_Get_Dir" |
---|
[70] | 968 | } |
---|
| 969 | |
---|
[689] | 970 | #==================================================== |
---|
| 971 | #- Call IGCM_sys_Mirror_libIGCM now ! |
---|
| 972 | if ( $MirrorlibIGCM ) ; then |
---|
| 973 | IGCM_sys_Mirror_libIGCM |
---|
| 974 | fi |
---|
| 975 | |
---|
[70] | 976 | #D-#================================================== |
---|
| 977 | #D-function IGCM_sys_Put_Rest |
---|
| 978 | #D-* Purpose: Put computied restarts on $(ARCHIVE). |
---|
| 979 | #D- File and target directory must exist. |
---|
| 980 | #D-* Examples: |
---|
| 981 | #D- |
---|
| 982 | function IGCM_sys_Put_Rest { |
---|
[619] | 983 | IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@ |
---|
| 984 | if ( $DEBUG_sys ) ; then |
---|
| 985 | echo "IGCM_sys_Put_Rest :" $@ |
---|
| 986 | fi |
---|
| 987 | if [ $DRYRUN = 0 ]; then |
---|
| 988 | if [ ! -f ${1} ] ; then |
---|
| 989 | echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ." |
---|
| 990 | IGCM_debug_Exit "IGCM_sys_Put_Rest" |
---|
[70] | 991 | fi |
---|
| 992 | |
---|
[719] | 993 | typeset status |
---|
[619] | 994 | # |
---|
| 995 | if [ X${JobType} = XRUN ] ; then |
---|
| 996 | IGCM_sys_Chmod 444 ${1} |
---|
| 997 | fi |
---|
| 998 | # |
---|
| 999 | # Only if we use rsync |
---|
| 1000 | #IGCM_sys_MkdirArchive $( dirname $2 ) |
---|
| 1001 | # |
---|
| 1002 | #USUAL WAY |
---|
| 1003 | mfput $1 $2 > out_rsync 2>&1 |
---|
[719] | 1004 | status=$? |
---|
[70] | 1005 | |
---|
[619] | 1006 | # #RSYNC WITH NETWORK RSH CALL |
---|
| 1007 | # echo ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 |
---|
| 1008 | # ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 |
---|
[70] | 1009 | |
---|
[619] | 1010 | # #RSYNC WITH NFS USE |
---|
| 1011 | # echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 |
---|
| 1012 | # ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 |
---|
[70] | 1013 | |
---|
[719] | 1014 | # status=$? |
---|
| 1015 | # IGCM_sys_Rsync_out $status |
---|
[70] | 1016 | |
---|
[619] | 1017 | # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync |
---|
[719] | 1018 | # (( status=status+$? )) |
---|
[619] | 1019 | |
---|
[719] | 1020 | if [ ${status} -gt 0 ] ; then |
---|
[619] | 1021 | echo "IGCM_sys_Put_Rest : error." |
---|
| 1022 | cat out_rsync |
---|
| 1023 | IGCM_debug_Exit "IGCM_sys_Put_Rest" |
---|
[70] | 1024 | else |
---|
[619] | 1025 | \rm out_rsync |
---|
[70] | 1026 | fi |
---|
[619] | 1027 | else |
---|
| 1028 | ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack |
---|
| 1029 | fi |
---|
| 1030 | IGCM_debug_PopStack "IGCM_sys_Put_Rest" |
---|
[70] | 1031 | } |
---|
| 1032 | |
---|
| 1033 | #D-#================================================== |
---|
[619] | 1034 | #D-function IGCM_sys_PutBuffer_Rest |
---|
| 1035 | #D-* Purpose: Put computied restarts on ${SCRATCHDIR}. |
---|
| 1036 | #D- File and target directory must exist. |
---|
| 1037 | #D-* Examples: |
---|
| 1038 | #D- |
---|
| 1039 | function IGCM_sys_PutBuffer_Rest { |
---|
| 1040 | IGCM_debug_PushStack "IGCM_sys_PutBuffer_Rest" $@ |
---|
| 1041 | if ( $DEBUG_sys ) ; then |
---|
| 1042 | echo "IGCM_sys_PutBuffer_Rest :" $@ |
---|
| 1043 | fi |
---|
| 1044 | if [ $DRYRUN = 0 ]; then |
---|
| 1045 | if [ ! -f ${1} ] ; then |
---|
| 1046 | echo "ERROR : IGCM_sys_PutBuffer_Rest ${1} DOES NOT EXIST ." |
---|
| 1047 | IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" |
---|
| 1048 | fi |
---|
| 1049 | |
---|
[719] | 1050 | typeset status |
---|
[619] | 1051 | # |
---|
| 1052 | if [ X${JobType} = XRUN ] ; then |
---|
| 1053 | IGCM_sys_Chmod 444 ${1} |
---|
| 1054 | fi |
---|
| 1055 | |
---|
| 1056 | # |
---|
| 1057 | # USUAL WAY |
---|
| 1058 | \cp $1 $2 > out_rsync 2>&1 |
---|
[719] | 1059 | status=$? |
---|
[619] | 1060 | |
---|
[719] | 1061 | if [ ${status} -gt 0 ] ; then |
---|
[619] | 1062 | echo "IGCM_sys_PutBuffer_Rest : error." |
---|
| 1063 | cat out_rsync |
---|
| 1064 | IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest" |
---|
| 1065 | else |
---|
| 1066 | \rm out_rsync |
---|
| 1067 | fi |
---|
| 1068 | else |
---|
| 1069 | ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack |
---|
| 1070 | fi |
---|
| 1071 | IGCM_debug_PopStack "IGCM_sys_PutBuffer_Rest" |
---|
| 1072 | } |
---|
| 1073 | |
---|
| 1074 | #D-#================================================== |
---|
[70] | 1075 | #D-function IGCM_sys_Put_Out |
---|
| 1076 | #D-* Purpose: Copy a file on $(ARCHIVE) after have chmod it in readonly |
---|
| 1077 | #D-* Examples: |
---|
| 1078 | #D- |
---|
| 1079 | function IGCM_sys_Put_Out { |
---|
[619] | 1080 | IGCM_debug_PushStack "IGCM_sys_Put_Out" $@ |
---|
| 1081 | if ( $DEBUG_sys ) ; then |
---|
| 1082 | echo "IGCM_sys_Put_Out :" $@ |
---|
| 1083 | fi |
---|
| 1084 | if [ $DRYRUN = 0 ]; then |
---|
| 1085 | if [ ! -f ${1} ] ; then |
---|
| 1086 | echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ." |
---|
| 1087 | IGCM_debug_PopStack "IGCM_sys_Put_Out" |
---|
| 1088 | return 1 |
---|
[70] | 1089 | fi |
---|
| 1090 | |
---|
[719] | 1091 | typeset status |
---|
[619] | 1092 | # |
---|
| 1093 | if [ X${JobType} = XRUN ] ; then |
---|
| 1094 | if [ X${3} = X ] ; then |
---|
| 1095 | IGCM_sys_Chmod 444 ${1} |
---|
| 1096 | fi |
---|
| 1097 | fi |
---|
| 1098 | # |
---|
| 1099 | # Only if we use rsync |
---|
| 1100 | #IGCM_sys_MkdirArchive $( dirname $2 ) |
---|
| 1101 | # |
---|
| 1102 | #USUAL WAY |
---|
| 1103 | mfput $1 $2 > out_rsync 2>&1 |
---|
[719] | 1104 | status=$? |
---|
[70] | 1105 | |
---|
[619] | 1106 | # #RSYNC WITH NETWORK RSH CALL |
---|
| 1107 | # echo ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1 |
---|
| 1108 | # ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1 |
---|
[70] | 1109 | |
---|
[619] | 1110 | # #RSYNC WITH NFS USE |
---|
| 1111 | # echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1 |
---|
| 1112 | # ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1 |
---|
[70] | 1113 | |
---|
[719] | 1114 | # status=$? |
---|
| 1115 | # IGCM_sys_Rsync_out $status |
---|
[70] | 1116 | |
---|
[619] | 1117 | # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync |
---|
[719] | 1118 | # (( status=status+$? )) |
---|
[70] | 1119 | |
---|
[719] | 1120 | if [ ${status} -gt 0 ] ; then |
---|
[619] | 1121 | echo "IGCM_sys_Put_Out : error." |
---|
| 1122 | cat out_rsync |
---|
| 1123 | IGCM_debug_Exit "IGCM_sys_Put_Out" |
---|
[70] | 1124 | else |
---|
[619] | 1125 | \rm out_rsync |
---|
[70] | 1126 | fi |
---|
[619] | 1127 | IGCM_sys_Rm out_rsync |
---|
| 1128 | else |
---|
| 1129 | ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack |
---|
| 1130 | fi |
---|
| 1131 | IGCM_debug_PopStack "IGCM_sys_Put_Out" |
---|
| 1132 | return 0 |
---|
[70] | 1133 | } |
---|
| 1134 | |
---|
| 1135 | #D-#================================================== |
---|
[619] | 1136 | #D-function IGCM_sys_PutBuffer_Out |
---|
| 1137 | #D-* Purpose: Copy a file on ${SCRATCHDIR} after having chmod it in readonly |
---|
| 1138 | #D-* Examples: |
---|
| 1139 | #D- |
---|
| 1140 | function IGCM_sys_PutBuffer_Out { |
---|
| 1141 | IGCM_debug_PushStack "IGCM_sys_PutBuffer_Out" $@ |
---|
| 1142 | if ( $DEBUG_sys ) ; then |
---|
| 1143 | echo "IGCM_sys_PutBuffer_Out :" $@ |
---|
| 1144 | fi |
---|
| 1145 | if [ $DRYRUN = 0 ]; then |
---|
| 1146 | if [ ! -f ${1} ] ; then |
---|
| 1147 | echo "WARNING : IGCM_sys_PutBuffer_Out ${1} DOES NOT EXIST ." |
---|
| 1148 | IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out" |
---|
| 1149 | return 1 |
---|
| 1150 | fi |
---|
| 1151 | # |
---|
| 1152 | IGCM_sys_Mkdir $( dirname $2 ) |
---|
| 1153 | # |
---|
[719] | 1154 | typeset status |
---|
[619] | 1155 | |
---|
| 1156 | if [ X${JobType} = XRUN ] ; then |
---|
| 1157 | if [ X${3} = X ] ; then |
---|
| 1158 | IGCM_sys_Chmod 444 ${1} |
---|
| 1159 | fi |
---|
| 1160 | fi |
---|
| 1161 | # |
---|
| 1162 | # USUAL WAY |
---|
| 1163 | \cp $1 $2 > out_rsync 2>&1 |
---|
[719] | 1164 | status=$? |
---|
[619] | 1165 | |
---|
[719] | 1166 | if [ ${status} -gt 0 ] ; then |
---|
[619] | 1167 | echo "IGCM_sys_PutBuffer_Out : error." |
---|
| 1168 | cat out_rsync |
---|
| 1169 | IGCM_debug_Exit "IGCM_sys_PutBuffer_Out" |
---|
| 1170 | else |
---|
| 1171 | \rm out_rsync |
---|
| 1172 | fi |
---|
| 1173 | else |
---|
| 1174 | ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack |
---|
| 1175 | fi |
---|
| 1176 | IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out" |
---|
| 1177 | return 0 |
---|
| 1178 | } |
---|
| 1179 | |
---|
| 1180 | #D-#================================================== |
---|
[70] | 1181 | #D-function IGCM_sys_Get |
---|
| 1182 | #D-* Purpose: Get a file from ${ARCHIVE} |
---|
| 1183 | #D-* Examples: IGCM_sys_Get myfile /destpath/myfile_with_PREFIX |
---|
| 1184 | #D- IGCM_sys_Get /l Array_contain_myfiles /destpath/ |
---|
| 1185 | function IGCM_sys_Get { |
---|
[619] | 1186 | IGCM_debug_PushStack "IGCM_sys_Get" $@ |
---|
[70] | 1187 | |
---|
[719] | 1188 | typeset DEST status dm_liste ifile target |
---|
[70] | 1189 | |
---|
[619] | 1190 | if ( $DEBUG_sys ) ; then |
---|
| 1191 | echo "IGCM_sys_Get :" $@ |
---|
| 1192 | fi |
---|
| 1193 | if [ $DRYRUN -le 2 ]; then |
---|
| 1194 | if [ X${1} = X'/l' ] ; then |
---|
| 1195 | # test if the first file is present in the old computation : |
---|
| 1196 | eval set +A dm_liste \${${2}} |
---|
| 1197 | else |
---|
| 1198 | dm_liste=${1} |
---|
[70] | 1199 | fi |
---|
[619] | 1200 | eval DEST=\${${#}} |
---|
[70] | 1201 | |
---|
[619] | 1202 | # test if the (first) file is present in the old computation : |
---|
| 1203 | IGCM_sys_TestFileArchive ${dm_liste[0]} |
---|
[719] | 1204 | status=$? |
---|
| 1205 | if [ ${status} -gt 0 ] ; then |
---|
[619] | 1206 | echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ." |
---|
| 1207 | IGCM_debug_Exit "IGCM_sys_Get" |
---|
| 1208 | return |
---|
| 1209 | fi |
---|
[70] | 1210 | |
---|
[619] | 1211 | # SD : dm_liste is not suited for computing job |
---|
| 1212 | # because we change filename during transfert |
---|
| 1213 | # dm_liste is better suited for post-treatment |
---|
| 1214 | #dm_liste=" " |
---|
| 1215 | #(( ifile=1 )) |
---|
| 1216 | #while [ $ifile -lt $# ] ; do |
---|
| 1217 | # dm_liste=$( eval echo ${dm_liste} " "\${${ifile}} ) |
---|
| 1218 | # (( ifile = ifile + 1 )) |
---|
| 1219 | #done |
---|
| 1220 | #DEST=$( eval echo \${${#}} ) |
---|
[70] | 1221 | |
---|
[619] | 1222 | #USUAL WAY |
---|
| 1223 | mfget ${dm_liste[*]} ${DEST} > out_rsync 2>&1 |
---|
[719] | 1224 | status=$? |
---|
[70] | 1225 | |
---|
[619] | 1226 | # #RSYNC WITH NETWORK RSH CALL |
---|
| 1227 | # echo ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1 |
---|
| 1228 | # ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1 |
---|
[70] | 1229 | |
---|
[619] | 1230 | # #RSYNC WITH NFS USE |
---|
| 1231 | # echo ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1 |
---|
| 1232 | # ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> out_rsync 2>&1 |
---|
[70] | 1233 | |
---|
[719] | 1234 | # status=$? |
---|
| 1235 | # IGCM_sys_Rsync_out $status |
---|
[70] | 1236 | |
---|
[619] | 1237 | # ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync |
---|
[719] | 1238 | # (( status=status+$? )) |
---|
[70] | 1239 | |
---|
[719] | 1240 | if [ ${status} -gt 0 ] ; then |
---|
[619] | 1241 | echo "IGCM_sys_Get : copy error." |
---|
| 1242 | cat out_rsync |
---|
| 1243 | IGCM_debug_Exit "IGCM_sys_Get" |
---|
[70] | 1244 | else |
---|
[619] | 1245 | \rm out_rsync |
---|
[70] | 1246 | fi |
---|
[619] | 1247 | else |
---|
| 1248 | ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack |
---|
| 1249 | fi |
---|
| 1250 | IGCM_debug_PopStack "IGCM_sys_Get" |
---|
[70] | 1251 | } |
---|
| 1252 | |
---|
[619] | 1253 | #D-#================================================== |
---|
| 1254 | #D-function IGCM_sys_GetBuffer |
---|
| 1255 | #D-* Purpose: Get a file from ${SCRATCHDIR} |
---|
| 1256 | #D-* Examples: IGCM_sys_GetBuffer myfile /destpath/myfile_with_PREFIX |
---|
| 1257 | #D- IGCM_sys_GetBuffer /l Array_contain_myfiles /destpath/ |
---|
| 1258 | function IGCM_sys_GetBuffer { |
---|
| 1259 | IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@ |
---|
| 1260 | |
---|
[719] | 1261 | typeset DEST status buf_liste ifile target file_work |
---|
[619] | 1262 | |
---|
| 1263 | if ( $DEBUG_sys ) ; then |
---|
| 1264 | echo "IGCM_sys_GetBuffer :" $@ |
---|
| 1265 | fi |
---|
| 1266 | if [ $DRYRUN -le 2 ]; then |
---|
| 1267 | if [ X${1} = X'/l' ] ; then |
---|
| 1268 | # test if the first file is present in the old computation : |
---|
| 1269 | eval set +A buf_liste \${${2}} |
---|
| 1270 | else |
---|
| 1271 | eval set +A buf_liste ${1} |
---|
| 1272 | fi |
---|
| 1273 | eval DEST=\${${#}} |
---|
| 1274 | |
---|
| 1275 | #USUAL WAY |
---|
| 1276 | if [ X${1} = X'/l' ] ; then |
---|
[719] | 1277 | (( status=0 )) |
---|
[619] | 1278 | for target in ${buf_liste[*]} ; do |
---|
| 1279 | local_file=$( basename ${target} ) |
---|
| 1280 | \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1 |
---|
[719] | 1281 | (( status = status + $? )) |
---|
[619] | 1282 | done |
---|
| 1283 | else |
---|
| 1284 | \cp ${buf_liste} ${DEST} >> out_rsync 2>&1 |
---|
[719] | 1285 | status=$? |
---|
[619] | 1286 | fi |
---|
| 1287 | |
---|
[719] | 1288 | if [ ${status} -gt 0 ] ; then |
---|
[619] | 1289 | echo "IGCM_sys_GetBuffer : copy error." |
---|
| 1290 | cat out_rsync |
---|
| 1291 | IGCM_debug_Exit "IGCM_sys_GetBuffer" |
---|
| 1292 | else |
---|
| 1293 | \rm out_rsync |
---|
| 1294 | fi |
---|
| 1295 | else |
---|
| 1296 | ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack |
---|
| 1297 | fi |
---|
| 1298 | IGCM_debug_PopStack "IGCM_sys_GetBuffer" |
---|
| 1299 | } |
---|
| 1300 | |
---|
[70] | 1301 | ############################################################## A FINIR !! |
---|
| 1302 | |
---|
| 1303 | #D-#================================================== |
---|
| 1304 | #D-function IGCM_sys_GetDate_FichWork |
---|
| 1305 | #D-* Purpose: donne la date filesys d'un fichier sur le filesystem WORK |
---|
| 1306 | #D-* Examples: |
---|
| 1307 | #D- |
---|
| 1308 | function IGCM_sys_GetDate_FichWork { |
---|
[619] | 1309 | IGCM_debug_PushStack "IGCM_sys_FichWork" $@ |
---|
| 1310 | if ( $DEBUG_sys ) ; then |
---|
| 1311 | echo "IGCM_sys_GetDate_FichWork :" $@ |
---|
| 1312 | fi |
---|
| 1313 | typeset dateF |
---|
| 1314 | set +A dateF -- $( rsh ${MASTER} -n /opt/freeware/bin/ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} ) |
---|
| 1315 | eval ${2}=${dateF[5]} |
---|
[537] | 1316 | |
---|
[619] | 1317 | # donne la date filesys d'un fichier sur la machine work |
---|
| 1318 | IGCM_debug_PopStack "IGCM_sys_FichWork" |
---|
[70] | 1319 | } |
---|
| 1320 | |
---|
| 1321 | #D-#================================================== |
---|
| 1322 | #D-function IGCM_sys_GetDate_FichArchive |
---|
[619] | 1323 | #D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE |
---|
[70] | 1324 | #D-* Examples: |
---|
| 1325 | #D- |
---|
| 1326 | function IGCM_sys_GetDate_FichArchive { |
---|
[619] | 1327 | IGCM_debug_PushStack "IGCM_sys_FichArchive" $@ |
---|
| 1328 | if ( $DEBUG_sys ) ; then |
---|
| 1329 | echo "IGCM_sys_GetDate_FichArchive :" $@ |
---|
| 1330 | fi |
---|
| 1331 | typeset dateF |
---|
| 1332 | set +A dateF -- $( rsh ${STOREHOST} -n ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} ) |
---|
| 1333 | eval ${2}=${dateF[5]} |
---|
[537] | 1334 | |
---|
[619] | 1335 | IGCM_debug_PopStack "IGCM_sys_FichArchive" |
---|
[70] | 1336 | } |
---|
| 1337 | |
---|
| 1338 | ############################################################## |
---|
| 1339 | # REBUILD OPERATOR |
---|
| 1340 | |
---|
| 1341 | function IGCM_sys_rebuild { |
---|
[619] | 1342 | IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@ |
---|
| 1343 | if ( $DEBUG_sys ) ; then |
---|
| 1344 | echo "IGCM_sys_rebuild :" $@ |
---|
| 1345 | fi |
---|
| 1346 | /homegpfs/rech/psl/rpsl035/bin/rebuild -f -o $@ |
---|
| 1347 | if [ $? -gt 0 ] ; then |
---|
| 1348 | echo "IGCM_sys_rebuild : erreur ${@}." |
---|
| 1349 | IGCM_debug_Exit "rebuild" |
---|
| 1350 | fi |
---|
[70] | 1351 | |
---|
[619] | 1352 | IGCM_debug_PopStack "IGCM_sys_rebuild" |
---|
[70] | 1353 | } |
---|
| 1354 | |
---|
[697] | 1355 | function IGCM_sys_rebuild_station { |
---|
| 1356 | IGCM_debug_PushStack "IGCM_sys_rebuild_station" -- $@ |
---|
| 1357 | typeset i list_opt file_in file_out prefix_invert list_invert |
---|
| 1358 | if ( $DEBUG_sys ) ; then |
---|
| 1359 | echo "IGCM_sys_rebuild_station :" $@ |
---|
| 1360 | fi |
---|
| 1361 | list_opt=$@ |
---|
| 1362 | |
---|
| 1363 | # Invert Axis : t,x -> x,t |
---|
| 1364 | # t,pres,x -> x,t,pres |
---|
| 1365 | # So that we can concatenate along x |
---|
| 1366 | i=0 |
---|
| 1367 | for file_in in ${list_opt} ; do |
---|
| 1368 | (( i = i + 1)) |
---|
| 1369 | [ ${i} = 1 ] && file_out=${file_in} && continue |
---|
| 1370 | prefix_invert=$( basename ${file_in} .nc ) |
---|
| 1371 | IGCM_sys_ncpdq -a x,time_counter -a x,time_counter,presnivs ${file_in} ${prefix_invert}_xt.nc |
---|
| 1372 | list_invert[${#list_invert[*]}]=${prefix_invert}_xt.nc |
---|
| 1373 | done |
---|
| 1374 | |
---|
| 1375 | # Concatenate |
---|
| 1376 | IGCM_sys_ncrcat ${list_invert[*]} histstn_xt.nc |
---|
| 1377 | |
---|
| 1378 | # Re-ivert file |
---|
| 1379 | IGCM_sys_ncpdq -a time_counter,x -a time_counter,presnivs,x histstn_xt.nc ${file_out} |
---|
| 1380 | |
---|
| 1381 | # Station re-ordering is too expansive to be run within libICGM |
---|
| 1382 | # This is due to (ncpdq - nrcat - ncpdq) I/O sequence. |
---|
| 1383 | # This re-ordering must be done "in memory" by the cmorization process |
---|
| 1384 | # Anyway this is the best sequence using (ncpdq - nrcat - ncpdq) |
---|
| 1385 | # BEGIN reordering |
---|
| 1386 | |
---|
| 1387 | # Only LMDZ text output contains the exact ordering of the station. |
---|
| 1388 | # We isolate this in the code below: |
---|
| 1389 | # 0 38 -157.5000000000000 70.98591549295774 |
---|
| 1390 | # 0 54 27.49999999999999 67.18309859154928 |
---|
| 1391 | # 0 56 -62.50000000000001 82.39436619718309 |
---|
| 1392 | # 0 79 12.49999999999999 78.59154929577466 |
---|
| 1393 | # 0 116 -165.0000000000000 76.05633802816901 |
---|
| 1394 | # 0 117 130.0000000000000 70.98591549295774 |
---|
| 1395 | # 0 118 110.0000000000000 87.46478873239437 |
---|
| 1396 | # 1 40 4.999999999999995 51.97183098591550 |
---|
| 1397 | # typeset iStation iProc list_opt file_in file_out prefix_invert |
---|
| 1398 | # typeset -Z4 j4 |
---|
| 1399 | # typeset -Z3 j3 |
---|
| 1400 | |
---|
| 1401 | # unset list_opt |
---|
| 1402 | # set +A list_opt $@ |
---|
| 1403 | |
---|
| 1404 | # Filename after rebuild |
---|
| 1405 | # file_out=${list_opt[0]} |
---|
| 1406 | # Prefix of output files |
---|
| 1407 | # prefix_invert=$( basename ${file_out} .nc ) |
---|
| 1408 | # Number of procs |
---|
| 1409 | # num_proc=$( grep -i mpi_size ${PREFIX}_${Exe_Output} | wc -l ) |
---|
| 1410 | |
---|
| 1411 | # iProc=0 |
---|
| 1412 | # while [ ${iProc} -lt ${num_proc} ] ; do |
---|
| 1413 | # Array containing Station as a number |
---|
| 1414 | # unset proc_stn |
---|
| 1415 | # set +A proc_stn $( grep "iophy_mpi rank ip lon lat $iProc" ${PREFIX}_${Exe_Output} | sed -e "s/iophy_mpi rank ip lon lat //g" | awk ' {print $2}' ) |
---|
| 1416 | # Number of stations produced by processor proc |
---|
| 1417 | # stationLast=${#proc_stn[*]} |
---|
| 1418 | # Proc number on 4 digits |
---|
| 1419 | # j4=${iProc} |
---|
| 1420 | # Init |
---|
| 1421 | # iStation=0 |
---|
| 1422 | # while [ ${iStation} -lt ${stationLast} ] ; do |
---|
| 1423 | # Station number on 3 digits |
---|
| 1424 | # j3=${proc_stn[${iStation}]} |
---|
| 1425 | # Extract station |
---|
| 1426 | # Invert Axis : t,x -> x,t |
---|
| 1427 | # t,pres,x -> x,t,pres |
---|
| 1428 | # So that we can concatenate along x |
---|
| 1429 | # IGCM_sys_ncpdq -a x,time_counter -a x,time_counter,presnivs -d x,$iStation,$iStation ${prefix_invert}_${j4}.nc ${prefix_invert}_stn_${j3}.nc |
---|
| 1430 | # (( iStation = iStation + 1 )) |
---|
| 1431 | # done |
---|
| 1432 | # (( iProc = iProc + 1 )) |
---|
| 1433 | # done |
---|
| 1434 | |
---|
| 1435 | # Concatenate all station along x |
---|
| 1436 | # IGCM_sys_ncrcat ${prefix_invert}_stn_???.nc ${prefix_invert}_xt.nc |
---|
| 1437 | |
---|
| 1438 | # Re-invert file |
---|
| 1439 | # IGCM_sys_ncpdq -a time_counter,x -a time_counter,presnivs,x ${prefix_invert}_xt.nc ${file_out} |
---|
| 1440 | |
---|
| 1441 | # END reordering |
---|
| 1442 | |
---|
| 1443 | IGCM_debug_PopStack "IGCM_sys_rebuild_station" |
---|
| 1444 | } |
---|
| 1445 | |
---|
[70] | 1446 | ############################################################ |
---|
| 1447 | # Activate Running Environnment Variables |
---|
| 1448 | |
---|
| 1449 | function IGCM_sys_activ_variables { |
---|
[619] | 1450 | IGCM_debug_PushStack "IGCM_sys_activ_variables" |
---|
| 1451 | if ( $DEBUG_sys ) ; then |
---|
| 1452 | echo "IGCM_sys_activ_variables " |
---|
| 1453 | fi |
---|
[70] | 1454 | |
---|
| 1455 | # -------------------------------------------------------------------- |
---|
[688] | 1456 | #D- OpenMP thread memory specifications : only one time |
---|
[70] | 1457 | # -------------------------------------------------------------------- |
---|
[688] | 1458 | echo $XLSMPOPTS | grep stack=524288000 1>/dev/null 2>&1 || export XLSMPOPTS=$XLSMPOPTS:stack=524288000 |
---|
[70] | 1459 | |
---|
| 1460 | # -------------------------------------------------------------------- |
---|
| 1461 | #D- Other specifications |
---|
| 1462 | # -------------------------------------------------------------------- |
---|
| 1463 | |
---|
[619] | 1464 | IGCM_debug_PopStack "IGCM_sys_activ_variables" |
---|
[70] | 1465 | |
---|
| 1466 | } |
---|
| 1467 | |
---|
| 1468 | ############################################################ |
---|
| 1469 | # Desactivate Running Environnment Variables |
---|
| 1470 | |
---|
| 1471 | function IGCM_sys_desactiv_variables { |
---|
[619] | 1472 | IGCM_debug_PushStack "IGCM_sys_desactiv_variables" |
---|
| 1473 | if ( $DEBUG_sys ) ; then |
---|
| 1474 | echo "IGCM_sys_desactiv_variables " |
---|
| 1475 | fi |
---|
[70] | 1476 | # -------------------------------------------------------------------- |
---|
| 1477 | #D- MPI specifications |
---|
| 1478 | # -------------------------------------------------------------------- |
---|
| 1479 | |
---|
| 1480 | # -------------------------------------------------------------------- |
---|
| 1481 | #D- Other specifications |
---|
| 1482 | # -------------------------------------------------------------------- |
---|
| 1483 | |
---|
[619] | 1484 | IGCM_debug_PopStack "IGCM_sys_desactiv_variables" |
---|
| 1485 | |
---|
[70] | 1486 | } |
---|
| 1487 | |
---|
| 1488 | ############################################################ |
---|
[619] | 1489 | # Build MPI/OMP scripts |
---|
| 1490 | function IGCM_sys_build_execution_scripts |
---|
| 1491 | { |
---|
| 1492 | IGCM_debug_PushStack "IGCM_sys_build_execution_scripts" $@ |
---|
| 1493 | if ( $DEBUG_sys ) ; then |
---|
| 1494 | echo "IGCM_sys_build_execution_scripts " $@ |
---|
| 1495 | fi |
---|
[70] | 1496 | |
---|
[619] | 1497 | typeset NbNodes_Job NbProc_Job comp_proc_mpi_loc comp_proc_omp_loc mpi_count |
---|
| 1498 | |
---|
| 1499 | if [ ! -f ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} ] ; then |
---|
| 1500 | IGCM_debug_Exit "IGCM_sys_vargas build_execution_scripts : Job_${config_UserChoices_JobName} don't exist in SUBMIT_DIR : ${SUBMIT_DIR} " |
---|
| 1501 | fi |
---|
| 1502 | |
---|
| 1503 | if ( ${OK_PARA_MPMD} ) ; then |
---|
| 1504 | |
---|
| 1505 | if [ -f run_file ] ; then |
---|
| 1506 | IGCM_sys_Rm -f run_file |
---|
| 1507 | fi |
---|
| 1508 | touch run_file |
---|
| 1509 | |
---|
| 1510 | if ( ${OK_PARA_OMP} ) ; then |
---|
| 1511 | # NEW : 2 Noeuds |
---|
| 1512 | # @ task_geometry={(0)(1,2,3)} |
---|
| 1513 | # Nombre de processus demandes |
---|
| 1514 | echo "Job_${config_UserChoices_JobName} includes task_geometry = \c" |
---|
| 1515 | cat ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} | grep "task_geometry" | sed -e "s/[^(]*([^(]*/(/g" |
---|
| 1516 | echo "Job_${config_UserChoices_JobName} includes task_geometry with NbNodes = \c" |
---|
| 1517 | cat ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} | grep "task_geometry" | sed -e "s/[^(]*([^(]*/(/g" | wc -c |
---|
| 1518 | NbNodes_Job=$(( $( cat ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} | grep "task_geometry" | sed -e "s/[^(]*([^(]*/(/g" | wc -c ) - 1 )) |
---|
| 1519 | |
---|
| 1520 | if [ ${NbNodes_Job} -eq 0 ] ; then |
---|
| 1521 | IGCM_debug_Print 2 "Error in Job_${config_UserChoices_JobName} ressources : no task_geometry defined with OpenMP run." |
---|
| 1522 | exit 1 |
---|
| 1523 | fi |
---|
| 1524 | else |
---|
| 1525 | |
---|
| 1526 | # OLD : |
---|
| 1527 | # @ total_tasks = 3 |
---|
| 1528 | # @ environment = "BATCH_NUM_PROC_TOT=3" |
---|
| 1529 | # Pas d OpenMP |
---|
| 1530 | # @ resources = ConsumableCpus(1) |
---|
| 1531 | |
---|
| 1532 | echo "Job_${config_UserChoices_JobName} includes total_tasks = \c" |
---|
| 1533 | cat ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} | grep "total_tasks" | sed -e "s/.*total_tasks = //" |
---|
| 1534 | NbProc_Job=$( cat ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} | grep "total_tasks" | sed -e "s/.*total_tasks = //" ) |
---|
| 1535 | NbProc_Job=${NbProc_Job:=0} |
---|
| 1536 | if [ ${NbProc_Job} -eq 0 ] ; then |
---|
| 1537 | IGCM_debug_Print 2 "Error in Job_${config_UserChoices_JobName} ressources : no total_tasks defined with MPI only run." |
---|
| 1538 | exit 1 |
---|
| 1539 | fi |
---|
| 1540 | if ( $( egrep '^# *@ *resources *= *ConsumableCpus\(1\)' ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} >/dev/null 2>&1 ) ) ; then |
---|
| 1541 | IGCM_debug_Print 2 "ressources = ConsumableCpus(1) line found into Job_${config_UserChoices_JobName}" |
---|
| 1542 | else |
---|
| 1543 | IGCM_debug_Print 2 "Error in Job_${config_UserChoices_JobName} ressources = line not found. Job should include resources = ConsumableCpus(1) " |
---|
| 1544 | exit 1 |
---|
| 1545 | fi |
---|
| 1546 | fi |
---|
| 1547 | |
---|
| 1548 | # run_file construction |
---|
| 1549 | |
---|
| 1550 | # Then first loop on the components for the coupler ie oasis |
---|
| 1551 | |
---|
| 1552 | ### the coupler ie oasis must be the first one |
---|
| 1553 | for comp in ${config_ListOfComponents[*]} ; do |
---|
| 1554 | |
---|
| 1555 | eval ExeNameIn=\${config_Executable_${comp}[0]} |
---|
| 1556 | eval ExeNameOut=\${config_Executable_${comp}[1]} |
---|
| 1557 | |
---|
| 1558 | # for CPL component only |
---|
| 1559 | if [ "X${comp}" = "XCPL" ] ; then |
---|
| 1560 | |
---|
| 1561 | eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} |
---|
| 1562 | eval comp_proc_omp_loc=\${${comp}_PROC_OMP} |
---|
| 1563 | |
---|
| 1564 | if ( ${OK_PARA_MPI} ) ; then |
---|
| 1565 | |
---|
| 1566 | (( mpi_count = 1 )) |
---|
| 1567 | until [ ${mpi_count} -gt ${comp_proc_mpi_loc} ] ; do |
---|
| 1568 | if ( ${OK_PARA_OMP} ) ; then |
---|
| 1569 | echo "env OMP_NUM_THREADS=${comp_proc_omp_loc} ./${ExeNameOut} " >> run_file |
---|
| 1570 | else |
---|
| 1571 | echo "./${ExeNameOut}" >> run_file |
---|
| 1572 | fi |
---|
| 1573 | (( mpi_count = mpi_count + 1 )) |
---|
| 1574 | done |
---|
| 1575 | else |
---|
| 1576 | if ( ${OK_PARA_OMP} ) ; then |
---|
| 1577 | echo "env OMP_NUM_THREADS=${comp_proc_omp_loc} ./${ExeNameOut} " >> run_file |
---|
| 1578 | else |
---|
| 1579 | echo "./${ExeNameOut} " >> run_file |
---|
| 1580 | fi |
---|
| 1581 | fi |
---|
| 1582 | fi |
---|
| 1583 | done |
---|
| 1584 | |
---|
| 1585 | # Then second loop on the components |
---|
| 1586 | |
---|
| 1587 | for comp in ${config_ListOfComponents[*]} ; do |
---|
| 1588 | |
---|
| 1589 | eval ExeNameIn=\${config_Executable_${comp}[0]} |
---|
| 1590 | eval ExeNameOut=\${config_Executable_${comp}[1]} |
---|
| 1591 | |
---|
| 1592 | # Only if we really have an executable for the component and not the coupler ie oasis: |
---|
| 1593 | if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${comp}" != "XCPL" ] ) ; then |
---|
| 1594 | |
---|
| 1595 | eval comp_proc_mpi_loc=\${${comp}_PROC_MPI} |
---|
| 1596 | eval comp_proc_omp_loc=\${${comp}_PROC_OMP} |
---|
| 1597 | |
---|
| 1598 | if ( ${OK_PARA_MPI} ) ; then |
---|
| 1599 | |
---|
| 1600 | (( mpi_count = 1 )) |
---|
| 1601 | until [ ${mpi_count} -gt ${comp_proc_mpi_loc} ] ; do |
---|
| 1602 | if ( ${OK_PARA_OMP} ) ; then |
---|
| 1603 | echo "env OMP_NUM_THREADS=${comp_proc_omp_loc} ./${ExeNameOut} " >> run_file |
---|
| 1604 | else |
---|
| 1605 | echo "./${ExeNameOut}" >> run_file |
---|
| 1606 | fi |
---|
| 1607 | (( mpi_count = mpi_count + 1 )) |
---|
| 1608 | done |
---|
| 1609 | else |
---|
| 1610 | if ( ${OK_PARA_OMP} ) ; then |
---|
| 1611 | echo "env OMP_NUM_THREADS=${comp_proc_omp_loc} ./${ExeNameOut} " >> run_file |
---|
| 1612 | else |
---|
| 1613 | # to be tested : no MPI only OpenMP into MPMD mode |
---|
| 1614 | echo "./${ExeNameOut} " >> run_file |
---|
| 1615 | fi |
---|
| 1616 | fi |
---|
| 1617 | fi |
---|
| 1618 | done |
---|
| 1619 | |
---|
| 1620 | EXECUTION="${HOST_MPIRUN_COMMAND} -pgmmodel mpmd -cmdfile ./run_file" |
---|
| 1621 | |
---|
| 1622 | IGCM_sys_Chmod u+x run_file |
---|
[70] | 1623 | if ( $DEBUG_sys ) ; then |
---|
[619] | 1624 | echo "run_file contains : " |
---|
| 1625 | cat run_file |
---|
[70] | 1626 | fi |
---|
[395] | 1627 | |
---|
[619] | 1628 | else # Only one executable. launch it. |
---|
[395] | 1629 | |
---|
[619] | 1630 | for comp in ${config_ListOfComponents[*]} ; do |
---|
[395] | 1631 | |
---|
[619] | 1632 | eval ExeNameIn=\${config_Executable_${comp}[0]} |
---|
| 1633 | eval ExeNameOut=\${config_Executable_${comp}[1]} |
---|
[70] | 1634 | |
---|
[664] | 1635 | if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${ExeNameOut}" != "Xinca.dat" ] ) ; then |
---|
| 1636 | EXECUTION="time ./${ExeNameOut}" |
---|
| 1637 | fi |
---|
[70] | 1638 | |
---|
[619] | 1639 | done |
---|
[395] | 1640 | |
---|
[619] | 1641 | fi |
---|
| 1642 | |
---|
| 1643 | IGCM_debug_Print 1 "sys vargas : execution command is " |
---|
| 1644 | IGCM_debug_Print 1 "$EXECUTION" |
---|
| 1645 | |
---|
| 1646 | IGCM_debug_PopStack "IGCM_sys_build_execution_scripts" |
---|
[70] | 1647 | } |
---|
[619] | 1648 | |
---|
| 1649 | function IGCM_sys_build_run_file { |
---|
| 1650 | |
---|
| 1651 | IGCM_debug_Print 3 " dummy function : IGCM_sys_build_run_file " |
---|
| 1652 | |
---|
| 1653 | } |
---|
[651] | 1654 | |
---|
| 1655 | ############################################################ |
---|
| 1656 | # Check of space available on temporary filesytems |
---|
| 1657 | function IGCM_sys_check_quota { |
---|
| 1658 | IGCM_debug_PushStack "IGCM_sys_check_quota" |
---|
| 1659 | if ( $DEBUG_sys ) ; then |
---|
| 1660 | echo "IGCM_sys_check_quota " |
---|
| 1661 | fi |
---|
| 1662 | # Limit of quota (in %) |
---|
| 1663 | limit_quota=90 |
---|
| 1664 | # Check of the volume |
---|
| 1665 | volume_quota=$(quota_u -w | grep 'Quota soft' | awk '{print $5}') |
---|
| 1666 | if [ ! X${volume_quota} = X ] ; then |
---|
| 1667 | quota_volume=${volume_quota%%\%} |
---|
| 1668 | # echo $quota_volume |
---|
| 1669 | if [ ${quota_volume} -ge ${limit_quota} ] ; then |
---|
[654] | 1670 | IGCM_debug_Print 1 "Please, check your quota of volume on workgpfs" |
---|
| 1671 | IGCM_debug_Print 1 "${quota_volume}% of your quota is used" |
---|
| 1672 | IGCM_debug_Print 1 "Use the quota_u -w command to check" |
---|
[651] | 1673 | IGCM_debug_Print 1 "You must have more than 10% available to run" |
---|
| 1674 | IGCM_debug_Exit "Not enough space to run ! STOP HERE" |
---|
| 1675 | IGCM_debug_Verif_Exit |
---|
| 1676 | fi |
---|
| 1677 | |
---|
| 1678 | fi |
---|
| 1679 | IGCM_debug_PopStack "IGCM_sys_check_quota" |
---|
| 1680 | } |
---|