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

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