source: trunk/libIGCM/AA_job @ 259

Last change on this file since 259 was 259, checked in by mafoipsl, 14 years ago

Add para-sx9 queue by default. prio-sx9 or test-sx9 allowed

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