source: CMIP6/PAMIP/CM6-pdSST-futAntSIC-001/CM6-pdSST-futAntSIC-001/Job_CM6-pdSST-futAntSIC-001-old2 @ 5160

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

sauvegarde exp PAMIP

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