source: tags/libIGCM_v1_1/libIGCM_sys/libIGCM_sys_platine.ksh @ 1168

Last change on this file since 1168 was 21, checked in by mmaipsl, 16 years ago

ACo, AC : change path for rebuild on platine.

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