source: branches/SmoothFiles/AA_job

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

MM: Add SmoothFiles? with last commit (r6) corrections.

  • 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.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::.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 Smooth Files (special files in time LAND COVER CHANGE ...)
245    #D- READ AND USE BY GCM AT SOME EXECUTIONS.
246    # ------------------------------------------------------------------
247    IGCM_comp_GetInputSmoothFiles
248
249    #D-
250    # ------------------------------------------------------------------
251    #D- Get Boundaries Conditions (SST, WIND[X,Y,Z], LAI ...)
252    #D- READ AND USE BY GCM AT EACH EXECUTION.
253    # ------------------------------------------------------------------
254    IGCM_comp_GetInputBoundaryFiles
255
256    #D-
257    # ------------------------------------------------------------------
258    #D- Get restart files (restartphy.nc, orca_restart.nc ...)
259    #D- READ AND USE BY GCM AT EACH EXECUTION.
260    #D-
261    #D- IF A COMPONENT DO NOT RESTART FROM PREVIOULSY COMPUTED RESTART
262    #D- ONLY IF CumulPeriod= (=> NUMERO) == 1
263    #D- MUST EXECUTE CREATE ETAT0_LIMIT (TYPICALLY LMDZ AND ./create_etat0_limit.e)
264    #D-
265    #D- IF CumulPeriod == 1
266    #D- AND A COMPONENT RESTART FROM PREVIOULSY COMPUTED RESTART
267    #D- MUST BRING THIS RESTART IN ${RUN_DIR_PATH}
268    #D-
269    #D- ELSE BRING RESTART FROM ${JobName} IN ${RUN_DIR_PATH}
270    # ------------------------------------------------------------------
271    IGCM_comp_GetInputRestartFiles
272   
273    #D-
274    # ------------------------------------------------------------------
275    #D- Test if all was right before Update
276    # ------------------------------------------------------------------
277    IGCM_debug_Verif_Exit
278
279    # ------------------------------------------------------------------
280    #D- Activate running environnement variables
281    # ------------------------------------------------------------------
282    IGCM_sys_activ_variables
283
284    #D-
285    # ------------------------------------------------------------------
286    #D- UPDATE ParametersFiles (.def, namelist ...) with
287    #D- current value of (ORCA_NIT00, ORCA_LRSTAR, RAZ_DATE, ...)
288    # ------------------------------------------------------------------
289    IGCM_comp_Update
290
291    #D-
292    # ------------------------------------------------------------------
293    #D- Test if all was right before execution
294    # ------------------------------------------------------------------
295    IGCM_debug_Verif_Exit
296
297    #D-
298    #D----------------------------------------------------------------==
299    #D-                          3. Execution
300    #D----------------------------------------------------------------==
301
302    echo
303    echo "#######################################"
304    echo "#      DIR BEFORE RUN EXECUTION       #"
305    echo "#######################################"
306    echo
307    ls -lrt
308
309    echo "========================================================================"
310    if ( [ X${BATCH_NUM_PROC_TOT} != X ] && [ "${BATCH_NUM_PROC_TOT}" -gt 1 ] ) ; then
311        MPIRUN_COMMAND=${HOST_MPIRUN_COMMAND}
312        eval MPIRUN_OPTIONS=${config_UserChoices_JobRunOptions}
313    else
314        MPIRUN_COMMAND=${MPIRUN_COMMAND:="time "}
315        MPIRUN_OPTIONS=${MPIRUN_OPTIONS:=""}
316    fi
317
318    if [ ${DRYRUN} -le 1 ] ; then
319        REAL_DATE_INIT=$( date )
320        echo "EXECUTION of : ${MPIRUN_COMMAND} ${MPIRUN_OPTIONS} ./${config_Executable_Name} > ${Exe_Output} 2>&1"
321        typeset RET
322        ${MPIRUN_COMMAND} ${MPIRUN_OPTIONS} ./${config_Executable_Name} > ${Exe_Output} 2>&1
323        RET=$?
324        if [ ${RET} -gt 0 ] ; then
325            echo "Return code of executable :" ${RET}
326            IGCM_debug_Exit "EXECUTABLE"
327            IGCM_sys_Cp ${Exe_Output} ${SUBMIT_DIR}/${PREFIX}_${Exe_Output}_error
328        fi
329        echo ${REAL_DATE_INIT} >> ${Exe_Output}
330        date >> ${Exe_Output}
331    else
332        echo "EXECUTION of : ${MPIRUN_COMMAND} ${MPIRUN_OPTIONS} ./${config_Executable_Name} simulated for DRYRUN = " $DRYRUN
333        echo "FOR EXECUTION DRYRUN mode = " $DRYRUN >> stack
334    fi
335    echo "========================================================================"
336
337    echo
338    echo "#######################################"
339    echo "#       DIR AFTER RUN EXECUTION       #"
340    echo "#######################################"
341    echo
342    ls -lrt
343
344    #D-
345    # ------------------------------------------------------------------
346    #D- Desactivate running environnement variables
347    # ------------------------------------------------------------------
348    IGCM_sys_desactiv_variables
349
350    #D-
351    #D----------------------------------------------------------------==
352    #D-                    4. Post execution operations
353    #D----------------------------------------------------------------==
354
355    #D-
356    # ------------------------------------------------------------------
357    #D- Save on archive machine netcdf outputs, restarts
358    #D- and text files of models
359    # ------------------------------------------------------------------
360    IGCM_comp_Finalize
361
362    #D-
363    # ------------------------------------------------------------------
364    #D- Test if all was right after Finalize
365    # ------------------------------------------------------------------
366    IGCM_debug_Verif_Exit
367
368    #D-
369    # ------------------------------------------------------------------
370    #D- Launch post-treatment process if necessary
371    # ------------------------------------------------------------------
372    IGCM_post_Initialize
373
374    #D-
375    # ------------------------------------------------------------------
376    #D- Save job output
377    #D- Manage executable size to save only different binary
378    #D- Write in run.card user, system and elapse time
379    #D- Check that everything went well ! No ? then we stop.
380    #D- Determine next computed period
381    # ------------------------------------------------------------------
382    IGCM_config_PeriodEnd
383
384    echo "Ending iteration ${Period}"
385    (( Period = Period + 1 ))
386
387    # End loop if date end is reached
388    if [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ; then
389        break ;
390    fi
391
392done 
393
394#D-
395#D--------------------------------------------------------------------==
396#D-     5. Submit next job or send mail if simulation over.
397#D--------------------------------------------------------------------==
398IGCM_config_Finalize
399
400date
Note: See TracBrowser for help on using the repository browser.