source: trunk/libIGCM/libIGCM_sys/libIGCM_sys_mercurex8.ksh @ 531

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

Add IGCM_sys_RshMaster to connect to Master frontend.

  • Property licence set to
    The following licence information concerns ONLY the libIGCM tools
    ==================================================================

    Copyright © Centre National de la Recherche Scientifique CNRS
    Commissariat à l'Énergie Atomique CEA

    libIGCM : Library for Portable Models Computation of IGCM Group.

    IGCM Group is the french IPSL Global Climate Model Group.

    This library is a set of shell scripts and functions whose purpose is
    the management of the initialization, the launch, the transfer of
    output files, the post-processing and the monitoring of datas produce
    by any numerical program on any plateforme.

    This software is governed by the CeCILL license under French law and
    abiding by the rules of distribution of free software. You can use,
    modify and/ or redistribute the software under the terms of the CeCILL
    license as circulated by CEA, CNRS and INRIA at the following URL
    "http://www.cecill.info".

    As a counterpart to the access to the source code and rights to copy,
    modify and redistribute granted by the license, users are provided only
    with a limited warranty and the software's author, the holder of the
    economic rights, and the successive licensors have only limited
    liability.

    In this respect, the user's attention is drawn to the risks associated
    with loading, using, modifying and/or developing or reproducing the
    software by the user in light of its specific status of free software,
    that may mean that it is complicated to manipulate, and that also
    therefore means that it is reserved for developers and experienced
    professionals having in-depth computer knowledge. Users are therefore
    encouraged to load and test the software's suitability as regards their
    requirements in conditions enabling the security of their systems and/or
    data to be ensured and, more generally, to use and operate it in the
    same conditions as regards security.

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