source: trunk/libIGCM/libIGCM_sys/libIGCM_sys_platine.ksh @ 192

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