source: CMIP6/PAMIP/CM6-pa-piArcSIC-001/cm6111-ndg-std/Job_cm6111-ndg-std @ 5656

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