source: CMIP6/PAMIP/CM6-pdSST-futAntSIC-001/CM6-pdSST-futAntSIC-001/Job_CM619-pamip-STD_SAVED_149812 @ 5160

Last change on this file since 5160 was 5160, checked in by ggalod, 4 years ago

sauvegarde exp PAMIP

File size: 19.9 KB
Line 
1#!/bin/ksh
2######################
3## IRENE   TGCC/CEA ##
4######################
5#MSUB -r CM619-pamip-STD        # Job Name
6#MSUB -o Script_Output_CM619-pamip-STD.000010    # standard output
7#MSUB -e Script_Output_CM619-pamip-STD.000010    # error output
8#MSUB -eo
9#MSUB -n 580  # Number of MPI tasks (SPMD case) or cores (MPMD case)
10#MSUB -x                    # exclusive node. To specify only for MPMD together with the one below
11#MSUB -T 12000              # Wall clock limit (seconds)
12#MSUB -A dcpcmip6
13#MSUB -q skylake
14#MSUB -m store,work,scratch
15###MSUB -S "05/01 14:05"
16
17BATCH_NUM_PROC_TOT=$BRIDGE_MSUB_NPROC
18set +x
19
20#**************************************************************
21# Author: Sebastien Denvil
22# Contact: Sebastien.Denvil__at__ipsl.jussieu.fr
23# $Revision:: 1460                                     $ Revision of last commit
24# $Author:: jgipsl                                     $ Author of last commit
25# $Date:: 2018-06-25 13:26:49 +0200 (Mon, 25 Jun 2018) $ Date of last commit
26# IPSL (2006)
27#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
28#
29#**************************************************************
30
31#set -eu
32#set -vx
33
34date
35echo
36echo "#######################################"
37echo "#       ANOTHER GREAT SIMULATION      #"
38echo "#######################################"
39echo
40
41#D--------------------------------------------------------------------==
42#D-
43#D-                      Job to launch IGCM models
44#D-
45#D--------------------------------------------------------------------==
46#D-
47
48MODIPSL=/ccc/cont003/dsku/perle2/home/app/gencmip6/p86ggas/PAMIP/26042019/modipsl
49libIGCM=${MODIPSL}/libIGCM
50
51#D--------------------------------------------------------------------==
52#D- -1. PLACE FOR USER MODIFICATION
53#D-     - Job Verbosity
54#D-     - PeriodNb
55#D-     - Experience type : DEB(ug), DEV(elopment), RUN
56#D--------------------------------------------------------------------==
57
58#D- Task type DO NOT CHANGE (computing, post-processing or checking)
59TaskType=computing
60
61#D- Increased verbosity (1, 2, 3)
62Verbosity=3
63
64#D- postProcessingStopLevel (0,1,2,3)
65#D- 3 stop the main job if any post-processing went wrong (atlas, monitoring, metrics, create_ts, create_se, rebuild or pack_*)
66#D- 2 stop only if create_ts, create_se or pack_* failed  (dont stop if atlas, monitoring or metrics failed)
67#D- 1 stop only if pack_* failed (dont stop if atlas, monitoring, metrics, create_ts or create_se failed)
68#D- 0 never stop the main job for post-processing that went wrong
69postProcessingStopLevel=1
70
71#D- Experience type : DEB(ug), DEV(elopment), RUN (default)
72#D- DEB : set -vx mode + output files are NOT read only
73#D- DEV : output files are NOT read only
74#D- RUN : output files ARE read only
75JobType=RUN
76
77#D- Number of execution in one job
78PeriodNb=1
79
80#D-
81#D- --------------------------------------------------------------------------------------------------#
82#D-                          ! OPTIONNAL FEATURES /!\ USE WITH CARE !                                 #
83#D- --------------------------------------------------------------------------------------------------#
84
85
86#D- Low level debug : to perform lib test checks, stack construction and IO functions instrumentation
87#D- Default=true
88#D-
89DEBUG_debug=true
90
91#D- Messaging : all activities and call stacks will be sent to ipsl servers
92#D- If true will imply DEBUG_debug=true
93#D- Default=false
94#D-
95BigBrother=true
96
97#D- Set DEBUG_sys to false to disable output calls of function
98#D- true when JobType=DEB # means DEB(ug)
99#D-
100#DEBUG_sys=false
101
102#D- Define running directory
103#D- Default=${TMPDIR} ie temporary batch directory
104#D-
105#RUN_DIR_PATH=/workdir/or/scratchdir/of/this/machine
106
107#D- Define submit directory
108#D- Default= where you launch qsub (variable from scheduler)
109#D-
110#SUBMIT_DIR=$( pwd )
111
112#D- Define input file root directory
113#D- Default=/IGCMG/common/account/of/this/machine
114#D- IPSL:   /prodigfs/ipslfs/igcmg/IGCM
115#D- TGCC:   /ccc/work/cont003/igcmg/igcmg/IGCM
116#D- IDRIS:  /workgpfs/rech/psl/rpsl035/IGCM
117#D- OBELIX: /home/orchideeshare/igcmg/IGCM
118#D- OTHER:  /home/${LOGIN}/IGCM
119
120#D- Change below to override the default
121#R_IN=/u/rech/por/rpor111/DATA
122
123#D- Turn in dry run mode ? (0,1,2,3)
124#D- Default=0
125#D-
126#DRYRUN=3
127#D-# YOU HAVE TO COMPILE YOUR EXE FILES to USE DRYRUN MODE !
128#D-# -------------------------------------------------------------------------------------
129#D-# | DRYRUN=  |  Date computations, | sys_Get    |  Exe    | sys_Put_Out; sys_Put_Rest |
130#D-# |          |  Cp/Exe/param/files |            |         |                           |
131#D-# |          |  Chmod Qsub         |            |         |                           |
132#D-# -------------------------------------------------------------------------------------
133#D-# |    0     |       yes           |    yes     |  yes    |      yes                  |
134#D-# -------------------------------------------------------------------------------------
135#D-# |    1     |       yes           |    yes     |  yes    |      no                   |
136#D-# -------------------------------------------------------------------------------------
137#D-# |    2     |       yes           |    yes     |  no     |      no                   |
138#D-# -------------------------------------------------------------------------------------
139#D-# |    3     |       yes           |    no      |  no     |      no                   |
140#D-# -------------------------------------------------------------------------------------
141
142#D-
143# --------------------------------------------------------------------------------------------------#
144#D- ! END OF OPTIONNAL FEATURES /!\ DO NOT MODIFY ANYTHING BELOW UNLESS YOU KNOW WHAT YOU ARE DOING #
145# --------------------------------------------------------------------------------------------------#
146
147#D-
148#D--------------------------------------------------------------------==
149#D- 0.0 SYSTEM ENVIRONMENT
150#D-     - Define variables for Number of processors
151#D-     - Define MPI variables
152#D-     - Define batch scheduler variables
153#D-     - Source IGCM Library
154#D-     - Get RESOLution in .resol file (temporary)
155#D--------------------------------------------------------------------==
156
157#---------------------------------------------------------------------==
158
159. ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh
160. ${libIGCM}/libIGCM_card/libIGCM_card.ksh
161. ${libIGCM}/libIGCM_date/libIGCM_date.ksh
162#-------
163. ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh
164. ${libIGCM}/libIGCM_config/libIGCM_config.ksh
165. ${libIGCM}/libIGCM_comp/libIGCM_comp.ksh
166. ${libIGCM}/libIGCM_post/libIGCM_post.ksh
167#-------
168( ${DEBUG_debug} ) && IGCM_debug_Check
169( ${DEBUG_debug} ) && IGCM_card_Check
170( ${DEBUG_debug} ) && IGCM_date_Check
171
172#--------------------------------------------------------------------==
173
174#-- Resolution FLAG for oasis input
175#RESOL="ORCA2xLMD9671"
176[ -f ${SUBMIT_DIR}/../.resol ] && RESOL=$(head -1 ${SUBMIT_DIR}/../.resol)
177#-- Chemistrie FLAG to ease chemistries configurations management
178#CHEM="AER"
179[ -f ${SUBMIT_DIR}/../.chimie ] && eval $(grep CHEM ${SUBMIT_DIR}/../.chimie)
180
181#D-
182#D--------------------------------------------------------------------==
183#D- 0.1 COMMON ENVIRONMENT
184#D-     - Read libIGCM compatibility version in config.card
185#D-     - Read UserChoices section
186#D-     - Read Ensemble section
187#D-     - Read Post section
188#D-     - Define all netcdf output directories
189#D--------------------------------------------------------------------==
190IGCM_config_CommonConfiguration ${SUBMIT_DIR}/config.card
191
192if [ ! -r ${SUBMIT_DIR}/run.card ] ; then
193  #================================================#
194  #         The file run.card doesn't exist        #
195  #================================================#
196  FirstInitialize=true
197  #copy initial run.card
198  IGCM_sys_Cp ${SUBMIT_DIR}/run.card.init ${SUBMIT_DIR}/run.card
199  IGCM_debug_Print 2 "run.card copied from run.card.init"
200else
201  FirstInitialize=false
202  IGCM_debug_Print 2 "run.card exists"
203fi
204
205# ------------------------------------------------------------------
206# Activate BigBrother so as to supervise this simulation
207# ------------------------------------------------------------------
208IGCM_debug_BigBro_Initialize
209
210#D-
211#D--------------------------------------------------------------------==
212#D- 1. INITIALIZE CONFIGURATION
213#D-    - Simulation configuration
214#D-    - Simulation parameters
215#D-    - Execution parameter
216#D-    - Define input files directory
217#D-    - Read or initialize CumulPeriod
218#D-    - run.card
219#D--------------------------------------------------------------------==
220IGCM_config_Initialize
221
222# --------------------------------------------------------------------==
223# Define, create and cd RUN_DIR
224# --------------------------------------------------------------------==
225RUN_DIR=${RUN_DIR_PATH}/${config_UserChoices_JobName}.${$}
226IGCM_sys_MkdirWork ${RUN_DIR}
227IGCM_sys_Cd ${RUN_DIR}
228
229# ------------------------------------------------------------------
230# Test if all was right before proceeding further
231# ------------------------------------------------------------------
232IGCM_debug_Verif_Exit
233
234#D-
235#D---------------------------------------------------------------------==
236#D- 2. INITIALIZE ALL COMPONENT OF THE CONFIGURATION
237#D-    - Define component executable
238#D-    - Define Write Frequency by component "1M" "1D" ...
239#D-    - Source ${comp}.driver
240#D-    - Define Storage Places by component
241#D-    - ${comp}_Initialize :
242#D-    - Patterns to sed
243#D-    - Variables from namelist
244#D---------------------------------------------------------------------==
245IGCM_comp_Initialize
246
247#D-
248#D---------------------------------------------------------------------==
249#D- 3. PERFORM GENERAL VERIFICATION
250#D-    - Verify compatibility of period length, write frequencies, ...
251#D-    - Verify compatibility of rebuild choices and post-process choices
252#D-    - Will stop here if something is wrong
253#D---------------------------------------------------------------------==
254IGCM_config_Check
255
256# ------------------------------------------------------------------
257# Test if all was right before entering the period loop
258# ------------------------------------------------------------------
259IGCM_debug_Verif_Exit
260
261#D-
262#D---------------------------------------------------------------------==
263#D- 4. ENTER THE DEEP EXECUTION LOOP
264#D-    ! FASTEN YOUR SEAT BELTS PLEASE. !
265#D-    !   WE WILL CROSS TURBULENCES.   !
266#D---------------------------------------------------------------------==
267
268Period=1
269
270PeriodContinue=false
271if [ ${Period} -le ${PeriodNb} ]; then
272  PeriodContinue=true
273fi
274while ( ${PeriodContinue} ) ; do
275
276  echo
277  echo "Starting iteration ${Period} / ${PeriodNb}"
278
279  #D-
280  # ------------------------------------------------------------------
281  #D-   4.1 COMPUTE AND DEFINE DATE INFORMATION.
282  #D-       - ${PeriodDateBegin}
283  #D-       - ${PeriodDateEnd}
284  #D-       - ${CumulPeriod}
285  #D-       - ${DatesPeriod}=${PeriodDateBegin}_${PeriodDateEnd}
286  #D-       - ${PeriodLength} => JOURS=31 , 28, 29, 30 ; MOIS=0 ; ANS=0
287  #D-       - update run.card value
288  # ------------------------------------------------------------------
289  IGCM_config_PeriodStart
290
291  #D-
292  # ------------------------------------------------------------------
293  #D-   4.2 BEGIN COMPUTATION ONLY IF NEEDED
294  # ------------------------------------------------------------------
295  if [ ${SimulationLengthInDays} -gt ${ExperienceLengthInDays} ] ; then
296    IGCM_debug_Print 1 "break because '\${SimulationLengthInDays} -gt \${ExperienceLengthInDays}' : ${SimulationLengthInDays} -gt ${ExperienceLengthInDays}"
297    break ;
298  fi
299
300  #D-
301  # ------------------------------------------------------------------
302  #D-   4.3 CALL OPTIONNAL FUNCTION WITHIN DRIVER
303  #D-       - to set special variables used in lists (Param, Init or Bc).
304  # ------------------------------------------------------------------
305  IGCM_comp_PeriodStart
306
307  #D-
308  # ------------------------------------------------------------------
309  #D-   4.4 GET PARAMETERS TEXT FILES UPDATED BY JOB
310  #D-       - (.def, namelist ...)
311  #D-       - READ AND USE BY GCM AT EACH EXECUTION.
312  # ------------------------------------------------------------------
313  IGCM_comp_GetInputParametersFiles
314
315  #D-
316  # ------------------------------------------------------------------
317  #D-   4.5 GET INITIAL STATE
318  #D-       - (Etat0, carteveg,relief...)
319  #D-       - NECESSARY ONLY IF CumulPeriod= (=> NUMERO) == 1
320  #D-       - AND ???_Restart=NO
321  #D-       - READ AND USE BY GCM FOR ONLY ONE EXECUTION.
322  # ------------------------------------------------------------------
323  IGCM_comp_GetInputInitialStateFiles
324
325  #D-
326  # ------------------------------------------------------------------
327  #D-   4.6 GET BOUNDARIES CONDITIONS
328  #D-       - (SST, WIND[X,Y,Z], LAI ...)
329  #D-       - READ AND USE BY GCM AT EACH EXECUTION.
330  # ------------------------------------------------------------------
331  IGCM_comp_GetInputBoundaryFiles
332
333  #D-
334  # ------------------------------------------------------------------
335  #D-   4.7 GET SmoothFiles CONDITIONS
336  #D-       - (SST, WIND[X,Y,Z], LAI ...)
337  #D-       - READ AND USE BY GCM AT EACH EXECUTION
338  #D-       - Do not change at each ${Period}
339  # ------------------------------------------------------------------
340  IGCM_comp_GetInputSmoothFiles
341
342  #D-
343  # ------------------------------------------------------------------
344  #D-   4.8 GET RESTART FILES
345  #D-       - (restartphy.nc, orca_restart.nc ...)
346  #D-       - READ AND USE BY GCM AT EACH EXECUTION.
347  #D-
348  #D-       - IF A COMPONENT DO NOT RESTART FROM PREVIOULSY COMPUTED RESTART
349  #D-       - ONLY IF CumulPeriod= (=> NUMERO) == 1
350  #D-       - MUST EXECUTE CREATE ETAT0_LIMIT (TYPICALLY LMDZ AND ./create_etat0_limit.e)
351  #D-
352  #D-       - IF CumulPeriod == 1
353  #D-       - AND A COMPONENT RESTART FROM PREVIOULSY COMPUTED RESTART
354  #D-       - MUST BRING THIS RESTART IN ${RUN_DIR_PATH}
355  #D-
356  #D-       - ELSE BRING RESTART FROM ${JobName} IN ${RUN_DIR_PATH}
357  # ------------------------------------------------------------------
358  IGCM_comp_GetInputRestartFiles
359
360  # ------------------------------------------------------------------
361  #D-   4.9 GET BINARY FILES
362  #D-       - USED BY AT EACH EXECUTION.
363  #D-       - CHECK BINARIES HAS BEEN COMPILED WITH THE SAME COMPILER
364  #D-       - RELOAD THE APPROPRIATE ENVIRONMENT THE FIRST TIME IF NEEDED
365  # ------------------------------------------------------------------
366  IGCM_comp_GetInputBinaryFiles
367
368  # ------------------------------------------------------------------
369  # Test if all was right before Update
370  # ------------------------------------------------------------------
371  IGCM_debug_Verif_Exit
372
373  #D-
374  # ------------------------------------------------------------------
375  #D-   4.10 ACTIVATE RUNNING ENVIRONNEMENT VARIABLES
376  #D-       - including module load associated to compiler & tools
377  #D-       - .env_intel17.0.2_curie
378  #D-       - .env_netcdf4.3.3.1_curie
379  # ------------------------------------------------------------------
380  IGCM_sys_activ_variables
381
382  #D-
383  # ------------------------------------------------------------------
384  #D-   4.11 UPDATE ParametersFiles
385  #D-        - (.def, namelist ...)
386  #D-        - with current value of (ORCA_NIT00, ORCA_LRSTAR, RAZ_DATE, ...)
387  # ------------------------------------------------------------------
388  IGCM_comp_Update
389
390  # ------------------------------------------------------------------
391  # Test if all was right before execution
392  # ------------------------------------------------------------------
393  IGCM_debug_Verif_Exit
394
395  #D-
396  #D---------------------------------------------------------------------==
397  #D- 5. 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  #D---------------------------------------------------------------------==
450  #D- 6. POST EXECUTION OPERATIONS
451  #D---------------------------------------------------------------------==
452
453  #D-
454  # ------------------------------------------------------------------
455  #D-   6.1. DESACTIVATE RUNNING ENVIRONNEMENT VARIABLES
456  # ------------------------------------------------------------------
457  IGCM_sys_desactiv_variables
458
459  #D-
460  # ------------------------------------------------------------------
461  #D-   6.2. SAVE OUTPUTS
462  #D-        - On archive/storage machine
463  #D-        - netcdf outputs, restarts and text files of models
464  # ------------------------------------------------------------------
465  IGCM_comp_Finalize
466
467  # ------------------------------------------------------------------
468  # Test if all was right after Finalize
469  # ------------------------------------------------------------------
470  IGCM_debug_Verif_Exit
471
472  #D-
473  # ------------------------------------------------------------------
474  #D-   6.3. CONFIGURE POST-PROCESSING
475  #D-        - asynchronous post-treatment (Level 0) when necessary (rebuild/pack)
476  #D-        - classic post-treatment      (Level 1) when necessary (TimeSeries/Seasonal)
477  # ------------------------------------------------------------------
478  IGCM_post_Configure
479
480  #D-
481  # ------------------------------------------------------------------
482  #D-   6.4. SUBMIT POST-PROCESSING
483  #D-        - remote rebuild or/and post-treatment process if necessary
484  # ------------------------------------------------------------------
485  IGCM_post_Submit
486
487  #D-
488  # ------------------------------------------------------------------
489  #D-   6.5. FINALYZE CURRENT LOOP AND PREPARE NEXT ONE
490  #D-        - Manage executable size to save only different binary
491  #D-        - Write in run.card user, system and elapse time
492  #D-        - Check that everything went well ! No ? then we stop.
493  #D-        - Determine next computed period
494  # ------------------------------------------------------------------
495  IGCM_config_PeriodEnd
496
497  echo "Ending iteration ${Period}"
498  (( Period = Period + 1 ))
499
500  # End loop if date end is reached
501  if [ ${SimulationLengthInDays} -ge ${ExperienceLengthInDays} ] ; then
502    break ;
503  fi
504
505  PeriodContinue=false
506  if [ ${Period} -le ${PeriodNb} ]; then
507    PeriodContinue=true
508  fi
509done
510
511#D-
512#D---------------------------------------------------------------------==
513#D- 7. SUBMIT NEXT JOB OR SEND MAIL IF SIMULATION IS OVER.
514#D---------------------------------------------------------------------==
515IGCM_config_Finalize
516
517date
Note: See TracBrowser for help on using the repository browser.