source: branches/AllPostFred/AA_job

Last change on this file was 5, checked in by mmaipsl, 16 years ago

MM: correct Date, Author and Revision svn properties.

  • 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: 15.6 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::.1    # 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- sx8brodie #######################
12#-Q- sx8brodie ## SX8BRODIE   IDRIS ##
13#-Q- sx8brodie #######################
14#-Q- sx8brodie #PBS -N ::Jobname::         # nom de la requete
15#-Q- sx8brodie #PBS -m a                   # message a la fin du job
16#-Q- sx8brodie #PBS -j o                   # regroupement des sorties du job : standard error et output
17#-Q- sx8brodie #PBS -o Script_Output_::Jobname::.1  # nom du fichier de sortie
18#-Q- sx8brodie #PBS -S /usr/bin/ksh        # shell de soumission
19#-Q- sx8brodie #PBS -v BATCH_NUM_PROC_TOT=::JobNumProcTot::
20#-Q- sx8brodie #PBS -q ::JobClass::                # classe multi pour BATCH_NUM_PROC_TOT superieur a 2, mono sinon
21#-Q- sx8brodie #PBS -l cpunum_job=${BATCH_NUM_PROC_TOT}  # reservation des processeurs pour le job
22#-Q- sx8brodie #PBS -l memsz_job=6.0gb     # Limite memoire
23#-Q- sx8brodie #PBS -l cputim_job=1:00:00  # Limite temps
24#-Q- sx8mercure #!/bin/ksh
25#-Q- sx8mercure ######################
26#-Q- sx8mercure ## SX8MERCURE   CEA ##
27#-Q- sx8mercure ######################
28#-Q- sx8mercure #PBS -N ::Jobname::           # nom de la requete
29#-Q- sx8mercure #PBS -m a                     # message a la fin du job
30#-Q- sx8mercure #PBS -j o                     # regroupement des sorties du job : standard error et output
31#-Q- sx8mercure #PBS -o Script_Output_::Jobname::.1   # nom du fichier de sortie
32#-Q- sx8mercure #PBS -S /usr/bin/ksh          # shell de soumission
33#-Q- sx8mercure #PBS -v BATCH_NUM_PROC_TOT=::JobNumProcTot::
34#-Q- sx8mercure #PBS -l cpunum_job=${BATCH_NUM_PROC_TOT}          # reservation des processeurs pour le job
35#-Q- sx8mercure #PBS -l memsz_job=6.0gb       # limite memoire
36#-Q- sx8mercure #PBS -l elapstim_req=00:30:00 # limite en temps elapsed
37#-Q- default #!/bin/ksh
38#-Q- default ##################
39#-Q- default ## DEFAULT HOST ##
40#-Q- default ##################
41#-Q- default #For MPI use, uncomment next line :
42#-Q- default #BATCH_NUM_PROC_TOT=::JobNumProcTot::
43
44# $Date$
45# $Author$
46# $Revision$
47# IPSL (2006)
48#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
49
50#set -eu
51#set -vx
52
53date
54echo
55echo "#######################################"
56echo "#       ANOTHER GREAT SIMULATION      #"
57echo "#######################################"
58echo
59
60#D--------------------------------------------------------------------==
61#D--------------------------------------------------------------------==
62#D-
63#D-                      Job to launch IGCM models
64#D-
65#D--------------------------------------------------------------------==
66#D--------------------------------------------------------------------==
67#D-
68
69MODIPSL=::modipsl::
70libIGCM=${MODIPSL}/libIGCM
71
72#D--------------------------------------------------------------------==
73#D-                   -1. User modification place
74#D-                      - Job Verbosity
75#D-                      - PeriodNb
76#D--------------------------------------------------------------------==
77
78#D- Increased verbosity (1, 2, 3)
79Verbosity=3
80#D- Number of execution in one job
81PeriodNb=1
82
83#D-
84# --------------------------------------------------------------------
85#D- ! Optionnal features /!\ Use with care !
86# --------------------------------------------------------------------
87
88#D- Low level debug : to bypass lib test checks and stack construction
89#D- Default=true
90DEBUG_debug=false
91
92#D- Set DEBUG_sys to false to disable output calls of function
93#D- Default=true
94#DEBUG_sys=false
95
96#D- Define running directory
97#D- Default=${TMPDIR} ie temporary batch directory
98#RUN_DIR_PATH=/workdir4/rech/ces/rces452/BABATEST/TESTPOST
99
100#D- Define submit directory
101#D- Default= where you launch qsub
102#SUBMIT_DIR=/workdir4/rech/ces/rces452/SCRIPT_V1/modipsl/config/IPSLCM4_v1_OASIS3/EXP01
103
104#D- Turn in dry run mode ? (0,1,2,3)
105#D- Default=0
106#DRYRUN=3
107# YOU MUST COMPILE YOUR EXE FILES FOR DRYRUN MODE !
108# -------------------------------------------------------------------------------------
109# | DRYRUN=  |  Date computations, | sys_Get    |  Exe    | sys_Put_Out; sys_Put_Rest |
110# |          |  Cp/Exe param files |            |  Chmod  |                           |
111# |          |      Qsub           |            |         |                           |
112# -------------------------------------------------------------------------------------
113# |    0     |       yes           |    yes     |  yes    |      yes                  |
114# -------------------------------------------------------------------------------------
115# |    1     |       yes           |    yes     |  yes    |      no                   |
116# -------------------------------------------------------------------------------------
117# |    2     |       yes           |    yes     |  no     |      no                   |
118# -------------------------------------------------------------------------------------
119# |    3     |       yes           |    no      |  no     |      no                   |
120# -------------------------------------------------------------------------------------
121
122#D- Define input file root directory
123#D- Default=/u/rech/ces/rces452/IGCM
124#R_IN=/u/rech/por/rpor111/DATA
125
126#D-
127#D--------------------------------------------------------------------==
128#D-                   0. System Environment
129#D-                      - Define variables for Number of processors
130#D-                      - Define MPI variables
131#D-                      - Define batch scheduler variables
132#D-                      - Source IGCM Library
133#D-                      - Get RESOLution in .resol file (temporary)
134#D--------------------------------------------------------------------==
135
136#D--------------------------------------------------------------------==
137
138. ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh
139        ( ${DEBUG_debug} ) && IGCM_debug_Check
140. ${libIGCM}/libIGCM_card/libIGCM_card.ksh
141       ( ${DEBUG_debug} ) && IGCM_card_Check
142. ${libIGCM}/libIGCM_date/libIGCM_date.ksh
143       ( ${DEBUG_debug} ) && IGCM_date_Check
144#-------
145. ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh
146. ${libIGCM}/libIGCM_config/libIGCM_config.ksh
147. ${libIGCM}/libIGCM_comp/libIGCM_comp.ksh
148. ${libIGCM}/libIGCM_post/libIGCM_post.ksh
149
150#D--------------------------------------------------------------------==
151
152#-- Resolution FLAG for oasis input
153RESOL=$(cat ${SUBMIT_DIR}/../.resol)
154#RESOL="ORCA2xLMD9671"
155
156#D-
157#D--------------------------------------------------------------------==
158#D-           1. INITIALIZE CONFIGURATION AND THEN COMPONENTS
159#D--------------------------------------------------------------------==
160
161# --------------------------------------------------------------------==
162#D- Initialize configuration :
163#D-              - Simulation configuration
164#D-              - Simulation parameters
165#D-              - Execution parameter
166#D-              - Define input files directory
167#D-              - Read or initialize CumulPeriod
168#D-              - run.card
169#D-
170# --------------------------------------------------------------------==
171IGCM_config_Initialize
172
173# --------------------------------------------------------------------==
174#D- Define, create and cd RUN_DIR
175#D- 
176# --------------------------------------------------------------------==
177RUN_DIR=${RUN_DIR_PATH}/${config_UserChoices_TagName}/${config_UserChoices_JobName}
178IGCM_sys_MkdirWork ${RUN_DIR}
179IGCM_sys_Cd ${RUN_DIR}
180
181# --------------------------------------------------------------------==
182#D- Initialize each components taking part
183#D- into simulation configuration :
184#D-         - Define component executable
185#D-         - Define Write Frequency by component "1M" "1D" ...
186#D-         - Source ${comp}.driver
187#D-         - Define Storage Places by component
188#D-         - ${comp}_Initialize :
189#D-         - Patterns to sed
190#D-         - Variables from namelist
191#D-
192# --------------------------------------------------------------------==
193IGCM_comp_Initialize
194
195# --------------------------------------------------------------------==
196#D- Verify compatibility of period length and write frequencies
197#D-
198# --------------------------------------------------------------------==
199#IGCM_config_Check
200
201#D--------------------------------------------------------------------==
202#D-                  2. ENTER THE DEEP EXECUTION LOOP
203#D-                  !!!! FASTEN YOUR SEAT BELTS !!!!
204#D-                  !!!!!      PLEASE.          !!!!
205#D-                  !! WE WILL CROSS TURBULENCES. !!
206#D--------------------------------------------------------------------==
207
208Period=1
209while [ ${Period} -le ${PeriodNb} ]; do
210
211    echo
212    echo "Starting iteration ${Period} / ${PeriodNb}"
213
214    #D-
215    # ------------------------------------------------------------------
216    #D- COMPUTE AND DEFINE DATE STUFF.
217    # ------------------------------------------------------------------
218    IGCM_config_PeriodStart
219    #D- => ${PeriodDateBegin}
220    #D- => ${PeriodDateEnd}
221    #D- => ${CumulPeriod}
222    #D- => ${DatesPeriod}=${PeriodDateBegin}_${PeriodDateEnd}
223    #D- => ${PeriodLength} => JOURS=31 , 28, 29, 30 ; MOIS=0 ; ANS=0
224    #D- => update run.card value
225   
226    #D-
227    # ------------------------------------------------------------------
228    #D- Get parameters text files updated by job (.def, namelist ...)
229    #D- READ AND USE BY GCM AT EACH EXECUTION.
230    # ------------------------------------------------------------------
231    IGCM_comp_GetInputParametersFiles
232
233    #D-
234    # ------------------------------------------------------------------
235    #D- Get initial state (Etat0, carteveg,relief...)
236    #D- NECESSARY ONLY IF CumulPeriod= (=> NUMERO) == 1
237    #D- AND ???_Restart=NO
238    #D- READ AND USE BY GCM FOR ONLY ONE EXECUTION.
239    # ------------------------------------------------------------------
240    IGCM_comp_GetInputInitialStateFiles
241
242    #D-
243    # ------------------------------------------------------------------
244    #D- Get Boundaries Conditions (SST, WIND[X,Y,Z], LAI ...)
245    #D- READ AND USE BY GCM AT EACH EXECUTION.
246    # ------------------------------------------------------------------
247    IGCM_comp_GetInputBoundaryFiles
248
249    #D-
250    # ------------------------------------------------------------------
251    #D- Get restart files (restartphy.nc, orca_restart.nc ...)
252    #D- READ AND USE BY GCM AT EACH EXECUTION.
253    #D-
254    #D- IF A COMPONENT DO NOT RESTART FROM PREVIOULSY COMPUTED RESTART
255    #D- ONLY IF CumulPeriod= (=> NUMERO) == 1
256    #D- MUST EXECUTE CREATE ETAT0_LIMIT (TYPICALLY LMDZ AND ./create_etat0_limit.e)
257    #D-
258    #D- IF CumulPeriod == 1
259    #D- AND A COMPONENT RESTART FROM PREVIOULSY COMPUTED RESTART
260    #D- MUST BRING THIS RESTART IN ${RUN_DIR_PATH}
261    #D-
262    #D- ELSE BRING RESTART FROM ${JobName} IN ${RUN_DIR_PATH}
263    # ------------------------------------------------------------------
264    IGCM_comp_GetInputRestartFiles
265   
266    #D-
267    # ------------------------------------------------------------------
268    #D- Test if all was right before Update
269    # ------------------------------------------------------------------
270    IGCM_debug_Verif_Exit
271
272    # ------------------------------------------------------------------
273    #D- Activate running environnement variables
274    # ------------------------------------------------------------------
275    IGCM_sys_activ_variables
276
277    #D-
278    # ------------------------------------------------------------------
279    #D- UPDATE ParametersFiles (.def, namelist ...) with
280    #D- current value of (ORCA_NIT00, ORCA_LRSTAR, RAZ_DATE, ...)
281    # ------------------------------------------------------------------
282    IGCM_comp_Update
283
284    #D-
285    # ------------------------------------------------------------------
286    #D- Test if all was right before execution
287    # ------------------------------------------------------------------
288    IGCM_debug_Verif_Exit
289
290    #D-
291    #D----------------------------------------------------------------==
292    #D-                          3. Execution
293    #D----------------------------------------------------------------==
294
295    echo
296    echo "#######################################"
297    echo "#      DIR BEFORE RUN EXECUTION       #"
298    echo "#######################################"
299    echo
300    ls -lrt
301
302    echo "========================================================================"
303    if ( [ X${BATCH_NUM_PROC_TOT} != X ] && [ "${BATCH_NUM_PROC_TOT}" -gt 1 ] ) ; then
304        MPIRUN_COMMAND=${HOST_MPIRUN_COMMAND}
305        eval MPIRUN_OPTIONS=${config_UserChoices_JobRunOptions}
306    else
307        MPIRUN_COMMAND=${MPIRUN_COMMAND:="time "}
308        MPIRUN_OPTIONS=${MPIRUN_OPTIONS:=""}
309    fi
310
311    if [ ${DRYRUN} -le 1 ] ; then
312        REAL_DATE_INIT=$( date )
313        echo "EXECUTION of : ${MPIRUN_COMMAND} ${MPIRUN_OPTIONS} ./${config_Executable_Name} > ${Exe_Output} 2>&1"
314        typeset RET
315        ${MPIRUN_COMMAND} ${MPIRUN_OPTIONS} ./${config_Executable_Name} > ${Exe_Output} 2>&1
316        RET=$?
317        if [ ${RET} -gt 0 ] ; then
318            echo "Return code of executable :" ${RET}
319            IGCM_debug_Exit "EXECUTABLE"
320            IGCM_sys_Cp ${Exe_Output} ${SUBMIT_DIR}/${PREFIX}_${Exe_Output}_error
321        fi
322        echo ${REAL_DATE_INIT} >> ${Exe_Output}
323        date >> ${Exe_Output}
324    else
325        echo "EXECUTION of : ${MPIRUN_COMMAND} ${MPIRUN_OPTIONS} ./${config_Executable_Name} simulated for DRYRUN = " $DRYRUN
326        echo "FOR EXECUTION DRYRUN mode = " $DRYRUN >> stack
327    fi
328    echo "========================================================================"
329
330    echo
331    echo "#######################################"
332    echo "#       DIR AFTER RUN EXECUTION       #"
333    echo "#######################################"
334    echo
335    ls -lrt
336
337    #D-
338    # ------------------------------------------------------------------
339    #D- Desactivate running environnement variables
340    # ------------------------------------------------------------------
341    IGCM_sys_desactiv_variables
342
343    #D-
344    #D----------------------------------------------------------------==
345    #D-                    4. Post execution operations
346    #D----------------------------------------------------------------==
347
348    #D-
349    # ------------------------------------------------------------------
350    #D- Save on archive machine netcdf outputs, restarts
351    #D- and text files of models
352    # ------------------------------------------------------------------
353    IGCM_comp_Finalize
354
355    #D-
356    # ------------------------------------------------------------------
357    #D- Test if all was right after Finalize
358    # ------------------------------------------------------------------
359    IGCM_debug_Verif_Exit
360
361    #D-
362    # ------------------------------------------------------------------
363    #D- Launch post-treatment process if necessary
364    # ------------------------------------------------------------------
365    IGCM_post_Initialize
366
367    #D-
368    # ------------------------------------------------------------------
369    #D- Save job output
370    #D- Manage executable size to save only different binary
371    #D- Write in run.card user, system and elapse time
372    #D- Check that everything went well ! No ? then we stop.
373    #D- Determine next computed period
374    # ------------------------------------------------------------------
375    IGCM_config_PeriodEnd
376
377    echo "Ending iteration ${Period}"
378    (( Period = Period + 1 ))
379
380    # End loop if date end is reached
381    if [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ; then
382        break ;
383    fi
384
385done 
386
387#D-
388#D--------------------------------------------------------------------==
389#D-     5. Submit next job or send mail if simulation over.
390#D--------------------------------------------------------------------==
391IGCM_config_Finalize
392
393date
Note: See TracBrowser for help on using the repository browser.