source: trunk/libIGCM/AA_job @ 781

Last change on this file since 781 was 781, checked in by acosce, 11 years ago

Correct Msub option for submission group / curie

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