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

Last change on this file since 40 was 40, checked in by sdipsl, 16 years ago

SD : - Tweak IGCM_sys_RshArchive function for non IDRIS machine

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