source: trunk/libIGCM/libIGCM_config/libIGCM_config.ksh @ 1370

Last change on this file since 1370 was 1366, checked in by sdipsl, 8 years ago
  • Add a flag to control atlas submission. TRUE by default (ie we submit atlas jobs)
  • 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: 52.5 KB
RevLine 
[2]1#!/bin/ksh
2
3#**************************************************************
4# Author: Sebastien Denvil, Martial Mancip
[373]5# Contact: Sebastien.Denvil__at__ipsl.jussieu.fr Martial.Mancip__at__ipsl.jussieu.fr
6# $Revision::                                          $ Revision of last commit
7# $Author::                                            $ Author of last commit
8# $Date::                                              $ Date of last commit
[2]9# IPSL (2006)
10#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
11#
12#**************************************************************
13
14#===================================
[726]15function IGCM_config_CommonConfiguration
16{
17  IGCM_debug_PushStack "IGCM_config_CommonConfiguration" $@
18
19  # Debug Print :
[769]20  [ ${Verbosity} -gt 0 ] && echo
[726]21  IGCM_debug_Print 1 "IGCM_config_CommonConfiguration" $@
22
23  # config.card path
[1242]24  configCardPath=$1
[726]25
26  #==================================
[1244]27  typeset option auxprint
[726]28
29  #==================================
30  # Read UserChoices section:
[769]31  [ ${Verbosity} -gt 0 ] && echo
[726]32  IGCM_debug_Print 1 "DefineArrayFromOption  : config_UserChoices"
33
[1242]34  IGCM_card_DefineArrayFromSection ${configCardPath} UserChoices
[726]35  for option in ${config_UserChoices[*]} ; do
[1242]36    IGCM_card_DefineVariableFromOption ${configCardPath} UserChoices ${option}
[726]37    eval auxprint=\${config_UserChoices_${option}}
38    IGCM_debug_Print 3 "${option} : ${auxprint}"
39  done
40
41  #==================================
42  # Read Ensemble section:
[769]43  [ ${Verbosity} -gt 0 ] && echo
[726]44  IGCM_debug_Print 1 "DefineArrayFromOption  : config_Ensemble"
45
[1242]46  IGCM_card_DefineArrayFromSection ${configCardPath} Ensemble
[726]47  for option in ${config_Ensemble[*]} ; do
[1242]48    IGCM_card_DefineVariableFromOption ${configCardPath} Ensemble ${option}
[726]49    eval auxprint=\${config_Ensemble_${option}}
50    IGCM_debug_Print 3 "${option} : ${auxprint}"
51  done
52
53  #==================================
54  # Read Post section:
[769]55  [ ${Verbosity} -gt 0 ] && echo
[726]56  IGCM_debug_Print 1 "DefineArrayFromOption : config_Post"
57
[1242]58  IGCM_card_DefineArrayFromSection ${configCardPath} Post
[726]59  for option in ${config_Post[*]} ; do
[1242]60    IGCM_card_DefineVariableFromOption ${configCardPath} Post ${option}
[726]61    eval auxprint=\${config_Post_${option}}
62    IGCM_debug_Print 3 "${option} : ${auxprint}"
63  done
[769]64  [ ${Verbosity} -gt 0 ] && echo
[726]65
[728]66  #==================================
67  # Define default value to keep compatibility with previous card: means before changes due to TGCC
68  # Apply some overrules to ensure proper usage of computing centres resources
[804]69  #
[728]70  if [ X${PackDefault} = Xtrue ] ; then
71    if [ X${config_UserChoices_SpaceName} = XTEST ]; then
72      # TEST simulations will not be packed and will stay on SCRATCHDIR filesystem
73      IGCM_debug_Print 1 "SpaceName=TEST. OVERRULE PackFrequency to NONE"
74      config_Post_PackFrequency=NONE
75    else
76      # Default to RebuildFrequency if nothing has been set up related to PackFrequency
77      [ X${config_Post_PackFrequency} = X ] && config_Post_PackFrequency=${config_Post_RebuildFrequency}
78    fi
79  else
80    # If we DO NOT apply pack in this computing center
81    config_Post_PackFrequency=NONE
82  fi
83
[726]84  #====================================================
[1057]85  # Define ARCHIVE : Dedicated to large files
86  # Define STORAGE : Dedicated to small/medium files
87  # Define R_OUT   : Output tree located on ARCHIVE
[1150]88  # Define R_BUF   : Output tree located on STORAGE (files waiting treatment, or file lcoation when SpaceName=!PROD)
[1057]89  # Define R_FIG   : Output tree located on STORAGE hosting figures (monitoring and atlas, and/or small files)
[1150]90  # Define R_TMP   : A temporary space used by IGCM_debug_send_AMQP_msg__MAILTUNNEL. Must be persistent in between jobs
[1057]91  IGCM_sys_defineArchives
92
93  #====================================================
[726]94  # R_SAVE : Job output directory
95  # R_BUFR : Job output buffered directory
96
97  if ( [ ! X${config_UserChoices_SpaceName} = X ] && [ ! X${config_UserChoices_ExperimentName} = X ] ) ; then
98    FreeName=$( echo ${config_UserChoices_JobName} | sed 's/.*_//' )
99    if ( [ ! X${config_Ensemble_EnsembleName} = X ] && [ ! X${config_Ensemble_EnsembleDate} = X ] ) ; then
100      R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${FreeName}
101      R_FIGR=${R_FIG}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${FreeName}
102      R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${FreeName}
103      R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${FreeName}
104    else
105      R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
106      R_FIGR=${R_FIG}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
107      R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
108      R_DODS=${config_UserChoices_TagName}/${config_UserChoices_SpaceName}/${config_UserChoices_ExperimentName}/${FreeName}
109    fi
110  else
111    if ( [ ! X${config_Ensemble_EnsembleName} = X ] && [ ! X${config_Ensemble_EnsembleDate} = X ] ) ; then
112      R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${config_UserChoices_JobName}
113      R_FIGR=${R_FIG}/${config_UserChoices_TagName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${config_UserChoices_JobName}
114      R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${config_UserChoices_JobName}
115      R_DODS=${config_UserChoices_TagName}/${config_Ensemble_EnsembleName}/${config_Ensemble_EnsembleDate}/${config_UserChoices_JobName}
116    else
117      R_SAVE=${R_OUT}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
118      R_FIGR=${R_FIG}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
119      R_BUFR=${R_BUF}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
120      R_DODS=${config_UserChoices_TagName}/${config_UserChoices_JobName}
121    fi
122  fi
123
[782]124  #====================================================
[1110]125  # Define R_OUT_KSH : Storage place for job output
126  # Define R_OUT_EXE : Storage place for binary used during simulation
127  R_OUT_KSH=${R_SAVE}/Out
128  R_OUT_EXE=${R_SAVE}/Exe
129
130  #====================================================
131  # Define R_BUF_KSH : Buffer place for job output
132  # Define R_BUF_EXE : Buffer place for binary used during simulation
133  R_BUF_KSH=${R_BUFR}/Out
134  R_BUF_EXE=${R_BUFR}/Exe
135
136  #====================================================
[1077]137  # Define REBUILD_DIR : where we store files needing rebuild process
[1031]138  REBUILD_DIR=${R_BUFR}/REBUILD
139  if [ ! X${TaskType} = Xchecking ] ; then
140    IGCM_sys_MkdirWork ${REBUILD_DIR}
[782]141  fi
142
[903]143  #====================================================
144  # DodsCopy : apply default value if not defined
145  if ( [ X${config_Post_DodsCopy} = X${NULL_STR} ] || [ X${config_Post_DodsCopy} = X ] ) ; then
146    config_Post_DodsCopy=TRUE
147  fi
148
[1115]149  #====================================================
[1366]150  # AtlasIPSL : apply default value if not defined
151  if ( [ X${config_Post_AtlasIPSL} = X${NULL_STR} ] || [ X${config_Post_AtlasIPSL} = X ] ) ; then
152    config_Post_AtlasIPSL=TRUE
153  fi
154
155  #====================================================
[1335]156  # MetricsPCMDI : apply default value if not defined
157  if ( [ X${config_Post_MetricsPCMDI} = X${NULL_STR} ] || [ X${config_Post_MetricsPCMDI} = X ] ) ; then
158    config_Post_MetricsPCMDI=FALSE
159  fi
160
161  #====================================================
[1204]162  # IgnoreNonMonotonic : apply default value if not defined
163  if ( [ X${config_Post_IgnoreNonMonotonic} = X${NULL_STR} ] || [ X${config_Post_IgnoreNonMonotonic} = X ] ) ; then
164    config_Post_IgnoreNonMonotonic=FALSE
165  fi
166
167  #====================================================
[1115]168  # Define StackFileLocation : directory where we store stack files
169  # Define StackFileName : stack file containing call tree and instrumentation
170  # Stack file containing call tree will be stored there.
171  if ( $DEBUG_debug ) ; then
172    StackFileLocation=${StackFileLocation:=${R_BUF_KSH}}
173    [ ! -d ${StackFileLocation} ] && mkdir -p ${StackFileLocation}
174    if [ X${TaskType} = Xcomputing ]; then
175      StackFileName=computing.stack.$$
176    elif [ X${TaskType} = Xpost-processing ]; then
177      StackFileName=${Script_Post_Output}.stack.$$
178    elif [ X${TaskType} = Xchecking ]; then
179      StackFileName=checking.stack.$$
180    else
181      IGCM_debug_Exit "IGCM_config_CommonConfiguration unknown TaskType : ${TaskType}"
182      IGCM_debug_Verif_Exit
183    fi
184
185    # This boolean will trigger the filling of the stack
186    # Only now we know where things should be ...
[1127]187    # We don't fill the stack when we perform checking task
188    if [ ! X${TaskType} = Xchecking ] ; then
189      ActivateStackFilling=true
190    fi
[1115]191  fi
192
[726]193  IGCM_debug_PopStack "IGCM_config_CommonConfiguration"
194}
195
196#===================================
[2]197function IGCM_config_Initialize
198{
[544]199  IGCM_debug_PushStack "IGCM_config_Initialize"
[2]200
[544]201  # Debug Print :
202  echo
203  IGCM_debug_Print 1 "IGCM_config_Initialize"
[2]204
[544]205  # Test modipsl tree existence.
206  IGCM_sys_TestDir ${MODIPSL}
207  [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDir"
208  IGCM_sys_TestDir ${libIGCM}
209  [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDir"
210  IGCM_sys_TestDir ${R_EXE}
211  [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDir"
212  IGCM_sys_TestDir ${SUBMIT_DIR}
213  [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDir"
[2]214
[544]215  if ( $DEBUG_debug ) ; then
216    echo "Keep trace of inital SUBMIT_DIR : "
217    ls -lta ${SUBMIT_DIR}
218  fi
[144]219
[544]220  #==================================
[619]221  # Read ListOfComponents section:
[726]222  echo
223  IGCM_debug_Print 1 "DefineArrayFromSection : ListOfComponents"
224
[544]225  IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card ListOfComponents
226  for comp in ${config_ListOfComponents[*]} ; do
227    IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/config.card ListOfComponents ${comp}
228  done
229  IGCM_debug_Print 3 ${config_ListOfComponents[*]}
[2]230
[544]231  #==================================
[726]232  # Read Executable section:
[544]233  IGCM_card_DefineArrayFromSection   ${SUBMIT_DIR}/config.card Executable
[619]234
[544]235  #==================================
[726]236  # Read Restarts section:
237  # Restarts : Gerneral rule or local for each component.
238  echo
239  IGCM_debug_Print 1 "DefineArrayFromOption : config_Restarts"
240
241  IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/config.card Restarts
242  for option in ${config_Restarts[*]} ; do
243    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/config.card Restarts ${option}
244    eval auxprint=\${config_Restarts_${option}}
245    IGCM_debug_Print 3 "${option} : ${auxprint}"
246  done
247
248  #==================================
249  # Define Job Outputs Name
250  echo
[544]251  IGCM_debug_Print 2 "Define Script_Output_Prefix and Exe_Output"
[939]252  Script_Output_Prefix=${config_UserChoices_Script_Output_Prefix:='Script_Output'}
[544]253  IGCM_debug_Print 3 "Script_Output_Prefix = ${Script_Output_Prefix}"
[939]254  Exe_Output=out_execution
[544]255  IGCM_debug_Print 3 "Exe_Output           = ${Exe_Output}"
[2]256
[544]257  #===================================================================#
258  # Prepare variables available for ${COMP}.card and ${COMP}.driver   #
259  #             But available to any son functions                    #
260  #===================================================================#
[2]261
[544]262  # Convert yyyy-mm-dd date to gregorian yyyymmdd
263  DateBegin=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} )
[619]264  DateEnd=$(   IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd}   )
[2]265
[544]266  # Period Length In Days between DateBegin and DateEnd
267  (( ExperienceLengthInDays=$( IGCM_date_DaysBetweenGregorianDate ${DateEnd} ${DateBegin} )  + 1 ))
268  if [ ${ExperienceLengthInDays} -lt 0 ] ; then
269    IGCM_debug_Print 1 "Problem with dates in config.card : ${DateEnd} < ${DateBegin} ! You must check that."
270    IGCM_debug_Exit "IGCM_config_Initialize" " Wrong Dates."
[619]271    IGCM_debug_Verif_Exit
[544]272  fi
[2]273
[544]274  # Day and Year of Initial State (Given in julian format)
275  InitDay=$(( $( IGCM_date_ConvertGregorianDateToJulian $DateBegin ) % 1000 ))
276  InitYear=$(( $( IGCM_date_ConvertGregorianDateToJulian $DateBegin ) / 1000 ))
[2]277
[544]278  #================================================================#
279  #                  Test and Prepare directories                  #
280  #================================================================#
[2]281
[544]282  # ==> 4 kinds of input files :
283  #     1) R_INIT  : Initial State Files   (Etat0, carteveg)
284  #     2) R_BC    : Boundary Conditions   (Forcages, lai)
285  #     3) Parameters files (allready define through ${SUBMIT_DIR})
286  #     4) Restarts files   (allready define in IGCM_config_Initialize)
[2]287
[544]288  # Here we offer the possibility to redefine R_INIT, R_BC
289  # and PeriodNb through config.card
290  R_INIT=${config_UserChoices_R_INIT:=${R_IN}/INIT}
[731]291  echo
[544]292  IGCM_debug_Print 2 "(Re)Define R_INIT, R_BC and PeriodNb"
293  IGCM_debug_Print 3 "R_INIT=${R_INIT}"
294  R_BC=${config_UserChoices_R_BC:=${R_IN}/BC}
295  IGCM_debug_Print 3  "R_BC=${R_BC}"
296  PeriodNb=${config_UserChoices_PeriodNb:=${PeriodNb}}
297  IGCM_debug_Print 3  "Loop in main Job with ${PeriodNb} period(s)"
[2]298
[771]299  # SD ADA SPECIFIC #
300  #      TO FIX     #
301  #IGCM_sys_TestDirArchive ${R_IN}
302  #[ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive"
303
[619]304  if ( ${FirstInitialize} ) ; then
[726]305    IGCM_sys_MkdirArchive   ${R_SAVE}
[805]306    [ ! ${config_Post_PackFrequency} = NONE ] && IGCM_sys_Mkdir ${R_BUFR}
[544]307  else
308    IGCM_sys_TestDirArchive ${R_SAVE}
309    [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDirArchive ${R_SAVE}"
[2]310
[805]311    if [ ! ${config_Post_PackFrequency} = NONE ] ; then
312      IGCM_sys_TestDir ${R_BUFR}
313      [ $? != 0 ] && IGCM_debug_Exit "IGCM_sys_TestDir ${R_BUFR}"
314    fi
[545]315
[1220]316    # Test state of run in run.card. Will schedule an exit if another process setted it to "Fatal"
317    IGCM_config_StateCheck
[619]318
[1220]319    # And EXIT if not OK
320    IGCM_debug_Verif_Exit
[544]321  fi
[2]322
[544]323  #====================================================
[619]324  # Experience type : DEB(ug), DEV(elopment), RUN
[544]325  if [ X${JobType} != XRUN ] ; then
326    echo
327    echo "===================================================="
328    echo "libIGCM JOB is NOT in RUN type mode."
329    echo "!! OUTPUT files will NOT be PROTECTED !!"
330    echo "Be carefull : you can ERASE the result of this job !"
[128]331
[544]332    case ${JobType} in
333    DEB)
334      echo "DEBUG mode : activation of 'set -vx' mode."
335      echo "DEBUG mode : no protection for output files."
336      echo "DEBUG mode : if active force asynchronous rebuild frequency to PeriodLength frequency."
337      ;;
338    DEV)
339      echo "DEVelopment mode : no protection for output files."
340      echo "DEVelopment mode : if active force asynchronous rebuild frequency to PeriodLength frequency."
341      ;;
342    esac
[166]343
[544]344    if ( [ X${config_Post_RebuildFrequency} != XNONE ] && [ ${DRYRUN} -eq 0 ] ) ; then
345      if [ X${config_Post_RebuildFrequency} != X${config_UserChoices_PeriodLength} ] ; then
[619]346        echo "------------"
347        echo "WARNING : Job is NOT in RUN mode then we will force REBUILD Frequency"
[786]348        echo "          to PeriodLength : ${config_UserChoices_PeriodLength}"
[619]349        echo "------------"
350        config_Post_RebuildFrequency=${config_UserChoices_PeriodLength}
[544]351      fi
[128]352    fi
[544]353    echo "===================================================="
354    echo
355  fi
[128]356
[544]357  IGCM_debug_PopStack "IGCM_config_Initialize"
[2]358}
359
360#===================================
[890]361function IGCM_config_DaysInPeriodLength
[118]362{
[890]363  IGCM_debug_PushStack "IGCM_config_DaysInPeriodLength"
[118]364
[544]365  typeset i
[124]366
[544]367  # Determine number of day(s) in PeriodLength :
368  case ${config_UserChoices_PeriodLength} in
369  *Y|*y)
[619]370    PeriodLengthInYears=$( echo ${config_UserChoices_PeriodLength} | sed -e 's/[yY]//' )
[731]371    echo
[544]372    IGCM_debug_Print 2 "Number of years for PeriodLength : ${PeriodLengthInYears}"
373    PeriodLengthInDays=0
374    i=0
[619]375    until [ $i -ge $PeriodLengthInYears ] ; do
376      (( PeriodLengthInDays = PeriodLengthInDays + $( IGCM_date_DaysInYear $(( year + i )) ) ))
377      (( i=i+1 ))
378    done
[544]379    ;;
380  *M|*m)
[619]381    PeriodLengthInMonths=$( echo ${config_UserChoices_PeriodLength} | sed -e 's/[mM]//' )
[731]382    echo
[544]383    IGCM_debug_Print 2 "Number of months for PeriodLength : ${PeriodLengthInMonths}"
384    PeriodLengthInDays=0
385    i=0
[619]386    until [ $i -ge $PeriodLengthInMonths ] ; do
[829]387      if [ $(( 10#${month} + ${i} )) -lt 13 ] ; then
388        (( PeriodLengthInDays  = PeriodLengthInDays + $( IGCM_date_DaysInMonth $year $(( 10#${month} + ${i} )) ) ))
[619]389      else
[829]390        (( PeriodLengthInDays  = PeriodLengthInDays + $( IGCM_date_DaysInMonth $year $(( 10#${month} + ${i} - 12 )) ) ))
[619]391      fi
392      (( i=i+1 ))
393    done
[544]394    ;;
[619]395  *D|*d)
[544]396    PeriodLengthInMonths=0
[731]397    PeriodLengthInDays=$( echo ${config_UserChoices_PeriodLength} | sed -e 's/[dD]//' )
398    echo
399    IGCM_debug_Print 2 "Number of days for PeriodLength : ${PeriodLengthInDays}";;
[619]400  *)
[890]401    IGCM_debug_Exit "IGCM_config_DaysInPeriodLength " ${config_UserChoices_PeriodLength} " invalid period length : choose in *Y, *M, *D."
[544]402    IGCM_debug_Verif_Exit ;;
403  esac
[118]404
[890]405  IGCM_debug_PopStack "IGCM_config_DaysInPeriodLength"
[380]406}
[118]407
[380]408#===================================
[890]409function IGCM_config_DateCoherency
[891]410{
[890]411  IGCM_debug_PushStack "IGCM_config_DateCoherency"
412
413  echo
414  IGCM_debug_Print 1 "IGCM_config_DateCoherency"
415  echo
416
417  typeset Length VerifiedPeriodDateBegin VerifiedPeriodDateEnd
418
419  # check coherency between (PeriodDateBegin, PeriodDateEnd) and (DateBegin, CumulPeriod, PeriodLength)
420  # DateBegin + CumulPeriod*PeriodLength = PeriodDateBegin
421  echo
[922]422
[890]423  case ${config_UserChoices_PeriodLength} in
424  *Y|*y)
425    Length=$( IGCM_date_DaysInCurrentPeriod ${DateBegin} $(( ${CumulPeriod} * ${PeriodLengthInYears} ))Y )
426    ;;
427  *M|*m)
428    Length=$( IGCM_date_DaysInCurrentPeriod ${DateBegin} $(( ${CumulPeriod} * ${PeriodLengthInMonths} ))M )
429    ;;
430  *D|*d)
431    Length=$( IGCM_date_DaysInCurrentPeriod ${DateBegin} $(( ${CumulPeriod} * ${PeriodLengthInDays} ))D )
432    ;;
433  esac
[892]434  VerifiedPeriodDateEnd=$( IGCM_date_AddDaysToGregorianDate ${DateBegin} ${Length}-1 )
[890]435
[892]436  if [ ${VerifiedPeriodDateEnd} != ${PeriodDateEnd} ] ; then
437    IGCM_debug_Print 1 "From run.card PeriodDateEnd is not consistent with DateBegin and CumulPeriod."
438    IGCM_debug_Print 1 "We have DateBegin = ${DateBegin}"
439    IGCM_debug_Print 1 "We have CumulPeriod = ${CumulPeriod}"
440    IGCM_debug_Print 1 "We have PeriodDateEnd = ${PeriodDateEnd}"
441    IGCM_debug_Print 1 "We have VerifiedPeriodDateEnd = ${VerifiedPeriodDateEnd}"
442    IGCM_debug_Print 1 "You must have change run.card in an inconsistent way."
443
444    IGCM_debug_Exit "STOP here to avoid further issues."
445  fi
446
[890]447  # PeriodDateBegin + PeriodLength = PeriodDateEnd
448  VerifiedPeriodDateBegin=$( IGCM_date_AddDaysToGregorianDate ${VerifiedPeriodDateEnd} $(( ${PeriodLengthInDays} * -1 )) )
449
450  IGCM_debug_PopStack "IGCM_config_DateCoherency"
451}
452
[1220]453#===================================
454function IGCM_config_StateCheck
455{
456  IGCM_debug_PushStack "IGCM_config_StateCheck"
[890]457
[1220]458    #Test state of run in run.card
459    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodState
460
461    if [ ${run_Configuration_PeriodState} = "Fatal" ] ; then
462      echo
463      IGCM_debug_Print 1 "!! Error in run.card with PeriodState : " ${run_Configuration_PeriodState} "!!"
[1280]464      IGCM_debug_Print 1 "Check the overall status of your simulation by visiting this page:"
465      IGCM_debug_Print 1 "http://prodiguer-test-web.ipsl.fr/static/simulation.detail.html?uid=${simuid}"
[1220]466      IGCM_debug_Print 1 "Then try running ${libIGCM}/clean_month.job to rerun one period"
467      IGCM_debug_Print 1 "Then try running ${libIGCM}/clean_year.job to rerun more."
468      IGCM_debug_Exit
[1280]469    elif [ $( echo ${run_Configuration_PeriodState} | grep Fatal | wc -l ) -eq 1 ] ; then
470      echo
471      IGCM_debug_Print 1 "!! Error in run.card with PeriodState : " ${run_Configuration_PeriodState} "!!"
472      IGCM_debug_Print 1 "Compute jobs has been stop because at least the above mentionned post-processing jobs fails."
473      IGCM_debug_Print 1 "Check post-processing jobs carefully by visiting this page:"
474      IGCM_debug_Print 1 "http://prodiguer-test-web.ipsl.fr/static/simulation.detail.html?uid=${simuid}"
475      IGCM_debug_Print 1 "Please visit that page to see how to fix issues:"
476      IGCM_debug_Print 1 "https://forge.ipsl.jussieu.fr/igcmg_doc/wiki/DocGmonitor"
477      IGCM_debug_Print 1 "Then try running ${libIGCM}/clean_month.job to rerun one period"
478      IGCM_debug_Print 1 "Then try running ${libIGCM}/clean_year.job to rerun more."
479      IGCM_debug_Exit
[1220]480    fi
481
482  IGCM_debug_PopStack "IGCM_config_StateCheck"
483}
484
[890]485#===================================
[380]486function IGCM_config_Check
487{
[544]488  IGCM_debug_PushStack "IGCM_config_Check"
[380]489
[544]490  # If one of the following modulo is not zero :
491  # we will issue an error then explain and exit in
492  # AA_job IGCM_debug_Verif_Exit call before binary submission
[380]493
[544]494  echo
495  IGCM_debug_Print 1 "IGCM_config_Check"
496  echo
497
498  typeset i
499
[554]500  # Check RebuildFrequency against key frequencies : PeriodLength ; PackFrequency ; TimeSeriesFrequency ; SeasonalFrequency
[545]501  if ( [ ! X${config_Post_RebuildFrequency} = X${NULL_STR} ] && [ ! X${config_Post_RebuildFrequency} = XNONE ] ) ; then
[544]502    AsynchronousRebuild=true
503    IGCM_debug_Print 1 "Asynchronous rebuild has been activated."
[380]504    echo
[544]505    # modulo (RebuildFrequency and PeriodLength/TimeSeriesFrequency/SeasonalFrequency) must be zero
506    IGCM_debug_Print 1 "Check coherence between RebuildFrequency and PeriodLength"
507    IGCM_post_CheckModuloFrequency config_Post_RebuildFrequency config_UserChoices_PeriodLength
[554]508    IGCM_debug_Print 1 "Check coherence between PackFrequency and RebuildFrequency"
509    IGCM_post_CheckModuloFrequency config_Post_PackFrequency config_Post_RebuildFrequency
[544]510    IGCM_debug_Print 1 "Check coherence between TimeSeriesFrequency and RebuildFrequency"
511    IGCM_post_CheckModuloFrequency config_Post_TimeSeriesFrequency config_Post_RebuildFrequency
512    IGCM_debug_Print 1 "Check coherence between SeasonalFrequency and RebuildFrequency"
513    IGCM_post_CheckModuloFrequency config_Post_SeasonalFrequency config_Post_RebuildFrequency
514  else
515    AsynchronousRebuild=false
516    IGCM_debug_Print 1 "Asynchronous rebuild has not been activated"
517    IGCM_debug_Print 1 "Proceed with standard post-treatment pathway"
[380]518    echo
[554]519    #modulo (PeriodLength and TimeSeriesFrequency/SeasonalFrequency) must be zero
[544]520    IGCM_debug_Print 1 "Check coherence between TimeSeriesFrequency and PeriodLength"
521    IGCM_post_CheckModuloFrequency config_Post_TimeSeriesFrequency config_UserChoices_PeriodLength
522    IGCM_debug_Print 1 "Check coherence between SeasonalFrequency and PeriodLength"
523    IGCM_post_CheckModuloFrequency config_Post_SeasonalFrequency   config_UserChoices_PeriodLength
524  fi
[380]525
[619]526  # Check PackFrequency against other key frequencies
[554]527  # Modulo (PackFrequency and TimeSeriesFrequency/SeasonalFrequency and PeriodLenght) must be zero
528  if ( [ ! X${config_Post_PackFrequency} = X${NULL_STR} ] && [ ! X${config_Post_PackFrequency} = XNONE ] ) ; then
529    Pack=true
530    #
531    IGCM_debug_Print 1 "Check coherence between PackFrequency and PeriodLength"
532    IGCM_post_CheckModuloFrequency config_Post_PackFrequency config_UserChoices_PeriodLength
533    IGCM_debug_Print 1 "Check coherence between TimeSeriesFrequency and PackFrequency"
534    IGCM_post_CheckModuloFrequency config_Post_TimeSeriesFrequency config_Post_PackFrequency
535    IGCM_debug_Print 1 "Check coherence between SeasonalFrequency and PackFrequency"
536    IGCM_post_CheckModuloFrequency config_Post_SeasonalFrequency config_Post_PackFrequency
537  else
538    Pack=false
539  fi
540
[890]541  # modulo (TimeSeriesFrequency and all Chunck2D) must be zero
[544]542  NbJob=${#CHUNCK2D_SIZE[@]}
543  i=0
544  until [ $i -ge $NbJob ]; do
545    value=${CHUNCK2D_SIZE[${i}]}
[1214]546    IGCM_debug_Print 1 "Check coherence between ${CHUNCK2D_NAME[${i}]} Chunck2D frequency and TimeSeriesFrequency"
[544]547    IGCM_post_CheckModuloFrequency value config_Post_TimeSeriesFrequency
[619]548    case ${value} in
549    *Y|*y) ;;
[786]550    *)
551      IGCM_debug_Print 1 "All ChunckJob2D frequency must be expressed in year *Y|*y in comp.card"
[544]552      IGCM_debug_Exit "This will stop the job" ;;
553    esac
554    (( i=i+1 ))
555  done
[387]556
[890]557  # modulo (TimeSeriesFrequency and all Chunck3D) must be zero
[544]558  NbJob=${#CHUNCK3D_SIZE[@]}
559  i=0
560  until [ $i -ge $NbJob ]; do
561    value=${CHUNCK3D_SIZE[${i}]}
[1214]562    IGCM_debug_Print 1 "Check coherence between ${CHUNCK3D_NAME[${i}]} Chunck3D frequency and TimeSeriesFrequency"
[544]563    IGCM_post_CheckModuloFrequency value config_Post_TimeSeriesFrequency
[619]564    case ${value} in
565    *Y|*y) ;;
[786]566    *)
567      IGCM_debug_Print 1 "All ChunckJob3D frequency must be expressed in year *Y|*y in comp.card"
[544]568      IGCM_debug_Exit "This will stop the job" ;;
569    esac
570    (( i=i+1 ))
571  done
[380]572
[890]573  # check to be sure there is enough space on temporary filesystems to run
[731]574  echo
[651]575  IGCM_debug_Print 1 "Check if there is enough space on temporary filesystem"
576  IGCM_sys_check_quota
577
[933]578  # check to be sure that RUN_DIR_PATH, that will be removed is not pointing to an important directory
579  echo
580  IGCM_debug_Print 1 "Check where RUN_DIR_PATH variable is pointing to"
581  IGCM_sys_check_path
582
583
[544]584  IGCM_debug_PopStack "IGCM_config_Check"
[118]585}
586
587#===================================
[1242]588function IGCM_config_ConfigureExecution
[1230]589{
[1242]590  IGCM_debug_PushStack " IGCM_config_ConfigureExecution"
[1230]591
[1250]592  #echo
[1242]593  IGCM_debug_Print 1 " IGCM_config_ConfigureExecution"
[1250]594  #echo
[1230]595
[1242]596  typeset ExeNameIn ExeNameFirst CompNameFirst configCardPath comp i
[1230]597  typeset tempvar tempvarMPI tempvarNOD NbElts NbExec
598
[1242]599  # config.card path
600  configCardPath=$1
601
[1235]602  coreNumber=0
603  mpiTasks=0
[1238]604  openMPthreads=0
[1230]605  NbExec=0
606
607  OK_PARA_MPI=false
608  OK_PARA_OMP=false
609  OK_PARA_NOD=false
610  OK_PARA_MPMD=false
611
612  for comp in ${config_ListOfComponents[*]} ; do
613
[1242]614    # Manage component executable
615    IGCM_card_DefineArrayFromOption ${configCardPath} Executable ${comp}
616
[1230]617    eval ExeNameIn=\${config_Executable_${comp}[0]}
618
619    # NO order in config.card for parallelized values !
620    # just use suffix : MPI , OMP and NOD (for number of NODes.)
621
622    # NOD is the number of NODes allocated
623    eval ${comp}_PROC_NOD=0
624
625    # MPI is the number of MPI processus per nodes
626    eval ${comp}_PROC_MPI=0
627
628    # OMP is the number of OpenMP threads per MPI processus
629    eval ${comp}_PROC_OMP=0
630
631    # Only if we really have an executable for the component :
632    if ( [ "X${ExeNameIn}" != X\"\" ] && [ "X${ExeNameIn}" != "Xinca.dat" ] ) ; then
633
[1250]634      IGCM_debug_Print 1 ${comp}
635
[1230]636      # Keep the first executable found and the first CompName
637      ExeNameFirst=${ExeNameIn}
638      CompNameFirst=${comp}
639
640      # Are we a second executable?
641      (( NbExec = NbExec + 1 ))
642
643      # set 1 MPI task, 1 OpenMP thread and 1 node as default
644      eval ${comp}_PROC_MPI=1
645      eval ${comp}_PROC_OMP=1
646      eval ${comp}_PROC_NOD=1
647
648      eval NbElts=\${#config_Executable_${comp}[@]}
649
[1252]650      if [ ${NbElts} -gt 2 ] ; then
[1230]651        #
652        # CURRENT METHOD TO SPECIFY MPI AND OMP RESSOURCES
653        #
654        i=2
655        while [ ${i} -lt ${NbElts} ] ; do
656          eval tempvar=\${config_Executable_${comp}[${i}]}
657          IGCM_debug_Print 2 ${tempvar}
658
659          if [ X${tempvar} = X ] ; then
660            IGCM_debug_Print 2 "Error reading MPI/OMP parameters !!!"
661            IGCM_debug_Exit "Check your config.card. Exit now"
662            IGCM_debug_Verif_Exit
663          fi
664
665          case ${tempvar} in
666          *[mM][pP][iI]*)
667            # Read MPI parameter for composante
668            eval ${comp}_PROC_MPI=$( echo ${tempvar} | tr '[a-z]' '[A-Z]' | sed -e "s/MPI//" )
669            OK_PARA_MPI=true;;
670          *[oO][mM][pP]*)
671            # Read OMP parameter for composante
672            eval ${comp}_PROC_OMP=$( echo ${tempvar} | tr '[a-z]' '[A-Z]' | sed -e "s/OMP//" )
673            ;;
674          *[nN][oO][dD]*)
675            # Read NOD (NumBer of Nodes) parameter for composante
676            eval ${comp}_PROC_NOD=$( echo ${tempvar} | tr '[a-z]' '[A-Z]' | sed -e "s/NOD//" )
677            OK_PARA_NOD=true
678            OK_PARA_MPI=true
679            ;;
680          esac
681          (( i = i + 1 ))
682        done
683      else
684        #
[1250]685        # BACKWARD COMPATIBILITY NOT SUPPORTED ANYMORE
[1230]686        #
[1253]687        IGCM_debug_Exit "You are using a deprecated ressources specification mechanism in your config.card"
688        IGCM_debug_Exit "Please check : https://forge.ipsl.jussieu.fr/igcmg_doc/wiki/DocEsetup#ThesectionExecutable"
[1270]689        IGCM_debug_Exit "Please modify ${configCardPath}"
[1252]690        exit
[1230]691      fi
692      eval tempvarMPI=\${${comp}_PROC_MPI}
693      eval tempvarNOD=\${${comp}_PROC_NOD}
694      eval tempvarOMP=\${${comp}_PROC_OMP}
695
696      # set OMP mode if more than 1 OMP thread.
697      [ ${tempvarOMP} -ge 2 ] && OK_PARA_OMP=true
698
[1238]699      # Number of OMP threads
700      [ ${openMPthreads} -lt ${tempvarOMP} ] && openMPthreads=${tempvarOMP}
701
[1235]702      # SUM UP NUMBER OF CORES
703      (( coreNumber = coreNumber + tempvarMPI * tempvarNOD * tempvarOMP ))
704
705      # SUM UP NUMBER OF MPI TASKS
706      (( mpiTasks = mpiTasks + tempvarMPI * tempvarNOD ))
[1230]707    fi
708  done
709
[1248]710  # MANDATORY FOR THE OPA9.DRIVER. USED TO EDIT OPA NAMELIST
711  # WE SHOULD PLANIFY NUM_PROC_??? DEPRECATION
712  NUM_PROC_CPL=${CPL_PROC_MPI}
713  NUM_PROC_OCE=${OCE_PROC_MPI}
714  NUM_PROC_ATM=${ATM_PROC_MPI}
715
[1230]716  # set MPMD mode if more than 2 executable names.
717  [ ${NbExec} -ge 2 ] && OK_PARA_MPMD=true 
718
719  # Define the execution type we are running in
[1255]720  if ( ${OK_PARA_MPMD} ) ; then
721    if ( ${OK_PARA_MPI} ) ; then
[1238]722      # MPMD always implies MPI
[1230]723      executionType=1
724    fi
[1255]725    if ( ${OK_PARA_OMP} ) ; then
[1238]726      # MPMD + MPI/OMP
[1230]727      executionType=2
728    fi
729  else
[1255]730    if ( ( ${OK_PARA_MPI} ) && ( ${OK_PARA_OMP} ) ) ; then
[1238]731      # SPMD + MPI/OMP
[1230]732      executionType=3
[1255]733    elif ( ( ${OK_PARA_MPI} ) && ( ! ${OK_PARA_OMP} ) ) ; then
[1230]734      # SPMD + MPI only
735      executionType=4
[1255]736    elif ( ( ! ${OK_PARA_MPI} ) && ( ${OK_PARA_OMP} ) ) ; then
[1230]737      # SPMD + OMP only
738      executionType=5
[1255]739    elif ( ( ! ${OK_PARA_MPI} ) && ( ! ${OK_PARA_OMP} ) ) ; then
[1230]740      # SEQUENTIAL THEN
741      executionType=6
[1235]742      coreNumber=1
[1230]743    fi
744  fi
745
[1235]746  IGCM_debug_Print 1 "MPI/OMP treatment coreNumber = ${coreNumber}"
[1242]747  IGCM_debug_Print 1 "MPI/OMP treatment mpiTasks = ${mpiTasks}"
748  IGCM_debug_Print 1 "MPI/OMP treatment openMPthreads = ${openMPthreads}"
749  IGCM_debug_Print 1 "MPI/OMP treatment executionType = ${executionType}"
[1230]750
[1242]751  IGCM_debug_PopStack "IGCM_config_ConfigureExecution"
[1230]752}
753
754#===================================
[2]755function IGCM_config_PeriodStart
756{
[544]757  IGCM_debug_PushStack "IGCM_config_PeriodStart"
[2]758
[544]759  echo
760  IGCM_debug_Print 1 "IGCM_config_PeriodStart"
761  echo
[2]762
[544]763  if ( ${FirstInitialize} ) ; then
764    #================================================#
765    #         Initialize date/period information     #
766    #================================================#
[2]767
[890]768    IGCM_date_GetYearMonthDay ${DateBegin} year month day
769    IGCM_config_DaysInPeriodLength
[2]770
[939]771    PeriodDateBegin=${DateBegin}
[544]772    PeriodDateEnd=$( IGCM_date_AddDaysToGregorianDate ${DateBegin} $(( ${PeriodLengthInDays} - 1 )) )
[939]773    CumulPeriod=1
[2]774
[544]775    #=================================================#
776    #              Write updated run.card             #
777    #=================================================#
[2]778
[544]779    #Correct run.card Configuration for this period
780    IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodDateBegin ${PeriodDateBegin}
781    IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodDateEnd ${PeriodDateEnd}
782    IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration CumulPeriod ${CumulPeriod}
783    if [ X$( grep "SubmitPath" ${SUBMIT_DIR}/run.card ) != X ] ; then
784      IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration SubmitPath ${SUBMIT_DIR}
785    fi
[427]786
[544]787    IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Running"
[619]788
[544]789  else
790    #================================================#
791    #         The file run.card allready exist       #
792    #================================================#
[2]793
[1220]794    # Test state of run in run.card. Will schedule an exit if another process setted it to "Fatal"
795    IGCM_config_StateCheck
796    # And EXIT if not OK
797    IGCM_debug_Verif_Exit
[2]798
[544]799    #===================================#
[786]800    #        Read updated run.card      #
[544]801    #===================================#
[2]802
[544]803    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodDateBegin
804    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration PeriodDateEnd
805    IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/run.card Configuration CumulPeriod
[2]806
[544]807    PeriodDateBegin=$( IGCM_date_ConvertFormatToGregorian ${run_Configuration_PeriodDateBegin} )
808    PeriodDateEnd=$( IGCM_date_ConvertFormatToGregorian ${run_Configuration_PeriodDateEnd} )
[939]809    CumulPeriod=${run_Configuration_CumulPeriod}
[2]810
[1028]811    LastPeriodDateEnd=$( IGCM_date_AddDaysToGregorianDate $( IGCM_date_ConvertFormatToGregorian ${PeriodDateBegin} ) -1 )
[471]812
[544]813    if [ ${Period} = 1 ]; then
[910]814      # save last Job output and current run.card
815      typeset Potential
816      IGCM_sys_Cd ${SUBMIT_DIR}
817      #
818      IGCM_debug_Print 2 "Save previous ksh job output"
819      for Potential in $( ls ${Script_Output_Prefix}_${config_UserChoices_JobName}.[0-9][0-9][0-9][0-9][0-9][0-9] ) ; do
820        if [ X${Pack} = Xtrue ] ; then
[1103]821          ( IGCM_sys_TestFileBuffer  ${R_BUF_KSH}/${Potential} ) || IGCM_sys_Cp ${Potential} ${R_BUF_KSH}/${Potential}.$$
[910]822        else
[1103]823          ( IGCM_sys_TestFileArchive ${R_OUT_KSH}/${Potential} ) || IGCM_sys_Cp ${Potential} ${R_OUT_KSH}/${Potential}.$$
[910]824        fi
825      done
826      #
827      IGCM_debug_Print 2 "Save current run.card"
[544]828      IGCM_card_CheckConflict run.card
[634]829      if [ X${Pack} = Xtrue ] ; then
[1103]830        IGCM_sys_Cp ${SUBMIT_DIR}/run.card ${R_BUF_KSH}/run.card
[634]831      else
[1103]832        IGCM_sys_Cp ${SUBMIT_DIR}/run.card ${R_OUT_KSH}/run.card
[634]833      fi
[910]834      #
[544]835      IGCM_sys_Cd ${RUN_DIR}
836    else
837      unset FileToBeDeleted
838    fi
[2]839
[892]840    # Determine number of day(s) in PeriodLength
[544]841    IGCM_date_GetYearMonthDay $PeriodDateBegin year month day
[890]842    IGCM_config_DaysInPeriodLength
[2]843
[892]844    # Check coherency between (PeriodDateBegin, PeriodDateEnd) and (DateBegin, CumulPeriod, PeriodLength)
845    IGCM_config_DateCoherency
846    # And EXIT if not OK
847    IGCM_debug_Verif_Exit
848
[1220]849    # Test state of run in run.card. Will schedule an exit if another process setted it to "Fatal"
850    IGCM_config_StateCheck
851    # And EXIT if not OK
852    IGCM_debug_Verif_Exit
853
854    # We can say we are "Running" now.
[544]855    IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Running"
[890]856  fi
[2]857
[544]858  # BEGIN: SHOULD GO IN A FUNCTION FROM libIGCM_date.ksh
859  # Compute year_m1 and year_p1 (year minus 1Y and year plus 1Y)
860  year_m1=$(( year - 1 ))
[619]861  year_p1=$(( year + 1 ))
[544]862  # Compute month_m1 (month minus 1M)
863  # Compute yyyymm_m1 (yyyymm minus 1M)
[829]864  month_m1=$(( 10#${month} - 1 ))
[544]865  if [ ${month_m1} = 0 ]; then
866    month_m1=12
867    yyyymm_m1=${year_m1}12
868  elif [ ${month_m1} -le 9 ]; then
869    month_m1=0${month_m1}
870    yyyymm_m1=${year}${month_m1}
871  else
872    yyyymm_m1=${year}${month_m1}
873  fi
874  # Compute month_p1 (month plus 1M)
875  # Compute yyyymm_p1 (yyyymm plus 1M)
[829]876  month_p1=$(( 10#${month} + 1 ))
[544]877  if [ ${month_p1} = 13 ]; then
878    month_p1=01
879    yyyymm_p1=${year_p1}01
880  elif [ ${month_p1} -le 9 ]; then
881    month_p1=0${month_p1}
882    yyyymm_p1=${year}${month_p1}
883  else
884    yyyymm_p1=${year}${month_p1}
885  fi
[522]886
[799]887  #===================================================================#
888  # Calculate CyclicYear to be used for looping over a given forcing  #
889  # period. Add CyclicBegin and CyclicEnd in config.card UserChoices. #
890  #===================================================================#
891
892  # To use the variable CyclicYear, one must add in config.card CyclicBegin and CyclicEnd.
893  # CyclicBegin is the first year in the cycle. CyclicEnd is the last year included in the cycle.
894  if ( [ ! X${config_UserChoices_CyclicBegin} = X ] && [ ! X${config_UserChoices_CyclicEnd} = X ] ) ; then
895    CycleNb=$(( ${config_UserChoices_CyclicEnd} - ${config_UserChoices_CyclicBegin} + 1 ))
[819]896    CyclicYear_p1=NOTDEFINED
897
898    # For current year
899    yeartmp=$year
900    diffy=$(( $yeartmp - ${config_UserChoices_CyclicBegin} ))
901    while [ $diffy -lt 0 ] ; do
902      yeartmp=$(( ${yeartmp} + ${CycleNb} ))
903      diffy=$(( $yeartmp - ${config_UserChoices_CyclicBegin} ))
904    done
905    CyclicYear=$(( ( ${diffy} % ${CycleNb} ) + ${config_UserChoices_CyclicBegin} ))
906
907    # For next coming year
908    yeartmp=$(( $year + 1 ))
909    diffy=$(( $yeartmp - ${config_UserChoices_CyclicBegin} ))
910    while [ $diffy -lt 0 ] ; do
911      yeartmp=$(( ${yeartmp} + ${CycleNb} ))
912      diffy=$(( $yeartmp - ${config_UserChoices_CyclicBegin} ))
913    done
914    CyclicYear_p1=$(( ( ${diffy} % ${CycleNb} ) + ${config_UserChoices_CyclicBegin} ))
915
[812]916    IGCM_debug_Print 1 "CyclicYear   = ${CyclicYear}, CyclicYear_p1 = ${CyclicYear_p1}, current year=$year"
[799]917  else
918    CyclicYear="ERROR_CyclicYear_Variable_Not_Defined"
[812]919    CyclicYear_p1="ERROR_CyclicYear_p1_Variable_Not_Defined"
[819]920    IGCM_debug_Print 1 "CyclicYear wont be use without adding CyclicBegin and CyclicEnd in config.card"
[799]921  fi
922
[544]923  # END: SHOULD GO IN A FUNCTION FROM libIGCM_date.ksh
[522]924
[544]925  #===================================================================#
926  # Prepare variables available for ${COMP}.card and ${COMP}.driver   #
[786]927  #             But available to any son functions                    #
[544]928  #===================================================================#
[2]929
[544]930  # Period Length In Days between DateBegin and DateCurrent (at end of period == PeriodDateEnd !)
931  (( SimulationLengthInDays = $( IGCM_date_DaysBetweenGregorianDate ${PeriodDateEnd} ${DateBegin} ) + 1 ))
[2]932
[544]933  # Debug Print :
[731]934  echo
[544]935  IGCM_debug_Print 1 "IGCM_config_PeriodStart : Before Execution"
936  IGCM_debug_Print 1 "Year of simulation      : ${year}"
937  IGCM_debug_Print 1 "Month of simulation     : ${month}"
938  IGCM_debug_Print 1 "PeriodLengthInDays      : ${PeriodLengthInDays}"
939  IGCM_debug_Print 1 "PeriodDateBegin         : ${PeriodDateBegin}"
940  IGCM_debug_Print 1 "PeriodDateEnd           : ${PeriodDateEnd}"
941  IGCM_debug_Print 1 "SimulationLengthInDays  : ${SimulationLengthInDays}"
942  IGCM_debug_Print 1 "ExperienceLengthInDays  : ${ExperienceLengthInDays}"
[2]943
[544]944  #================================================================#
945  #         Prepare variables available for comp_finalyze          #
946  #================================================================#
[2]947
[544]948  # Period for save files
[939]949  DatesPeriod=${PeriodDateBegin}_${PeriodDateEnd}
[2]950
[544]951  # Prefix for save files of this period
[939]952  PREFIX=${config_UserChoices_JobName}_${DatesPeriod}
[2]953
[544]954  # List of files that will be deleted in RUN_DIR after run
955  [ -f stack ] && FileToBeDeleted[0]="stack"
[2]956
[544]957  # Test if the same run as already been saved :
958  if [ X${JobType} = XRUN ] ; then
959    if [ ${DRYRUN} -le 0 ] ; then
960      if ( IGCM_sys_TestFileBuffer ${R_BUF_KSH}/${PREFIX}_${Exe_Output} ) ; then
[619]961        IGCM_debug_Exit "IGCM_config_PeriodStart" "You are currently RErunning an old job."
962        IGCM_debug_Print 1 "Because of readonly permissions, you can't RErun a job when saved files"
963        IGCM_debug_Print 1 " are still in the ARCHIVE directory. You must deleted those files, or "
964        IGCM_debug_Print 1 " the whole ${R_SAVE} tree. See clean_month.job in ${libIGCM} directory."
965        IGCM_debug_Print 1 " This exit has been initiated because at least ${R_BUF_KSH}/${PREFIX}_${Exe_Output} exists."
966        IGCM_debug_Verif_Exit
[544]967      fi
[2]968    fi
[544]969  else
970    if ( IGCM_sys_TestFileBuffer ${R_BUF_KSH}/${PREFIX}_${Exe_Output} ) ; then
971      IGCM_debug_Print 1 "IGCM_config_PeriodStart" "RErun an old job. Allowed in DEBUG or DEV mode."
972    fi
973  fi
[128]974
[939]975  #================================================================#
976  #       Prepare variables available for binary execution         #
[1009]977  #       Call function for creation of run script                 #
978  #       Only done once per job                                   #
[939]979  #================================================================#
[616]980
[1009]981  if [ ${Period} -eq 1 ]; then
[1230]982    # Define the execution context (MPMD, SPMD, MPI/OMP ...)
[1242]983    IGCM_config_ConfigureExecution ${SUBMIT_DIR}/config.card
[1230]984    # Create the execution script for the current context
[1009]985    IGCM_sys_build_execution_scripts
986  fi
[616]987
[544]988  ExecutionFail=false
[473]989
[1332]990  # Update the rabbitMQ queue
991  IGCM_debug_BigBro_Update
992
[544]993  IGCM_debug_PopStack "IGCM_config_PeriodStart"
[2]994}
995
996#===================================
[523]997function IGCM_config_SaveSourceModifications
998{
[544]999  IGCM_debug_PushStack "IGCM_config_SaveSourceModifications"
[523]1000
[544]1001  typeset ExeOutDateMax listVarEnv
1002  ExeOutDateMax=$1
[523]1003
[544]1004  listVarEnv="ExeOutDateMax,R_OUT_EXE,PREFIX,SUBMIT_DIR"
1005  IGCM_sys_RshMaster "\
[545]1006    . ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh; \
[544]1007    export ExeOutDateMax=${ExeOutDateMax};\
[545]1008    export R_OUT_EXE=${R_OUT_EXE};\
1009    export PREFIX=${PREFIX};\
1010    export SUBMIT_DIR=${SUBMIT_DIR};\
1011    export listVarEnv=${listVarEnv};\
1012    Script_Output=out_SaveSourceModifications;\
1013    IGCM_sys_Qsub ${libIGCM}/SaveSourceModifications.job ${ExeOutDateMax} ${R_OUT_EXE} ${PREFIX} ${SUBMIT_DIR}"
[523]1014
[544]1015  IGCM_debug_PopStack "IGCM_config_SaveSourceModifications"
[523]1016}
1017
1018#===================================
[2]1019function IGCM_config_PeriodEnd
1020{
[544]1021  IGCM_debug_PushStack "IGCM_config_PeriodEnd"
[2]1022
[544]1023  echo
1024  IGCM_debug_Print 1 "IGCM_config_PeriodEnd"
1025  echo
[2]1026
[622]1027  if [ ${DRYRUN} -le 1 ] ; then
[457]1028
[622]1029    IGCM_debug_Print 1 "Check components binary : size and creation date"
[2]1030
[622]1031    typeset LS_comp LS_bin ExeDate ExeCpuLog NextExeSize LastCompExeSize
1032    typeset comp i
1033    typeset ExeNameIn ExeNameOut UpdateExe ExeSecDateMax
[2]1034
[622]1035    #==================================#
1036    #        Get last Exe Size         #
1037    #==================================#
[2]1038
[622]1039    (( i=0 ))
1040    if ( ${FirstInitialize} ) ; then
1041      run_Log_LastExeSize=""
1042      for comp in ${config_ListOfComponents[*]} ; do
1043        run_Log_LastExeSize[$i]=0
1044        (( i=i+1 ))
1045      done
1046    else
1047      IGCM_card_DefineArrayFromOption ${SUBMIT_DIR}/run.card Log LastExeSize
1048    fi
1049    #==================================#
1050    #         And Build ExeDate        #
1051    #==================================#
[2]1052
[622]1053    # ExeDate = ATM_Jun_12_09:34-SRF_Jun_12_09:34-OCE_Jun_12_09:34-ICE_Jun_12_09:34-CPL_Jun_12_09:33
1054    # Would be nice to have next line but no way to format ls output (need to ls -l --time-style "+%Y-%m-%dT%H:%M")
1055    # ExeDate = ATM_2009-06-12T09:34+SRF_2009-06-12T09:34+OCE_2009-06-12T09:34+ICE_2009-06-12T09:34+CPL_2009-06-12T09:34
1056    ExeDate=""
1057    NextExeSize="( "
1058    (( i=0 ))
1059    UpdateExe=false
1060    (( ExeSecDateMax = 0 ))
1061    for comp in ${config_ListOfComponents[*]} ; do
[2]1062
[622]1063      IGCM_debug_Print 3 ${comp}
[2]1064
[622]1065      eval ExeNameIn=\${config_Executable_${comp}[0]}
1066      eval ExeNameOut=\${config_Executable_${comp}[1]}
1067      # Only if we really have an executable for the component :
1068      if [ X${ExeNameIn} = X\"\" ] ; then
1069        # If there is no exe file for this component
1070        (( ExeSize=0 ))
[619]1071      else
[939]1072        LS_bin=${R_EXE}/${ExeNameIn}
[622]1073        IGCM_sys_FileSize ${LS_bin} ExeSize
1074
1075        set +A LS_comp -- $( LC_TIME=en_US ls -l ${LS_bin} )
1076        if [ X${ExeDate} = X ] ; then
1077          # First component exe date
1078          ExeDate=${comp}_${LS_comp[5]}_${LS_comp[6]}
1079        else
1080          ExeDate=${ExeDate}-${comp}_${LS_comp[5]}_${LS_comp[6]}
1081        fi
1082        ExeDate=${ExeDate}_${LS_comp[7]}
[619]1083      fi
[2]1084
[622]1085      if [ ${i} -eq 0 ] ; then
1086        # First component
1087        NextExeSize="( "${ExeSize}
[619]1088      else
[622]1089        NextExeSize=${NextExeSize}", "${ExeSize}
[619]1090      fi
[939]1091      LastCompExeSize=${run_Log_LastExeSize[$i]}
[622]1092      (( i=i+1 ))
[523]1093
[622]1094      if [ ${ExeSize} -ne ${LastCompExeSize} ] ; then
1095        if ( ${FirstInitialize} ) ; then
1096          IGCM_debug_Print 1 "Save first ${ExeNameIn} in ${R_OUT_EXE} !"
1097        else
1098          IGCM_debug_Print 1 "${ExeNameIn} has changed in ${R_EXE} !"
1099          IGCM_debug_Print 1 "Save latest ${ExeNameIn} in ${R_OUT_EXE} !"
[939]1100          FileToBeDeleted[${#FileToBeDeleted[@]}]=${ExeNameOut}
[622]1101        fi
[939]1102        IGCM_sys_Put_Out ${ExeNameOut} ${R_OUT_EXE}/${PREFIX}_${ExeNameIn} rw
[622]1103        UpdateExe=true
1104
[691]1105        # SD : switch off for now
1106        #IGCM_sys_GetDate_FichWork ${LS_bin} ExeSecDate
1107        #if [ $ExeSecDateMax -lt $ExeSecDate ] ; then
1108        #  ExeSecDateMax=$ExeSecDate
1109        #fi
[619]1110      fi
[622]1111    done
[2]1112
[622]1113    # SD : switch off for now
1114    #if ( ${UpdateExe} ) ; then
1115    #  echo "Launch SaveSourceModifications."
1116    #  IGCM_config_SaveSourceModifications ${ExeSecDateMax}
1117    #fi
[523]1118
[622]1119    NextExeSize=${NextExeSize}" )"
1120    IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Log LastExeSize "${NextExeSize}"
[457]1121
[622]1122    if [ ${DRYRUN} -le 1 ] ; then
1123      tail -1500 ${Exe_Output} > ${Exe_Output}_tail.txt
1124      ExeCpuLog=$( gawk -f ${libIGCM}/libIGCM_sys/IGCM_add_out.awk ${Exe_Output}_tail.txt )
1125      RET=$?
1126      if [ $RET -eq 0 ] ; then
1127        # ExeCpuLog variable contents 5 fields
1128        echo "${CumulPeriod} ${PeriodDateBegin} ${PeriodDateEnd} ${ExeCpuLog} ${ExeDate}" |   \
1129          gawk '{printf("# %11d | %15s | %15s | %19s | %19s | %15.5f | %15.5f | %15.5f | %s\n", \
[544]1130            $1,$2,$3,$4,$5,$6,$7,$8,$9)}' >> ${SUBMIT_DIR}/run.card
[622]1131      fi
[939]1132      FileToBeDeleted[${#FileToBeDeleted[@]}]=${Exe_Output}_tail.txt
[619]1133    fi
[622]1134
[619]1135  fi
[2]1136
[1041]1137  #==================================#
1138  #         Save Job output          #
1139  #==================================#
1140  if [ X${Pack} = Xtrue ] ; then
1141    IGCM_sys_PutBuffer_Out ${Exe_Output} ${R_BUF_KSH}/${PREFIX}_${Exe_Output}
1142  else
1143    IGCM_sys_Put_Out ${Exe_Output} ${R_OUT_KSH}/${PREFIX}_${Exe_Output}
1144  fi
1145  FileToBeDeleted[${#FileToBeDeleted[@]}]=${Exe_Output}
1146
[622]1147  # All was right ? no ? then we stop.
[619]1148  IGCM_debug_Verif_Exit
[2]1149
[622]1150  # If all was OK, we can delete all files not necessary for next Job
[619]1151  echo
1152  IGCM_debug_Print 1 "Files that will be deleted before next period-run : "
[2]1153
[619]1154  if [ ${DRYRUN} -le 2 ] ; then
1155    for f in ${FileToBeDeleted[@]} ; do [ -f ${f} ] && ls -la $f ; [ -f ${f} ] && rm -f $f ; done
1156  else
1157    echo ${FileToBeDeleted[@]}
1158  fi
[2]1159
[922]1160  # Send some accounting element to the user if CumulPeriod=3
1161  if [ ${CumulPeriod} -eq 3 ] ; then
1162    echo
1163    IGCM_debug_Print 1 "Send email containing some accounting information : "
1164
1165    RealCpuTime=$( echo ${ExeCpuLog} | gawk '{print $3}' )
1166
[1235]1167    consumeHoursPerPeriod=$( echo "scale=6;${RealCpuTime}*${coreNumber}/3600" | bc )
[922]1168
1169    consumeHoursPerWholeSimulation=$( echo "scale=6;${consumeHoursPerPeriod}/${PeriodLengthInDays}*${ExperienceLengthInDays}" | bc )
1170
[1235]1171    recommendedPeriodNb=$( echo "scale=6;${jobWarningDelay}/3600/${consumeHoursPerPeriod}*${coreNumber}" | bc )
[922]1172
1173    IGCM_sys_SendMail Accounting
1174  fi
1175
[622]1176  #=================================================#
1177  #         Modification of libIGCM behaviour       #
1178  #=================================================#
[119]1179
[622]1180  # To use this function, one must copy libIGCM.card from ${libIGCM} directory
1181  # and put it in ${SUBMIT_DIR} directory. After modifications of ${SUBMIT_DIR}/libIGCM.card,
1182  # variables define inside [UserChanges] will be modified for next Period of libIGCM main loop.
[619]1183  if [ -f ${SUBMIT_DIR}/libIGCM.card ] ; then
1184    echo
1185    echo "########################################################################"
1186    echo "!!!                 Modification of libIGCM behaviour                !!!"
1187    echo
[119]1188
[619]1189    IGCM_debug_Print 1 "DefineArrayFromOption  : libIGCM_UserChanges in libIGCM.card"
1190    IGCM_card_DefineArrayFromSection ${SUBMIT_DIR}/libIGCM.card UserChanges
1191    IGCM_debug_Print 2 "libIGCM_UserChanges" ${libIGCM_UserChanges[*]}
[119]1192
[622]1193    # Special treatments for libIGCM internals
[619]1194    for option in ${libIGCM_UserChanges[*]} ; do
1195      IGCM_card_DefineVariableFromOption ${SUBMIT_DIR}/libIGCM.card UserChanges ${option}
[119]1196
[619]1197      echo "We will change : ${option}."
1198      eval echo "Previous value : " \${${option}}
1199      eval echo "Change to : " \${libIGCM_UserChanges_${option}}
[119]1200
[619]1201      eval ${option}=\${libIGCM_UserChanges_${option}}
[119]1202
[619]1203      case ${option} in
1204      config_UserChoices_DateEnd)
1205        IGCM_debug_PrintVariables 1 config_UserChoices_DateEnd
1206        DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )
1207
[622]1208        # Period Length In Days between DateBegin and DateEnd
[619]1209        (( ExperienceLengthInDays=$( IGCM_date_DaysBetweenGregorianDate ${DateEnd} ${DateBegin} )  + 1 ))
1210        if [ ${ExperienceLengthInDays} -lt 0 ] ; then
1211          IGCM_debug_Print 1 "Problem with dates in libIGCM.card : ${DateEnd} < ${DateBegin} ! You must check that."
[939]1212          IGCM_debug_Exit "IGCM_PeriodEnd have wrong dates."
[619]1213          IGCM_debug_Verif_Exit
1214        fi
1215        ;;
1216      config_UserChoices_PeriodLength)
1217        IGCM_debug_Print 1  "Change config_UserChoices_PeriodLength=${config_UserChoices_PeriodLength}"
1218        ;;
1219      PeriodNb)
1220        IGCM_debug_Print 1  "Loop in main Job with ${PeriodNb} period(s)"
1221        ;;
1222      config_Post_RebuildFrequency)
1223        IGCM_debug_Print 1  "Change config_Post_RebuildFrequency=${config_Post_RebuildFrequency} : IGCM_post_Configure"
1224        IGCM_post_Configure
1225        ;;
1226      config_Post_TimeSeriesFrequency)
[653]1227        IGCM_debug_Print 1  "Change config_Post_TimeSeriesFrequency = ${config_Post_TimeSeriesFrequency} : IGCM_post_Configure"
[619]1228        IGCM_post_Configure
1229        ;;
1230      config_Post_SeasonalFrequency)
[653]1231        IGCM_debug_Print 1  "Change config_Post_SeasonalFrequency = ${config_Post_SeasonalFrequency} : IGCM_post_Configure"
[619]1232        IGCM_post_Configure
1233        ;;
1234      esac
1235    done
[119]1236
[619]1237    echo
1238    echo "########################################################################"
1239    echo
[544]1240  fi
[119]1241
[544]1242  #=================================================#
1243  #         Determine next computed period          #
1244  #=================================================#
[2]1245
[544]1246  PeriodDateBegin=$( IGCM_date_AddDaysToGregorianDate ${PeriodDateEnd} 1 )
1247  IGCM_date_GetYearMonthDay $PeriodDateBegin year month day
1248  year_m1=$(( year - 1 ))
1249  year_p1=$(( year + 1 ))
[890]1250  IGCM_config_DaysInPeriodLength
[544]1251  PeriodDateEnd=$( IGCM_date_AddDaysToGregorianDate ${PeriodDateBegin} $(( ${PeriodLengthInDays} - 1 )) )
[2]1252
[544]1253  # Debug Print :
1254  echo
1255  IGCM_debug_Print 1 "IGCM_config_PeriodEnd : Preparing Next Execution"
1256  IGCM_debug_Print 1 "PeriodDateBegin       : ${PeriodDateBegin}"
1257  IGCM_debug_Print 1 "PeriodDateEnd         : ${PeriodDateEnd}"
1258  IGCM_debug_Print 1 "PeriodLengthInDays    : ${PeriodLengthInDays}"
[2]1259
[544]1260  PeriodDateBegin=$( IGCM_date_ConvertFormatToHuman ${PeriodDateBegin} )
1261  PeriodDateEnd=$( IGCM_date_ConvertFormatToHuman ${PeriodDateEnd} )
[2]1262
[544]1263  (( CumulPeriod = CumulPeriod + 1 ))
[2]1264
[544]1265  # Debug Print :
1266  echo
1267  IGCM_debug_Print 3 "PeriodDateBegin Human : ${PeriodDateBegin}"
1268  IGCM_debug_Print 3 "PeriodDateEnd Human   : ${PeriodDateEnd}"
1269  IGCM_debug_Print 3 "CumulPeriod           : ${CumulPeriod}"
[2]1270
[544]1271  #=================================================#
[786]1272  #             Write updated run.card              #
[544]1273  #=================================================#
[2]1274
[544]1275  IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodDateBegin ${PeriodDateBegin}
1276  IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodDateEnd ${PeriodDateEnd}
1277  IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration CumulPeriod ${CumulPeriod}
[2]1278
[544]1279  if ( ${FirstInitialize} ) ; then
1280    # It's no more the first time
1281    FirstInitialize=false
1282  fi
[446]1283
[544]1284  IGCM_debug_PopStack "IGCM_config_PeriodEnd"
[2]1285}
1286
1287#===================================
1288function IGCM_config_Finalize
1289{
[544]1290  IGCM_debug_PushStack "IGCM_config_Finalize"
[2]1291
[544]1292  echo
1293  IGCM_debug_Print 1 "IGCM_config_Finalize"
1294  echo
[2]1295
[1220]1296  # Test state of run in run.card. Will schedule an exit if another process setted it to "Fatal"
1297  IGCM_config_StateCheck
1298
1299  # And EXIT if not OK
1300  IGCM_debug_Verif_Exit
1301
[544]1302  if [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ; then
1303    #==========================#
1304    # End of entire simulation #
1305    #==========================#
[1189]1306    simulationIsOver=true
[2]1307
[544]1308    # Mail notification
1309    IGCM_sys_SendMail
1310    #
1311    IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "Completed"
[920]1312    #
[544]1313    IGCM_debug_Print 1 "Normal End of computation."
[873]1314
[544]1315  else
1316    #=================#
1317    # Submit next job #
1318    #=================#
[1189]1319    simulationIsOver=false
[2]1320
[544]1321    IGCM_card_WriteOption ${SUBMIT_DIR}/run.card Configuration PeriodState "OnQueue"
[2]1322
[544]1323    # Name of next Ksh Script output :
[939]1324    Script_Output=${Script_Output_Prefix}_${config_UserChoices_JobName}.$( printf "%06d" ${CumulPeriod} )
[2]1325
[544]1326    IGCM_debug_Print 1 "Submit next job"
[922]1327    # SUBMIT NEXT JOB from SUBMIT_DIR and come back in RUN_DIR
1328    IGCM_sys_Cd ${SUBMIT_DIR}
[544]1329    # Keep only the 5 latest ${Script_Output_Prefix}_${config_UserChoices_JobName}
1330    ScriptTot=$( ls ${Script_Output_Prefix}_${config_UserChoices_JobName}.?????? 2>/dev/null | wc -l )
1331    [ ${ScriptTot} -gt 5 ] && rm -f $( ls ${Script_Output_Prefix}_${config_UserChoices_JobName}.?????? | head -$(( ${ScriptTot} - 5 )) )
[861]1332    # Submit next job and come back
[544]1333    IGCM_sys_Qsub ${SUBMIT_DIR}/Job_${config_UserChoices_JobName}
[861]1334    IGCM_sys_Cd -
[544]1335  fi
[154]1336
[804]1337  # Clean ${RUN_DIR}=${RUN_DIR_PATH}/${config_UserChoices_JobName}.${$}
[544]1338  # Only for production run (No clean up in DEV or DEB mode)
1339  # and command sent from .. directory.
1340  IGCM_sys_Cd ..
[943]1341  [ X${JobType} = XRUN ] && IGCM_sys_RmRunDir -rf ${RUN_DIR_PATH}
[544]1342
[1189]1343  # Inform the rabbitMQ queue
1344  IGCM_debug_BigBro_Finalize
[1076]1345
[544]1346  IGCM_debug_PopStack "IGCM_config_Finalize"
[2]1347}
1348
1349#===================================
Note: See TracBrowser for help on using the repository browser.