source: tags/libIGCM_v2.1/AA_job @ 1137

Last change on this file since 1137 was 929, checked in by sdipsl, 11 years ago

machine cleanup
whitespace cleanup

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