source: CMIP6/DECK/CM61-LR-4xCO2-01/Job_CM61-LR-4xCO2-01 @ 3879

Last change on this file since 3879 was 3879, checked in by mafoipsl, 6 years ago

CM61-LR-4xCO2-01 import.

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