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

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