source: trunk/libIGCM/AA_job @ 1051

Last change on this file since 1051 was 1051, checked in by sdipsl, 10 years ago

update message content
# Message type standard fields:
https://github.com/Prodiguer/prodiguer-docs/wiki/MQ-Standard-Message-Fields
# Message type dictionnary and custom fields:
https://github.com/Prodiguer/prodiguer-docs/wiki/Monitoring-Message-Dictionary

  • 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: 19.6 KB
Line 
1#-Q- curie #!/bin/ksh
2#-Q- curie ######################
3#-Q- curie ## CURIE   TGCC/CEA ##
4#-Q- curie ######################
5#-Q- curie #MSUB -r ::Jobname::        # Job Name
6#-Q- curie #MSUB -o Script_Output_::Jobname::.000001    # standard output
7#-Q- curie #MSUB -e Script_Output_::Jobname::.000001    # error output
8#-Q- curie #MSUB -eo
9#-Q- curie #MSUB -n ::JobNumProcTot::  # reservation des processeurs pour le job
10#-Q- curie ##MSUB -N 8                 # Number of nodes (16 cores per node)
11#-Q- curie ##MSUB -x                    # exclusive node
12#-Q- curie ##MSUB -E '--cpu_bind=none'
13#-Q- curie #MSUB -T 86400              # Wall clock limit (seconds)
14#-Q- curie #MSUB -q standard           # thin nodes
15#-Q- curie #MSUB -A ::default_project::
16#-Q- curie BATCH_NUM_PROC_TOT=$BRIDGE_MSUB_NPROC
17#-Q- curie set +x
18#-Q- ada #!/bin/ksh
19#-Q- ada # ######################
20#-Q- ada # ##  ADA       IDRIS ##
21#-Q- ada # ######################
22#-Q- ada # Nom de la requete
23#-Q- ada # @ job_name = ::Jobname::
24#-Q- ada # Type de travail
25#-Q- ada # @ job_type = parallel
26#-Q- ada # Fichier de sortie standard
27#-Q- ada # @ output = Script_Output_::Jobname::.000001
28#-Q- ada # Fichier de sortie erreur (le meme)
29#-Q- ada # @ error = Script_Output_::Jobname::.000001
30#-Q- ada # Nombre de processus demandes
31#-Q- ada # @ total_tasks = ::JobNumProcTot::
32#-Q- ada # @ environment = "BATCH_NUM_PROC_TOT=::JobNumProcTot::"
33#-Q- ada # Temps CPU max. par processus MPI hh:mm:ss
34#-Q- ada # @ wall_clock_limit = 1:00:00
35#-Q- ada # Nombre de taches OpenMP/pthreads par processus MPI
36#-Q- ada ### @ parallel_threads = 4
37#-Q- ada # Fin de l entete
38#-Q- ada # @ queue
39#-Q- lxiv8 ######################
40#-Q- lxiv8 ## OBELIX      LSCE ##
41#-Q- lxiv8 ######################
42#-Q- lxiv8 #PBS -N ::Jobname::
43#-Q- lxiv8 #PBS -m a
44#-Q- lxiv8 #PBS -j oe
45#-Q- lxiv8 #PBS -q medium
46#-Q- lxiv8 #PBS -o Script_Output_::Jobname::.000001
47#-Q- lxiv8 #PBS -S /bin/ksh
48#-Q- lxiv8 #PBS -v BATCH_NUM_PROC_TOT=::JobNumProcTot::
49#-Q- lxiv8 #PBS -l nodes=1:ppn=::JobNumProcTot::
50#-Q- default #!/bin/ksh
51#-Q- default ##################
52#-Q- default ## DEFAULT HOST ##
53#-Q- default ##################
54#-Q- default #For MPI use, uncomment next line :
55#-Q- default #BATCH_NUM_PROC_TOT=::JobNumProcTot::
56
57#**************************************************************
58# Author: Sebastien Denvil
59# Contact: Sebastien.Denvil__at__ipsl.jussieu.fr
60# $Revision::                                          $ Revision of last commit
61# $Author::                                            $ Author of last commit
62# $Date::                                              $ Date of last commit
63# IPSL (2006)
64#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
65#
66#**************************************************************
67
68#set -eu
69#set -vx
70
71date
72echo
73echo "#######################################"
74echo "#       ANOTHER GREAT SIMULATION      #"
75echo "#######################################"
76echo
77
78#D--------------------------------------------------------------------==
79#D-
80#D-                      Job to launch IGCM models
81#D-
82#D--------------------------------------------------------------------==
83#D-
84
85MODIPSL=::modipsl::
86libIGCM=${MODIPSL}/libIGCM
87
88#D--------------------------------------------------------------------==
89#D- -1. PLACE FOR USER MODIFICATION
90#D-     - Job Verbosity
91#D-     - PeriodNb
92#D-     - Experience type : DEB(ug), DEV(elopment), RUN
93#D--------------------------------------------------------------------==
94
95#D- Task type (computing or post-processing)
96TaskType=computing
97#D- Increased verbosity (1, 2, 3)
98Verbosity=3
99#D- Experience type : DEB(ug), DEV(elopment), RUN (default)
100JobType=RUN
101#D- Number of execution in one job
102PeriodNb=1
103#-Q- sx9mercure PeriodNb=60
104
105#D-
106#D- --------------------------------------------------------------------------------------------------#
107#D-                          ! OPTIONNAL FEATURES /!\ USE WITH CARE !                                 #
108#D- --------------------------------------------------------------------------------------------------#
109
110
111#D- Low level debug : to bypass lib test checks and stack construction
112#D- Default=true
113#D-
114DEBUG_debug=false
115
116#D- Messaging : all activities and call stacks will be sent to ipsl servers
117#D- If true will imply DEBUG_debug=true
118#D- Default=false
119#D-
120BigBrother=false
121
122#D- Set DEBUG_sys to false to disable output calls of function
123#D- true when JobType=DEB # means DEB(ug)
124#D-
125#DEBUG_sys=false
126
127#D- Define running directory
128#D- Default=${TMPDIR} ie temporary batch directory
129#D-
130#RUN_DIR_PATH=/workdir/or/scratchdir/of/this/machine
131
132#D- Define submit directory
133#D- Default= where you launch qsub (variable from scheduler)
134#D-
135#SUBMIT_DIR=$( pwd )
136
137#D- Define input file root directory
138#D- Default=/IGCMG/common/account/of/this/machine
139#D-
140#R_IN=/u/rech/por/rpor111/DATA
141
142#D- Turn in dry run mode ? (0,1,2,3)
143#D- Default=0
144#D-
145#DRYRUN=3
146#D-# YOU HAVE TO COMPILE YOUR EXE FILES to USE DRYRUN MODE !
147#D-# -------------------------------------------------------------------------------------
148#D-# | DRYRUN=  |  Date computations, | sys_Get    |  Exe    | sys_Put_Out; sys_Put_Rest |
149#D-# |          |  Cp/Exe/param/files |            |         |                           |
150#D-# |          |  Chmod Qsub         |            |         |                           |
151#D-# -------------------------------------------------------------------------------------
152#D-# |    0     |       yes           |    yes     |  yes    |      yes                  |
153#D-# -------------------------------------------------------------------------------------
154#D-# |    1     |       yes           |    yes     |  yes    |      no                   |
155#D-# -------------------------------------------------------------------------------------
156#D-# |    2     |       yes           |    yes     |  no     |      no                   |
157#D-# -------------------------------------------------------------------------------------
158#D-# |    3     |       yes           |    no      |  no     |      no                   |
159#D-# -------------------------------------------------------------------------------------
160
161#D-
162# --------------------------------------------------------------------------------------------------#
163#D- ! END OF OPTIONNAL FEATURES /!\ DO NOT MODIFY ANYTHING BELOW UNLESS YOU KNOW WHAT YOU ARE DOING #
164# --------------------------------------------------------------------------------------------------#
165
166#D-
167#D--------------------------------------------------------------------==
168#D- 0.0 SYSTEM ENVIRONMENT
169#D-     - Define variables for Number of processors
170#D-     - Define MPI variables
171#D-     - Define batch scheduler variables
172#D-     - Source IGCM Library
173#D-     - Get RESOLution in .resol file (temporary)
174#D--------------------------------------------------------------------==
175
176#---------------------------------------------------------------------==
177
178. ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh
179. ${libIGCM}/libIGCM_card/libIGCM_card.ksh
180. ${libIGCM}/libIGCM_date/libIGCM_date.ksh
181#-------
182. ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh
183. ${libIGCM}/libIGCM_config/libIGCM_config.ksh
184. ${libIGCM}/libIGCM_comp/libIGCM_comp.ksh
185. ${libIGCM}/libIGCM_post/libIGCM_post.ksh
186#-------
187( ${DEBUG_debug} ) && IGCM_debug_Check
188( ${DEBUG_debug} ) && IGCM_card_Check
189( ${DEBUG_debug} ) && IGCM_date_Check
190
191#--------------------------------------------------------------------==
192
193#-- Resolution FLAG for oasis input
194#RESOL="ORCA2xLMD9671"
195[ -f ${SUBMIT_DIR}/../.resol ] && RESOL=$(head -1 ${SUBMIT_DIR}/../.resol)
196#-- Chemistrie FLAG to ease chemistries configurations management
197#CHEM="AER"
198[ -f ${SUBMIT_DIR}/../.chimie ] && eval $(grep CHEM ${SUBMIT_DIR}/../.chimie)
199
200#D-
201#D--------------------------------------------------------------------==
202#D- 0.1 COMMON ENVIRONMENT
203#D-     - Read libIGCM compatibility version in config.card
204#D-     - Read UserChoices section
205#D-     - Read Ensemble section
206#D-     - Read Post section
207#D-     - Define all netcdf output directories
208#D--------------------------------------------------------------------==
209IGCM_config_CommonConfiguration ${SUBMIT_DIR}/config.card
210
211# ------------------------------------------------------------------
212# Activate BigBrother so as to supervise this simulation
213# ------------------------------------------------------------------
214IGCM_debug_ActivateBigBro
215
216#D-
217#D--------------------------------------------------------------------==
218#D- 1. INITIALIZE CONFIGURATION
219#D-    - Simulation configuration
220#D-    - Simulation parameters
221#D-    - Execution parameter
222#D-    - Define input files directory
223#D-    - Read or initialize CumulPeriod
224#D-    - run.card
225#D--------------------------------------------------------------------==
226IGCM_config_Initialize
227
228# --------------------------------------------------------------------==
229# Define, create and cd RUN_DIR
230# --------------------------------------------------------------------==
231RUN_DIR=${RUN_DIR_PATH}/${config_UserChoices_JobName}.${$}
232IGCM_sys_MkdirWork ${RUN_DIR}
233IGCM_sys_Cd ${RUN_DIR}
234
235# ------------------------------------------------------------------
236# Test if all was right before proceeding further
237# ------------------------------------------------------------------
238IGCM_debug_Verif_Exit
239
240#D-
241#D---------------------------------------------------------------------==
242#D- 2. INITIALIZE ALL COMPONENT OF THE CONFIGURATION
243#D-    - Define component executable
244#D-    - Define Write Frequency by component "1M" "1D" ...
245#D-    - Source ${comp}.driver
246#D-    - Define Storage Places by component
247#D-    - ${comp}_Initialize :
248#D-    - Patterns to sed
249#D-    - Variables from namelist
250#D---------------------------------------------------------------------==
251IGCM_comp_Initialize
252
253#D-
254#D---------------------------------------------------------------------==
255#D- 3. PERFORM GENERAL VERIFICATION
256#D-    - Verify compatibility of period length, write frequencies, ...
257#D-    - Verify compatibility of rebuild choices and post-process choices
258#D-    - Will stop here if something is wrong
259#D---------------------------------------------------------------------==
260IGCM_config_Check
261
262# ------------------------------------------------------------------
263# Test if all was right before entering the period loop
264# ------------------------------------------------------------------
265IGCM_debug_Verif_Exit
266
267#D-
268#D---------------------------------------------------------------------==
269#D- 4. ENTER THE DEEP EXECUTION LOOP
270#D-    ! FASTEN YOUR SEAT BELTS PLEASE. !
271#D-    !   WE WILL CROSS TURBULENCES.   !
272#D---------------------------------------------------------------------==
273
274Period=1
275
276PeriodContinue=false
277if [ ${Period} -le ${PeriodNb} ]; then
278  PeriodContinue=true
279fi
280while ( ${PeriodContinue} ) ; do
281
282  echo
283  echo "Starting iteration ${Period} / ${PeriodNb}"
284
285  #D-
286  # ------------------------------------------------------------------
287  #D-   4.1 COMPUTE AND DEFINE DATE INFORMATION.
288  #D-       - ${PeriodDateBegin}
289  #D-       - ${PeriodDateEnd}
290  #D-       - ${CumulPeriod}
291  #D-       - ${DatesPeriod}=${PeriodDateBegin}_${PeriodDateEnd}
292  #D-       - ${PeriodLength} => JOURS=31 , 28, 29, 30 ; MOIS=0 ; ANS=0
293  #D-       - update run.card value
294  # ------------------------------------------------------------------
295  IGCM_config_PeriodStart
296
297  #D-
298  # ------------------------------------------------------------------
299  #D-   4.2 BEGIN COMPUTATION ONLY IF NEEDED
300  # ------------------------------------------------------------------
301  if [ ${SimulationLengthInDays} -gt ${ExperienceLengthInDays} ] ; then
302    IGCM_debug_Print 1 "break because '${SimulationLengthInDays} -gt ${ExperienceLengthInDays}' : ${SimulationLengthInDays} -gt ${ExperienceLengthInDays}"
303    break ;
304  fi
305
306  #D-
307  # ------------------------------------------------------------------
308  #D-   4.3 CALL OPTIONNAL FUNCTION WITHIN DRIVER
309  #D-       - to set special variables used in lists (Param, Init or Bc).
310  # ------------------------------------------------------------------
311  IGCM_comp_PeriodStart
312
313  #D-
314  # ------------------------------------------------------------------
315  #D-   4.4 GET PARAMETERS TEXT FILES UPDATED BY JOB
316  #D-       - (.def, namelist ...)
317  #D-       - READ AND USE BY GCM AT EACH EXECUTION.
318  # ------------------------------------------------------------------
319  IGCM_comp_GetInputParametersFiles
320
321  #D-
322  # ------------------------------------------------------------------
323  #D-   4.5 GET INITIAL STATE
324  #D-       - (Etat0, carteveg,relief...)
325  #D-       - NECESSARY ONLY IF CumulPeriod= (=> NUMERO) == 1
326  #D-       - AND ???_Restart=NO
327  #D-       - READ AND USE BY GCM FOR ONLY ONE EXECUTION.
328  # ------------------------------------------------------------------
329  IGCM_comp_GetInputInitialStateFiles
330
331  #D-
332  # ------------------------------------------------------------------
333  #D-   4.6 GET BOUNDARIES CONDITIONS
334  #D-       - (SST, WIND[X,Y,Z], LAI ...)
335  #D-       - READ AND USE BY GCM AT EACH EXECUTION.
336  # ------------------------------------------------------------------
337  IGCM_comp_GetInputBoundaryFiles
338
339  #D-
340  # ------------------------------------------------------------------
341  #D-   4.7 GET SmoothFiles CONDITIONS
342  #D-       - (SST, WIND[X,Y,Z], LAI ...)
343  #D-       - READ AND USE BY GCM AT EACH EXECUTION
344  #D-       - Do not change at each ${Period}
345  # ------------------------------------------------------------------
346  IGCM_comp_GetInputSmoothFiles
347
348  #D-
349  # ------------------------------------------------------------------
350  #D-   4.8 GET RESTART FILES
351  #D-       - (restartphy.nc, orca_restart.nc ...)
352  #D-       - READ AND USE BY GCM AT EACH EXECUTION.
353  #D-
354  #D-       - IF A COMPONENT DO NOT RESTART FROM PREVIOULSY COMPUTED RESTART
355  #D-       - ONLY IF CumulPeriod= (=> NUMERO) == 1
356  #D-       - MUST EXECUTE CREATE ETAT0_LIMIT (TYPICALLY LMDZ AND ./create_etat0_limit.e)
357  #D-
358  #D-       - IF CumulPeriod == 1
359  #D-       - AND A COMPONENT RESTART FROM PREVIOULSY COMPUTED RESTART
360  #D-       - MUST BRING THIS RESTART IN ${RUN_DIR_PATH}
361  #D-
362  #D-       - ELSE BRING RESTART FROM ${JobName} IN ${RUN_DIR_PATH}
363  # ------------------------------------------------------------------
364  IGCM_comp_GetInputRestartFiles
365
366  # ------------------------------------------------------------------
367  # Test if all was right before Update
368  # ------------------------------------------------------------------
369  IGCM_debug_Verif_Exit
370
371  #D-
372  # ------------------------------------------------------------------
373  #D-   4.9 ACTIVATE RUNNING ENVIRONNEMENT VARIABLES
374  # ------------------------------------------------------------------
375  IGCM_sys_activ_variables
376
377  #D-
378  # ------------------------------------------------------------------
379  #D-   4.10 UPDATE ParametersFiles
380  #D-        - (.def, namelist ...)
381  #D-        - with current value of (ORCA_NIT00, ORCA_LRSTAR, RAZ_DATE, ...)
382  # ------------------------------------------------------------------
383  IGCM_comp_Update
384
385  # ------------------------------------------------------------------
386  # Test if all was right before execution
387  # ------------------------------------------------------------------
388  IGCM_debug_Verif_Exit
389
390  #D-
391  #D---------------------------------------------------------------------==
392  #D- 5. EXECUTION
393  #D---------------------------------------------------------------------==
394
395  echo
396  echo "#######################################"
397  echo "#      DIR BEFORE RUN EXECUTION       #"
398  echo "#######################################"
399  echo
400  ls -lrt
401
402  echo "========================================================================"
403  if [ ${DRYRUN} -le 1 ] ; then
404    REAL_DATE_INIT=$( date )
405    echo                                                                                   > ${Exe_Output}
406    echo "#######################################"                                        >> ${Exe_Output}
407    echo "EXECUTION of : ${EXECUTION}"
408    echo "EXECUTION of : ${EXECUTION}"                                                    >> ${Exe_Output}
409    echo                                                                                  >> ${Exe_Output}
410    typeset RET
411    RUN_DATE_BEGIN=$( date '+%Y-%m-%dT%H:%M:%S' )
412    ${EXECUTION}  >> ${Exe_Output} 2>&1
413    RET=$?
414    RUN_DATE_END=$( date '+%Y-%m-%dT%H:%M:%S' )
415    if [ ${RET} -gt 0 ] ; then
416      echo "Return code of executable :" ${RET}
417      IGCM_debug_Exit "EXECUTABLE"
418      IGCM_sys_Mkdir ${SUBMIT_DIR}/Debug
419      IGCM_sys_Cp ${Exe_Output} ${SUBMIT_DIR}/Debug/${PREFIX}_${Exe_Output}_error
420      ExecutionFail=true
421    fi
422    echo                                            >> ${Exe_Output}
423    echo "#######################################"  >> ${Exe_Output}
424    echo "libIGCM RunDateBegin=${RUN_DATE_BEGIN}"   >> ${Exe_Output}
425    echo "libIGCM RunDateEnd=${RUN_DATE_END}"       >> ${Exe_Output}
426    echo                                            >> ${Exe_Output}
427  else
428    echo "EXECUTION of : ${EXECUTION} simulated for DRYRUN = " $DRYRUN
429    echo "EXECUTION of : ${EXECUTION} simulated for DRYRUN = " $DRYRUN > ${Exe_Output}
430    if ( $DEBUG_debug ) ; then
431      echo "FOR EXECUTION DRYRUN mode = " $DRYRUN >> stack
432    fi
433  fi
434  echo "========================================================================"
435
436  echo
437  echo "#######################################"
438  echo "#       DIR AFTER RUN EXECUTION       #"
439  echo "#######################################"
440  echo
441  ls -lrt
442
443  #D-
444  #D---------------------------------------------------------------------==
445  #D- 6. POST EXECUTION OPERATIONS
446  #D---------------------------------------------------------------------==
447
448  #D-
449  # ------------------------------------------------------------------
450  #D-   6.1. DESACTIVATE RUNNING ENVIRONNEMENT VARIABLES
451  # ------------------------------------------------------------------
452  IGCM_sys_desactiv_variables
453
454  #D-
455  # ------------------------------------------------------------------
456  #D-   6.2. SAVE OUTPUTS
457  #D-        - On archive/storage machine
458  #D-        - netcdf outputs, restarts and text files of models
459  # ------------------------------------------------------------------
460  IGCM_comp_Finalize
461
462  # ------------------------------------------------------------------
463  # Test if all was right after Finalize
464  # ------------------------------------------------------------------
465  IGCM_debug_Verif_Exit
466
467  #D-
468  # ------------------------------------------------------------------
469  #D-   6.3. CONFIGURE POST-PROCESSING
470  #D-        - asynchronous post-treatment (Level 0) when necessary (rebuild/pack)
471  #D-        - classic post-treatment      (Level 1) when necessary (TimeSeries/Seasonal)
472  # ------------------------------------------------------------------
473  IGCM_post_Configure
474
475  #D-
476  # ------------------------------------------------------------------
477  #D-   6.4. SUBMIT POST-PROCESSING
478  #D-        - remote rebuild or/and post-treatment process if necessary
479  # ------------------------------------------------------------------
480  IGCM_post_Submit
481
482  #D-
483  # ------------------------------------------------------------------
484  #D-   6.5. FINALYZE CURRENT LOOP AND PREPARE NEXT ONE
485  #D-        - Manage executable size to save only different binary
486  #D-        - Write in run.card user, system and elapse time
487  #D-        - Check that everything went well ! No ? then we stop.
488  #D-        - Determine next computed period
489  # ------------------------------------------------------------------
490  IGCM_config_PeriodEnd
491
492  echo "Ending iteration ${Period}"
493  (( Period = Period + 1 ))
494
495  # End loop if date end is reached
496  if [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ; then
497    break ;
498  fi
499
500  PeriodContinue=false
501  if [ ${Period} -le ${PeriodNb} ]; then
502    PeriodContinue=true
503  fi
504done
505
506#D-
507#D---------------------------------------------------------------------==
508#D- 7. SUBMIT NEXT JOB OR SEND MAIL IF SIMULATION IS OVER.
509#D---------------------------------------------------------------------==
510IGCM_config_Finalize
511
512date
Note: See TracBrowser for help on using the repository browser.