source: tags/libIGCM_v2.8.1/libIGCM_sys/libIGCM_sys_default.ksh

Last change on this file was 1318, checked in by sdipsl, 8 years ago
  • Property licence set to
    The following licence information concerns ONLY the libIGCM tools
    ==================================================================

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

    libIGCM : Library for Portable Models Computation of IGCM Group.

    IGCM Group is the french IPSL Global Climate Model Group.

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

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

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

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

    The fact that you are presently reading this means that you have had
    knowledge of the CeCILL license and that you accept its terms.
  • Property svn:keywords set to Revision Author Date
File size: 36.9 KB
Line 
1#!/bin/ksh
2
3#**************************************************************
4# Author: Sebastien Denvil, Martial Mancip
5# Contact: Martial.Mancip__at__ipsl.jussieu.fr
6# $Revision::                                          $ Revision of last commit
7# $Author::                                            $ Author of last commit
8# $Date::                                              $ Date of last commit
9# IPSL (2006)
10#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
11#
12#**************************************************************
13
14#=========================================================
15# The documentation of this file can be automatically generated
16# if you use the prefix #D- for comments to be extracted.
17# Extract with command: cat lib* | grep "^#D-" | cut -c "4-"
18#=========================================================
19
20#D-#==================================================
21#D-LibIGCM_sys Default host
22#D-#==================================================
23#D-
24#D- This ksh library if a layer under some usefull
25#D-environment variables and shell commands.
26#D-All those definitions depend on host particularities.
27#D-It manages a stack mechanism and test validity of operations.
28#D-All function described bellow must be prefixed by IGCM_sys.
29
30#====================================================
31# libIGCM_sys PARAMETERS
32#====================================================
33
34#====================================================
35# set DEBUG_sys to true to output calls of function
36typeset -r DEBUG_sys=${DEBUG_sys:=true}
37
38#====================================================
39# Turn in dry run mode ? (sys_Put_Rest, sys_Put_Out, sys_Get)
40typeset -r DRYRUN=${DRYRUN:=0}
41
42# YOU MUST COMPILE YOUR EXE FILES FOR DRYRUN MODE !
43# -------------------------------------------------------------------------------------
44# | DRYRUN=  |  Date computations, | sys_Get    |  Exe    | sys_Put_Out; sys_Put_Rest |
45# |          |  Cp/Exe/param/files |            |         |                           |
46# |          |  Chmod Qsub         |            |         |                           |
47# -------------------------------------------------------------------------------------
48# |    0     |       yes           |    yes     |  yes    |      yes                  |
49# -------------------------------------------------------------------------------------
50# |    1     |       yes           |    yes     |  yes    |      no                   |
51# -------------------------------------------------------------------------------------
52# |    2     |       yes           |    yes     |  no     |      no                   |
53# -------------------------------------------------------------------------------------
54# |    3     |       yes           |    no      |  no     |      no                   |
55# -------------------------------------------------------------------------------------
56
57#=====================================================
58# Global Variables :
59#=====================================================
60# Language : "fr" or "en"
61typeset -r MYLANG="fr"
62
63#=====================================================
64# Host user names project maxCpuTime
65# $hostname ou hostname
66typeset HOST=${HOST:=$( hostname )}
67# $username ou whoami
68typeset LOGIN=${LOGIN:=$( whoami )}
69# $hostname of the MASTER job
70typeset MASTER=${MASTER:=$( hostname )}
71# project name
72typeset PROJECT=NONE
73# jobWarningDelay in seconds
74typeset jobWarningDelay=NONE
75
76#D-
77#D-#==================================================
78#D-Program used in libIGCM
79#D-#==================================================
80
81# Submit command
82typeset SUBMIT=${SUBMIT:=qsub}
83# rsync with path
84typeset -r RSYNC=/usr/bin/rsync
85# RSYNC_opt args to rsync
86typeset -r RSYNC_opt="-va"
87# ie storage filesystem
88typeset -r STOREHOST=${MASTER}
89
90#====================================================
91# Set environment tools (ferret, nco, cdo, rebuild, ...)
92#====================================================
93#. /home/${LOGIN}/.atlas_env_${HOST}_ksh
94#export PATH=${PATH}:/home/${LOGIN}/rebuild/bin/
95
96#====================================================
97# Host specific DIRECTORIES
98#====================================================
99
100#====================================================
101#- MirrorlibIGCM for frontend
102typeset -r MirrorlibIGCM=${MirrorlibIGCM:=false}
103
104#====================================================
105#- libIGCM_POST for frontend
106typeset -r libIGCM_POST=${libIGCM}
107
108#====================================================
109#- R_EXE   (==> BIN_DIR = ${MODIPSL}/bin )
110typeset -r R_EXE="${MODIPSL}/bin"
111
112#====================================================
113#- SUBMIT_DIR : submission dir
114typeset -x SUBMIT_DIR=${SUBMIT_DIR:=${PWD}}
115
116#====================================================
117#- IN
118typeset -r R_IN=${R_IN:=/home/${LOGIN}/IGCM}
119typeset -r R_IN_ECMWF=${R_IN_ECMWF:=/home/${LOGIN}/IGCM}
120
121#====================================================
122#- RUN_DIR_PATH : Temporary working directory (=> TMP)
123typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=/home/${LOGIN}/RUN_DIR/tmp$$}
124
125#====================================================
126#- OUTCOMMAND_PATH : tmp place to store command lines standard error and outputs
127typeset -r OUTCOMMAND_PATH=/tmp
128
129#====================================================
130#- HOST_MPIRUN_COMMAND
131typeset -r HOST_MPIRUN_COMMAND=${HOST_MPIRUN_COMMAND:="time mpirun"}
132
133#====================================================
134#- Max number of arguments passed to nco operator or demigration command
135UNIX_MAX_LIMIT=360
136
137#====================================================
138#- set PackDefault to false on the default machine
139PackDefault=false
140
141#====================================================
142#- Default number of MPI task for IPSL coupled model
143#- required for backward compatibility
144#-
145DEFAULT_NUM_PROC_OCE=5
146DEFAULT_NUM_PROC_CPL=1
147(( DEFAULT_NUM_PROC_ATM = BATCH_NUM_PROC_TOT - DEFAULT_NUM_PROC_OCE - DEFAULT_NUM_PROC_CPL ))
148
149#D-#==================================================
150#D-function IGCM_sys_defineArchives
151#D-* Purpose:
152#D-* Define ARCHIVE : Dedicated to large files
153#D-* Define STORAGE : Dedicated to small/medium files
154#D-* Define R_OUT   : Output tree located on ARCHIVE
155#D-* Define R_FIG   : Output tree located on STORAGE hosting figures (monitoring and atlas, and/or small files)
156#D-* Define R_BUF   : Output tree located on STORAGE hosting files waiting for rebuild or pack processes
157#D-* if SpaceName=TEST nothing special will hapen
158#D-* Examples:
159#D-
160function IGCM_sys_defineArchives {
161  IGCM_debug_PushStack "IGCM_sys_defineArchives"
162
163  if [ ! X${config_UserChoices_ARCHIVE} = X ]; then
164    #====================================================
165    #- ARCHIVE (dedicated to large files)
166    ARCHIVE=${config_UserChoices_ARCHIVE}
167  else
168    #====================================================
169    #- ARCHIVE (dedicated to large files)
170    ARCHIVE=${ARCHIVE:=/home/${LOGIN}}
171  fi
172
173  if [ ! X${config_UserChoices_STORAGE} = X ]; then
174    #====================================================
175    #- STORAGE (dedicated to small/medium files)
176    STORAGE=${config_UserChoices_STORAGE}
177  else
178    #====================================================
179    #- STORAGE (dedicated to small/medium files)
180    STORAGE=${ARCHIVE}
181  fi
182
183  # ON DEFAULT MACHINE NO SPECIAL CASE WHEN X${config_UserChoices_SpaceName} = XTEST
184
185  #====================================================
186  #- R_OUT
187  R_OUT=${ARCHIVE}/IGCM_OUT
188
189  #====================================================
190  #- R_FIG (hosting figures : monitoring and atlas, and/or small files)
191  R_FIG=${STORAGE}/IGCM_OUT
192
193  #====================================================
194  #- R_BUF (ONLY FOR double copy an scratch)
195  R_BUF=${STORAGE}/IGCM_OUT
196
197  IGCM_debug_Print 1 "R_OUT has been defined = ${R_OUT}"
198  IGCM_debug_Print 1 "R_BUF has been defined = ${R_BUF}"
199  IGCM_debug_Print 1 "R_FIG has been defined = ${R_FIG}"
200
201  IGCM_debug_PopStack "IGCM_sys_defineArchives"
202}
203
204#D-#==================================================
205#D-function IGCM_sys_RshArchive
206#D-* Purpose: Archive rsh command
207#D-* Examples:
208#D-
209function IGCM_sys_RshArchive {
210  IGCM_debug_PushStack "IGCM_sys_RshArchive" $@
211  /bin/ksh <<-EOF
212    ${@}
213EOF
214  status=$?
215  if [ ${status} -gt 0 ] ; then
216    IGCM_debug_Print 2 "IGCM_sys_RshArchive : command failed error code ${status}"
217    IGCM_debug_Exit "IGCM_sys_RshArchive"
218  fi
219  IGCM_debug_PopStack "IGCM_sys_RshArchive"
220}
221
222#D-#==================================================
223#D-function IGCM_sys_RshArchive_NoError
224#D-* Purpose: Archive rsh command, without error
225#D-*          used only in monitoring.job
226#D-* Examples:
227#D-
228function IGCM_sys_RshArchive_NoError {
229  IGCM_debug_PushStack "IGCM_sys_RshArchive_NoError" $@
230  /bin/ksh <<-EOF
231    ${@} 2> /dev/null
232EOF
233  IGCM_debug_PopStack "IGCM_sys_RshArchive_NoError"
234}
235
236#D-#==================================================
237#D-function IGCM_sys_MkdirArchive
238#D-* Purpose: Mkdir on Archive
239#D-* Examples:
240#D-
241function IGCM_sys_MkdirArchive {
242  IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@
243  if ( $DEBUG_sys ) ; then
244    echo "IGCM_sys_MkdirArchive :" $@
245  fi
246  #- creation de repertoire sur le serveur fichier
247  if [ ! -d ${1} ]; then
248    \mkdir -p $1
249    status=$?
250
251    if [ ${status} -gt 0 ] ; then
252      IGCM_debug_Print 2 "IGCM_sys_MkdirArchive : mkdir failed error code ${status}"
253      IGCM_debug_Exit "IGCM_sys_MkdirArchive"
254    fi
255  fi
256  IGCM_debug_PopStack "IGCM_sys_MkdirArchive"
257}
258
259#D-#==================================================
260#D-function IGCM_sys_TestDirArchive
261#D-* Purpose: Test Directory that must exists on Archive
262#D-* Examples:
263#D-
264function IGCM_sys_TestDirArchive {
265  IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@
266  if ( $DEBUG_sys ) ; then
267    echo "IGCM_sys_TestDirArchive :" $@
268  fi
269  typeset ExistFlag
270  ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
271  IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
272  return ${ExistFlag}
273}
274
275#D-#==================================================
276#D-function IGCM_sys_IsFileArchived
277#D-* Purpose: Test file that must NOT EXISTS on Archive based on filename only
278#D-* Examples:
279#D-
280function IGCM_sys_IsFileArchived {
281  IGCM_debug_PushStack "IGCM_sys_IsFileArchived" $@
282  if ( $DEBUG_sys ) ; then
283    echo "IGCM_sys_IsFileArchived :" $@
284  fi
285  typeset IsArchivedFlag
286  # Never archived for this system
287  IsArchivedFlag=1
288  IGCM_debug_PopStack "IGCM_sys_IsFileArchived"
289
290  return ${IsArchivedFlag}
291}
292
293#D-#==================================================
294#D-function IGCM_sys_TestFileArchive
295#D-* Purpose: Test file that must NOT EXISTS on Archive
296#D-* Examples:
297#D-
298function IGCM_sys_TestFileArchive {
299  IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@
300  typeset ExistFlag
301  ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 )
302  IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
303
304  return ${ExistFlag}
305}
306
307#D-#==================================================
308#D-function IGCM_sys_CountFileArchive
309#D-* Purpose: Count files on Archive filesystem
310#D-* Examples:
311#D-
312function IGCM_sys_CountFileArchive {
313  IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@
314  ls ${@} 2>/dev/null | wc -l
315  if [ $? -gt 0 ] ; then
316    echo "IGCM_sys_CountFileArchive : erreur."
317  fi
318  IGCM_debug_PopStack "IGCM_sys_CountFileArchive"
319}
320
321#D-#==================================================
322#D-function IGCM_sys_Tree
323#D-* Purpose: Tree directories with files on ${ARCHIVE}
324#D-* Examples: IGCM_sys_Tree ${R_IN} ${R_OUT}
325#D-
326function IGCM_sys_Tree {
327  IGCM_debug_PushStack "IGCM_sys_Tree" $@
328  if ( $DEBUG_sys ) ; then
329    echo "IGCM_sys_Tree :" $@
330  fi
331
332  \ls -lR ${@}
333
334  IGCM_debug_PopStack "IGCM_sys_Tree"
335}
336
337#D-#==================================================
338#D-function IGCM_sys_Qsub
339#D-* Purpose: Qsub new job
340#D-* Examples:
341#D-
342function IGCM_sys_Qsub {
343  IGCM_debug_PushStack "IGCM_sys_Qsub" $@
344  if ( $DEBUG_sys ) ; then
345    echo "IGCM_sys_Qsub :" $@
346  fi
347  echo "${@} > ${SUBMIT_DIR}/${Script_Output} 2>&1 &"
348  ${@} > ${SUBMIT_DIR}/${Script_Output} 2>&1 &
349  if [ $? -gt 0 ] ; then
350    echo "IGCM_sys_Qsub : erreur ${options} $1"
351    IGCM_debug_Exit "IGCM_sys_Qsub"
352  fi
353  IGCM_debug_PopStack "IGCM_sys_Qsub"
354}
355
356#D-#==================================================
357#D-function IGCM_sys_QsubPost
358#D-* Purpose: Qsub new job on scalaire
359#D-* Examples:
360#D-
361function IGCM_sys_QsubPost {
362  IGCM_debug_PushStack "IGCM_sys_QsubPost" $@
363  if ( $DEBUG_sys ) ; then
364    echo "IGCM_sys_QsubPost :" $@
365  fi
366  echo "${libIGCM_POST}/$1.job > ${POST_DIR}/$1.${PeriodDateEnd}.out 2>&1 &"
367  ${libIGCM_POST}/$1.job > ${POST_DIR}/${Script_Post_Output}.out 2>&1 &
368  if [ $? -gt 0 ] ; then
369    echo "IGCM_sys_QsubPost : erreur " $@
370    IGCM_debug_Exit "IGCM_sys_QsubPost"
371  fi
372  IGCM_debug_PopStack "IGCM_sys_QsubPost"
373}
374
375#D-*************************
376#D- File transfer functions
377#D-*************************
378#D-
379
380#D-#==================================================
381#D-function IGCM_sys_RmRunDir
382#D-* Purpose: rm tmpdir (dummy function most of the time batch
383#D-                      scheduler will do the job)
384#D-* Examples:
385#D-
386function IGCM_sys_RmRunDir {
387  IGCM_debug_PushStack "IGCM_sys_RmRunDir" $@
388  if ( $DEBUG_sys ) ; then
389    echo "IGCM_sys_RmRunDir :" $@
390    IGCM_debug_Print 1 "Dummy call, let the user do that."
391  fi
392  IGCM_debug_PopStack "IGCM_sys_RmRunDir"
393}
394
395#D-#==================================================
396#D-function IGCM_sys_Put_Dir
397#D-* Purpose: Copy a complete directory on $(ARCHIVE)
398#D-* Examples:
399#D-
400function IGCM_sys_Put_Dir {
401  IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@
402  if ( $DEBUG_sys ) ; then
403    echo "IGCM_sys_Put_Dir :" $@
404  fi
405  if [ $DRYRUN = 0 ]; then
406    if [ ! -d ${1} ] ; then
407      echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ."
408      IGCM_debug_PopStack "IGCM_sys_Put_Dir"
409      return
410    fi
411
412    typeset status
413
414    # Only if we use rsync
415    #IGCM_sys_TestDirArchive $( dirname $2 )
416    #
417    #USUAL WAY
418    \cp -r $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
419    status=$?
420
421    if [ ${status} -gt 0 ] ; then
422      IGCM_debug_Print 2 "IGCM_sys_Put_Dir : cp failed error code ${status}"
423      cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
424      IGCM_debug_Exit "IGCM_sys_Put_Dir"
425    else
426      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
427    fi
428  fi
429  IGCM_debug_PopStack "IGCM_sys_Put_Dir"
430}
431
432#D-#==================================================
433#D-function IGCM_sys_Get_Dir
434#D-* Purpose: Copy a complete directory from ${ARCHIVE}
435#D-* Examples:
436#D-
437function IGCM_sys_Get_Dir {
438  IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@
439  if ( $DEBUG_sys ) ; then
440    echo "IGCM_sys_Get_Dir :" $@
441  fi
442  if [ $DRYRUN = 0 ]; then
443    typeset NB_ESSAI DELAI status i
444    # number of tentative
445    NB_ESSAI=3
446    # time delay between tentative
447    DELAI=2
448
449    #
450    # USUAL WAY
451    i=0
452    while [ $i -lt $NB_ESSAI ] ; do
453      \cp -ur $1 $2 >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
454      status=$?
455      if [ ${status} -gt 0 ] ; then
456        IGCM_debug_Print 2 "IGCM_sys_Get_Dir : cp failed error code ${status} ${i}/${NB_ESSAI}"
457        IGCM_debug_Print 2 "IGCM_sys_Get_Dir : sleep ${DELAI} seconds and try again."
458        sleep $DELAI
459      else
460        break
461      fi
462      (( i = i + 1 ))
463    done
464
465    if [ ${status} -gt 0 ] ; then
466      IGCM_debug_Print 2 "IGCM_sys_Get_Dir : cp failed error code ${status}"
467      cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
468      IGCM_debug_Exit "IGCM_sys_Get_Dir"
469    else
470      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
471    fi
472  fi
473  IGCM_debug_PopStack "IGCM_sys_Get_Dir"
474}
475
476#D-#==================================================
477#D-function IGCM_sys_Put_Rest
478#D-* Purpose: Put computied restarts on ${ARCHIVE}.
479#D-           File and target directory must exist.
480#D-* Examples:
481#D-
482function IGCM_sys_Put_Rest {
483  IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@
484  if ( $DEBUG_sys ) ; then
485    echo "IGCM_sys_Put_Rest :" $@
486  fi
487  if [ $DRYRUN = 0 ]; then
488    if [ ! -f ${1} ] ; then
489      echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ."
490      IGCM_debug_Exit "IGCM_sys_Put_Rest"
491    fi
492
493    typeset status
494    #
495    # USUAL WAY
496    \cp $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
497    status=$?
498
499#       #RSYNC WITH NETWORK SSH CALL
500#       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
501#       ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
502
503#       #RSYNC WITH NFS USE
504#       echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
505#       ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
506
507#       status=$?
508#       IGCM_sys_Rsync_out $status
509
510#       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
511#       (( status=status+$? ))
512
513    if [ ${status} -gt 0 ] ; then
514      IGCM_debug_Print 2 "IGCM_sys_Put_Rest : cp failed error code ${status}"
515      [ -f ${1} ] && ls -l ${1}
516      [ -f ${2} ] && ls -l ${2}
517      [ -f ${2}/${1} ] && ls -l ${2}/${1}
518      cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
519      IGCM_debug_Exit "IGCM_sys_Put_Rest"
520    else
521
522      if [ X${JobType} = XRUN ] ; then
523        [ -f ${2} ] && IGCM_sys_Chmod 444 ${2}
524        [ -f ${2}/${1} ] && IGCM_sys_Chmod 444 ${2}/${1}
525      fi
526
527      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
528    fi
529  fi
530  IGCM_debug_PopStack "IGCM_sys_Put_Rest"
531}
532
533#D-#==================================================
534#D-function IGCM_sys_Put_Out
535#D-* Purpose: Copy a file on ${ARCHIVE} after having chmod it in readonly
536#D-* Examples:
537#D-
538function IGCM_sys_Put_Out {
539  IGCM_debug_PushStack "IGCM_sys_Put_Out" $@
540  if ( $DEBUG_sys ) ; then
541    echo "IGCM_sys_Put_Out :" $@
542  fi
543
544  typeset status
545
546  if [ $DRYRUN = 0 ]; then
547    if [ ! -f ${1} ] ; then
548      echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ."
549      IGCM_debug_PopStack "IGCM_sys_Put_Out"
550      return 1
551    fi
552    #
553    IGCM_sys_MkdirArchive $( dirname $2 )
554    #
555    if [ X${JobType} = XRUN ] ; then
556      if [ X${3} = X ] ; then
557        IGCM_sys_Chmod 444 ${1}
558      fi
559    fi
560    #
561
562    echo ${RSYNC} ${RSYNC_opt} $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
563    ${RSYNC} ${RSYNC_opt} $1 $2 >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
564    status=$?
565    IGCM_sys_Rsync_out $status
566
567    ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
568    (( status=status+$? ))
569
570    if [ ${status} -gt 0 ] ; then
571      IGCM_debug_Print 2 "IGCM_sys_Put_Out : rsync failed error code ${status}"
572      cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
573      IGCM_debug_Exit "IGCM_sys_Put_Out"
574    else
575      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
576    fi
577  fi
578  IGCM_debug_PopStack "IGCM_sys_Put_Out"
579  return 0
580}
581
582#D-#==================================================
583#D-function IGCM_sys_Get
584#D-* Purpose: Get a file from ${ARCHIVE}
585#D-* Examples: IGCM_sys_Get myfile /destpath/myfile_with_PREFIX
586#D-            IGCM_sys_Get /l Array_contain_myfiles /destpath/
587function IGCM_sys_Get {
588  IGCM_debug_PushStack "IGCM_sys_Get" $@
589
590  typeset DEST status dm_liste
591
592  if ( $DEBUG_sys ) ; then
593    echo "IGCM_sys_Get :" $@
594  fi
595  if [ $DRYRUN -le 2 ]; then
596    if [ X${1} = X'/l' ] ; then
597      eval set +A dm_liste \${${2}}
598    else
599      dm_liste=${1}
600    fi
601    eval DEST=\${${#}}
602
603    # test if the (first) file is present in the old computation :
604    IGCM_sys_TestFileArchive ${dm_liste[0]}
605    status=$?
606    if [ ${status} -gt 0 ] ; then
607      echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ."
608      IGCM_debug_Exit "IGCM_sys_Get"
609      return
610    fi
611
612    #USUAL WAY
613    \cp ${dm_liste[*]} ${DEST} > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
614    status=$?
615
616    if [ ${status} -gt 0 ] ; then
617      IGCM_debug_Print 2 "IGCM_sys_Get : cp failed error code ${status}"
618      cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
619      IGCM_debug_Exit "IGCM_sys_Get"
620    else
621      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
622    fi
623  fi
624  IGCM_debug_PopStack "IGCM_sys_Get"
625}
626
627#D-#==================================================
628#D-function IGCM_sys_GetDate_Monitoring
629#D-* Purpose: get the last year for which the monitoring has been computed
630#D-* Examples:
631#D-
632function IGCM_sys_GetDate_Monitoring {
633  IGCM_debug_PushStack "IGCM_sys_GetDate_Monitoring" $@
634  if ( $DEBUG_sys ) ; then
635    echo "IGCM_sys_GetDate_Monitoring :" $@
636  fi
637
638  eval ${2}=$( cdo showyear ${1} 2> /dev/null | gawk '{ print $NF }' )
639
640  IGCM_debug_PopStack "IGCM_sys_GetDate_Monitoring"
641}
642
643#D-#==================================================
644#D-function IGCM_sys_Dods_Rm
645#D-* Purpose: DO NOTHING ! Put ${ARCHIVE} files on DODS internet protocole.
646#D-* Examples:
647#D-
648function IGCM_sys_Dods_Rm {
649  if ( $DEBUG_sys ) ; then
650    echo "IGCM_sys_Dods_Rm :" $@
651  fi
652  return 0
653}
654
655#D-#==================================================
656#D-function IGCM_sys_Dods_Cp
657#D-* Purpose: Copy $(ARCHIVE) files on DODS internet protocole.
658#D-* Examples:
659#D-
660function IGCM_sys_Dods_Cp {
661  if ( $DEBUG_sys ) ; then
662    echo "IGCM_sys_Dods_Cp :" $@
663  fi
664  return 0
665}
666
667#D-#==================================================
668#D-function IGCM_sys_Put_Dods
669#D-* Purpose: Put ${ARCHIVE} files on DODS internet protocole. Dummy function here
670#D-* Examples:
671#D-
672function IGCM_sys_Put_Dods {
673  IGCM_debug_PushStack "IGCM_sys_Put_Dods" $@
674  if ( $DEBUG_sys ) ; then
675    echo "IGCM_sys_Put_Dods :" $@
676  fi
677  IGCM_debug_PopStack "IGCM_sys_Put_Dods"
678}
679
680##############################################################
681# REBUILD OPERATOR
682
683#D-#==================================================
684#D-function IGCM_sys_sync
685#D-* Purpose: flush buffer on disk (dummy function on Default machine)
686#D-* Examples:
687#D-
688function IGCM_sys_sync {
689  IGCM_debug_PushStack "IGCM_sys_sync" $@
690  if ( $DEBUG_sys ) ; then
691    echo "IGCM_sys_sync :" $@
692    echo "Dummy call, let the system do that."
693  fi
694  IGCM_debug_PopStack "IGCM_sys_sync"
695}
696
697############################################################
698# Activate Running Environnment Variables
699
700#D-#==================================================
701#D-function IGCM_sys_activ_variables
702#D-* Purpose: set environement variables prior to execution
703#D-* Examples:
704#D-
705function IGCM_sys_activ_variables {
706  IGCM_debug_PushStack "IGCM_sys_activ_variables"
707  if ( $DEBUG_sys ) ; then
708    echo "IGCM_sys_activ_variables"
709  fi
710
711# --------------------------------------------------------------------
712#D- MPI specifications
713# --------------------------------------------------------------------
714
715# --------------------------------------------------------------------
716#D- Other specifications
717# --------------------------------------------------------------------
718
719  ulimit -s unlimited
720
721  IGCM_debug_PopStack "IGCM_sys_activ_variables"
722}
723
724############################################################
725# Desactivate Running Environnment Variables
726
727#D-#==================================================
728#D-function IGCM_sys_desactiv_variables
729#D-* Purpose: unset environement variables after execution
730#D-* Examples:
731#D-
732function IGCM_sys_desactiv_variables {
733  IGCM_debug_PushStack "IGCM_sys_desactiv_variables"
734  if ( $DEBUG_sys ) ; then
735    echo "IGCM_sys_desactiv_variables"
736  fi
737# --------------------------------------------------------------------
738#D- MPI specifications
739# --------------------------------------------------------------------
740
741# --------------------------------------------------------------------
742#D- Other specifications
743# --------------------------------------------------------------------
744
745  IGCM_debug_PopStack "IGCM_sys_desactiv_variables"
746}
747
748############################################################
749# Update job headers to be used by the scheduler
750
751#D-#==================================================
752#D-function IGCM_sys_updateHeaders
753#D-* Purpose: Update job headers to be used by the scheduler
754#D-* Examples: IGCM_sys_updateHeaders /path/to/Job_MYEXP
755#D-
756function IGCM_sys_updateHeaders {
757  IGCM_debug_PushStack "IGCM_sys_updateHeaders"
758  if ( $DEBUG_sys ) ; then
759    echo "IGCM_sys_updateHeaders"
760  fi
761  typeset file
762  file=$1
763
764  if [ ${executionType} -eq 1 ] ; then
765    # MPMD + MPI
766    sed -e "/::openMPthreads::/d"                  \
767        -e "s/::JobNumProcTot::/${coreNumber}/"    \
768      ${file} > ${file}.tmp
769
770  elif [ ${executionType} -eq 2 ] ; then
771    # MPMD + MPI + OMP
772    sed -e "s/::openMPthreads::/${openMPthreads}/" \
773        -e "s/::JobNumProcTot::/${coreNumber}/"    \
774      ${file} > ${file}.tmp
775
776  elif [ ${executionType} -eq 3 ] ; then
777    # SPMD + MPI/OMP
778    sed -e "s/::openMPthreads::/${openMPthreads}/" \
779        -e "s/::JobNumProcTot::/${mpiTasks}/"      \
780      ${file} > ${file}.tmp
781
782  elif [ ${executionType} -eq 4 ] ; then
783    # SPMD + MPI only
784    sed -e "s/::JobNumProcTot::/${mpiTasks}/"      \
785        -e "/::openMPthreads::/d"                  \
786      ${file} > ${file}.tmp
787
788  elif [ ${executionType} -eq 5 ] ; then
789    # SPMD + OMP only
790    sed -e "s/::openMPthreads::/${openMPthreads}/" \
791        -e "/::JobNumProcTot::/d"                  \
792      ${file} > ${file}.tmp
793
794  elif [ ${executionType} -eq 6 ] ; then
795    # SEQUENTIAL THEN
796    sed -e "s/::JobNumProcTot::/1/"                \
797        -e "/::openMPthreads::/d"                  \
798      ${file} > ${file}.tmp
799
800  fi
801
802  IGCM_sys_Mv ${file}.tmp ${file}
803
804  IGCM_debug_PopStack "IGCM_sys_updateHeaders"
805}
806
807############################################################
808# Build MPI/OMP scripts run file (dummy function)
809
810#D-#==================================================
811#D-function IGCM_sys_build_run_file
812#D-* Purpose: build run file (deprecated)
813#D-* Examples:
814#D-
815function IGCM_sys_build_run_file {
816  IGCM_debug_Print 3 " dummy function : IGCM_sys_build_run_file "
817}
818
819############################################################
820# Build MPI/OMP scripts
821
822#D-#==================================================
823#D-function IGCM_sys_build_execution_scripts
824#D-* Purpose: build execution scripts to be launch by ${HOST_MPIRUN_COMMAND}
825#D-* Examples:
826#D-
827function IGCM_sys_build_execution_scripts
828{
829  IGCM_debug_PushStack "IGCM_sys_build_execution_scripts" $@
830  if ( $DEBUG_sys ) ; then
831    echo "IGCM_sys_build_execution_scripts " $@
832  fi
833
834  EXECUTION=${HOST_MPIRUN_COMMAND}
835
836  # MPMD mode
837  if ( ${OK_PARA_MPMD} ) ; then
838
839    # Only MPI (MPMD)
840    if  ( ! ${OK_PARA_OMP} ) ; then
841
842      if [ -f run_file ] ; then
843        IGCM_sys_Rm -f run_file
844      fi
845      touch run_file
846
847      # Build run_file
848
849      # First loop on the components for the coupler ie oasis (only if oasis3)
850      # the coupler ie oasis3 must be the first one
851      for comp in ${config_ListOfComponents[*]} ; do
852
853        eval ExeNameIn=\${config_Executable_${comp}[0]}
854        eval ExeNameOut=\${config_Executable_${comp}[1]}
855
856        # for CPL component only
857        if [ "X${comp}" = "XCPL" ]  && [ "X${ExeNameOut}" != X\"\" ] ; then
858          eval comp_proc_mpi_loc=\${${comp}_PROC_MPI}
859          eval comp_proc_omp_loc=\${${comp}_PROC_OMP}
860          echo "-np ${comp_proc_mpi_loc} ./${ExeNameOut} " >> run_file
861        fi
862      done
863
864      # Then second loop on the components
865      for comp in ${config_ListOfComponents[*]} ; do
866
867        eval ExeNameIn=\${config_Executable_${comp}[0]}
868        eval ExeNameOut=\${config_Executable_${comp}[1]}
869
870        # Only if we really have an executable for the component and not the coupler ie oasis:
871        if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${comp}" != "XCPL" ] ) ; then
872
873          eval comp_proc_mpi_loc=\${${comp}_PROC_MPI}
874          eval comp_proc_omp_loc=\${${comp}_PROC_OMP}
875          echo "-np ${comp_proc_mpi_loc} ./${ExeNameOut}" >> run_file
876        fi
877      done
878
879      EXECUTION="${HOST_MPIRUN_COMMAND} --app ./run_file"
880
881      IGCM_sys_Chmod u+x run_file
882      if ( $DEBUG_sys ) ; then
883        echo "run_file contains : "
884        cat run_file
885      fi
886 
887    # MPI-OpenMP (MPMD)
888    else
889
890      #  Hosts treatment
891      ${HOST_MPIRUN_COMMAND} hostname | sort | uniq > hosts.tmp
892
893      i=0
894      rm -f hosts
895      IGCM_debug_Print 1 "sys $( hostname ), Hosts available :"
896      for nodes in `cat hosts.tmp` ; do
897        host[$i]=$nodes
898        echo "${host[$i]} slots=1 max_slots=1" >> hosts
899        IGCM_debug_Print 1 ${host[$i]}
900        i=$((i+1))
901      done
902      rm -f hosts.tmp
903
904      listnodes=${host[*]}
905
906      EXECUTION="${HOST_MPIRUN_COMMAND} -hostfile hosts"
907
908      # Initialisation
909      rank=0
910      current_core=0
911      core_per_node=4
912      init_exec=n
913
914      # Loop on the components
915      for comp in ${config_ListOfComponents[*]} ; do
916
917        eval ExeNameIn=\${config_Executable_${comp}[0]}
918        eval ExeNameOut=\${config_Executable_${comp}[1]}
919
920        # Not possible if oasis has an executable (i.e old version of oasis3)
921        if ( [ "X${ExeNameOut}" != X\"\" ] &&  [ "X${comp}" = "XCPL" ] ) ; then
922          IGCM_debug_Exit "ERROR MPMD with hybrid MPI-OpenMP is not available with oasis3 version"
923          IGCM_debug_Print 2 "Only available with oasis3-MCT version coupler"
924          IGCM_debug_Verif_Exit
925        fi
926
927        # Only if we really have an executable for the component :
928        if [ "X${ExeNameOut}" != X\"\" ] ; then
929
930          eval comp_proc_mpi_loc=\${${comp}_PROC_MPI}
931          eval comp_proc_omp_loc=\${${comp}_PROC_OMP}
932
933          echo "#!/bin/ksh" > script_${ExeNameOut}.ksh
934          echo ""  >> script_${ExeNameOut}.ksh
935          if [ ${comp_proc_omp_loc} -gt 1 ] ; then
936
937            # Check if the number of threads is correct
938            case ${comp_proc_omp_loc} in
939            2|4)
940              IGCM_debug_Print 1 "You run ${ExeNameOut} on ${comp_proc_omp_loc} OMP threads"
941              ;;
942            *)
943              IGCM_debug_Exit "ERROR with OMP parameters !"
944              IGCM_debug_Print 2 "${comp_proc_omp_loc} is not possible as number of OMP threads"
945              IGCM_debug_Print 2 "Only 2,4 as number of OMP threads are possible "
946              IGCM_debug_Verif_Exit
947              ;;
948            esac
949            #echo "export KMP_STACKSIZE=3g"  >> script_${ExeNameOut}.ksh
950            #echo "export KMP_LIBRARY=turnaround"  >> script_${ExeNameOut}.ksh
951            #echo "export MKL_SERIAL=YES"  >> script_${ExeNameOut}.ksh
952            echo "export OMP_STACKSIZE=200M" >> script_${ExeNameOut}.ksh
953            echo "export OMP_NUM_THREADS=${comp_proc_omp_loc}" >> script_${ExeNameOut}.ksh
954          fi
955
956          #echo "./${ExeNameOut}" >> script_${ExeNameOut}.ksh
957          echo "(( MYMPIRANK = OMPI_COMM_WORLD_RANK )) " >> script_${ExeNameOut}.ksh
958          echo "MYMPIRANK=\$(printf '%3.3d\n' \${MYMPIRANK})" >> script_${ExeNameOut}.ksh
959          echo "./${ExeNameOut} > out_${ExeNameOut}.out.\${MYMPIRANK} 2>out_${ExeNameOut}.err.\${MYMPIRANK}" >> script_${ExeNameOut}.ksh
960          IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh
961
962          if [ ${init_exec} = y ] ; then
963            EXECUTION="${EXECUTION} : -np ${comp_proc_mpi_loc} ./script_${ExeNameOut}.ksh"
964          else
965            EXECUTION="${EXECUTION} -np ${comp_proc_mpi_loc} ./script_${ExeNameOut}.ksh"
966            init_exec=y
967          fi
968
969          # Build rankfile : method used to assign cores and nodes for the MPI process
970          # Ex :
971          #rank 0=curie5296 slot=0,1,2,3
972          #rank 1=curie5296 slot=4,5,6,7
973          # Example of final command :
974          # mpirun -hostfile hosts -rankfile rankfile -np 27 ./script_lmdz.x.ksh : -np 5 ./script_opa.xx.ksh
975          # with script_lmdz.x.ksh :
976          # #!/bin/ksh
977          #export OMP_STACKSIZE=200M
978          #export OMP_NUM_THREADS=4
979          #./lmdz.x
980
981          for nb_proc_mpi in `seq 0 $(($comp_proc_mpi_loc-1))`; do
982            (( index_host = current_core / core_per_node ))
983            host_value=${host[${index_host}]}
984            (( slot =  current_core % core_per_node ))
985            virg=","
986            string_final=""
987            for index in `seq $slot $(($slot+$comp_proc_omp_loc-1))`; do
988              string=$index$virg
989              string_final=$string_final$string
990            done
991            string_final=$( echo $string_final | sed "s/.$//" )
992            echo "rank $rank=$host_value slot=$string_final" >> rankfile
993            (( rank = rank + 1 ))
994            (( current_core = current_core + comp_proc_omp_loc ))
995          done
996        fi
997      done
998    fi
999
1000  # Only one executable (SPMD mode).
1001  else
1002
1003    for comp in ${config_ListOfComponents[*]} ; do
1004
1005      # Only if we really have an executable for the component :
1006      eval ExeNameOut=\${config_Executable_${comp}[1]}
1007      if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${ExeNameOut}" != "Xinca.dat" ] ) ; then
1008
1009        echo "#!/bin/ksh" > script_${ExeNameOut}.ksh
1010        echo ""  >> script_${ExeNameOut}.ksh
1011        if ( ${OK_PARA_OMP} ) ; then
1012          eval comp_proc_omp_loc=\${${comp}_PROC_OMP}
1013          echo "export OMP_STACKSIZE=200M" >> script_${ExeNameOut}.ksh
1014          echo "export OMP_NUM_THREADS=${comp_proc_omp_loc}" >> script_${ExeNameOut}.ksh
1015        fi
1016        if  ( ${OK_PARA_MPI} ) ; then
1017          # Default : mpirun used if nb_proc gt 1
1018          # pour sortie out/err par process
1019          echo "./${ExeNameOut} > out_${ExeNameOut}.out.\${OMPI_COMM_WORLD_RANK} 2>out_${ExeNameOut}.err.\${OMPI_COMM_WORLD_RANK}"  >> script_${ExeNameOut}.ksh
1020          #echo "./${ExeNameOut}" >> script_${ExeNameOut}.ksh
1021          IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh
1022          EXECUTION="${HOST_MPIRUN_COMMAND} ./script_${ExeNameOut}.ksh"
1023        else
1024          # Default : mpirun is NOT used if nb_proc eq 1
1025          # pour sortie out/err par process
1026          echo "./${ExeNameOut} > out_${ExeNameOut}.out 2>out_${ExeNameOut}.err" >> script_${ExeNameOut}.ksh
1027          #echo "./${ExeNameOut}" >> script_${ExeNameOut}.ksh
1028          IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh
1029          EXECUTION="time ./script_${ExeNameOut}.ksh"
1030        fi
1031
1032        IGCM_debug_Print 1 "sys $( hostname ) : script_${ExeNameOut}.ksh contains"
1033        cat script_${ExeNameOut}.ksh
1034
1035      fi
1036
1037    done
1038
1039  fi
1040
1041  IGCM_debug_Print 1 "sys $( hostname ) : execution command is"
1042  IGCM_debug_Print 1 "$EXECUTION"
1043
1044  IGCM_debug_PopStack "IGCM_sys_build_execution_scripts"
1045}
1046
1047#D-#==================================================
1048#D-function IGCM_sys_check_path
1049#D-* Purpose: check that RUN_DIR_PATH that will be removed on some machine
1050#D-* do not point to an important use directory. Stop immediately in that case.
1051#D-* Examples:
1052#D-
1053function IGCM_sys_check_path {
1054  IGCM_debug_PushStack "IGCM_sys_check_path"
1055  if ( $DEBUG_sys ) ; then
1056    echo "IGCM_sys_check_path"
1057  fi
1058
1059  if ( [ X${RUN_DIR_PATH} = X${HOME} ] || [ X${RUN_DIR_PATH} = X${ARCHIVE} ] ) ; then
1060    IGCM_debug_Print 1 "Variable RUN_DIR_PATH is pointing to an important directory : ${RUN_DIR_PATH}"
1061    IGCM_debug_Print 1 "Please check the RUN_DIR_PATH definition in your Job : Job_${config_UserChoices_JobName}"
1062    IGCM_debug_Exit "This will stop the job"
1063  fi
1064  IGCM_debug_PopStack "IGCM_sys_check_path"
1065}
1066
1067#D-#==================================================
1068#D-function IGCM_sys_check_quota. Dummy call here
1069#D-* Purpose: check user quota. Stop the simulation if quota above 90%
1070#D-* Examples:
1071#D-
1072function IGCM_sys_check_quota {
1073  IGCM_debug_PushStack "IGCM_sys_check_quota"
1074  if ( $DEBUG_sys ) ; then
1075    echo "IGCM_sys_check_quota"
1076  fi
1077
1078  # TO BE IMPLEMENTED
1079
1080  IGCM_debug_PopStack "IGCM_sys_check_quota"
1081}
1082
1083#D-#==================================================
1084#D-function IGCM_sys_projectAccounting
1085#D-* Purpose: store project accounting information in a file
1086#D-* Examples:
1087#D-
1088function IGCM_sys_projectAccounting {
1089  IGCM_debug_PushStack "IGCM_sys_projectAccounting"
1090  if ( $DEBUG_sys ) ; then
1091    echo "IGCM_sys_check_quota"
1092  fi
1093
1094  touch $1
1095
1096  IGCM_debug_PopStack "IGCM_sys_projectAccounting"
1097}
1098
1099#D-#==================================================
1100#D-function IGCM_sys_getJobSchedulerID
1101#D-* Purpose: Get the job ID during execution
1102#D-* Examples: IGCM_sys_getJobSchedulerID jobSchedulerID
1103#D-
1104function IGCM_sys_getJobSchedulerID {
1105  IGCM_debug_PushStack "IGCM_sys_getJobSchedulerID"
1106  if ( $DEBUG_sys ) ; then
1107    echo "IGCM_sys_getJobSchedulerID"
1108  fi
1109
1110  # N/A content
1111  eval ${1}="N/A"
1112
1113  IGCM_debug_PopStack "IGCM_sys_getJobSchedulerID"
1114}
1115
1116#D-#==================================================
1117#D-function IGCM_sys_GetJobID
1118#D-* Purpose: Get the job ID from the JobName
1119#D-* Examples: IGCM_sys_GetJobID ${JobName} ${TargetUsr} JobID
1120#D-
1121function IGCM_sys_GetJobID {
1122  IGCM_debug_PushStack "IGCM_sys_GetJobID"
1123  if ( $DEBUG_sys ) ; then
1124    echo "IGCM_sys_GetJobID"
1125  fi
1126
1127  # N/A content
1128  eval ${3}="N/A"
1129  IGCM_debug_PopStack "IGCM_sys_GetJobID"
1130}
1131
1132#D-#==================================================
1133#D-function IGCM_sys_CountJobInQueue
1134#D-* Purpose: Count number of users job
1135#D-* Examples: IGCM_sys_CountJobInQueue ${JobName} NbRun
1136#D-
1137function IGCM_sys_CountJobInQueue {
1138  IGCM_debug_PushStack "IGCM_sys_CountJobInQueue"
1139  if ( $DEBUG_sys ) ; then
1140    echo "IGCM_sys_CountJobInQueue"
1141  fi
1142  IGCM_debug_PopStack "IGCM_sys_CountJobInQueue"
1143}
1144
1145#D-#==================================================
1146#D-function IGCM_sys_atlas
1147#D-* Purpose: encapsulate atlas call so as to manage error code and curie specificity
1148#D-* Examples:
1149#D-
1150function IGCM_sys_atlas {
1151  IGCM_debug_PushStack "IGCM_sys_atlas" $@
1152  if ( $DEBUG_sys ) ; then
1153    echo "IGCM_sys_atlas :" $@
1154  fi
1155
1156  typeset status
1157
1158  \atlas $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
1159  status=$?
1160  if [ ${status} -gt 0 ] ; then
1161    echo "IGCM_sys_atlas : error code ${status}"
1162    cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1163    \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1164    IGCM_debug_PopStack "IGCM_sys_atlas"
1165    return 1
1166  else
1167    IGCM_debug_PopStack "IGCM_sys_atlas"
1168    return 0
1169  fi
1170
1171  IGCM_debug_PopStack "IGCM_sys_atlas"
1172}
1173
Note: See TracBrowser for help on using the repository browser.