source: trunk/libIGCM/libIGCM_sys/libIGCM_sys_default.ksh @ 855

Last change on this file since 855 was 855, checked in by sdipsl, 11 years ago

First try. Include rabbitMQ C client call within IGCM_debug_PushStack and IGCM_debug_PopStack. See r138
Flag protected so won't affect normal behaviour

  • 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: 69.1 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 and user names
65# $hostname ou hostname
66typeset  HOST=${HOST:=$( hostname )}
67# $username ou whoami
68typeset  LOGIN=${LOGIN:=$( whoami )}
69# $hostname of the MASTER job
70typeset -r MASTER=${HOST}
71
72#D-
73#D-#==================================================
74#D-Program used in libIGCM
75#D-#==================================================
76
77# Submit command
78typeset SUBMIT=${SUBMIT:=qsub}
79# rsync with path
80typeset -r RSYNC=/usr/bin/rsync
81# RSYNC_opt args to rsync
82typeset -r RSYNC_opt="-va"
83# ie storage filesystem
84typeset -r STOREHOST=${MASTER}
85
86#====================================================
87# Set environment tools (ferret, nco, cdo)
88#====================================================
89#. /home/${LOGIN}/.atlas_env_${HOST}_ksh
90
91export PATH=${PATH}:/home/jripsl/snapshot/Monitoring/CNClient/
92
93#====================================================
94# Host specific DIRECTORIES
95#====================================================
96
97#====================================================
98#- MirrorlibIGCM for frontend
99typeset -r MirrorlibIGCM=${MirrorlibIGCM:=false}
100
101#====================================================
102#- libIGCM_POST for frontend
103typeset -r libIGCM_POST=${libIGCM}
104
105#====================================================
106#- R_EXE   (==> BIN_DIR = ${MODIPSL}/bin )
107typeset -r R_EXE="${MODIPSL}/bin"
108
109#====================================================
110#- SUBMIT_DIR : submission dir
111typeset SUBMIT_DIR=${SUBMIT_DIR:=${PWD}}
112
113#====================================================
114#- IN
115typeset -r R_IN=${R_IN:=/home/${LOGIN}/IGCM}
116typeset -r R_IN_ECMWF=${R_IN_ECMWF:=/home/${LOGIN}/IGCM}
117
118#====================================================
119#- ARCHIVE
120typeset ARCHIVE=${ARCHIVE:=/home/${LOGIN}}
121
122#====================================================
123#- STORAGE (dedicated to small/medium files)
124typeset STORAGE=${ARCHIVE}
125
126#====================================================
127#- R_OUT
128typeset R_OUT=${ARCHIVE}/IGCM_OUT
129
130#====================================================
131#- R_FIG (hosting figures : monitoring and atlas, and/or small files)
132typeset R_FIG=${STORAGE}/IGCM_OUT
133
134#====================================================
135#- R_BUF (ONLY FOR double copy an scratch)
136typeset -r R_BUF=${STORAGE}/IGCM_OUT
137
138#====================================================
139#- RUN_DIR_PATH : Temporary working directory (=> TMP)
140typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${STORAGE}/RUN_DIR/tmp$$}
141
142#====================================================
143#- HOST_MPIRUN_COMMAND
144typeset -r HOST_MPIRUN_COMMAND=${HOST_MPIRUN_COMMAND:="time mpirun"}
145
146#====================================================
147#- Max number of arguments passed to nco operator or demigration command
148UNIX_MAX_LIMIT=360
149
150#====================================================
151#- Number of core per node (max number of OpenMP task)
152NUM_COREPERNODE=1
153
154#====================================================
155#- Default number of MPI task for IPSL coupled model
156#- required for backward compatibility
157#-
158DEFAULT_NUM_PROC_OCE=1
159DEFAULT_NUM_PROC_CPL=1
160(( DEFAULT_NUM_PROC_ATM = BATCH_NUM_PROC_TOT - DEFAULT_NUM_PROC_OCE - DEFAULT_NUM_PROC_CPL ))
161DEFAULT_NUM_PROC_TOTAL=${BATCH_NUM_PROC_TOT}
162
163#D-#==================================================
164#D-function IGCM_sys_ChangeArchive
165#D-* Purpose: Just a dummy call on this machine
166#D-* Examples:
167#D-
168function IGCM_sys_ChangeArchive {
169  IGCM_debug_Print 1 " dummy function : IGCM_sys_ChangeArchive "
170}
171
172#D-#==================================================
173#D-function IGCM_sys_RshMaster
174#D-* Purpose: Connection to frontend machine.
175#D-* Examples:
176#D-
177function IGCM_sys_RshMaster {
178  IGCM_debug_PushStack "IGCM_sys_RshMaster" $@
179  /bin/ksh <<-EOF
180    export libIGCM=${libIGCM}
181    export DEBUG_debug=${DEBUG_debug}
182    . ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh
183    . ${libIGCM}/libIGCM_card/libIGCM_card.ksh
184    ${@}
185EOF
186  if [ $? -gt 0 ] ; then
187    echo "IGCM_sys_RshMaster : erreur."
188    IGCM_debug_Exit "IGCM_sys_RshMaster"
189  fi
190  IGCM_debug_PopStack "IGCM_sys_RshMaster"
191}
192
193#D-#==================================================
194#D-function IGCM_sys_RshArchive
195#D-* Purpose: Archive rsh command
196#D-* Examples:
197#D-
198function IGCM_sys_RshArchive {
199  IGCM_debug_PushStack "IGCM_sys_RshArchive" $@
200  /bin/ksh <<-EOF
201    ${@}
202EOF
203  status=$?
204  if [ ${status} -gt 0 ] ; then
205    IGCM_debug_Print 2 "IGCM_sys_RshArchive : command failed error code ${status}"
206    IGCM_debug_Exit "IGCM_sys_RshArchive"
207  fi
208  IGCM_debug_PopStack "IGCM_sys_RshArchive"
209}
210
211#D-#==================================================
212#D-function IGCM_sys_RshPost
213#D-* Purpose: Post-process rsh command
214#D-* Examples:
215#D-
216function IGCM_sys_RshPost {
217  IGCM_debug_PushStack "IGCM_sys_RshPost" $@
218  if ( $DEBUG_sys ) ; then
219    echo "IGCM_sys_RshPost :" $@
220  fi
221
222  # keep standard input (stdin) for the loop onto temporary file
223  cat >tmp_IGCM_sys_RshPost_$$
224
225  /bin/ksh <tmp_IGCM_sys_RshPost_$$
226  if [ $? -gt 0 ] ; then
227    echo "IGCM_sys_RshPost : erreur."
228    IGCM_debug_Exit "IGCM_sys_RshPost"
229  fi
230  # delete temporary file
231  \rm tmp_IGCM_sys_RshPost_$$
232  IGCM_debug_PopStack "IGCM_sys_RshPost"
233}
234
235#D-#==================================================
236#D-function IGCM_sys_SendMail
237#D-* Purpose: Send mail when simulation is over
238#D-* Examples:
239#D-
240function IGCM_sys_SendMail {
241  IGCM_debug_PushStack "IGCM_sys_SendMail" $@
242  if ( $DEBUG_sys ) ; then
243    echo "IGCM_sys_SendMail :" $@
244  fi
245
246  if ( ${ExitFlag} ) ; then
247    status=failed
248  else
249    status=completed
250  fi
251
252  cat  << END_MAIL > job_end.mail
253Dear ${LOGIN},
254
255  Simulation ${config_UserChoices_JobName} is ${status} on supercomputer `hostname`.
256  Job started : ${DateBegin}
257  Job ended   : ${DateEnd}
258  Output files are available in ${R_SAVE}
259  Files to be rebuild are temporarily available in ${REBUILD_DIR}
260  Pre-packed files are temporarily available in ${R_BUFR}
261  Script files, Script Outputs and Debug files (if necessary) are available in ${SUBMIT_DIR}
262END_MAIL
263
264  if [ ! -z ${config_UserChoices_MailName} ] ; then
265    mailx -s "${config_UserChoices_JobName} ${status}" ${config_UserChoices_MailName} <  job_end.mail
266  elif [ -f ~/.forward ] ; then
267    mailx -s "${config_UserChoices_JobName} ${status}" $( cat ~/.forward ) < job_end.mail
268  fi
269
270  sleep 10
271  rm -f job_end.mail
272
273  if [ $? -gt 0 ] ; then
274    echo "IGCM_sys_SendMail : erreur."
275    IGCM_debug_Exit "IGCM_sys_SendMail"
276  fi
277  IGCM_debug_PopStack "IGCM_sys_SendMail"
278}
279
280#D-#==================================================
281#D-function IGCM_sys_Mkdir
282#D-* Purpose: Master locale mkdir command
283#D-* Examples:
284#D-
285function IGCM_sys_Mkdir {
286  IGCM_debug_PushStack "IGCM_sys_Mkdir" $@
287  if ( $DEBUG_sys ) ; then
288    echo "IGCM_sys_Mkdir :" $@
289  fi
290  if [ ! -d ${1} ]; then
291    \mkdir -p $1
292    if [ $? -gt 0 ] ; then
293      echo "IGCM_sys_Mkdir : erreur."
294      IGCM_debug_Exit "IGCM_sys_Mkdir"
295    fi
296  fi
297  # vérification :
298  if [ ! -d ${1} ] ; then
299    echo "IGCM_sys_Mkdir : erreur."
300    IGCM_debug_Exit "IGCM_sys_Mkdir"
301  fi
302  IGCM_debug_PopStack "IGCM_sys_Mkdir"
303}
304
305#D-#==================================================
306#D-function IGCM_sys_MkdirArchive
307#D-* Purpose: Mkdir on Archive
308#D-* Examples:
309#D-
310function IGCM_sys_MkdirArchive {
311  IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@
312  if ( $DEBUG_sys ) ; then
313    echo "IGCM_sys_MkdirArchive :" $@
314  fi
315  #- creation de repertoire sur le serveur fichier
316  mkdir -p $1
317  status=$?
318
319  if [ ${status} -gt 0 ] ; then
320    IGCM_debug_Print 2 "IGCM_sys_MkdirArchive : mkdir failed error code ${status}"
321    IGCM_debug_Exit "IGCM_sys_MkdirArchive"
322  fi
323  IGCM_debug_PopStack "IGCM_sys_MkdirArchive"
324}
325
326#D-#==================================================
327#D-function IGCM_sys_MkdirWork
328#D-* Purpose: Mkdir on Work
329#D-* Examples:
330#D-
331function IGCM_sys_MkdirWork {
332  IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@
333  if ( $DEBUG_sys ) ; then
334    echo "IGCM_sys_MkdirWork :" $@
335  fi
336  #- creation de repertoire sur le serveur fichier
337  if [ ! -d ${1} ]; then
338    \mkdir -p $1
339    if [ $? -gt 0 ] ; then
340      echo "IGCM_sys_MkdirWork : erreur."
341      IGCM_debug_Exit "IGCM_sys_MkdirWork"
342    fi
343  fi
344  IGCM_debug_PopStack "IGCM_sys_MkdirWork"
345}
346
347#D-#==================================================
348#D-function IGCM_sys_Cd
349#D-* Purpose: master cd command
350#D-* Examples:
351#D-
352function IGCM_sys_Cd {
353  IGCM_debug_PushStack "IGCM_sys_Cd" $@
354  if ( $DEBUG_sys ) ; then
355    echo "IGCM_sys_Cd :" $@
356  fi
357  \cd $1
358  if [ $? -gt 0 ] ; then
359    echo "IGCM_sys_Cd : erreur."
360    IGCM_debug_Exit "IGCM_sys_Cd"
361  fi
362  IGCM_debug_PopStack "IGCM_sys_Cd"
363}
364
365#D-#==================================================
366#D-function IGCM_sys_Chmod
367#D-* Purpose: Chmod
368#D-* Examples:
369#D-
370function IGCM_sys_Chmod {
371  IGCM_debug_PushStack "IGCM_sys_Chmod" -- $@
372  if ( $DEBUG_sys ) ; then
373    echo "IGCM_sys_Chmod :" $@
374  fi
375  \chmod $@
376  if [ $? -gt 0 ] ; then
377    echo "IGCM_sys_Chmod : erreur."
378    IGCM_debug_Exit "IGCM_sys_Chmod"
379  fi
380  IGCM_debug_PopStack "IGCM_sys_Chmod"
381}
382
383#D-#==================================================
384#D-function IGCM_sys_FileSize
385#D-* Purpose: Filesize
386#D-* Examples:
387#D-
388function IGCM_sys_FileSize {
389  IGCM_debug_PushStack "IGCM_sys_FileSize" $@
390
391  typeset sizeF
392  set +A sizeF -- $( ls -la ${1} )
393  if [ $? -gt 0 ] ; then
394    IGCM_debug_Exit "IGCM_sys_FileSize"
395  fi
396  eval ${2}=${sizeF[4]}
397
398  IGCM_debug_PopStack "IGCM_sys_FileSize"
399}
400
401#D-#==================================================
402#D-function IGCM_sys_TestDir
403#D-* Purpose: Test Directory that must exists
404#D-* Examples:
405#D-
406function IGCM_sys_TestDir {
407  IGCM_debug_PushStack "IGCM_sys_TestDir" $@
408  if ( $DEBUG_sys ) ; then
409    echo "IGCM_sys_TestDir :" $@
410  fi
411  typeset ExistFlag
412  ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
413  IGCM_debug_PopStack "IGCM_sys_TestDir"
414
415  return ${ExistFlag}
416}
417
418#D-#==================================================
419#D-function IGCM_sys_TestDirArchive
420#D-* Purpose: Test Directory that must exists on Archive
421#D-* Examples:
422#D-
423function IGCM_sys_TestDirArchive {
424  IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@
425  if ( $DEBUG_sys ) ; then
426    echo "IGCM_sys_TestDirArchive :" $@
427  fi
428  typeset ExistFlag
429  ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
430  IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
431  return ${ExistFlag}
432}
433
434#D-#==================================================
435#D-function IGCM_sys_IsFileArchived
436#D-* Purpose: Test file that must NOT EXISTS on Archive
437#D-* Examples:
438#D-
439function IGCM_sys_IsFileArchived {
440  IGCM_debug_PushStack "IGCM_sys_IsFileArchived" $@
441  if ( $DEBUG_sys ) ; then
442    echo "IGCM_sys_IsFileArchived :" $@
443  fi
444  typeset IsArchivedFlag
445  # Never archived for this system
446  IsArchivedFlag=1
447  IGCM_debug_PopStack "IGCM_sys_IsFileArchived"
448
449  return ${IsArchivedFlag}
450}
451
452#D-#==================================================
453#D-function IGCM_sys_TestFileArchive
454#D-* Purpose: Test file that must NOT EXISTS on Archive
455#D-* Examples:
456#D-
457function IGCM_sys_TestFileArchive {
458  IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@
459  typeset ExistFlag
460  ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 )
461  IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
462
463  return ${ExistFlag}
464}
465
466#D-#==================================================
467#D-function IGCM_sys_TestFileBuffer
468#D-* Purpose: Test file that must NOT EXISTS on Buffer
469#D-* Examples:
470#D-
471function IGCM_sys_TestFileBuffer {
472  IGCM_debug_PushStack "IGCM_sys_TestFileBuffer" $@
473  typeset ExistFlag
474  ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 )
475  IGCM_debug_PopStack "IGCM_sys_TestFileBuffer"
476
477  return ${ExistFlag}
478}
479
480#D-#==================================================
481#D-function IGCM_sys_CountFileArchive
482#D-* Purpose: Count files on Archive filesystem
483#D-* Examples:
484#D-
485function IGCM_sys_CountFileArchive {
486  IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@
487  ls ${@} 2>/dev/null | wc -l
488  if [ $? -gt 0 ] ; then
489    echo "IGCM_sys_CountFileArchive : erreur."
490  fi
491  IGCM_debug_PopStack "IGCM_sys_CountFileArchive"
492}
493
494#D-#==================================================
495#D-function IGCM_sys_CountFileBuffer
496#D-* Purpose: Count files on Scratch filesystem
497#D-* Examples:
498#D-
499function IGCM_sys_CountFileBuffer {
500  IGCM_debug_PushStack "IGCM_sys_CountFileBuffer" $@
501  ls ${@} 2>/dev/null | wc -l
502  if [ $? -gt 0 ] ; then
503    echo "IGCM_sys_CountFileBuffer : erreur."
504  fi
505  IGCM_debug_PopStack "IGCM_sys_CountFileBuffer"
506}
507
508#D-#==================================================
509#D-function IGCM_sys_Tree
510#D-* Purpose: Tree directories with files on ${ARCHIVE}
511#D-* Examples: IGCM_sys_Tree ${R_IN} ${R_OUT}
512#D-
513function IGCM_sys_Tree {
514  IGCM_debug_PushStack "IGCM_sys_Tree" $@
515  if ( $DEBUG_sys ) ; then
516    echo "IGCM_sys_Tree :" $@
517  fi
518
519  \tree -f $@
520
521  IGCM_debug_PopStack "IGCM_sys_Tree"
522}
523
524#D-#==================================================
525#D-function IGCM_sys_Tar
526#D-* Purpose: master tar command
527#D-* Examples:
528#D-
529function IGCM_sys_Tar {
530  IGCM_debug_PushStack "IGCM_sys_Tar" $@
531  if ( $DEBUG_sys ) ; then
532    echo "IGCM_sys_Tar :" $@
533  fi
534  \tar cf $@
535  if [ $? -gt 0 ] ; then
536    echo "IGCM_sys_Tar : erreur."
537    IGCM_debug_Exit "IGCM_sys_Tar"
538  fi
539  IGCM_debug_PopStack "IGCM_sys_Tar"
540}
541
542#D-#==================================================
543#D-function IGCM_sys_UnTar
544#D-* Purpose: master un-tar command
545#D-* Examples:
546#D-
547function IGCM_sys_UnTar {
548  IGCM_debug_PushStack "IGCM_sys_UnTar" $@
549  if ( $DEBUG_sys ) ; then
550    echo "IGCM_sys_UnTar :" $@
551  fi
552  \tar xvf $1
553  if [ $? -gt 0 ] ; then
554    echo "IGCM_sys_UnTar : erreur."
555    IGCM_debug_Exit "IGCM_sys_UnTar"
556  fi
557  IGCM_debug_PopStack "IGCM_sys_UnTar"
558}
559
560#D-#==================================================
561#D-function IGCM_sys_Qsub
562#D-* Purpose: Qsub new job
563#D-* Examples:
564#D-
565function IGCM_sys_Qsub {
566  IGCM_debug_PushStack "IGCM_sys_Qsub" $@
567  if ( $DEBUG_sys ) ; then
568    echo "IGCM_sys_Qsub :" $@
569  fi
570  echo "${@} > ${SUBMIT_DIR}/${Script_Output} 2>&1 &"
571  ${@} > ${SUBMIT_DIR}/${Script_Output} 2>&1 &
572  if [ $? -gt 0 ] ; then
573    echo "IGCM_sys_Qsub : erreur ${options} $1"
574    IGCM_debug_Exit "IGCM_sys_Qsub"
575  fi
576  IGCM_debug_PopStack "IGCM_sys_Qsub"
577}
578
579#D-#==================================================
580#D-function IGCM_sys_QsubPost
581#D-* Purpose: Qsub new job on scalaire
582#D-* Examples:
583#D-
584function IGCM_sys_QsubPost {
585  IGCM_debug_PushStack "IGCM_sys_QsubPost" $@
586  if ( $DEBUG_sys ) ; then
587    echo "IGCM_sys_QsubPost :" $@
588  fi
589  echo "${libIGCM_POST}/$1.job > ${POST_DIR}/$1.${PeriodDateEnd}.out 2>&1 &"
590  ${libIGCM_POST}/$1.job > ${POST_DIR}/${Script_Post_Output}.out 2>&1 &
591  if [ $? -gt 0 ] ; then
592    echo "IGCM_sys_QsubPost : erreur " $@
593    IGCM_debug_Exit "IGCM_sys_QsubPost"
594  fi
595  IGCM_debug_PopStack "IGCM_sys_QsubPost"
596}
597
598#D-*************************
599#D- File transfer functions
600#D-*************************
601#D-
602
603#D-#==================================================
604#D-function IGCM_sys_Rsync_out
605#D-* Purpose: treat return val of rsync
606#D-* Examples: IGCM_sys_Rsync_out out_RET_rsync
607#D-  Error values and explanations can depend on your system version.
608function IGCM_sys_Rsync_out {
609  status=$1
610  if [ ! $status ] ; then
611    echo "rsync error !"
612  fi
613
614  if [ $MYLANG = "fr" ]; then
615    case $status in
616    0)  return ;;
617    1)  echo "Erreur de rsync ; RERR_SYNTAX : "
618      echo "Erreur de syntaxe ou d'utilisation."
619      return;;
620    2)  echo "Erreur de rsync ; RERR_PROTOCOL : "
621      echo "Incompatibilité de protocole."
622      return;;
623    3)  echo "Erreur de rsync ; RERR_FILESELECT 3"
624      echo "Erreurs  lors  de  la  sélection des fichiers d'entrée sortie et"
625      echo "répertoires"
626      return;;
627    4)  echo "Erreur de rsync ; RERR_UNSUPPORTED"
628      echo "Action demandée non supportée : une tentative de manipulation de"
629      echo "fichiers  64-bits  sur une plate-forme qui ne les supporte pas a"
630      echo "été faite ; ou une option qui est supportée par le  client  mais"
631      echo "pas par le serveur a été spécifiée."
632      return;;
633    10) echo "Erreur de rsync ; RERR_SOCKETIO"
634      echo "Erreur dans le socket d'entrée sortie"
635      return;;
636    11) echo "Erreur de rsync ; RERR_FILEIO"
637      echo "Erreur d'entrée sortie fichier"
638      return;;
639    12) echo "Erreur de rsync ; RERR_STREAMIO"
640      echo "Erreur dans flux de donnée du protocole rsync"
641      return;;
642    13) echo "Erreur de rsync ; RERR_MESSAGEIO"
643      echo "Erreur avec les diagnostics du programme"
644      return;;
645    14) echo "Erreur de rsync ; RERR_IPC"
646      echo "Erreur dans le code IPC"
647      return;;
648    20) echo "Erreur de rsync ; RERR_SIGNAL"
649      echo "SIGUSR1 ou SIGINT reçu"
650      return;;
651    21) echo "Erreur de rsync ; RERR_WAITCHILD"
652      echo "Une erreur retournée par waitpid()"
653      return;;
654    22) echo "Erreur de rsync ; RERR_MALLOC"
655      echo "Erreur lors de l'allocation des tampons de mémoire de coeur"
656      return;;
657    23) echo ""
658      echo "Erreur fichier inexistant"
659      return;;
660    30) echo "Erreur de rsync ; RERR_TIMEOUT"
661      echo "Temps d'attente écoulé dans l'envoi/réception de données"
662      return;;
663    *)  echo "Erreur de rsync : code de retour de rsync inconnu :" $status
664      return;;
665    esac
666  elif [ $MYLANG = "en" ] ; then
667    case $status in
668    0)  return;;
669    1)  echo "rsync error : Syntax or usage error "
670      return;;
671    2)  echo "rsync error : Protocol incompatibility "
672      return;;
673    3)  echo "rsync error : Errors selecting input/output files, dirs"
674      return;;
675    4)  echo "rsync error : Requested action not supported: an attempt"
676      echo "was made to manipulate 64-bit files on a platform that cannot support"
677      echo "them; or an option was specified that is supported by the client and"
678      echo "not by the server."
679      return;;
680    5)  echo "rsync error : Error starting client-server protocol"
681      return;;
682    10) echo "rsync error : Error in socket I/O "
683      return;;
684    11) echo "rsync error : Error in file I/O "
685      return;;
686    12) echo "rsync error : Error in rsync protocol data stream "
687      return;;
688    13) echo "rsync error : Errors with program diagnostics "
689      return;;
690    14) echo "rsync error : Error in IPC code "
691      return;;
692    20) echo "rsync error : Received SIGUSR1 or SIGINT "
693      return;;
694    21) echo "rsync error : Some error returned by waitpid() "
695      return;;
696    22) echo "rsync error : Error allocating core memory buffers "
697      return;;
698    23) echo "rsync error : Partial transfer due to error"
699      return;;
700    24) echo "rsync error : Partial transfer due to vanished source files"
701      return;;
702    30) echo "rsync error : Timeout in data send/receive "
703      return;;
704    *)  echo "rsync error : return code of rsync unknown :" $status
705      return;;
706    esac
707  else
708    echo "unknown language $MYLANG."
709    return
710  fi
711}
712
713#D-#==================================================
714#D-function IGCM_sys_Miror_libIGCM
715#D-* Purpose: Mirror libIGCM PATH and lib to frontend
716#D-* Examples:
717#D-
718function IGCM_sys_Mirror_libIGCM {
719  IGCM_debug_PushStack "IGCM_sys_Mirror_libIGCM"
720  if ( $DEBUG_sys ) ; then
721    echo "IGCM_sys_Mirror_libIGCM"
722  fi
723
724  typeset status
725
726  mkdir -p ${HOME}/MIRROR/${PATHlibIGCM}
727
728  echo ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} > out_rsync 2>&1
729  ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} >> out_rsync 2>&1
730  status=$?
731
732  if [ ${status} -gt 0 ] ; then
733    echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on frontend."
734    cat out_rsync
735  fi
736  IGCM_debug_PopStack "IGCM_sys_Mirror_libIGCM"
737}
738
739#D-#==================================================
740#D-function IGCM_sys_Cp
741#D-* Purpose: generic cp
742#D-* Examples:
743#D-
744function IGCM_sys_Cp {
745  IGCM_debug_PushStack "IGCM_sys_Cp" $@
746  if ( $DEBUG_sys ) ; then
747    echo "IGCM_sys_Cp :" $@
748  fi
749
750  typeset status
751
752  echo cp $@ > out_rsync 2>&1
753  \cp $@ >> out_rsync 2>&1
754  status=$?
755
756  if [ ${status} -gt 0 ] ; then
757    echo "IGCM_sys_Cp : error code ${status}"
758    cat out_rsync
759    IGCM_debug_Exit "IGCM_sys_Cp"
760  else
761    \rm out_rsync
762  fi
763  IGCM_debug_PopStack "IGCM_sys_Cp"
764}
765
766#D-#==================================================
767#D-function IGCM_sys_Rm
768#D-* Purpose: generic rm
769#D-* Examples:
770#D-
771function IGCM_sys_Rm {
772  IGCM_debug_PushStack "IGCM_sys_Rm" -- $@
773  if ( $DEBUG_sys ) ; then
774    echo "IGCM_sys_Rm :" $@
775  fi
776
777  typeset status
778
779  echo rm $@ > out_rsync 2>&1
780  \rm $@ >> out_rsync 2>&1
781  status=$?
782
783  if [ ${status} -gt 0 ] ; then
784    echo "IGCM_sys_Rm : error code ${status}"
785    cat out_rsync
786    IGCM_debug_Exit "IGCM_sys_Rm"
787  else
788    \rm out_rsync
789  fi
790  IGCM_debug_PopStack "IGCM_sys_Rm"
791}
792
793#D-#==================================================
794#D-function IGCM_sys_RmRunDir
795#D-* Purpose: rm tmpdir (dummy function most of the time batch
796#D-                      scheduler will do the job)
797#D-* Examples:
798#D-
799function IGCM_sys_RmRunDir {
800  IGCM_debug_PushStack "IGCM_sys_RmRunDir" -- $@
801  if ( $DEBUG_sys ) ; then
802    echo "IGCM_sys_RmRunDir :" $@
803    echo "Dummy call, let the user do that."
804#    IGCM_sys_Rm -rf ${RUN_DIR}
805  fi
806  IGCM_debug_PopStack "IGCM_sys_RmRunDir"
807}
808
809#D-#==================================================
810#D-function IGCM_sys_Mv
811#D-* Purpose: generic move
812#D-* Examples:
813#D-
814function IGCM_sys_Mv {
815  IGCM_debug_PushStack "IGCM_sys_Mv" $@
816  if ( $DEBUG_sys ) ; then
817    echo "IGCM_sys_Mv :" $@
818  fi
819
820  if [ $DRYRUN = 0 ]; then
821
822    typeset status
823
824    echo mv $@ > out_rsync 2>&1
825    \mv $@ >> out_rsync 2>&1
826    status=$?
827
828    if [ ${status} -gt 0 ] ; then
829      echo "IGCM_sys_Mv : error code ${status}"
830      cat out_rsync
831      IGCM_debug_Exit "IGCM_sys_Mv"
832    else
833      \rm out_rsync
834    fi
835  fi
836
837  IGCM_debug_PopStack "IGCM_sys_Mv"
838}
839
840#D-#==================================================
841#D-function IGCM_sys_Put_Dir
842#D-* Purpose: Copy a complete directory on $(ARCHIVE)
843#D-* Examples:
844#D-
845function IGCM_sys_Put_Dir {
846  IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@
847  if ( $DEBUG_sys ) ; then
848    echo "IGCM_sys_Put_Dir :" $@
849  fi
850  if [ $DRYRUN = 0 ]; then
851    if [ ! -d ${1} ] ; then
852      echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ."
853      IGCM_debug_PopStack "IGCM_sys_Put_Dir"
854      return
855    fi
856
857    typeset status
858
859    # Only if we use rsync
860    #IGCM_sys_TestDirArchive $( dirname $2 )
861    #
862    #USUAL WAY
863    \cp -r $1 $2 > out_rsync 2>&1
864    status=$?
865
866    if [ ${status} -gt 0 ] ; then
867      IGCM_debug_Print 2 "IGCM_sys_Put_Dir : cp failed error code ${status}"
868      cat out_rsync
869      IGCM_debug_Exit "IGCM_sys_Put_Dir"
870    else
871      \rm out_rsync
872    fi
873  fi
874  IGCM_debug_PopStack "IGCM_sys_Put_Dir"
875}
876
877#D-#==================================================
878#D-function IGCM_sys_Get_Dir
879#D-* Purpose: Copy a complete directory from ${ARCHIVE}
880#D-* Examples:
881#D-
882function IGCM_sys_Get_Dir {
883  IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@
884  if ( $DEBUG_sys ) ; then
885    echo "IGCM_sys_Get_Dir :" $@
886  fi
887  if [ $DRYRUN = 0 ]; then
888    if [ ! -d ${1} ] ; then
889      echo "WARNING : IGCM_sys_Get_Dir ${1} DOES NOT EXIST ."
890      IGCM_debug_PopStack "IGCM_sys_Get_Dir"
891      return
892    fi
893
894    typeset status
895
896    #USUAL WAY
897    \cp -ur $1 $2 > out_rsync 2>&1
898    status=$?
899
900    if [ ${status} -gt 0 ] ; then
901      IGCM_debug_Print 2 "IGCM_sys_Get_Dir : cp failed error code ${status}"
902      cat out_rsync
903      IGCM_debug_Exit "IGCM_sys_Get_Dir"
904    else
905      \rm out_rsync
906    fi
907  fi
908  IGCM_debug_PopStack "IGCM_sys_Get_Dir"
909}
910
911#D-#==================================================
912#D-function IGCM_sys_Get_Master
913#D-* Purpose: Copy a complete directory from MASTER filesystem
914#D-* Examples:
915#D-
916function IGCM_sys_Get_Master {
917  IGCM_debug_PushStack "IGCM_sys_Get_Master" $@
918  if ( $DEBUG_sys ) ; then
919    echo "IGCM_sys_Get_Master :" $@
920  fi
921  if [ $DRYRUN = 0 ]; then
922    if ( [ ! -d ${1} ] && [ ! -f ${1} ] ) ; then
923      echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ."
924      IGCM_debug_PopStack "IGCM_sys_Get_Master"
925      return
926    fi
927
928    typeset NB_ESSAI DELAI status i
929    # number of tentative
930    NB_ESSAI=3
931    # time delay between tentative
932    DELAI=2
933
934    i=0
935    while [ $i -lt $NB_ESSAI ] ; do
936      \cp -urL $1 $2 > out_rsync 2>&1
937      status=$?
938      if [ ${status} -gt 0 ]; then
939        IGCM_debug_Print 2 "IGCM_sys_Get_Master : cp failed error code ${status} ${i}/${NB_ESSAI}"
940        IGCM_debug_Print 2 "IGCM_sys_Get_Master : sleep ${DELAI} seconds and try again."
941        sleep $DELAI
942      else
943        break
944      fi
945      (( i = i + 1 ))
946    done
947
948    if [ ${status} -gt 0 ] ; then
949      echo "IGCM_sys_Get_Master : error."
950      cat out_rsync
951      IGCM_debug_Exit "IGCM_sys_Get_Master"
952    else
953      \rm out_rsync
954    fi
955  fi
956  IGCM_debug_PopStack "IGCM_sys_Get_Master"
957}
958
959#====================================================
960#- Call IGCM_sys_Mirror_libIGCM now !
961if ( $MirrorlibIGCM ) ; then
962  IGCM_sys_Mirror_libIGCM
963fi
964
965#D-#==================================================
966#D-function IGCM_sys_Put_Rest
967#D-* Purpose: Put computied restarts on ${ARCHIVE}.
968#D-           File and target directory must exist.
969#D-* Examples:
970#D-
971function IGCM_sys_Put_Rest {
972  IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@
973  if ( $DEBUG_sys ) ; then
974    echo "IGCM_sys_Put_Rest :" $@
975  fi
976  if [ $DRYRUN = 0 ]; then
977    if [ ! -f ${1} ] ; then
978      echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ."
979      IGCM_debug_Exit "IGCM_sys_Put_Rest"
980    fi
981
982    typeset status
983    #
984    if [ X${JobType} = XRUN ] ; then
985      IGCM_sys_Chmod 444 ${1}
986    fi
987    #
988    # Only if we use rsync
989    #IGCM_sys_MkdirArchive $( dirname $2 )
990    #
991    #USUAL WAY
992    \cp $1 $2 > out_rsync 2>&1
993    status=$?
994
995#       #RSYNC WITH NETWORK SSH CALL
996#       echo ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} > out_rsync 2>&1
997#       ${RSYNC} ${RSYNC_opt} -e ssh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> out_rsync 2>&1
998
999#       #RSYNC WITH NFS USE
1000#       echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > out_rsync 2>&1
1001#       ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> out_rsync 2>&1
1002
1003#       status=$?
1004#       IGCM_sys_Rsync_out $status
1005
1006#       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
1007#       (( status=status+$? ))
1008
1009    if [ ${status} -gt 0 ] ; then
1010      echo "IGCM_sys_Put_Rest : cp failed error code ${status}"
1011      cat out_rsync
1012      IGCM_debug_Exit "IGCM_sys_Put_Rest"
1013    else
1014      \rm out_rsync
1015    fi
1016  fi
1017  IGCM_debug_PopStack "IGCM_sys_Put_Rest"
1018}
1019
1020#D-#==================================================
1021#D-function IGCM_sys_PutBuffer_Rest
1022#D-* Purpose: Put computied restarts on ${SCRATCHDIR}.
1023#D-           File and target directory must exist.
1024#D-* Examples:
1025#D-
1026function IGCM_sys_PutBuffer_Rest {
1027  IGCM_debug_PushStack "IGCM_sys_PutBuffer_Rest" $@
1028  if ( $DEBUG_sys ) ; then
1029    echo "IGCM_sys_PutBuffer_Rest :" $@
1030  fi
1031  if [ $DRYRUN = 0 ]; then
1032    if [ ! -f ${1} ] ; then
1033      echo "ERROR : IGCM_sys_PutBuffer_Rest ${1} DOES NOT EXIST ."
1034      IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest"
1035    fi
1036
1037    typeset status
1038    #
1039    if [ X${JobType} = XRUN ] ; then
1040      IGCM_sys_Chmod 444 ${1}
1041    fi
1042
1043    #
1044    # USUAL WAY
1045    \cp $1 $2 > out_rsync 2>&1
1046    status=$?
1047
1048    if [ ${status} -gt 0 ] ; then
1049      echo "IGCM_sys_PutBuffer_Rest : error code ${status}"
1050      [ -f ${2} ] && ls -l ${2}
1051      [ -f ${2}/${1} ] && ls -l ${2}/${1}
1052      cat out_rsync
1053      IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest"
1054    else
1055      \rm out_rsync
1056    fi
1057  fi
1058  IGCM_debug_PopStack "IGCM_sys_PutBuffer_Rest"
1059}
1060
1061#D-#==================================================
1062#D-function IGCM_sys_PrepareTaredRestart
1063#D-* Purpose: Prepare tared restart to be access by computing job. Identity here.
1064#D-* Examples:
1065#D-
1066function IGCM_sys_PrepareTaredRestart {
1067  IGCM_debug_PushStack "IGCM_sys_PrepareTaredRestart" $@
1068  echo $1
1069  IGCM_debug_PopStack "IGCM_sys_PrepareTaredRestart"
1070}
1071
1072#D-#==================================================
1073#D-function IGCM_sys_Put_Out
1074#D-* Purpose: Copy a file on ${ARCHIVE} after having chmod it in readonly
1075#D-* Examples:
1076#D-
1077function IGCM_sys_Put_Out {
1078  IGCM_debug_PushStack "IGCM_sys_Put_Out" $@
1079  if ( $DEBUG_sys ) ; then
1080    echo "IGCM_sys_Put_Out :" $@
1081  fi
1082
1083  typeset status
1084
1085  if [ $DRYRUN = 0 ]; then
1086    if [ ! -f ${1} ] ; then
1087      echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ."
1088      IGCM_debug_PopStack "IGCM_sys_Put_Out"
1089      return 1
1090    fi
1091    #
1092    IGCM_sys_MkdirArchive $( dirname $2 )
1093    #
1094    if [ X${JobType} = XRUN ] ; then
1095      if [ X${3} = X ] ; then
1096        IGCM_sys_Chmod 444 ${1}
1097      fi
1098    fi
1099    #
1100
1101    echo ${RSYNC} ${RSYNC_opt} $1 $2 > out_rsync 2>&1
1102    ${RSYNC} ${RSYNC_opt} $1 $2 >> out_rsync 2>&1
1103    status=$?
1104    IGCM_sys_Rsync_out $status
1105
1106    ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk out_rsync
1107    (( status=status+$? ))
1108
1109    if [ ${status} -gt 0 ] ; then
1110      IGCM_debug_Print 2 "IGCM_sys_Put_Out : rsync failed error code ${status}"
1111      cat out_rsync
1112      IGCM_debug_Exit "IGCM_sys_Put_Out"
1113    else
1114      \rm out_rsync
1115    fi
1116  fi
1117  IGCM_debug_PopStack "IGCM_sys_Put_Out"
1118  return 0
1119}
1120
1121#D-#==================================================
1122#D-function IGCM_sys_PutBuffer_Out
1123#D-* Purpose: Copy a file on ${SCRATCHDIR} after having chmod it in readonly
1124#D-* Examples:
1125#D-
1126function IGCM_sys_PutBuffer_Out {
1127  IGCM_debug_PushStack "IGCM_sys_PutBuffer_Out" $@
1128  if ( $DEBUG_sys ) ; then
1129    echo "IGCM_sys_PutBuffer_Out :" $@
1130  fi
1131
1132  typeset NB_ESSAI DELAI status i exist skip
1133
1134  # number of tentative
1135  NB_ESSAI=3
1136  # time delay between tentative
1137  DELAI=2
1138
1139  if [ $DRYRUN = 0 ]; then
1140    if [ ! -f ${1} ] ; then
1141      echo "WARNING : IGCM_sys_PutBuffer_Out ${1} DOES NOT EXIST ."
1142      IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out"
1143      return 1
1144    fi
1145    #
1146    IGCM_sys_Mkdir $( dirname $2 )
1147    #
1148
1149    exist=false
1150    skip=false
1151    if [ -f $2 ] ; then
1152      IGCM_debug_Print 1 "$2 already exist"
1153      exist=true
1154      if [ "X$( diff $1 $2 )" = X ] ; then
1155        IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy"
1156        status=0
1157        skip=true
1158      else
1159        IGCM_debug_Print 2 "$1 and $2 are not the same file, we force the copy"
1160        skip=false
1161      fi
1162    fi
1163    #
1164    if ( [ X${exist} = Xtrue ] && [ X${skip} = Xfalse ] ) ; then
1165      IGCM_sys_Chmod u+w $2
1166    fi
1167
1168    if [ X${skip} = Xfalse ] ; then
1169      i=0
1170      while [ $i -lt $NB_ESSAI ] ; do
1171        # USUAL WAY
1172        \cp $1 $2 > out_rsync 2>&1
1173        status=$?
1174        if [ ${status} -gt 0 ]; then
1175          IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : cp failed error code ${status} ${i}/${NB_ESSAI}"
1176          IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : sleep ${DELAI} seconds and try again."
1177          [ -f ${2} ] && ls -l ${2}
1178          [ -f ${2}/${1} ] && ls -l ${2}/${1}
1179          sleep $DELAI
1180        else
1181          break
1182        fi
1183        (( i = i + 1 ))
1184      done
1185    fi
1186
1187    if [ ${status} -gt 0 ] ; then
1188      echo "IGCM_sys_PutBuffer_Out : error."
1189      [ -f ${2} ] && ls -l ${2}
1190      [ -f ${2}/${1} ] && ls -l ${2}/${1}
1191      cat out_rsync
1192      IGCM_debug_Exit "IGCM_sys_PutBuffer_Out"
1193    else
1194
1195      if [ X${JobType} = XRUN ] ; then
1196        if [ X${3} = X ] ; then
1197          [ -f ${2} ] && IGCM_sys_Chmod 444 ${2}
1198          [ -f ${2}/${1} ] && IGCM_sys_Chmod 444 ${2}/${1}
1199        fi
1200      fi
1201
1202      \rm out_rsync
1203    fi
1204  fi
1205  IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out"
1206  return 0
1207}
1208
1209#D-#==================================================
1210#D-function IGCM_sys_Get
1211#D-* Purpose: Get a file from ${ARCHIVE}
1212#D-* Examples: IGCM_sys_Get myfile /destpath/myfile_with_PREFIX
1213#D-            IGCM_sys_Get /l Array_contain_myfiles /destpath/
1214function IGCM_sys_Get {
1215  IGCM_debug_PushStack "IGCM_sys_Get" $@
1216
1217  typeset DEST status dm_liste
1218
1219  if ( $DEBUG_sys ) ; then
1220    echo "IGCM_sys_Get :" $@
1221  fi
1222  if [ $DRYRUN -le 2 ]; then
1223    if [ X${1} = X'/l' ] ; then
1224      # test if the first file is present in the old computation :
1225      eval set +A dm_liste \${${2}}
1226    else
1227      dm_liste=${1}
1228    fi
1229    eval DEST=\${${#}}
1230
1231    # test if the (first) file is present in the old computation :
1232    IGCM_sys_TestFileArchive ${dm_liste[0]}
1233    status=$?
1234    if [ ${status} -gt 0 ] ; then
1235      echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ."
1236      IGCM_debug_Exit "IGCM_sys_Get"
1237      return
1238    fi
1239
1240    #USUAL WAY
1241    \cp ${dm_liste[*]} ${DEST} > out_rsync 2>&1
1242    status=$?
1243
1244    if [ ${status} -gt 0 ] ; then
1245      IGCM_debug_Print 2 "IGCM_sys_Get : cp failed error code ${status}"
1246      cat out_rsync
1247      IGCM_debug_Exit "IGCM_sys_Get"
1248    else
1249      \rm out_rsync
1250    fi
1251  fi
1252  IGCM_debug_PopStack "IGCM_sys_Get"
1253}
1254
1255#D-#==================================================
1256#D-function IGCM_sys_GetBuffer
1257#D-* Purpose: Get a file from ${SCRATCHDIR}
1258#D-* Examples: IGCM_sys_GetBuffer myfile /destpath/myfile_with_PREFIX
1259#D-            IGCM_sys_GetBuffer /l Array_contain_myfiles /destpath/
1260function IGCM_sys_GetBuffer {
1261  IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@
1262
1263  typeset DEST buf_liste target file_work
1264  typeset NB_ESSAI DELAI status i
1265
1266  if ( $DEBUG_sys ) ; then
1267    echo "IGCM_sys_GetBuffer :" $@
1268  fi
1269
1270  # number of tentative
1271  NB_ESSAI=3
1272  # time delay between tentative
1273  DELAI=2
1274
1275  if [ $DRYRUN -le 2 ]; then
1276    if [ X${1} = X'/l' ] ; then
1277      # test if the first file is present in the old computation :
1278      eval set +A buf_liste \${${2}}
1279    else
1280      eval set +A buf_liste ${1}
1281    fi
1282    eval DEST=\${${#}}
1283
1284    #USUAL WAY
1285    if [ X${1} = X'/l' ] ; then
1286      for target in ${buf_liste[*]} ; do
1287        local_file=$( basename ${target} )
1288        i=0
1289        while [ $i -lt $NB_ESSAI ] ; do
1290          \cp ${target} ${DEST}/${local_file} >> out_rsync 2>&1
1291          status=$?
1292          if [ ${status} -gt 0 ]; then
1293            IGCM_debug_Print 2 "IGCM_sys_GetBuffer : cp failed error code ${status} ${i}/${NB_ESSAI}"
1294            IGCM_debug_Print 2 "IGCM_sys_GetBuffer : sleep ${DELAI} seconds and try again."
1295            sleep $DELAI
1296          else
1297            break
1298          fi
1299          (( i = i + 1 ))
1300        done
1301        if [ ${status} -gt 0 ] ; then
1302          echo "IGCM_sys_Get : error"
1303          cat out_rsync
1304          \rm out_rsync
1305          IGCM_debug_Exit "IGCM_sys_GetBuffer"
1306        else
1307          \rm out_rsync
1308        fi
1309      done
1310    else
1311      i=0
1312      while [ $i -lt $NB_ESSAI ] ; do
1313        \cp ${buf_liste} ${DEST} >> out_rsync 2>&1
1314        status=$?
1315        if [ ${status} -gt 0 ]; then
1316          IGCM_debug_Print 2 "IGCM_sys_GetBuffer : cp failed error code ${status} ${i}/${NB_ESSAI}"
1317          IGCM_debug_Print 2 "IGCM_sys_GetBuffer : sleep ${DELAI} seconds and try again."
1318          sleep $DELAI
1319        else
1320          break
1321        fi
1322        (( i = i + 1 ))
1323      done
1324      if [ ${status} -gt 0 ] ; then
1325        echo "IGCM_sys_Get : error"
1326        cat out_rsync
1327        \rm out_rsync
1328        IGCM_debug_Exit "IGCM_sys_GetBuffer"
1329      else
1330        \rm out_rsync
1331      fi
1332    fi
1333  fi
1334  IGCM_debug_PopStack "IGCM_sys_GetBuffer"
1335}
1336
1337#D-#==================================================
1338#D-function IGCM_sys_GetDate_FichWork
1339#D-* Purpose: donne la date filesys d'un fichier sur le filesystem WORK
1340#D-* Examples:
1341#D-
1342function IGCM_sys_GetDate_FichWork {
1343  IGCM_debug_PushStack "IGCM_sys_FichWork" $@
1344  if ( $DEBUG_sys ) ; then
1345    echo "IGCM_sys_GetDate_FichWork :" $@
1346  fi
1347  typeset dateF
1348  set +A dateF -- $( ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} )
1349  eval ${2}=${dateF[5]}
1350
1351  # donne la date filesys d'un fichier sur la machine work
1352  IGCM_debug_PopStack "IGCM_sys_FichWork"
1353}
1354
1355#D-#==================================================
1356#D-function IGCM_sys_GetDate_FichArchive
1357#D-* Purpose: donne la date filesys d'un fichier sur le filesystem ARCHIVE
1358#D-* Examples:
1359#D-
1360function IGCM_sys_GetDate_FichArchive {
1361  IGCM_debug_PushStack "IGCM_sys_FichArchive" $@
1362  if ( $DEBUG_sys ) ; then
1363    echo "IGCM_sys_GetDate_FichArchive :" $@
1364  fi
1365  typeset dateF
1366  set +A dateF -- $( ls -l --full-time --time-style='+%Y%m%d%H%M%S' ${1} )
1367  eval ${2}=${dateF[5]}
1368
1369  IGCM_debug_PopStack "IGCM_sys_FichArchive"
1370}
1371
1372#D-#==================================================
1373#D-function IGCM_sys_Dods_Rm
1374#D-* Purpose: DO NOTHING ! Put ${ARCHIVE} files on DODS internet protocole.
1375#D-* Examples:
1376#D-
1377function IGCM_sys_Dods_Rm {
1378  if ( $DEBUG_sys ) ; then
1379    echo "IGCM_sys_Dods_Rm :" $@
1380  fi
1381  return 0
1382}
1383
1384#D-#==================================================
1385#D-function IGCM_sys_Dods_Cp
1386#D-* Purpose: Copy $(ARCHIVE) files on DODS internet protocole.
1387#D-* Examples:
1388#D-
1389function IGCM_sys_Dods_Cp {
1390  if ( $DEBUG_sys ) ; then
1391    echo "IGCM_sys_Dods_Cp :" $@
1392  fi
1393  return 0
1394}
1395
1396#D-#==================================================
1397#D-function IGCM_sys_Put_Dods
1398#D-* Purpose: Put ${ARCHIVE} files on DODS internet protocole. Dummy function here
1399#D-* Examples:
1400#D-
1401function IGCM_sys_Put_Dods {
1402  IGCM_debug_PushStack "IGCM_sys_Put_Dods" $@
1403  if ( $DEBUG_sys ) ; then
1404    echo "IGCM_sys_Put_Dods :" $@
1405  fi
1406  IGCM_debug_PopStack "IGCM_sys_Put_Dods"
1407}
1408
1409##############################################################
1410# REBUILD OPERATOR
1411
1412#D-#==================================================
1413#D-function IGCM_sys_rebuild
1414#D-* Purpose: rebuild parallel files
1415#D-* Examples:
1416#D-
1417function IGCM_sys_rebuild {
1418  IGCM_debug_PushStack "IGCM_sys_rebuild" -- $@
1419  if ( $DEBUG_sys ) ; then
1420    echo "IGCM_sys_rebuild :" $@
1421  fi
1422
1423  typeset NB_ESSAI DELAI status i firstArg
1424  # number of tentative
1425  NB_ESSAI=3
1426  # time delay between tentative
1427  DELAI=2
1428
1429  i=0
1430  while [ $i -lt $NB_ESSAI ] ; do
1431    rebuild -f -o $@ > out_rsync 2>&1
1432    status=$?
1433    if [ ${status} -gt 0 ] ; then
1434      IGCM_debug_Print 2 "IGCM_sys_rebuild : error code ${status}"
1435      cat out_rsync
1436      \rm out_rsync
1437      IGCM_debug_Print 2 "IGCM_sys_rebuild : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
1438      firstArg=${1}
1439      \rm ${firstArg}
1440      sleep $DELAI
1441    else
1442      \rm out_rsync
1443      break
1444    fi
1445    (( i = i + 1 ))
1446  done
1447
1448  if [ ${status} -gt 0 ] ; then
1449    echo "IGCM_sys_rebuild : rebuild error code is ${status}"
1450    IGCM_debug_Exit "rebuild"
1451  fi
1452
1453  IGCM_debug_PopStack "IGCM_sys_rebuild"
1454}
1455
1456#D-#==================================================
1457#D-function IGCM_sys_rebuild_station
1458#D-* Purpose: rebuild parallel files describing station
1459#D-* Examples:
1460#D-
1461function IGCM_sys_rebuild_station {
1462  IGCM_debug_PushStack "IGCM_sys_rebuild_station" -- $@
1463  typeset i list_opt file_in file_out prefix_invert list_invert
1464  if ( $DEBUG_sys ) ; then
1465    echo "IGCM_sys_rebuild_station :" $@
1466  fi
1467  list_opt=$@
1468
1469  # Invert Axis : t,x -> x,t
1470  #               t,pres,x -> x,t,pres
1471  # So that we can concatenate along x
1472  i=0
1473  for file_in in ${list_opt} ; do
1474    (( i = i + 1))
1475    [ ${i} = 1 ] && file_out=${file_in} && continue
1476    prefix_invert=$( basename ${file_in} .nc )
1477    IGCM_sys_ncpdq -a x,time_counter -a x,time_counter,presnivs ${file_in} ${prefix_invert}_xt.nc
1478    list_invert[${#list_invert[*]}]=${prefix_invert}_xt.nc
1479  done
1480
1481  # Concatenate
1482  IGCM_sys_ncrcat ${list_invert[*]} histstn_xt.nc
1483
1484  # Re-ivert file
1485  IGCM_sys_ncpdq -a time_counter,x -a time_counter,presnivs,x histstn_xt.nc ${file_out}
1486
1487  # Station re-ordering is too expansive to be run within libICGM
1488  # This is due to (ncpdq - nrcat - ncpdq) I/O sequence.
1489  # This re-ordering must be done "in memory" by the cmorization process
1490  # Anyway this is the best sequence using (ncpdq - nrcat - ncpdq)
1491  # BEGIN reordering
1492
1493  # Only LMDZ text output contains the exact ordering of the station.
1494  # We isolate this in the code below:
1495  #  0  38  -157.5000000000000  70.98591549295774
1496  #  0  54  27.49999999999999   67.18309859154928
1497  #  0  56  -62.50000000000001  82.39436619718309
1498  #  0  79  12.49999999999999   78.59154929577466
1499  #  0  116 -165.0000000000000  76.05633802816901
1500  #  0  117 130.0000000000000   70.98591549295774
1501  #  0  118 110.0000000000000   87.46478873239437
1502  #  1  40  4.999999999999995   51.97183098591550
1503#  typeset iStation iProc list_opt file_in file_out prefix_invert
1504#  typeset -Z4 j4
1505#  typeset -Z3 j3
1506
1507#  unset list_opt
1508#  set +A list_opt $@
1509
1510  # Filename after rebuild
1511#  file_out=${list_opt[0]}
1512  # Prefix of output files
1513#  prefix_invert=$( basename ${file_out} .nc )
1514  # Number of procs
1515#  num_proc=$( grep -i mpi_size ${PREFIX}_${Exe_Output} | wc -l )
1516
1517#  iProc=0
1518#  while [ ${iProc} -lt ${num_proc} ] ; do
1519    # Array containing Station as a number
1520#    unset proc_stn
1521#    set +A proc_stn $( grep "iophy_mpi rank ip lon lat  $iProc" ${PREFIX}_${Exe_Output} | sed -e "s/iophy_mpi rank ip lon lat //g" | awk ' {print $2}' )
1522    # Number of stations produced by processor proc
1523#    stationLast=${#proc_stn[*]}
1524    # Proc number on 4 digits
1525#    j4=${iProc}
1526    # Init
1527#    iStation=0
1528#    while [ ${iStation} -lt ${stationLast} ] ; do
1529      # Station number on 3 digits
1530#      j3=${proc_stn[${iStation}]}
1531      # Extract station
1532      # Invert Axis : t,x -> x,t
1533      #               t,pres,x -> x,t,pres
1534      # So that we can concatenate along x
1535#      IGCM_sys_ncpdq -a x,time_counter -a x,time_counter,presnivs -d x,$iStation,$iStation ${prefix_invert}_${j4}.nc ${prefix_invert}_stn_${j3}.nc
1536#      (( iStation = iStation + 1 ))
1537#    done
1538#    (( iProc = iProc + 1 ))
1539#  done
1540
1541  # Concatenate all station along x
1542#  IGCM_sys_ncrcat ${prefix_invert}_stn_???.nc ${prefix_invert}_xt.nc
1543
1544  # Re-invert file
1545#  IGCM_sys_ncpdq -a time_counter,x -a time_counter,presnivs,x ${prefix_invert}_xt.nc ${file_out}
1546
1547  # END reordering
1548
1549  IGCM_debug_PopStack "IGCM_sys_rebuild_station"
1550}
1551
1552############################################################
1553# Activate Running Environnment Variables
1554
1555#D-#==================================================
1556#D-function IGCM_sys_desactiv_variables
1557#D-* Purpose: set environement variables prior to execution
1558#D-* Examples:
1559#D-
1560function IGCM_sys_activ_variables {
1561  IGCM_debug_PushStack "IGCM_sys_activ_variables"
1562  if ( $DEBUG_sys ) ; then
1563    echo "IGCM_sys_activ_variables"
1564  fi
1565
1566# --------------------------------------------------------------------
1567#D- MPI specifications
1568# --------------------------------------------------------------------
1569
1570# --------------------------------------------------------------------
1571#D- Other specifications
1572# --------------------------------------------------------------------
1573
1574  IGCM_debug_PopStack "IGCM_sys_activ_variables"
1575}
1576
1577############################################################
1578# Desactivate Running Environnment Variables
1579
1580#D-#==================================================
1581#D-function IGCM_sys_desactiv_variables
1582#D-* Purpose: unset environement variables after execution
1583#D-* Examples:
1584#D-
1585function IGCM_sys_desactiv_variables {
1586  IGCM_debug_PushStack "IGCM_sys_desactiv_variables"
1587  if ( $DEBUG_sys ) ; then
1588    echo "IGCM_sys_desactiv_variables"
1589  fi
1590# --------------------------------------------------------------------
1591#D- MPI specifications
1592# --------------------------------------------------------------------
1593
1594# --------------------------------------------------------------------
1595#D- Other specifications
1596# --------------------------------------------------------------------
1597
1598  IGCM_debug_PopStack "IGCM_sys_desactiv_variables"
1599}
1600
1601############################################################
1602# Build MPI/OMP scripts run file (dummy function)
1603
1604#D-#==================================================
1605#D-function IGCM_sys_build_run_file
1606#D-* Purpose: build run file (deprecated)
1607#D-* Examples:
1608#D-
1609function IGCM_sys_build_run_file {
1610
1611  IGCM_debug_Print 3 " dummy function : IGCM_sys_build_run_file "
1612
1613}
1614
1615############################################################
1616# Build MPI/OMP scripts
1617
1618#D-#==================================================
1619#D-function IGCM_sys_build_execution_scripts
1620#D-* Purpose: build execution scripts to be launch by ${HOST_MPIRUN_COMMAND}
1621#D-* Examples:
1622#D-
1623function IGCM_sys_build_execution_scripts
1624{
1625  IGCM_debug_PushStack "IGCM_sys_build_execution_scripts" $@
1626  if ( $DEBUG_sys ) ; then
1627    echo "IGCM_sys_build_execution_scripts " $@
1628  fi
1629  typeset nodes listnodes init_node start_num init_exec comp ExeNameIn ExeNameOut
1630  typeset node_num_current node_current comp_proc_mpi_loc comp_proc_omp_loc
1631  typeset num_corempi nombre_restant_node nombre_restant_comp
1632
1633  if [ ! -f ${SUBMIT_DIR}/Job_${config_UserChoices_JobName} ]  ; then
1634    IGCM_debug_Exit "IGCM_sys_default build_execution_scripts : Job_${config_UserChoices_JobName} don't exist in SUBMIT_DIR : ${SUBMIT_DIR} "
1635  fi
1636
1637  if ( ${OK_PARA_MPMD} ) ; then
1638
1639    if [ -f run_file ] ; then
1640      IGCM_sys_Rm -f run_file
1641    fi
1642    touch run_file
1643
1644    if ( ${OK_PARA_OMP} ) ; then
1645
1646      #  Hosts treatment
1647
1648      ${HOST_MPIRUN_COMMAND} hostname | sort | uniq > hosts.tmp
1649
1650      i=0
1651      rm -f hosts
1652      IGCM_debug_Print 1 "sys $( hostname ), Hosts avaible :"
1653      for nodes in `cat hosts.tmp` ; do
1654        host[$i]=$nodes
1655        echo "${host[$i]} slots=1 max_slots=1" >> hosts
1656        IGCM_debug_Print 1 ${host[$i]}
1657        i=$((i+1))
1658      done
1659      rm -f hosts.tmp
1660
1661      listnodes=${host[*]}
1662
1663      EXECUTION="${HOST_MPIRUN_COMMAND} -hostfile hosts"
1664
1665      # Initialisation
1666
1667      init_node=y
1668      node_num_current=0
1669      start_num=0
1670      init_exec=n
1671
1672      # Test : if oasis is there, we put it at the first position
1673
1674      for comp in ${config_ListOfComponents[*]} ; do
1675
1676        if [ "X${comp}" = "XCPL" ]  ; then
1677
1678          eval ExeNameIn=\${config_Executable_${comp}[0]}
1679          eval ExeNameOut=\${config_Executable_${comp}[1]}
1680
1681          echo "#!/bin/ksh" > script_${ExeNameOut}.ksh
1682          echo ""  >> script_${ExeNameOut}.ksh
1683          #echo "export KMP_STACKSIZE=3g"  >> script_${ExeNameOut}.ksh
1684          #echo "export KMP_LIBRARY=turnaround"  >> script_${ExeNameOut}.ksh
1685          #echo "export MKL_SERIAL=YES"  >> script_${ExeNameOut}.ksh
1686          echo "./${ExeNameOut} > out_${ExeNameOut}.out 2>out_${ExeNameOut}.err"  >> script_${ExeNameOut}.ksh
1687          IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh
1688
1689          init_node=n
1690
1691          (( nombre_restant_node = NUM_COREPERNODE - 1 ))
1692          node_num_current=0
1693          node_current=${host[${node_num_current}]}
1694
1695          EXECUTION="${EXECUTION} -H ${node_current} -np 1 ./script_${ExeNameOut}.ksh"
1696
1697          init_exec=y
1698          start_num=1
1699
1700        fi
1701
1702      done
1703
1704      # Then loop on the components (except for oasis)
1705
1706      for comp in ${config_ListOfComponents[*]} ; do
1707
1708        eval ExeNameIn=\${config_Executable_${comp}[0]}
1709        eval ExeNameOut=\${config_Executable_${comp}[1]}
1710
1711        # Only if we really have an executable for the component :
1712        if ( [ "X${ExeNameOut}" != X\"\" ] &&  [ "X${comp}" != "XCPL" ] ) ; then
1713
1714          eval comp_proc_mpi_loc=\${${comp}_PROC_MPI}
1715          eval comp_proc_omp_loc=\${${comp}_PROC_OMP}
1716
1717          echo "#!/bin/ksh" > script_${ExeNameOut}.ksh
1718          # echo "set -vx" >> script_${ExeNameOut}.ksh
1719          echo ""  >> script_${ExeNameOut}.ksh
1720          #echo "export KMP_STACKSIZE=3g"  >> script_${ExeNameOut}.ksh
1721          #echo "export KMP_LIBRARY=turnaround"  >> script_${ExeNameOut}.ksh
1722          #echo "export MKL_SERIAL=YES"  >> script_${ExeNameOut}.ksh
1723          echo "OMP_NUM_THREADS=${comp_proc_omp_loc}" >> script_${ExeNameOut}.ksh
1724          echo "(( MYMPIRANK = OMPI_COMM_WORLD_RANK - ${start_num})) " >>  script_${ExeNameOut}.ksh
1725          echo "./${ExeNameOut} > out_${ExeNameOut}.out.\${MYMPIRANK} 2>out_${ExeNameOut}.err.\${MYMPIRANK}"  >> script_${ExeNameOut}.ksh
1726          IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh
1727
1728          node_num=0
1729
1730          # We define the number of MPI process to be assigned for the component
1731
1732          nombre_restant_comp=${comp_proc_mpi_loc}
1733
1734          # Loop on the allocated nodes
1735
1736          for node in ${listnodes} ; do
1737
1738            # We go to the current node
1739            if [ ${node_num} = ${node_num_current} ] ; then
1740
1741              node_current=${host[${node_num_current}]}
1742
1743              # If first time on the node : initialisation
1744
1745              if [ ${init_node} = y ] ; then
1746                nombre_restant_node=${NUM_COREPERNODE}
1747              fi
1748
1749              # Test on the number of OMP threads
1750
1751              if [ ${comp_proc_omp_loc} -gt ${nombre_restant_node} ] ; then
1752                (( node_num = node_num + 1 ))
1753                node_num_current=${node_num}
1754                init_node=y
1755                continue
1756              fi
1757
1758              # Number of MPI process to assign
1759
1760              (( num_corempi = nombre_restant_node / comp_proc_omp_loc ))
1761
1762              if [ ${num_corempi} -gt ${nombre_restant_comp} ] ; then
1763                num_corempi=${nombre_restant_comp}
1764              fi
1765
1766              (( nombre_restant_node = nombre_restant_node - num_corempi * comp_proc_omp_loc ))
1767              (( nombre_restant_comp = nombre_restant_comp - num_corempi ))
1768
1769              if [ ${init_exec} = y ] ; then
1770                EXECUTION="${EXECUTION} : -H ${node_current} -np ${num_corempi} ./script_${ExeNameOut}.ksh"
1771              else
1772                EXECUTION="${EXECUTION} -H ${node_current} -np ${num_corempi} ./script_${ExeNameOut}.ksh"
1773                init_exec=y
1774              fi
1775
1776              ((  start_num = num_corempi + start_num ))
1777
1778            else
1779
1780              (( node_num = node_num + 1 ))
1781              continue
1782            fi
1783
1784            # Test on the number of core/process remaining on the node/component
1785
1786            if [ ${nombre_restant_node} = 0 ] ; then
1787              (( node_num = node_num + 1 ))
1788              node_num_current=${node_num}
1789              init_node=y
1790
1791              if [ ${nombre_restant_comp} = 0 ] ; then
1792                break 1
1793              fi
1794            else
1795
1796              node_num_current=${node_num}
1797              init_node=n
1798
1799              if [ ${nombre_restant_comp} = 0 ] ; then
1800                break 1
1801              fi
1802            fi
1803          done
1804        fi
1805      done
1806
1807    else
1808
1809      # Then first loop on the components for the coupler ie oasis
1810
1811      ## the coupler ie oasis must be the first one
1812      for comp in ${config_ListOfComponents[*]} ; do
1813
1814        eval ExeNameOut=\${config_Executable_${comp}[1]}
1815
1816        # for CPL component only
1817        if [ "X${comp}" = "XCPL" ] ; then
1818          eval comp_proc_mpi_loc=\${${comp}_PROC_MPI}
1819          echo "-np ${comp_proc_mpi_loc} ./${ExeNameOut} " >> run_file
1820        fi
1821      done
1822
1823      # Then second loop on the components
1824
1825      for comp in ${config_ListOfComponents[*]} ; do
1826
1827        eval ExeNameOut=\${config_Executable_${comp}[1]}
1828
1829        # Only if we really have an executable for the component and not the coupler ie oasis:
1830        if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${comp}" != "XCPL" ] ) ; then
1831          eval comp_proc_mpi_loc=\${${comp}_PROC_MPI}
1832          echo "-np ${comp_proc_mpi_loc} ./${ExeNameOut}" >> run_file
1833        fi
1834      done
1835      IGCM_sys_Chmod u+x run_file
1836
1837      EXECUTION="${HOST_MPIRUN_COMMAND} --app ./run_file"
1838
1839    fi
1840
1841  else # Only one executable. launch it.
1842
1843    for comp in ${config_ListOfComponents[*]} ; do
1844
1845      # Only if we really have an executable for the component :
1846      eval ExeNameOut=\${config_Executable_${comp}[1]}
1847      if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${ExeNameOut}" != "Xinca.dat" ] ) ; then
1848
1849        echo "#!/bin/ksh" > script_${ExeNameOut}.ksh
1850        echo ""  >> script_${ExeNameOut}.ksh
1851        if ( ${OK_PARA_OMP} ) ; then
1852          eval comp_proc_omp_loc=\${${comp}_PROC_OMP}
1853          echo "OMP_NUM_THREADS=${comp_proc_omp_loc}" >> script_${ExeNameOut}.ksh
1854        fi
1855        if  ( ${OK_PARA_MPI} ) ; then
1856          # Default : mpirun used if nb_proc gt 1
1857          # pour sortie out/err par process
1858          # echo "./${ExeNameOut} > out_${ExeNameOut}.out.\${OMPI_COMM_WORLD_RANK} 2>out_${ExeNameOut}.err.\${OMPI_COMM_WORLD_RANK}"  >> script_${ExeNameOut}.ksh
1859          echo "./${ExeNameOut}" >> script_${ExeNameOut}.ksh
1860          IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh
1861          EXECUTION="${HOST_MPIRUN_COMMAND} ./script_${ExeNameOut}.ksh"
1862        else
1863          # Default : mpirun is NOT used if nb_proc eq 1
1864          # pour sortie out/err par process
1865          # echo "./${ExeNameOut} > out_${ExeNameOut}.out 2>out_${ExeNameOut}.err" >> script_${ExeNameOut}.ksh
1866          echo "./${ExeNameOut}" >> script_${ExeNameOut}.ksh
1867          IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh
1868          EXECUTION="time ./script_${ExeNameOut}.ksh"
1869        fi
1870      fi
1871    done
1872
1873  fi
1874
1875  IGCM_debug_Print 1 "sys $( hostname ) : execution command is"
1876  IGCM_debug_Print 1 "$EXECUTION"
1877
1878  IGCM_debug_PopStack "IGCM_sys_build_execution_scripts"
1879}
1880
1881############################################################
1882# Check of space available on temporary filesytems. Dummy function here
1883
1884#D-#==================================================
1885#D-function IGCM_sys_check_quota. Dummy call here
1886#D-* Purpose: check user quota. Stop the simulation if quota above 90%
1887#D-* Examples:
1888#D-
1889function IGCM_sys_check_quota {
1890  IGCM_debug_PushStack "IGCM_sys_check_quota"
1891  if ( $DEBUG_sys ) ; then
1892    echo "IGCM_sys_check_quota"
1893  fi
1894  IGCM_debug_PopStack "IGCM_sys_check_quota"
1895}
1896
1897#D-#==================================================
1898#D-function IGCM_sys_CountJobInQueue
1899#D-* Purpose: Check if job_name is currently
1900#D-  running or in queue
1901#D-* Examples: IGCM_sys_CountJobInQueue ${JobName} NbRun
1902#D-
1903function IGCM_sys_CountJobInQueue {
1904  IGCM_debug_PushStack "IGCM_sys_CountJobInQueue"
1905  if ( $DEBUG_sys ) ; then
1906    echo "IGCM_sys_CountJobInQueue"
1907  fi
1908  IGCM_debug_PopStack "IGCM_sys_CountJobInQueue"
1909}
1910
1911##############################################################
1912# NCO OPERATOR
1913
1914#D-#==================================================
1915#D-function IGCM_sys_ncap2
1916#D-* Purpose: encapsulate ncap2 call so as to manage error code and retry
1917#D-* Examples:
1918#D-
1919function IGCM_sys_ncap2 {
1920  IGCM_debug_PushStack "IGCM_sys_ncap2" -- $@
1921  if ( $DEBUG_sys ) ; then
1922    echo "IGCM_sys_ncap2 :" $@
1923  fi
1924
1925  typeset NB_ESSAI DELAI status i
1926  # number of tentative
1927  NB_ESSAI=3
1928  # time delay between tentative
1929  DELAI=2
1930
1931  i=0
1932  while [ $i -lt $NB_ESSAI ] ; do
1933    ncap2 "$@" > out_rsync 2>&1
1934    status=$?
1935    if [ ${status} -gt 0 ] ; then
1936      IGCM_debug_Print 2 "IGCM_sys_ncap2 : error code ${status}"
1937      cat out_rsync
1938      \rm out_rsync
1939      IGCM_debug_Print 2 "IGCM_sys_ncap2 : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
1940      sleep $DELAI
1941    else
1942      \rm out_rsync
1943      break
1944    fi
1945    (( i = i + 1 ))
1946  done
1947
1948  if [ ${status} -gt 0 ] ; then
1949    echo "IGCM_sys_ncap2 : ncap2 error"
1950    IGCM_debug_Exit "ncap2"
1951  fi
1952
1953  IGCM_debug_PopStack "IGCM_sys_ncap2"
1954}
1955
1956#D-#==================================================
1957#D-function IGCM_sys_ncatted
1958#D-* Purpose: encapsulate ncatted call so as to manage error code and retry
1959#D-* Examples:
1960#D-
1961function IGCM_sys_ncatted {
1962  IGCM_debug_PushStack "IGCM_sys_ncatted" -- $@
1963  if ( $DEBUG_sys ) ; then
1964    echo "IGCM_sys_ncatted :" $@
1965  fi
1966
1967  typeset NB_ESSAI DELAI status i
1968  # number of tentative
1969  NB_ESSAI=3
1970  # time delay between tentative
1971  DELAI=2
1972
1973  i=0
1974  while [ $i -lt $NB_ESSAI ] ; do
1975    ncatted "$@" > out_rsync 2>&1
1976    status=$?
1977    if [ ${status} -gt 0 ] ; then
1978      IGCM_debug_Print 2 "IGCM_sys_ncatted : error code ${status}"
1979      cat out_rsync
1980      \rm out_rsync
1981      IGCM_debug_Print 2 "IGCM_sys_ncatted : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
1982      sleep $DELAI
1983    else
1984      \rm out_rsync
1985      break
1986    fi
1987    (( i = i + 1 ))
1988  done
1989
1990  if [ ${status} -gt 0 ] ; then
1991    echo "IGCM_sys_ncatted : ncatted error"
1992    IGCM_debug_Exit "ncatted"
1993  fi
1994
1995  IGCM_debug_PopStack "IGCM_sys_ncatted"
1996}
1997
1998#D-#==================================================
1999#D-function IGCM_sys_ncbo
2000#D-* Purpose: encapsulate ncbo call so as to manage error code and retry
2001#D-* Examples:
2002#D-
2003function IGCM_sys_ncbo {
2004  IGCM_debug_PushStack "IGCM_sys_ncbo" -- $@
2005  if ( $DEBUG_sys ) ; then
2006    echo "IGCM_sys_ncbo :" $@
2007  fi
2008
2009  typeset NB_ESSAI DELAI status i
2010  # number of tentative
2011  NB_ESSAI=3
2012  # time delay between tentative
2013  DELAI=2
2014
2015  i=0
2016  while [ $i -lt $NB_ESSAI ] ; do
2017    ncbo $@ > out_rsync 2>&1
2018    status=$?
2019    if [ ${status} -gt 0 ] ; then
2020      IGCM_debug_Print 2 "IGCM_sys_ncbo : error code ${status}"
2021      cat out_rsync
2022      \rm out_rsync
2023      IGCM_debug_Print 2 "IGCM_sys_ncbo : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
2024      sleep $DELAI
2025    else
2026      \rm out_rsync
2027      break
2028    fi
2029    (( i = i + 1 ))
2030  done
2031
2032  if [ ${status} -gt 0 ] ; then
2033    echo "IGCM_sys_ncbo : ncbo error"
2034    IGCM_debug_Exit "ncbo"
2035  fi
2036
2037  IGCM_debug_PopStack "IGCM_sys_ncbo"
2038}
2039
2040#D-#==================================================
2041#D-function IGCM_sys_ncdif
2042#D-* Purpose: encapsulate ncdiff call so as to manage error code and retry
2043#D-* Examples:
2044#D-
2045function IGCM_sys_ncdiff {
2046  IGCM_debug_PushStack "IGCM_sys_ncdiff" -- $@
2047  if ( $DEBUG_sys ) ; then
2048    echo "IGCM_sys_ncdiff :" $@
2049  fi
2050
2051  typeset NB_ESSAI DELAI status i
2052  # number of tentative
2053  NB_ESSAI=3
2054  # time delay between tentative
2055  DELAI=2
2056
2057  i=0
2058  while [ $i -lt $NB_ESSAI ] ; do
2059    ncdiff $@ > out_rsync 2>&1
2060    status=$?
2061    if [ ${status} -gt 0 ] ; then
2062      IGCM_debug_Print 2 "IGCM_sys_ncdiff : error code ${status}"
2063      cat out_rsync
2064      \rm out_rsync
2065      IGCM_debug_Print 2 "IGCM_sys_ncdiff : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
2066      sleep $DELAI
2067    else
2068      \rm out_rsync
2069      break
2070    fi
2071    (( i = i + 1 ))
2072  done
2073
2074  if [ ${status} -gt 0 ] ; then
2075    echo "IGCM_sys_ncdiff : ncdiff error"
2076    IGCM_debug_Exit "ncdiff"
2077  fi
2078
2079  IGCM_debug_PopStack "IGCM_sys_ncdiff"
2080}
2081
2082#D-#==================================================
2083#D-function IGCM_sys_ncea
2084#D-* Purpose: encapsulate ncea call so as to manage error code and retry
2085#D-* Examples:
2086#D-
2087function IGCM_sys_ncea {
2088  IGCM_debug_PushStack "IGCM_sys_ncea" -- $@
2089  if ( $DEBUG_sys ) ; then
2090    echo "IGCM_sys_ncea :" $@
2091  fi
2092
2093  typeset NB_ESSAI DELAI status i
2094  # number of tentative
2095  NB_ESSAI=3
2096  # time delay between tentative
2097  DELAI=2
2098
2099  i=0
2100  while [ $i -lt $NB_ESSAI ] ; do
2101    ncea $@ > out_rsync 2>&1
2102    status=$?
2103    if [ ${status} -gt 0 ] ; then
2104      IGCM_debug_Print 2 "IGCM_sys_ncea : error code ${status}"
2105      cat out_rsync
2106      \rm out_rsync
2107      IGCM_debug_Print 2 "IGCM_sys_ncea : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
2108      sleep $DELAI
2109    else
2110      \rm out_rsync
2111      break
2112    fi
2113    (( i = i + 1 ))
2114  done
2115
2116  if [ ${status} -gt 0 ] ; then
2117    echo "IGCM_sys_ncea : ncea error"
2118    IGCM_debug_Exit "ncea"
2119  fi
2120
2121  IGCM_debug_PopStack "IGCM_sys_ncea"
2122}
2123
2124#D-#==================================================
2125#D-function IGCM_sys_ncecat
2126#D-* Purpose: encapsulate ncecat call so as to manage error code and retry
2127#D-* Examples:
2128#D-
2129function IGCM_sys_ncecat {
2130  IGCM_debug_PushStack "IGCM_sys_ncecat" -- $@
2131  if ( $DEBUG_sys ) ; then
2132    echo "IGCM_sys_ncecat :" $@
2133  fi
2134
2135  typeset NB_ESSAI DELAI status i
2136  # number of tentative
2137  NB_ESSAI=3
2138  # time delay between tentative
2139  DELAI=2
2140
2141  i=0
2142  while [ $i -lt $NB_ESSAI ] ; do
2143    ncecat $@ > out_rsync 2>&1
2144    status=$?
2145    if [ ${status} -gt 0 ] ; then
2146      IGCM_debug_Print 2 "IGCM_sys_ncecat : error code ${status}"
2147      cat out_rsync
2148      \rm out_rsync
2149      IGCM_debug_Print 2 "IGCM_sys_ncecat : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
2150      sleep $DELAI
2151    else
2152      \rm out_rsync
2153      break
2154    fi
2155    (( i = i + 1 ))
2156  done
2157
2158  if [ ${status} -gt 0 ] ; then
2159    echo "IGCM_sys_ncecat : ncecat error"
2160    IGCM_debug_Exit "ncecat"
2161  fi
2162
2163  IGCM_debug_PopStack "IGCM_sys_ncecat"
2164}
2165
2166#D-#==================================================
2167#D-function IGCM_sys_ncflint
2168#D-* Purpose: encapsulate ncflint call so as to manage error code and retry
2169#D-* Examples:
2170#D-
2171function IGCM_sys_ncflint {
2172  IGCM_debug_PushStack "IGCM_sys_ncflint" -- $@
2173  if ( $DEBUG_sys ) ; then
2174    echo "IGCM_sys_ncflint :" $@
2175  fi
2176
2177  typeset NB_ESSAI DELAI status i
2178  # number of tentative
2179  NB_ESSAI=3
2180  # time delay between tentative
2181  DELAI=2
2182
2183  i=0
2184  while [ $i -lt $NB_ESSAI ] ; do
2185    ncflint $@ > out_rsync 2>&1
2186    status=$?
2187    if [ ${status} -gt 0 ] ; then
2188      IGCM_debug_Print 2 "IGCM_sys_ncflint : error code ${status}"
2189      cat out_rsync
2190      \rm out_rsync
2191      IGCM_debug_Print 2 "IGCM_sys_ncflint : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
2192      sleep $DELAI
2193    else
2194      \rm out_rsync
2195      break
2196    fi
2197    (( i = i + 1 ))
2198  done
2199
2200  if [ ${status} -gt 0 ] ; then
2201    echo "IGCM_sys_ncflint : ncflint error"
2202    IGCM_debug_Exit "ncflint"
2203  fi
2204
2205  IGCM_debug_PopStack "IGCM_sys_ncflint"
2206}
2207
2208#D-#==================================================
2209#D-function IGCM_sys_ncks
2210#D-* Purpose: encapsulate ncks call so as to manage error code and retry
2211#D-* Examples:
2212#D-
2213function IGCM_sys_ncks {
2214  IGCM_debug_PushStack "IGCM_sys_ncks" -- $@
2215  if ( $DEBUG_sys ) ; then
2216    echo "IGCM_sys_ncks :" $@
2217  fi
2218
2219  typeset NB_ESSAI DELAI status i
2220  # number of tentative
2221  NB_ESSAI=3
2222  # time delay between tentative
2223  DELAI=2
2224
2225  i=0
2226  while [ $i -lt $NB_ESSAI ] ; do
2227    ncks $@ > out_rsync 2>&1
2228    status=$?
2229    if [ ${status} -gt 0 ] ; then
2230      IGCM_debug_Print 2 "IGCM_sys_ncks : error code ${status}"
2231      cat out_rsync
2232      \rm out_rsync
2233      IGCM_debug_Print 2 "IGCM_sys_ncks : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
2234      sleep $DELAI
2235    else
2236      \rm out_rsync
2237      break
2238    fi
2239    (( i = i + 1 ))
2240  done
2241
2242  if [ ${status} -gt 0 ] ; then
2243    echo "IGCM_sys_ncks : ncks error"
2244    IGCM_debug_Exit "ncks"
2245  fi
2246
2247  IGCM_debug_PopStack "IGCM_sys_ncks"
2248}
2249
2250#D-#==================================================
2251#D-function IGCM_sys_ncpdq
2252#D-* Purpose: encapsulate ncpdq call so as to manage error code and retry
2253#D-* Examples:
2254#D-
2255function IGCM_sys_ncpdq {
2256  IGCM_debug_PushStack "IGCM_sys_ncpdq" -- $@
2257  if ( $DEBUG_sys ) ; then
2258    echo "IGCM_sys_ncpdq :" $@
2259  fi
2260
2261  typeset NB_ESSAI DELAI status i
2262  # number of tentative
2263  NB_ESSAI=3
2264  # time delay between tentative
2265  DELAI=2
2266
2267  i=0
2268  while [ $i -lt $NB_ESSAI ] ; do
2269    ncpdq $@ > out_rsync 2>&1
2270    status=$?
2271    if [ ${status} -gt 0 ] ; then
2272      IGCM_debug_Print 2 "IGCM_sys_ncpdq : error code ${status}"
2273      cat out_rsync
2274      \rm out_rsync
2275      IGCM_debug_Print 2 "IGCM_sys_ncpdq : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
2276      sleep $DELAI
2277    else
2278      \rm out_rsync
2279      break
2280    fi
2281    (( i = i + 1 ))
2282  done
2283
2284  if [ ${status} -gt 0 ] ; then
2285    echo "IGCM_sys_ncpdq : ncpdq error"
2286    IGCM_debug_Exit "ncpdq"
2287  fi
2288
2289  IGCM_debug_PopStack "IGCM_sys_ncpdq"
2290}
2291
2292#D-#==================================================
2293#D-function IGCM_sys_ncra
2294#D-* Purpose: encapsulate ncra call so as to manage error code and retry
2295#D-* Examples:
2296#D-
2297function IGCM_sys_ncra {
2298  IGCM_debug_PushStack "IGCM_sys_ncra" -- $@
2299  if ( $DEBUG_sys ) ; then
2300    echo "IGCM_sys_ncra :" $@
2301  fi
2302
2303  typeset NB_ESSAI DELAI status i
2304  # number of tentative
2305  NB_ESSAI=3
2306  # time delay between tentative
2307  DELAI=2
2308
2309  i=0
2310  while [ $i -lt $NB_ESSAI ] ; do
2311    ncra $@ > out_rsync 2>&1
2312    status=$?
2313    if [ ${status} -gt 0 ] ; then
2314      IGCM_debug_Print 2 "IGCM_sys_ncra : error code ${status}"
2315      cat out_rsync
2316      \rm out_rsync
2317      IGCM_debug_Print 2 "IGCM_sys_ncra : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
2318      sleep $DELAI
2319    else
2320      \rm out_rsync
2321      break
2322    fi
2323    (( i = i + 1 ))
2324  done
2325
2326  if [ ${status} -gt 0 ] ; then
2327    echo "IGCM_sys_ncra : ncra error"
2328    IGCM_debug_Exit "ncra"
2329  fi
2330
2331  IGCM_debug_PopStack "IGCM_sys_ncra"
2332}
2333
2334#D-#==================================================
2335#D-function IGCM_sys_ncrcat
2336#D-* Purpose: encapsulate ncrcat call so as to manage error code and retry
2337#D-* Examples:
2338#D-
2339function IGCM_sys_ncrcat {
2340  IGCM_debug_PushStack "IGCM_sys_ncrcat" -- $@
2341  if ( $DEBUG_sys ) ; then
2342    echo "IGCM_sys_ncrcat :" $@
2343  fi
2344
2345  typeset NB_ESSAI DELAI status i lastArg
2346  # number of tentative
2347  NB_ESSAI=3
2348  # time delay between tentative
2349  DELAI=2
2350
2351  i=0
2352  while [ $i -lt $NB_ESSAI ] ; do
2353    ncrcat $@ > out_rsync 2>&1
2354    status=$?
2355    if [ ${status} -gt 0 ] ; then
2356      IGCM_debug_Print 2 "IGCM_sys_ncrcat : error code ${status}"
2357      cat out_rsync
2358      \rm out_rsync
2359      IGCM_debug_Print 2 "IGCM_sys_ncrcat : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
2360      sleep $DELAI
2361    elif [ ! "X$( grep "WARNING Intra-file non-monotonicity" out_rsync )" = "X" ] ; then
2362      IGCM_debug_Print 2 "IGCM_sys_ncrcat : WARNING Intra-file non-monotonicity"
2363      cat out_rsync
2364      # remove files having corrupted time axis
2365      eval lastArg=\${$#}
2366      IGCM_debug_Print 2 "IGCM_sys_ncrcat : Delete ${lastArg}"
2367      \rm ${lastArg}
2368      \rm out_rsync
2369      IGCM_debug_Print 2 "IGCM_sys_ncrcat : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
2370      sleep $DELAI
2371    else
2372      \rm out_rsync
2373      break
2374    fi
2375    (( i = i + 1 ))
2376  done
2377
2378  if [ ${status} -gt 0 ] ; then
2379    echo "IGCM_sys_ncrcat : ncrcat error"
2380    #IGCM_debug_Exit "ncrcat"
2381  fi
2382
2383  IGCM_debug_PopStack "IGCM_sys_ncrcat"
2384}
2385
2386#D-#==================================================
2387#D-function IGCM_sys_ncrename
2388#D-* Purpose: encapsulate ncrename call so as to manage error code and retry
2389#D-* Examples:
2390#D-
2391function IGCM_sys_ncrename {
2392  IGCM_debug_PushStack "IGCM_sys_ncrename" -- $@
2393  if ( $DEBUG_sys ) ; then
2394    echo "IGCM_sys_ncrename :" $@
2395  fi
2396
2397  typeset NB_ESSAI DELAI status i
2398  # number of tentative
2399  NB_ESSAI=3
2400  # time delay between tentative
2401  DELAI=2
2402
2403  i=0
2404  while [ $i -lt $NB_ESSAI ] ; do
2405    ncrename $@ > out_rsync 2>&1
2406    status=$?
2407    if [ ${status} -gt 0 ] ; then
2408      IGCM_debug_Print 2 "IGCM_sys_ncrename : error code ${status}"
2409      cat out_rsync
2410      \rm out_rsync
2411      IGCM_debug_Print 2 "IGCM_sys_ncrename : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
2412      sleep $DELAI
2413    else
2414      \rm out_rsync
2415      break
2416    fi
2417    (( i = i + 1 ))
2418  done
2419
2420  if [ ${status} -gt 0 ] ; then
2421    echo "IGCM_sys_ncrename : ncrename error"
2422    IGCM_debug_Exit "ncrename"
2423  fi
2424
2425  IGCM_debug_PopStack "IGCM_sys_ncrename"
2426}
2427
2428#D-#==================================================
2429#D-function IGCM_sys_ncwa
2430#D-* Purpose: encapsulate ncwa call so as to manage error code and retry
2431#D-* Examples:
2432#D-
2433function IGCM_sys_ncwa {
2434  IGCM_debug_PushStack "IGCM_sys_ncwa" -- $@
2435  if ( $DEBUG_sys ) ; then
2436    echo "IGCM_sys_ncwa :" $@
2437  fi
2438
2439  typeset NB_ESSAI DELAI status i
2440  # number of tentative
2441  NB_ESSAI=3
2442  # time delay between tentative
2443  DELAI=2
2444
2445  i=0
2446  while [ $i -lt $NB_ESSAI ] ; do
2447    ncwa $@ > out_rsync 2>&1
2448    status=$?
2449    if [ ${status} -gt 0 ] ; then
2450      IGCM_debug_Print 2 "IGCM_sys_ncwa : error code ${status}"
2451      cat out_rsync
2452      \rm out_rsync
2453      IGCM_debug_Print 2 "IGCM_sys_ncwa : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
2454      sleep $DELAI
2455    else
2456      \rm out_rsync
2457      break
2458    fi
2459    (( i = i + 1 ))
2460  done
2461
2462  if [ ${status} -gt 0 ] ; then
2463    echo "IGCM_sys_ncwa : ncwa error"
2464    IGCM_debug_Exit "ncwa"
2465  fi
2466
2467  IGCM_debug_PopStack "IGCM_sys_ncwa"
2468}
2469
2470##############################################################
2471# CDO OPERATOR
2472
2473#D-#==================================================
2474#D-function IGCM_sys_cdo
2475#D-* Purpose: encapsulate cdo call so as to manage error code and retry
2476#D-* Examples:
2477#D-
2478function IGCM_sys_cdo {
2479  IGCM_debug_PushStack "IGCM_sys_cdo" -- $@
2480  if ( $DEBUG_sys ) ; then
2481    echo "IGCM_sys_cdo :" $@
2482  fi
2483
2484  typeset status
2485
2486  \cdo $@ > out_rsync 2>&1
2487  status=$?
2488  if [ ${status} -gt 0 ] ; then
2489    echo "IGCM_sys_cdo : error code ${status}"
2490    cat out_rsync
2491    \rm out_rsync
2492    IGCM_debug_PopStack "IGCM_sys_cdo"
2493    return 1
2494  else
2495    IGCM_debug_PopStack "IGCM_sys_cdo"
2496    return 0
2497  fi
2498
2499  IGCM_debug_PopStack "IGCM_sys_cdo"
2500}
Note: See TracBrowser for help on using the repository browser.