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

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