source: trunk/libIGCM/libIGCM_sys/libIGCM_sys.ksh @ 1573

Last change on this file since 1573 was 1569, checked in by aclsce, 18 months ago

Added fonctionality to create RUN_DIR and Job_debug to be launched directly in the RUN_DIR directory.

  • 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: 50.4 KB
Line 
1#!/bin/ksh
2
3#**************************************************************
4# Author: 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# bypass specific internationalization (for gawk)
14export LC_ALL="C"
15
16# By default, all libIGCM_sys save functions will protect output datas (RUN execution mode)
17# other values : DEB(ug), DEV(elopment).
18JobType=${JobType:=RUN}
19
20#====================================================
21# set PackDefault false by default
22PackDefault=false
23
24#====================================================
25# set BigBrother false by default
26BigBrother=${BigBrother:=false}
27
28#====================================================
29# set BigBrother channel (AMQP or MAIL)
30# only MAIL working at present due to firewall constraint
31BigBrotherChannel=MAIL
32
33# no need to be so verbose in checking mode
34if [ ! X${TaskType} = Xchecking ] ; then
35  echo
36  echo "===================================================="
37  echo "Where do we run ?" $( hostname )
38  uname -a
39  echo "===================================================="
40  echo
41fi
42
43if [ X${JobType} = XDEB ] ; then
44    echo "DEBUG mode : activation of 'set -vx' mode."
45    set -vx
46    DEBUG_debug=true
47    DEBUG_sys=true
48fi
49
50#====================================================
51
52case $( hostname -s ) in
53    ada*)
54        [ ! X${TaskType} = Xchecking ] && echo "Source machine dependent settings for ada Intel X-64."
55        CENTER=IDRIS
56        SYSTEM=ada
57        . ${libIGCM}/libIGCM_sys/libIGCM_sys_ada.ksh;;
58    curie*)
59        [ ! X${TaskType} = Xchecking ] && echo "Source machine dependent settings for curie Intel X-64."
60        CENTER=TGCC
61        SYSTEM=curie
62        . ${libIGCM}/libIGCM_sys/libIGCM_sys_curie.ksh;;
63    irene*)
64        if [ "${SLURM_JOB_PARTITION}" = "rome" ] || [ "$( hostname -s)" = "irene172" ] || [ "$( hostname -s)" = "irene173" ] || [ "$( hostname -s)" = "irene194" ] || [ "$( hostname -s)" = "irene195" ] ; then
65         [ ! X${TaskType} = Xchecking ] && echo "Source machine dependent settings for irene_amd Intel X-64 at TGCC"
66         CENTER=TGCC
67         SYSTEM=irene-amd
68         . ${libIGCM}/libIGCM_sys/libIGCM_sys_irene-amd.ksh
69        else
70         [ ! X${TaskType} = Xchecking ] && echo "Source machine dependent settings for irene Intel X-64 at TGCC"
71         CENTER=TGCC
72         SYSTEM=irene
73         . ${libIGCM}/libIGCM_sys/libIGCM_sys_irene.ksh
74        fi;;
75    airain*)
76        [ ! X${TaskType} = Xchecking ] && echo "Source machine dependent settings for airain Intel X-64."
77        CENTER=TGCC
78        SYSTEM=curie
79        . ${libIGCM}/libIGCM_sys/libIGCM_sys_curie.ksh;;
80    asterix*|obelix*)
81        [ ! X${TaskType} = Xchecking ] && echo "Source machine dependent settings for obelix or asterix."
82        CENTER=LSCE
83        SYSTEM=obelix
84        . ${libIGCM}/libIGCM_sys/libIGCM_sys_obelix.ksh;;
85    spiritx*)
86            [ ! X${TaskType} = Xchecking ] && echo "Source machine dependent settings for spiritx at MESO ESPRI IPSL cluster."
87        CENTER=spiritx
88        SYSTEM=mesoipsl
89        . ${libIGCM}/libIGCM_sys/libIGCM_sys_mesoipsl.ksh;;
90    spirit*)
91            [ ! X${TaskType} = Xchecking ] && echo "Source machine dependent settings for spirit at MESO ESPRI IPSL cluster."
92        CENTER=spirit
93        SYSTEM=mesoipsl
94        . ${libIGCM}/libIGCM_sys/libIGCM_sys_mesoipsl.ksh;;
95    ciclad*)
96        [ ! X${TaskType} = Xchecking ] && echo "Source machine dependent settings for ciclad for running at ciclad."
97        CENTER=IPSL-ciclad
98        SYSTEM=ifort_CICLAD
99        . ${libIGCM}/libIGCM_sys/libIGCM_sys_ciclad.ksh;;
100    camelot*|loholt1*|loholt2*|merlin*)
101        [ ! X${TaskType} = Xchecking ] && echo "Source machine dependent settings for ciclad for running at climserv."
102        CENTER=IPSL-climserv
103        SYSTEM=ifort_CICLAD
104        . ${libIGCM}/libIGCM_sys/libIGCM_sys_ciclad.ksh;;
105    iitm*)
106        [ ! X${TaskType} = Xchecking ] && echo "Source machine dependent settings for iitm."
107        CENTER=IITM
108        SYSTEM=iitm
109        . ${libIGCM}/libIGCM_sys/libIGCM_sys_iitm.ksh;;
110    *)
111        if [ "${SLURM_CLUSTER_NAME}" = "jean-zay" ] || [ "$( hostname -s |  cut -c "1-8"  )" = "jean-zay" ] ; then
112          [ ! X${TaskType} = Xchecking ] && echo "Source machine dependent settings for Jean-Zay Intel X-64."
113          CENTER=IDRIS
114          SYSTEM=jeanzay
115          . ${libIGCM}/libIGCM_sys/libIGCM_sys_jeanzay.ksh
116        else
117          [ ! X${TaskType} = Xchecking ] && echo "Source machine dependent settings for a default machine."
118          CENTER=DEFAULT
119          SYSTEM=default
120          . ${libIGCM}/libIGCM_sys/libIGCM_sys_default.ksh
121        fi;;
122esac
123# Set default umask (umask is 0027 on some machines : CCRT machine at least)
124umask 0022
125
126#D--------------------------------------------------------------------==
127#D-
128#D-    Define IGCM_sys functions that are common on every systems
129#D-
130#D--------------------------------------------------------------------==
131
132#D-#==================================================
133#D-function IGCM_sys_RshMaster
134#D-* Purpose: Connection to frontend machine.
135#D-* Examples:
136#D-
137function IGCM_sys_RshMaster {
138  IGCM_debug_PushStack "IGCM_sys_RshMaster" $@
139  OUTCOMMAND_PATH=${OUTCOMMAND_PATH} /bin/ksh <<-EOF
140    export libIGCM=${libIGCM}
141    export DEBUG_debug=${DEBUG_debug}
142    . ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh
143    . ${libIGCM}/libIGCM_card/libIGCM_card.ksh
144    ${@}
145EOF
146  if [ $? -gt 0 ] ; then
147    echo "IGCM_sys_RshMaster : erreur."
148    IGCM_debug_Exit "IGCM_sys_RshMaster"
149  fi
150  IGCM_debug_PopStack "IGCM_sys_RshMaster"
151}
152
153#D-#==================================================
154#D-function IGCM_sys_RshPost
155#D-* Purpose: Post-process rsh command
156#D-* Examples:
157#D-
158function IGCM_sys_RshPost {
159  IGCM_debug_PushStack "IGCM_sys_RshPost" $@
160  if ( $DEBUG_sys ) ; then
161    echo "IGCM_sys_RshPost :" $@
162  fi
163  # keep standard input (stdin) for the loop onto temporary file
164  cat >${OUTCOMMAND_PATH}/tmp_IGCM_sys_RshPost_$$_${LOGNAME}
165
166  OUTCOMMAND_PATH=${OUTCOMMAND_PATH} /bin/ksh <${OUTCOMMAND_PATH}/tmp_IGCM_sys_RshPost_$$_${LOGNAME}
167  if [ $? -gt 0 ] ; then
168    echo "IGCM_sys_RshPost : erreur."
169    IGCM_debug_Exit "IGCM_sys_RshPost"
170  fi
171  # delete temporary file
172  \rm ${OUTCOMMAND_PATH}/tmp_IGCM_sys_RshPost_$$_${LOGNAME}
173
174# ============ FRONTEND  END  ============ #
175
176# ============ CESIUM START ============ #
177#  typeset NB_ESSAI DELAI status i
178#  if [ "X$( grep rebuild_from tmp_IGCM_sys_RshPost_$$ )" != "X" ] ; then
179#    #little hack so that rebuild submission is done on titane not an cesium
180#
181#    libIGCM_POST_sed=$( echo $libIGCM_POST | sed 's/\//\\\//g' )
182#    POST_DIR_sed=$( echo ${POST_DIR} | sed 's/\//\\\//g' )
183#    sed "s/IGCM_sys_QsubPost/IGCM_sys_Qsub/g" tmp_IGCM_sys_RshPost_$$ > tmp.txt
184#    sed "s/ rebuild_fromWorkdir/ ${libIGCM_POST_sed}\/rebuild_fromWorkdir.job/g" tmp.txt > tmp_IGCM_sys_RshPost_$$
185#    sed "s/ rebuild_fromArchive/ ${libIGCM_POST_sed}\/rebuild_fromArchive.job/g" tmp_IGCM_sys_RshPost_$$ > tmp.txt
186#    sed "s/Script_Post_Output=/Script_Output=${POST_DIR_sed}\//g" tmp.txt > tmp_IGCM_sys_RshPost_$$
187#    \mv tmp.txt tmp_IGCM_sys_RshPost_$$
188#
189#    echo cat tmp_IGCM_sys_RshPost_$$ AFTER
190#    cat tmp_IGCM_sys_RshPost_$$
191#
192#    /bin/ksh <tmp_IGCM_sys_RshPost_$$
193#    if [ $? -gt 0 ] ; then
194#      echo "IGCM_sys_RshPost : erreur."
195#      IGCM_debug_Exit "IGCM_sys_RshPost"
196#    fi
197#    # delete temporary file
198#    \rm tmp_IGCM_sys_RshPost_$$
199#
200#  else
201#    # number of tentative
202#    NB_ESSAI=10
203#    # time delay between tentative
204#    DELAI=10
205#    i=0
206#    while [ $i -ne $NB_ESSAI ] ; do
207#      ssh -t titane996 ssh cesium /bin/ksh <tmp_IGCM_sys_RshPost_$$
208#      status=$?
209#      if [ ${status} -ne 0 ];
210#      then
211#        sleep $DELAI
212#      else
213#        break
214#      fi
215#      let i=$i+1
216#    done
217#    # delete temporary file
218#    \rm tmp_IGCM_sys_RshPost_$$
219#
220#    if [ ${status} -gt 0 ] ; then
221#      echo "IGCM_sys_RshPost : erreur."
222#      IGCM_debug_Exit "IGCM_sys_RshPost"
223#    fi
224#  fi
225
226# ============ CESIUM  END  ============ #
227
228  IGCM_debug_PopStack "IGCM_sys_RshPost"
229}
230
231#D-#==================================================
232#D-function IGCM_sys_SendMail
233#D-* Purpose: Send mail when simulation is over
234#D-* Examples:
235#D-
236function IGCM_sys_SendMail {
237  IGCM_debug_PushStack "IGCM_sys_SendMail" $@
238  if ( $DEBUG_sys ) ; then
239    echo "IGCM_sys_SendMail :" $@
240  fi
241
242  if [ X${1} = XAccounting ] ; then
243    status=Accounting
244    mailText=jobAccounting.mail
245  elif ( ${ExitFlag} ) ; then
246    status=failed
247    mailText=jobEnd.mail
248  else
249    status=completed
250    mailText=jobEnd.mail
251  fi
252
253  # Update selected mail template
254  while read -r line; do
255    eval echo $line >> mail.txt ;
256  done < ${libIGCM}/libIGCM_sys/${mailText}
257
258  if [ ! -z ${config_UserChoices_MailName} ] ; then
259    mail -s "${config_UserChoices_JobName} ${status}" ${config_UserChoices_MailName} < mail.txt
260  elif [ -f ~/.forward ] ; then
261    mail -s "${config_UserChoices_JobName} ${status}" $( cat ~/.forward ) < mail.txt
262  else
263    mail -s "${config_UserChoices_JobName} ${status}" ${USER} < mail.txt
264  fi
265
266  sleep 10
267  rm -f mail.txt
268
269  IGCM_debug_PopStack "IGCM_sys_SendMail"
270}
271
272#D-#==================================================
273#D-function IGCM_sys_Mkdir
274#D-* Purpose: Master locale mkdir command
275#D-* Examples:
276#D-
277function IGCM_sys_Mkdir {
278  IGCM_debug_PushStack "IGCM_sys_Mkdir" $@
279  if ( $DEBUG_sys ) ; then
280    echo "IGCM_sys_Mkdir :" $@
281  fi
282  if [ ! -d ${1} ]; then
283    \mkdir -p $1
284    if [ $? -gt 0 ] ; then
285      echo "IGCM_sys_Mkdir : erreur."
286      IGCM_debug_Exit "IGCM_sys_Mkdir"
287    fi
288  fi
289  # vérification :
290  if [ ! -d ${1} ] ; then
291    echo "IGCM_sys_Mkdir : erreur."
292    IGCM_debug_Exit "IGCM_sys_Mkdir"
293  fi
294  IGCM_debug_PopStack "IGCM_sys_Mkdir"
295}
296
297#D-#==================================================
298#D-function IGCM_sys_MkdirWork
299#D-* Purpose: Mkdir on Work
300#D-* Examples:
301#D-
302function IGCM_sys_MkdirWork {
303  IGCM_debug_PushStack "IGCM_sys_MkdirWork" $@
304  if ( $DEBUG_sys ) ; then
305    echo "IGCM_sys_MkdirWork :" $@
306  fi
307  #- creation de repertoire sur le serveur fichier
308  if [ ! -d ${1} ]; then
309    \mkdir -p $1
310    if [ $? -gt 0 ] ; then
311      echo "IGCM_sys_MkdirWork : erreur."
312      IGCM_debug_Exit "IGCM_sys_MkdirWork"
313    fi
314  fi
315  IGCM_debug_PopStack "IGCM_sys_MkdirWork"
316}
317
318#D-#==================================================
319#D-function IGCM_sys_Cd
320#D-* Purpose: master cd command
321#D-* Examples:
322#D-
323function IGCM_sys_Cd {
324  IGCM_debug_PushStack "IGCM_sys_Cd" $@
325  if ( $DEBUG_sys ) ; then
326    echo "IGCM_sys_Cd :" $@
327  fi
328  \cd $1
329  if [ $? -gt 0 ] ; then
330    echo "IGCM_sys_Cd : erreur."
331    IGCM_debug_Exit "IGCM_sys_Cd"
332  fi
333  IGCM_debug_PopStack "IGCM_sys_Cd"
334}
335
336#D-#==================================================
337#D-function IGCM_sys_Chmod
338#D-* Purpose: Chmod
339#D-* Examples:
340#D-
341function IGCM_sys_Chmod {
342  IGCM_debug_PushStack "IGCM_sys_Chmod" $@
343  if ( $DEBUG_sys ) ; then
344    echo "IGCM_sys_Chmod :" $@
345  fi
346  \chmod $@
347  if [ $? -gt 0 ] ; then
348    echo "IGCM_sys_Chmod : erreur."
349    IGCM_debug_Exit "IGCM_sys_Chmod"
350  fi
351  IGCM_debug_PopStack "IGCM_sys_Chmod"
352}
353
354#D-#==================================================
355#D-function IGCM_sys_FileSize
356#D-* Purpose: Filesize
357#D-* Examples:
358#D-
359function IGCM_sys_FileSize {
360  IGCM_debug_PushStack "IGCM_sys_FileSize" $@
361
362  typeset sizeF
363  set +A sizeF -- $( ls -la ${1} )
364  if [ $? -gt 0 ] ; then
365    IGCM_debug_Exit "IGCM_sys_FileSize"
366  fi
367  eval ${2}=${sizeF[4]}
368
369  IGCM_debug_PopStack "IGCM_sys_FileSize"
370}
371
372#D-#==================================================
373#D-function IGCM_sys_TestDir
374#D-* Purpose: Test Directory that must exists
375#D-* Examples:
376#D-
377function IGCM_sys_TestDir {
378  IGCM_debug_PushStack "IGCM_sys_TestDir" $@
379  if ( $DEBUG_sys ) ; then
380    echo "IGCM_sys_TestDir :" $@
381  fi
382  typeset ExistFlag
383  ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
384  IGCM_debug_PopStack "IGCM_sys_TestDir"
385
386  return ${ExistFlag}
387}
388
389#D-#==================================================
390#D-function IGCM_sys_TestFileBuffer
391#D-* Purpose: Test file that must NOT EXISTS on Buffer
392#D-* Examples:
393#D-
394function IGCM_sys_TestFileBuffer {
395  IGCM_debug_PushStack "IGCM_sys_TestFileBuffer" $@
396  typeset ExistFlag
397  ExistFlag=$( [ -f $1 ] && echo 0 || echo 1 )
398  IGCM_debug_PopStack "IGCM_sys_TestFileBuffer"
399
400  return ${ExistFlag}
401}
402
403#D-#==================================================
404#D-function IGCM_sys_CountFileBuffer
405#D-* Purpose: Count files on Scratch filesystem
406#D-* Examples:
407#D-
408function IGCM_sys_CountFileBuffer {
409  IGCM_debug_PushStack "IGCM_sys_CountFileBuffer" $@
410  ls ${@} 2>/dev/null | wc -l
411  if [ $? -gt 0 ] ; then
412    echo "IGCM_sys_CountFileBuffer : erreur."
413  fi
414  IGCM_debug_PopStack "IGCM_sys_CountFileBuffer"
415}
416
417#D-#==================================================
418#D-function IGCM_sys_Tar
419#D-* Purpose: master tar command
420#D-* Examples:
421#D-
422function IGCM_sys_Tar {
423  IGCM_debug_PushStack "IGCM_sys_Tar" $@
424  if ( $DEBUG_sys ) ; then
425    echo "IGCM_sys_Tar :" $@
426  fi
427  \tar cf $@
428  if [ $? -gt 0 ] ; then
429    echo "IGCM_sys_Tar : erreur."
430    IGCM_debug_Exit "IGCM_sys_Tar"
431  fi
432  IGCM_debug_PopStack "IGCM_sys_Tar"
433}
434
435#D-#==================================================
436#D-function IGCM_sys_UnTar
437#D-* Purpose: master un-tar command
438#D-* Examples:
439#D-
440function IGCM_sys_UnTar {
441  IGCM_debug_PushStack "IGCM_sys_UnTar" $@
442  if ( $DEBUG_sys ) ; then
443    echo "IGCM_sys_UnTar :" $@
444  fi
445  \tar xvf $1
446  if [ $? -gt 0 ] ; then
447    echo "IGCM_sys_UnTar : erreur."
448    IGCM_debug_Exit "IGCM_sys_UnTar"
449  fi
450  IGCM_debug_PopStack "IGCM_sys_UnTar"
451}
452
453#D-*************************
454#D- File transfer functions
455#D-*************************
456#D-
457
458#D-#==================================================
459#D-function IGCM_sys_Rsync_out
460#D-* Purpose: treat return val of rsync
461#D-* Examples: IGCM_sys_Rsync_out out_RET_rsync
462#D-  Error values and explanations can depend on your system version.
463function IGCM_sys_Rsync_out {
464  IGCM_debug_PushStack "IGCM_sys_Rsync_out" $@
465  if ( $DEBUG_sys ) ; then
466    echo "IGCM_sys_UnTar :" $@
467  fi
468
469  typeset status
470  status=$1
471
472  if [ ! $status ] ; then
473    IGCM_debug_Print 1 "IGCM_sys_Rsync_out need an argument"
474    IGCM_debug_PopStack "IGCM_sys_Rsync_out"
475    return
476  fi
477
478  case $status in
479  0)  ;;
480  1)  IGCM_debug_Print 1 "rsync error RERR_SYNTAX : Syntax or usage error";;
481  2)  IGCM_debug_Print 1 "rsync error RERR_PROTOCOL : Protocol incompatibility";;
482  3)  IGCM_debug_Print 1 "rsync error RERR_FILESELECT : Errors selecting input/output files, dirs";;
483  4)  IGCM_debug_Print 1 "rsync error RERR_UNSUPPORTED : Requested action not supported."
484      IGCM_debug_Print 1 "An attempt was made to manipulate 64-bit files on a platform that cannot support them"
485      IGCM_debug_Print 1 "Or an option was specified that is supported by the client and not by the server.";;
486  5)  IGCM_debug_Print 1 "rsync error  : Error starting client-server protocol";;
487  10) IGCM_debug_Print 1 "rsync error RERR_SOCKETIO : Error in socket I/O";;
488  11) IGCM_debug_Print 1 "rsync error RERR_FILEIO: Error in file I/O";;
489  12) IGCM_debug_Print 1 "rsync error RERR_STREAMIO : Error in rsync protocol data stream";;
490  13) IGCM_debug_Print 1 "rsync error RERR_MESSAGEIO : Errors with program diagnostics";;
491  14) IGCM_debug_Print 1 "rsync error RERR_IPC : Error in IPC code";;
492  20) IGCM_debug_Print 1 "rsync error RERR_SIGNAL : Received SIGUSR1 or SIGINT";;
493  21) IGCM_debug_Print 1 "rsync error RERR_WAITCHILD : Some error returned by waitpid()";;
494  22) IGCM_debug_Print 1 "rsync error RERR_MALLOC : Error allocating core memory buffers";;
495  23) IGCM_debug_Print 1 "rsync error : Partial transfer due to error";;
496  24) IGCM_debug_Print 1 "rsync error : Partial transfer due to vanished source files";;
497  30) IGCM_debug_Print 1 "rsync error : Timeout in data send/receive";;
498  *)  IGCM_debug_Print 1 "rsync error : return code of rsync unknown :" $status;;
499  esac
500
501  IGCM_debug_PopStack "IGCM_sys_Rsync_out"
502}
503
504#D-#==================================================
505#D-function IGCM_sys_Miror_libIGCM
506#D-* Purpose: Mirror libIGCM PATH and lib to frontend
507#D-* Examples:
508#D-
509function IGCM_sys_Mirror_libIGCM {
510  IGCM_debug_PushStack "IGCM_sys_Mirror_libIGCM"
511  if ( $DEBUG_sys ) ; then
512    echo "IGCM_sys_Mirror_libIGCM"
513  fi
514
515  typeset status
516
517  mkdir -p ${HOME}/MIRROR/${PATHlibIGCM}
518
519  echo ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
520  ${RSYNC} ${RSYNC_opt} ${libIGCM} ${HOME}/MIRROR/${PATHlibIGCM} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
521  status=$?
522
523  if [ ${status} -gt 0 ] ; then
524    echo "IGCM_sys_Mirror_libIGCM Warning : no libIGCM on frontend."
525    cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
526  fi
527  IGCM_debug_PopStack "IGCM_sys_Mirror_libIGCM"
528}
529
530#D-#==================================================
531#D-function IGCM_sys_Cp
532#D-* Purpose: generic cp
533#D-* Examples:
534#D-
535function IGCM_sys_Cp {
536  IGCM_debug_PushStack "IGCM_sys_Cp" $@
537  if ( $DEBUG_sys ) ; then
538    echo "IGCM_sys_Cp :" $@
539  fi
540
541  typeset status
542
543  echo cp $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
544  \cp $@ >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
545  status=$?
546
547  if [ ${status} -gt 0 ] ; then
548    echo "IGCM_sys_Cp : error code ${status}"
549    cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
550    IGCM_debug_Exit "IGCM_sys_Cp"
551  else
552    \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
553  fi
554  IGCM_debug_PopStack "IGCM_sys_Cp"
555}
556
557#D-#==================================================
558#D-function IGCM_sys_Rm
559#D-* Purpose: generic rm
560#D-* Examples:
561#D-
562function IGCM_sys_Rm {
563  IGCM_debug_PushStack "IGCM_sys_Rm" $@
564  if ( $DEBUG_sys ) ; then
565    echo "IGCM_sys_Rm :" $@
566  fi
567
568  typeset status
569
570  echo rm $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
571  \rm $@ >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
572  status=$?
573
574  if [ ${status} -gt 0 ] ; then
575    echo "IGCM_sys_Rm : error code ${status}"
576    cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
577    IGCM_debug_Exit "IGCM_sys_Rm"
578  else
579    \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
580  fi
581  IGCM_debug_PopStack "IGCM_sys_Rm"
582}
583
584#D-#==================================================
585#D-function IGCM_sys_Mv
586#D-* Purpose: generic move
587#D-* Examples:
588#D-
589function IGCM_sys_Mv {
590  IGCM_debug_PushStack "IGCM_sys_Mv" $@
591  if ( $DEBUG_sys ) ; then
592    echo "IGCM_sys_Mv :" $@
593  fi
594
595  if [ $DRYRUN = 0 ]; then
596
597    typeset status
598
599    echo mv $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
600    \mv $@ >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
601    status=$?
602
603    if [ ${status} -gt 0 ] ; then
604      echo "IGCM_sys_Mv : error code ${status}"
605      cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
606      IGCM_debug_Exit "IGCM_sys_Mv"
607    else
608      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
609    fi
610  fi
611  IGCM_debug_PopStack "IGCM_sys_Mv"
612}
613
614#D-#==================================================
615#D-function IGCM_sys_Get_Master
616#D-* Purpose: Copy a complete directory from MASTER filesystem
617#D-* Examples:
618#D-
619function IGCM_sys_Get_Master {
620  IGCM_debug_PushStack "IGCM_sys_Get_Master" $@
621  if ( $DEBUG_sys ) ; then
622    echo "IGCM_sys_Get_Master :" $@
623  fi
624  if [ $DRYRUN = 0 ]; then
625    if ( [ ! -d ${1} ] && [ ! -f ${1} ] ) ; then
626      echo "WARNING : IGCM_sys_Get_Master ${1} DOES NOT EXIST ."
627      IGCM_debug_PopStack "IGCM_sys_Get_Master"
628      return
629    fi
630
631    typeset NB_ESSAI DELAI status i
632    # number of tentative
633    NB_ESSAI=3
634    # time delay between tentative
635    DELAI=2
636
637    i=0
638    while [ $i -lt $NB_ESSAI ] ; do
639      \cp -urL $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
640      status=$?
641      if [ ${status} -gt 0 ]; then
642        IGCM_debug_Print 2 "IGCM_sys_Get_Master : cp failed error code ${status} ${i}/${NB_ESSAI}"
643        IGCM_debug_Print 2 "IGCM_sys_Get_Master : sleep ${DELAI} seconds and try again."
644        sleep $DELAI
645      else
646        break
647      fi
648      (( i = i + 1 ))
649    done
650
651    if [ ${status} -gt 0 ] ; then
652      echo "IGCM_sys_Get_Master : error."
653      cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
654      IGCM_debug_Exit "IGCM_sys_Get_Master"
655    else
656      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
657    fi
658  fi
659  IGCM_debug_PopStack "IGCM_sys_Get_Master"
660}
661
662#====================================================
663#- Call IGCM_sys_Mirror_libIGCM now !
664if ( $MirrorlibIGCM ) ; then
665  IGCM_sys_Mirror_libIGCM
666fi
667
668#D-#==================================================
669#D-function IGCM_sys_PutBuffer_Rest
670#D-* Purpose: Put computied restarts on ${SCRATCHDIR}.
671#D-           File and target directory must exist.
672#D-* Examples:
673#D-
674function IGCM_sys_PutBuffer_Rest {
675  IGCM_debug_PushStack "IGCM_sys_PutBuffer_Rest" $@
676  if ( $DEBUG_sys ) ; then
677    echo "IGCM_sys_PutBuffer_Rest :" $@
678  fi
679  if [ $DRYRUN = 0 ]; then
680    if [ ! -f ${1} ] ; then
681      echo "ERROR : IGCM_sys_PutBuffer_Rest ${1} DOES NOT EXIST ."
682      IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest"
683    fi
684
685    typeset status
686    #
687    # USUAL WAY
688    \cp $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
689    status=$?
690
691    if [ ${status} -gt 0 ] ; then
692      echo "IGCM_sys_PutBuffer_Rest : error code ${status}"
693      [ -f ${2} ] && ls -l ${2}
694      [ -f ${2}/${1} ] && ls -l ${2}/${1}
695      cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
696      IGCM_debug_Exit "IGCM_sys_PutBuffer_Rest"
697    else
698
699      if [ X${JobType} = XRUN ] ; then
700        [ -f ${2} ] && IGCM_sys_Chmod 444 ${2}
701        [ -f ${2}/${1} ] && IGCM_sys_Chmod 444 ${2}/${1}
702      fi
703
704      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
705    fi
706  fi
707  IGCM_debug_PopStack "IGCM_sys_PutBuffer_Rest"
708}
709
710#D-#==================================================
711#D-function IGCM_sys_PrepareTaredRestart
712#D-* Purpose: Prepare tared restart to be access by computing job.
713#D-* Examples:
714#D-
715function IGCM_sys_PrepareTaredRestart {
716  IGCM_debug_PushStack "IGCM_sys_PrepareTaredRestart" $@
717  if [ $DRYRUN = 0 ]; then
718    [ ! -f $( basename $1 ) ] && IGCM_sys_Get $1 .
719  fi
720  IGCM_debug_PopStack "IGCM_sys_PrepareTaredRestart"
721}
722
723#D-#==================================================
724#D-function IGCM_sys_PutBuffer_Out
725#D-* Purpose: Copy a file on the buffer filesystem after having chmod it in readonly
726#D-* Examples:
727#D-
728function IGCM_sys_PutBuffer_Out {
729  IGCM_debug_PushStack "IGCM_sys_PutBuffer_Out" $@
730  if ( $DEBUG_sys ) ; then
731    echo "IGCM_sys_PutBuffer_Out :" $@
732  fi
733
734  typeset NB_ESSAI DELAI status i exist skip
735  typeset fileDeviceNumberInHex directoryDeviceNumberInHex
736
737  # number of tentative
738  NB_ESSAI=3
739  # time delay between tentative
740  DELAI=2
741
742  if [ $DRYRUN = 0 ]; then
743    if [ ! -f ${1} ] ; then
744      echo "WARNING : IGCM_sys_PutBuffer_Out ${1} DOES NOT EXIST ."
745      IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out"
746      return 1
747    fi
748    #
749    IGCM_sys_Mkdir $( dirname $2 )
750    #
751
752    exist=false
753    skip=false
754    if [ -f $2 ] ; then
755      IGCM_debug_Print 1 "$2 already exist"
756      exist=true
757      if [ "X$( diff $1 $2 )" = X ] ; then
758        IGCM_debug_Print 2 "$1 and $2 are the same file, we skip the copy"
759        status=0
760        skip=true
761      else
762        IGCM_debug_Print 2 "$1 and $2 are not the same file, we force the copy"
763        skip=false
764      fi
765    fi
766    #
767    if ( [ X${exist} = Xtrue ] && [ X${skip} = Xfalse ] ) ; then
768      IGCM_sys_Chmod u+w $2
769    fi
770
771    if [ X${skip} = Xfalse ] ; then
772      i=0
773      while [ $i -lt $NB_ESSAI ] ; do
774        # Identify file system
775        fileDeviceNumberInHex=$( stat -c %d $1 )
776        status=$?
777        if [ ${status} -gt 0 ] ; then
778          IGCM_debug_Exit "IGCM_sys_PutBuffer_Out"
779        fi
780        # Identify file system
781        directoryDeviceNumberInHex=$( stat -c %d $( dirname $2 ) )
782        status=$?
783        if [ ${status} -gt 0 ] ; then
784          IGCM_debug_Exit "IGCM_sys_PutBuffer_Out"
785        fi
786
787        if [ ${fileDeviceNumberInHex} -ne ${directoryDeviceNumberInHex} ] ; then
788          # They are not on the same device. USUAL WAY
789          \cp $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
790          status=$?
791        else
792          # They are on the same device. USUAL WAY
793          \mv $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
794          status=$?
795        fi
796        if [ ${status} -gt 0 ]; then
797          IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : cp failed error code ${status} ${i}/${NB_ESSAI}"
798          IGCM_debug_Print 2 "IGCM_sys_PutBuffer_Out : sleep ${DELAI} seconds and try again."
799          [ -f ${2} ] && ls -l ${2}
800          [ -f ${2}/${1} ] && ls -l ${2}/${1}
801          sleep $DELAI
802        else
803          break
804        fi
805        (( i = i + 1 ))
806      done
807    fi
808
809    if [ ${status} -gt 0 ] ; then
810      echo "IGCM_sys_PutBuffer_Out : error."
811      [ -f ${2} ] && ls -l ${2}
812      [ -f ${2}/${1} ] && ls -l ${2}/${1}
813      cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
814      IGCM_debug_Exit "IGCM_sys_PutBuffer_Out"
815    else
816
817      if [ X${JobType} = XRUN ] ; then
818        if [ X${3} = X ] ; then
819          [ -f ${2} ] && IGCM_sys_Chmod 444 ${2}
820          [ -f ${2}/${1} ] && IGCM_sys_Chmod 444 ${2}/${1}
821        fi
822      fi
823
824      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
825    fi
826  fi
827  IGCM_debug_PopStack "IGCM_sys_PutBuffer_Out"
828  return 0
829}
830
831#D-#==================================================
832#D-function IGCM_sys_GetBuffer
833#D-* Purpose: Get a file from ${SCRATCHDIR}
834#D-* Examples: IGCM_sys_GetBuffer myfile /destpath/myfile_with_PREFIX
835#D-            IGCM_sys_GetBuffer /l Array_contain_myfiles /destpath/
836function IGCM_sys_GetBuffer {
837  IGCM_debug_PushStack "IGCM_sys_GetBuffer" $@
838
839  typeset DEST buf_liste target file_work
840  typeset NB_ESSAI DELAI status i
841
842  if ( $DEBUG_sys ) ; then
843    echo "IGCM_sys_GetBuffer :" $@
844  fi
845
846  # number of tentative
847  NB_ESSAI=3
848  # time delay between tentative
849  DELAI=2
850
851  if [ $DRYRUN -le 2 ]; then
852    if [ X${1} = X'/l' ] ; then
853      eval set +A buf_liste \${${2}}
854    else
855      eval set +A buf_liste ${1}
856    fi
857    eval DEST=\${${#}}
858
859    #USUAL WAY
860    if [ X${1} = X'/l' ] ; then
861      for target in ${buf_liste[*]} ; do
862        local_file=$( basename ${target} )
863        i=0
864        while [ $i -lt $NB_ESSAI ] ; do
865          \cp ${target} ${DEST}/${local_file} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
866          status=$?
867          if [ ${status} -gt 0 ]; then
868            IGCM_debug_Print 2 "IGCM_sys_GetBuffer : cp failed error code ${status} ${i}/${NB_ESSAI}"
869            IGCM_debug_Print 2 "IGCM_sys_GetBuffer : sleep ${DELAI} seconds and try again."
870            sleep $DELAI
871          else
872            break
873          fi
874          (( i = i + 1 ))
875        done
876        if [ ${status} -gt 0 ] ; then
877          echo "IGCM_sys_Get : error"
878          cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
879          \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
880          IGCM_debug_Exit "IGCM_sys_GetBuffer"
881        else
882          \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
883        fi
884      done
885    else
886      i=0
887      while [ $i -lt $NB_ESSAI ] ; do
888        \cp ${buf_liste} ${DEST} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
889        status=$?
890        if [ ${status} -gt 0 ]; then
891          IGCM_debug_Print 2 "IGCM_sys_GetBuffer : cp failed error code ${status} ${i}/${NB_ESSAI}"
892          IGCM_debug_Print 2 "IGCM_sys_GetBuffer : sleep ${DELAI} seconds and try again."
893          sleep $DELAI
894        else
895          break
896        fi
897        (( i = i + 1 ))
898      done
899      if [ ${status} -gt 0 ] ; then
900        echo "IGCM_sys_Get : error"
901        cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
902        \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
903        IGCM_debug_Exit "IGCM_sys_GetBuffer"
904      else
905        \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
906      fi
907    fi
908  fi
909  IGCM_debug_PopStack "IGCM_sys_GetBuffer"
910}
911
912#D-#==================================================
913#D-function IGCM_sys_GetDate_FichWork
914#D-* Purpose: donne la date filesys d'un fichier sur le filesystem WORK
915#D-* Examples:
916#D-
917function IGCM_sys_GetDate_FichWork {
918  IGCM_debug_PushStack "IGCM_sys_GetDate_FichWork" $@
919  if ( $DEBUG_sys ) ; then
920    echo "IGCM_sys_GetDate_FichWork :" $@
921  fi
922
923  if [ $# -ge 3 ] ; then
924    mode=$3
925    TimeStyle=$4
926  else
927    mode="default"
928    TimeStyle="%Y%m%d%H%M%S"
929  fi
930
931  typeset dateF
932  set +A dateF -- $( ls -l --full-time --time-style=+"${TimeStyle}" ${1} )
933
934  case $mode in
935    "default")
936      eval ${2}=${dateF[5]}
937      ;;
938    "SplitFields")
939      eval ${2}="${dateF[5]}\ ${dateF[6]}"
940      ;;
941  esac
942
943  # donne la date filesys d'un fichier sur la machine work
944  IGCM_debug_PopStack "IGCM_sys_GetDate_FichWork"
945}
946
947#D-#==================================================
948#D-function IGCM_sys_rebuild
949#D-* Purpose: rebuild parallel files
950#D-* Examples:
951#D-
952function IGCM_sys_rebuild {
953  IGCM_debug_PushStack "IGCM_sys_rebuild" $@
954  if ( $DEBUG_sys ) ; then
955    echo "IGCM_sys_rebuild :" $@
956  fi
957
958  typeset NB_ESSAI DELAI status i firstArg
959  # number of tentative
960  NB_ESSAI=3
961  # time delay between tentative
962  DELAI=2
963
964  i=0
965  while [ $i -lt $NB_ESSAI ] ; do
966    rebuild -f -o $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
967    status=$?
968    if [ ${status} -gt 0 ] ; then
969      IGCM_debug_Print 2 "IGCM_sys_rebuild : error code ${status}"
970      cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
971      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
972      IGCM_debug_Print 2 "IGCM_sys_rebuild : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
973      firstArg=${1}
974      \rm ${firstArg}
975      sleep $DELAI
976    else
977      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
978      break
979    fi
980    (( i = i + 1 ))
981  done
982
983  if [ ${status} -gt 0 ] ; then
984    echo "IGCM_sys_rebuild : rebuild error code is ${status}"
985    IGCM_debug_Exit "rebuild"
986  fi
987
988  IGCM_debug_PopStack "IGCM_sys_rebuild"
989}
990
991#D-#==================================================
992#D-function IGCM_sys_rebuild_station
993#D-* Purpose: rebuild parallel files describing station
994#D-* Examples:
995#D-
996function IGCM_sys_rebuild_station {
997  IGCM_debug_PushStack "IGCM_sys_rebuild_station" $@
998  typeset i list_opt file_in file_out prefix_invert list_invert
999  if ( $DEBUG_sys ) ; then
1000    echo "IGCM_sys_rebuild_station :" $@
1001  fi
1002
1003  # Station re-ordering is too expansive to be run within libIGCM
1004  # This is due to (ncpdq - nrcat - ncpdq) I/O sequence.
1005  # This re-ordering must be done "in memory" by the cmorization process
1006
1007  # Only LMDZ text output contains the exact ordering of the station.
1008  # We isolate this in the code below:
1009  #  0  38  -157.5000000000000  70.98591549295774
1010  #  0  54  27.49999999999999   67.18309859154928
1011  #  0  56  -62.50000000000001  82.39436619718309
1012  #  0  79  12.49999999999999   78.59154929577466
1013  #  0  116 -165.0000000000000  76.05633802816901
1014  #  0  117 130.0000000000000   70.98591549295774
1015  #  0  118 110.0000000000000   87.46478873239437
1016  #  1  40  4.999999999999995   51.97183098591550
1017
1018  list_opt=$@
1019
1020  # Invert Axis : t,x -> x,t
1021  #               t,pres,x -> x,t,pres
1022  # So that we can concatenate along x
1023  i=0
1024  for file_in in ${list_opt} ; do
1025    (( i = i + 1))
1026    [ ${i} = 1 ] && file_out=${file_in} && continue
1027    # detect time counter and do the job only if present
1028    var_unlim=$(ncdump -h ${file_in} | grep UNLIMITED | cut -d ' ' -f 1 | sed -e 's/^[ \t]*//' -e 's/[ \t]*$//')
1029    if [ X${var_unlim} = Xtime_counter ] ; then
1030      prefix_invert=$( basename ${file_in} .nc )
1031      IGCM_sys_ncpdq -a x,time_counter -a x,time_counter,presnivs ${file_in} ${prefix_invert}_xt.nc
1032      list_invert[${#list_invert[*]}]=${prefix_invert}_xt.nc
1033    fi
1034  done
1035
1036  # Concatenate
1037  IGCM_sys_ncrcat ${list_invert[*]} histstn_xt.nc
1038
1039  # Re-ivert file
1040  IGCM_sys_ncpdq -a time_counter,x -a time_counter,presnivs,x histstn_xt.nc ${file_out}
1041
1042  IGCM_debug_PopStack "IGCM_sys_rebuild_station"
1043}
1044
1045##############################################################
1046# NCO OPERATOR
1047
1048#D-#==================================================
1049#D-function IGCM_sys_ncap2
1050#D-* Purpose: encapsulate ncap2 call so as to manage error code and retry
1051#D-* Examples:
1052#D-
1053function IGCM_sys_ncap2 {
1054  IGCM_debug_PushStack "IGCM_sys_ncap2" $@
1055  if ( $DEBUG_sys ) ; then
1056    echo "IGCM_sys_ncap2 :" $@
1057  fi
1058
1059  typeset NB_ESSAI DELAI status i
1060  # number of tentative
1061  NB_ESSAI=3
1062  # time delay between tentative
1063  DELAI=2
1064
1065  i=0
1066  while [ $i -lt $NB_ESSAI ] ; do
1067    ncap2 -C --buffer_size 838860800 "$@" > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
1068    status=$?
1069    if [ ${status} -gt 0 ] ; then
1070      IGCM_debug_Print 2 "IGCM_sys_ncap2 : error code ${status}"
1071      cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1072      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1073      IGCM_debug_Print 2 "IGCM_sys_ncap2 : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
1074      sleep $DELAI
1075    else
1076      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1077      break
1078    fi
1079    (( i = i + 1 ))
1080  done
1081
1082  if [ ${status} -gt 0 ] ; then
1083    echo "IGCM_sys_ncap2 : ncap2 error"
1084    IGCM_debug_Exit "ncap2"
1085  fi
1086
1087  IGCM_debug_PopStack "IGCM_sys_ncap2"
1088}
1089
1090#D-#==================================================
1091#D-function IGCM_sys_ncatted
1092#D-* Purpose: encapsulate ncatted call so as to manage error code and retry
1093#D-* Examples:
1094#D-
1095function IGCM_sys_ncatted {
1096  IGCM_debug_PushStack "IGCM_sys_ncatted" $@
1097  if ( $DEBUG_sys ) ; then
1098    echo "IGCM_sys_ncatted :" $@
1099  fi
1100
1101  typeset NB_ESSAI DELAI status i
1102  # number of tentative
1103  NB_ESSAI=3
1104  # time delay between tentative
1105  DELAI=2
1106
1107  i=0
1108  while [ $i -lt $NB_ESSAI ] ; do
1109    ncatted "$@" > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
1110    status=$?
1111    if [ ${status} -gt 0 ] ; then
1112      IGCM_debug_Print 2 "IGCM_sys_ncatted : error code ${status}"
1113      cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1114      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1115      IGCM_debug_Print 2 "IGCM_sys_ncatted : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
1116      sleep $DELAI
1117    else
1118      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1119      break
1120    fi
1121    (( i = i + 1 ))
1122  done
1123
1124  if [ ${status} -gt 0 ] ; then
1125    echo "IGCM_sys_ncatted : ncatted error"
1126    IGCM_debug_Exit "ncatted"
1127  fi
1128
1129  IGCM_debug_PopStack "IGCM_sys_ncatted"
1130}
1131
1132#D-#==================================================
1133#D-function IGCM_sys_ncbo
1134#D-* Purpose: encapsulate ncbo call so as to manage error code and retry
1135#D-* Examples:
1136#D-
1137function IGCM_sys_ncbo {
1138  IGCM_debug_PushStack "IGCM_sys_ncbo" $@
1139  if ( $DEBUG_sys ) ; then
1140    echo "IGCM_sys_ncbo :" $@
1141  fi
1142
1143  typeset NB_ESSAI DELAI status i
1144  # number of tentative
1145  NB_ESSAI=3
1146  # time delay between tentative
1147  DELAI=2
1148
1149  i=0
1150  while [ $i -lt $NB_ESSAI ] ; do
1151    ncbo -C --buffer_size 838860800 $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
1152    status=$?
1153    if [ ${status} -gt 0 ] ; then
1154      IGCM_debug_Print 2 "IGCM_sys_ncbo : error code ${status}"
1155      cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1156      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1157      IGCM_debug_Print 2 "IGCM_sys_ncbo : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
1158      sleep $DELAI
1159    else
1160      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1161      break
1162    fi
1163    (( i = i + 1 ))
1164  done
1165
1166  if [ ${status} -gt 0 ] ; then
1167    echo "IGCM_sys_ncbo : ncbo error"
1168    IGCM_debug_Exit "ncbo"
1169  fi
1170
1171  IGCM_debug_PopStack "IGCM_sys_ncbo"
1172}
1173
1174#D-#==================================================
1175#D-function IGCM_sys_ncdif
1176#D-* Purpose: encapsulate ncdiff call so as to manage error code and retry
1177#D-* Examples:
1178#D-
1179function IGCM_sys_ncdiff {
1180  IGCM_debug_PushStack "IGCM_sys_ncdiff" $@
1181  if ( $DEBUG_sys ) ; then
1182    echo "IGCM_sys_ncdiff :" $@
1183  fi
1184
1185  typeset NB_ESSAI DELAI status i
1186  # number of tentative
1187  NB_ESSAI=3
1188  # time delay between tentative
1189  DELAI=2
1190
1191  i=0
1192  while [ $i -lt $NB_ESSAI ] ; do
1193    ncdiff -C --buffer_size 838860800 $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
1194    status=$?
1195    if [ ${status} -gt 0 ] ; then
1196      IGCM_debug_Print 2 "IGCM_sys_ncdiff : error code ${status}"
1197      cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1198      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1199      IGCM_debug_Print 2 "IGCM_sys_ncdiff : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
1200      sleep $DELAI
1201    else
1202      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1203      break
1204    fi
1205    (( i = i + 1 ))
1206  done
1207
1208  if [ ${status} -gt 0 ] ; then
1209    echo "IGCM_sys_ncdiff : ncdiff error"
1210    IGCM_debug_Exit "ncdiff"
1211  fi
1212
1213  IGCM_debug_PopStack "IGCM_sys_ncdiff"
1214}
1215
1216#D-#==================================================
1217#D-function IGCM_sys_ncea
1218#D-* Purpose: encapsulate ncea call so as to manage error code and retry
1219#D-* Examples:
1220#D-
1221function IGCM_sys_ncea {
1222  IGCM_debug_PushStack "IGCM_sys_ncea" $@
1223  if ( $DEBUG_sys ) ; then
1224    echo "IGCM_sys_ncea :" $@
1225  fi
1226
1227  typeset NB_ESSAI DELAI status i
1228  # number of tentative
1229  NB_ESSAI=3
1230  # time delay between tentative
1231  DELAI=2
1232
1233  i=0
1234  while [ $i -lt $NB_ESSAI ] ; do
1235    ncea -C --buffer_size 838860800 $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
1236    status=$?
1237    if [ ${status} -gt 0 ] ; then
1238      IGCM_debug_Print 2 "IGCM_sys_ncea : error code ${status}"
1239      cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1240      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1241      IGCM_debug_Print 2 "IGCM_sys_ncea : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
1242      sleep $DELAI
1243    else
1244      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1245      break
1246    fi
1247    (( i = i + 1 ))
1248  done
1249
1250  if [ ${status} -gt 0 ] ; then
1251    echo "IGCM_sys_ncea : ncea error"
1252    IGCM_debug_Exit "ncea"
1253  fi
1254
1255  IGCM_debug_PopStack "IGCM_sys_ncea"
1256}
1257
1258#D-#==================================================
1259#D-function IGCM_sys_ncecat
1260#D-* Purpose: encapsulate ncecat call so as to manage error code and retry
1261#D-* Examples:
1262#D-
1263function IGCM_sys_ncecat {
1264  IGCM_debug_PushStack "IGCM_sys_ncecat" $@
1265  if ( $DEBUG_sys ) ; then
1266    echo "IGCM_sys_ncecat :" $@
1267  fi
1268
1269  typeset NB_ESSAI DELAI status i
1270  # number of tentative
1271  NB_ESSAI=3
1272  # time delay between tentative
1273  DELAI=2
1274
1275  i=0
1276  while [ $i -lt $NB_ESSAI ] ; do
1277    ncecat -C --buffer_size 838860800 $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
1278    status=$?
1279    if [ ${status} -gt 0 ] ; then
1280      IGCM_debug_Print 2 "IGCM_sys_ncecat : error code ${status}"
1281      cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1282      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1283      IGCM_debug_Print 2 "IGCM_sys_ncecat : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
1284      sleep $DELAI
1285    else
1286      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1287      break
1288    fi
1289    (( i = i + 1 ))
1290  done
1291
1292  if [ ${status} -gt 0 ] ; then
1293    echo "IGCM_sys_ncecat : ncecat error"
1294    IGCM_debug_Exit "ncecat"
1295  fi
1296
1297  IGCM_debug_PopStack "IGCM_sys_ncecat"
1298}
1299
1300#D-#==================================================
1301#D-function IGCM_sys_ncflint
1302#D-* Purpose: encapsulate ncflint call so as to manage error code and retry
1303#D-* Examples:
1304#D-
1305function IGCM_sys_ncflint {
1306  IGCM_debug_PushStack "IGCM_sys_ncflint" $@
1307  if ( $DEBUG_sys ) ; then
1308    echo "IGCM_sys_ncflint :" $@
1309  fi
1310
1311  typeset NB_ESSAI DELAI status i
1312  # number of tentative
1313  NB_ESSAI=3
1314  # time delay between tentative
1315  DELAI=2
1316
1317  i=0
1318  while [ $i -lt $NB_ESSAI ] ; do
1319    ncflint -C --buffer_size 838860800 $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
1320    status=$?
1321    if [ ${status} -gt 0 ] ; then
1322      IGCM_debug_Print 2 "IGCM_sys_ncflint : error code ${status}"
1323      cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1324      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1325      IGCM_debug_Print 2 "IGCM_sys_ncflint : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
1326      sleep $DELAI
1327    else
1328      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1329      break
1330    fi
1331    (( i = i + 1 ))
1332  done
1333
1334  if [ ${status} -gt 0 ] ; then
1335    echo "IGCM_sys_ncflint : ncflint error"
1336    IGCM_debug_Exit "ncflint"
1337  fi
1338
1339  IGCM_debug_PopStack "IGCM_sys_ncflint"
1340}
1341
1342#D-#==================================================
1343#D-function IGCM_sys_ncks
1344#D-* Purpose: encapsulate ncks call so as to manage error code and retry
1345#D-* Examples:
1346#D-
1347function IGCM_sys_ncks {
1348  IGCM_debug_PushStack "IGCM_sys_ncks" $@
1349  if ( $DEBUG_sys ) ; then
1350    echo "IGCM_sys_ncks :" $@
1351  fi
1352
1353  typeset NB_ESSAI DELAI status i
1354  # number of tentative
1355  NB_ESSAI=3
1356  # time delay between tentative
1357  DELAI=2
1358
1359  i=0
1360  while [ $i -lt $NB_ESSAI ] ; do
1361    ncks -C --buffer_size 838860800 $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
1362    status=$?
1363    if [ ${status} -gt 0 ] ; then
1364      IGCM_debug_Print 2 "IGCM_sys_ncks : error code ${status}"
1365      cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1366      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1367      IGCM_debug_Print 2 "IGCM_sys_ncks : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
1368      sleep $DELAI
1369    else
1370      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1371      break
1372    fi
1373    (( i = i + 1 ))
1374  done
1375
1376  if [ ${status} -gt 0 ] ; then
1377    echo "IGCM_sys_ncks : ncks error"
1378    IGCM_debug_Exit "ncks"
1379  fi
1380
1381  IGCM_debug_PopStack "IGCM_sys_ncks"
1382}
1383
1384#D-#==================================================
1385#D-function IGCM_sys_ncpdq
1386#D-* Purpose: encapsulate ncpdq call so as to manage error code and retry
1387#D-* Examples:
1388#D-
1389function IGCM_sys_ncpdq {
1390  IGCM_debug_PushStack "IGCM_sys_ncpdq" $@
1391  if ( $DEBUG_sys ) ; then
1392    echo "IGCM_sys_ncpdq :" $@
1393  fi
1394
1395  typeset NB_ESSAI DELAI status i
1396  # number of tentative
1397  NB_ESSAI=3
1398  # time delay between tentative
1399  DELAI=2
1400
1401  i=0
1402  while [ $i -lt $NB_ESSAI ] ; do
1403    ncpdq -C --buffer_size 838860800 $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
1404    status=$?
1405    if [ ${status} -gt 0 ] ; then
1406      IGCM_debug_Print 2 "IGCM_sys_ncpdq : error code ${status}"
1407      cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1408      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1409      IGCM_debug_Print 2 "IGCM_sys_ncpdq : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
1410      sleep $DELAI
1411    else
1412      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1413      break
1414    fi
1415    (( i = i + 1 ))
1416  done
1417
1418  if [ ${status} -gt 0 ] ; then
1419    echo "IGCM_sys_ncpdq : ncpdq error"
1420    IGCM_debug_Exit "ncpdq"
1421  fi
1422
1423  IGCM_debug_PopStack "IGCM_sys_ncpdq"
1424}
1425
1426#D-#==================================================
1427#D-function IGCM_sys_ncra
1428#D-* Purpose: encapsulate ncra call so as to manage error code and retry
1429#D-* Examples:
1430#D-
1431function IGCM_sys_ncra {
1432  IGCM_debug_PushStack "IGCM_sys_ncra" $@
1433  if ( $DEBUG_sys ) ; then
1434    echo "IGCM_sys_ncra :" $@
1435  fi
1436
1437  typeset NB_ESSAI DELAI status i
1438  # number of tentative
1439  NB_ESSAI=3
1440  # time delay between tentative
1441  DELAI=2
1442
1443  i=0
1444  while [ $i -lt $NB_ESSAI ] ; do
1445    ncra -C --buffer_size 838860800 $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
1446    status=$?
1447    if [ ${status} -gt 0 ] ; then
1448      IGCM_debug_Print 2 "IGCM_sys_ncra : error code ${status}"
1449      cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1450      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1451      IGCM_debug_Print 2 "IGCM_sys_ncra : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
1452      sleep $DELAI
1453    else
1454      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1455      break
1456    fi
1457    (( i = i + 1 ))
1458  done
1459
1460  if [ ${status} -gt 0 ] ; then
1461    echo "IGCM_sys_ncra : ncra error"
1462    IGCM_debug_Exit "ncra"
1463  fi
1464
1465  IGCM_debug_PopStack "IGCM_sys_ncra"
1466}
1467
1468#D-#==================================================
1469#D-function IGCM_sys_ncrcat
1470#D-* Purpose: encapsulate ncrcat call so as to manage error code and retry
1471#D-* Examples:
1472#D-
1473function IGCM_sys_ncrcat {
1474  IGCM_debug_PushStack "IGCM_sys_ncrcat" $@
1475  if ( $DEBUG_sys ) ; then
1476    echo "IGCM_sys_ncrcat :" $@
1477  fi
1478
1479  typeset NB_ESSAI DELAI status i lastArg
1480  # number of tentative
1481  NB_ESSAI=3
1482  # time delay between tentative
1483  DELAI=2
1484
1485  i=0
1486  while [ $i -lt $NB_ESSAI ] ; do
1487    ncrcat -C --buffer_size 838860800 $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
1488    status=$?
1489    if [ ${status} -gt 0 ] ; then
1490      IGCM_debug_Print 2 "IGCM_sys_ncrcat : error code ${status}"
1491      cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1492      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1493      IGCM_debug_Print 2 "IGCM_sys_ncrcat : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
1494      sleep $DELAI
1495    elif ( [ ! "X$( grep "WARNING Intra-file non-monotonicity" ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ )" = "X" ] && [ X${config_Post_IgnoreNonMonotonic} = XFALSE ] ) ; then
1496      IGCM_debug_Print 2 "IGCM_sys_ncrcat : WARNING Intra-file non-monotonicity"
1497      cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1498      # remove files having corrupted time axis
1499      eval lastArg=\${$#}
1500      IGCM_debug_Print 2 "Remove files having corrupted time axis"
1501      IGCM_debug_Print 2 "IGCM_sys_ncrcat : Delete ${lastArg}"
1502      \rm ${lastArg}
1503      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1504      IGCM_debug_Print 2 "IGCM_sys_ncrcat : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
1505      sleep $DELAI
1506    else
1507      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1508      break
1509    fi
1510    (( i = i + 1 ))
1511  done
1512
1513  # Special case for spinup with cyclic time axis: change attribute calendar to none
1514  if [ X${config_Post_IgnoreNonMonotonic} = XTRUE ] ; then
1515      eval lastArg=\${$#}
1516      echo "IGCM_sys_ncrcat : change attribute calendar to none in file:" ${lastArg}
1517      IGCM_sys_ncatted -a calendar,time_counter,m,c,none ${lastArg}
1518  fi
1519
1520  if [ ${status} -gt 0 ] ; then
1521    echo "IGCM_sys_ncrcat : ncrcat error"
1522    #IGCM_debug_Exit "ncrcat"
1523  fi
1524
1525  IGCM_debug_PopStack "IGCM_sys_ncrcat"
1526}
1527
1528#D-#==================================================
1529#D-function IGCM_sys_ncrename
1530#D-* Purpose: encapsulate ncrename call so as to manage error code and retry
1531#D-* Examples:
1532#D-
1533function IGCM_sys_ncrename {
1534  IGCM_debug_PushStack "IGCM_sys_ncrename" $@
1535  if ( $DEBUG_sys ) ; then
1536    echo "IGCM_sys_ncrename :" $@
1537  fi
1538
1539  typeset NB_ESSAI DELAI status i
1540  # number of tentative
1541  NB_ESSAI=3
1542  # time delay between tentative
1543  DELAI=2
1544
1545  i=0
1546  while [ $i -lt $NB_ESSAI ] ; do
1547    ncrename $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
1548    status=$?
1549    if [ ${status} -gt 0 ] ; then
1550      IGCM_debug_Print 2 "IGCM_sys_ncrename : error code ${status}"
1551      cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1552      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1553      IGCM_debug_Print 2 "IGCM_sys_ncrename : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
1554      sleep $DELAI
1555    else
1556      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1557      break
1558    fi
1559    (( i = i + 1 ))
1560  done
1561
1562  if [ ${status} -gt 0 ] ; then
1563    echo "IGCM_sys_ncrename : ncrename error"
1564    IGCM_debug_Exit "ncrename"
1565  fi
1566
1567  IGCM_debug_PopStack "IGCM_sys_ncrename"
1568}
1569
1570#D-#==================================================
1571#D-function IGCM_sys_ncwa
1572#D-* Purpose: encapsulate ncwa call so as to manage error code and retry
1573#D-* Examples:
1574#D-
1575function IGCM_sys_ncwa {
1576  IGCM_debug_PushStack "IGCM_sys_ncwa" $@
1577  if ( $DEBUG_sys ) ; then
1578    echo "IGCM_sys_ncwa :" $@
1579  fi
1580
1581  typeset NB_ESSAI DELAI status i
1582  # number of tentative
1583  NB_ESSAI=3
1584  # time delay between tentative
1585  DELAI=2
1586
1587  i=0
1588  while [ $i -lt $NB_ESSAI ] ; do
1589    ncwa -C --buffer_size 838860800 $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
1590    status=$?
1591    if [ ${status} -gt 0 ] ; then
1592      IGCM_debug_Print 2 "IGCM_sys_ncwa : error code ${status}"
1593      cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1594      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1595      IGCM_debug_Print 2 "IGCM_sys_ncwa : ${i}/${NB_ESSAI} sleep ${DELAI} seconds and try again."
1596      sleep $DELAI
1597    else
1598      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1599      break
1600    fi
1601    (( i = i + 1 ))
1602  done
1603
1604  if [ ${status} -gt 0 ] ; then
1605    echo "IGCM_sys_ncwa : ncwa error"
1606    IGCM_debug_Exit "ncwa"
1607  fi
1608
1609  IGCM_debug_PopStack "IGCM_sys_ncwa"
1610}
1611
1612##############################################################
1613# CDO OPERATOR
1614
1615#D-#==================================================
1616#D-function IGCM_sys_cdo
1617#D-* Purpose: encapsulate cdo call so as to manage error code and retry
1618#D-* Examples:
1619#D-
1620function IGCM_sys_cdo {
1621  IGCM_debug_PushStack "IGCM_sys_cdo" $@
1622  if ( $DEBUG_sys ) ; then
1623    echo "IGCM_sys_cdo :" $@
1624  fi
1625
1626  typeset status
1627
1628  \cdo $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
1629  status=$?
1630  if [ ${status} -gt 0 ] ; then
1631    echo "IGCM_sys_cdo : error code ${status}"
1632    cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1633    \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1634    IGCM_debug_PopStack "IGCM_sys_cdo"
1635    return 1
1636  else
1637    IGCM_debug_PopStack "IGCM_sys_cdo"
1638    return 0
1639  fi
1640
1641  IGCM_debug_PopStack "IGCM_sys_cdo"
1642}
1643#
1644#D-#==================================================
1645#D-function IGCM_sys_create_run_dir
1646#D-* Purpose: stop the simulation in order to work into the run_dir directory
1647#D-* Examples:
1648#D-
1649function IGCM_sys_create_run_dir {
1650  IGCM_debug_PushStack "IGCM_sys_create_run_dir"
1651  if ( $DEBUG_sys ) ; then
1652    echo "IGCM_sys_create_run_dir :"
1653  fi
1654  if [ -f ${libIGCM}/Job_debug_${config_UserChoices_JobName} ] ; then
1655
1656      CPL_comp=n ; SRF_comp=n ; OCE_comp=n ; CHM_comp=n
1657      for comp in ${config_ListOfComponents[*]} ; do
1658        [ "X${comp}" = "XCPL" ] && CPL_comp=y
1659        [ "X${comp}" = "XSRF" ] && SRF_comp=y
1660        [ "X${comp}" = "XOCE" ] && OCE_comp=y
1661        [ "X${comp}" = "XCHM" ] && CHM_comp=y
1662        eval ExeNameIn=\${config_Executable_${comp}[0]}
1663        eval ExeNameOut=\${config_Executable_${comp}[1]}
1664        if [ X${ExeNameIn} != X\"\" ] ; then
1665          eval ExeNameIn=${ExeNameIn}
1666          echo "$ExeNameIn"" ""$ExeNameOut" >> components_binary.txt
1667        fi
1668      done
1669   SUBMIT_DIRECTORY=$(grep SUBMIT_DIR ${libIGCM}/libIGCM_sys/libIGCM_sys_${SYSTEM}.ksh | grep -m1 typeset | cut -dx -f2)
1670      sed -e "s%::ENVFILE::%${EnvFile}%" \
1671          -e "s%::EXECUTION::%${EXECUTION}%" \
1672          -e "s%::EXECUTION_TYPE::%${executionType}%" \
1673          -e "s%::JOBNAME::%${config_UserChoices_JobName}%" \
1674          -e "s%::SUBMIT_DIR::%${SUBMIT_DIRECTORY}%" \
1675          -e "s%::CPL_comp::%${CPL_comp}%" \
1676          -e "s%::OCE_comp::%${OCE_comp}%" \
1677          -e "s%::SRF_comp::%${SRF_comp}%" \
1678          -e "s%::CHM_comp::%${CHM_comp}%" \
1679          ${libIGCM}/Job_debug_${config_UserChoices_JobName} > ${RUN_DIR}/Job_debug_${config_UserChoices_JobName}
1680      echo
1681      echo "############################################"
1682      echo "#    DEBUG PHASE : CREATION OF RUN_DIR    #"
1683      echo "############################################"
1684      echo
1685      echo "You are in development or debug phase"
1686      echo "You can run directly into the running directory which is here "
1687      echo ${RUN_DIR}
1688      echo "Inside the run directory you will find a Job_debug_${config_UserChoices_JobName}"
1689      echo "to be used to launch the run as follows :"
1690      echo "${SUBMIT} Job_debug_${config_UserChoices_JobName}"
1691      exit
1692  else
1693      echo "############################################"
1694      echo "#    DEBUG PHASE : CREATION OF RUN_DIR    #"
1695      echo "############################################"
1696      echo
1697      echo "You are in development or debug phase"
1698      echo "You can run directly into the running directory which is here "
1699      echo ${RUN_DIR}
1700      exit
1701  fi
1702 
1703  IGCM_debug_PopStack "IGCM_sys_create_run_dir"
1704}
Note: See TracBrowser for help on using the repository browser.