1 | #@$-r GYRE.1 # name of job |
---|
2 | #@$-me # sends a mail at the end of execution |
---|
3 | #@$-eo # merge standard error and output |
---|
4 | # in one file |
---|
5 | #@$-o sortie_GYRE.1 # name of the output file (listing) |
---|
6 | #@$-lT 2:00:00 # Max total CPU time |
---|
7 | #@$-lt 1:59:00 # Max CPU time per process |
---|
8 | #@$-lM 2Gb # Max memory |
---|
9 | #-Q- sxnec ## NEC |
---|
10 | #-Q- sxnec #@$-jo # print a short performance analysis |
---|
11 | #-Q- sxnec # at the end of the listing |
---|
12 | ## Temporary comments |
---|
13 | ###-Q- sxnec #@$-c 4 # Max number of simultaneous procs used (here=4) |
---|
14 | ###-Q- sxnec #@$-q multi # Use more than 1 proc |
---|
15 | ## End of Temporary comments |
---|
16 | #-Q- fjvpp ## VPP |
---|
17 | #-Q- fjvpp #@$-ko # Keep the output listing on disk |
---|
18 | #-Q- fjvpp #@$-s /bin/ksh # Name of the shell used for this script |
---|
19 | #-Q- fjvpp #@$-lP 3 # Number of procs (here=3) |
---|
20 | # |
---|
21 | # |
---|
22 | # |
---|
23 | ######################################################################## |
---|
24 | ## |
---|
25 | ## Script to run the GYRE configuration |
---|
26 | ## |
---|
27 | ## Claire Levy |
---|
28 | ## |
---|
29 | ## Original Script: |
---|
30 | ## Coupled IPSL experiment Eric MAISONNAVE / Marie-Alice FOUJOLS |
---|
31 | ## |
---|
32 | ######################################################################### |
---|
33 | ##-- print echo of commands before and after shell interpretation |
---|
34 | date |
---|
35 | set -vx |
---|
36 | ## |
---|
37 | ## |
---|
38 | ##-- Name of the experiment |
---|
39 | ##-- |
---|
40 | CEXPER=GYRE |
---|
41 | # - Directory for executables |
---|
42 | # |
---|
43 | # ! Attention ! The executables are to be copied from the modipsl/bin |
---|
44 | # directory |
---|
45 | # |
---|
46 | R_EXE=$WORKDIR/${CEXPER}/Exe |
---|
47 | # |
---|
48 | # |
---|
49 | |
---|
50 | JOB=${CEXPER} |
---|
51 | ##-- First day of the experiment |
---|
52 | JOUR_DEBUT_EXP=1 ; MOIS_DEBUT_EXP=1 ; AN_DEBUT_EXP=1 |
---|
53 | ##-- |
---|
54 | ##-- Last day of the experiment |
---|
55 | JOUR_FINAL_EXP=31 ; MOIS_FINAL_EXP=12 ; AN_FINAL_EXP=1 |
---|
56 | ##-- |
---|
57 | ##-- Duration of the experiment |
---|
58 | JOURS=0; MOIS=0 ; ANS=1 |
---|
59 | ## |
---|
60 | ######################################################################### |
---|
61 | ## |
---|
62 | ## 1. Unix Variables definition |
---|
63 | ## |
---|
64 | ######################################################################### |
---|
65 | ## |
---|
66 | ##-- Get the submisson directory |
---|
67 | echo $QSUB_WORKDIR |
---|
68 | ##-- Get the directory controlling the chaining of the jobs |
---|
69 | R_EXPER=${QSUB_WORKDIR} |
---|
70 | ## |
---|
71 | ## |
---|
72 | MKDIR="mkdir" |
---|
73 | #-Q- fjvpp MKDIR="/usr/X11R6/bin/mkdirhier" |
---|
74 | # |
---|
75 | ##--- Variables used by the ocean model |
---|
76 | # ----------------- GYRE -------------- |
---|
77 | # |
---|
78 | JOB=$( echo ${CEXPER} | tr '[a-z]' '[A-Z]' ) |
---|
79 | # |
---|
80 | # |
---|
81 | # |
---|
82 | ######################################################################### |
---|
83 | ## |
---|
84 | ## 2. Directories definition |
---|
85 | ## |
---|
86 | ######################################################################### |
---|
87 | # - Data directory for input/output of the model |
---|
88 | # |
---|
89 | #-Q- sxnec R_DONNEES=${WORKDIR}/EXPER/${CEXPER} |
---|
90 | #-Q- fjvpp R_DONNEES=${WORKDIR}/EXPER/${CEXPER} |
---|
91 | # |
---|
92 | # |
---|
93 | # ----------------- GYRE -------------------- |
---|
94 | # |
---|
95 | R_ENTREE_OCE=${R_DONNEES}/Entree/Oce |
---|
96 | R_SORTIE_OCE=${R_DONNEES}/Sortie/Oce |
---|
97 | # |
---|
98 | # |
---|
99 | if [ ! -d ${R_DONNEES} ]; then |
---|
100 | mkdir -p ${R_ENTREE_OCE} |
---|
101 | mkdir -p ${R_SORTIE_OCE} |
---|
102 | mkdir -p ${R_DONNEES}/SortieTest/Oce |
---|
103 | fi |
---|
104 | # |
---|
105 | # - Get the tarfile containing all the usefull files |
---|
106 | # |
---|
107 | # |
---|
108 | #-- Directory definition for the data storage computer (where the tarfile is) |
---|
109 | #-Q- sxnec R_STOCKAGE="gaya:/u/DODS/pub/reee055/ORCA2_LIM" |
---|
110 | #-Q- fjvpp R_STOCKAGE="/G/nymphea0/dmnfs/" |
---|
111 | #-- |
---|
112 | #-- Test if the tarfile is already there before geting it from the data storage |
---|
113 | #-- |
---|
114 | #-Q- sxnec Rapatrie () { [ -f $1/$3 ] || ( rcp ${R_STOCKAGE}/$2/$3 $1 ; cd $1; tar xvf $3 ;) } |
---|
115 | #-Q- fjvpp Rapatrie () { [ -f $1/$3 ] || ( cp ${R_STOCKAGE}/$2/$3 $1 ; cd $1; tar xvf $3 ;) } |
---|
116 | |
---|
117 | # |
---|
118 | Rapatrie ${R_ENTREE_OCE} ENTREE Entree_Oce.tar |
---|
119 | Rapatrie ${R_DONNEES}/SortieTest/Oce VERIF SortieTest_Oce.tar |
---|
120 | |
---|
121 | # |
---|
122 | # - Temporary working directory |
---|
123 | # |
---|
124 | #-Q- sxnec TMP=${TMPDIR}/${CEXPER} |
---|
125 | #-Q- fjvpp TMP=${SCRATCHDIR}/${CEXPER} |
---|
126 | # |
---|
127 | #-- Create this directory if needed |
---|
128 | [ -d ${TMP} ] || ${MKDIR} ${TMP} |
---|
129 | # |
---|
130 | # |
---|
131 | ######################################################################### |
---|
132 | ## |
---|
133 | ## 3. Pre-processing |
---|
134 | ## |
---|
135 | ######################################################################### |
---|
136 | # |
---|
137 | # ============================================================================= |
---|
138 | # Time control |
---|
139 | # ============================================================================= |
---|
140 | cd ${R_EXPER} |
---|
141 | ## |
---|
142 | ##- Create ${JOB}.suivi containing the date of the run going on or the date |
---|
143 | ##- of the first waiting job, and ${JOB}.log containing execution log |
---|
144 | ## |
---|
145 | if [ ! -f "${JOB}.suivi" ] |
---|
146 | then |
---|
147 | JOUR_DEB_JOB=${JOUR_DEBUT_EXP} ; MOIS_DEB_JOB=${MOIS_DEBUT_EXP} ; AN_DEB_JOB=${AN_DEBUT_EXP} |
---|
148 | NUMERO=1 |
---|
149 | cat <<EOF >${JOB}.suivi |
---|
150 | $AN_DEB_JOB $MOIS_DEB_JOB $JOUR_DEB_JOB $NUMERO |
---|
151 | EOF |
---|
152 | echo `date` " Begining of Experience : " ${JOB} " in directory :" ${R_EXPER} > ${JOB}.log |
---|
153 | fi |
---|
154 | |
---|
155 | cat ${JOB}.suivi | read AN_DEB_JOB MOIS_DEB_JOB JOUR_DEB_JOB NUMERO |
---|
156 | echo $AN_DEB_JOB $MOIS_DEB_JOB $JOUR_DEB_JOB |
---|
157 | echo "`date` $AN_DEB_JOB $MOIS_DEB_JOB $JOUR_DEB_JOB begin" >> ${JOB}.log |
---|
158 | |
---|
159 | |
---|
160 | |
---|
161 | # ============================================================================== |
---|
162 | # Copy executables |
---|
163 | # ============================================================================== |
---|
164 | if [ -z ${TMP} ]; then |
---|
165 | echo " The TMP variable is empty !!!" |
---|
166 | exit |
---|
167 | fi |
---|
168 | cd ${TMP} || exit |
---|
169 | #- Clear working directory |
---|
170 | rm -f * |
---|
171 | |
---|
172 | #- Get executables |
---|
173 | # ----------------- GYRE ----------------------- |
---|
174 | cp ${R_EXE}/opa opa.xx |
---|
175 | # |
---|
176 | # |
---|
177 | #-Q- sxnec # ----------------- GYRE ----------------------- |
---|
178 | #-Q- sxnec # Reminder for the cpp keys used |
---|
179 | #-Q- sxnec # |
---|
180 | #-Q- sxnec OPT_COMPIL_ORCA=` mcs -p opa.xx | grep key_orca | head -1 ` |
---|
181 | #-Q- sxnec # |
---|
182 | #-Q- sxnec echo ${OPT_COMPIL_ORCA} |
---|
183 | #-Q- sxnec # |
---|
184 | #-Q- sxnec #-- Check ocean model resolution |
---|
185 | #-Q- sxnec RESOL_ORCA=` echo ${OPT_COMPIL_ORCA} | sed s/.*key_orca_r// | sed s/-Wp.*// ` |
---|
186 | #-Q- sxnec if [ ${RESOL_ORCA} -ne "2" ] ; then |
---|
187 | #-Q- sxnec echo " Resolution of the executable for the ocean model is not correct : " ${RESOL_ORCA} |
---|
188 | #-Q- sxnec fi |
---|
189 | # |
---|
190 | #-Q- sxnec #-- Ckeck for real and integer size |
---|
191 | #-Q- sxnec #-- in the ocean executable |
---|
192 | #-Q- sxnec IR_ORCA=` echo ${OPT_COMPIL_ORCA} | grep "-ew" ` |
---|
193 | #-Q- sxnec if [ -n ${IR_ORCA} ]; then |
---|
194 | #-Q- sxnec echo 'Taille des reels : 8 ' |
---|
195 | #-Q- sxnec echo 'Taille des entiers : 8 ' |
---|
196 | #-Q- sxnec else |
---|
197 | #-Q- sxnec echo ' ATTENTION: ocean executable has not been compiled in I8R8 ' |
---|
198 | #-Q- sxnec exit |
---|
199 | #-Q- sxnec fi |
---|
200 | |
---|
201 | # ============================================================================== |
---|
202 | # Update the namelist |
---|
203 | # ============================================================================== |
---|
204 | # |
---|
205 | # ----------------- GYRE --------------------- |
---|
206 | # |
---|
207 | # |
---|
208 | # change namelist from fortran 77 to fortran 90 |
---|
209 | sed -e /:/d -e s/" \&END"/"\/"/ -e s/" \&"/"\&"/ ${R_ENTREE_OCE}/namelist > namelist |
---|
210 | # |
---|
211 | PAT_NO=$( grep 'no' namelist | grep -v off ) |
---|
212 | PAT_CEXPER=$( grep 'cexper' namelist ) |
---|
213 | PAT_RESTAR=$( grep 'lrstar' namelist ) |
---|
214 | PAT_NRSTAR=$( grep 'nrstdt' namelist ) |
---|
215 | PAT_NMSH=$( grep 'nmsh' namelist ) |
---|
216 | PAT_NDATE0=$( grep 'ndate0' namelist ) |
---|
217 | |
---|
218 | |
---|
219 | if [ ${NUMERO} -eq 1 ] |
---|
220 | then |
---|
221 | #- At the beginning of the experiment: |
---|
222 | #- No check of the date of restart (since there is no restart) |
---|
223 | #- Create the meshmask file (usefull for graphics) |
---|
224 | sed -e "s/$PAT_CEXPER/ cexper=\"$CEXPER\"/" \ |
---|
225 | -e "s/$PAT_NMSH/ nmsh=1/" \ |
---|
226 | namelist > nam.tmp |
---|
227 | else |
---|
228 | #- Check the date of restart for all the following job submission |
---|
229 | sed -e "s/$PAT_CEXPER/ cexper=\"$CEXPER\"/" \ |
---|
230 | -e "s/$PAT_RESTAR/ lrstar=.TRUE./" \ |
---|
231 | -e "s/$PAT_NMSH/ nmsh=0/" \ |
---|
232 | -e "s/$PAT_NRSTAR/ nrstdt=1/" \ |
---|
233 | -e "s/$PAT_NDATE0/ ndate0=$DATE_DEB_JOB/" \ |
---|
234 | namelist > nam.tmp |
---|
235 | fi |
---|
236 | |
---|
237 | mv nam.tmp namelist |
---|
238 | |
---|
239 | |
---|
240 | # |
---|
241 | # ============================================================================== |
---|
242 | # Copy input files |
---|
243 | # ============================================================================== |
---|
244 | # |
---|
245 | # ----------------- GYRE --------------------- |
---|
246 | # |
---|
247 | # - Copy auxilliary files |
---|
248 | # |
---|
249 | # WARNING: No input data files for the GYRE configuration |
---|
250 | # |
---|
251 | # - Copy of the restart file |
---|
252 | # |
---|
253 | |
---|
254 | if [ ${NUMERO} -ne 1 ] |
---|
255 | then |
---|
256 | cp ${R_SORTIE_OCE}/${CEXPER}_${DATE_RESTART}_restart.nc restart.nc |
---|
257 | fi |
---|
258 | |
---|
259 | # |
---|
260 | # |
---|
261 | ls -alF |
---|
262 | # |
---|
263 | ######################################################################### |
---|
264 | ## |
---|
265 | ## 4. Launching the experiment |
---|
266 | ## |
---|
267 | ######################################################################### |
---|
268 | # |
---|
269 | ##-Q- sxnec export F_PROGINF=detail F_FTRACE=yes F_ERRCNT=500 |
---|
270 | ##-Q- sxnec mpirun -np 1 -max_np 3 opa.xx |
---|
271 | #-Q- sxnec opa.xx |
---|
272 | |
---|
273 | #-Q- fjvpp opa.xx -np 1 |
---|
274 | |
---|
275 | #-Q- fjvpp ##-- Accounting |
---|
276 | #-Q- fjvpp ja |
---|
277 | |
---|
278 | |
---|
279 | ls -alF |
---|
280 | |
---|
281 | NIT_FINAL=$( cat time.step ) |
---|
282 | # |
---|
283 | ######################################################################### |
---|
284 | ## |
---|
285 | ## 5. Post-processing |
---|
286 | ## |
---|
287 | ######################################################################### |
---|
288 | # |
---|
289 | # ============================================================================== |
---|
290 | # Save output files |
---|
291 | # ==============================================================================# |
---|
292 | i_ERR_SAUV=0 |
---|
293 | # |
---|
294 | # |
---|
295 | # |
---|
296 | # ----------------- GYRE --------------------- |
---|
297 | # |
---|
298 | if [ -f date.file ] |
---|
299 | then |
---|
300 | DATE=$(cat date.file | sed 's/ //g' | sed 's/_output//g' ) |
---|
301 | fi |
---|
302 | ## Print the last time step: |
---|
303 | cat time.step |
---|
304 | # |
---|
305 | ##-Q- sxnec cp ftrace.out ${R_SORTIE_OCE}/${DATE}.ftrace.out |
---|
306 | ##-Q- sxnec cp mon.out ${R_SORTIE_OCE}/${DATE}.mon.out |
---|
307 | # |
---|
308 | # Save ocean output files |
---|
309 | # |
---|
310 | if [ ${NUMERO} -eq 1 ] |
---|
311 | then |
---|
312 | mv meshmask* ${R_SORTIE_OCE} |
---|
313 | fi |
---|
314 | mv ocean.output ${R_SORTIE_OCE}/${DATE}.oceout |
---|
315 | mv solver.stat ${R_SORTIE_OCE}/${DATE}.solver.stat |
---|
316 | # |
---|
317 | for file_netcdf in *_grid_[TUVW].nc |
---|
318 | do |
---|
319 | mv $file_netcdf ${R_SORTIE_OCE}/ || i_ERR_SAUV=1 |
---|
320 | done |
---|
321 | # |
---|
322 | # Save ocean restart file |
---|
323 | mv ${CEXPER}_*_restart.nc ${R_SORTIE_OCE}/${CEXPER}_${DATE_FIN_JOB}_restart.nc |
---|
324 | if [ ! -f ${R_SORTIE_OCE}/${CEXPER}_${DATE_FIN_JOB}_restart.nc ]; then |
---|
325 | echo " Attention: The backup of the restart file was UNSUCCESSFULL" |
---|
326 | i_ERR_SAUV=1 |
---|
327 | fi |
---|
328 | |
---|
329 | # |
---|
330 | #- |
---|
331 | #- Test on backups |
---|
332 | #- |
---|
333 | if [ ${i_ERR_SAUV} -ne "0" ] ; then |
---|
334 | echo "Error in at least one of the restarts backups!" |
---|
335 | exit |
---|
336 | fi |
---|
337 | # |
---|
338 | # Tar all outputs in one tarfile |
---|
339 | cd ${R_SORTIE_OCE} |
---|
340 | if [ ! -f ${R_DONNEES}/SortieTest/Oce/SortieTest_Oce.tar ] |
---|
341 | then |
---|
342 | tar cvf ${R_DONNEES}/SortieTest/Oce/SortieTest_Oce.tar . |
---|
343 | else |
---|
344 | tar rvf ${R_DONNEES}/SortieTest/Oce/SortieTest_Oce.tar . |
---|
345 | fi |
---|
346 | rcp ${R_DONNEES}/SortieTest/Oce/SortieTest_Oce.tar ${R_STOCKAGE}/VERIF/SortieTest_Oce.tar |
---|
347 | cd ${TMP} |
---|