source: trunk/libIGCM/libIGCM_sys/libIGCM_sys_vargas.ksh @ 537

Last change on this file since 537 was 537, checked in by mmaipsl, 13 years ago

Correct IGCM_sys_GetDate_FichWork and some IGCM_sys_Tar. Suppress DODS for obelix. Add IGCM_sys_RshMaster to connect to frontend.

  • Property svn:keywords set to Revision Author Date
File size: 35.4 KB
Line 
1#!/bin/ksh
2
3#**************************************************************
4# Author: Sébastien Denvil
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
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
16# if you use the prefix #D- for comments to be extracted.
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-
24#D- This ksh library if a layer under some usefull
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
36typeset -r DEBUG_sys=${DEBUG_sys:=true}
37
38#====================================================
39# Turn in dry run mode ? (sys_Put_Rest, sys_Put_Out, sys_Get)
40typeset -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"
61typeset -r MYLANG="fr"
62
63#=====================================================
64# Host and user names
65# $hostname ou hostname
66typeset  HOST=${HOST:=$( hostname )}
67# $username ou whoami
68typeset  LOGIN=${LOGIN:=$( whoami )}
69# $hostname of the MASTER job
70typeset -r MASTER=vargas
71
72#D-
73#D-#==================================================
74#D-Program used in libIGCM
75#D-#==================================================
76
77# rsync with path
78typeset -r RSYNC=/usr/local/bin/rsync
79# RSYNC_opt args to rsync
80typeset -r RSYNC_opt="-va"
81# ie storage filesystem
82typeset -r STOREHOST=gaya.idris.fr
83typeset -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 )
91typeset -r R_EXE="${MODIPSL}/bin"
92
93#====================================================
94#- SUBMIT_DIR : submission dir
95typeset SUBMIT_DIR=${SUBMIT_DIR:=${LOADL_STEP_INITDIR}}
96
97#====================================================
98#- ARCHIVE
99typeset -r ARCHIVE=$( echo ${HOME} | sed -e "s/homegpfs/u/" )
100
101#====================================================
102#- Mirror libIGCM from vargas to ulam
103typeset -r MirrorlibIGCM=${MirrorlibIGCM:=true}
104
105#====================================================
106#- libIGCM_POST
107PATHlibIGCM=$( echo ${libIGCM} | gawk -F"${LOGIN}/" '{print $2}' | sed -e "s&/libIGCM&&" )
108typeset -r HOME_POST=$( echo ${HOME} | sed -e "s/homegpfs/home/" )
109typeset -r libIGCM_POST=${HOME_POST}/MIRROR/${PATHlibIGCM}/libIGCM
110
111#====================================================
112#- IN
113typeset -r R_IN=${R_IN:=/u/rech/psl/rpsl035/IGCM}
114typeset -r R_IN_ECMWF=${R_IN_ECMWF:=/u/rech/psl/rpsl376}
115
116#====================================================
117#- OUT
118typeset -r R_OUT=${ARCHIVE}/IGCM_OUT
119
120#====================================================
121#- OUT_POST
122typeset -r R_OUT_POST=$( echo ${HOME} | sed -e "s/homegpfs/workdir/" )/IGCM_OUT
123
124#====================================================
125#- RUN_DIR_PATH : Temporary working directory (=> TMP)
126typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${TMPDIR}}
127
128#====================================================
129#- BIG_DIR : BIG_DIR to store files waiting for rebuild
130typeset -r BIG_DIR=${BIG_DIR:=${WORKDIR}/REBUILD}
131
132#====================================================
133#- HOST_MPIRUN_COMMAND
134typeset -r HOST_MPIRUN_COMMAND=${HOST_MPIRUN_COMMAND:="time poe"}
135
136#====================================================
137#- Max number of arguments passed to nco operator or demigration command
138UNIX_MAX_LIMIT=360
139
140#D-#==================================================
141#D-function IGCM_sys_RshMaster
142#D-* Purpose: Connection to frontend machine.
143#D-* Examples:
144#D-
145(( RshMNum = 0 ))
146function IGCM_sys_RshMaster {
147    IGCM_debug_PushStack "IGCM_sys_RshMaster" $@
148
149    typeset THEFILE OUTFILE ERR
150
151    RshDIR=${WORKDIR}/RUN_DIR/${config_UserChoices_TagName}/${config_UserChoices_JobName}.${$}
152    if [ ! -d ${RshDIR} ] ; then
153        IGCM_sys_Mkdir ${RshDIR}
154    fi
155    THEFILE=${RshDIR}/file_sys_RshMaster_$$_${RshMNum}
156    echo '#!/bin/ksh' > ${THEFILE}
157    echo "export libIGCM=${libIGCM} > /dev/null 2>&1" >> ${THEFILE}
158    echo "export DEBUG_debug=${DEBUG_debug} > /dev/null 2>&1" >> ${THEFILE}
159    echo ". ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh > /dev/null 2>&1" >> ${THEFILE}
160    echo ". ${libIGCM}/libIGCM_card/libIGCM_card.ksh > /dev/null 2>&1" >> ${THEFILE}
161    echo "${@} " >> ${THEFILE}
162
163    # No frontend queue on brodie : just rsh the job on the frontend with submission.
164    sed -e "s@IGCM_sys_Qsub\(.*\)@\1@" ${THEFILE} > ${THEFILE}_
165
166    chmod u+x  ${THEFILE}_
167
168    OUTFILE=${RshDIR}/out_RshMaster.$$.${RshMNum}
169    (( RshMNum = RshMNum + 1 ))
170
171    rsh ${MASTER} 'bash -c "nohup '${THEFILE}'_ > '${OUTFILE}' 2>&1 &"'
172    if [ $? -gt 0 ] ; then
173        echo "IGCM_sys_RshMaster : erreur."
174        IGCM_debug_Exit "IGCM_sys_RshMaster"
175    fi
176    IGCM_debug_PopStack "IGCM_sys_RshMaster"
177}
178
179#D-#==================================================
180#D-function IGCM_sys_RshArchive
181#D-* Purpose: Archive rsh command
182#D-* Examples:
183#D-
184function IGCM_sys_RshArchive {
185    IGCM_debug_PushStack "IGCM_sys_RshArchive" $@
186    rsh ${STOREHOST} exec /bin/ksh <<-EOF
187    ${@}
188EOF
189    if [ $? -gt 0 ] ; then
190        echo "IGCM_sys_RshArchive : erreur."
191        IGCM_debug_Exit "IGCM_sys_RshArchive"
192    fi
193    IGCM_debug_PopStack "IGCM_sys_RshArchive"
194}
195
196#D-#==================================================
197#D-function IGCM_sys_RshPost
198#D-* Purpose: Post-process rsh command
199#D-* Examples:
200#D-
201function IGCM_sys_RshPost {
202    IGCM_debug_PushStack "IGCM_sys_RshPost" $@
203    if ( $DEBUG_sys ) ; then
204        echo "IGCM_sys_RshPost :" $@
205    fi
206
207    # keep standard input to keep it for postpone if ulam don't answer
208    cat >/tmp/tmp_IGCM_sys_RshPost_$$
209
210    ## Add submission for old postponed files only if command is a Qsub
211    ##
212    ISITQSUB=0
213    grep Qsub /tmp/tmp_IGCM_sys_RshPost_$$ >/dev/null 2>&1 && ISITQSUB=1
214    if  ( [ ${ISITQSUB} -gt 0 ] ) ; then
215      if [ -d ${SUBMIT_DIR}/POSTPONE ] ; then
216            for postponed_file in ${SUBMIT_DIR}/POSTPONE/* ; do
217              if [ -f ${postponed_file} ] ; then
218                IGCM_debug_Print 2 " submit postponed file : " ${postponed_file}
219                rsh ulam exec /bin/ksh <${postponed_file}
220                if [ $? -eq 0 ] ; then
221                     IGCM_sys_Rm ${postponed_file}
222                else
223                     IGCM_debug_Print 2 "keep postponed file for an other submission :" ${postponed_file}
224                fi
225              fi
226          done
227      fi
228    fi
229
230    RETURN=0
231    # rsh ulam command
232    rsh ulam exec /bin/ksh </tmp/tmp_IGCM_sys_RshPost_$$
233    RETURN=$?
234
235    # keep standard input for postpone if ulam don't answer
236    if ( [ ${RETURN} -gt 0 ] ) ; then
237        IGCM_debug_Print 2 "Postpone tmp_IGCM_sys_RshPost_$$"
238        [ -d ${SUBMIT_DIR}/POSTPONE ] || mkdir ${SUBMIT_DIR}/POSTPONE
239        mv /tmp/tmp_IGCM_sys_RshPost_$$ ${SUBMIT_DIR}/POSTPONE
240    fi
241    IGCM_debug_PopStack "IGCM_sys_RshPost"
242}
243
244#D-#==================================================
245#D-function IGCM_sys_SendMail
246#D-* Purpose: Send mail when simulation is over
247#D-* Examples:
248#D-
249function IGCM_sys_SendMail {
250    IGCM_debug_PushStack "IGCM_sys_SendMail" $@
251    if ( $DEBUG_sys ) ; then
252        echo "IGCM_sys_SendMail :" $@
253    fi
254
255    if ( ${ExitFlag} ) ; then
256        status=failed
257    else
258        status=completed
259    fi
260    cat  << END_MAIL > job_end.mail
261Dear ${LOGIN},
262
263  Simulation ${config_UserChoices_JobName} is ${status} on supercomputer `hostname`.
264  Job started : ${DateBegin}
265  Job ended   : ${DateEnd}
266  Output files are available in ${R_SAVE}
267  Script files, Script Outputs and Debug files (if necessary) are available in ${SUBMIT_DIR}
268END_MAIL
269
270    if [ ! -z ${config_UserChoices_MailName} ] ; then
271        mailx -s "${config_UserChoices_JobName} ${status}" ${config_UserChoices_MailName} <  job_end.mail
272    elif [ -f ~/.forward ] ; then
273        mailx -s "${config_UserChoices_JobName} ${status}" $( cat ~/.forward ) < job_end.mail
274    else
275        mailx -s "${config_UserChoices_JobName} ${status}" ${USER} < job_end.mail
276    fi
277
278    if [ $? -gt 0 ] ; then
279        echo "IGCM_sys_SendMail : erreur."
280        IGCM_debug_Exit "IGCM_sys_SendMail"
281    fi
282    IGCM_debug_PopStack "IGCM_sys_SendMail"
283}
284
285#D-#==================================================
286#D-function IGCM_sys_Mkdir
287#D-* Purpose: Master locale mkdir command
288#D-* Examples:
289#D-
290function IGCM_sys_Mkdir {
291    IGCM_debug_PushStack "IGCM_sys_Mkdir" $@
292    if ( $DEBUG_sys ) ; then
293        echo "IGCM_sys_Mkdir :" $@
294    fi
295    if [ ! -d ${1} ]; then
296        \mkdir -p $1
297        if [ $? -gt 0 ] ; then
298            echo "IGCM_sys_Mkdir : erreur."
299            IGCM_debug_Exit "IGCM_sys_Mkdir"
300        fi
301    fi
302    # vérification :
303    if [ ! -d ${1} ] ; then
304        echo "IGCM_sys_Mkdir : erreur."
305        IGCM_debug_Exit "IGCM_sys_Mkdir"
306    fi
307    IGCM_debug_PopStack "IGCM_sys_Mkdir"
308}
309
310#D-#==================================================
311#D-function IGCM_sys_MkdirArchive
312#D-* Purpose: Mkdir on Archive
313#D-* Examples:
314#D-
315function IGCM_sys_MkdirArchive {
316    IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@
317    if ( $DEBUG_sys ) ; then
318        echo "IGCM_sys_MkdirArchive :" $@
319    fi
320    #- creation de repertoire sur le serveur fichier
321    rsh ${STOREHOST} -n mkdir -p $1
322
323    if [ $? -gt 0 ] ; then
324        echo "IGCM_sys_MkdirArchive : erreur."
325        IGCM_debug_Exit "IGCM_sys_MkdirArchive"
326    fi
327    IGCM_debug_PopStack "IGCM_sys_MkdirArchive"
328}
329
330#D-#==================================================
331#D-function IGCM_sys_MkdirWork
332#D-* Purpose: Mkdir on Work
333#D-* Examples:
334#D-
335function IGCM_sys_MkdirWork {
336    IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@
337    if ( $DEBUG_sys ) ; then
338        echo "IGCM_sys_MkdirWork :" $@
339    fi
340    #- creation de repertoire sur le serveur fichier
341    if [ ! -d ${1} ]; then 
342        \mkdir -p $1
343        if [ $? -gt 0 ] ; then
344            echo "IGCM_sys_MkdirWork : erreur."
345            IGCM_debug_Exit "IGCM_sys_MkdirWork"
346        fi
347    fi
348    IGCM_debug_PopStack "IGCM_sys_MkdirWork"
349}
350
351#D-#==================================================
352#D-function IGCM_sys_Cd
353#D-* Purpose: master cd command
354#D-* Examples:
355#D-
356function IGCM_sys_Cd {
357    IGCM_debug_PushStack "IGCM_sys_Cd" $@
358    if ( $DEBUG_sys ) ; then
359        echo "IGCM_sys_Cd :" $@
360    fi
361    \cd $1
362    if [ $? -gt 0 ] ; then
363        echo "IGCM_sys_Cd : erreur."
364        IGCM_debug_Exit "IGCM_sys_Cd"
365    fi
366    IGCM_debug_PopStack "IGCM_sys_Cd"
367}
368
369#D-#==================================================
370#D-function IGCM_sys_Chmod
371#D-* Purpose: Chmod
372#D-* Examples:
373#D-
374function IGCM_sys_Chmod {
375    IGCM_debug_PushStack "IGCM_sys_Chmod" -- $@
376    if ( $DEBUG_sys ) ; then
377        echo "IGCM_sys_Chmod :" $@
378    fi
379    if [ $DRYRUN -le 1 ]; then
380        \chmod $@
381        if [ $? -gt 0 ] ; then
382            echo "IGCM_sys_Chmod : erreur."
383            IGCM_debug_Exit "IGCM_sys_Chmod"
384        fi
385    else
386        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
387    fi
388    IGCM_debug_PopStack "IGCM_sys_Chmod"
389}
390
391#D-#==================================================
392#D-function IGCM_sys_FileSize
393#D-* Purpose: Filesize
394#D-* Examples:
395#D-
396function IGCM_sys_FileSize {
397    IGCM_debug_PushStack "IGCM_sys_FileSize" $@
398
399    typeset sizeF
400    set +A sizeF -- $( ls -la ${1} )
401    if [ $? -gt 0 ] ; then
402        IGCM_debug_Exit "IGCM_sys_FileSize"
403    fi
404    eval ${2}=${sizeF[4]}
405
406    IGCM_debug_PopStack "IGCM_sys_FileSize"
407}
408
409#D-#==================================================
410#D-function IGCM_sys_TestDir
411#D-* Purpose: Test Directory that must exists
412#D-* Examples:
413#D-
414function IGCM_sys_TestDir {
415    IGCM_debug_PushStack "IGCM_sys_TestDir" $@
416    if ( $DEBUG_sys ) ; then
417        echo "IGCM_sys_TestDir :" $@
418    fi
419    typeset ExistFlag
420    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
421    IGCM_debug_PopStack "IGCM_sys_TestDir"
422
423    return ${ExistFlag}
424}
425
426#D-#==================================================
427#D-function IGCM_sys_TestDirArchive
428#D-* Purpose: Test Directory that must exists on Archive
429#D-* Examples:
430#D-
431function IGCM_sys_TestDirArchive {
432    IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@
433    if ( $DEBUG_sys ) ; then
434        echo "IGCM_sys_TestDirArchive :" $@
435    fi
436    typeset ExistFlag
437    ExistFlag=$( IGCM_sys_RshArchive "[ -d $1 ] && echo 0 || echo 1" )
438    IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
439
440    return ${ExistFlag}
441}
442
443#D-#==================================================
444#D-function IGCM_sys_TestFileArchive
445#D-* Purpose: Test file that must NOT EXISTS on Archive
446#D-* Examples:
447#D-
448function IGCM_sys_TestFileArchive {
449    IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@
450    typeset ExistFlag
451    ExistFlag=$( IGCM_sys_RshArchive "[ -f $1 ] && echo 0 || echo 1" )
452    IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
453
454    return ${ExistFlag}
455}
456
457#D-#==================================================
458#D-function IGCM_sys_CountFileArchive
459#D-* Purpose: Count files on Archive filesystem
460#D-* Examples:
461#D-
462function IGCM_sys_CountFileArchive {
463    IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@
464    IGCM_sys_RshArchive "ls ${@} 2>/dev/null | wc -l"
465    if [ $? -gt 0 ] ; then
466        echo "IGCM_sys_CountFileArchive : erreur."
467    fi
468    IGCM_debug_PopStack "IGCM_sys_CountFileArchive"
469}
470
471#D-#==================================================
472#D-function IGCM_sys_Tree
473#D-* Purpose: Tree directories with files on ${ARCHIVE}
474#D-* Examples: IGCM_sys_Tree ${R_IN} ${R_OUT}
475#D-
476function IGCM_sys_Tree {
477    IGCM_debug_PushStack "IGCM_sys_Tree" $@
478    if ( $DEBUG_sys ) ; then
479        echo "IGCM_sys_Tree :" $@
480    fi
481
482    \mfls -r $@
483
484    IGCM_debug_PopStack "IGCM_sys_Tree"
485}
486
487#D-#==================================================
488#D-function IGCM_sys_Tar
489#D-* Purpose: master un-tar command
490#D-* Examples:
491#D-
492function IGCM_sys_Tar {
493    IGCM_debug_PushStack "IGCM_sys_Tar" $@
494    if ( $DEBUG_sys ) ; then
495        echo "IGCM_sys_Tar :" $@
496    fi
497    \tar cf $@
498    if [ $? -gt 0 ] ; then
499        echo "IGCM_sys_Tar : erreur."
500        IGCM_debug_Exit "IGCM_sys_Tar"
501    fi
502    IGCM_debug_PopStack "IGCM_sys_Tar"
503}
504
505#D-#==================================================
506#D-function IGCM_sys_UnTar
507#D-* Purpose: master un-tar command
508#D-* Examples:
509#D-
510function IGCM_sys_UnTar {
511    IGCM_debug_PushStack "IGCM_sys_UnTar" $@
512    if ( $DEBUG_sys ) ; then
513        echo "IGCM_sys_UnTar :" $@
514    fi
515    \tar xvf $1
516    if [ $? -gt 0 ] ; then
517        echo "IGCM_sys_UnTar : erreur."
518        IGCM_debug_Exit "IGCM_sys_UnTar"
519    fi
520    IGCM_debug_PopStack "IGCM_sys_UnTar"
521}
522
523#D-#==================================================
524#D-function IGCM_sys_Qsub
525#D-* Purpose: Qsub new job
526#D-* Examples:
527#D-
528function IGCM_sys_Qsub {
529    IGCM_debug_PushStack "IGCM_sys_Qsub" $@
530    if ( $DEBUG_sys ) ; then
531        echo "IGCM_sys_Qsub :" $@
532    fi
533    # We have to change output/error file
534    [ ${#@} = 1 ] &&  REP_FOR_JOB=$LOADL_STEP_INITDIR
535    [ ${#@} = 2 ] &&  REP_FOR_JOB=$2
536    sed -e "s/\# \@ output *= .*/\# \@ output = ${Script_Output}/" -e "s/\# \@ error *= .*/\# \@ error = ${Script_Output}/" <$1 >${REP_FOR_JOB}/JOB_FOR_IGCM
537    {
538       [ ${#@} = 1 ] &&  ( cd $LOADL_STEP_INITDIR ; /usr/local/bin/llsubmit JOB_FOR_IGCM ; ERROR=$? ; cd - ; )
539       [ ${#@} = 2 ] &&  ( cd $2 ; /usr/local/bin/llsubmit JOB_FOR_IGCM ; ERROR=$? ; cd - ; )
540    }
541    if [ ${ERROR} -gt 0 ] ; then
542       echo "IGCM_sys_Qsub : erreur $@."
543       IGCM_debug_Exit "IGCM_sys_Qsub"
544    fi
545    IGCM_sys_Rm ${REP_FOR_JOB}/JOB_FOR_IGCM
546    IGCM_debug_PopStack "IGCM_sys_Qsub"
547
548}
549
550#D-#==================================================
551#D-function IGCM_sys_QsubPost
552#D-* Purpose: Qsub new job on scalaire
553#D-* Examples:
554#D-
555function IGCM_sys_QsubPost {
556    IGCM_debug_PushStack "IGCM_sys_QsubPost" $@
557    if ( $DEBUG_sys ) ; then
558        echo "IGCM_sys_QsubPost :" $@
559    fi
560    cd ${POST_DIR}
561    /opt/ibmll/LoadL/full/bin/llsubmit ${libIGCM_POST}/$1.job
562    cd -
563    if [ $? -gt 0 ] ; then
564        echo "IGCM_sys_QsubPost : erreur " $@
565        IGCM_debug_Exit "IGCM_sys_QsubPost"
566    fi
567    IGCM_debug_PopStack "IGCM_sys_QsubPost"
568}
569
570#D-*************************
571#D- File transfer functions
572#D-*************************
573#D-
574
575#D-#==================================================
576#D-function IGCM_sys_Rsync_out
577#D-* Purpose: treat return val of rsync
578#D-* Examples: IGCM_sys_Rsync_out out_RET_rsync
579#D-  Error values and explanations can depend on your system version.
580function IGCM_sys_Rsync_out {
581    RET=$1
582    if [ ! $RET ] ; then
583        echo "rsync error !"
584    fi
585
586    if [ $MYLANG = "fr" ]; then
587        case $RET in
588            0)  return ;;
589            1)  echo "Erreur de rsync ; RERR_SYNTAX : "
590                echo "Erreur de syntaxe ou d'utilisation."
591                return;;
592            2)  echo "Erreur de rsync ; RERR_PROTOCOL : "
593                echo "Incompatibilité de protocole."
594                return;;
595            3)  echo "Erreur de rsync ; RERR_FILESELECT 3"
596                echo "Erreurs  lors  de  la  sélection des fichiers d'entrée sortie et"
597                echo "répertoires"
598                return;;
599            4)  echo "Erreur de rsync ; RERR_UNSUPPORTED"
600                echo "Action demandée non supportée : une tentative de manipulation de"
601                echo "fichiers  64-bits  sur une plate-forme qui ne les supporte pas a"
602                echo "été faite ; ou une option qui est supportée par le  client  mais"
603                echo "pas par le serveur a été spécifiée."
604                return;;
605            10) echo "Erreur de rsync ; RERR_SOCKETIO"
606                echo "Erreur dans le socket d'entrée sortie"
607                return;;
608            11) echo "Erreur de rsync ; RERR_FILEIO"
609                echo "Erreur d'entrée sortie fichier"
610                return;;
611            12) echo "Erreur de rsync ; RERR_STREAMIO"
612                echo "Erreur dans flux de donnée du protocole rsync"
613                return;;
614            13) echo "Erreur de rsync ; RERR_MESSAGEIO"
615                echo "Erreur avec les diagnostics du programme"
616                return;;
617            14) echo "Erreur de rsync ; RERR_IPC"
618                echo "Erreur dans le code IPC"
619                return;;
620            20) echo "Erreur de rsync ; RERR_SIGNAL"
621                echo "SIGUSR1 ou SIGINT reçu"
622                return;;
623            21) echo "Erreur de rsync ; RERR_WAITCHILD"
624                echo "Une erreur retournée par waitpid()"
625                return;;
626            22) echo "Erreur de rsync ; RERR_MALLOC"
627                echo "Erreur lors de l'allocation des tampons de mémoire de coeur"
628                return;;
629            23) echo ""
630                echo "Erreur fichier inexistant"
631                return;;
632            30) echo "Erreur de rsync ; RERR_TIMEOUT"
633                echo "Temps d'attente écoulé dans l'envoi/réception de données"
634                return;;
635            *)  echo "Erreur de rsync : code de retour de rsync inconnu :" $RET
636                return;;
637        esac
638    elif [ $MYLANG = "en" ] ; then
639        case $RET in
640            0)  return;;               
641            1)  echo "rsync error : Syntax or usage error "
642                return;;
643            2)  echo "rsync error : Protocol incompatibility "
644                return;;
645            3)  echo "rsync error : Errors selecting input/output files, dirs"
646                return;;
647            4)  echo "rsync error : Requested action not supported: an attempt"
648                echo "was made to manipulate 64-bit files on a platform that cannot support"
649                echo "them; or an option was specified that is supported by the client and"
650                echo "not by the server."
651                return;;
652            5)  echo "rsync error : Error starting client-server protocol"
653                return;;
654            10) echo "rsync error : Error in socket I/O "
655                return;;
656            11) echo "rsync error : Error in file I/O "
657                return;;
658            12) echo "rsync error : Error in rsync protocol data stream "
659                return;;
660            13) echo "rsync error : Errors with program diagnostics "
661                return;;
662            14) echo "rsync error : Error in IPC code "
663                return;;
664            20) echo "rsync error : Received SIGUSR1 or SIGINT "
665                return;;
666            21) echo "rsync error : Some error returned by waitpid() "
667                return;;
668            22) echo "rsync error : Error allocating core memory buffers "
669                return;;
670            23) echo "rsync error : Partial transfer due to error"
671                return;;
672            24) echo "rsync error : Partial transfer due to vanished source files"
673                return;;
674            30) echo "rsync error : Timeout in data send/receive "
675                return;;
676            *)  echo "rsync error : return code of rsync unknown :" $RET
677                return;;
678        esac
679    else
680        echo "unknown language $MYLANG."
681        return
682    fi
683}
684   
685
686#D-#==================================================
687#D-function IGCM_sys_Miror_libIGCM
688#D-* Purpose: Mirror libIGCM PATH and lib to ulam
689#D-* Examples:
690#D-
691function IGCM_sys_Mirror_libIGCM {
692    IGCM_debug_PushStack "IGCM_sys_Mirror_libIGCM"
693    if ( $DEBUG_sys ) ; then
694        echo "IGCM_sys_Mirror_libIGCM"
695    fi
696
697    typeset RET
698
699    IGCM_sys_RshPost <<-EOF
700    mkdir -p ${HOME_POST}/MIRROR/${PATHlibIGCM}
701EOF
702    rsh ulam -n hostname > /dev/null 2>&1
703    RET=$?
704    if [ $RET -eq 0 ] ; then
705        echo ${RSYNC} ${RSYNC_opt} -e "rsh " ${libIGCM} ulam:${HOME_POST}/MIRROR/${PATHlibIGCM} > out_rsync 2>&1
706        ${RSYNC} ${RSYNC_opt} -e "rsh " ${libIGCM} ulam:${HOME_POST}/MIRROR/${PATHlibIGCM} >> out_rsync 2>&1
707        RET=$?
708
709        if [ ${RET} -gt 0 ] ; then
710            echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on ulam."
711            cat out_rsync
712        fi
713    else
714        echo "No POST-TREATMENT avaible because ulam is down."
715    fi
716    IGCM_debug_PopStack "IGCM_sys_Mirror_libIGCM"
717}
718
719#====================================================
720#- Call IGCM_sys_Mirror_libIGCM now !
721if ( $MirrorlibIGCM ) ; then
722    IGCM_sys_Mirror_libIGCM
723fi
724
725#D-#==================================================
726#D-function IGCM_sys_Cp
727#D-* Purpose: generic cp
728#D-* Examples:
729#D-
730function IGCM_sys_Cp {
731    IGCM_debug_PushStack "IGCM_sys_Cp" $@
732    if ( $DEBUG_sys ) ; then
733        echo "IGCM_sys_Cp :" $@
734    fi
735
736    typeset RET
737
738    echo cp $@ > out_rsync 2>&1
739    \cp $@ >> out_rsync 2>&1
740    RET=$?
741
742    if [ ${RET} -gt 0 ] ; then
743        echo "IGCM_sys_Cp : error."
744        cat out_rsync
745        IGCM_debug_Exit "IGCM_sys_Cp"
746     else
747         \rm out_rsync
748    fi
749    IGCM_debug_PopStack "IGCM_sys_Cp"
750}
751
752#D-#==================================================
753#D-function IGCM_sys_Rm
754#D-* Purpose: generic rm
755#D-* Examples:
756#D-
757function IGCM_sys_Rm {
758    IGCM_debug_PushStack "IGCM_sys_Rm" -- $@
759    if ( $DEBUG_sys ) ; then
760        echo "IGCM_sys_Rm :" $@
761    fi
762
763    typeset RET
764
765    echo rm $@ > out_rsync 2>&1
766    \rm $@ >> out_rsync 2>&1
767    RET=$?
768
769    if [ ${RET} -gt 0 ] ; then
770        echo "IGCM_sys_Rm : error."
771        cat out_rsync
772        IGCM_debug_Exit "IGCM_sys_Rm"
773    else
774        \rm out_rsync
775    fi
776    IGCM_debug_PopStack "IGCM_sys_Rm"
777}
778
779#D-#==================================================
780#D-function IGCM_sys_RmRunDir
781#D-* Purpose: rm tmpdir (dummy function most of the time batch
782#D-                      scheduler will do the job)
783#D-* Examples:
784#D-
785function IGCM_sys_RmRunDir {
786    IGCM_debug_PushStack "IGCM_sys_RmRunDir" -- $@
787    if ( $DEBUG_sys ) ; then
788        echo "IGCM_sys_RmRunDir :" $@
789        echo "Dummy call, let the scheduler do that."
790    fi
791    IGCM_debug_PopStack "IGCM_sys_RmRunDir"
792}
793
794#D-#==================================================
795#D-function IGCM_sys_Mv
796#D-* Purpose: generic move
797#D-* Examples:
798#D-
799function IGCM_sys_Mv {
800    IGCM_debug_PushStack "IGCM_sys_Mv" $@
801    if ( $DEBUG_sys ) ; then
802        echo "IGCM_sys_Mv :" $@
803    fi
804
805    if [ $DRYRUN = 0 ]; then
806
807        typeset RET
808           
809        echo mv $@ > out_rsync 2>&1
810        \mv $@ >> out_rsync 2>&1
811        RET=$?
812   
813        if [ ${RET} -gt 0 ] ; then
814            echo "IGCM_sys_Mv : error in mv."
815            cat out_rsync
816            IGCM_debug_Exit "IGCM_sys_Mv"
817        else
818            \rm out_rsync
819        fi
820    else
821        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
822    fi
823
824    IGCM_debug_PopStack "IGCM_sys_Mv"
825}
826
827#D-#==================================================
828#D-function IGCM_sys_Put_Dir
829#D-* Purpose: Copy a complete directory on $(ARCHIVE)
830#D-* Examples:
831#D-
832function IGCM_sys_Put_Dir {
833    IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@
834    if ( $DEBUG_sys ) ; then
835        echo "IGCM_sys_Put_Dir :" $@
836    fi
837    if [ $DRYRUN = 0 ]; then
838        if [ ! -d ${1} ] ; then
839            echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ."
840            IGCM_debug_PopStack "IGCM_sys_Put_Dir"
841            return
842        fi
843
844        typeset RET
845
846        # Only if we use rsync
847        #IGCM_sys_TestDirArchive $( dirname $2 )
848        #
849        #USUAL WAY
850        rcp -r $1 ${STOREHOST}:$2 > out_rsync 2>&1
851        RET=$?
852
853        if [ ${RET} -gt 0 ] ; then
854            echo "IGCM_sys_Put_Dir : error."
855            cat out_rsync
856            IGCM_debug_Exit "IGCM_sys_Put_Dir"
857        else
858            \rm out_rsync
859        fi
860    else
861        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
862    fi
863    IGCM_debug_PopStack "IGCM_sys_Put_Dir"
864}
865
866#D-#==================================================
867#D-function IGCM_sys_Get_Dir
868#D-* Purpose: Copy a complete directory from $(ARCHIVE)
869#D-* Examples:
870#D-
871function IGCM_sys_Get_Dir {
872    IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@
873    if ( $DEBUG_sys ) ; then
874        echo "IGCM_sys_Get_Dir :" $@
875    fi
876    if [ $DRYRUN = 0 ]; then
877        if [ ! -d ${1} ] ; then
878            echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ."
879            IGCM_debug_PopStack "IGCM_sys_Get_Dir"
880            return
881        fi
882
883        typeset RET
884
885        #USUAL WAY
886        rcp -rp ${STOREHOST}:$1 $2 > out_rsync 2>&1
887        RET=$?
888
889        if [ ${RET} -gt 0 ] ; then
890            echo "IGCM_sys_Get_Dir : error."
891            cat out_rsync
892            IGCM_debug_Exit "IGCM_sys_Get_Dir"
893        fi
894    else
895        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
896    fi
897    IGCM_debug_PopStack "IGCM_sys_Get_Dir"
898}
899
900#D-#==================================================
901#D-function IGCM_sys_Put_Rest
902#D-* Purpose: Put computied restarts on $(ARCHIVE).
903#D-           File and target directory must exist.
904#D-* Examples:
905#D-
906function IGCM_sys_Put_Rest {
907    IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@
908    if ( $DEBUG_sys ) ; then
909        echo "IGCM_sys_Put_Rest :" $@
910    fi
911    if [ $DRYRUN = 0 ]; then
912        if [ ! -f ${1} ] ; then
913            echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ."
914            IGCM_debug_Exit "IGCM_sys_Put_Rest"
915        fi
916
917        typeset RET
918        #
919        if [ X${JobType} = XRUN ] ; then
920            IGCM_sys_Chmod 444 ${1}
921        fi
922        #
923        # Only if we use rsync
924        #IGCM_sys_MkdirArchive $( dirname $2 )
925        #
926        #USUAL WAY
927        mfput $1 $2 > out_rsync 2>&1
928        RET=$?
929
930#       #RSYNC WITH NETWORK RSH CALL
931#       echo ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1
932#       ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1
933
934#       #RSYNC WITH NFS USE
935#       echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
936#       ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1
937       
938#       RET=$?
939#       IGCM_sys_Rsync_out $RET
940
941#       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
942#       (( RET=RET+$? ))
943
944        if [ ${RET} -gt 0 ] ; then
945            echo "IGCM_sys_Put_Rest : error."
946            cat out_rsync
947            IGCM_debug_Exit "IGCM_sys_Put_Rest"
948        else
949            \rm out_rsync
950        fi
951    else
952        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
953    fi
954    IGCM_debug_PopStack "IGCM_sys_Put_Rest"
955}
956
957#D-#==================================================
958#D-function IGCM_sys_Put_Out
959#D-* Purpose: Copy a file on $(ARCHIVE) after have chmod it in readonly
960#D-* Examples:
961#D-
962function IGCM_sys_Put_Out {
963    IGCM_debug_PushStack "IGCM_sys_Put_Out" $@
964    if ( $DEBUG_sys ) ; then
965        echo "IGCM_sys_Put_Out :" $@
966    fi
967    if [ $DRYRUN = 0 ]; then
968        if [ ! -f ${1} ] ; then
969            echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ."
970            IGCM_debug_PopStack "IGCM_sys_Put_Out"
971            return 1
972        fi
973
974        typeset RET
975        #
976        if [ X${JobType} = XRUN ] ; then
977            if [ X${3} = X ] ; then
978                IGCM_sys_Chmod 444 ${1}
979            fi
980        fi
981        #
982        # Only if we use rsync
983        #IGCM_sys_MkdirArchive $( dirname $2 )
984        #
985        #USUAL WAY
986        mfput $1 $2 > out_rsync 2>&1
987        RET=$?
988
989#       #RSYNC WITH NETWORK RSH CALL
990#       echo ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1
991#       ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1
992
993#       #RSYNC WITH NFS USE
994#       echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
995#       ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1
996
997#       RET=$?
998#       IGCM_sys_Rsync_out $RET
999
1000#       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
1001#       (( RET=RET+$? ))
1002
1003        if [ ${RET} -gt 0 ] ; then
1004            echo "IGCM_sys_Put_Out : error."
1005            cat out_rsync
1006            IGCM_debug_Exit "IGCM_sys_Put_Out"
1007        else
1008            \rm out_rsync
1009        fi
1010    else
1011        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
1012    fi
1013    IGCM_debug_PopStack "IGCM_sys_Put_Out"
1014    return 0
1015}
1016
1017#D-#==================================================
1018#D-function IGCM_sys_Get
1019#D-* Purpose: Get a file from ${ARCHIVE}
1020#D-* Examples: IGCM_sys_Get myfile /destpath/myfile_with_PREFIX
1021#D-            IGCM_sys_Get /l Array_contain_myfiles /destpath/
1022function IGCM_sys_Get {
1023    IGCM_debug_PushStack "IGCM_sys_Get" $@
1024
1025    typeset DEST RET dm_liste ifile target
1026
1027    if ( $DEBUG_sys ) ; then
1028        echo "IGCM_sys_Get :" $@
1029    fi
1030    if [ $DRYRUN -le 2 ]; then
1031        if [ X${1} = X'/l' ] ; then
1032            # test if the first file is present in the old computation :
1033            eval set +A dm_liste \${${2}}
1034        else
1035            dm_liste=${1}
1036        fi
1037        eval DEST=\${${#}}
1038
1039        # test if the (first) file is present in the old computation :
1040        IGCM_sys_TestFileArchive ${dm_liste[0]}
1041        RET=$?
1042        if [ ${RET} -gt 0 ] ; then
1043            echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ."
1044            IGCM_debug_Exit "IGCM_sys_Get"
1045            return
1046        fi
1047
1048        # SD : dm_liste is not suited for computing job
1049        #      because we change filename during transfert
1050        #      dm_liste is better suited for post-treatment
1051        #dm_liste=" "
1052        #(( ifile=1 ))
1053        #while [ $ifile -lt $# ] ; do
1054        #    dm_liste=$( eval echo ${dm_liste} " "\${${ifile}} )
1055        #    (( ifile = ifile + 1 ))
1056        #done
1057        #DEST=$( eval echo \${${#}} )
1058
1059        #USUAL WAY
1060        mfget ${dm_liste[*]} ${DEST} > out_rsync 2>&1
1061        #mfget $1 $2 > out_rsync 2>&1
1062        RET=$?
1063
1064#       #RSYNC WITH NETWORK RSH CALL
1065#       echo ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} > out_rsync 2>&1
1066#       ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} >> out_rsync 2>&1
1067
1068#       #RSYNC WITH NFS USE
1069#       echo ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > out_rsync 2>&1
1070#       ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> out_rsync 2>&1
1071
1072#       RET=$?
1073#       IGCM_sys_Rsync_out $RET
1074
1075#       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
1076#       (( RET=RET+$? ))
1077
1078        if [ ${RET} -gt 0 ] ; then
1079            echo "IGCM_sys_Get : copy error."
1080            cat out_rsync
1081            IGCM_debug_Exit "IGCM_sys_Get"
1082        else
1083            \rm out_rsync
1084        fi
1085    else
1086        ( ${DEBUG_debug} ) && echo "DRYRUN mode = " $DRYRUN >> stack
1087    fi
1088    IGCM_debug_PopStack "IGCM_sys_Get"
1089}
1090
1091############################################################## A FINIR !!
1092
1093#D-#==================================================
1094#D-function IGCM_sys_GetDate_FichWork
1095#D-* Purpose: donne la date filesys d'un fichier sur le filesystem WORK
1096#D-* Examples:
1097#D-
1098function IGCM_sys_GetDate_FichWork {
1099    IGCM_debug_PushStack "IGCM_sys_FichWork" $@
1100    if ( $DEBUG_sys ) ; then
1101        echo "IGCM_sys_GetDate_FichWork :" $@
1102    fi
1103    typeset dateF
1104    set +A dateF -- $( rsh ${MASTER} -n /opt/freeware/bin/ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} )
1105    eval ${2}=${dateF[5]}
1106
1107    # donne la date filesys d'un fichier sur la machine work
1108    IGCM_debug_PopStack "IGCM_sys_FichWork"
1109}
1110
1111#D-#==================================================
1112#D-function IGCM_sys_GetDate_FichArchive
1113#D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE
1114#D-* Examples:
1115#D-
1116function IGCM_sys_GetDate_FichArchive {
1117    IGCM_debug_PushStack "IGCM_sys_FichArchive" $@
1118    if ( $DEBUG_sys ) ; then
1119        echo "IGCM_sys_GetDate_FichArchive :" $@
1120    fi
1121    typeset dateF
1122    set +A dateF -- $( rsh ${STOREHOST} -n ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} )
1123    eval ${2}=${dateF[5]}
1124
1125    IGCM_debug_PopStack "IGCM_sys_FichArchive"
1126}
1127
1128##############################################################
1129# REBUILD OPERATOR
1130
1131function IGCM_sys_rebuild {
1132    IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@
1133    if ( $DEBUG_sys ) ; then
1134        echo "IGCM_sys_rebuild :" $@
1135    fi
1136    /homegpfs/rech/psl/rpsl035/bin/rebuild -f -o $@
1137    if [ $? -gt 0 ] ; then
1138       echo "IGCM_sys_rebuild : erreur ${@}."
1139       IGCM_debug_Exit "rebuild"
1140    fi
1141
1142    IGCM_debug_PopStack "IGCM_sys_rebuild"
1143}
1144
1145############################################################
1146# Activate Running Environnment Variables
1147
1148function IGCM_sys_activ_variables {
1149    IGCM_debug_PushStack "IGCM_sys_activ_variables"
1150    if ( $DEBUG_sys ) ; then
1151        echo "IGCM_sys_activ_variables "
1152    fi
1153
1154# --------------------------------------------------------------------
1155#D- MPI specifications
1156# --------------------------------------------------------------------
1157
1158# --------------------------------------------------------------------
1159#D- Other specifications
1160# --------------------------------------------------------------------
1161
1162    IGCM_debug_PopStack "IGCM_sys_activ_variables"
1163
1164}
1165
1166############################################################
1167# Desactivate Running Environnment Variables
1168
1169function IGCM_sys_desactiv_variables {
1170    IGCM_debug_PushStack "IGCM_sys_desactiv_variables"
1171    if ( $DEBUG_sys ) ; then
1172        echo "IGCM_sys_desactiv_variables "
1173    fi
1174# --------------------------------------------------------------------
1175#D- MPI specifications
1176# --------------------------------------------------------------------
1177
1178# --------------------------------------------------------------------
1179#D- Other specifications
1180# --------------------------------------------------------------------
1181
1182    IGCM_debug_PopStack "IGCM_sys_desactiv_variables"
1183 
1184}
1185
1186############################################################
1187# Build run file
1188
1189function IGCM_sys_build_run_file {
1190    IGCM_debug_PushStack "IGCM_sys_build_run_file" $@
1191set -x
1192    if ( $DEBUG_sys ) ; then
1193        echo "IGCM_sys_build_run_file " $@
1194    fi
1195
1196    NUM_PROC_OASIS=1
1197
1198    # Set the number of processors for OCE here
1199    NUM_PROC_OCE=5
1200
1201    (( NUM_PROC_ATM = BATCH_NUM_PROC_TOT - NUM_PROC_OASIS - NUM_PROC_OCE ))
1202   
1203    if [ $1 = MPI2 ]; then
1204       echo "IGCM_sys_build_run_file : error - MPI2 not available on vargas. "
1205       IGCM_debug_Exit "IGCM_sys_build_run_file"
1206    elif [ $1 = MPI1 ]; then
1207        cat <<EOF > run_file
1208./oasis
1209EOF
1210
1211        typeset i
1212        (( i = 0 ))
1213        while [ ${i} -lt ${NUM_PROC_ATM} ] ; do
1214            (( i = i + 1 ))
1215            cat <<EOF >> run_file
1216./lmdz.x
1217EOF
1218        done
1219
1220        (( i = 0 ))
1221        while [ ${i} -lt ${NUM_PROC_OCE} ] ; do
1222            (( i = i + 1 ))
1223            cat <<EOF >> run_file
1224./opa.xx
1225EOF
1226        done
1227
1228        wc -l run_file
1229    fi
1230set +x
1231    IGCM_debug_PopStack "IGCM_sys_build_run_file"
1232}
Note: See TracBrowser for help on using the repository browser.