source: trunk/libIGCM/libIGCM_sys/libIGCM_sys_ada.ksh @ 1451

Last change on this file since 1451 was 1431, checked in by sdipsl, 6 years ago
  • CMIP6 files go in CCCWORKDIR and alike.
  • 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: 54.2 KB
Line 
1#!/bin/ksh
2
3#**************************************************************
4# Author: Sébastien Denvil
5# Contact: Sebastien.Denvil__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 for Ada
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 MASTER=ada
71# project name
72typeset PROJECT=$(echo ${LOADL_STEP_GROUP:=NONE})
73# jobWarningDelay in seconds
74typeset jobWarningDelay=$( TZ=utc date -d '1970-01-01 '${wall_clock_limit} +%s )
75
76#D-
77#D-#==================================================
78#D-Program used in libIGCM
79#D-#==================================================
80
81# Submit command
82typeset SUBMIT=${SUBMIT:=llsubmit}
83# rsync with path
84typeset -r RSYNC=/usr/bin/rsync
85# RSYNC_opt args to rsync
86typeset -r RSYNC_opt="-va"
87# ie storage filesystem
88typeset -r STOREHOST=ergon
89typeset -r REMOTE_RSYNC=/usr/bin/rsync
90
91#====================================================
92# Set environment tools (ferret, nco, cdo, rebuild, ...)
93#====================================================
94source /smplocal/pub/Modules/default/init/ksh
95if ( [ "X${LOADL_STEP_TYPE}" = "XPARALLEL" ] || [ "X${LOADL_STEP_TYPE}" = "XSERIAL" ] ) ; then
96  module load python/2.7.10 > /dev/null 2>&1
97  . /smphome/rech/psl/rpsl035/.atlas_env_ada_intel_2013_0_bash > /dev/null 2>&1
98else
99  module load python/2.7.10 > /dev/null 2>&1
100  module unload intel > /dev/null 2>&1
101  module load intel/2016.2 > /dev/null 2>&1
102  . /smphome/rech/psl/rpsl035/.atlas_env_ada_bash > /dev/null 2>&1
103  export PCMDI_MP=/workgpfs/rech/psl/rpsl035/PCMDI-MP
104  export UVCDAT_ANONYMOUS_LOG=no
105fi
106[ ! X${TaskType} = Xchecking ] && IGCM_debug_Print 1 "List of loaded modules:"
107[ ! X${TaskType} = Xchecking ] && module list
108
109export PATH=${PATH}:/smphome/rech/psl/rpsl035/AddNoise/src_X64_ADA/bin
110export PATH=${PATH}:/smphome/rech/psl/rpsl035/AddPerturbation/src_X64_ADA/bin
111export PATH=${PATH}:/smphome/rech/psl/rpsl035/bin/
112
113#====================================================
114# Host specific DIRECTORIES
115#====================================================
116
117#====================================================
118#- MirrorlibIGCM for frontend
119typeset -r MirrorlibIGCM=${MirrorlibIGCM:=false}
120
121#====================================================
122#- libIGCM_POST for frontend
123typeset -r libIGCM_POST=${libIGCM}
124
125#====================================================
126#- R_EXE   (==> BIN_DIR = ${MODIPSL}/bin )
127typeset -r R_EXE="${MODIPSL}/bin"
128
129#====================================================
130#- SUBMIT_DIR : submission dir
131typeset -x SUBMIT_DIR=${SUBMIT_DIR:=${LOADL_STEP_INITDIR}}
132
133#====================================================
134#- IN
135typeset -r R_IN=${R_IN:=/workgpfs/rech/psl/rpsl035/IGCM}
136typeset -r R_IN_ECMWF=${R_IN_ECMWF:=/u/rech/psl/rpsl376}
137
138#====================================================
139#- RUN_DIR_PATH : Temporary working directory (=> TMP)
140typeset -r RUN_DIR_PATH=${RUN_DIR_PATH:=${TMPDIR}}
141
142#====================================================
143#- OUTCOMMAND_PATH : tmp place to store command lines standard error and outputs
144typeset -r OUTCOMMAND_PATH=${RUN_DIR_PATH:-/tmp}
145
146#====================================================
147#- HOST_MPIRUN_COMMAND
148if ( [ "X${LOADL_STEP_TYPE}" = "XPARALLEL" ] || [ "X${LOADL_STEP_TYPE}" = "XSERIAL" ] ) ; then
149  typeset -r HOST_MPIRUN_COMMAND=${HOST_MPIRUN_COMMAND:="/usr/bin/time poe"}
150else
151  typeset -r HOST_MPIRUN_COMMAND=${HOST_MPIRUN_COMMAND:="/usr/bin/time mpirun"}
152fi
153#====================================================
154#- Max number of arguments passed to nco operator or demigration command
155UNIX_MAX_LIMIT=360
156
157#====================================================
158#- set PackDefault to true on ada
159PackDefault=true
160
161#====================================================
162#- Number of cores per node
163core_per_node=32
164
165#====================================================
166#- Default number of MPI task for IPSL coupled model
167#- required for backward compatibility
168#-
169DEFAULT_NUM_PROC_OCE=5
170DEFAULT_NUM_PROC_CPL=1
171(( DEFAULT_NUM_PROC_ATM = BATCH_NUM_PROC_TOT - DEFAULT_NUM_PROC_OCE - DEFAULT_NUM_PROC_CPL ))
172
173#D-#==================================================
174#D-function IGCM_sys_defineArchives
175#D-* Purpose:
176#D-* Define ARCHIVE : Dedicated to large files
177#D-* Define STORAGE : Dedicated to small/medium files
178#D-* Define R_OUT   : Output tree located on ARCHIVE
179#D-* Define R_FIG   : Output tree located on STORAGE hosting figures (monitoring and atlas, and/or small files)
180#D-* Define R_BUF   : Output tree located on SCRATCHDIR hosting files waiting for rebuild or pack processes
181#D-* if SpaceName=TEST everything is stored on WORKDIR
182#D-* Examples:
183#D-
184function IGCM_sys_defineArchives {
185  IGCM_debug_PushStack "IGCM_sys_defineArchives"
186
187  if [ ! X${config_UserChoices_ARCHIVE} = X ]; then
188    #====================================================
189    #- ARCHIVE (dedicated to large files)
190    ARCHIVE=${config_UserChoices_ARCHIVE}
191  else
192    #====================================================
193    #- ARCHIVE (dedicated to large files)
194    ARCHIVE=$(echo ${HOME} | sed -e "s,/.*home/,/arch/home/,")
195  fi
196
197  if [ ! X${config_UserChoices_STORAGE} = X ]; then
198    #====================================================
199    #- STORAGE (dedicated to small/medium files)
200    STORAGE=${config_UserChoices_STORAGE}
201  else
202    #====================================================
203    #- STORAGE (dedicated to small/medium files)
204    STORAGE=${WORKDIR}
205  fi
206
207  if [ X${config_UserChoices_SpaceName} = XTEST ]; then
208    #====================================================
209    #- R_OUT
210    R_OUT=${WORKDIR}/IGCM_OUT
211
212    #====================================================
213    #- R_FIG (hosting figures : monitoring and atlas, and/or small files)
214    R_FIG=${WORKDIR}/IGCM_OUT
215
216    IGCM_debug_Print 1 "SpaceName=TEST ==> OVERRULE destination path directories"
217
218  else
219    #====================================================
220    #- R_OUT
221    R_OUT=${ARCHIVE}/IGCM_OUT
222
223    #====================================================
224    #- R_FIG (hosting figures : monitoring and atlas, and/or small files)
225    R_FIG=${ARCHIVE}/IGCM_OUT
226  fi
227
228  #====================================================
229  #- CMIP6 (hosting CMIP6 files produced by XIOS2 and configured by dr2xml)
230  CMIP6_BUF=${STORAGE}/IGCM_OUT
231
232  #====================================================
233  #- R_BUF (ONLY FOR double copy an scratch)
234  R_BUF=${WORKDIR}/IGCM_OUT
235
236  IGCM_debug_Print 1 "R_OUT has been defined = ${R_OUT}"
237  IGCM_debug_Print 1 "R_BUF has been defined = ${R_BUF}"
238  IGCM_debug_Print 1 "R_FIG has been defined = ${R_FIG}"
239
240  IGCM_debug_PopStack "IGCM_sys_defineArchives"
241}
242
243#D-#==================================================
244#D-function IGCM_sys_RshArchive
245#D-* Purpose: Archive rsh command
246#D-* Examples:
247#D-
248function IGCM_sys_RshArchive {
249  IGCM_debug_PushStack "IGCM_sys_RshArchive" $@
250  DEBUG_sys=false IGCM_sys_IsFileArchived "$@"
251  if [ $? = 0 ] ; then
252    rsh ${STOREHOST} exec /bin/ksh <<-EOF
253    ${@}
254EOF
255    status=$?
256  else
257    /bin/ksh <<-EOF
258    ${@}
259EOF
260    status=$?
261  fi
262  if [ ${status} -gt 0 ] ; then
263    IGCM_debug_Print 2 "IGCM_sys_RshArchive : rsh or command failed error code ${status}"
264    IGCM_debug_Exit "IGCM_sys_RshArchive"
265  fi
266  IGCM_debug_PopStack "IGCM_sys_RshArchive"
267}
268
269#D-#==================================================
270#D-function IGCM_sys_RshArchive_NoError
271#D-* Purpose: Archive rsh command, without error
272#D-*          used only in monitoring.job
273#D-* Examples:
274#D-
275function IGCM_sys_RshArchive_NoError {
276  IGCM_debug_PushStack "IGCM_sys_RshArchive_NoError" $@
277  DEBUG_sys=false IGCM_sys_IsFileArchived "$@"
278  if [ $? = 0 ] ; then
279    rsh ${STOREHOST} exec /bin/ksh <<-EOF
280    ${@} 2> /dev/null
281EOF
282  else
283    /bin/ksh <<-EOF
284    ${@} 2> /dev/null
285EOF
286  fi
287  IGCM_debug_PopStack "IGCM_sys_RshArchive_NoError"
288}
289
290#D-#==================================================
291#D-function IGCM_sys_MkdirArchive
292#D-* Purpose: Mkdir on Archive
293#D-* Examples:
294#D-
295function IGCM_sys_MkdirArchive {
296  IGCM_debug_PushStack "IGCM_sys_MkdirArchive" $@
297  if ( $DEBUG_sys ) ; then
298    echo "IGCM_sys_MkdirArchive :" $@
299  fi
300  #- creation de repertoire sur le serveur fichier
301  DEBUG_sys=false IGCM_sys_IsFileArchived $1
302  if [ $? = 0 ] ; then
303    rsh ${STOREHOST} -n mkdir -p $1
304    status=$?
305  else
306    mkdir -p $1
307    status=$?
308  fi
309
310  if [ ${status} -gt 0 ] ; then
311    IGCM_debug_Print 2 "IGCM_sys_MkdirArchive : rsh or mkdir failed error code ${status}"
312    IGCM_debug_Exit "IGCM_sys_MkdirArchive"
313  fi
314  IGCM_debug_PopStack "IGCM_sys_MkdirArchive"
315}
316
317#D-#==================================================
318#D-function IGCM_sys_TestDirArchive
319#D-* Purpose: Test Directory that must exists on Archive
320#D-* Examples:
321#D-
322function IGCM_sys_TestDirArchive {
323  IGCM_debug_PushStack "IGCM_sys_TestDirArchive" $@
324  if ( $DEBUG_sys ) ; then
325    echo "IGCM_sys_TestDirArchive :" $@
326  fi
327  typeset ExistFlag
328  #Command depends on targeted file system
329  DEBUG_sys=false IGCM_sys_IsFileArchived $1
330  if [ $? = 0 ] ; then
331    ExistFlag=$( IGCM_sys_RshArchive "[ -d $1 ] && echo 0 || echo 1" )
332  else
333    ExistFlag=$( [ -d $1 ] && echo 0 || echo 1 )
334  fi
335  IGCM_debug_PopStack "IGCM_sys_TestDirArchive"
336  return ${ExistFlag}
337}
338
339#D-#==================================================
340#D-function IGCM_sys_IsFileArchived
341#D-* Purpose: Test file that must NOT EXISTS on Archive based on filename only
342#D-* Examples:
343#D-
344function IGCM_sys_IsFileArchived {
345  IGCM_debug_PushStack "IGCM_sys_IsFileArchived" $@
346  if ( $DEBUG_sys ) ; then
347    echo "IGCM_sys_IsFileArchived :" $@
348  fi
349  typeset IsArchivedFlag
350  IsArchivedFlag=$( [ "X$( echo $@ | grep \/arch\/home )" != "X" ] && echo 0 || echo 1 )
351  IGCM_debug_PopStack "IGCM_sys_IsFileArchived"
352
353  return ${IsArchivedFlag}
354}
355
356#D-#==================================================
357#D-function IGCM_sys_TestFileArchive
358#D-* Purpose: Test file that must NOT EXISTS on Archive
359#D-* Examples:
360#D-
361function IGCM_sys_TestFileArchive {
362  IGCM_debug_PushStack "IGCM_sys_TestFileArchive" $@
363  typeset ExistFlag
364  ExistFlag=$( IGCM_sys_RshArchive "[ -f $1 ] && echo 0 || echo 1" )
365  IGCM_debug_PopStack "IGCM_sys_TestFileArchive"
366
367  return ${ExistFlag}
368}
369
370#D-#==================================================
371#D-function IGCM_sys_CountFileArchive
372#D-* Purpose: Count files on Archive filesystem
373#D-* Examples:
374#D-
375function IGCM_sys_CountFileArchive {
376  IGCM_debug_PushStack "IGCM_sys_CountFileArchive" $@
377  #Command depends on targeted file system
378  DEBUG_sys=false IGCM_sys_IsFileArchived $1
379  if [ $? = 0 ] ; then
380    IGCM_sys_RshArchive "ls ${@} 2>/dev/null | wc -l"
381    status=$?
382  else
383    ls ${@} 2>/dev/null | wc -l
384    status=$?
385  fi
386  if [ ${status} -gt 0 ] ; then
387    echo "IGCM_sys_CountFileArchive : erreur."
388  fi
389  IGCM_debug_PopStack "IGCM_sys_CountFileArchive"
390}
391
392#D-#==================================================
393#D-function IGCM_sys_Tree
394#D-* Purpose: Tree directories with files on ${ARCHIVE}
395#D-* Examples: IGCM_sys_Tree ${R_IN} ${R_OUT}
396#D-
397function IGCM_sys_Tree {
398  IGCM_debug_PushStack "IGCM_sys_Tree" $@
399  if ( $DEBUG_sys ) ; then
400    echo "IGCM_sys_Tree :" $@
401  fi
402
403  \mfls -R $@
404
405  IGCM_debug_PopStack "IGCM_sys_Tree"
406}
407
408#D-#==================================================
409#D-function IGCM_sys_Qsub
410#D-* Purpose: Qsub new job
411#D-* Examples:
412#D-
413function IGCM_sys_Qsub {
414  IGCM_debug_PushStack "IGCM_sys_Qsub" $@
415  if ( $DEBUG_sys ) ; then
416    echo "IGCM_sys_Qsub :" $@
417  fi
418  typeset status
419
420  # We have to change output/error file
421  [ ${#@} = 1 ] &&  REP_FOR_JOB=${SUBMIT_DIR}
422  [ ${#@} = 2 ] &&  REP_FOR_JOB=${2}
423  sed -e "s:\# \@ output *= .*:\# \@ output = ${Script_Output}:" \
424    -e "s:\# \@ error *= .*:\# \@ error = ${Script_Output}:"   \
425    $1 > ${REP_FOR_JOB}/JOB_FOR_IGCM
426  cd $REP_FOR_JOB ; /usr/bin/llsubmit JOB_FOR_IGCM > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 ; status=$? ; cd - ;
427
428  cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
429  if [ ${status} -gt 0 ] ; then
430    IGCM_debug_Print 2 "IGCM_sys_Qsub $1 : error code ${status}"
431    IGCM_debug_Exit "IGCM_sys_Qsub"
432  else
433    JobID=$( gawk {'print $4'} ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ | tail -1 | sed -e s/\"//g )
434    IGCM_sys_Rm ${REP_FOR_JOB}/JOB_FOR_IGCM
435  fi
436  IGCM_debug_PopStack "IGCM_sys_Qsub"
437}
438
439#D-#==================================================
440#D-function IGCM_sys_QsubPost
441#D-* Purpose: Qsub new job on scalaire
442#D-* Examples:
443#D-
444function IGCM_sys_QsubPost {
445  IGCM_debug_PushStack "IGCM_sys_QsubPost" $@
446  if ( $DEBUG_sys ) ; then
447    echo "IGCM_sys_QsubPost :" $@
448  fi
449  typeset status
450
451  # We have to change output/error file
452  [ ${#@} = 1 ] &&  REP_FOR_JOB=${POST_DIR}
453  [ ${#@} = 2 ] &&  REP_FOR_JOB=${2}
454
455  sed -e "s:\# \@ output *= .*:\# \@ output = ${Script_Post_Output}.out:" \
456    -e "s:\# \@ error *= .*:\# \@ error = ${Script_Post_Output}.out:"   \
457    ${libIGCM_POST}/$1.job > ${REP_FOR_JOB}/JOB_FOR_IGCM_$$
458
459  cd $REP_FOR_JOB ; /usr/bin/llsubmit JOB_FOR_IGCM_$$ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1 ; status=$? ; cd - ;
460
461  cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
462  if [ ${status} -gt 0 ] ; then
463    IGCM_debug_Print 2 "IGCM_sys_QsubPost $1 : error code ${status}"
464    IGCM_debug_Exit "IGCM_sys_QsubPost"
465  else
466    JobID=$( gawk {'print $4'} ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ | tail -1 | sed -e s/\"//g )
467    IGCM_sys_Rm ${REP_FOR_JOB}/JOB_FOR_IGCM_$$
468  fi
469  IGCM_debug_PopStack "IGCM_sys_QsubPost"
470}
471
472#D-*************************
473#D- File transfer functions
474#D-*************************
475#D-
476
477#D-#==================================================
478#D-function IGCM_sys_RmRunDir
479#D-* Purpose: rm tmpdir (dummy function most of the time batch
480#D-                      scheduler will do the job)
481#D-* Examples:
482#D-
483function IGCM_sys_RmRunDir {
484  IGCM_debug_PushStack "IGCM_sys_RmRunDir" $@
485  if ( $DEBUG_sys ) ; then
486    echo "IGCM_sys_RmRunDir :" $@
487    IGCM_debug_Print 1 "Dummy call, let the scheduler do that."
488  fi
489  IGCM_debug_PopStack "IGCM_sys_RmRunDir"
490}
491
492#D-#==================================================
493#D-function IGCM_sys_Put_Dir
494#D-* Purpose: Copy a complete directory on $(ARCHIVE)
495#D-* Examples:
496#D-
497function IGCM_sys_Put_Dir {
498  IGCM_debug_PushStack "IGCM_sys_Put_Dir" $@
499  if ( $DEBUG_sys ) ; then
500    echo "IGCM_sys_Put_Dir :" $@
501  fi
502  if [ $DRYRUN = 0 ]; then
503    if [ ! -d ${1} ] ; then
504      echo "WARNING : IGCM_sys_Put_Dir ${1} DOES NOT EXIST ."
505      IGCM_debug_PopStack "IGCM_sys_Put_Dir"
506      return
507    fi
508
509    typeset status
510
511    # Only if we use rsync
512    #IGCM_sys_TestDirArchive $( dirname $2 )
513    #
514    #Command depends on targeted file system
515    DEBUG_sys=false IGCM_sys_IsFileArchived $2
516    if [ $? = 0 ] ; then
517      \rcp -r $1 ${STOREHOST}:$2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
518      status=$?
519    else
520      \cp -r $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
521      status=$?
522    fi
523
524    if [ ${status} -gt 0 ] ; then
525      IGCM_debug_Print 2 "IGCM_sys_Put_Dir : rcp or cp failed error code ${status}"
526      cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
527      IGCM_debug_Exit "IGCM_sys_Put_Dir"
528    else
529      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
530    fi
531  fi
532  IGCM_debug_PopStack "IGCM_sys_Put_Dir"
533}
534
535#D-#==================================================
536#D-function IGCM_sys_Get_Dir
537#D-* Purpose: Copy a complete directory from ${ARCHIVE}
538#D-* Examples:
539#D-
540function IGCM_sys_Get_Dir {
541  IGCM_debug_PushStack "IGCM_sys_Get_Dir" $@
542  if ( $DEBUG_sys ) ; then
543    echo "IGCM_sys_Get_Dir :" $@
544  fi
545  if [ $DRYRUN = 0 ]; then
546    typeset NB_ESSAI DELAI status i
547    # number of tentative
548    NB_ESSAI=3
549    # time delay between tentative
550    DELAI=2
551
552    # Only if we use rsync
553    #IGCM_sys_TestDirArchive $( dirname $2 )
554    #
555    # Command depends on targeted filesystem
556    DEBUG_sys=false IGCM_sys_IsFileArchived $1
557    if [ $? = 0 ] ; then
558      # add dmget (to demigrate all offline files) to reduce time of this command :
559      #IGCM_sys_RshArchive "dmfind $1 -state MIG -o -state OFL -o -state PAR | dmget -q -n"
560      i=0
561      while [ $i -lt $NB_ESSAI ] ; do
562        \rcp -rp ${STOREHOST}:$1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
563        status=$?
564        if [ ${status} -gt 0 ]; then
565          IGCM_debug_Print 2 "IGCM_sys_Get_Dir : rcp failed error code ${status} ${i}/${NB_ESSAI}"
566          IGCM_debug_Print 2 "IGCM_sys_Get_Dir : sleep ${DELAI} seconds and try again."
567          sleep $DELAI
568        else
569          break
570        fi
571        (( i = i + 1 ))
572      done
573    else
574      \cp -rp $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
575      status=$?
576      if [ ${status} -gt 0 ] ; then
577        IGCM_debug_Print 2 "IGCM_sys_Get_Dir : cp failed error code ${status}"
578        cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
579        IGCM_debug_Exit "IGCM_sys_Get_Dir"
580      else
581        \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
582      fi
583    fi
584    if [ ${status} -gt 0 ] ; then
585      IGCM_debug_Print 2 "IGCM_sys_Get_Dir : (r)cp failed error code ${status}"
586      cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
587      IGCM_debug_Exit "IGCM_sys_Get_Dir"
588    else
589      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
590    fi
591  fi
592  IGCM_debug_PopStack "IGCM_sys_Get_Dir"
593}
594
595#D-#==================================================
596#D-function IGCM_sys_Put_Rest
597#D-* Purpose: Put computied restarts on ${ARCHIVE}.
598#D-           File and target directory must exist.
599#D-* Examples:
600#D-
601function IGCM_sys_Put_Rest {
602  IGCM_debug_PushStack "IGCM_sys_Put_Rest" $@
603  if ( $DEBUG_sys ) ; then
604    echo "IGCM_sys_Put_Rest :" $@
605  fi
606  if [ $DRYRUN = 0 ]; then
607    if [ ! -f ${1} ] ; then
608      echo "ERROR : IGCM_sys_Put_Rest ${1} DOES NOT EXIST ."
609      IGCM_debug_Exit "IGCM_sys_Put_Rest"
610    fi
611
612    typeset status
613    #
614    if [ X${JobType} = XRUN ] ; then
615      IGCM_sys_Chmod 444 ${1}
616    fi
617    #
618    #
619    #Command depends on targeted file system
620    DEBUG_sys=false IGCM_sys_IsFileArchived $2
621    if [ $? = 0 ] ; then
622      mfput $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
623      status=$?
624    else
625      IGCM_sys_MkdirArchive $( dirname $2 )
626      \cp $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
627      status=$?
628    fi
629
630#       #RSYNC WITH NETWORK RSH CALL
631#       IGCM_sys_MkdirArchive $( dirname $2 )
632#       echo ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${STOREHOST}:${2} > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
633#       ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
634
635#       #RSYNC WITH NFS USE
636#       echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
637#       ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
638
639#       status=$?
640#       IGCM_sys_Rsync_out $status
641
642#       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
643#       (( status=status+$? ))
644
645    if [ ${status} -gt 0 ] ; then
646      IGCM_debug_Print 2 "IGCM_sys_Put_Rest : mfput or cp failed error code ${status}"
647      cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
648      IGCM_debug_Exit "IGCM_sys_Put_Rest"
649    else
650      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
651    fi
652  fi
653  IGCM_debug_PopStack "IGCM_sys_Put_Rest"
654}
655
656#D-#==================================================
657#D-function IGCM_sys_Put_Out
658#D-* Purpose: Copy a file on ${ARCHIVE} after having chmod it in readonly
659#D-* Examples:
660#D-
661function IGCM_sys_Put_Out {
662  IGCM_debug_PushStack "IGCM_sys_Put_Out" $@
663  if ( $DEBUG_sys ) ; then
664    echo "IGCM_sys_Put_Out :" $@
665  fi
666
667  typeset status
668
669  if [ $DRYRUN = 0 ]; then
670    if [ ! -f ${1} ] ; then
671      echo "WARNING : IGCM_sys_Put_Out ${1} DOES NOT EXIST ."
672      IGCM_debug_PopStack "IGCM_sys_Put_Out"
673      return 1
674    fi
675    #
676    if [ X${JobType} = XRUN ] ; then
677      if [ X${3} = X ] ; then
678        IGCM_sys_Chmod 444 ${1}
679      fi
680    fi
681    #
682    #
683    #Command depends on targeted file system
684    DEBUG_sys=false IGCM_sys_IsFileArchived $2
685    if [ $? = 0 ] ; then
686      mfput $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
687      status=$?
688    else
689      IGCM_sys_MkdirArchive $( dirname $2 )
690      \cp $1 $2 > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
691      status=$?
692    fi
693
694#       #RSYNC WITH NETWORK RSH CALL
695#       IGCM_sys_MkdirArchive $( dirname $2 )
696#       echo ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${STOREHOST}:${2} > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
697#       ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${RUN_DIR}/$1 ${STOREHOST}:${2} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
698
699#       #RSYNC WITH NFS USE
700#       echo ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
701#       ${RSYNC} ${RSYNC_opt} ${RUN_DIR}/$1 ${2} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
702
703#       status=$?
704#       IGCM_sys_Rsync_out $status
705
706#       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
707#       (( status=status+$? ))
708
709    if [ ${status} -gt 0 ] ; then
710      IGCM_debug_Print 2 "IGCM_sys_Put_Out : mfput or cp failed error code ${status}"
711      cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
712      IGCM_debug_Exit "IGCM_sys_Put_Out"
713    else
714      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
715    fi
716  fi
717  IGCM_debug_PopStack "IGCM_sys_Put_Out"
718  return 0
719}
720
721#D-#==================================================
722#D-function IGCM_sys_Get
723#D-* Purpose: Get a file from ${ARCHIVE}
724#D-* Examples: IGCM_sys_Get myfile /destpath/myfile_with_PREFIX
725#D-            IGCM_sys_Get /l Array_contain_myfiles /destpath/
726function IGCM_sys_Get {
727  IGCM_debug_PushStack "IGCM_sys_Get" $@
728
729  typeset DEST status dm_liste
730
731  if ( $DEBUG_sys ) ; then
732    echo "IGCM_sys_Get :" $@
733  fi
734  if [ $DRYRUN -le 2 ]; then
735    if [ X${1} = X'/l' ] ; then
736      eval set +A dm_liste \${${2}}
737    else
738      dm_liste=${1}
739    fi
740    eval DEST=\${${#}}
741
742    # test if the (first) file is present in the old computation :
743    DEBUG_sys=false IGCM_sys_IsFileArchived ${dm_liste[0]}
744    if [ $? = 0 ] ; then
745      IGCM_sys_TestFileArchive ${dm_liste[0]}
746      status=$?
747    else
748      IGCM_sys_TestFileBuffer ${dm_liste[0]}
749      status=$?
750    fi
751
752    if [ ${status} -gt 0 ] ; then
753      echo "IGCM_sys_Get, ERROR : regular file ${dm_liste[0]} DOES NOT EXIST ."
754      IGCM_debug_Exit "IGCM_sys_Get"
755      return
756    fi
757
758    #Command depends on targeted file system
759    DEBUG_sys=false IGCM_sys_IsFileArchived ${dm_liste[0]}
760    if [ $? = 0 ] ; then
761      mfget ${dm_liste[*]} ${DEST} > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
762      status=$?
763    else
764      \cp ${dm_liste[*]} ${DEST} > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
765      status=$?
766    fi
767
768#       #RSYNC WITH NETWORK RSH CALL
769#       echo ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
770#       ${RSYNC} ${RSYNC_opt} --rsync-path=${REMOTE_RSYNC} -e rsh ${STOREHOST}:"${dm_liste}" ${STOREHOST}:${RUN_DIR}/${DEST} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
771
772#       #RSYNC WITH NFS USE
773#       echo ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
774#       ${RSYNC} ${RSYNC_opt} ${dm_liste} ${RUN_DIR}/${DEST} >> ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
775
776#       status=$?
777#       IGCM_sys_Rsync_out $status
778
779#       ${libIGCM}/libIGCM_sys/IGCM_analyse_rsync_out.awk ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
780#       (( status=status+$? ))
781
782    if [ ${status} -gt 0 ] ; then
783      IGCM_debug_Print 2 "IGCM_sys_Get : mfget or cp failed error code ${status}"
784      cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
785      IGCM_debug_Exit "IGCM_sys_Get"
786    else
787      \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
788    fi
789  fi
790  IGCM_debug_PopStack "IGCM_sys_Get"
791}
792
793#D-#==================================================
794#D-function IGCM_sys_GetDate_Monitoring
795#D-* Purpose: get the last year for which the monitoring has been computed
796#D-* Examples:
797#D-
798function IGCM_sys_GetDate_Monitoring {
799  IGCM_debug_PushStack "IGCM_sys_GetDate_Monitoring" $@
800  if ( $DEBUG_sys ) ; then
801    echo "IGCM_sys_GetDate_Monitoring :" $@
802  fi
803
804  IGCM_sys_Cd /tmp
805  # NASTY HACK. We force /tmp here. This function is called only from the front-end and interactively.
806  RUN_DIR_PATH=/tmp IGCM_sys_Get ${1} .
807  eval ${2}=$( cdo showyear $( basename ${1} ) 2> /dev/null | gawk '{ print $NF }' )
808  # Need to erase this file to avoid collision (permission denied getting file) between users on the front-end
809  IGCM_sys_Rm -f $( basename ${1} )
810  IGCM_sys_Cd -
811
812  IGCM_debug_PopStack "IGCM_sys_GetDate_Monitoring"
813}
814
815#D-#==================================================
816#D-function IGCM_sys_Dods_Rm
817#D-* Purpose: DO NOTHING ! Put ${ARCHIVE} files on DODS internet protocole.
818#D-* Examples:
819#D-
820function IGCM_sys_Dods_Rm {
821  if ( $DEBUG_sys ) ; then
822    echo "IGCM_sys_Dods_Rm :" $@
823  fi
824
825  typeset status
826  if [ $DRYRUN = 0 ]; then
827    if [ "$#" -eq 1 ]; then
828      rsh ${STOREHOST} exec /bin/ksh <<EOF
829          cd ${R_SAVE}
830          /arch/local/bin/dods_rm DODS/pub/${LOGIN}/${R_DODS}/${1} > /dev/null 2>&1
831EOF
832      status=$?
833    else
834      rsh ${STOREHOST} exec /bin/ksh <<EOF
835          cd ${R_SAVE}
836          /arch/local/bin/dods_rm DODS/pub/${LOGIN}/${R_DODS} > /dev/null 2>&1
837EOF
838      status=$?
839    fi
840  fi
841
842  return ${status}
843}
844
845#D-#==================================================
846#D-function IGCM_sys_Dods_Cp
847#D-* Purpose: Copy $(ARCHIVE) files on DODS internet protocole.
848#D-* Examples:
849#D-
850function IGCM_sys_Dods_Cp {
851  if ( $DEBUG_sys ) ; then
852    echo "IGCM_sys_Dods_Cp :" $@
853  fi
854  return 0
855}
856
857#D-#==================================================
858#D-function IGCM_sys_Put_Dods
859#D-* Purpose: Put ${ARCHIVE} files on DODS internet protocole.
860#D-* Examples:
861#D-
862function IGCM_sys_Put_Dods {
863  IGCM_debug_PushStack "IGCM_sys_Put_Dods" $@
864  if ( $DEBUG_sys ) ; then
865    echo "IGCM_sys_Put_Dods :" $@
866  fi
867  typeset status
868  if [ $DRYRUN = 0 ]; then
869    # We take our time on that
870    sleep 10
871    IGCM_sys_TestDirArchive ${R_SAVE}/${1}
872    if [ $? != 0 ] ; then
873      echo "WARNING : IGCM_sys_Put_Dods ${R_SAVE}/${1} DOES NOT EXIST ."
874      IGCM_debug_PopStack "IGCM_sys_Put_Dods"
875      return
876    fi
877
878    rsh ${STOREHOST} exec /bin/ksh <<EOF
879          cd ${R_SAVE}
880          /arch/local/bin/dods_rm DODS/pub/${LOGIN}/${R_DODS}/${1} > /dev/null 2>&1
881          /bin/chmod -R u+w ${R_SAVE}/${1}
882          /arch/local/bin/dods_cp ${1} DODS/pub/${LOGIN}/${R_DODS} > /dev/null 2>&1
883          /bin/chmod -R +rX ${R_SAVE}/${1}
884          /bin/chmod -R u+w ${R_SAVE}/${1}
885EOF
886    status=$?
887
888    if [ ${status} -gt 0 ] ; then
889      echo "IGCM_sys_Put_Dods : error."
890      IGCM_debug_Exit "IGCM_sys_Put_Dods"
891    fi
892  fi
893  IGCM_debug_PopStack "IGCM_sys_Put_Dods"
894}
895
896##############################################################
897# REBUILD OPERATOR
898
899#D-#==================================================
900#D-function IGCM_sys_sync
901#D-* Purpose: flush buffer on disk (dummy function on Ada)
902#D-* Examples:
903#D-
904function IGCM_sys_sync {
905  IGCM_debug_PushStack "IGCM_sys_sync" $@
906  if ( $DEBUG_sys ) ; then
907    echo "IGCM_sys_sync :" $@
908    echo "Dummy call, let the system do that."
909  fi
910  IGCM_debug_PopStack "IGCM_sys_sync"
911}
912
913############################################################
914# Activate Running Environnment Variables
915
916#D-#==================================================
917#D-function IGCM_sys_activ_variables
918#D-* Purpose: set environement variables prior to execution
919#D-* Examples:
920#D-
921function IGCM_sys_activ_variables {
922  IGCM_debug_PushStack "IGCM_sys_activ_variables"
923  if ( $DEBUG_sys ) ; then
924    echo "IGCM_sys_activ_variables"
925  fi
926
927# --------------------------------------------------------------------
928#D- MPI specifications
929# --------------------------------------------------------------------
930
931# --------------------------------------------------------------------
932#D- Other specifications
933# --------------------------------------------------------------------
934
935  ulimit -s unlimited
936## to be done only one time
937## export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/smplocal/pub/NetCDF/4.1.3/lib:/smplocal/pub/HDF5/1.8.9/seq/lib
938##  echo ${LD_LIBRARY_PATH} | grep -i netcdf >/dev/null 2>&1 || export LD_LIBRARY_PATH=${LD_LIBRARY_PATH}:/smplocal/pub/NetCDF/4.1.3/lib:/smplocal/pub/HDF5/1.8.9/seq/lib
939  IGCM_debug_Print 1 "set LD_LIBRARY_PATH=${LD_LIBRARY_PATH}"
940
941  export MP_STDOUTMODE=combined
942  IGCM_debug_Print 1 "set MP_STDOUTMODE=${MP_STDOUTMODE}"
943
944  ## fix to reduce memory usage. Required since 2014/22/04. On ada IDRIS.
945  #export MP_EUILIBPATH=/smplocal/lib/ibmhpc/pe12012/ppe.pami/gnu/lib64/pami64
946  #IGCM_debug_Print 1 "set MP_EUILIBPATH=${MP_EUILIBPATH}"
947
948  IGCM_debug_PopStack "IGCM_sys_activ_variables"
949}
950
951############################################################
952# Desactivate Running Environnment Variables
953
954#D-#==================================================
955#D-function IGCM_sys_desactiv_variables
956#D-* Purpose: unset environement variables after execution
957#D-* Examples:
958#D-
959function IGCM_sys_desactiv_variables {
960  IGCM_debug_PushStack "IGCM_sys_desactiv_variables"
961  if ( $DEBUG_sys ) ; then
962    echo "IGCM_sys_desactiv_variables"
963  fi
964# --------------------------------------------------------------------
965#D- MPI specifications
966# --------------------------------------------------------------------
967
968# --------------------------------------------------------------------
969#D- Other specifications
970# --------------------------------------------------------------------
971
972  IGCM_debug_PopStack "IGCM_sys_desactiv_variables"
973}
974
975############################################################
976# Update job headers to be used by the scheduler
977
978#D-#==================================================
979#D-function IGCM_sys_updateHeaders
980#D-* Purpose: Update job headers to be used by the scheduler
981#D-* Examples: IGCM_sys_updateHeaders /path/to/Job_MYEXP
982#D-
983function IGCM_sys_updateHeaders {
984  IGCM_debug_PushStack "IGCM_sys_updateHeaders"
985  if ( $DEBUG_sys ) ; then
986    echo "IGCM_sys_updateHeaders"
987  fi
988  typeset file
989  file=$1
990
991  if [ ${executionType} -eq 1 ] ; then
992    # MPMD + MPI
993    if [ X${MPIEnvironment} = XIBM ] ; then
994      sed -e "/::openMPthreads::/d"                  \
995        -e "s/::JobNumProcTot::/${coreNumber}/"    \
996        ${file} > ${file}.tmp
997    else
998      sed -e "/::openMPthreads::/d"                  \
999        -e "s/@ job_type = parallel/@ job_type = mpich/" \
1000        -e "s/::JobNumProcTot::/${coreNumber}/"    \
1001        ${file} > ${file}.tmp
1002    fi
1003
1004  elif [ ${executionType} -eq 2 ] ; then
1005    # MPMD + MPI + OMP
1006    if [ X${MPIEnvironment} = XIBM ] ; then
1007      sed -e "s/::openMPthreads::/${openMPthreads}/" \
1008        -e "s/::JobNumProcTot::/${mpiTasks}/"    \
1009        ${file} > ${file}.tmp
1010    else
1011      (( nodeNumber = coreNumber / core_per_node ))
1012      [ $(( ${coreNumber} % ${core_per_node} )) -ne 0 ] && (( nodeNumber = nodeNumber + 1 ))
1013      sed -e "/::openMPthreads::/d"                  \
1014        -e "s/@ job_type = parallel/@ job_type = mpich/" \
1015        -e "s/@ total_tasks = ::JobNumProcTot::/@ node = ${nodeNumber} /"    \
1016        -e "/@ as_limit = 3.5gb/d"      \
1017        -e "s/::JobNumProcTot::/${mpiTasks}/"      \
1018        ${file} > ${file}.tmp
1019    fi
1020
1021  elif [ ${executionType} -eq 3 ] ; then
1022    # SPMD + MPI/OMP
1023    if [ X${MPIEnvironment} = XIBM ] ; then
1024      sed -e "s/::openMPthreads::/${openMPthreads}/" \
1025        -e "s/::JobNumProcTot::/${mpiTasks}/"      \
1026        ${file} > ${file}.tmp
1027    else
1028      sed -e "s/::openMPthreads::/${openMPthreads}/" \
1029        -e "s/@ job_type = parallel/@ job_type = mpich/" \
1030        -e "s/::JobNumProcTot::/${mpiTasks}/"      \
1031        ${file} > ${file}.tmp
1032    fi
1033
1034  elif [ ${executionType} -eq 4 ] ; then
1035    # SPMD + MPI only
1036    if [ X${MPIEnvironment} = XIBM ] ; then
1037      sed -e "s/::JobNumProcTot::/${mpiTasks}/"      \
1038        -e "/::openMPthreads::/d"                  \
1039        ${file} > ${file}.tmp
1040    else
1041      sed -e "s/::JobNumProcTot::/${mpiTasks}/"      \
1042        -e "s/@ job_type = parallel/@ job_type = mpich/" \
1043        -e "/::openMPthreads::/d"                  \
1044        ${file} > ${file}.tmp
1045    fi
1046
1047  elif [ ${executionType} -eq 5 ] ; then
1048    # SPMD + OMP only
1049    sed -e "s/::openMPthreads::/${openMPthreads}/" \
1050        -e "s/@ job_type = parallel/@ job_type = serial/" \
1051        -e "/::JobNumProcTot::/d"                  \
1052      ${file} > ${file}.tmp
1053
1054  elif [ ${executionType} -eq 6 ] ; then
1055    # SEQUENTIAL THEN
1056    sed -e "s/::JobNumProcTot::/1/"                \
1057        -e "s/@ job_type = parallel/@ job_type = serial/" \
1058        -e "/::openMPthreads::/d"                  \
1059      ${file} > ${file}.tmp
1060
1061  fi
1062
1063  IGCM_sys_Mv ${file}.tmp ${file}
1064
1065  IGCM_debug_PopStack "IGCM_sys_updateHeaders"
1066}
1067
1068############################################################
1069# Build MPI/OMP scripts run file (dummy function)
1070
1071#D-#==================================================
1072#D-function IGCM_sys_build_run_file
1073#D-* Purpose: build run file (deprecated)
1074#D-* Examples:
1075#D-
1076function IGCM_sys_build_run_file {
1077
1078  IGCM_debug_Print 3 " dummy function : IGCM_sys_build_run_file "
1079
1080}
1081
1082############################################################
1083# Build MPI/OMP scripts
1084
1085#D-#==================================================
1086#D-function IGCM_sys_build_execution_scripts
1087#D-* Purpose: build execution scripts to be launch by ${HOST_MPIRUN_COMMAND}
1088#D-* Examples:
1089#D-
1090function IGCM_sys_build_execution_scripts
1091{
1092  IGCM_debug_PushStack "IGCM_sys_build_execution_scripts" $@
1093  if ( $DEBUG_sys ) ; then
1094    echo "IGCM_sys_build_execution_scripts " $@
1095  fi
1096
1097  EXECUTION=${HOST_MPIRUN_COMMAND}
1098
1099  # MPMD mode
1100  if ( ${OK_PARA_MPMD} ) ; then
1101
1102    # MPI IBM Environment
1103    if ( [ "X${LOADL_STEP_TYPE}" = "XPARALLEL" ] || [ "X${LOADL_STEP_TYPE}" = "XSERIAL" ] ) ; then
1104      IGCM_debug_Print 1 "You use IBM MPI environment"
1105      if [ -f run_file ] ; then
1106        IGCM_sys_Rm -f run_file
1107      fi
1108      touch run_file
1109
1110      # Build run_file
1111
1112      # First loop on the components for the coupler ie oasis (only if oasis3)
1113      # the coupler ie oasis3 must be the first one
1114      for comp in ${config_ListOfComponents[*]} ; do
1115
1116        eval ExeNameIn=\${config_Executable_${comp}[0]}
1117        eval ExeNameOut=\${config_Executable_${comp}[1]}
1118
1119        # for CPL component only
1120        if [ "X${comp}" = "XCPL" ] ; then
1121
1122          eval comp_proc_mpi_loc=\${${comp}_PROC_MPI}
1123          eval comp_proc_omp_loc=\${${comp}_PROC_OMP}
1124
1125          if ( ${OK_PARA_MPI} ) ; then
1126            (( mpi_count = 1 ))
1127            until [ ${mpi_count} -gt ${comp_proc_mpi_loc} ] ; do
1128              echo "./${ExeNameOut}" >> run_file
1129              (( mpi_count = mpi_count + 1 ))
1130            done
1131          else
1132            echo "./${ExeNameOut} " >> run_file
1133          fi
1134        fi
1135
1136      done
1137
1138      # Then second loop on the components
1139      for comp in ${config_ListOfComponents[*]} ; do
1140
1141        eval ExeNameIn=\${config_Executable_${comp}[0]}
1142        eval ExeNameOut=\${config_Executable_${comp}[1]}
1143
1144        # Only if we really have an executable for the component and not the coupler ie oasis:
1145        if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${comp}" != "XCPL" ] ) ; then
1146
1147          eval comp_proc_mpi_loc=\${${comp}_PROC_MPI}
1148          eval comp_proc_omp_loc=\${${comp}_PROC_OMP}
1149
1150          if ( ${OK_PARA_OMP} ) ; then
1151            # Check if the number of threads is correct
1152            case ${comp_proc_omp_loc} in
1153            1|2|4)
1154              IGCM_debug_Print 1 "You run ${ExeNameOut} on ${comp_proc_omp_loc} OMP threads on IBM MPI Environment"
1155              IGCM_debug_Print 1 "Beware : it may you use more CPU than needed."
1156              ;;
1157            8)
1158              IGCM_debug_Print 1 "You run ${ExeNameOut} on ${comp_proc_omp_loc} OMP threads on IBM MPI Environment"
1159              IGCM_debug_Print 1 "Beware : it may you use more CPU than needed."
1160              IGCM_debug_Print 1 "Beware : these settings should not be used for IPSLCM coupled model!"
1161              ;;
1162            16)
1163              IGCM_debug_Exit "ERROR with OMP parameters !"
1164              IGCM_debug_Print 2 "Beware : ${comp_proc_omp_loc} is too much for MPMD mode"
1165              IGCM_debug_Print 2 "You will use more CPU than needed : try to use Intel-MPI environment to do such a thing !"
1166              IGCM_debug_Verif_Exit
1167              ;;
1168            *)
1169              IGCM_debug_Exit "ERROR with OMP parameters !"
1170              IGCM_debug_Print 2 "${comp_proc_omp_loc} is not possible as number of OMP threads"
1171              IGCM_debug_Print 2 "Only 1,2,4,8,16 as number of OMP threads are possible "
1172              IGCM_debug_Verif_Exit
1173              ;;
1174            esac
1175
1176          fi
1177
1178          if ( ${OK_PARA_MPI} ) ; then
1179            (( mpi_count = 1 ))
1180            until [ ${mpi_count} -gt ${comp_proc_mpi_loc} ] ; do
1181              if ( ${OK_PARA_OMP} ) ; then
1182                echo "env OMP_NUM_THREADS=$comp_proc_omp_loc ./${ExeNameOut}" >> run_file
1183              else
1184                echo "./${ExeNameOut}" >> run_file
1185              fi
1186              (( mpi_count = mpi_count + 1 ))
1187            done
1188          else
1189            echo "./${ExeNameOut} " >> run_file
1190          fi
1191        fi
1192      done
1193      if ( ${OK_PARA_OMP} ) ; then
1194        export KMP_STACKSIZE=200m
1195      fi
1196
1197      EXECUTION="${HOST_MPIRUN_COMMAND} -pgmmodel mpmd -cmdfile ./run_file"
1198
1199      IGCM_sys_Chmod u+x run_file
1200      if ( $DEBUG_sys ) ; then
1201        echo "run_file contains : "
1202        cat run_file
1203      fi
1204
1205
1206    # MPI Intel Environment
1207    else
1208      IGCM_debug_Print 1 "You use Intel MPI environment"
1209
1210      # Only MPI (MPMD)
1211      if  ( ! ${OK_PARA_OMP} ) ; then
1212        init_exec=n
1213 
1214        # First loop on the components for the coupler ie oasis (only if oasis3)
1215        # the coupler ie oasis3 must be the first one
1216        for comp in ${config_ListOfComponents[*]} ; do
1217
1218          eval ExeNameIn=\${config_Executable_${comp}[0]}
1219          eval ExeNameOut=\${config_Executable_${comp}[1]}
1220
1221          # for CPL component only
1222          if [ "X${comp}" = "XCPL"  ]  && [ "X${ExeNameOut}" != X\"\" ] ; then
1223
1224            eval comp_proc_mpi_loc=\${${comp}_PROC_MPI}
1225            eval comp_proc_omp_loc=\${${comp}_PROC_OMP}
1226
1227            echo "#!/bin/ksh" > script_${ExeNameOut}.ksh
1228            echo ""  >> script_${ExeNameOut}.ksh
1229            echo "./${ExeNameOut}" >> script_${ExeNameOut}.ksh
1230            IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh
1231            EXECUTION="${EXECUTION} -np ${comp_proc_mpi_loc} ./script_${ExeNameOut}.ksh"
1232            init_exec=y
1233          fi
1234        done
1235        # Then second loop on the components
1236        for comp in ${config_ListOfComponents[*]} ; do
1237
1238          eval ExeNameIn=\${config_Executable_${comp}[0]}
1239          eval ExeNameOut=\${config_Executable_${comp}[1]}
1240
1241          # Only if we really have an executable for the component and not the coupler ie oasis:
1242          if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${comp}" != "XCPL" ] ) ; then
1243
1244            eval comp_proc_mpi_loc=\${${comp}_PROC_MPI}
1245            eval comp_proc_omp_loc=\${${comp}_PROC_OMP}
1246
1247            echo "#!/bin/ksh" > script_${ExeNameOut}.ksh
1248            echo ""  >> script_${ExeNameOut}.ksh
1249            echo "./${ExeNameOut}" >> script_${ExeNameOut}.ksh
1250            IGCM_sys_Chmod u+x script_${ExeNameOut}.ksh
1251
1252            if [ ${init_exec} = y ] ; then
1253              EXECUTION="${EXECUTION} : -np ${comp_proc_mpi_loc} ./script_${ExeNameOut}.ksh"
1254            else
1255              EXECUTION="${EXECUTION} -np ${comp_proc_mpi_loc} ./script_${ExeNameOut}.ksh"
1256              init_exec=y
1257            fi
1258          fi
1259        done
1260      # MPI-OpenMP (MPMD)
1261      else
1262
1263        # Execution specifications
1264        EXECUTION="${EXECUTION} -configfile run_file"
1265        export KMP_STACKSIZE=200m
1266        if [ -f run_file ] ; then
1267          IGCM_sys_Rm -f run_file
1268        fi
1269        touch run_file
1270
1271        # Initialisation of variables
1272        string_final=""
1273        string_final_hexa=""
1274        current_core=0
1275        executable_nb=1
1276
1277        #  Hosts treatment
1278        for nodes in `echo $LOADL_PROCESSOR_LIST`
1279        do
1280          host[$i]=$nodes
1281          i=$((i+1))
1282        done
1283
1284        # Loop on the components
1285        for comp in ${config_ListOfComponents[*]} ; do
1286
1287          eval ExeNameIn=\${config_Executable_${comp}[0]}
1288          eval ExeNameOut=\${config_Executable_${comp}[1]}
1289
1290          # Not possible if oasis has an executable (i.e old version of oasis3)
1291          if ( [ "X${ExeNameOut}" != X\"\" ] &&  [ "X${comp}" = "XCPL" ] ) ; then
1292            IGCM_debug_Exit "ERROR MPMD with hybrid MPI-OpenMP is not available with oasis3 version"
1293            IGCM_debug_Print 2 "Only available with oasis3-MCT version coupler"
1294            IGCM_debug_Verif_Exit
1295          fi
1296
1297          # Only if we really have an executable for the component :
1298          if [ "X${ExeNameOut}" != X\"\" ] ; then
1299
1300            eval comp_proc_mpi_loc=\${${comp}_PROC_MPI}
1301            eval comp_proc_omp_loc=\${${comp}_PROC_OMP}
1302
1303            # Check if the number of threads is correct
1304            case ${comp_proc_omp_loc} in
1305            1|2|4|8|16)
1306              IGCM_debug_Print 1 "You run ${ExeNameOut} on ${comp_proc_omp_loc} OMP threads"
1307              ;;
1308            *)
1309              IGCM_debug_Exit "ERROR with OMP parameters !"
1310              IGCM_debug_Print 2 "${comp_proc_omp_loc} is not possible as number of OMP threads"
1311              IGCM_debug_Print 2 "Only 1,2,4,8,16 as number of OMP threads are possible "
1312              IGCM_debug_Verif_Exit
1313              ;;
1314            esac
1315
1316
1317            # Build run_file for Ada Intel-MPI environment : method used to assign cores and nodes for the MPI process by using hexadecimal mask
1318            # Example of run_file :
1319            #-host host0 -n 4 -env I_MPI_PIN_DOMAIN=[ff,ff00,ff0000,ff000000] ./a.out
1320            #-host host1 -n 4 -env I_MPI_PIN_DOMAIN=[ff,ff00,ff0000,ff000000] ./a.out
1321            #-host host2 -n 10 -env I_MPI_PIN_DOMAIN=[3,c,30,c0,300,c00,3000,c000,30000,c0000,100000,200000,400000,800000,1000000,2000000,4000000,8000000,10000000,20000000] ./b.out
1322            #-host host2 -n 10 ./c.out
1323            # Example of final command :
1324            # mpirun -configfile run_file
1325
1326            rank=0
1327            # For one specific executable, loop on mpi process
1328            for nb_proc_mpi in `seq 0 $(($comp_proc_mpi_loc-1))`; do
1329              (( index_host = current_core / core_per_node ))
1330              host_value=${host[${index_host}]}
1331              (( slot =  current_core % core_per_node ))
1332              # loop on omp threads for each mpi process (set the appropriate bit to 1 and append it to previous one)
1333              for index in `seq $slot $(($slot+$comp_proc_omp_loc-1))`; do
1334                string_final="1"$string_final
1335              done
1336              # convert binary mask to hexadecimal mask
1337              if [ $rank -ne 0 ] ; then
1338                string_final_hexa=$string_final_hexa","$( printf '%x\n' "$((2#$string_final))" )
1339              else
1340                string_final_hexa=$( printf '%x\n' "$((2#$string_final))" )
1341              fi
1342              # replace bit 1 by bit 0 in order to append next one (next one wil be 1)
1343              string_final=$( echo $string_final | sed "s/1/0/g" )
1344              # mpi rank = mpi_rank + 1
1345              (( rank = rank + 1 ))
1346              # current core takes into account the number of omp threads which was previously append
1347              (( current_core = current_core + comp_proc_omp_loc ))
1348              # We write to the configuration file either we switch to the next node or we switch to the next executable
1349              if ( [ $(( current_core / core_per_node )) -ne $index_host ] || [ $nb_proc_mpi -eq $(($comp_proc_mpi_loc-1)) ] ) ; then
1350                # I_MPI_PIN_DOMAIN variable must be given once per node
1351                if [ $executable_nb -eq 1 ] ; then
1352                  echo "-host $host_value -n $rank -env I_MPI_PIN_DOMAIN=[$string_final_hexa] ./$ExeNameOut" >> run_file
1353                else
1354                  sed -i "/$host_value/s/\]/\,$string_final_hexa\]/g" run_file
1355                  echo "-host $host_value -n $rank ./$ExeNameOut" >> run_file
1356                fi
1357                # +1 for the number of executbale on the same node
1358                if [ $nb_proc_mpi -eq $(($comp_proc_mpi_loc-1)) ] ; then
1359                  (( executable_nb = executable_nb + 1 ))
1360                fi
1361                # Some initializations if we switch to the next node
1362                if [ $(( current_core / core_per_node )) -ne $index_host ] ; then
1363                  string_final=""
1364                  string_final_hexa=""
1365                  rank=0
1366                  executable_nb=1
1367                fi
1368              fi
1369            done
1370
1371          fi
1372        done
1373        IGCM_sys_Chmod u+x run_file
1374        if ( $DEBUG_sys ) ; then
1375          echo "run_file contains : "
1376          cat run_file
1377        fi
1378      fi
1379    fi
1380
1381  # Only one executable (SPMD mode).
1382  else
1383
1384    for comp in ${config_ListOfComponents[*]} ; do
1385
1386      # Only if we really have an executable for the component :
1387      eval ExeNameOut=\${config_Executable_${comp}[1]}
1388      if ( [ "X${ExeNameOut}" != X\"\" ] && [ "X${ExeNameOut}" != "Xinca.dat" ] ) ; then
1389
1390        if ( ${OK_PARA_OMP} ) ; then
1391          eval comp_proc_omp_loc=\${${comp}_PROC_OMP}
1392          export KMP_STACKSIZE=200m
1393          #export KMP_LIBRARY=turnaround
1394          #echo "export KMP_STACKSIZE=3g"  >> script_${ExeNameOut}.ksh
1395          #echo "export KMP_LIBRARY=turnaround"  >> script_${ExeNameOut}.ksh
1396          #echo "export MKL_SERIAL=YES"  >> script_${ExeNameOut}.ksh
1397        fi
1398        if  ( ${OK_PARA_MPI} ) ; then
1399          if ( [ "X${LOADL_STEP_TYPE}" = "XPARALLEL" ] || [ "X${LOADL_STEP_TYPE}" = "XSERIAL" ] ) ; then
1400            EXECUTION="${HOST_MPIRUN_COMMAND} ./${ExeNameOut}"
1401          else
1402            eval comp_proc_mpi_loc=\${${comp}_PROC_MPI}
1403            EXECUTION="${HOST_MPIRUN_COMMAND} -np ${comp_proc_mpi_loc} ./${ExeNameOut}"
1404          fi
1405        else
1406          EXECUTION="/usr/bin/time ./${ExeNameOut}"
1407        fi
1408      fi
1409
1410    done
1411
1412  fi
1413
1414  IGCM_debug_Print 1 "sys ada : execution command is "
1415  IGCM_debug_Print 1 "$EXECUTION"
1416
1417  IGCM_debug_PopStack "IGCM_sys_build_execution_scripts"
1418}
1419
1420#D-#==================================================
1421#D-function IGCM_sys_check_path
1422#D-* Purpose: check that RUN_DIR_PATH that will be removed on some machine
1423#D-* do not point to an important use directory. Stop immediately in that case.
1424#D-* Examples:
1425#D-
1426function IGCM_sys_check_path {
1427  IGCM_debug_PushStack "IGCM_sys_check_path"
1428  if ( $DEBUG_sys ) ; then
1429    echo "IGCM_sys_check_path"
1430  fi
1431
1432  if ( [ X${RUN_DIR_PATH} = X${HOME} ] || [ X${RUN_DIR_PATH} = X${WORKDIR} ] || [ X${RUN_DIR_PATH} = X${ARCHIVE} ] ) ; then
1433    IGCM_debug_Print 1 "Variable RUN_DIR_PATH is pointing to an important directory : ${RUN_DIR_PATH}"
1434    IGCM_debug_Print 1 "Please check the RUN_DIR_PATH definition in your Job : Job_${config_UserChoices_JobName}"
1435    IGCM_debug_Exit "This will stop the job"
1436  fi
1437  IGCM_debug_PopStack "IGCM_sys_check_path"
1438}
1439
1440#D-#==================================================
1441#D-function IGCM_sys_check_quota
1442#D-* Purpose: check user quota. Stop the simulation if quota above 90%
1443#D-* Examples:
1444#D-
1445function IGCM_sys_check_quota {
1446  IGCM_debug_PushStack "IGCM_sys_check_quota"
1447  if ( $DEBUG_sys ) ; then
1448    echo "IGCM_sys_check_quota"
1449  fi
1450  # Limit of quota (in %)
1451  limit_quota=90
1452
1453  # Check of the volume
1454  volume_quota=$(quota_u -w 2>/dev/null| grep 'Quota soft' | gawk '{print $5}')
1455  if [ ! X${volume_quota} = X ] ; then
1456    quota_volume=${volume_quota%%\%}
1457#    echo $quota_volume
1458    if [ $(echo "${quota_volume} > ${limit_quota}" | bc) -eq 1 ] ; then
1459      IGCM_debug_Print 1 "Please, check your quota of volume on workgpfs"
1460      IGCM_debug_Print 1 "${quota_volume}% of your quota is used"
1461      IGCM_debug_Print 1 "Use the quota_u -w command to check"
1462      IGCM_debug_Print 1 "You must have more than 10% available to run"
1463      IGCM_debug_Exit "Not enough space to run ! STOP HERE"
1464      IGCM_debug_Verif_Exit
1465    fi
1466
1467  fi
1468  IGCM_debug_PopStack "IGCM_sys_check_quota"
1469}
1470
1471#D-#==================================================
1472#D-function IGCM_sys_projectAccounting
1473#D-* Purpose: store project accounting information in a file
1474#D-* Examples:
1475#D-
1476function IGCM_sys_projectAccounting {
1477  IGCM_debug_PushStack "IGCM_sys_projectAccounting"
1478  if ( $DEBUG_sys ) ; then
1479    echo "IGCM_sys_check_quota"
1480  fi
1481
1482  cpt > $1
1483
1484  IGCM_debug_PopStack "IGCM_sys_projectAccounting"
1485}
1486
1487#D-#==================================================
1488#D-function IGCM_sys_getJobSchedulerID
1489#D-* Purpose: Get the job ID during execution
1490#D-* Examples: IGCM_sys_getJobSchedulerID jobSchedulerID
1491#D-
1492function IGCM_sys_getJobSchedulerID {
1493  IGCM_debug_PushStack "IGCM_sys_getJobSchedulerID"
1494  if ( $DEBUG_sys ) ; then
1495    echo "IGCM_sys_getJobSchedulerID"
1496  fi
1497
1498  eval ${1}=$( echo $LOADL_STEP_ID | awk -F. '{print $4}' )
1499
1500  IGCM_debug_PopStack "IGCM_sys_getJobSchedulerID"
1501}
1502
1503#D-#==================================================
1504#D-function IGCM_sys_GetJobID
1505#D-* Purpose: Get the job ID from the JobName
1506#D-* Examples: IGCM_sys_GetJobID ${JobName} ${TargetUsr} JobID
1507#D-
1508function IGCM_sys_GetJobID {
1509  IGCM_debug_PushStack "IGCM_sys_GetJobID"
1510  if ( $DEBUG_sys ) ; then
1511    echo "IGCM_sys_GetJobID"
1512  fi
1513
1514  # Print only the full (-W) JobID (%id) and JobName (%jn)
1515  ID=$( llq -u $2 -W -f %id %jn | \
1516    gawk -v JobName=$1 '( $NF ~ JobName ) { print $1 }' )
1517
1518  eval ${3}=${ID}
1519  IGCM_debug_PopStack "IGCM_sys_GetJobID"
1520}
1521
1522#D-#==================================================
1523#D-function IGCM_sys_CountJobInQueue
1524#D-* Purpose: Count number of users job
1525#D-* Examples: IGCM_sys_CountJobInQueue ${JobName} NbRun
1526#D-
1527function IGCM_sys_CountJobInQueue {
1528  IGCM_debug_PushStack "IGCM_sys_CountJobInQueue"
1529  if ( $DEBUG_sys ) ; then
1530    echo "IGCM_sys_CountJobInQueue"
1531  fi
1532
1533  # Print only the full (-W) JobName (%jn)
1534  NbRun=$( llq -W -f %jn | grep -c "$1" )
1535
1536  eval ${2}=${NbRun}
1537
1538  IGCM_debug_PopStack "IGCM_sys_CountJobInQueue"
1539}
1540
1541#D-#==================================================
1542#D-function IGCM_sys_ListJobInQueue
1543#D-* Purpose: Produce a list of users jobs
1544#D-* Examples: IGCM_sys_ListJobInQueue ${User} JobNameList
1545#D-
1546function IGCM_sys_ListJobInQueue {
1547  IGCM_debug_PushStack "IGCM_sys_ListJobInQueue"
1548  if ( $DEBUG_sys ) ; then
1549    echo "IGCM_sys_ListJobInQueue"
1550  fi
1551
1552  # With -W option, column width is as large as necessary
1553  set -A JobList $( llq -u $1 -W -f %jn | head -n -2 | tail -n +3 | \
1554    gawk '( $1 != /TS/      && \
1555                            $1 !~ /PACK/    && \
1556                            $1 !~ /REBUILD/ && \
1557                            $1 !~ /pack/ )     \
1558                          { print $1 }' | sed -e "s/\(.*\)\.[0-9]*/\1/" )
1559
1560  eval set -A ${2} ${JobList[*]}
1561
1562  IGCM_debug_PopStack "IGCM_sys_ListJobInQueue"
1563}
1564
1565#D-#==================================================
1566#D-function IGCM_sys_atlas
1567#D-* Purpose: encapsulate atlas call so as to manage error code and curie specificity
1568#D-* Examples:
1569#D-
1570function IGCM_sys_atlas {
1571  IGCM_debug_PushStack "IGCM_sys_atlas" $@
1572  if ( $DEBUG_sys ) ; then
1573    echo "IGCM_sys_atlas :" $@
1574  fi
1575
1576  typeset status
1577
1578  \atlas $@ > ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$ 2>&1
1579  status=$?
1580  if [ ${status} -gt 0 ] ; then
1581    echo "IGCM_sys_atlas : error code ${status}"
1582    cat ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1583    \rm ${OUTCOMMAND_PATH}/out_command_${LOGIN}.$$
1584    IGCM_debug_PopStack "IGCM_sys_atlas"
1585    return 1
1586  else
1587    IGCM_debug_PopStack "IGCM_sys_atlas"
1588    return 0
1589  fi
1590
1591  IGCM_debug_PopStack "IGCM_sys_atlas"
1592}
1593
1594#D-#==================================================
1595#D-function IGCM_sys_rebuild_nemo
1596#D-* Purpose: rebuild nemo parallel files with general rebuild
1597#D-* Examples:
1598#D-
1599
1600function IGCM_sys_rebuild_nemo {
1601  IGCM_debug_PushStack "IGCM_sys_rebuild_nemo" $@
1602  if ( $DEBUG_sys ) ; then
1603    echo "IGCM_sys_rebuild_nemo :" $@
1604  fi
1605
1606  nemo_generic_restart_file_name_out=${1}
1607  nemo_extension_out=${3}
1608  shift ; shift ; shift
1609
1610  IGCM_sys_rebuild -o ${nemo_generic_restart_file_name_out}.${nemo_extension_out} $@
1611
1612  IGCM_debug_PopStack "IGCM_sys_rebuild_nemo"
1613}
1614
1615
Note: See TracBrowser for help on using the repository browser.