source: tags/libIGCM_v2.2/AA_rebuild_fromWorkdir

Last change on this file was 929, checked in by sdipsl, 11 years ago

machine cleanup
whitespace cleanup

  • Property svn:keywords set to Revision Author Date
File size: 7.3 KB
Line 
1#-Q- curie ######################
2#-Q- curie ## CURIE   TGCC/CEA ##
3#-Q- curie ######################
4#-Q- curie #MSUB -r REBUILDWRK     # Nom du job
5#-Q- curie #MSUB -eo
6#-Q- curie #MSUB -n 1              # Reservation du processus
7#-Q- curie #MSUB -T 36000          # Limite de temps elapsed du job
8#-Q- curie #MSUB -q xlarge
9#-Q- curie #MSUB -Q normal
10#-Q- curie #MSUB -A ::default_project::
11#-Q- curie set +x
12#-Q- ada #!/bin/ksh
13#-Q- ada #######################
14#-Q- ada ## ADA         IDRIS ##
15#-Q- ada #######################
16#-Q- ada # @ job_type = serial
17#-Q- ada # @ requirements = (Feature == "prepost")
18#-Q- ada # Temps Elapsed max. d'une requete hh:mm:ss
19#-Q- ada # @ wall_clock_limit = 10:00:00
20#-Q- ada # Nom du travail LoadLeveler
21#-Q- ada # @ job_name   = REBUILDWRK
22#-Q- ada # Fichier de sortie standard du travail
23#-Q- ada # @ output     = $(job_name).$(jobid)
24#-Q- ada # Fichier de sortie d'erreur du travail
25#-Q- ada # @ error      =  $(job_name).$(jobid)
26#-Q- ada # pour recevoir un mail en cas de depassement du temps Elapsed (ou autre pb.)
27#-Q- ada # @ notification = error
28#-Q- ada # @ environment  = $DEBUG_debug ; $MODIPSL ; $libIGCM ; $libIGCM_SX ; $SUBMIT_DIR ; $REBUILD_DIR ; $RebuildFromArchive ; $POST_DIR ; $DateBegin ; $PeriodDateBegin ; $PeriodDateEnd ; $NbRebuildDir ; $StandAlone ; $RESOL_ATM ; $RESOL_OCE ; $RESOL_ICE ; $RESOL_MBG ; $RESOL_SRF ; $RESOL_SBG ; $MASTER
29#-Q- ada # @ queue
30#-Q- lxiv8 ######################
31#-Q- lxiv8 ## OBELIX      LSCE ##
32#-Q- lxiv8 ######################
33#-Q- lxiv8 #PBS -N REBUILDWRK
34#-Q- lxiv8 #PBS -m a
35#-Q- lxiv8 #PBS -j oe
36#-Q- lxiv8 #PBS -q medium
37#-Q- lxiv8 #PBS -o REBUILDWRK.$$
38#-Q- lxiv8 #PBS -S /bin/ksh
39#-Q- default #!/bin/ksh
40#-Q- default ##################
41#-Q- default ## DEFAULT HOST ##
42#-Q- default ##################
43
44#**************************************************************
45# Author: Sebastien Denvil
46# Contact: Sebastien.Denvil__at__ipsl.jussieu.fr
47# $Revision::                                          $ Revision of last commit
48# $Author::                                            $ Author of last commit
49# $Date::                                              $ Date of last commit
50# IPSL (2006)
51#  This software is governed by the CeCILL licence see libIGCM/libIGCM_CeCILL.LIC
52#
53#**************************************************************
54
55#set -eu
56#set -vx
57
58date
59
60#-Q- ada export OMP_NUM_THREADS=1
61
62#D- Task type (computing or post-processing)
63TaskType=post-processing
64
65########################################################################
66
67#D- Flag to determine if this job in a standalone mode
68#D- Default : value from AA_job if any
69StandAlone=${StandAlone:=true}
70
71#D- Path to libIGCM
72#D- Default : value from AA_job if any
73# WARNING For StandAlone use : To run this script on some machine (ulam and cesium)
74# WARNING you must check MirrorlibIGCM variable in sys library.
75# WARNING If this variable is true, you must use libIGCM_POST path instead
76# WARNING of your running libIGCM directory.
77libIGCM=${libIGCM:=::modipsl::/libIGCM}
78
79#-D- $hostname of the MASTER job when SUBMIT_DIR is not visible on postprocessing computer.
80MASTER=${MASTER:=ada|curie}
81
82#D- Do we rebuild parallel output from archive or from ${BIGDIR}
83#D- Default : value from AA_job if any
84RebuildFromArchive=${RebuildFromArchive:=false}
85
86#D- Directory where files we need to rebuild are store
87#D- Default : value from AA_job if any
88#D- if RebuildFromArchive=true REBUILD_DIR=${DMFDIR}/IGCM_OUT/.../JobName/TMP
89#D- example : /dmnfs09/cont003/p86denv/IGCM_OUT/IPSLCM5/CM5PIRC7/TMP
90#D- if RebuildFromArchive=false REBUILD_DIR=${BIGDIR}/REBUILD/TagName/JobName/
91#D- example : /scratch/cont003/p86denv/REBUILD/IPSLCM5/SCAL-NEW
92REBUILD_DIR=${REBUILD_DIR:=/path/to/your/TMP/REBUILD/FILES}
93
94#D- How many directory to rebuild we have to consider
95#D- Default : value from AA_job if any
96NbRebuildDir=${NbRebuildDir:=1000}
97
98#D- Suffix date we will use to determine which directory to rebuild
99#D- We will rebuild NbRebuildDir before and including PeriodDateBegin
100#D- Default : value from AA_job if any
101LastPeriodForRebuild=${LastPeriodForRebuild:=${PeriodDateBegin:=18901201}}
102
103#D- Flag to determine atlas job's output directory
104#D- Default : value from libIGCM_post.ksh if any
105POST_DIR=${POST_DIR:=${PBS_O_WORKDIR}}
106
107#-D- libIGCM_SX contains libIGCM on Master computer. Required on some center. Always OK.
108libIGCM_SX=${libIGCM_SX:=::modipsl::/libIGCM}
109
110#D- Increased verbosity (1, 2, 3)
111#D- Default : value from AA_job if any
112Verbosity=${Verbosity:=3}
113
114#D- Low level debug : to bypass lib test checks and stack construction
115#D- Default : value from AA_job if any
116DEBUG_debug=${DEBUG_debug:=false}
117
118#D- TEMPORARY Flag to determine atmospheric resolution
119#D- Default : value from atmospheric driver if any
120RESOL_ATM=${RESOL_ATM:=ALL}
121
122#D- TEMPORARY Flag to determine ocean resolution
123#D- Default : value from ocean driver if any
124RESOL_OCE=${RESOL_OCE:=ORCA2}
125
126#D- TEMPORARY Flag to determine ice resolution
127#D- Default : value from ice driver if any
128RESOL_ICE=${RESOL_ICE:=ORCA2}
129
130#D- TEMPORARY Flag to determine biogeochemistry resolution
131#D- Default : value from ice driver if any
132RESOL_MBG=${RESOL_MBG:=ORCA2}
133
134#D- Flag to determine surface resolution
135#D- Default : value from surface driver if any
136RESOL_SRF=ALL
137
138#D- Flag to determine surface resolution
139#D- Default : value from surface driver if any
140RESOL_SBG=ALL
141
142########################################################################
143
144. ${libIGCM}/libIGCM_debug/libIGCM_debug.ksh
145. ${libIGCM}/libIGCM_card/libIGCM_card.ksh
146. ${libIGCM}/libIGCM_date/libIGCM_date.ksh
147#-------
148. ${libIGCM}/libIGCM_sys/libIGCM_sys.ksh
149. ${libIGCM}/libIGCM_post/libIGCM_post.ksh
150#-------
151( ${DEBUG_debug} ) && IGCM_debug_Check
152( ${DEBUG_debug} ) && IGCM_card_Check
153( ${DEBUG_debug} ) && IGCM_date_Check
154
155########################################################################
156
157#set -vx
158
159RUN_DIR=${RUN_DIR_PATH}
160IGCM_sys_MkdirWork ${RUN_DIR}
161IGCM_sys_Cd ${RUN_DIR}
162
163# ------------------------------------------------------------------
164# Test if all was right before proceeding further
165# ------------------------------------------------------------------
166IGCM_debug_Verif_Exit_Post
167
168#
169if [ ${RebuildFromArchive} = true ] ; then
170  ListAllRebuildDir=$( IGCM_sys_RshArchive ls -d ${REBUILD_DIR}/REBUILD_* | grep -B $(( ${NbRebuildDir} -1 )) ${LastPeriodForRebuild} )
171else
172  ListAllRebuildDir=$( IGCM_sys_RshMaster ls -d ${REBUILD_DIR}/REBUILD_* | grep -B $(( ${NbRebuildDir} -1 )) ${LastPeriodForRebuild} )
173fi
174#
175
176for directory in ${ListAllRebuildDir} ; do
177  #
178  if [ ${RebuildFromArchive} = true ] ; then
179    IGCM_sys_Get_Dir ${directory} ${RUN_DIR}
180  else
181    IGCM_sys_Get_Master ${directory} ${RUN_DIR}
182  fi
183  #
184  IGCM_sys_Cd ${RUN_DIR}/$( basename ${directory} )
185
186  # --------------------------------------------------------------------
187  # Source function include in the REBUILD ksh and rebuild
188  # --------------------------------------------------------------------
189  . ${RUN_DIR}/$( basename ${directory} )/rebuild.ksh
190  IGCM_FlushRebuild
191  #
192  IGCM_sys_Cd ${RUN_DIR}
193  # Clean Up
194  # local clean up
195  IGCM_sys_Rm -rf $( basename ${directory} )
196  # remote clean up
197  if [ ${RebuildFromArchive} = true ] ; then
198    IGCM_sys_RshArchive rm -rf ${directory}
199  else
200    IGCM_sys_RshMaster rm -rf ${directory}
201  fi
202done
203
204# Clean RUN_DIR_PATH (necessary for cesium and titane only)
205IGCM_sys_RmRunDir -Rf ${RUN_DIR_PATH}
206
207date
Note: See TracBrowser for help on using the repository browser.