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

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

remove machines that are not available anymore
cleanup

  • 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
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      eval set +A dm_liste \${${2}}
1225    else
1226      dm_liste=${1}
1227    fi
1228    eval DEST=\${${#}}
1229
1230    # test if the (first) file is present in the old computation :
1231    IGCM_sys_TestFileArchive ${dm_liste[0]}
1232    status=$?
1233    if [ ${status} -gt 0 ] ; then
1234      echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ."
1235      IGCM_debug_Exit "IGCM_sys_Get"
1236      return
1237    fi
1238
1239    #USUAL WAY
1240    \cp ${dm_liste[*]} ${DEST} > out_rsync 2>&1
1241    status=$?
1242
1243    if [ ${status} -gt 0 ] ; then
1244      IGCM_debug_Print 2 "IGCM_sys_Get : cp failed error code ${status}"
1245      cat out_rsync
1246      IGCM_debug_Exit "IGCM_sys_Get"
1247    else
1248      \rm out_rsync
1249    fi
1250  fi
1251  IGCM_debug_PopStack "IGCM_sys_Get"
1252}
1253
1254#D-#==================================================
1255#D-function IGCM_sys_GetBuffer
1256#D-* Purpose: Get a file from ${SCRATCHDIR}
1257#D-* Examples: IGCM_sys_GetBuffer myfile /destpath/myfile_with_PREFIX
1258#D-            IGCM_sys_GetBuffer /l Array_contain_myfiles /destpath/
1259function IGCM_sys_GetBuffer {
1260  IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@
1261
1262  typeset DEST buf_liste target file_work
1263  typeset NB_ESSAI DELAI status i
1264
1265  if ( $DEBUG_sys ) ; then
1266    echo "IGCM_sys_GetBuffer :" $@
1267  fi
1268
1269  # number of tentative
1270  NB_ESSAI=3
1271  # time delay between tentative
1272  DELAI=2
1273
1274  if [ $DRYRUN -le 2 ]; then
1275    if [ X${1} = X'/l' ] ; then
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" | gawk ' {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.