source: trunk/libIGCM/AA_SE_Checker

Last change on this file was 1603, checked in by aclsce, 6 months ago
  • Changed libIGCM behaviour in case of pb in pack_output.job : now, we exit from the job if there is any problem, whatever we are in PROD, DEVT, TEST mode.
  • Specification of pack frequency per file :

In order to reduce the number of inodes, it is possible to specify by file the frequency of packing. The syntax to do that is in the 4th column of OutputFiles? section of the component.card, for example as follows in lmdz.card :
[OutputFiles?]
List= (histmth.nc, ${R_OUT_ATM_O_M}/${PREFIX}_1M_histmth.nc, Post_1M_histmth, 100Y), \

(histday.nc, ${R_OUT_ATM_O_D}/${PREFIX}_1D_histday.nc, Post_1D_histday, 10Y), \

...

In this example, histmth files will be packed every 100 years and histday files will be packed every 10 years.
The pack frequency you defined in config.card is the frequency of pack by default, that means if a specific frequency of pack is specified for a file in a component.card, this file will be packed at the specific frequency whereas all other files will be packed at global pack frequency (specified in config.card) and in this case, the frequency pack (from the config.card) is the frequency the pack_output job will be launched at.
There is a constraint to use this fonctionality : the Packfrequency you defined in config.card must be greater or equal to the pack frequencies you specified for each type of file in component.card, otherwise the computing job will be stopped (with an explicit error message).
Surpack mode :
A surpack mode functionality is available through the use of pack_output.job. To enable this functionality, you have to put "surpack_mode=y" (default value is n). The way to use is similar to restart post-processing pack_output jobs, as indicated here : http://forge.ipsl.jussieu.fr/igcmg_doc/wiki/Doc/CheckDebug#RestartPack_output. You can either use a global pack frequency in config.card or specific pack frequency per file, as explained above.

  • 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: 10.3 KB
Line 
1#!/bin/ksh
2
3#**************************************************************
4# Author: Sebastien 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# ID of your genci project. Curie only : post-processing jobs need it to run properly
14#-Q- curie export BRIDGE_MSUB_PROJECT=::default_project::
15#-Q- irene export BRIDGE_MSUB_PROJECT=::default_project::
16#-Q- irene-amd export BRIDGE_MSUB_PROJECT=::default_project::
17
18#D- Task type DO NOT CHANGE (computing, post-processing or checking)
19TaskType=checking
20
21#D- Low level debug : to perform lib test checks, stack construction and IO functions instrumentation
22DEBUG_debug=false
23
24#D- Messaging : all activities and call stacks will be sent to ipsl servers
25BigBrother=false
26
27# Check that everything went well during seasonal average production
28# Display a short report
29# Launch what's missing when a simulation has been completed PeriodState=Completed
30
31#D- Path to libIGCM
32#D- Default : value from AA_job if any
33# WARNING For StandAlone use : To run this script on some machine (ulam and cesium)
34# WARNING you must check MirrorlibIGCM variable in sys library.
35# WARNING If this variable is true, you must use libIGCM_POST path instead
36# WARNING of your running libIGCM directory.
37libIGCM=${libIGCM:=::modipsl::/libIGCM}
38
39# Current directory
40CURRENT_DIR=$( pwd )
41
42# Directory with comp.cards
43CARD_DIR=${CARD_DIR:=${CURRENT_DIR}}
44
45# Directory for script output
46POST_DIR=${POST_DIR:=${CARD_DIR}/OutScript}
47
48if [ ! -d ${CARD_DIR} ]; then
49  echo "No ${CARD_DIR}, we stop here"
50  exit
51fi
52
53########################################################################
54
55. ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh
56. ${libIGCM}/libIGCM_card/libIGCM_card.ksh
57. ${libIGCM}/libIGCM_date/libIGCM_date.ksh
58#-------
59. ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh
60. ${libIGCM}/libIGCM_config/libIGCM_config.ksh
61#-------
62( ${DEBUG_debug} ) && IGCM_debug_Check
63( ${DEBUG_debug} ) && IGCM_card_Check
64( ${DEBUG_debug} ) && IGCM_date_Check
65
66########################################################################
67
68#set -vx
69
70echo "Hi I'm here to help you check and complete the seasonal average production"
71echo -e "\033[1;31mDo you want me to run in dryrun mode just telling what I would submit? Answer no in this case\033[m"
72echo -e "\033[1;31mOr do you want me to submit job for real? Answer yes in this case.\033[m"
73echo -n " Run for real (y/n) :"
74read ActionAnswer
75
76case ${ActionAnswer} in
77oui|OUI|o|y|yes|YES)
78  echo "OK. I will submit jobs"
79  action=true
80  ;;
81non|NON|n|no|NO)
82  echo "OK. I won't submit any jobs"
83  action=false
84  ;;
85*)
86  echo "I did not recognize your answer. I will stop here."
87  echo "Please answer: oui|OUI|o|y|yes|YES"
88  echo "Or answer: non|NON|n|no|NO"
89  exit
90  ;;
91esac
92
93#==================================
94# First of all
95#
96# Read libIGCM compatibility version in config.card
97# Read UserChoices section
98# Read Ensemble section
99# Read Post section
100# Define all netcdf output directories
101#==================================
102IGCM_config_CommonConfiguration ${CARD_DIR}/config.card
103
104#==================================
105# Read ListOfComponents section:
106IGCM_card_DefineArrayFromSection ${CARD_DIR}/config.card ListOfComponents
107
108#==================================
109# Read SeasonalFrequency:
110IGCM_card_DefineVariableFromOption ${CARD_DIR}/config.card Post SeasonalFrequency
111
112#===================================
113# Read DateBegin from config.card
114DateBegin=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateBegin} )
115
116#===================================
117# Read end date from run.card or config.card
118if [ -f ${CARD_DIR}/run.card ] ; then
119   # Read updated run.card :
120   IGCM_card_DefineVariableFromOption ${CARD_DIR}/run.card Configuration PeriodDateBegin
121   IGCM_card_DefineVariableFromOption ${CARD_DIR}/run.card Configuration PeriodState
122
123  if [ X${run_Configuration_PeriodState} != X"Completed" ] ; then
124    # Calculate DateEnd by read PeriodDateBegin from run.card and remove one day 
125    DateEnd=$( IGCM_date_AddDaysToGregorianDate $( IGCM_date_ConvertFormatToGregorian ${run_Configuration_PeriodDateBegin} ) -1 )
126  else
127    # Simulation is finished, read DateEnd from config.card
128    DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )
129  fi
130else
131  # No run.card available, read DateEnd from config.card
132  DateEnd=$( IGCM_date_ConvertFormatToGregorian ${config_UserChoices_DateEnd} )
133fi
134
135#===================================
136# Calculate offset
137if ( [ X${config_Post_SeasonalFrequencyOffset} = X${NULL_STR} ] || [ X${config_Post_SeasonalFrequencyOffset} = XNONE ] || [ X${config_Post_SeasonalFrequencyOffset} = X ] ) ; then
138  PeriodOffset=0
139else
140  PeriodOffset=${config_Post_SeasonalFrequencyOffset}
141fi
142
143IGCM_debug_Print 1 "DateBegin for SE_Checker : "${DateBegin}
144IGCM_debug_Print 1 "DateEnd   for SE_Checker : "${DateEnd}
145IGCM_debug_Print 1 "Offset    for SE_Checker : "${PeriodOffset}
146echo
147#
148[ X${config_Post_SeasonalFrequency} = X"NONE" ] && exit
149
150freq=$( echo ${config_Post_SeasonalFrequency} |  sed -e "s/[yY]//" )
151
152an_deb=$( IGCM_date_YearDigit $(( DateBegin / 10000 + PeriodOffset )) )
153an_fin=$( IGCM_date_YearDigit $(( an_deb + freq - 1 )) )
154an_fin_all=$( IGCM_date_YearDigit $(( DateEnd / 10000 )) )
155
156#
157while [ ${an_fin} -le ${an_fin_all} ] ; do
158
159  countTotal=0
160  countGood=0
161  countBad=0
162
163  IGCM_debug_Print 1 " DateBegin/End for SE :  ${an_deb}_${an_fin} "
164
165  for comp in ${config_ListOfComponents[*]} ; do
166    localcountBad=0
167    # Debug Print
168    IGCM_debug_Print 1 ${comp}
169    # Define component
170    IGCM_card_DefineArrayFromOption ${CARD_DIR}/config.card ListOfComponents ${comp}
171    eval compname=\${config_ListOfComponents_${comp}[0]} > /dev/null 2>&1
172
173    # Read libIGCM compatibility version in ${compname}.card
174    card=${CARD_DIR}/COMP/${compname}.card
175
176    # Read and Build Output File stuff
177    #IGCM_debug_Print 1 "DefineArrayFromOption  : ${compname}_OutputFiles ${card}"
178    IGCM_card_DefineArrayFromOption ${card} OutputFiles List
179    ListFilesName=${compname}_OutputFiles_List
180    eval FileName0=\${${ListFilesName}[0]} > /dev/null 2>&1
181    #
182    if [ X${FileName0} != X${NULL_STR} ] ; then
183      #
184      # INITIALISATION
185      #
186      eval NbFiles=\${#${ListFilesName}[@]} > /dev/null 2>&1
187      typeset i=2
188      #
189      until [ $i -gt $NbFiles ]; do
190        #
191        eval flag_post=\${${ListFilesName}[$i]} > /dev/null 2>&1
192        #
193        if [ X${flag_post} != XNONE ] ; then
194          #
195          # Check if seasonal is required for this file
196          #
197          IGCM_card_DefineArrayFromSection ${card} ${flag_post}
198          #
199          # Seasonal case : If option Seasonal is not found (old cards) put SEASONAL ON by default
200          #
201          # variable option allready typeset above
202          for option in $( eval echo \${${compname}_${flag_post}[*]} ) ; do
203            if [ ${option} = Seasonal ] ; then
204              FoundSeasonal=true
205              IGCM_card_DefineVariableFromOption ${card} ${flag_post} Seasonal
206            fi
207          done
208          #
209          if [ ! X${FoundSeasonal} = Xtrue ] ; then
210            eval ${compname}_${flag_post}_Seasonal=ON
211          fi
212          #
213          if [ ! X$( eval echo \${${compname}_${flag_post}_Seasonal} ) = XON ] ; then
214              (( i_ = i+1 ))
215              eval Testvar_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
216              eval Testvar=${Testvar_}
217              if [[ ${Testvar} =~ [0-9][DMY]$ ]] ; then
218                  (( i = i+4 ))
219              else
220            (( i=i+3 ))
221              fi
222            continue
223          fi
224          #
225          # CREATE LIST
226          #
227          FILE=$( echo ${flag_post} | awk "-FPost_" '{print $2}' )
228          #
229          DIRECTORY=${R_SAVE}/${comp}/Analyse/SE
230          #
231          TestedFile=${config_UserChoices_JobName}_SE_${an_deb}_${an_fin}_${FILE}.nc
232          #
233          (( countTotal = countTotal + 1 ))
234          IGCM_sys_TestFileArchive ${DIRECTORY}/${TestedFile} >/dev/null 2>&1
235          if [ ! $? = 0 ] ; then
236            eval set +A LISTE_FILE_${comp}_${an_deb} \$\{LISTE_FILE_${comp}_${an_deb}[*]} ${TestedFile}
237            (( countBad = countBad + 1 ))
238            (( localcountBad = localcountBad + 1 ))
239          else
240            (( countGood = countGood + 1 ))
241          fi
242        fi
243      (( i_ = i+1 )) # to explore file list
244      eval Testvar_=\${${ListFilesName}[$i_]} > /dev/null 2>&1
245      eval Testvar=${Testvar_}
246      if [[ ${Testvar} =~ [0-9][DMY]$ ]] ; then
247          (( i = i+4 ))
248      else
249          (( i=i+3 ))
250      fi
251      done            # until [ $i -eq $NbFiles ]
252    fi                  # [ X${FileName0} != X${NULL_STR} ]
253
254    [ $localcountBad = 0 ] || IGCM_debug_Print 1 "$localcountBad file(s) missing for ${comp} : " $( eval echo \${LISTE_FILE_${comp}_${an_deb}[*]} )
255  done
256
257  # create_se submit if files don't exist
258  if [ $countGood != $countTotal ] ; then
259      if [ ${action} = true ] ; then
260
261          IGCM_debug_Print 2 -e "\033[1;31mSubmit create_se \033[m for period ${an_deb}-${an_fin}"
262         
263          listVarEnv="DEBUG_debug,BigBrother,libIGCM,SUBMIT_DIR,POST_DIR,Script_Post_Output,DateBegin,PeriodDateEnd,RebuildFrequency,RESOL_ATM,RESOL_SRF,RESOL_SBG,RESOL_OCE,RESOL_ICE,RESOL_MBG"
264          export DEBUG_debug=${DEBUG_debug}
265          export BigBrother=${BigBrother}
266          export libIGCM=${libIGCM}
267          export SUBMIT_DIR=${CARD_DIR}
268          export POST_DIR=${POST_DIR}
269          export DateBegin=${an_deb}
270          export PeriodDateEnd=${an_fin}1231
271          export RebuildFrequency=${RebuildFrequency}
272          export RESOL_ATM=${RESOL_ATM}
273          export RESOL_SRF=${RESOL_SRF}
274          export RESOL_SBG=${RESOL_SBG}
275          export RESOL_OCE=${RESOL_OCE}
276          export RESOL_ICE=${RESOL_ICE}
277          export RESOL_MBG=${RESOL_MBG}
278          export listVarEnv=${listVarEnv}
279          export Script_Post_Output=create_se.${PeriodDateEnd}
280         
281          IGCM_sys_MkdirWork ${POST_DIR}
282          IGCM_debug_Verif_Exit
283          IGCM_sys_QsubPost create_se
284          echo
285      else
286          # only dry run
287          IGCM_debug_Print 2 -e "\033[1;31mI should NOW Submit create_se \033[m for period ${an_deb}-${an_fin}"
288          echo
289      fi
290  else               
291      IGCM_debug_Print 2 -e "\033[1;32mFiles are OK for period ${an_deb}-${an_fin}.\033[m Nothing needs to be done for this period."
292      echo
293  fi
294
295  (( an_deb = an_deb + freq ))
296  (( an_fin = an_fin + freq ))
297
298done # while
Note: See TracBrowser for help on using the repository browser.