source: trunk/libIGCM/AA_job @ 262

Last change on this file since 262 was 262, checked in by sdipsl, 14 years ago
  • Add to possibility to use SmoothFiles?.
  • Need to uncomment for the moment
  • 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.9 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 SmoothFiles Conditions (SST, WIND[X,Y,Z], LAI ...)
318    #D- READ AND USE BY GCM AT EACH EXECUTION but varying in time
319    # ------------------------------------------------------------------
320    #IGCM_comp_GetInputSmoothFiles
321
322    #D-
323    # ------------------------------------------------------------------
324    #D- Get restart files (restartphy.nc, orca_restart.nc ...)
325    #D- READ AND USE BY GCM AT EACH EXECUTION.
326    #D-
327    #D- IF A COMPONENT DO NOT RESTART FROM PREVIOULSY COMPUTED RESTART
328    #D- ONLY IF CumulPeriod= (=> NUMERO) == 1
329    #D- MUST EXECUTE CREATE ETAT0_LIMIT (TYPICALLY LMDZ AND ./create_etat0_limit.e)
330    #D-
331    #D- IF CumulPeriod == 1
332    #D- AND A COMPONENT RESTART FROM PREVIOULSY COMPUTED RESTART
333    #D- MUST BRING THIS RESTART IN ${RUN_DIR_PATH}
334    #D-
335    #D- ELSE BRING RESTART FROM ${JobName} IN ${RUN_DIR_PATH}
336    # ------------------------------------------------------------------
337    IGCM_comp_GetInputRestartFiles
338   
339    #D-
340    # ------------------------------------------------------------------
341    #D- Test if all was right before Update
342    # ------------------------------------------------------------------
343    IGCM_debug_Verif_Exit
344
345    # ------------------------------------------------------------------
346    #D- Activate running environnement variables
347    # ------------------------------------------------------------------
348    IGCM_sys_activ_variables
349
350    #D-
351    # ------------------------------------------------------------------
352    #D- UPDATE ParametersFiles (.def, namelist ...) with
353    #D- current value of (ORCA_NIT00, ORCA_LRSTAR, RAZ_DATE, ...)
354    # ------------------------------------------------------------------
355    IGCM_comp_Update
356
357    #D-
358    # ------------------------------------------------------------------
359    #D- Test if all was right before execution
360    # ------------------------------------------------------------------
361    IGCM_debug_Verif_Exit
362
363    #D-
364    #D----------------------------------------------------------------==
365    #D-                          3. Execution
366    #D----------------------------------------------------------------==
367
368    echo
369    echo "#######################################"
370    echo "#      DIR BEFORE RUN EXECUTION       #"
371    echo "#######################################"
372    echo
373    ls -lrt
374
375    echo "========================================================================"
376    if ( [ X${BATCH_NUM_PROC_TOT} != X ] && [ "${BATCH_NUM_PROC_TOT}" -gt 1 ] ) ; then
377        MPIRUN_COMMAND=${HOST_MPIRUN_COMMAND}
378        eval MPIRUN_OPTIONS=${config_UserChoices_JobRunOptions}
379    else
380        MPIRUN_COMMAND=${MPIRUN_COMMAND:="time "}
381        MPIRUN_OPTIONS=${MPIRUN_OPTIONS:=""}
382    fi
383
384    if [ ${DRYRUN} -le 1 ] ; then
385        REAL_DATE_INIT=$( date )
386        echo "EXECUTION of : ${MPIRUN_COMMAND} ${MPIRUN_OPTIONS} ./${config_Executable_Name}   > ${Exe_Output} 2>&1"
387        echo                                                                                   > ${Exe_Output}
388        echo "#######################################"                                        >> ${Exe_Output}
389        echo "EXECUTION of : ${MPIRUN_COMMAND} ${MPIRUN_OPTIONS} ./${config_Executable_Name}" >> ${Exe_Output}
390        echo                                                                                  >> ${Exe_Output}
391        typeset RET
392        RUN_DATE_BEGIN=$( date '+%Y-%m-%dT%H:%M:%S' )
393        ${MPIRUN_COMMAND} ${MPIRUN_OPTIONS} ./${config_Executable_Name} >> ${Exe_Output} 2>&1
394        RET=$?
395        RUN_DATE_END=$( date '+%Y-%m-%dT%H:%M:%S' )
396        if [ ${RET} -gt 0 ] ; then
397            echo "Return code of executable :" ${RET}
398            IGCM_debug_Exit "EXECUTABLE"
399            IGCM_sys_Cp ${Exe_Output} ${SUBMIT_DIR}/${PREFIX}_${Exe_Output}_error
400        fi
401        echo                                            >> ${Exe_Output}
402        echo "#######################################"  >> ${Exe_Output}
403        echo "libIGCM RunDateBegin=${RUN_DATE_BEGIN}"   >> ${Exe_Output}
404        echo "libIGCM RunDateEnd=${RUN_DATE_END}"       >> ${Exe_Output}
405        echo                                            >> ${Exe_Output}
406    else
407        echo "EXECUTION of : ${MPIRUN_COMMAND} ${MPIRUN_OPTIONS} ./${config_Executable_Name} simulated for DRYRUN = " $DRYRUN
408        if ( $DEBUG_debug ) ; then
409            echo "FOR EXECUTION DRYRUN mode = " $DRYRUN >> stack
410        fi
411    fi
412    echo "========================================================================"
413
414    echo
415    echo "#######################################"
416    echo "#       DIR AFTER RUN EXECUTION       #"
417    echo "#######################################"
418    echo
419    ls -lrt
420
421    #D-
422    # ------------------------------------------------------------------
423    #D- Desactivate running environnement variables
424    # ------------------------------------------------------------------
425    IGCM_sys_desactiv_variables
426
427    #D-
428    #D----------------------------------------------------------------==
429    #D-                    4. Post execution operations
430    #D----------------------------------------------------------------==
431
432    #D-
433    # ------------------------------------------------------------------
434    #D- Save on archive machine netcdf outputs, restarts
435    #D- and text files of models
436    # ------------------------------------------------------------------
437    IGCM_comp_Finalize
438
439    #D-
440    # ------------------------------------------------------------------
441    #D- Test if all was right after Finalize
442    # ------------------------------------------------------------------
443    IGCM_debug_Verif_Exit
444
445    #D-
446    # ------------------------------------------------------------------
447    #D- Launch remote rebuild or/and post-treatment process if necessary
448    # ------------------------------------------------------------------
449    IGCM_post_Configure
450
451    #D-
452    # ------------------------------------------------------------------
453    #D- Save job output
454    #D- Manage executable size to save only different binary
455    #D- Write in run.card user, system and elapse time
456    #D- Check that everything went well ! No ? then we stop.
457    #D- Determine next computed period
458    # ------------------------------------------------------------------
459    IGCM_config_PeriodEnd
460
461    echo "Ending iteration ${Period}"
462    (( Period = Period + 1 ))
463
464    # End loop if date end is reached
465    if [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ; then
466        break ;
467    fi
468
469    PeriodContinue=false
470    if [ ${Period} -le ${PeriodNb} ]; then
471        PeriodContinue=true
472    fi
473done
474
475#D-
476#D--------------------------------------------------------------------==
477#D-     5. Submit next job or send mail if simulation over.
478#D--------------------------------------------------------------------==
479IGCM_config_Finalize
480
481date
Note: See TracBrowser for help on using the repository browser.