1 | #!/bin/ksh |
---|
2 | |
---|
3 | #--------------------------------------------------------------------------------# |
---|
4 | # This file is part of PALM. |
---|
5 | # |
---|
6 | # PALM is free software: you can redistribute it and/or modify it under the terms |
---|
7 | # of the GNU General Public License as published by the Free Software Foundation, |
---|
8 | # either version 3 of the License, or (at your option) any later version. |
---|
9 | # |
---|
10 | # PALM is distributed in the hope that it will be useful, but WITHOUT ANY |
---|
11 | # WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR |
---|
12 | # A PARTICULAR PURPOSE. See the GNU General Public License for more details. |
---|
13 | # |
---|
14 | # You should have received a copy of the GNU General Public License along with |
---|
15 | # PALM. If not, see <http://www.gnu.org/licenses/>. |
---|
16 | # |
---|
17 | # Copyright 1997-2012 Leibniz University Hannover |
---|
18 | #--------------------------------------------------------------------------------# |
---|
19 | # |
---|
20 | # Current revisions: |
---|
21 | # ----------------- |
---|
22 | # |
---|
23 | # Former revisions: |
---|
24 | # ----------------- |
---|
25 | # $Id: mrun 1047 2012-11-09 15:32:58Z hoffmann $ |
---|
26 | # |
---|
27 | # 1046 2012-11-09 14:38:45Z maronga |
---|
28 | # code put under GPL (PALM 3.9) |
---|
29 | # |
---|
30 | # mrun - script for running PALM jobs |
---|
31 | |
---|
32 | |
---|
33 | # Procedure for interactive/batch PALM runs (initial runs and automatic |
---|
34 | # restart runs) |
---|
35 | |
---|
36 | # Last changes: |
---|
37 | # 03/03/94 - Siggi - Entwicklungsbeginn |
---|
38 | # 21/03/94 - Siggi - Entwicklungsabschluss (Version 1.0) |
---|
39 | # 09/12/94 - Siggi - allexport unterbunden; statt dessen werden jetzt ein- |
---|
40 | # zelne Variable exportiert. Dies ist noetig, weil an- |
---|
41 | # sonsten irgendein Speicher ueberlaeuft und von mrun |
---|
42 | # aufgerufene Programme (z.B. stageout) mit Fehlern |
---|
43 | # abbrechen (too many arguments) |
---|
44 | # 20/06/95 - Siggi - noclobber muss explizit abgeschaltet, da jetzt |
---|
45 | # defaultmaessig im RRZN-Profile eingeschaltet |
---|
46 | # 10/06/97 - Siggi - Zusaetzliche Option -C bei cpp, damit // nicht |
---|
47 | # wegfallen |
---|
48 | # 25/04/00 - Siggi - Version 1.5 |
---|
49 | # remote_addres und remote_user in return_addres bzw. |
---|
50 | # return_username umbenannt, return_username wird dem |
---|
51 | # mrun-Aufruf im Job ueber Option -U mitgegeben. |
---|
52 | # Neue Variable remote_username, die beim interaktiven |
---|
53 | # mrun-Aufruf zwingend ueber die neue Option -u oder |
---|
54 | # in der Konfigurationsdatei angegeben werden muss. |
---|
55 | # 08/02/01 - Siggi - Alle mrun-Meldungen ins englische uebersetzt, |
---|
56 | # Version 1.7 |
---|
57 | # 05/05/02 - Siggi - Uebersetzungen mittels make-Mechanismus moeglich |
---|
58 | # 21/11/02 - Siggi - ENV-Variable XLFRTEOPTS wird vor Ausfuehrung auf |
---|
59 | # IBM gesetzt, um Record-Laenge der NAMELIST-Dateien, |
---|
60 | # zu bestimmen; Praeprozessoroptionen haben nun alle |
---|
61 | # die Form -Dtext=text, weil auf IBM sonst text durch |
---|
62 | # die leere Zeichenkette ersetzt wird |
---|
63 | # 01/08/03 - Siggi - Test of implementing dvrp+1PE on ibm |
---|
64 | # 07/01/04 - Siggi - additional preprocessor directive for ibm included |
---|
65 | # (-D$OMP=OMP) in order to avoid problems with |
---|
66 | # OMP_NUM_THREADS |
---|
67 | # 04/01/05 - Siggi - archiving on hanni and berni is done in separate |
---|
68 | # tar files, one for each node used |
---|
69 | # 07/01/04 - Siggi - old code for t3e, vpp and hpcs eliminated |
---|
70 | # 09/01/05 - Siggi - workaround for getting the IP address on gfdl3 |
---|
71 | # 17/01/05 - Siggi - job for data transfer to local machine now within |
---|
72 | # job class c1 (HLRN) |
---|
73 | # 27/01/05 - Siggi - IP address workaround for gfdl3 removed |
---|
74 | # 28/01/05 - Siggi - tar-filenames on $PERM (HLRN) now include the |
---|
75 | # base filename and cycle number |
---|
76 | # 16/02/05 - Gerald - hababai validated |
---|
77 | # 14/03/05 - Siggi - abort on NEC after first runtime error (F_ERRCNT) |
---|
78 | # 29/03/05 - Marcus - berni*-en0 validated |
---|
79 | # 21/04/05 - Siggi - transfer-job-protocol for avs-data is no more stored |
---|
80 | # 24/04/05 - Siggi - netcdf support on lcmuk |
---|
81 | # 25/04/05 - Siggi - netcdf support on gfld3 (decalpha) |
---|
82 | # 11/05/05 - Siggi - files with non-numeric extensions (.xxx after cycle |
---|
83 | # number) can now be used within interactive runs |
---|
84 | # 12/05/05 - Siggi - netcdf support on ibm |
---|
85 | # 13/05/05 - Siggi - error in tar-filenames on $PERM (HLRN) removed |
---|
86 | # 18/05/05 - Siggi - netcdf support on nec |
---|
87 | # 24/05/05 - Siggi - netcdf support on ibms |
---|
88 | # 14/06/05 - Siggi - sleep interval after submit of restart job increased |
---|
89 | # to 30 seconds |
---|
90 | # 28/06/05 - Siggi - bora adjusted to new intel compiler (LD_LIBRARY_ |
---|
91 | # PATH is temporarily set) |
---|
92 | # 07/09/05 - Siggi - setting of MP_EAGER_LIMIT switched off because it |
---|
93 | # caused warnings in the job protocol |
---|
94 | # 20/10/05 - Siggi - update of netcdf-version on decalpha (gfdl3) |
---|
95 | # 25/10/05 - Siggi - error in listing files for getting the cycle number |
---|
96 | # removed |
---|
97 | # 26/10/05 - Siggi - new paths for dvrp-library, transfer of catalogs |
---|
98 | # realized by file attribute trpe |
---|
99 | # 28/10/05 - Siggi - if existing, the file extension is output in case |
---|
100 | # of missing input file - no job abort in case of |
---|
101 | # missing input files with file extensions |
---|
102 | # (preliminary solution) |
---|
103 | # 31/10/05 - Siggi - data transfer from nech now within seperate job |
---|
104 | # 04/11/05 - Siggi - netcdf 3.6.0-p1 on ibmh/ibmb |
---|
105 | # 07/12/05 - Siggi - gallego and elephanta admitted |
---|
106 | # 30/12/05 - Siggi - gfdl5 (ibmy) admitted |
---|
107 | # 10/01/06 - Siggi - cpp directive for NetCDF 64bit support |
---|
108 | # 20/01/06 - Siggi - cpp directive for ibmy |
---|
109 | # 09/02/06 - Siggi - ibmy admitted for batch mode |
---|
110 | # 13/04/06 - Siggi - ostria admitted |
---|
111 | # 18/04/06 - Siggi - usage of OpenMP implemented (additional option -O) |
---|
112 | # 10/05/06 - Siggi - environment variable XLSMPOPTS set on IBM for |
---|
113 | # optimization of OpenMP runs (option stacksize is |
---|
114 | # necessary for large gridpoint numbers because |
---|
115 | # otherwise a segmentation fault occurs) |
---|
116 | # 23/05/05 - Siggi - lctit (SUN Fire X4600) admitted |
---|
117 | # 21/08/06 - Siggi - standard mrun path on scirocco is as on bora |
---|
118 | # 23/08/06 - Siggi - netcdf support for scirocco (notebook) |
---|
119 | # 20/09/06 - Marcus - add DVRP library on nech |
---|
120 | # 24/10/06 - Siggi - Environment variables for PALM steering are written |
---|
121 | # on local NAMELIST file ENVPAR |
---|
122 | # 24/11/06 - Siggi - levanto admitted, maestro switched to ifc 9.1 |
---|
123 | # 28/11/06 - Siggi - call to interpret_config.x_levanto because of SuSe 10 |
---|
124 | # 06/02/07 - Siggi - add DVRP library on lcmuk |
---|
125 | # 07/02/07 - Siggi - revision of source code handling, source code is |
---|
126 | # now expected in directory given by source_path and |
---|
127 | # not in the current working directory, source code |
---|
128 | # files provided in add_source_path are allways |
---|
129 | # compiled, source code to be compiled is allways |
---|
130 | # sampled in SOURCES_FOR_RUN_$fname which is a |
---|
131 | # subdirectory of the current working directory, |
---|
132 | # -s TEST changed to -s WRITE_PERMIT or -s WP, |
---|
133 | # adapted for RIAM (neck) |
---|
134 | # bugfix for cycle number of output file (extout) |
---|
135 | # all hpmuk-related code removed |
---|
136 | # 14/02/07 - Siggi - dvrp support for neck added |
---|
137 | # 28/02/07 - Siggi - empty lines in configuration file are accepted |
---|
138 | # mrun_path replaced by PALM_BIN, |
---|
139 | # all machines are calling interpret_config.x |
---|
140 | # 14/03/07 - Siggi - fimm admitted, revision number added to terminal |
---|
141 | # output |
---|
142 | # 16/03/07 - Siggi - adjustments for lctit |
---|
143 | # 29/03/07 - Siggi - global revision transfered to batch job by new |
---|
144 | # option -G |
---|
145 | # 30/03/07 - Siggi - compilation "by hand" removed, cpp-directives/options |
---|
146 | # + netcdf/dvrp-options are read from configuration |
---|
147 | # file, host identifier (local_host) is read from |
---|
148 | # config file, code related to ftp filetransfer |
---|
149 | # removed (incl. option -f) |
---|
150 | # 19/06/07 - Siggi - time limit for cdata jobs increased |
---|
151 | # 25/07/07 - Siggi - two sets of executables can be started on lcmuk, |
---|
152 | # if new option -Y (coupling) is given, |
---|
153 | # output of executables to aout_output removed, |
---|
154 | # messages are immediately written to stdout instead |
---|
155 | # 03/08/07 - Marcus - add XOPT="-X $numprocs" for lcfimm |
---|
156 | # 09/08/07 - Marcus - workaround on lcfimm to propagate environment |
---|
157 | # variables out to the nodes in coupled mode -disabled- |
---|
158 | # 13/08/07 - Marcus - start local restart jobs per ssh on lcfimm |
---|
159 | # 28/08/07 - Marcus - completely remove workaround on lcfimm to propagate |
---|
160 | # environment variables out to the nodes in coupled mode |
---|
161 | # 15/10/07 - Siggi - Preliminary adjustments for lctit, based on Jin's |
---|
162 | # suggestions |
---|
163 | # 19/10/07 - Marcus - further adjustments for lctit: add new optional |
---|
164 | # argument -g group_number, admit all sla* node_usage |
---|
165 | # queues |
---|
166 | # 30/10/07 - Marcus - further adjustments for queues on lctit |
---|
167 | # 14/02/08 - Bjoern - link of restart files with long file name possible |
---|
168 | # 28/02/08 - Marcus - If environment variable link_local_output is set to |
---|
169 | # true, mrun tries "ln -f" on local output and resorts |
---|
170 | # to "cp" or "cp -r" on error |
---|
171 | # 15/04/08 - Siggi - argument -c introduced to most of the subjob calls, |
---|
172 | # which allows the user to choose his own job catalog |
---|
173 | # by setting job_catalog in the configuration file |
---|
174 | # (default is ~/job_queue), |
---|
175 | # workaround for mpiexec with -env option, |
---|
176 | # adjustments for lcxt4 (Bergen Center for Computational |
---|
177 | # Science) |
---|
178 | # 22/05/08 - Marcus - If environment variable link_local_input is set to |
---|
179 | # true, mrun tries "ln -f" on local input and resorts |
---|
180 | # to "cp" or "cp -r" on error |
---|
181 | # 27/05/08 - Siggi - PATH is set to PALM_BIN everywhere (missing so far) |
---|
182 | # 14/07/08 - Siggi - adjustments for lcsgih |
---|
183 | # 08/08/08 - Marcus - typo removed in lcxt4 branch |
---|
184 | # 17/09/08 - Siggi - restart mechanism adjusted for lcsgi |
---|
185 | # 02/10/08 - BjornM - argument "-Y" modified, adjustments for coupled runs |
---|
186 | # 21/10/08 - Siggi - bugfix for the case that -K has more than one |
---|
187 | # argument |
---|
188 | # 08/11/08 - Siggi - bugfix for depository path settings in configuration |
---|
189 | # file |
---|
190 | # 11/11/08 - Siggi - rules for using user code files changed: user |
---|
191 | # code splitted into one file per subroutine, |
---|
192 | # user can provide his/her own makefile, only |
---|
193 | # default source-code filenames are allowed |
---|
194 | # 14/11/08 - Siggi - cond1 and cond2 are part of the depository name |
---|
195 | # 08/01/09 - Siggi - mpi module on sgi machines to be used can be set |
---|
196 | # with environment variable mpilib |
---|
197 | # 13/01/09 - Siggi - totalview on hice/bice can be used in debug mode |
---|
198 | # using environment variable totalview |
---|
199 | # 25/02/09 - Siggi - cputime-option (-t) is allowed to be omitted for |
---|
200 | # interactive runs |
---|
201 | # 05/03/09 - Siggi - adjustments for new NEC-SX9 at RIAM (necriam) |
---|
202 | # 16/03/09 - Siggi - dvrp_lib, dvrp_inc replaced by dvr_lib, dvr_inc, |
---|
203 | # dvr streaming server is automatically started using |
---|
204 | # new variable dvr_server and a configuration file |
---|
205 | # .dvrserver.config, |
---|
206 | # processing of dvr output files using new script |
---|
207 | # process_dvr_output implemented, in order to make |
---|
208 | # dvr application more user friendly |
---|
209 | # 20/03/09 - Marcus - update of n1ge command for lctit |
---|
210 | # 16/04/09 - Siggi - new option -y for precursor (uncoupled) ocean runs |
---|
211 | # to be followed by a coupled atmosphere-ocean run |
---|
212 | # 21/04/09 - Siggi - adjustments for new IBM at DKRZ, which is now ibmh |
---|
213 | # 24/06/09 - BjornM - adjustments for coupled/precursor runs on ibmy |
---|
214 | # 08/07/09 - Siggi - default value for email_notification is none, |
---|
215 | # option -e added to subjob |
---|
216 | # 19/08/09 - Marcus - MPI debug option |
---|
217 | # 21/08/09 - Marcus - totalview on hice/bice also available for mvapich2 |
---|
218 | # 25/08/09 - BjornM - adpated for lck |
---|
219 | # 26/08/09 - Siggi - additional environment variables for mpt on ice2 |
---|
220 | # 26/08/09 - Marcus - adjustment for ice2 on lcsgib |
---|
221 | # 29/09/09 - Siggi - default value for archiving is false, option "-A" |
---|
222 | # switches on archiving, archiving on SGI-ICE enabled |
---|
223 | # 16/10/09 - Carolin- adjustments for archiving on SGI-ICE of binary files; |
---|
224 | # adjustment for special1q |
---|
225 | # 18/12/09 - Carolin- modification of archiving (permq) |
---|
226 | # 01/02/10 - Siggi - adapted for lcxt5m and lckyoto (Fujitsu HX600) |
---|
227 | # 03/02/10 - Siggi - make options (mopts) to be set by configuration file |
---|
228 | # implemented |
---|
229 | # 08/02/10 - Siggi - loading of modules now controlled via configuration |
---|
230 | # file (modules) |
---|
231 | # 02/03/10 - Siggi - for each block in the configuration file, separate |
---|
232 | # utility programs are used, combine_plot_fields is |
---|
233 | # directly called and must not be given by an output |
---|
234 | # command in the configuration file any more |
---|
235 | # 15/06/10 - Rieke - ssh from compute nodes to login nodes on hosts |
---|
236 | # lcsgih/lcsgib is done using the names |
---|
237 | # hicegate0/bicegate0 instead of the IP addresses |
---|
238 | # 17/08/10 - BjornM - adjustments for interactive runs on lcxt4 |
---|
239 | # 07/09/10 - Siggi - bugfix for wrong netcdf/3.6.3 module on lcsgi |
---|
240 | # 08/12/10 - Siggi - new handling of openmp/hybrid runs, option -O |
---|
241 | # has now argument threads_per_task |
---|
242 | # adjustments for Kyushu Univ. (lcrte, ibmku) |
---|
243 | # 14/12/10 - Siggi - adjustments for new Tsubame system at Tokyo |
---|
244 | # institute of technology (lctit) |
---|
245 | # 23/12/10 - Micha - different number of processors in ocean and |
---|
246 | # atmosphere is now allowed |
---|
247 | # 02/02/10 - Siggi - further adjustments on Tsubame and concerning openMP |
---|
248 | # usage |
---|
249 | # 09/03/10 - Siggi - adjustments for ibmkisti, mpt bugfix for netCDF4 |
---|
250 | # usage, totalview usage extended |
---|
251 | # 17/03/11 - Siggi - adjustments for openmp usage on ibmkisti |
---|
252 | # 03/04/11 - Micha - added lckordi |
---|
253 | # 06/04/11 - BjornM - bugfix for runs with mpt on lcsgi |
---|
254 | # 17/08/11 - Siggi - extensions for impi library |
---|
255 | # 18/08/11 - Siggi - bugfix for local append of output files with suffix |
---|
256 | # (.nc) |
---|
257 | # 18/08/11 - Marcus - support for Linux OS with German locale |
---|
258 | # - properly report hosts on general Linux clusters |
---|
259 | # 29/08/11 - BjornW - adapted for lcflow (ForWind cluster in Oldenburg) |
---|
260 | # 29/08/11 - Carolin- initiating restart-run: adjustment of the path at |
---|
261 | # IMUK |
---|
262 | # 15/09/11 - Siggi - new option -w tp set the maximum number of parallel |
---|
263 | # io streams, option -T is obligatory from now on |
---|
264 | # 25/01/12 - BjornM - a namelist file check prior to the model run has |
---|
265 | # been implemented (check_namelist_files). |
---|
266 | # New option -z can be used to skip the check |
---|
267 | # 03/02/12 - BjornM - namelist file check temporary disabled |
---|
268 | # until severel bugs are fixed |
---|
269 | # 08/02/12 - BjornM - bugfixes: skipping namelist file check in case of |
---|
270 | # restart runs. check is now possible with topography |
---|
271 | # and the -v (silent) option is considered |
---|
272 | # 14/02/12 - BjornM/- bugfix: removed slash in \$queue, changed default |
---|
273 | # Farah queue for lcsgi to testq, since bigq is not |
---|
274 | # available on ice1 |
---|
275 | # 16/02/12 - BjornM - bugfix: replaced $localhost by $host in the ENVPAR |
---|
276 | # file, which is generated for the namelist file check |
---|
277 | # 17/02/12 - Siggi - -z included in description of options (mrun ?) |
---|
278 | # 22/02/12 - Siggi - -s info updated |
---|
279 | # 22/02/12 - Siggi - case "-s WP" removed |
---|
280 | # 28/02/12 - BjornM - further adjustments for namelist file check |
---|
281 | # 09/03/12 - Siggi - -T option not obligatory for lcflow |
---|
282 | # 12/03/12 - Siggi - tasks_per_node divisor check not for lcflow |
---|
283 | # 21/03/12 - Matthias - default compiler on ibmh changed |
---|
284 | # 02/05/12 - Bjoern - lcxt4 is now lcxe6, adjustments for lcxe6, |
---|
285 | # bugfixes for the parameter file check, initial |
---|
286 | # commands on ssh calls sourced out to .mrun.config |
---|
287 | # 05/06/12 - Bjoern - bugfixes for the parameter file check on lcxe6. |
---|
288 | # combine_plot_fields can be switched off by the |
---|
289 | # new mrun option -Z |
---|
290 | # 08/06/12 - Bjoern - max_pr_user enabled for the namelist file check, |
---|
291 | # sleep commands are now disabled in silent mode (-v) |
---|
292 | # 06/08/12 - Bjoern - update: system update at imuk now requires (new) |
---|
293 | # initial shell commands on ssh calls (automatic |
---|
294 | # restart runs were not possible) |
---|
295 | # 22/08/12 - Bjoern - bugfix: missing export statement in the previous |
---|
296 | # update of the ssh calls |
---|
297 | # 06/09/12 - Bjoern - typo removed: "-D_parallel" -> "-D__parallel" |
---|
298 | # 02/10/12 - Siggi - adjusted for lcsb (urban00) |
---|
299 | # 31/10/12 - Siggi - -T option not obligatory for lcxt5m, |
---|
300 | # tasks_per_node not checked for this machine |
---|
301 | # 01/11/12 - Siggi - adjusted for lckiaps |
---|
302 | # 07/11/12 - Bjoern - parameter file check adapted for batch jobs on |
---|
303 | # local host |
---|
304 | |
---|
305 | |
---|
306 | |
---|
307 | # VARIABLENVEREINBARUNGEN + DEFAULTWERTE |
---|
308 | |
---|
309 | set +o allexport # SICHERHEITSHALBER UNTERBINDEN, DA SONST EVTL. STAGEOUT |
---|
310 | # NICHT LAUEFT (TOO MANY ARGUMENTS - PROBLEM) |
---|
311 | set +o noclobber # EXISTIERENDE DATEIEN DUERFEN UEBERSCHRIEBEN WERDEN |
---|
312 | |
---|
313 | AddFilenames="" |
---|
314 | additional_conditions="" |
---|
315 | add_source_path="" |
---|
316 | afname="" |
---|
317 | archive_save=true |
---|
318 | archive_system=none |
---|
319 | check_namelist_files=true |
---|
320 | combine_plot_fields=true |
---|
321 | compiler_name="" |
---|
322 | cond1="" |
---|
323 | cond2="" |
---|
324 | config_file=.mrun.config |
---|
325 | coupled_dist="" |
---|
326 | coupled_mode="mpi1" |
---|
327 | cpp_opts="" |
---|
328 | cpp_options="" |
---|
329 | cpumax=0 |
---|
330 | cpurest=0 |
---|
331 | delete_temporary_catalog=true |
---|
332 | do_batch=false |
---|
333 | do_compile=true |
---|
334 | do_remote=false |
---|
335 | do_stagein=true |
---|
336 | do_stageout=true |
---|
337 | do_trace=false |
---|
338 | email_notification="none" |
---|
339 | exclude="" |
---|
340 | executable="" |
---|
341 | execution_error=false |
---|
342 | fimm=false |
---|
343 | fname=test |
---|
344 | fromhost="" |
---|
345 | global_revision="" |
---|
346 | group_number=none |
---|
347 | host="" |
---|
348 | host_file="" |
---|
349 | hp="" |
---|
350 | ignore_archive_error=false |
---|
351 | input_list="" |
---|
352 | interpreted_config_file="" |
---|
353 | job_catalog="~/job_queue" |
---|
354 | job_on_file="" |
---|
355 | keep_data_from_previous_run=false |
---|
356 | link_local_input=false |
---|
357 | link_local_output=false |
---|
358 | localhost_realname=$(hostname) |
---|
359 | local_compile=false |
---|
360 | local_dvrserver_running=.FALSE. |
---|
361 | locat=normal |
---|
362 | mainprog="" |
---|
363 | makefile="" |
---|
364 | max_par_io_str="" |
---|
365 | mc=$0 |
---|
366 | while [[ $(echo $mc | grep -c "/") != 0 ]] |
---|
367 | do |
---|
368 | mc=`echo $mc | cut -f2- -d"/"` |
---|
369 | done |
---|
370 | module_calls="" |
---|
371 | mrun_script_name=$mc |
---|
372 | netcdf_inc="" |
---|
373 | netcdf_lib="" |
---|
374 | netcdf_support=false |
---|
375 | node_usage=default |
---|
376 | numprocs="" |
---|
377 | numprocs_atmos=0 |
---|
378 | numprocs_ocean=0 |
---|
379 | OOPT="" |
---|
380 | openmp=false |
---|
381 | output_list="" |
---|
382 | package_list="" |
---|
383 | punkte="..........................................................." |
---|
384 | queue=none |
---|
385 | read_from_config="" |
---|
386 | restart_run=false |
---|
387 | if [[ `hostname` = rte10 ]] |
---|
388 | then |
---|
389 | return_addres=133.5.185.60 |
---|
390 | echo "+++ WARNING: fixed return_addres = $return_addres is used !!!!!" |
---|
391 | elif [[ `hostname` = climate0 ]] |
---|
392 | then |
---|
393 | return_addres=165.132.26.68 |
---|
394 | echo "+++ WARNING: fixed return_addres = $return_addres is used !!!!!" |
---|
395 | elif [[ `hostname` = urban00 ]] |
---|
396 | then |
---|
397 | return_addres=147.46.30.151 |
---|
398 | echo "+++ WARNING: fixed return_addres = $return_addres is used !!!!!" |
---|
399 | else |
---|
400 | return_addres=$(nslookup `hostname` 2>&1 | grep "Address:" | tail -1 | awk '{print $2}') |
---|
401 | fi |
---|
402 | return_password="" |
---|
403 | return_username=$LOGNAME |
---|
404 | remotecall=false |
---|
405 | remote_username="" |
---|
406 | run_coupled_model=false |
---|
407 | run_mode="" |
---|
408 | scirocco=false |
---|
409 | store_on_archive_system=false |
---|
410 | striche=" ----------------------------------------------------------------------------" |
---|
411 | silent=false |
---|
412 | source_list="" |
---|
413 | source_path=SOURCE |
---|
414 | tasks_per_node="" |
---|
415 | threads_per_task=1 |
---|
416 | tmpcreate=false |
---|
417 | tmp_data_catalog="" |
---|
418 | transfer_problems=false |
---|
419 | usern=$LOGNAME |
---|
420 | use_openmp=false |
---|
421 | working_directory=`pwd` |
---|
422 | TOPT="" |
---|
423 | XOPT="" |
---|
424 | zeit=$( date | cut -c 12-19 ) |
---|
425 | |
---|
426 | typeset -i iec=0 iic=0 iin=0 ioc=0 iout=0 memory=0 stagein_anz=0 stageout_anz=0 |
---|
427 | typeset -i cputime i ii iia iii iio icycle inode ival jobges jobsek maxcycle minuten nodes pes sekunden tp1 |
---|
428 | |
---|
429 | typeset -R30 calltime |
---|
430 | typeset -L20 spalte1 |
---|
431 | typeset -L40 spalte2 |
---|
432 | typeset -L60 spalte3 |
---|
433 | typeset -L35 string1=`date` |
---|
434 | typeset -L12 string2=$usern |
---|
435 | typeset -L12 string3=$localhost_realname |
---|
436 | typeset -L12 string4 |
---|
437 | typeset -L12 string5 |
---|
438 | typeset -L30 version="MRUN 2.0 Rev$Rev: 1047 $" |
---|
439 | |
---|
440 | |
---|
441 | |
---|
442 | # EINZELNE VARIABLE FUER HAUPTPROGRAMM EXPORTIEREN |
---|
443 | export cpurest fname host localhost return_addres return_username remotecall tasks_per_node |
---|
444 | |
---|
445 | # FOLGENDE VARIABLEN MUESSEN FUER DIE INTERPRETATION DER KONFIGURATIONSDATEI |
---|
446 | # EXPORTIERT WERDEN |
---|
447 | export afname config_file cpp_opts cpumax do_batch do_trace fname fromhost |
---|
448 | export group_number input_list memory numprocs output_list queue run_mode |
---|
449 | |
---|
450 | |
---|
451 | |
---|
452 | # FEHLERBEHANDLUNG |
---|
453 | # BEI EXIT: |
---|
454 | trap 'rm -rf $working_directory/tmp_mrun |
---|
455 | if [[ $locat != localhost ]] |
---|
456 | then |
---|
457 | # if [[ ! -f ${mrun_path}/statistik/mrun_statistik ]] |
---|
458 | # then |
---|
459 | # cat > ${mrun_path}/statistik/mrun_statistik << %STATEND% |
---|
460 | #MRUN-calls on $localhost |
---|
461 | # |
---|
462 | #date and time user localhost remotehost termination mrun-command |
---|
463 | #-------------------------------------------------------------------------------------------------------------------- |
---|
464 | #%STATEND% |
---|
465 | # chmod 666 ${mrun_path}/statistik/mrun_statistik |
---|
466 | # fi |
---|
467 | # |
---|
468 | # # EINTRAG IN DIE STATISTIK-DATEI |
---|
469 | # string4=$host |
---|
470 | # string5=$locat |
---|
471 | # if [[ "$job_on_file" = "" && $locat != control_c && $locat != user_abort ]] |
---|
472 | # then |
---|
473 | # if [[ $do_batch = true ]] |
---|
474 | # then |
---|
475 | # printf "$string1$string2$string3$string4$string5$mrun_com \n" >> ${mrun_path}/statistik/mrun_statistik |
---|
476 | # else |
---|
477 | # printf "$string1$string2$string3$string4$string5$mc \n" >> ${mrun_path}/statistik/mrun_statistik |
---|
478 | # fi |
---|
479 | # fi |
---|
480 | echo " " > /dev/null |
---|
481 | fi |
---|
482 | |
---|
483 | if [[ $locat != normal && $locat != control_c && $locat != local_compile ]] |
---|
484 | then |
---|
485 | |
---|
486 | # EVENTUELLE ERROR-KOMMANDOS ABARBEITEN |
---|
487 | (( i = 0 )) |
---|
488 | while (( i < iec )) |
---|
489 | do |
---|
490 | (( i = i + 1 )) |
---|
491 | printf "\n *** Execution of ERROR-command:\n" |
---|
492 | printf " >>> ${err_command[$i]}\n" |
---|
493 | eval ${err_command[$i]} |
---|
494 | done |
---|
495 | if [[ -n $interpreted_config_file ]] then |
---|
496 | rm -rf $interpreted_config_file |
---|
497 | fi |
---|
498 | if [[ -n .mrun_environment ]] then |
---|
499 | rm -rf .mrun_environment |
---|
500 | fi |
---|
501 | if [[ $tmpcreate = true ]] |
---|
502 | then |
---|
503 | printf "\n *** Contents of \"$TEMPDIR\":\n" |
---|
504 | ls -al; cd |
---|
505 | [[ $delete_temporary_catalog = true ]] && rm -rf $TEMPDIR |
---|
506 | fi |
---|
507 | if [[ "$dvrserver_id" != "" ]] |
---|
508 | then |
---|
509 | echo "+++ killing dvrserver_id=$dvrserver_id" |
---|
510 | kill $dvrserver_id |
---|
511 | fi |
---|
512 | if [[ -f ~/job_queue/JOBINFO.$QSUB_REQID ]] |
---|
513 | then |
---|
514 | rm -rf ~/job_queue/JOBINFO.$QSUB_REQID |
---|
515 | fi |
---|
516 | printf "\n\n+++ MRUN killed \n\n" |
---|
517 | elif [[ $locat != control_c ]] |
---|
518 | then |
---|
519 | printf "\n\n --> all actions finished\n\n" |
---|
520 | printf " Bye, bye $usern !!\n\n" |
---|
521 | fi' exit |
---|
522 | |
---|
523 | |
---|
524 | # BEI TERMINAL-BREAK: |
---|
525 | trap 'rm -rf $working_directory/tmp_mrun |
---|
526 | rm -rf $working_directory/tmp_check_namelist_files |
---|
527 | [[ $tmpcreate = true ]] && (cd; rm -rf $TEMPDIR) |
---|
528 | if [[ -f ~/job_queue/JOBINFO.$QSUB_REQID ]] |
---|
529 | then |
---|
530 | rm -rf ~/job_queue/JOBINFO.$QSUB_REQID |
---|
531 | fi |
---|
532 | if [[ "$dvrserver_id" != "" ]] |
---|
533 | then |
---|
534 | echo "+++ killing dvrserver_id=$dvrserver_id" |
---|
535 | kill $dvrserver_id |
---|
536 | fi |
---|
537 | printf "\n+++ MRUN killed by \"^C\" \n\n" |
---|
538 | locat=control_c |
---|
539 | exit |
---|
540 | ' 2 |
---|
541 | |
---|
542 | |
---|
543 | # CHECK IF THE PATH FOR THE PALM BINARIES (SCRIPTS+UTILITY-PROGRAMS) HAS |
---|
544 | # BEEN SET |
---|
545 | if [[ "$PALM_BIN" = "" ]] |
---|
546 | then |
---|
547 | printf "\n +++ environment variable PALM_BIN has not been set" |
---|
548 | printf "\n please set it to the directory where the PALM scripts are located" |
---|
549 | locat=palm_bin; exit |
---|
550 | fi |
---|
551 | export PATH=$PALM_BIN:$PATH |
---|
552 | |
---|
553 | |
---|
554 | |
---|
555 | # SHELLSCRIPT-OPTIONEN EINLESEN UND KOMMANDO NEU ZUSAMMENSETZEN, FALLS ES |
---|
556 | # FUER FOLGEJOBS BENOETIGT WIRD |
---|
557 | while getopts :a:AbBc:Cd:D:Fg:G:h:H:i:IkK:m:M:n:o:O:p:P:q:r:R:s:St:T:u:U:vw:xX:yY:zZ option |
---|
558 | do |
---|
559 | case $option in |
---|
560 | (a) afname=$OPTARG;; |
---|
561 | (A) store_on_archive_system=true; mc="$mc -A";; |
---|
562 | (b) do_batch=true; mc="$mc -b";; |
---|
563 | (B) delete_temporary_catalog=false; mc="$mc -B";; |
---|
564 | (c) config_file=$OPTARG; mc="$mc -c$OPTARG";; |
---|
565 | (C) restart_run=true; mc="$mc -C";; |
---|
566 | (d) fname=$OPTARG; mc="$mc -d$OPTARG";; |
---|
567 | (D) cpp_opts="$cpp_opts $OPTARG"; mc="$mc -D'$OPTARG'";; |
---|
568 | (F) job_on_file="-D"; mc="$mc -F";; |
---|
569 | (g) group_number=$OPTARG; mc="$mc -g$OPTARG";; |
---|
570 | (G) global_revision=$OPTARG; mc="$mc -G'$OPTARG'";; |
---|
571 | (h) host=$OPTARG; mc="$mc -h$OPTARG";; |
---|
572 | (H) fromhost=$OPTARG; mc="$mc -H$OPTARG";; |
---|
573 | (i) input_list=$OPTARG; mc="$mc -i'$OPTARG'";; |
---|
574 | (I) ignore_archive_error=true; mc="$mc -I";; |
---|
575 | (k) keep_data_from_previous_run=true; mc="$mc -k";; |
---|
576 | (K) additional_conditions="$OPTARG"; mc="$mc -K'$OPTARG'";; |
---|
577 | (m) memory=$OPTARG; mc="$mc -m$OPTARG";; |
---|
578 | (M) makefile=$OPTARG; mc="$mc -M$OPTARG";; |
---|
579 | (n) node_usage=$OPTARG; mc="$mc -n$OPTARG";; |
---|
580 | (o) output_list=$OPTARG; mc="$mc -o'$OPTARG'";; |
---|
581 | (O) use_openmp=true; threads_per_task=$OPTARG; mc="$mc -O$OPTARG";; |
---|
582 | (p) package_list=$OPTARG; mc="$mc -p'$OPTARG'";; |
---|
583 | (P) return_password=$OPTARG; mc="$mc -P$OPTARG";; |
---|
584 | (q) queue=$OPTARG; mc="$mc -q$OPTARG";; |
---|
585 | (r) run_mode=$OPTARG; mc="$mc -r'$OPTARG'";; |
---|
586 | (R) remotecall=true;return_addres=$OPTARG; mc="$mc -R$OPTARG";; |
---|
587 | (s) source_list=$OPTARG; mc="$mc -s'$OPTARG'";; |
---|
588 | (S) read_from_config=false; mc="$mc -S";; |
---|
589 | (t) cpumax=$OPTARG; mc="$mc -t$OPTARG";; |
---|
590 | (T) mrun_tasks_per_node=$OPTARG; mc="$mc -T$OPTARG";; |
---|
591 | (u) remote_username=$OPTARG; mc="$mc -u$OPTARG";; |
---|
592 | (U) return_username=$OPTARG; mc="$mc -U$OPTARG";; |
---|
593 | (v) silent=true; mc="$mc -v";; |
---|
594 | (w) max_par_io_str=$OPTARG; mc="$mc -w$OPTARG";; |
---|
595 | (x) do_trace=true;set -x; mc="$mc -x";; |
---|
596 | (X) numprocs=$OPTARG; mc="$mc -X$OPTARG";; |
---|
597 | (y) ocean_file_appendix=true; mc="$mc -y";; |
---|
598 | (Y) run_coupled_model=true; coupled_dist=$OPTARG; mc="$mc -Y'$OPTARG'";; |
---|
599 | (z) check_namelist_files=false; mc="$mc -z";; |
---|
600 | (Z) combine_plot_fields=false; mc="$mc -Z";; |
---|
601 | (\?) printf "\n +++ unknown option $OPTARG \n" |
---|
602 | printf "\n --> type \"$0 ?\" for available options \n" |
---|
603 | locat=parameter;exit;; |
---|
604 | esac |
---|
605 | done |
---|
606 | |
---|
607 | |
---|
608 | # EVTL. POSITIONSPARAMETER EINLESEN |
---|
609 | # ZUR ZEIT GIBT ES NUR DEN PARAMETER ? (=KURZINFO) |
---|
610 | shift OPTIND-1 |
---|
611 | |
---|
612 | |
---|
613 | # KURZE AUFRUFBESCHREIBUNG WIRD HIER AUSGEGEBEN |
---|
614 | if [[ "$1" = "?" ]] |
---|
615 | then |
---|
616 | (printf "\n *** mrun can be called as follows:\n" |
---|
617 | printf "\n $mrun_script_name -b -c.. -d.. -D.. -f.. -F -h.. -i.. -I -K.. -m.. -o.. -p.. -r.. -R -s.. -t.. -T.. -v -x -X.. -y -Y.. -z -Z <modus> \n" |
---|
618 | printf "\n Description of available options:\n" |
---|
619 | printf "\n Option Description Default-Value" |
---|
620 | printf "\n -a base name of input files equiv. -d" |
---|
621 | printf "\n -A archiving when using file-attribute fl" |
---|
622 | printf "\n -b batch-job on local machine ---" |
---|
623 | printf "\n -B do not delete temporary directory at end ---" |
---|
624 | printf "\n -c configuration file .mrun.config" |
---|
625 | printf "\n -d base name of files attached to program test" |
---|
626 | printf "\n -D preprocessor(cpp)-directives \"\" " |
---|
627 | printf "\n -F create remote job file only ---" |
---|
628 | printf "\n -h execution host $localhost_realname" |
---|
629 | printf "\n -i INPUT control list \"\" " |
---|
630 | printf "\n -I archiving errors of previous batch-jobs" |
---|
631 | printf "\n will be ignored" |
---|
632 | printf "\n -k keep data from previous run" |
---|
633 | printf "\n -K additional conditions for controling" |
---|
634 | printf "\n usage of conditional code and" |
---|
635 | printf "\n env-variables in configuration file \"\" " |
---|
636 | printf "\n -m memory demand in MB (batch-jobs) 0 MB" |
---|
637 | printf "\n -M Makefile name Makefile" |
---|
638 | printf "\n -n node usage (shared/not_shared) depending on -h" |
---|
639 | printf "\n -o OUTPUT control list \"\" " |
---|
640 | printf "\n -O use OpenMP ---" |
---|
641 | printf "\n -p software package list \"\" " |
---|
642 | printf "\n -q queue \"$queue\" " |
---|
643 | printf "\n -r run control list (combines -i -o) \"\" " |
---|
644 | printf "\n -s filenames of routines to be compiled \"\" " |
---|
645 | printf "\n must end with .f, .f90, .F, or .c !" |
---|
646 | printf "\n use \"..\" for more than one file and wildcards" |
---|
647 | printf "\n -s LM compiles all locally modified files" |
---|
648 | printf "\n -S config file interpreted by shellscript ---" |
---|
649 | printf "\n -t allowed cpu-time in seconds (batch) 0" |
---|
650 | printf "\n -T tasks per node depending on -h" |
---|
651 | printf "\n -u username on remote machine \"\" " |
---|
652 | printf "\n -v no prompt for confirmation ---" |
---|
653 | printf "\n -w maximum parallel io streams as given by -X" |
---|
654 | printf "\n -x tracing of mrun for debug purposes ---" |
---|
655 | printf "\n -X # of processors (on parallel machines) 1" |
---|
656 | printf "\n -y add appendix \"_O\" to all local output" |
---|
657 | printf "\n files (ocean precursor runs followed by" |
---|
658 | printf "\n coupled atmosphere-ocean runs) ---" |
---|
659 | printf "\n -Y run coupled model, \"#1 #2\" with" |
---|
660 | printf "\n #1 atmosphere and #2 ocean processors \"#/2 #/2\" depending on -X" |
---|
661 | printf "\n -z disable a priori parameter file check ---" |
---|
662 | printf "\n -Z skip combine_plot_fields at the end of " |
---|
663 | printf "\n the simulation ---" |
---|
664 | printf "\n " |
---|
665 | printf "\n Possible values of positional parameter <modus>:" |
---|
666 | printf "\n \"?\" - this outline \n\n") | more |
---|
667 | exit |
---|
668 | elif [[ "$1" != "" ]] |
---|
669 | then |
---|
670 | printf "\n +++ positional parameter $1 unknown \n" |
---|
671 | locat=parameter; exit |
---|
672 | fi |
---|
673 | |
---|
674 | |
---|
675 | |
---|
676 | # KURZE STARTMELDUNG |
---|
677 | printf "\n*** $version " |
---|
678 | printf "\n will be executed. Please wait ..." |
---|
679 | |
---|
680 | |
---|
681 | |
---|
682 | # PRUEFEN, OB KONFIGURATIONS-DATEI VORHANDEN |
---|
683 | if [[ ! -f $config_file ]] |
---|
684 | then |
---|
685 | printf "\n\n +++ configuration file: " |
---|
686 | printf "\n $config_file" |
---|
687 | printf "\n does not exist" |
---|
688 | locat=connect; exit |
---|
689 | fi |
---|
690 | |
---|
691 | |
---|
692 | # HOST-IDENTIFIER (local_host) AUS KONFIGURATIONSDATEI BESTIMMEN |
---|
693 | line="" |
---|
694 | grep "%host_identifier" $config_file > tmp_mrun |
---|
695 | while read line |
---|
696 | do |
---|
697 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
698 | then |
---|
699 | HOSTNAME=`echo $line | cut -d" " -s -f2` |
---|
700 | host_identifier=`echo $line | cut -d" " -s -f3` |
---|
701 | if [[ $localhost_realname = $HOSTNAME ]] |
---|
702 | then |
---|
703 | localhost=$host_identifier |
---|
704 | break |
---|
705 | fi |
---|
706 | fi |
---|
707 | done < tmp_mrun |
---|
708 | |
---|
709 | if [[ "$localhost" = "" ]] |
---|
710 | then |
---|
711 | printf "\n\n +++ no host identifier found in configuration file \"$config_file\"" |
---|
712 | printf "\n for local host \"$localhost_realname\"." |
---|
713 | printf "\n Please add line" |
---|
714 | printf "\n \"\%host_identifier $localhost_realname <identifier>\"" |
---|
715 | printf "\n to the configuration file." |
---|
716 | locat=localhost; exit |
---|
717 | fi |
---|
718 | |
---|
719 | |
---|
720 | # HOSTSPEZIFISCHE VARIABLEN SETZEN |
---|
721 | case $localhost_realname in |
---|
722 | (r1*|r2*|h01*|b01*) archive_system=tivoli;; |
---|
723 | (cs*) archive_system=ut;; |
---|
724 | (fimm.bccs.uib.no) fimm=true;; |
---|
725 | (gate|n-sx) PATH=$PALM_BIN:$PATH:/usr/bin/nqsII;; |
---|
726 | (scirocco) scirocco=true;; |
---|
727 | esac |
---|
728 | |
---|
729 | |
---|
730 | |
---|
731 | # BASISNAME DER INPUT-DATEIEN GLEICH ALLGEMEINEM BASISNAMEN SETZEN, |
---|
732 | # WENN NICHT VOM BENUTZER ANDERS BESTIMMT |
---|
733 | [[ "$afname" = "" ]] && afname=$fname |
---|
734 | |
---|
735 | |
---|
736 | # EVTL. RUN-MODUS DEN I/O-LISTEN HINZUFUEGEN |
---|
737 | if [[ "$run_mode" != "" ]] |
---|
738 | then |
---|
739 | input_list="$input_list $run_mode" |
---|
740 | output_list="$output_list $run_mode" |
---|
741 | fi |
---|
742 | |
---|
743 | |
---|
744 | # RECHNERNAMEN ABSPEICHERN, VON DEM AUS JOB GESTARTET WIRD, |
---|
745 | # ALLERDINGS NUR DANN, WENN NICHT PER OPTION -H BEREITS EIN WERT |
---|
746 | # ZUGEWIESEN WURDE (MRUN MACHT DIES IMMER, WENN ES SELBST BATCH-JOBS |
---|
747 | # STARTET) |
---|
748 | if [[ "$fromhost" = "" ]] |
---|
749 | then |
---|
750 | fromhost=$localhost |
---|
751 | fi |
---|
752 | |
---|
753 | |
---|
754 | # PRUEFEN, OB AUF REMOTE-MASCHINE GERECHNET WERDEN SOLL |
---|
755 | # WERT VON do_remote WIRD FUER DATEIVERBINDUNGEN BENOETIGT. |
---|
756 | # WENN AUF REMOTE-MASCHINE GERECHNET WIRD, IST GLEICHZEITIG KLAR, |
---|
757 | # DASS EIN BATCH-JOB GESTARTET WERDEN MUSS |
---|
758 | if [[ -n $host && "$host" != $localhost ]] |
---|
759 | then |
---|
760 | do_batch=true |
---|
761 | do_remote=true |
---|
762 | case $host in |
---|
763 | (ibm|ibmh|ibmkisti|ibmku|ibms|ibmy|nech|necriam|lckyoto|lcsgib|lcsgih|unics|lcxe6|lcxt5m|lck|lckiaps|lckordi|lcsb) true;; |
---|
764 | (*) printf "\n" |
---|
765 | printf "\n +++ sorry: execution of batch jobs on remote host \"$host\"" |
---|
766 | printf "\n is not available" |
---|
767 | locat=nqs; (( iec = 0 )); exit;; |
---|
768 | esac |
---|
769 | else |
---|
770 | host=$localhost |
---|
771 | fi |
---|
772 | |
---|
773 | |
---|
774 | # ZUSATZBEDINGUNGEN (OPTION -K) AUSWERTEN |
---|
775 | if [[ -n $additional_conditions ]] |
---|
776 | then |
---|
777 | # echo $additional_conditions | cut -d" " -f1-3 | read cond1 cond2 dummy |
---|
778 | cond1=`echo $additional_conditions | cut -d" " -f1` |
---|
779 | cond2=`echo $additional_conditions | cut -d" " -s -f2` |
---|
780 | dummy=`echo $additional_conditions | cut -d" " -s -f3` |
---|
781 | if [[ -n $dummy ]] |
---|
782 | then |
---|
783 | printf "\n +++ more than 2 additional conditions given for Option \"-K\"" |
---|
784 | locat=options; exit |
---|
785 | fi |
---|
786 | block=_$cond1 |
---|
787 | [[ -n $cond2 ]] && block=${block}_$cond2 |
---|
788 | fi |
---|
789 | |
---|
790 | |
---|
791 | # KOPPLUNGSEIGENSCHAFTEN (-Y) AUSWERTEN UND coupled_mode BESTIMMEN |
---|
792 | if [[ $run_coupled_model = true ]] |
---|
793 | then |
---|
794 | |
---|
795 | if [[ -n $coupled_dist ]] |
---|
796 | then |
---|
797 | |
---|
798 | numprocs_atmos=`echo $coupled_dist | cut -d" " -s -f1` |
---|
799 | numprocs_ocean=`echo $coupled_dist | cut -d" " -s -f2` |
---|
800 | |
---|
801 | if (( $numprocs_ocean + $numprocs_atmos != $numprocs )) |
---|
802 | then |
---|
803 | |
---|
804 | printf "\n +++ number of processors does not fit to specification by \"-Y\"." |
---|
805 | printf "\n PEs (total) : $numprocs" |
---|
806 | printf "\n PEs (atmosphere): $numprocs_atmos" |
---|
807 | printf "\n PEs (ocean) : $numprocs_ocean" |
---|
808 | locat=coupling; exit |
---|
809 | |
---|
810 | fi |
---|
811 | |
---|
812 | else |
---|
813 | |
---|
814 | (( numprocs_ocean = $numprocs / 2 )) |
---|
815 | (( numprocs_atmos = $numprocs / 2 )) |
---|
816 | |
---|
817 | fi |
---|
818 | coupled_dist=`echo "$numprocs_atmos $numprocs_ocean"` |
---|
819 | |
---|
820 | # GET coupled_mode FROM THE CONFIG FILE |
---|
821 | line="" |
---|
822 | grep "%cpp_options.*-D__mpi2.*$host" $config_file > tmp_mrun |
---|
823 | while read line |
---|
824 | do |
---|
825 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" && ( $(echo $line | cut -d" " -s -f4) = $cond1 || $(echo $line | cut -d" " -s -f4) = $cond2 ) ]] |
---|
826 | then |
---|
827 | coupled_mode="mpi2" |
---|
828 | fi |
---|
829 | done < tmp_mrun |
---|
830 | |
---|
831 | fi |
---|
832 | |
---|
833 | |
---|
834 | # PRUEFEN, OB EVTL. BEI VORHERGEHENDEM LAUF (KETTENJOB) EINE |
---|
835 | # ARCHIVIERUNG FEHLGESCHLAGEN IST |
---|
836 | if [[ -f ~/job_queue/ARCHIVE_ERROR_$fname ]] |
---|
837 | then |
---|
838 | if [[ $ignore_archive_error = false ]] |
---|
839 | then |
---|
840 | printf "\n +++ data archiving of previous run failed" |
---|
841 | printf "\n see directory \~/job_queue on remote machine" |
---|
842 | locat=archive; exit |
---|
843 | else |
---|
844 | printf "\n +++ warning: data archiving in a previous run failed" |
---|
845 | printf "\n MRUN continues, trying to get backup copy" |
---|
846 | fi |
---|
847 | fi |
---|
848 | |
---|
849 | |
---|
850 | |
---|
851 | # LESEN UND INTERPRETIEREN DER KONFIGURATIONS-DATEI VOM SHELLSCRIPT AUS |
---|
852 | # VORUEBERGEHEND ZWINGEND AUF LINUX-RECHNERN |
---|
853 | if [[ "$read_from_config" = false ]] |
---|
854 | then |
---|
855 | |
---|
856 | [[ $silent = false ]] && printf "\n Reading the configuration file... " |
---|
857 | while read zeile |
---|
858 | do |
---|
859 | [[ $silent = false ]] && printf "." |
---|
860 | |
---|
861 | |
---|
862 | # ZUERST EVENTUELL VORKOMMENDE ENVIRONMENT-VARIABLEN DURCH IHRE WERTE |
---|
863 | # ERSETZEN |
---|
864 | eval zeile=\"$zeile\" |
---|
865 | |
---|
866 | |
---|
867 | # INTERPRETATION DER ZEILE |
---|
868 | if [[ "$(echo $zeile)" = "" ]] |
---|
869 | then |
---|
870 | # LEERZEILE, KEINE AKTION |
---|
871 | continue |
---|
872 | |
---|
873 | elif [[ "$(echo $zeile | cut -c1)" = "#" ]] |
---|
874 | then |
---|
875 | |
---|
876 | # ZEILE IST KOMMENTARZEILE |
---|
877 | true |
---|
878 | |
---|
879 | elif [[ "$(echo $zeile | cut -c1)" = "%" ]] |
---|
880 | then |
---|
881 | |
---|
882 | # ZEILE DEFINIERT ENVIRONMENT-VARIABLE |
---|
883 | zeile=$(echo $zeile | cut -c2-) |
---|
884 | # echo $zeile | cut -d" " -f1-5 | read var value for_host for_cond1 for_cond2 |
---|
885 | var=`echo $zeile | cut -d" " -f1` |
---|
886 | value=`echo $zeile | cut -d" " -s -f2` |
---|
887 | for_host=`echo $zeile | cut -d" " -s -f3` |
---|
888 | for_cond1=`echo $zeile | cut -d" " -s -f4` |
---|
889 | for_cond2=`echo $zeile | cut -d" " -s -f5` |
---|
890 | |
---|
891 | if [[ "$for_host" = "" || ( "$for_host" = $host && "$for_cond1" = "$cond1" && "$for_cond2" = "$cond2" ) || $(echo "$input_list$output_list"|grep -c "$for_host") != 0 ]] |
---|
892 | then |
---|
893 | |
---|
894 | # BEI COMPILER- CPP- ODER LINKEROPTIONEN EVTL ":" DURCH " " |
---|
895 | # ERSETZEN. "::" WIRD DURCH ":" ERSETZT. |
---|
896 | value=`echo $value | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` |
---|
897 | |
---|
898 | |
---|
899 | # ENVIRONMENT-VARIABLE WIRD WERT AUS KONFIGURATIONSDATEI |
---|
900 | # ZUGEWIESEN, WENN SIE SELBST NOCH KEINEN WERT UEBER DIE |
---|
901 | # ENTSPRECHENDE SCRIPT-OPTION ERHALTEN HAT. SOLCHE |
---|
902 | # VARIABLEN HAETTEN DANN DEN WERT "" ODER IM INTEGER-FALL DEN |
---|
903 | # WERT 0. ALLGEMEINE REGEL ALSO: SCRIPT-OPTION GEHT UEBER |
---|
904 | # KONFIGURATIONSDATEI |
---|
905 | if [[ "$(eval echo \$$var)" = "" || "$(eval echo \$$var)" = "0" ]] |
---|
906 | then |
---|
907 | eval $var=\$value |
---|
908 | |
---|
909 | # EVTL. BILDSCHIRMAUSGABEN DER ENVIRONMENT-VARIABLEN |
---|
910 | if [[ $do_trace = true ]] |
---|
911 | then |
---|
912 | printf "\n*** ENVIRONMENT-VARIABLE $var = $value" |
---|
913 | fi |
---|
914 | fi |
---|
915 | |
---|
916 | # WENN ENVIRONMENT-VARIABLE HOST VEREINBART, DANN SOFORT AUSWERTEN |
---|
917 | # WERT VON do-remote WIRD BEI DATEIVERBINDUNGEN BENOETIGT |
---|
918 | # WENN AUF REMOTE-MASCHINE GERECHNET WIRD, IST GLEICHZEITIG KLAR, |
---|
919 | # DASS EIN BATCH-JOB GESTARTET WERDEN MUSS |
---|
920 | if [[ $var = host ]] |
---|
921 | then |
---|
922 | if [[ -n $host && "$host" != $localhost ]] |
---|
923 | then |
---|
924 | do_batch=true |
---|
925 | do_remote=true |
---|
926 | case $host in |
---|
927 | (ibm|ibmh|ibmkisti|ibmku|ibms|ibmy|lckyoto|lcsgib|lcsgih|nech|necriam|unics|lcxe6|lcxt5m|lck|lckiaps|lckordi|lcsb) true;; |
---|
928 | (*) printf "\n +++ sorry: execution of batch jobs on remote host \"$host\"" |
---|
929 | printf "\n is not available" |
---|
930 | locat=nqs; exit;; |
---|
931 | esac |
---|
932 | else |
---|
933 | host=$localhost |
---|
934 | fi |
---|
935 | fi |
---|
936 | |
---|
937 | # VOM BENUTZER DEFINIERTE ENVIRONMENT VARIABLEN MUESSEN PRINZIPIELL |
---|
938 | # EXPORTIERT WERDEN, DA SIE VIELLEICHT IN WEITER UNTEN AUFZURUFEN- |
---|
939 | # DEN PROGRAMMEN BENOETIGT WERDEN |
---|
940 | export $var |
---|
941 | fi |
---|
942 | |
---|
943 | |
---|
944 | |
---|
945 | |
---|
946 | elif [[ "$(echo $zeile | cut -c1-3)" = "EC:" ]] |
---|
947 | then |
---|
948 | |
---|
949 | # ZEILE DEFINIERT ERROR-KOMMANDO |
---|
950 | (( iec = iec + 1 )) |
---|
951 | zeile=$(echo $zeile | cut -c4-) |
---|
952 | err_command[$iec]="$zeile" |
---|
953 | |
---|
954 | elif [[ "$(echo $zeile | cut -c1-3)" = "IC:" ]] |
---|
955 | then |
---|
956 | |
---|
957 | # ZEILE DEFINIERT INPUT-KOMMANDO |
---|
958 | (( iic = iic + 1 )) |
---|
959 | zeile=$(echo $zeile | cut -c4-) |
---|
960 | in_command[$iic]="$zeile" |
---|
961 | |
---|
962 | elif [[ "$(echo $zeile | cut -c1-3)" = "OC:" ]] |
---|
963 | then |
---|
964 | |
---|
965 | # ZEILE DEFINIERT OUTPUT-KOMMANDO |
---|
966 | (( ioc = ioc + 1 )) |
---|
967 | zeile=$(echo $zeile | cut -c4-) |
---|
968 | out_command[$ioc]="$zeile" |
---|
969 | |
---|
970 | else |
---|
971 | |
---|
972 | # ZEILE DEFINIERT DATEIVERBINDUNG. EINLESEN DER DATEIEIGENSCHAFTEN |
---|
973 | # s2a: in/out - Feld |
---|
974 | # s2b: loc - Feld (optional) |
---|
975 | # s2c: tr/ar - Feld (optional) |
---|
976 | # echo $zeile | cut -d" " -f1-2 | read s1 s2 |
---|
977 | s1=`echo $zeile | cut -d" " -f1` |
---|
978 | s2=`echo $zeile | cut -d" " -s -f2` |
---|
979 | s2a=$(echo $s2 | cut -d":" -f1) |
---|
980 | if [[ $(echo $s2 | grep -c ":") = 0 ]] |
---|
981 | then |
---|
982 | s2b="" |
---|
983 | s2c="" |
---|
984 | else |
---|
985 | # echo $s2 | cut -d":" -f2-3 | sed 's/:/ /g' | read s2b s2c |
---|
986 | s2b=`echo $s2 | cut -d":" -f2 | sed 's/:/ /g'` |
---|
987 | s2c=`echo $s2 | cut -d":" -s -f3 | sed 's/:/ /g'` |
---|
988 | fi |
---|
989 | # echo $zeile | cut -d" " -f3-6 | read s3 s4 s5 s6 |
---|
990 | s3=`echo $zeile | cut -d" " -f3` |
---|
991 | s4=`echo $zeile | cut -d" " -s -f4` |
---|
992 | s5=`echo $zeile | cut -d" " -s -f5` |
---|
993 | s6=`echo $zeile | cut -d" " -s -f6` |
---|
994 | |
---|
995 | |
---|
996 | # ABSPEICHERN DER DATEIVERBINDUNG, FALLS IN INPUT- ODER OUTPUT-LIST |
---|
997 | # VERMERKT. VARIABLE S3 KANN AUCH LISTE ENTHALTEN (FELDTRENNER ":") |
---|
998 | # DATEIVERBINDUNG WIRD DANN NICHT ABGESPEICHERT UND GEPRUEFT, WENN |
---|
999 | # PROGRAMMLAUF AUF REMOTE-MASCHINE ERFOLGT UND DATEI NUR LOKAL VOR- |
---|
1000 | # HANDEN SEIN MUSS (D.H. s2b = loc) |
---|
1001 | IFSALT="$IFS"; IFS="$IFS:" |
---|
1002 | if [[ "$s2a" = in && ! ( $do_remote = true && ( "$s2b" = loc || "$s2b" = locopt ) ) ]] |
---|
1003 | then |
---|
1004 | found=false |
---|
1005 | for actual in $input_list |
---|
1006 | do |
---|
1007 | for formal in $s3 |
---|
1008 | do |
---|
1009 | [[ $actual = $formal || "$formal" = "-" ]] && found=true |
---|
1010 | done |
---|
1011 | done |
---|
1012 | if [[ $found = true ]] |
---|
1013 | then |
---|
1014 | (( iin = iin + 1 )) |
---|
1015 | localin[$iin]=$s1; transin[$iin]=$s2b; actionin[$iin]=$s2c; |
---|
1016 | typein[$iin]=$s3; pathin[$iin]=$s4; endin[$iin]=$s5; |
---|
1017 | extin[$iin]=$s6 |
---|
1018 | fi |
---|
1019 | elif [[ "$s2a" = out && ! ( $do_remote = true && "$s2b" = loc ) ]] |
---|
1020 | then |
---|
1021 | found=false |
---|
1022 | for actual in $output_list |
---|
1023 | do |
---|
1024 | for formal in $s3 |
---|
1025 | do |
---|
1026 | [[ $actual = $formal || "$formal" = "-" ]] && found=true |
---|
1027 | done |
---|
1028 | done |
---|
1029 | if [[ $found = true ]] |
---|
1030 | then |
---|
1031 | (( iout = iout + 1 )) |
---|
1032 | localout[$iout]=$s1; actionout[$iout]=$s2c; typeout[$iout]=$s3; |
---|
1033 | pathout[$iout]=$s4; endout[$iout]=$s5; extout[$iout]=$s6 |
---|
1034 | fi |
---|
1035 | elif [[ "$s2a" != in && "$s2a" != out ]] |
---|
1036 | then |
---|
1037 | printf "\n +++ I/O-attribute in configuration file $config_file has the invalid" |
---|
1038 | printf "\n value \"$s2\". Only \"in\" and \"out\" are allowed!" |
---|
1039 | locat=connect; exit |
---|
1040 | fi |
---|
1041 | IFS="$IFSALT" |
---|
1042 | fi |
---|
1043 | done < $config_file |
---|
1044 | |
---|
1045 | else |
---|
1046 | |
---|
1047 | |
---|
1048 | # INTERPRETATION DER KONFIGURATIONSDATEI MITTELS FORTRAN 90 - PROGRAMM |
---|
1049 | [[ $silent = false ]] && printf "..." |
---|
1050 | export cond1 cond2 config_file do_remote do_trace input_list localhost output_list |
---|
1051 | export interpreted_config_file=.icf.$RANDOM |
---|
1052 | |
---|
1053 | |
---|
1054 | |
---|
1055 | # ENVIRONMENT-VARIABLEN FUER INTERPRET_CONFIG UEBER NAMELIST_DATEI ZUR |
---|
1056 | # VERFUEGUNG STELLEN |
---|
1057 | cat > .mrun_environment << %%END%% |
---|
1058 | &mrun_environment cond1 = '$cond1', cond2 = '$cond2', |
---|
1059 | config_file = '$config_file', do_remote = '$do_remote', |
---|
1060 | do_trace = '$do_trace', host = '$host', |
---|
1061 | input_list = '$input_list', icf = '$interpreted_config_file', |
---|
1062 | localhost = '$localhost', output_list = '$output_list' / |
---|
1063 | |
---|
1064 | %%END%% |
---|
1065 | |
---|
1066 | # WERTE VON MRUN-OPTIONEN SICHERN UND DAMIT GEGEBENENFALLS SPAETER DIE |
---|
1067 | # IN DER KONFIGURAIONSDATEI ANGEGEBENEN WERTE UEBERSTEUERN |
---|
1068 | mrun_memory=$memory |
---|
1069 | mrun_group_number=$group_number |
---|
1070 | mrun_cpumax=$cpumax |
---|
1071 | mrun_numprocs=$numprocs |
---|
1072 | |
---|
1073 | if [[ $localhost_realname = "sx-fep" ]] |
---|
1074 | then |
---|
1075 | /home/COAR/NC/raasch/pub/interpret_config_necriam.x |
---|
1076 | else |
---|
1077 | |
---|
1078 | if [[ "$host" != $localhost ]] |
---|
1079 | then |
---|
1080 | |
---|
1081 | # REMOTE JOB FROM LOCAL HOST: JUST TAKE THE FIRST EXECUTABLE FOUND |
---|
1082 | interpret_config_executable=`ls -1 ${PALM_BIN}/interpret_config*.x 2>/dev/null` |
---|
1083 | if [[ $? != 0 ]] |
---|
1084 | then |
---|
1085 | printf "\n\n +++ no interpret_config found" |
---|
1086 | printf "\n run \"mbuild -u -h ...\" to generate utilities for this host" |
---|
1087 | locat=interpret_config; exit |
---|
1088 | fi |
---|
1089 | interpret_config_executable=`echo $interpret_config_executable | cut -d" " -f1` |
---|
1090 | $interpret_config_executable |
---|
1091 | |
---|
1092 | else |
---|
1093 | |
---|
1094 | # CHECK, IF THERE IS AN EXECUTABLE FOR THE BLOCK |
---|
1095 | if [[ ! -f ${PALM_BIN}/interpret_config${block}.x ]] |
---|
1096 | then |
---|
1097 | printf "\n\n +++ no interpret_config found for given block \"$cond1 $cond2\"" |
---|
1098 | printf "\n run \"mbuild -u -h ...\" to generate utilities for this block" |
---|
1099 | locat=interpret_config; exit |
---|
1100 | else |
---|
1101 | interpret_config${block}.x |
---|
1102 | fi |
---|
1103 | |
---|
1104 | fi |
---|
1105 | fi |
---|
1106 | rm .mrun_environment |
---|
1107 | |
---|
1108 | |
---|
1109 | # AUSFUEHRUNG DER GENERIERTEN SHELL-KOMMANDOS IN DIESER SHELL |
---|
1110 | chmod u+x $interpreted_config_file |
---|
1111 | export PATH=$PATH:. |
---|
1112 | . $interpreted_config_file |
---|
1113 | rm $interpreted_config_file |
---|
1114 | |
---|
1115 | |
---|
1116 | # OPTIONSWERTE UEBERSTEUERN KONFIGURATIONSDATEI |
---|
1117 | [[ $mrun_memory != 0 ]] && memory=$mrun_memory |
---|
1118 | [[ "$mrun_group_number" != "none" ]] && group_number=$mrun_group_number |
---|
1119 | [[ $mrun_cpumax != 0 ]] && cpumax=$mrun_cpumax |
---|
1120 | [[ "$mrun_numprocs" != "" ]] && numprocs=$mrun_numprocs |
---|
1121 | [[ "$max_par_io_str" != "" ]] && maximum_parallel_io_streams=$max_par_io_str |
---|
1122 | [[ "$mrun_tasks_per_node" != "" ]] && tasks_per_node=$mrun_tasks_per_node |
---|
1123 | |
---|
1124 | fi |
---|
1125 | |
---|
1126 | |
---|
1127 | # QUELLTEXTVERZEICHNIS AUF LOKALER MASCHINE AUS KONFIGURATIONSDATEI |
---|
1128 | # BESTIMMEN (WUERDE SONST EVTL. DAS VERZEICHNIS DES JEWEILS UNTER -h |
---|
1129 | # ANGEGEBENEN REMOTE-RECHNERS SEIN) |
---|
1130 | # BEI BATCH-JOBS SIND DIE ZU UEBERSETZENDEN PROGRAMMTEILE SCHON KOMPLETT |
---|
1131 | if [[ "$SOURCES_COMPLETE" = "" ]] |
---|
1132 | then |
---|
1133 | |
---|
1134 | # ZUERST PRUEFEN, OB EIN GLOBALER QUELLTEXTPFAD FUER ALLE RECHNER |
---|
1135 | # VEREINBART WURDE |
---|
1136 | source_path="" |
---|
1137 | line="" |
---|
1138 | grep "%source_path" $config_file > tmp_mrun |
---|
1139 | while read line |
---|
1140 | do |
---|
1141 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
1142 | then |
---|
1143 | if [[ "$(echo $line | cut -d" " -f3)" = "" ]] |
---|
1144 | then |
---|
1145 | global_source_path=`echo $line | cut -d" " -f2` |
---|
1146 | fi |
---|
1147 | fi |
---|
1148 | done < tmp_mrun |
---|
1149 | |
---|
1150 | line="" |
---|
1151 | found=false |
---|
1152 | grep " $localhost" $config_file | grep "%source_path" > tmp_mrun |
---|
1153 | while read line |
---|
1154 | do |
---|
1155 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
1156 | then |
---|
1157 | if [[ $found = true ]] |
---|
1158 | then |
---|
1159 | printf "\n\n +++ more than one source path found in configuration file" |
---|
1160 | printf "\n for local host \"$localhost\" " |
---|
1161 | locat=source_path; exit |
---|
1162 | fi |
---|
1163 | source_path=`echo $line | cut -d" " -f2` |
---|
1164 | found=true |
---|
1165 | fi |
---|
1166 | done < tmp_mrun |
---|
1167 | rm tmp_mrun |
---|
1168 | |
---|
1169 | if [[ "$source_path" = "" ]] |
---|
1170 | then |
---|
1171 | if [[ "$global_source_path" != "" ]] |
---|
1172 | then |
---|
1173 | source_path=$global_source_path |
---|
1174 | else |
---|
1175 | printf "\n\n +++ no source path found in configuration file" |
---|
1176 | printf "\n for local host \"$localhost\" " |
---|
1177 | locat=source_path; exit |
---|
1178 | fi |
---|
1179 | fi |
---|
1180 | eval source_path=$source_path |
---|
1181 | |
---|
1182 | if [[ ! -d $source_path ]] |
---|
1183 | then |
---|
1184 | printf "\n\n +++ source path \"$source_path\" on local host" |
---|
1185 | printf "\n \"$localhost\" does not exist" |
---|
1186 | locat=source_path; exit |
---|
1187 | fi |
---|
1188 | |
---|
1189 | fi |
---|
1190 | |
---|
1191 | |
---|
1192 | # GLOBALE REVISIONSNUMMER ERMITTELN (FORTSETZUNGSLAEUFEN WIRD DIESE |
---|
1193 | # DURCH OPTION -G MITGETEILT) |
---|
1194 | if [[ "$global_revision" = "" && $host != "ibmkisti" ]] |
---|
1195 | then |
---|
1196 | global_revision=`svnversion $source_path 2>/dev/null` |
---|
1197 | global_revision="Rev: $global_revision" |
---|
1198 | fi |
---|
1199 | |
---|
1200 | |
---|
1201 | # NOCHMAL PRUEFEN, OB AUF REMOTE-MASCHINE GERECHNET WERDEN SOLL |
---|
1202 | # (HOST KANN IN KONFIGURATIONSDATEI ANDERS FESTGELEGT WORDEN SEIN) |
---|
1203 | # WERT VON do_remote WIRD FUER DATEIVERBINDUNGEN BENOETIGT. |
---|
1204 | # WENN AUF REMOTE-MASCHINE GERECHNET WIRD, IST GLEICHZEITIG KLAR, |
---|
1205 | # DASS EIN BATCH-JOB GESTARTET WERDEN MUSS |
---|
1206 | if [[ -n $host && "$host" != $localhost ]] |
---|
1207 | then |
---|
1208 | do_batch=true |
---|
1209 | do_remote=true |
---|
1210 | case $host in |
---|
1211 | (ibm|ibmh|ibmkisti|ibmku|ibms|ibmy|lckyoto|lcsgib|lcsgih|nech|necriam|unics|lcxe6|lcxt5m|lck|lckiaps|lckordi|lcsb) true;; |
---|
1212 | (*) printf "\n" |
---|
1213 | printf "\n +++ sorry: execution of batch jobs on remote host \"$host\"" |
---|
1214 | printf "\n is not available" |
---|
1215 | locat=nqs; (( iec = 0 )); exit;; |
---|
1216 | esac |
---|
1217 | else |
---|
1218 | host=$localhost |
---|
1219 | fi |
---|
1220 | |
---|
1221 | |
---|
1222 | # PRUEFUNG EINIGER PROZESSORZAHLANGABEN BEI RECHNUNGEN AUF PARALLELRECHNERN |
---|
1223 | if [[ "$cond1" = parallel || "$cond2" = parallel ]] |
---|
1224 | then |
---|
1225 | |
---|
1226 | # PRUEFEN, OB DIE ANZAHL DER ZU VERWENDENDEN PES ANGEGEBEN WURDE |
---|
1227 | if [[ ! -n $numprocs ]] |
---|
1228 | then |
---|
1229 | printf "\n" |
---|
1230 | printf "\n +++ option \"-K parallel\" requires additional specification" |
---|
1231 | printf "\n of the number of processors to be used by" |
---|
1232 | printf "\n mrun-option \"-X\" or by environment-variable" |
---|
1233 | printf "\n \"numprocs\" in the configuration file" |
---|
1234 | locat=numprocs; (( iec = 0 )); exit |
---|
1235 | fi |
---|
1236 | |
---|
1237 | # PRUEFEN, OB DIE PROZESSORANZAHL PRO KNOTEN ANGEGEBEN WURDE (GGF. |
---|
1238 | # DEFAULT-WERT SETZEN) UND OB SIE EIN GANZZAHLIGER TEILER DER |
---|
1239 | # GESAMTPROZESSORANZAHL IST |
---|
1240 | if [[ "$tasks_per_node" = "" && $host != lcflow && $host != lcxt5m ]] |
---|
1241 | then |
---|
1242 | printf "\n" |
---|
1243 | printf "\n +++ option \"-T\" (tasks per node) is missing" |
---|
1244 | printf "\n set -T option or define tasks_per_node in the config file" |
---|
1245 | locat=tasks_per_node; (( iec = 0 )); exit |
---|
1246 | fi |
---|
1247 | if [[ $host != lcflow && $host != lcxt5m ]] |
---|
1248 | then |
---|
1249 | (( ival = $tasks_per_node )) |
---|
1250 | (( pes = numprocs )) |
---|
1251 | # if [[ $(echo $package_list | grep -c dvrp_graphics+1PE) = 1 ]] |
---|
1252 | # then |
---|
1253 | # (( pes = pes - 1 )) |
---|
1254 | # fi |
---|
1255 | (( ii = pes / ival )) |
---|
1256 | if (( pes - ii * ival > 0 )) |
---|
1257 | then |
---|
1258 | printf "\n" |
---|
1259 | printf "\n +++ tasks per node (option \"-T\") must be an integral" |
---|
1260 | printf "\n divisor of the total number of processors (option \"-X\")" |
---|
1261 | printf "\n values of this mrun-call: \"-T $tasks_per_node\" \"-X $numprocs\"" |
---|
1262 | locat=tasks_per_node; (( iec = 0 )); exit |
---|
1263 | fi |
---|
1264 | fi |
---|
1265 | |
---|
1266 | |
---|
1267 | # IBMY HAT NUR EINEN KNOTEN |
---|
1268 | if [[ $host = ibmy ]] |
---|
1269 | then |
---|
1270 | if [[ "$tasks_per_node" != "" && "$tasks_per_node" != "$numprocs" ]] |
---|
1271 | then |
---|
1272 | printf "\n" |
---|
1273 | printf "\n +++ on ibmy, tasks per node (option \"-T\") must be equal to the" |
---|
1274 | printf "\n total number of processors (option \"-X\")" |
---|
1275 | printf "\n values of this mrun-call: \"-T $tasks_per_node\" \"-X $numprocs\"" |
---|
1276 | locat=tasks_per_node; (( iec = 0 )); exit |
---|
1277 | fi |
---|
1278 | fi |
---|
1279 | |
---|
1280 | |
---|
1281 | # SETTINGS FOR SUBJOB-COMMAND |
---|
1282 | TOPT="-T $tasks_per_node" |
---|
1283 | OOPT="-O $threads_per_task" |
---|
1284 | |
---|
1285 | # GESAMTZAHL DER KNOTEN BESTIMMEN |
---|
1286 | if [[ "$tasks_per_node" != "" ]] |
---|
1287 | then |
---|
1288 | (( nodes = numprocs / ( tasks_per_node * threads_per_task ) )) |
---|
1289 | fi |
---|
1290 | |
---|
1291 | # PRUEFEN, OB NODE USAGE EINEN ERLAUBTEN WERT HAT BZW. DEN DEFAULT |
---|
1292 | # SETZEN |
---|
1293 | if [[ $node_usage = default ]] |
---|
1294 | then |
---|
1295 | if [[ $host = ibms ]] |
---|
1296 | then |
---|
1297 | node_usage=shared |
---|
1298 | elif [[ $(echo $host | cut -c1-5) = lcsgi ]] |
---|
1299 | then |
---|
1300 | node_usage=singlejob |
---|
1301 | else |
---|
1302 | node_usage=not_shared |
---|
1303 | fi |
---|
1304 | fi |
---|
1305 | |
---|
1306 | if [[ $node_usage != shared && $node_usage != not_shared && $node_usage != singlejob && "$(echo $node_usage | cut -c1-3)" != "sla" ]] |
---|
1307 | then |
---|
1308 | printf "\n" |
---|
1309 | printf "\n +++ node usage (option \"-n\") is only allowed to be set" |
---|
1310 | printf "\n \"shared\" or \"not_shared\"" |
---|
1311 | locat=tasks_per_node; (( iec = 0 )); exit |
---|
1312 | fi |
---|
1313 | |
---|
1314 | fi |
---|
1315 | |
---|
1316 | # PRUEFEN, OB HOSTFILE EXISTIERT |
---|
1317 | if [[ -n $hostfile ]] |
---|
1318 | then |
---|
1319 | if [[ ! -f $hostfile ]] |
---|
1320 | then |
---|
1321 | printf "\n" |
---|
1322 | printf "\n +++ hostfile \"$hostfile\" does not exist" |
---|
1323 | locat=hostfile; exit |
---|
1324 | fi |
---|
1325 | fi |
---|
1326 | |
---|
1327 | # PRUEFEN, OB RHOSTS DATEI EXISTIERT. GEGEBENENFALLS ANLEGEN BZW. ERWEITERN |
---|
1328 | if [[ $host = ibmy && $do_remote = false ]] |
---|
1329 | then |
---|
1330 | if [[ ! -f $HOME/.rhosts ]] |
---|
1331 | then |
---|
1332 | echo "gfdl5.yonsei.ac.kr" > $HOME/.rhosts |
---|
1333 | printf "\n\n *** file:" |
---|
1334 | printf "\n $HOME/.rhosts" |
---|
1335 | printf "\n was created\n" |
---|
1336 | fi |
---|
1337 | if [[ $(grep -c gfdl5.yonsei.ac.kr $HOME/.rhosts) = 0 ]] |
---|
1338 | then |
---|
1339 | echo "gfdl5.yonsei.ac.kr" >> $HOME/.rhosts |
---|
1340 | printf "\n\n *** file:" |
---|
1341 | printf "\n $HOME/.rhosts" |
---|
1342 | printf "\n was extended by the name of the current host\n" |
---|
1343 | fi |
---|
1344 | fi |
---|
1345 | |
---|
1346 | |
---|
1347 | # Set default value for the maximum number of parallel io streams |
---|
1348 | if [[ "$maximum_parallel_io_streams" = "" ]] |
---|
1349 | then |
---|
1350 | maximum_parallel_io_streams=$numprocs |
---|
1351 | fi |
---|
1352 | |
---|
1353 | |
---|
1354 | # FALLS NICHT VORGEGEBEN, DEFAULT-QUEUE AUF DER ZIELMASCHINE FESTLEGEN |
---|
1355 | if [[ $queue = none ]] |
---|
1356 | then |
---|
1357 | case $host in |
---|
1358 | (ibmh) queue=no_class;; |
---|
1359 | (ibmkisti) queue=class.32plus;; |
---|
1360 | (ibmy) queue=parallel;; |
---|
1361 | (lckiaps) queue=normal;; |
---|
1362 | (lckyoto) queue=ph;; |
---|
1363 | (lcsgib) queue=testq;; |
---|
1364 | (lcsgih) queue=testq;; |
---|
1365 | (lctit) queue=S;; |
---|
1366 | (nech) queue=none;; |
---|
1367 | (necriam) queue=SP;; |
---|
1368 | (unics) queue=unics;; |
---|
1369 | esac |
---|
1370 | fi |
---|
1371 | |
---|
1372 | |
---|
1373 | # VOLLSTAENDIGE DATEINAMEN DER INPUT-FILES BILDEN, |
---|
1374 | # INPUT-DATEIEN AUF VORHANDENSEIN PRUEFEN UND EVTL. HOECHSTE ZYKLUSNUMMER |
---|
1375 | # ERMITTELN |
---|
1376 | (( i = 0 )) |
---|
1377 | while (( i < iin )) |
---|
1378 | do |
---|
1379 | (( i = i + 1 )) |
---|
1380 | (( maxcycle = 0 )) |
---|
1381 | |
---|
1382 | # NAMENSBILDUNG (EVTL. IST FESTER DATEINAME VORGEGEBEN) |
---|
1383 | if [[ "${actionin[$i]}" = di ]] |
---|
1384 | then |
---|
1385 | remotepathin[$i]=${pathin[$i]}/${endin[$i]} # REMOTE-PFAD ERST AUF |
---|
1386 | # REM-MASCHINE AUSWERTEN |
---|
1387 | eval filename=${pathin[$i]}/${endin[$i]} |
---|
1388 | else |
---|
1389 | remotepathin[$i]=${pathin[$i]}/${afname}${endin[$i]} # REMOTE-PFAD ERST AUF |
---|
1390 | # REM-MASCHINE AUSWERTEN |
---|
1391 | eval filename=${pathin[$i]}/${afname}${endin[$i]} |
---|
1392 | fi |
---|
1393 | eval pathname=${pathin[$i]} |
---|
1394 | |
---|
1395 | # SAVE INPUT FILE NAME FOR PARAMETER FILE CHECK |
---|
1396 | if [[ ("${transin[$i]}" = job) && (-f $filename) ]] |
---|
1397 | then |
---|
1398 | filename_input=$filename |
---|
1399 | fi |
---|
1400 | |
---|
1401 | # PRUEFEN AUF VORHANDENSEIN |
---|
1402 | if [[ $(ls $filename* 2>&1 | grep -c "not found") = 1 || \ |
---|
1403 | $(ls $filename* 2>&1 | grep -c "nicht gefunden") = 1 || \ |
---|
1404 | $(ls $filename* 2>&1 | grep -c "No such file") = 1 || \ |
---|
1405 | $(ls $filename* 2>&1 | grep -c "does not exist") = 1 ]] |
---|
1406 | then |
---|
1407 | # DATEIEN MIT EXTENSION (Z.B. NC) MUESSEN NICHT ZWINGEND VORHANDEN |
---|
1408 | # SEIN, DESHALB IN SOLCHEN FAELLEN KEIN ABBRUCH. DIES IST NUR EINE |
---|
1409 | # VORUEBERGEHENDE LOESUNG (OKT 05). NICHT ZWINGEND BENOETIGTE |
---|
1410 | # EINGABEDATEIEN SOLLTEN EINE SPEZIELLE OPTION IN DER DATEI- |
---|
1411 | # VERBINDUNGSANWEISUNG BEKOMMEN (Z.B. inopt?) |
---|
1412 | if [[ "${transin[$i]}" != "locopt" ]] |
---|
1413 | then |
---|
1414 | printf "\n\n +++ INPUT-file: " |
---|
1415 | if [[ "${extin[$i]}" = "" ]] |
---|
1416 | then |
---|
1417 | printf "\n $filename" |
---|
1418 | else |
---|
1419 | printf "\n $filename.${extin[$i]}" |
---|
1420 | fi |
---|
1421 | printf "\n does not exist\n" |
---|
1422 | locat=input; exit |
---|
1423 | else |
---|
1424 | transin[$i]="unavailable" |
---|
1425 | fi |
---|
1426 | else |
---|
1427 | |
---|
1428 | # ZYKLUSNUMMER FESTSTELLEN |
---|
1429 | ls -1 -d $filename > filelist 2>/dev/null |
---|
1430 | ls -1 -d $filename.* >> filelist 2>/dev/null |
---|
1431 | while read zeile |
---|
1432 | do |
---|
1433 | cycle=$(print $zeile | cut -f2 -d".") |
---|
1434 | if [[ "$cycle" = "$zeile" ]] |
---|
1435 | then |
---|
1436 | (( icycle = 0 )) |
---|
1437 | elif [[ "$cycle" = "${extin[$i]}" ]] |
---|
1438 | then |
---|
1439 | (( icycle = 0 )) |
---|
1440 | else |
---|
1441 | (( icycle = $cycle )) |
---|
1442 | fi |
---|
1443 | if (( icycle > maxcycle )) |
---|
1444 | then |
---|
1445 | (( maxcycle = icycle )) |
---|
1446 | file_to_be_used=$zeile |
---|
1447 | fi |
---|
1448 | done <filelist |
---|
1449 | rm filelist |
---|
1450 | |
---|
1451 | # EVTL. ZYKLUSNUMMER AN DATEINAMEN ANFUEGEN |
---|
1452 | if (( maxcycle > 0 )) |
---|
1453 | then |
---|
1454 | if [[ "${extin[$i]}" != " " && "${extin[$i]}" != "" ]] |
---|
1455 | then |
---|
1456 | filename=${filename}.$maxcycle.${extin[$i]} |
---|
1457 | else |
---|
1458 | filename=${filename}.$maxcycle |
---|
1459 | fi |
---|
1460 | else |
---|
1461 | if [[ "${extin[$i]}" != " " && "${extin[$i]}" != "" ]] |
---|
1462 | then |
---|
1463 | filename=${filename}.${extin[$i]} |
---|
1464 | fi |
---|
1465 | fi |
---|
1466 | |
---|
1467 | # DATEINAMEN OHNE PFAD ABER MIT ZYKLUSNUMMER ABSPEICHERN, |
---|
1468 | # DA SPAETER BEI RUECKSPEICHERN VOM ARCHIVSYSTEM EVTL. BENOETIGT |
---|
1469 | absnamein[$i]=$filename |
---|
1470 | if (( maxcycle > 0 )) |
---|
1471 | then |
---|
1472 | if [[ "${actionin[$i]}" = di ]] |
---|
1473 | then |
---|
1474 | frelin[$i]=${endin[$i]}.$maxcycle |
---|
1475 | else |
---|
1476 | frelin[$i]=${afname}${endin[$i]}.$maxcycle |
---|
1477 | fi |
---|
1478 | else |
---|
1479 | if [[ "${actionin[$i]}" = di ]] |
---|
1480 | then |
---|
1481 | frelin[$i]=${endin[$i]} |
---|
1482 | else |
---|
1483 | frelin[$i]=${afname}${endin[$i]} |
---|
1484 | fi |
---|
1485 | fi |
---|
1486 | |
---|
1487 | fi |
---|
1488 | done |
---|
1489 | |
---|
1490 | # VOLLSTAENDIGE DATEINAMEN (OHNE $ ODER ~) DER OUTPUT-FILES BILDEN, |
---|
1491 | # OUTPUT-DATEIEN AUF VORHANDENSEIN PRUEFEN UND EVTL. HOECHSTE ZYKLUSNUMMER |
---|
1492 | # ERMITTELN ODER, FALLS NICHT VORHANDEN, PRUEFEN, OB SIE SICH ANLEGEN LASSEN |
---|
1493 | # DIESE AKTIONEN FINDEN NICHT STATT, WENN PROGRAMM AUF REMOTE-MASCHINE |
---|
1494 | # RECHNET UND DATEI ANSCHLIESSEND TRANSFERIERT WERDEN SOLL! |
---|
1495 | (( i = 0 )) |
---|
1496 | while (( i < iout )) |
---|
1497 | do |
---|
1498 | (( i = i + 1 )) |
---|
1499 | if [[ ! ( $fromhost != $localhost && ( "${actionout[$i]}" = tr || "${actionout[$i]}" = tra || "${actionout[$i]}" = trpe ) ) ]] |
---|
1500 | then |
---|
1501 | if [[ "${actionout[$i]}" = tr ]] |
---|
1502 | then |
---|
1503 | actionout[$i]="" |
---|
1504 | elif [[ "${actionout[$i]}" = trpe ]] |
---|
1505 | then |
---|
1506 | actionout[$i]=pe |
---|
1507 | elif [[ "${actionout[$i]}" = tra ]] |
---|
1508 | then |
---|
1509 | actionout[$i]=a |
---|
1510 | fi |
---|
1511 | (( maxcycle = 0 )) |
---|
1512 | eval filename=${pathout[$i]}/${fname}${endout[$i]} |
---|
1513 | eval catalogname=${pathout[$i]} |
---|
1514 | if [[ $(ls $filename* 2>&1 | grep -c "not found") = 1 || \ |
---|
1515 | $(ls $filename* 2>&1 | grep -c "nicht gefunden") = 1 || \ |
---|
1516 | $(ls $filename* 2>&1 | grep -c "No such file") = 1 || \ |
---|
1517 | $(ls $filename* 2>&1 | grep -c "does not exist") = 1 ]] |
---|
1518 | then |
---|
1519 | |
---|
1520 | # OUTPUT-DATEI NICHT VORHANDEN. PRUEFEN, OB ANLEGEN MOEGLICH. |
---|
1521 | if cat /dev/null > $filename |
---|
1522 | then |
---|
1523 | rm $filename |
---|
1524 | else |
---|
1525 | |
---|
1526 | # PRUEFEN, OB KATALOG VORHANDEN UND EVTL. DIESEN ANLEGEN |
---|
1527 | if [[ ! -d $catalogname ]] |
---|
1528 | then |
---|
1529 | if mkdir -p $catalogname |
---|
1530 | then |
---|
1531 | printf "\n\n *** directory:" |
---|
1532 | printf "\n $catalogname" |
---|
1533 | printf "\n was created\n" |
---|
1534 | else |
---|
1535 | printf "\n\n +++ OUTPUT-file:" |
---|
1536 | printf "\n $filename" |
---|
1537 | printf "\n cannot be created, because directory does not exist" |
---|
1538 | printf "\n and cannot be created either" |
---|
1539 | printf "\n" |
---|
1540 | locat=output ; exit |
---|
1541 | fi 2>/dev/null |
---|
1542 | else |
---|
1543 | printf "\n\n +++ OUTPUT-file:" |
---|
1544 | printf "\n $filename" |
---|
1545 | printf "\n cannot be created, although directory exists" |
---|
1546 | printf "\n" |
---|
1547 | locat=output ; exit |
---|
1548 | fi |
---|
1549 | fi 2>/dev/null |
---|
1550 | else |
---|
1551 | |
---|
1552 | # ZYKLUSNUMMER FESTSTELLEN |
---|
1553 | ls -1 -d $filename > filelist 2>/dev/null |
---|
1554 | ls -1 -d $filename.* >> filelist 2>/dev/null |
---|
1555 | while read zeile |
---|
1556 | do |
---|
1557 | cycle=$(print $zeile | cut -f2 -d".") |
---|
1558 | if [[ "$cycle" = "$zeile" || "$cycle" = ${extout[$i]} ]] |
---|
1559 | then |
---|
1560 | (( icycle = 1 )) |
---|
1561 | else |
---|
1562 | (( icycle = $cycle + 1 )) |
---|
1563 | fi |
---|
1564 | if (( icycle > maxcycle )) |
---|
1565 | then |
---|
1566 | (( maxcycle = icycle )) |
---|
1567 | fi |
---|
1568 | done <filelist |
---|
1569 | rm filelist |
---|
1570 | fi |
---|
1571 | |
---|
1572 | # EVTL. ZYKLUSNUMMER AN DATEINAMEN ANFUEGEN UND PRUEFEN, OB SICH |
---|
1573 | # DATEI AUCH WIRKLICH ANLEGEN LAESST. IM APPEND-FALL MUSS AN DEN |
---|
1574 | # HOECHSTEN VORHANDENEN ZYKLUS-ANGEHAENGT WERDEN. ANLAGEPRUEFUNG |
---|
1575 | # IST DANN NATUERLICH NICHT ZULAESSIG BZW. MOEGLICH |
---|
1576 | if [[ "${actionout[$i]}" != a ]] |
---|
1577 | then |
---|
1578 | if (( maxcycle > 0 )) |
---|
1579 | then |
---|
1580 | filename=${filename}.$maxcycle |
---|
1581 | if cat /dev/null > $filename |
---|
1582 | then |
---|
1583 | rm $filename |
---|
1584 | else |
---|
1585 | printf "\n +++ OUTPUT-file:" |
---|
1586 | printf "\n $filename" |
---|
1587 | printf "\n cannot be created" |
---|
1588 | locat=output ; exit |
---|
1589 | fi |
---|
1590 | fi |
---|
1591 | else |
---|
1592 | (( maxcycle = maxcycle - 1 )) |
---|
1593 | if (( maxcycle > 0 )) |
---|
1594 | then |
---|
1595 | filename=${filename}.$maxcycle |
---|
1596 | fi |
---|
1597 | fi |
---|
1598 | |
---|
1599 | # DATEINAMEN OHNE PFAD ABER MIT ZYKLUSNUMMER ABSPEICHERN, |
---|
1600 | # DA SPAETER BEI ABLAGE AUF ARCHIVSYSTEM BZW. FUER |
---|
1601 | # DATEI OUTPUT_FILE_CONNECTIONS EVTL. BENOETIGT |
---|
1602 | pathout[$i]=$filename |
---|
1603 | if (( maxcycle > 0 )) |
---|
1604 | then |
---|
1605 | frelout[$i]=${fname}${endout[$i]}.$maxcycle |
---|
1606 | else |
---|
1607 | frelout[$i]=${fname}${endout[$i]} |
---|
1608 | fi |
---|
1609 | |
---|
1610 | fi |
---|
1611 | done |
---|
1612 | |
---|
1613 | |
---|
1614 | # DAS DVR-PAKET ERFORDERT EINE ENTSPRECHENDE BIBLIOTHEK |
---|
1615 | if [[ $(echo $package_list | grep -c dvrp_graphics) != 0 ]] |
---|
1616 | then |
---|
1617 | if [[ "$dvr_inc" = "" ]] |
---|
1618 | then |
---|
1619 | printf "\n\n +++ no value for \"dvr_inc\" given in configuration file" |
---|
1620 | printf "\n This is required for the dvrp_graphics package.\n" |
---|
1621 | locat=dvr; exit |
---|
1622 | fi |
---|
1623 | if [[ "$dvr_lib" = "" ]] |
---|
1624 | then |
---|
1625 | printf "\n\n +++ no value for \"dvr_lib\" given in configuration file" |
---|
1626 | printf "\n This is required for the dvrp_graphics package.\n" |
---|
1627 | locat=dvr; exit |
---|
1628 | fi |
---|
1629 | fi |
---|
1630 | |
---|
1631 | |
---|
1632 | # PRUEFEN, OB ENTWEDER HAUPTPROGRAMM ODER NUR EIN AUSFUEHRBARES |
---|
1633 | # PROGRAMM VEREINBART WURDE (IN DIESEM FALL BRAUCHT IM WEITEREN NICHT |
---|
1634 | # UEBERSETZT ZU WERDEN) |
---|
1635 | if [[ "$mainprog" = "" && "$executable" = "" ]] |
---|
1636 | then |
---|
1637 | printf "\n +++ neither main program nor executable defined" |
---|
1638 | locat=source; exit |
---|
1639 | elif [[ "$mainprog" != "" && "$executable" != "" ]] |
---|
1640 | then |
---|
1641 | printf "\n +++ main program as well as executable defined" |
---|
1642 | locat=source; exit |
---|
1643 | elif [[ "$mainprog" = "" && "$executable" != "" ]] |
---|
1644 | then |
---|
1645 | do_compile=false |
---|
1646 | fi |
---|
1647 | |
---|
1648 | |
---|
1649 | # SOURCE-VERZEICHNIS ZUM AUFSAMMELN DER ZU UEBERSETZENDEN PROGRAMMTEILE |
---|
1650 | # ERZEUGEN. HIERHIN WERDEN SPAETER IM FALL VON BATCH-JOBS AUCH DAS MRUN- |
---|
1651 | # SCRIPTS SOWIE DIE KONFIGURATIONSDATEI KOPIERT |
---|
1652 | if [[ $restart_run != true && "$SOURCES_COMPLETE" = "" ]] |
---|
1653 | then |
---|
1654 | rm -rf SOURCES_FOR_RUN_$fname |
---|
1655 | mkdir SOURCES_FOR_RUN_$fname |
---|
1656 | fi |
---|
1657 | |
---|
1658 | |
---|
1659 | # ALLE ZU UEBERSETZENDEN PROGRAMMTEILE ZUSAMMENSAMMELN |
---|
1660 | # BEI BATCH-JOBS IST DIES NICHT NOETIG, WEIL DIE PROGRAMMTEILE BEREITS DURCH |
---|
1661 | # DEN MRUN-AUFRUF ERMITTELT SIND, DER DEN BATCH-JOB GENERIERT HAT, UND |
---|
1662 | # IM VERZEICHNIS SOURCES_FOR_RUN_... ABGELEGT SIND |
---|
1663 | if [[ $do_compile = true && "$SOURCES_COMPLETE" = "" ]] |
---|
1664 | then |
---|
1665 | |
---|
1666 | [[ "$source_list" = LM ]] && source_list=LOCALLY_MODIFIED |
---|
1667 | |
---|
1668 | if [[ "$source_list" = LOCALLY_MODIFIED ]] |
---|
1669 | then |
---|
1670 | |
---|
1671 | # MODIFIZIERTE DATEIEN DER SVN-ARBEITSKOPIE BESTIMMEN |
---|
1672 | source_list="" |
---|
1673 | cd $source_path |
---|
1674 | |
---|
1675 | |
---|
1676 | # PRUEFEN, OB VERZEICHNIS UEBERHAUPT UNTER SVN-KONTROLLE STEHT |
---|
1677 | if [[ ! -d .svn ]] |
---|
1678 | then |
---|
1679 | printf "\n\n +++ source directory" |
---|
1680 | printf "\n \"$source_path\" " |
---|
1681 | printf "\n is not under control of \"subversion\"." |
---|
1682 | printf "\n Please do not use mrun-option \"-s LOCALLY_MODIFIED\"\n" |
---|
1683 | fi |
---|
1684 | |
---|
1685 | |
---|
1686 | # ALLE MODIFIZIERTEN QUELLCODEDATEIEN AUFLISTEN |
---|
1687 | Filenames="" |
---|
1688 | svn status > tmp_mrun |
---|
1689 | while read line |
---|
1690 | do |
---|
1691 | firstc=`echo $line | cut -c1` |
---|
1692 | if [[ $firstc = M || $firstc = "?" ]] |
---|
1693 | then |
---|
1694 | Name=`echo "$line" | cut -c8-` |
---|
1695 | extension=`echo $Name | cut -d. -f2` |
---|
1696 | if [[ "$extension" = f90 || "$extension" = F90 || "$extension" = f || "$extension" = F || "$extension" = c ]] |
---|
1697 | then |
---|
1698 | Filenames="$Filenames "$Name |
---|
1699 | fi |
---|
1700 | fi |
---|
1701 | done < tmp_mrun |
---|
1702 | |
---|
1703 | |
---|
1704 | # DATEIEN NACH SOURCES_FOR_RUN_... KOPIEREN |
---|
1705 | for dateiname in $Filenames |
---|
1706 | do |
---|
1707 | cp $dateiname $working_directory/SOURCES_FOR_RUN_$fname |
---|
1708 | source_list=$source_list"$dateiname " |
---|
1709 | done |
---|
1710 | |
---|
1711 | cd - > /dev/null |
---|
1712 | |
---|
1713 | |
---|
1714 | # MITTELS OPTION -s ANGEGEBENE DATEIEN NACH SOURCES_FOR_RUN_... KOPIEREN |
---|
1715 | # BEI AUTOMATISCHEN FORTSETZUNGSLAEUFEN SIND DORT SCHON ALLE DATEIEN |
---|
1716 | # VORHANDEN |
---|
1717 | elif [[ "$source_list" != "" && $restart_run != true ]] |
---|
1718 | then |
---|
1719 | |
---|
1720 | cd $source_path |
---|
1721 | |
---|
1722 | for filename in $source_list |
---|
1723 | do |
---|
1724 | |
---|
1725 | # QUELLTEXT-DATEI DARF KEINE PFADE BEINHALTEN |
---|
1726 | if [[ $(print $filename | grep -c "/") != 0 ]] |
---|
1727 | then |
---|
1728 | printf "\n +++ source code file: $filename" |
---|
1729 | printf "\n must not contain (\"/\") " |
---|
1730 | locat=source; exit |
---|
1731 | fi |
---|
1732 | |
---|
1733 | if [[ ! -f $filename ]] |
---|
1734 | then |
---|
1735 | printf "\n +++ source code file: $filename" |
---|
1736 | printf "\n does not exist" |
---|
1737 | locat=source; exit |
---|
1738 | else |
---|
1739 | cp $filename $working_directory/SOURCES_FOR_RUN_$fname |
---|
1740 | fi |
---|
1741 | |
---|
1742 | done |
---|
1743 | |
---|
1744 | cd - > /dev/null |
---|
1745 | |
---|
1746 | fi |
---|
1747 | |
---|
1748 | |
---|
1749 | # PRUEFEN, OB ENTWEDER HAUPTPROGRAMM VORHANDEN UND ES EVTL. IN DER |
---|
1750 | # LISTE DER ZU UEBERSETZENDEN PROGRAMMTEILE MIT ENTHALTEN IST (WENN |
---|
1751 | # NICHT, WIRD ES DIESER LISTE HINZUGEFUEGT) |
---|
1752 | if [[ $restart_run != true ]] |
---|
1753 | then |
---|
1754 | |
---|
1755 | if [[ ! -f "$source_path/$mainprog" ]] |
---|
1756 | then |
---|
1757 | printf "\n\n +++ main program: $mainprog" |
---|
1758 | printf "\n does not exist in source directory" |
---|
1759 | printf "\n \"$source_path\"\n" |
---|
1760 | locat=source; exit |
---|
1761 | else |
---|
1762 | if [[ $(echo $source_list | grep -c $mainprog) = 0 ]] |
---|
1763 | then |
---|
1764 | cp $source_path/$mainprog SOURCES_FOR_RUN_$fname |
---|
1765 | source_list=${mainprog}" $source_list" |
---|
1766 | fi |
---|
1767 | fi |
---|
1768 | fi |
---|
1769 | |
---|
1770 | |
---|
1771 | # MAKEFILE AUF VORHANDENSEIN PRUEFEN UND KOPIEREN |
---|
1772 | # BEI RESTART-LAEUFEN LIEGT ES SCHON IM VERZEICHNIS SOURCES_FOR_RUN... |
---|
1773 | if [[ "$restart_run" != true ]] |
---|
1774 | then |
---|
1775 | [[ "$makefile" = "" ]] && makefile=$source_path/Makefile |
---|
1776 | if [[ ! -f $makefile ]] |
---|
1777 | then |
---|
1778 | printf "\n +++ file \"$makefile\" does not exist" |
---|
1779 | locat=make; exit |
---|
1780 | else |
---|
1781 | cp $makefile SOURCES_FOR_RUN_$fname/Makefile |
---|
1782 | fi |
---|
1783 | fi |
---|
1784 | |
---|
1785 | |
---|
1786 | # DATEIEN AUS ZUSAETZLICHEM QUELLVERZEICHNIS HINZUFUEGEN |
---|
1787 | if [[ $restart_run != true && "$add_source_path" != "" ]] |
---|
1788 | then |
---|
1789 | |
---|
1790 | # GIBT ES DAS VERZEICHNIS UEBERHAUPT? |
---|
1791 | if [[ ! -d $add_source_path ]] |
---|
1792 | then |
---|
1793 | printf "\n\n +++ WARNING: additional source code directory" |
---|
1794 | printf "\n \"$add_source_path\" " |
---|
1795 | printf "\n does not exist or is not a directory." |
---|
1796 | printf "\n No source code will be used from this directory!\n" |
---|
1797 | add_source_path="" |
---|
1798 | if [[ $silent == false ]] |
---|
1799 | then |
---|
1800 | sleep 3 |
---|
1801 | fi |
---|
1802 | else |
---|
1803 | |
---|
1804 | cd $add_source_path |
---|
1805 | found=false |
---|
1806 | |
---|
1807 | Names=$(ls -1 *.f90 2>&1) |
---|
1808 | [[ $(echo $Names | grep -c '*.f90') = 0 ]] && AddFilenames="$Names" |
---|
1809 | Names=$(ls -1 *.F90 2>&1) |
---|
1810 | [[ $(echo $Names | grep -c '*.F90') = 0 ]] && AddFilenames="$AddFilenames $Names" |
---|
1811 | Names=$(ls -1 *.F 2>&1) |
---|
1812 | [[ $(echo $Names | grep -c '*.F') = 0 ]] && AddFilenames="$AddFilenames $Names" |
---|
1813 | Names=$(ls -1 *.f 2>&1) |
---|
1814 | [[ $(echo $Names | grep -c '*.f') = 0 ]] && AddFilenames="$AddFilenames $Names" |
---|
1815 | Names=$(ls -1 *.c 2>&1) |
---|
1816 | [[ $(echo $Names | grep -c '*.c') = 0 ]] && AddFilenames="$AddFilenames $Names" |
---|
1817 | |
---|
1818 | cd - > /dev/null |
---|
1819 | cd SOURCES_FOR_RUN_$fname |
---|
1820 | |
---|
1821 | # COPY MAKEFILE IF EXISTING |
---|
1822 | if [[ -f $add_source_path/Makefile ]] |
---|
1823 | then |
---|
1824 | printf "\n\n *** user Makefile from directory" |
---|
1825 | printf "\n \"$add_source_path\" is used \n" |
---|
1826 | if [[ $silent == false ]] |
---|
1827 | then |
---|
1828 | sleep 1 |
---|
1829 | fi |
---|
1830 | cp $add_source_path/Makefile . |
---|
1831 | fi |
---|
1832 | |
---|
1833 | for dateiname in $AddFilenames |
---|
1834 | do |
---|
1835 | if [[ -f $dateiname ]] |
---|
1836 | then |
---|
1837 | printf "\n +++ source code file \"$dateiname\" found in additional" |
---|
1838 | printf "\n source code directory \"$add_source_path\" " |
---|
1839 | printf "\n but was also given with option \"-s\" which means that it should be taken" |
---|
1840 | printf "\n from directory \"$source_path\"." |
---|
1841 | locat=source; exit |
---|
1842 | fi |
---|
1843 | |
---|
1844 | cp $add_source_path/$dateiname . |
---|
1845 | source_list="$source_list $dateiname" |
---|
1846 | |
---|
1847 | # CHECK IF FILE IS CONTAINED IN MAKEFILE |
---|
1848 | if [[ $(grep -c $dateiname Makefile) = 0 ]] |
---|
1849 | then |
---|
1850 | printf "\n\n +++ user file \"$dateiname\" " |
---|
1851 | printf "\n is not listed in Makefile \n" |
---|
1852 | locat=source; exit |
---|
1853 | else |
---|
1854 | |
---|
1855 | # Default User-Interface von der Liste entfernen, falls Datei |
---|
1856 | # ein User-Interface enthaelt |
---|
1857 | # if [[ $( cat $dateiname | grep -c "END SUBROUTINE user_parin" ) != 0 ]] |
---|
1858 | # then |
---|
1859 | # if [[ $dateiname != user_interface.f90 && -f user_interface.f90 ]] |
---|
1860 | # then |
---|
1861 | # rm -rf user_interface.f90 |
---|
1862 | # source_list=`echo $source_list | sed -e 's/user_interface.f90//'` |
---|
1863 | # printf "\n\n *** default \"user_interface.f90\" removed from the files to be translated" |
---|
1864 | # printf "\n since a user-interface is found in file" |
---|
1865 | # printf "\n \"$add_source_path/$dateiname\" \n" |
---|
1866 | # sleep 3 |
---|
1867 | # else |
---|
1868 | if [[ $found = false ]] |
---|
1869 | then |
---|
1870 | found=true |
---|
1871 | printf "\n\n *** following user file(s) added to the" |
---|
1872 | printf " files to be translated:\n " |
---|
1873 | fi |
---|
1874 | printf "$dateiname " |
---|
1875 | if [[ $silent == false ]] |
---|
1876 | then |
---|
1877 | sleep 0.5 |
---|
1878 | fi |
---|
1879 | |
---|
1880 | fi |
---|
1881 | done |
---|
1882 | [[ $found = true ]] && printf "\n" |
---|
1883 | cd - > /dev/null |
---|
1884 | fi |
---|
1885 | fi |
---|
1886 | |
---|
1887 | |
---|
1888 | # ALLE UNTERPROGRAMME, DIE ZU VEREINBARTEN SOFTWAREPAKETEN GEHOEREN, |
---|
1889 | # DER LISTE DER ZU UEBERSETZENDEN DATEIEN HINZUFUEGEN |
---|
1890 | if [[ $restart_run != true && -n $package_list ]] |
---|
1891 | then |
---|
1892 | |
---|
1893 | cd $source_path |
---|
1894 | |
---|
1895 | for package in $package_list |
---|
1896 | do |
---|
1897 | |
---|
1898 | [[ $package = "dvrp_graphics+1PE" ]] && package=dvrp_graphics |
---|
1899 | |
---|
1900 | # ERMITTELE ALLE DATEIEN, DIE ZUM PAKET GEHOEREN |
---|
1901 | # FEHLERMELDUNGEN WERDEN ABGEFANGEN, DA * AUCH VERZEICHNISSNAMEN |
---|
1902 | # LIEFERT |
---|
1903 | package_source_list=`grep "defined( __$package " * 2>/dev/null | cut -f1 -d:` |
---|
1904 | |
---|
1905 | |
---|
1906 | # FUEGE DIESE DATEIEN DER LISTE DER ZU UEBERSETZENDEN DATEIEN |
---|
1907 | # HINZU, FALLS SIE NOCH NICHT DAZUGEHOEREN |
---|
1908 | for source_list_name in $package_source_list |
---|
1909 | do |
---|
1910 | if [[ $(echo $source_list | grep -c $source_list_name) = 0 ]] |
---|
1911 | then |
---|
1912 | |
---|
1913 | # NUR DATEIEN MIT GUELTIGEN ENDUNGEN VERWENDEN |
---|
1914 | ending=`echo $source_list_name | cut -f2 -d.` |
---|
1915 | if [[ "$ending" = f90 || "$ending" = F90 || "$ending" = f || "$ending" = F || "$ending" = c ]] |
---|
1916 | then |
---|
1917 | cp $source_list_name $working_directory/SOURCES_FOR_RUN_$fname |
---|
1918 | source_list="$source_list $source_list_name" |
---|
1919 | fi |
---|
1920 | fi |
---|
1921 | done |
---|
1922 | done |
---|
1923 | |
---|
1924 | cd - > /dev/null |
---|
1925 | fi |
---|
1926 | |
---|
1927 | |
---|
1928 | # MAKEFILE AUF VORHANDENSEIN PRUEFEN UND KOPIEREN |
---|
1929 | # BEI RESTART-LAEUFEN LIEGT ES SCHON IM VERZEICHNIS SOURCES_FOR_RUN... |
---|
1930 | # if [[ "$restart_run" != true ]] |
---|
1931 | # then |
---|
1932 | # [[ "$makefile" = "" ]] && makefile=$source_path/Makefile |
---|
1933 | # if [[ ! -f $makefile ]] |
---|
1934 | # then |
---|
1935 | # printf "\n +++ file \"$makefile\" does not exist" |
---|
1936 | # locat=make; exit |
---|
1937 | # else |
---|
1938 | # cp $makefile SOURCES_FOR_RUN_$fname/Makefile |
---|
1939 | # fi |
---|
1940 | # fi |
---|
1941 | |
---|
1942 | fi # do_compile=true |
---|
1943 | |
---|
1944 | |
---|
1945 | # FALLS PROGRAMMTEILE UEBERSETZT WERDEN SOLLEN, FOLGEN JETZT EINIGE |
---|
1946 | # UEBERPRUEFUNGEN UND DAS SETZEN DER PRAEPROZESSOR-DIREKTIVEN |
---|
1947 | if [[ $do_compile = true ]] |
---|
1948 | then |
---|
1949 | |
---|
1950 | # PRAEPROZESSOR-DIREKTIVEN ZUM SELEKTIVEN AUSWAEHLEN VON CODETEILEN |
---|
1951 | # ZUSAMMENSETZEN |
---|
1952 | # DIREKTIVEN ZUM AKTIVIEREN VON RECHNERSPEZIFISCHEM CODE |
---|
1953 | if [[ $(echo $localhost | cut -c1-3) = ibm ]] |
---|
1954 | then |
---|
1955 | cpp_options="${cpp_options},-D__ibm=__ibm" |
---|
1956 | elif [[ $(echo $localhost | cut -c1-3) = nec ]] |
---|
1957 | then |
---|
1958 | cpp_options="$cpp_options -D__nec" |
---|
1959 | elif [[ $(echo $localhost | cut -c1-2) = lc ]] |
---|
1960 | then |
---|
1961 | cpp_options="$cpp_options -D__lc" |
---|
1962 | else |
---|
1963 | cpp_options="$cpp_options -D__$localhost" |
---|
1964 | fi |
---|
1965 | |
---|
1966 | # DIREKTIVEN DIE DURCH OPTION -K BESTIMMT WERDEN (Z.B. PARALLEL) |
---|
1967 | if [[ $(echo $localhost | cut -c1-3) = ibm ]] |
---|
1968 | then |
---|
1969 | [[ -n $cond1 ]] && cpp_options="${cpp_options},-D__$cond1=__$cond1" |
---|
1970 | [[ -n $cond2 ]] && cpp_options="${cpp_options},-D__$cond2=__$cond2" |
---|
1971 | else |
---|
1972 | [[ -n $cond1 ]] && cpp_options="$cpp_options -D__$cond1" |
---|
1973 | [[ -n $cond2 ]] && cpp_options="$cpp_options -D__$cond2" |
---|
1974 | fi |
---|
1975 | |
---|
1976 | # DIREKTIVEN DIE SOFTWAREPAKETE AKTIVIEREN (OPTION -p) |
---|
1977 | if [[ -n $package_list ]] |
---|
1978 | then |
---|
1979 | for package in $package_list |
---|
1980 | do |
---|
1981 | if [[ $(echo $localhost | cut -c1-3) = ibm ]] |
---|
1982 | then |
---|
1983 | if [[ $package != "dvrp_graphics+1PE" ]] |
---|
1984 | then |
---|
1985 | cpp_options="${cpp_options},-D__$package=__$package" |
---|
1986 | else |
---|
1987 | cpp_options="${cpp_options},-D__dvrp_graphics=__dvrp_graphics" |
---|
1988 | export use_seperate_pe_for_dvrp_output=true |
---|
1989 | fi |
---|
1990 | else |
---|
1991 | if [[ $package != "dvrp_graphics+1PE" ]] |
---|
1992 | then |
---|
1993 | cpp_options="$cpp_options -D__$package" |
---|
1994 | else |
---|
1995 | cpp_options="$cpp_options -D__dvrp_graphics" |
---|
1996 | export use_seperate_pe_for_dvrp_output=true |
---|
1997 | fi |
---|
1998 | fi |
---|
1999 | done |
---|
2000 | fi |
---|
2001 | |
---|
2002 | # DIREKTIVEN DIE DURCH OPTION -D FESTGELEGT SIND |
---|
2003 | if [[ -n $cpp_opts ]] |
---|
2004 | then |
---|
2005 | for popts in $cpp_opts |
---|
2006 | do |
---|
2007 | if [[ $(echo $localhost | cut -c1-3) = ibm ]] |
---|
2008 | then |
---|
2009 | cpp_options="${cpp_options},-D__$popts=__$popts" |
---|
2010 | else |
---|
2011 | cpp_options="$cpp_options -D__$popts" |
---|
2012 | fi |
---|
2013 | done |
---|
2014 | fi |
---|
2015 | |
---|
2016 | else |
---|
2017 | |
---|
2018 | |
---|
2019 | # BEI LOKALEN RECHNUNGEN PRUEFEN, OB EXECUTABLE VORHANDEN |
---|
2020 | if [[ $do_remote = false ]] |
---|
2021 | then |
---|
2022 | if [[ ! -f $executable ]] |
---|
2023 | then |
---|
2024 | printf "\n +++ executable file: $executable" |
---|
2025 | printf "\n does not exist" |
---|
2026 | locat=executable; exit |
---|
2027 | fi |
---|
2028 | fi |
---|
2029 | fi |
---|
2030 | |
---|
2031 | |
---|
2032 | # JOBMODUS FESTSTELLEN |
---|
2033 | if [[ "$ENVIRONMENT" = BATCH ]] |
---|
2034 | then |
---|
2035 | jobmo=BATCH |
---|
2036 | else |
---|
2037 | jobmo=INTERACTIVE |
---|
2038 | fi |
---|
2039 | |
---|
2040 | |
---|
2041 | # no interactive runs on lctit |
---|
2042 | if [[ $host = lctit && $jobmo = INTERACTIVE && $do_batch = false ]] |
---|
2043 | then |
---|
2044 | printf "\n +++ no interactive runs allowed on host \"$host\" " |
---|
2045 | printf "\n please submit batch job using mrun option \"-b\" \n" |
---|
2046 | locat=normal; exit |
---|
2047 | fi |
---|
2048 | |
---|
2049 | |
---|
2050 | # HOSTSPEZIFISCHE DEFAULT-COMPILER SETZEN, FALLS NICHT BEREITS |
---|
2051 | # DURCH BENUTZER ANDERWEITIG VEREINBART |
---|
2052 | if [[ "$compiler_name" = "" ]] |
---|
2053 | then |
---|
2054 | |
---|
2055 | printf "\n +++ no compiler specified for \"$host $cond1 $cond2\"" |
---|
2056 | locat=compiler_name; exit |
---|
2057 | |
---|
2058 | fi |
---|
2059 | |
---|
2060 | |
---|
2061 | # COMPILER AUF RIAMS NEC UEBERSCHREIBEN |
---|
2062 | [[ $localhost = necriam ]] && compiler_name=mpif90 |
---|
2063 | |
---|
2064 | |
---|
2065 | |
---|
2066 | # TEMPORAEREN KATALOGNAMEN BESTIMMEN |
---|
2067 | kennung=$RANDOM |
---|
2068 | if [[ "$tmp_user_catalog" = "" ]] |
---|
2069 | then |
---|
2070 | if [[ $localhost = ibmh ]] |
---|
2071 | then |
---|
2072 | tmp_user_catalog=$SCRATCH |
---|
2073 | elif [[ $localhost = nech ]] |
---|
2074 | then |
---|
2075 | tmp_user_catalog=$WRKSHR |
---|
2076 | else |
---|
2077 | tmp_user_catalog=/tmp |
---|
2078 | fi |
---|
2079 | fi |
---|
2080 | TEMPDIR=$tmp_user_catalog/${usern}.$kennung |
---|
2081 | |
---|
2082 | |
---|
2083 | # KATALOGNAMEN FUER ZWISCHENSPEICHERUNG VON FORTSETZUNGSLAUFDATEIEN |
---|
2084 | # BESTIMMEN |
---|
2085 | if [[ "$tmp_data_catalog" = "" ]] |
---|
2086 | then |
---|
2087 | if [[ $localhost = nech ]] |
---|
2088 | then |
---|
2089 | tmp_data_catalog=$WRKSHR/mrun_restart_data |
---|
2090 | else |
---|
2091 | tmp_data_catalog=/tmp/mrun_restart_data |
---|
2092 | fi |
---|
2093 | fi |
---|
2094 | |
---|
2095 | |
---|
2096 | # EVENTUELL BEI LOKALEN RECHNUNGEN $-ZEICHEN IN ENVIRONMENT-VARIABLEN |
---|
2097 | # ERSETZEN |
---|
2098 | if [[ $do_remote = false && $do_compile = true ]] |
---|
2099 | then |
---|
2100 | eval fopts=\"$fopts\" |
---|
2101 | eval lopts=\"$lopts\" |
---|
2102 | fi |
---|
2103 | |
---|
2104 | |
---|
2105 | |
---|
2106 | # COMPILE- UND LINK-OPTIONEN BESTIMMEN |
---|
2107 | fopts="$fopts $netcdf_inc $dvr_inc" |
---|
2108 | lopts="$lopts $netcdf_lib $dvr_lib" |
---|
2109 | ROPTS="$ropts" |
---|
2110 | if [[ ( $(echo $host | cut -c1-3) = nec || $(echo $host | cut -c1-3) = ibm || $host = lckyoto || $host = lcsgih || $host = lcsgib || $host = lctit || $host = lcfimm || $host = lcxe6 || $host = lcxt5m || $host = lck || $host = lckiaps || $host = lckordi || $host = lcsb ) && -n $numprocs ]] |
---|
2111 | then |
---|
2112 | XOPT="-X $numprocs" |
---|
2113 | fi |
---|
2114 | |
---|
2115 | |
---|
2116 | |
---|
2117 | # PRUEFEN DER CPU-ZEIT. (CPUMAX WIRD ALS ENV-VARIABLE VOM HAUTPRO- |
---|
2118 | # GRAMM BENOETIGT |
---|
2119 | done=false |
---|
2120 | while [[ $done = false ]] |
---|
2121 | do |
---|
2122 | cputime=$cpumax |
---|
2123 | if (( $cputime == 0 )) |
---|
2124 | then |
---|
2125 | if [[ $do_batch = true ]] |
---|
2126 | then |
---|
2127 | printf "\n +++ cpu-time is undefined" |
---|
2128 | printf "\n >>> Please type CPU-time in seconds as INTEGER:" |
---|
2129 | printf "\n >>> " |
---|
2130 | read cputime 1>/dev/null 2>&1 |
---|
2131 | else |
---|
2132 | cputime=10000000 # NO CPU LIMIT FOR INTERACTIVE RUNS |
---|
2133 | fi |
---|
2134 | else |
---|
2135 | done=true |
---|
2136 | fi |
---|
2137 | cpumax=$cputime |
---|
2138 | done |
---|
2139 | |
---|
2140 | (( minuten = cputime / 60 )) |
---|
2141 | (( sekunden = cputime - minuten * 60 )) |
---|
2142 | |
---|
2143 | |
---|
2144 | # PRUEFEN DER KERNSPEICHERANFORDERUNG |
---|
2145 | if [[ $do_batch = true ]] |
---|
2146 | then |
---|
2147 | done=false |
---|
2148 | while [[ $done = false ]] |
---|
2149 | do |
---|
2150 | if (( memory == 0 )) |
---|
2151 | then |
---|
2152 | printf "\n +++ memory demand is undefined" |
---|
2153 | printf "\n >>> Please type memory in MByte per process as INTEGER:" |
---|
2154 | printf "\n >>> " |
---|
2155 | read memory 1>/dev/null 2>&1 |
---|
2156 | else |
---|
2157 | done=true |
---|
2158 | fi |
---|
2159 | done |
---|
2160 | fi |
---|
2161 | |
---|
2162 | |
---|
2163 | # PRUEFEN, OB FUER REMOTE-RECHNUNGEN EIN BENUTZERNAME ANGEGEBEN WURDE |
---|
2164 | if [[ $do_remote = true && -z $remote_username ]] |
---|
2165 | then |
---|
2166 | while [[ -z $remote_username ]] |
---|
2167 | do |
---|
2168 | printf "\n +++ username on remote host \"$host\" is undefined" |
---|
2169 | printf "\n >>> Please type username:" |
---|
2170 | printf "\n >>> " |
---|
2171 | read remote_username |
---|
2172 | done |
---|
2173 | mc="$mc -u$remote_username" |
---|
2174 | fi |
---|
2175 | |
---|
2176 | # CHECK FOR INITIAL COMMANDS AFTER LOGIN |
---|
2177 | if [[ "$login_init_cmd" != "" ]] |
---|
2178 | then |
---|
2179 | export init_cmds="${login_init_cmd};" |
---|
2180 | fi |
---|
2181 | |
---|
2182 | |
---|
2183 | # set module load command and export for subjob |
---|
2184 | if [[ "$modules" != "" ]] |
---|
2185 | then |
---|
2186 | if [[ $host = lctit ]] |
---|
2187 | then |
---|
2188 | export module_calls=". $modules" |
---|
2189 | else |
---|
2190 | export module_calls="module load ${modules};" |
---|
2191 | fi |
---|
2192 | fi |
---|
2193 | |
---|
2194 | # bugfix for wrong netcdf module and for netCDF4 usage in case of mpt |
---|
2195 | if [[ $host = lcsgib || $host = lcsgih ]] |
---|
2196 | then |
---|
2197 | if [[ $(echo $module_calls | grep -c netcdf/3.6.3-intel) != 0 ]] |
---|
2198 | then |
---|
2199 | export module_calls="$module_calls export LD_LIBRARY_PATH=/sw/dataformats/netcdf/3.6.3-intel/lib:\$LD_LIBRARY_PATH;" |
---|
2200 | fi |
---|
2201 | # if [[ $(echo $module_calls | grep -c mpt) != 0 ]] |
---|
2202 | # then |
---|
2203 | # export module_calls="$module_calls export LD_LIBRARY_PATH=/sw/sgi/mpt/2011-02-07/lib:\$LD_LIBRARY_PATH;" |
---|
2204 | # echo "*** module_calls = $module_calls" |
---|
2205 | # fi |
---|
2206 | fi |
---|
2207 | |
---|
2208 | |
---|
2209 | # SET DEFAULT VALUE FOR MPI MODULE TO BE USED ON SGI-ALTIX |
---|
2210 | if [[ $host = lcsgib || $host = lcsgih ]] |
---|
2211 | then |
---|
2212 | if [[ $(echo $modules | grep -c mpt ) != 0 ]] |
---|
2213 | then |
---|
2214 | mpilib=mpt |
---|
2215 | elif [[ $(echo $modules | grep -c mvapich ) != 0 ]] |
---|
2216 | then |
---|
2217 | mpilib=mvapich |
---|
2218 | elif [[ $(echo $modules | grep -c impi ) != 0 ]] |
---|
2219 | then |
---|
2220 | mpilib=impi |
---|
2221 | fi |
---|
2222 | fi |
---|
2223 | |
---|
2224 | |
---|
2225 | |
---|
2226 | ########################################################################### |
---|
2227 | # HEADER-AUSGABE |
---|
2228 | ########################################################################### |
---|
2229 | |
---|
2230 | |
---|
2231 | calltime=$(date) |
---|
2232 | printf "\n" |
---|
2233 | # [[ $silent = false ]] && clear |
---|
2234 | printf "#--------------------------------------------------------------# \n" |
---|
2235 | printf "| $version$calltime | \n" |
---|
2236 | printf "| | \n" |
---|
2237 | spalte1="called on:"; spalte2=$localhost_realname |
---|
2238 | printf "| $spalte1$spalte2 | \n" |
---|
2239 | if [[ $local_compile = false ]] |
---|
2240 | then |
---|
2241 | if [[ $do_remote = true ]] |
---|
2242 | then |
---|
2243 | spalte1="execution on:"; spalte2="$host (username: $remote_username)" |
---|
2244 | else |
---|
2245 | spalte1="execution on:"; spalte2="$host ($localhost_realname)" |
---|
2246 | fi |
---|
2247 | else |
---|
2248 | spalte1="compiling test only!"; spalte2="" |
---|
2249 | fi |
---|
2250 | printf "| $spalte1$spalte2 | \n" |
---|
2251 | if [[ -n $numprocs ]] |
---|
2252 | then |
---|
2253 | spalte1="number of PEs:"; spalte2=$numprocs |
---|
2254 | printf "| $spalte1$spalte2 | \n" |
---|
2255 | fi |
---|
2256 | if [[ -n $tasks_per_node ]] |
---|
2257 | then |
---|
2258 | spalte1="tasks per node:"; spalte2="$tasks_per_node (number of nodes: $nodes)" |
---|
2259 | printf "| $spalte1$spalte2 | \n" |
---|
2260 | fi |
---|
2261 | if [[ $maximum_parallel_io_streams != $numprocs ]] |
---|
2262 | then |
---|
2263 | spalte1="max par io streams:"; spalte2="$maximum_parallel_io_streams" |
---|
2264 | printf "| $spalte1$spalte2 | \n" |
---|
2265 | fi |
---|
2266 | if [[ $use_openmp = true ]] |
---|
2267 | then |
---|
2268 | spalte1="threads per task:"; spalte2="$threads_per_task" |
---|
2269 | printf "| $spalte1$spalte2 | \n" |
---|
2270 | fi |
---|
2271 | printf "| | \n" |
---|
2272 | if [[ $do_compile = true ]] |
---|
2273 | then |
---|
2274 | if [[ "$mopts" != "" ]] |
---|
2275 | then |
---|
2276 | spalte1="make options:"; spalte2=$mopts |
---|
2277 | printf "| $spalte1$spalte2 | \n" |
---|
2278 | zeile=$(echo "$mopts" | cut -c41-) |
---|
2279 | while [[ "$zeile" != "" ]] |
---|
2280 | do |
---|
2281 | spalte1="" |
---|
2282 | spalte2=$zeile |
---|
2283 | printf "| $spalte1$spalte2 | \n" |
---|
2284 | zeile=$(echo "$zeile" | cut -c41-) |
---|
2285 | done |
---|
2286 | fi |
---|
2287 | |
---|
2288 | spalte1="cpp directives:"; spalte2=$cpp_options |
---|
2289 | printf "| $spalte1$spalte2 | \n" |
---|
2290 | zeile=$(echo "$cpp_options" | cut -c41-) |
---|
2291 | while [[ "$zeile" != "" ]] |
---|
2292 | do |
---|
2293 | spalte1="" |
---|
2294 | spalte2=$zeile |
---|
2295 | printf "| $spalte1$spalte2 | \n" |
---|
2296 | zeile=$(echo "$zeile" | cut -c41-) |
---|
2297 | done |
---|
2298 | |
---|
2299 | spalte1="compiler options:"; spalte2="$fopts" |
---|
2300 | printf "| $spalte1$spalte2 | \n" |
---|
2301 | zeile=$(echo "$fopts" | cut -c41-) |
---|
2302 | while [[ "$zeile" != "" ]] |
---|
2303 | do |
---|
2304 | spalte1="" |
---|
2305 | spalte2=$zeile |
---|
2306 | printf "| $spalte1$spalte2 | \n" |
---|
2307 | zeile=$(echo "$zeile" | cut -c41-) |
---|
2308 | done |
---|
2309 | |
---|
2310 | spalte1="linker options:"; spalte2=$lopts |
---|
2311 | printf "| $spalte1$spalte2 | \n" |
---|
2312 | zeile=$(echo "$lopts" | cut -c41-) |
---|
2313 | while [[ "$zeile" != "" ]] |
---|
2314 | do |
---|
2315 | spalte1="" |
---|
2316 | spalte2=$zeile |
---|
2317 | printf "| $spalte1$spalte2 | \n" |
---|
2318 | zeile=$(echo "$zeile" | cut -c41-) |
---|
2319 | done |
---|
2320 | |
---|
2321 | spalte1="modules to be load:"; spalte2=$modules |
---|
2322 | printf "| $spalte1$spalte2 | \n" |
---|
2323 | zeile=$(echo "$modules" | cut -c41-) |
---|
2324 | while [[ "$zeile" != "" ]] |
---|
2325 | do |
---|
2326 | spalte1="" |
---|
2327 | spalte2=$zeile |
---|
2328 | printf "| $spalte1$spalte2 | \n" |
---|
2329 | zeile=$(echo "$zeile" | cut -c41-) |
---|
2330 | done |
---|
2331 | |
---|
2332 | spalte1="main program":; spalte2=$mainprog |
---|
2333 | printf "| $spalte1$spalte2 | \n" |
---|
2334 | else |
---|
2335 | spalte1=executable:; spalte2=$executable |
---|
2336 | printf "| $spalte1$spalte2 | \n" |
---|
2337 | fi |
---|
2338 | printf "| | \n" |
---|
2339 | spalte1="base name of files":; spalte2=$fname |
---|
2340 | printf "| $spalte1$spalte2 | \n" |
---|
2341 | if [[ $fname != $afname ]] |
---|
2342 | then |
---|
2343 | spalte1="base name of input files":; spalte2=$afname |
---|
2344 | printf "| $spalte1$spalte2 | \n" |
---|
2345 | fi |
---|
2346 | spalte1="INPUT control list":; spalte2=$input_list |
---|
2347 | printf "| $spalte1$spalte2 | \n" |
---|
2348 | spalte1="OUTPUT control list":; spalte2=$output_list |
---|
2349 | printf "| $spalte1$spalte2 | \n" |
---|
2350 | |
---|
2351 | if [[ $do_batch = true || "$LOADLBATCH" = yes ]] |
---|
2352 | then |
---|
2353 | spalte1="memory demand / PE":; spalte2="$memory MB" |
---|
2354 | printf "| $spalte1$spalte2 | \n" |
---|
2355 | spalte1=CPU-time:; spalte2="$minuten:$sekunden" |
---|
2356 | printf "| $spalte1$spalte2 | \n" |
---|
2357 | fi |
---|
2358 | |
---|
2359 | if [[ $do_compile = true ]] |
---|
2360 | then |
---|
2361 | printf "| | \n" |
---|
2362 | printf "| Files to be compiled: | \n" |
---|
2363 | zeile=$source_list |
---|
2364 | while [[ "$zeile" != "" ]] |
---|
2365 | do |
---|
2366 | spalte3=$zeile |
---|
2367 | printf "| $spalte3 | \n" |
---|
2368 | zeile=$(echo "$zeile" | cut -c61-) |
---|
2369 | done |
---|
2370 | fi |
---|
2371 | printf "#--------------------------------------------------------------#" |
---|
2372 | |
---|
2373 | |
---|
2374 | |
---|
2375 | # BEDINGTE AUSGABE DER DATEIVERBINDUNGEN |
---|
2376 | if [[ $do_trace = true ]] |
---|
2377 | then |
---|
2378 | (( i = 0 )) |
---|
2379 | while (( i < iin )) |
---|
2380 | do |
---|
2381 | (( i = i + 1 )) |
---|
2382 | if (( i == 1 )) |
---|
2383 | then |
---|
2384 | printf "\n\n >>> INPUT-file assignments:\n" |
---|
2385 | fi |
---|
2386 | printf "\n ${localin[$i]} : ${absnamein[$i]}" |
---|
2387 | done |
---|
2388 | (( i = 0 )) |
---|
2389 | while (( i < iout )) |
---|
2390 | do |
---|
2391 | (( i = i + 1 )) |
---|
2392 | if (( i == 1 )) |
---|
2393 | then |
---|
2394 | printf "\n\n >>> OUTPUT-file assignments:\n" |
---|
2395 | fi |
---|
2396 | printf "\n ${localout[$i]} : ${pathout[$i]}" |
---|
2397 | done |
---|
2398 | (( i = 0 )) |
---|
2399 | while (( i < iic )) |
---|
2400 | do |
---|
2401 | (( i = i + 1 )) |
---|
2402 | if (( i == 1 )) |
---|
2403 | then |
---|
2404 | printf "\n\n >>> INPUT-commands:\n" |
---|
2405 | fi |
---|
2406 | printf "\n ${in_command[$i]}" |
---|
2407 | done |
---|
2408 | (( i = 0 )) |
---|
2409 | while (( i < ioc )) |
---|
2410 | do |
---|
2411 | (( i = i + 1 )) |
---|
2412 | if (( i == 1 )) |
---|
2413 | then |
---|
2414 | printf "\n\n >>> OUTPUT-commands:\n" |
---|
2415 | fi |
---|
2416 | printf "\n ${out_command[$i]}" |
---|
2417 | done |
---|
2418 | fi |
---|
2419 | |
---|
2420 | |
---|
2421 | # ABFRAGEN BEI AUFRUF AUF LOKALER MASCHINE |
---|
2422 | if [[ $remotecall = false && $silent = false && $jobmo != BATCH ]] |
---|
2423 | then |
---|
2424 | antwort=dummy |
---|
2425 | printf "\n\n" |
---|
2426 | while [[ "$antwort" != y && "$antwort" != Y && "$antwort" != n && "$antwort" != N ]] |
---|
2427 | do |
---|
2428 | printf " >>> everything o.k. (y/n) ? " |
---|
2429 | read antwort |
---|
2430 | done |
---|
2431 | if [[ $antwort = n || $antwort = N ]] |
---|
2432 | then |
---|
2433 | locat=user_abort; (( iec = 0 )); exit |
---|
2434 | fi |
---|
2435 | if [[ $do_batch = true ]] |
---|
2436 | then |
---|
2437 | printf " >>> batch-job will be created and submitted" |
---|
2438 | else |
---|
2439 | if [[ $local_compile = false ]] |
---|
2440 | then |
---|
2441 | printf " >>> MRUN will now continue to execute on this machine" |
---|
2442 | else |
---|
2443 | printf " >>> a test compilation will now be carried out on this machine" |
---|
2444 | fi |
---|
2445 | fi |
---|
2446 | fi |
---|
2447 | |
---|
2448 | #### PERFORM PARAMETER FILE CHECK (COUPLED RUNS ARE NOT SUPPORTED YET) |
---|
2449 | |
---|
2450 | #DEFINE VARIABLES FOR FREQUENTLY USED DIRECTORIES |
---|
2451 | check_depository="${working_directory}/trunk/UTIL" |
---|
2452 | check_sources="${working_directory}/tmp_check_namelist_files" |
---|
2453 | skip_check=false |
---|
2454 | |
---|
2455 | #CHECK IF NAMELIST_FILE_CHECK HAS BEEN COMPILED SUCCESSFULLY |
---|
2456 | if [[ ! -f $check_depository/check_namelist_files.tar ]] |
---|
2457 | then |
---|
2458 | skip_check=true |
---|
2459 | reason="run on remote host or parameter file check has not been compiled." |
---|
2460 | fi |
---|
2461 | if [[ ! -f $PALM_BIN/check_namelist_files.x ]] |
---|
2462 | then |
---|
2463 | skip_check=true |
---|
2464 | reason="parameter file check has not been compiled." |
---|
2465 | fi |
---|
2466 | |
---|
2467 | #CHECK FOR PARALLEL RUN; OTHERWISE SKIP CHECK |
---|
2468 | if [[ "$cond1" != "parallel" && "$cond2" != "parallel" ]] |
---|
2469 | then |
---|
2470 | skip_check=true |
---|
2471 | reason="serial run." |
---|
2472 | fi |
---|
2473 | |
---|
2474 | #ONLY PERFORM CHECK IF -z OPTION IS NOT SET, NO RESTART RUN IS CARRIED OUT AND IF THE EXECUTION HOST IS THE LOCAL HOST |
---|
2475 | if [[ $check_namelist_files == false ]] |
---|
2476 | then |
---|
2477 | skip_check=true |
---|
2478 | reason="-z option set." |
---|
2479 | fi |
---|
2480 | |
---|
2481 | if [[ $fromhost != $localhost ]] |
---|
2482 | then |
---|
2483 | skip_check=true |
---|
2484 | reason="submitting host is local host." |
---|
2485 | fi |
---|
2486 | |
---|
2487 | if [[ $run_coupled_model == true ]] |
---|
2488 | then |
---|
2489 | skip_check=true |
---|
2490 | reason="coupled run." |
---|
2491 | fi |
---|
2492 | |
---|
2493 | if [[ $restart_run == true ]] |
---|
2494 | then |
---|
2495 | skip_check=true |
---|
2496 | reason="restart run." |
---|
2497 | |
---|
2498 | fi |
---|
2499 | |
---|
2500 | #SKIP CHECK IN CASE OF RESTART RUN: CHECK WHETHER THE LAST CHAR IS "f" IN PARIN |
---|
2501 | ((last_char = `echo $filename_input | wc -c` - 1)) |
---|
2502 | last_char=`echo $filename_input |cut -c$last_char` |
---|
2503 | if [[ "$last_char" == "f" ]] |
---|
2504 | then |
---|
2505 | skip_check=true |
---|
2506 | reason="restart run.)" |
---|
2507 | fi |
---|
2508 | |
---|
2509 | if [[ $skip_check == false ]] |
---|
2510 | then |
---|
2511 | |
---|
2512 | tmp_check=${working_directory}/tmp_check |
---|
2513 | |
---|
2514 | # GET TOPOGRAPHY PARAMETER FILE SUFFIX (USUALLY "_P3DF"). THIS FILE MIGHT IS |
---|
2515 | # NOT NECESSARILY REQUIRED |
---|
2516 | line="" |
---|
2517 | found=false |
---|
2518 | grep "TOPOGRAPHY_DATA" $config_file > $tmp_check |
---|
2519 | while read line1 |
---|
2520 | do |
---|
2521 | line="$line1" |
---|
2522 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
2523 | then |
---|
2524 | topo_suffix=`echo $line | tr -s " " | cut -d" " -s -f5` |
---|
2525 | found=true |
---|
2526 | fi |
---|
2527 | done < $tmp_check |
---|
2528 | |
---|
2529 | if [[ $found = false ]] |
---|
2530 | then |
---|
2531 | printf "\n +++ no TOPOGRAPHY list entry found in the configuration file." |
---|
2532 | fi |
---|
2533 | |
---|
2534 | rm -rf ${working_directory}/tmp_check |
---|
2535 | |
---|
2536 | # CHECK IF THE A P3DF FILE MUST BE CHECKED |
---|
2537 | for item in $input_list |
---|
2538 | do |
---|
2539 | if [[ "$item" == "restart" ]] |
---|
2540 | then |
---|
2541 | check_restart=1 |
---|
2542 | else |
---|
2543 | check_restart=0 |
---|
2544 | fi |
---|
2545 | done |
---|
2546 | |
---|
2547 | # ERROR IF NO PARAMETER FILE WAS FOUND, OTHERWISE PROCEED |
---|
2548 | if [[ (! -f $filename_input) && ( "$filename_input" != "") ]] |
---|
2549 | then |
---|
2550 | printf "\n\n +++ ERROR: parameter file ($filename_input) not found." |
---|
2551 | locat=check_namelist; exit |
---|
2552 | fi |
---|
2553 | |
---|
2554 | # CHECK IF THE RESTART PARAMETER FILE EXISTS (IF NECESSARY) |
---|
2555 | if [[ $check_restart == 1 ]] |
---|
2556 | then |
---|
2557 | |
---|
2558 | |
---|
2559 | |
---|
2560 | filenamef="${filename_input}f" |
---|
2561 | if [[ ! -f $filenamef ]] |
---|
2562 | then |
---|
2563 | printf "\n\n +++ WARNING: restart parameter file ($filenamef) is missing." |
---|
2564 | check_restart=0 |
---|
2565 | answer=dummy |
---|
2566 | printf "\n\n" |
---|
2567 | |
---|
2568 | if [[ $silent == false ]] |
---|
2569 | then |
---|
2570 | while [[ "$answer" != c && "$answer" != C && "$answer" != a && "$answer" != A ]] |
---|
2571 | do |
---|
2572 | printf " >>> continue anyway (c(ontinue)/a(bort)) ? " |
---|
2573 | read answer |
---|
2574 | done |
---|
2575 | if [[ $answer = a || $answer = A ]] |
---|
2576 | then |
---|
2577 | printf "\n +++ Aborting...." |
---|
2578 | locat=normal; exit |
---|
2579 | fi |
---|
2580 | fi |
---|
2581 | else |
---|
2582 | check_restart=1 |
---|
2583 | fi |
---|
2584 | fi |
---|
2585 | |
---|
2586 | # CREATE TEMPORARY SOURCES_FOR_CHECK PATH |
---|
2587 | mkdir $check_sources |
---|
2588 | cd $check_sources |
---|
2589 | |
---|
2590 | |
---|
2591 | # CHECK FOR USER CODE, OTHERWISE USE THE PRECOMPILED CHECK_NAMELIST_FILES.X |
---|
2592 | if [[ -d $add_source_path ]] |
---|
2593 | then |
---|
2594 | printf "\n\n *** copying files from $check_depository" |
---|
2595 | cp $check_depository/check_namelist_files.tar ./ |
---|
2596 | |
---|
2597 | printf "\n\n *** untar of makefile and source files in $check_sources" |
---|
2598 | tar -xf check_namelist_files.tar > /dev/null 2>&1 |
---|
2599 | |
---|
2600 | printf "\n\n *** adding user code." |
---|
2601 | cp $add_source_path/* ./ |
---|
2602 | touch check_namelist_files.f90 |
---|
2603 | |
---|
2604 | # GET COMPILER OPTIONS AND PERFORM MAKE |
---|
2605 | printf "\n\n *** compiling code if necessary...\n" |
---|
2606 | |
---|
2607 | # workaround for batch jobs on local machine (lcxe6) |
---|
2608 | if [[ $do_batch == true && $do_remote == false ]] |
---|
2609 | then |
---|
2610 | eval $init_cmds |
---|
2611 | fi |
---|
2612 | |
---|
2613 | copts_check="-cpp -D__parallel -D__check" |
---|
2614 | make -f Makefile_check F90=$compiler_name_ser COPT="$copts_check" |
---|
2615 | |
---|
2616 | # GET MAKE OUTPUT |
---|
2617 | if [[ $? != 0 ]] |
---|
2618 | then |
---|
2619 | printf "\n +++ error during make." |
---|
2620 | answer=dummy |
---|
2621 | printf "\n\n" |
---|
2622 | if [[ $silent == false ]] |
---|
2623 | then |
---|
2624 | while [[ "$answer" != c && "$answer" != C && "$answer" != a && "$answer" != A ]] |
---|
2625 | do |
---|
2626 | printf " >>> continue anyway (c(ontinue)/a(bort)) ? " |
---|
2627 | read answer |
---|
2628 | done |
---|
2629 | if [[ $answer = a || $answer = A ]] |
---|
2630 | then |
---|
2631 | printf "\n +++ Aborting..." |
---|
2632 | rm -rf $check_sources |
---|
2633 | locat=normal; exit |
---|
2634 | else |
---|
2635 | skip_check=true |
---|
2636 | fi |
---|
2637 | else |
---|
2638 | skip_check=true |
---|
2639 | fi |
---|
2640 | fi |
---|
2641 | else |
---|
2642 | cp $PALM_BIN/check_namelist_files.x ./ |
---|
2643 | fi |
---|
2644 | |
---|
2645 | cp $filename_input ./PARIN |
---|
2646 | if [[ $check_restart == 1 ]] |
---|
2647 | then |
---|
2648 | cp $filenamef ./PARINF |
---|
2649 | fi |
---|
2650 | |
---|
2651 | if [[ -f ${pathname}/${fname}${topo_suffix} && $skip_check == false ]] |
---|
2652 | then |
---|
2653 | printf "\n *** adding topography data" |
---|
2654 | cp ${pathname}/${fname}${topo_suffix} ./TOPOGRAPHY_DATA |
---|
2655 | |
---|
2656 | # IN CASE OF TOPOGRAPHY AND HIGH GRID POINT NUMBERS, THE STACK SIZE |
---|
2657 | # MUST BE INCREASED. THIS IS DUE TO THE ARRAY nzb_local AND topo_height, |
---|
2658 | # WHICH REQUIRE SUFFICIENT MEMORY |
---|
2659 | ulimit -s unlimited |
---|
2660 | fi |
---|
2661 | |
---|
2662 | # CREATE ENVPAR FILE, WHICH IS NEEDED BY CHECK_NAMELIST_FILES.X |
---|
2663 | cat > ENVPAR << %%END%% |
---|
2664 | &envpar run_identifier = '$fname', host = '$host', |
---|
2665 | write_binary = '$write_binary', tasks_per_node = $tasks_per_node, |
---|
2666 | maximum_parallel_io_streams = $maximum_parallel_io_streams, |
---|
2667 | maximum_cpu_time_allowed = ${cpumax}., |
---|
2668 | revision = '$global_revision', |
---|
2669 | local_dvrserver_running = $local_dvrserver_running / |
---|
2670 | |
---|
2671 | %%END%% |
---|
2672 | |
---|
2673 | # SAFETY CHECK: ONLY PROCEED IF THE PARAMETER CHECK PROGRAM WAS PROPERLY COMPILED |
---|
2674 | if [[ ! -f check_namelist_files.x && $skip_check == false ]] then |
---|
2675 | printf "\n +++ WARNING: check_namelist_files.x not found." |
---|
2676 | answer=dummy |
---|
2677 | printf "\n\n" |
---|
2678 | |
---|
2679 | if [[ $silent == false ]] |
---|
2680 | then |
---|
2681 | while [[ "$answer" != c && "$answer" != C && "$answer" != a && "$answer" != A ]] |
---|
2682 | do |
---|
2683 | printf " >>> continue anyway (c(ontinue)/a(bort)) ? " |
---|
2684 | read answer |
---|
2685 | done |
---|
2686 | if [[ $answer = a || $answer = A ]] |
---|
2687 | then |
---|
2688 | printf "\n +++ Aborting..." |
---|
2689 | rm -rf $check_sources |
---|
2690 | locat=normal; exit |
---|
2691 | else |
---|
2692 | printf "\n *** Skipping parameter file check." |
---|
2693 | |
---|
2694 | fi |
---|
2695 | fi |
---|
2696 | |
---|
2697 | elif [[ $skip_check == false ]] |
---|
2698 | then |
---|
2699 | # STARTING THE PARAMETER FILE CHECK |
---|
2700 | printf "\n\n *** starting parameter file check..." |
---|
2701 | |
---|
2702 | # CHECKING THE P3D FILE |
---|
2703 | printf "\n\n (1) checking $filename_input" |
---|
2704 | echo "$numprocs 0 0" > VARIN |
---|
2705 | errors=`./check_namelist_files.x < VARIN 2>&1` |
---|
2706 | |
---|
2707 | check_error=false |
---|
2708 | if [[ "$errors" == "" ]] |
---|
2709 | then |
---|
2710 | printf " --> o.k." |
---|
2711 | else |
---|
2712 | printf " --> failed." |
---|
2713 | check_error=true |
---|
2714 | printf "\n\n $errors" |
---|
2715 | fi |
---|
2716 | |
---|
2717 | # CHECKING THE PD3F FILE IF NECESSARY |
---|
2718 | if [[ $check_restart == 1 && $check_error == false ]] |
---|
2719 | then |
---|
2720 | printf "\n\n (2) checking $filenamef" |
---|
2721 | |
---|
2722 | # FIRST CHECK IF INITIALIZING_ACTIONS="READ_RESTART_DATA" IS SET IN &INIPAR LIST |
---|
2723 | found=false |
---|
2724 | cat PARINF|while read line |
---|
2725 | do |
---|
2726 | line=$(echo $line|sed 's/ //g') |
---|
2727 | if [[ $line == *"&inipar"* ]] |
---|
2728 | then |
---|
2729 | start_search=true |
---|
2730 | fi |
---|
2731 | |
---|
2732 | if [[ $start_search == true ]] |
---|
2733 | then |
---|
2734 | if [[ $line == *"initializing_actions='read_restart_data'"* ]] |
---|
2735 | then |
---|
2736 | found=true |
---|
2737 | break |
---|
2738 | fi |
---|
2739 | fi |
---|
2740 | |
---|
2741 | if [[ $line == *"/"* ]] |
---|
2742 | then |
---|
2743 | start_search=false |
---|
2744 | fi |
---|
2745 | |
---|
2746 | done |
---|
2747 | |
---|
2748 | if [[ $found = false ]] |
---|
2749 | then |
---|
2750 | printf "\n\n +++ ERROR: initializing_actions = 'read_restart_data' not found" |
---|
2751 | printf "\n in &inipar list in $fname$p3df_suffix." |
---|
2752 | rm -rf $check_sources |
---|
2753 | locat=check_namelist; exit |
---|
2754 | fi |
---|
2755 | |
---|
2756 | # READ max_user_pr FROM FILES |
---|
2757 | if [[ -f parin_for_check ]] |
---|
2758 | then |
---|
2759 | read max_pr_user < parin_for_check |
---|
2760 | else |
---|
2761 | max_user_pr=0 |
---|
2762 | fi |
---|
2763 | |
---|
2764 | echo "$numprocs 1 $max_pr_user" > VARIN |
---|
2765 | errors=`./check_namelist_files.x < VARIN 2>&1` |
---|
2766 | |
---|
2767 | if [[ "$errors" == "" ]] |
---|
2768 | then |
---|
2769 | printf " --> o.k." |
---|
2770 | else |
---|
2771 | printf " --> failed." |
---|
2772 | check_error=true |
---|
2773 | printf "\n\n $errors" |
---|
2774 | fi |
---|
2775 | fi |
---|
2776 | |
---|
2777 | # REPORT ERRORS AND CONTINUE/EXIT |
---|
2778 | if [[ $check_error == true ]] |
---|
2779 | then |
---|
2780 | printf "\n +++ errors found in the parameter file!\n" |
---|
2781 | answer=dummy |
---|
2782 | printf "\n\n" |
---|
2783 | |
---|
2784 | while [[ "$answer" != c && "$answer" != C && "$answer" != a && "$answer" != A ]] |
---|
2785 | do |
---|
2786 | printf " >>> continue anyway (c(ontinue)/a(bort)) ? " |
---|
2787 | read answer |
---|
2788 | done |
---|
2789 | |
---|
2790 | if [[ $answer = a || $answer = A ]] |
---|
2791 | then |
---|
2792 | printf "\n +++ Aborting..." |
---|
2793 | rm -rf $check_sources |
---|
2794 | locat=normal; exit |
---|
2795 | fi |
---|
2796 | else |
---|
2797 | printf "\n\n *** parameter file(s) seem(s) to be o.k.\n" |
---|
2798 | fi |
---|
2799 | rm -rf $check_sources |
---|
2800 | fi |
---|
2801 | else |
---|
2802 | printf "\n\n +++ skipping parameter file check due to following reason: $reason" |
---|
2803 | fi |
---|
2804 | |
---|
2805 | # DELETE TEMPORARY DIRECTORY AND FINISH NAMELIST FILE CHECK |
---|
2806 | rm -rf $check_sources |
---|
2807 | cd $working_directory |
---|
2808 | |
---|
2809 | |
---|
2810 | # FALLS AUF DIESER MASCHINE GERECHNET WERDEN SOLL, WERDEN JETZT ENTSPRE- |
---|
2811 | # CHENDE AKTIONEN DURCHGEFUEHRT |
---|
2812 | if [[ $do_batch = false ]] |
---|
2813 | then |
---|
2814 | |
---|
2815 | |
---|
2816 | # TEMPORAEREN KATALOG ERZEUGEN |
---|
2817 | mkdir -p $TEMPDIR |
---|
2818 | chmod go+rx $TEMPDIR |
---|
2819 | tmpcreate=true |
---|
2820 | |
---|
2821 | # set striping on lustre file system |
---|
2822 | # if [[ $localhost = lcsgih ]] |
---|
2823 | # then |
---|
2824 | # lfs setstripe -s 8192k -c 16 $TEMPDIR |
---|
2825 | # lfs getstripe $TEMPDIR |
---|
2826 | # fi |
---|
2827 | |
---|
2828 | |
---|
2829 | # SAEMTLICHE QUELLTEXT-DATEIEN BZW. AUSFUEHRBARES PROGRAMM IN |
---|
2830 | # TEMPORAERES VERZEICHNIS KOPIEREN |
---|
2831 | if [[ $do_compile = true ]] |
---|
2832 | then |
---|
2833 | |
---|
2834 | # ON NEC, COMPILATION IS DONE ON HOST CROSS VIA CROSS COMPILING |
---|
2835 | # CREATE A TEMPORARY DIRECTORY ON THAT MACHINE (HOME MOUNTED VIA NFS) |
---|
2836 | if [[ $localhost = nech ]] |
---|
2837 | then |
---|
2838 | TEMPDIR_COMPILE=$HOME/work/${usern}.$kennung |
---|
2839 | if mkdir -p $TEMPDIR_COMPILE |
---|
2840 | then |
---|
2841 | printf "\n *** \"$TEMPDIR_COMPILE\" " |
---|
2842 | printf "\n is generated as temporary directory for cross compiling\n" |
---|
2843 | else |
---|
2844 | printf "\n +++ creating directory \"$TEMPDIR_COMPILE\" " |
---|
2845 | printf "\n needed for cross compilation failed" |
---|
2846 | locat=compile |
---|
2847 | exit |
---|
2848 | fi |
---|
2849 | else |
---|
2850 | TEMPDIR_COMPILE=$TEMPDIR |
---|
2851 | fi |
---|
2852 | |
---|
2853 | |
---|
2854 | # PFADNAMEN FUER DAS MAKE-DEPOSITORY ERMITTELN |
---|
2855 | line="" |
---|
2856 | grep "%depository_path" $config_file > tmp_mrun |
---|
2857 | while read line |
---|
2858 | do |
---|
2859 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
2860 | then |
---|
2861 | if [[ "$(echo $line | cut -d" " -s -f3)" = "" ]] |
---|
2862 | then |
---|
2863 | global_depository_path=`echo $line | cut -d" " -s -f2` |
---|
2864 | fi |
---|
2865 | fi |
---|
2866 | done < tmp_mrun |
---|
2867 | |
---|
2868 | line="" |
---|
2869 | grep " $localhost" $config_file | grep "%depository_path" > tmp_mrun |
---|
2870 | while read line |
---|
2871 | do |
---|
2872 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
2873 | then |
---|
2874 | if [[ "$(echo $line | cut -d" " -s -f4)" = "$cond1" && "$(echo $line | cut -d" " -s -f5)" = "$cond2" ]] |
---|
2875 | then |
---|
2876 | local_depository_path=`echo $line | cut -d" " -s -f2` |
---|
2877 | fi |
---|
2878 | fi |
---|
2879 | done < tmp_mrun |
---|
2880 | |
---|
2881 | if [[ "$local_depository_path" = "" ]] |
---|
2882 | then |
---|
2883 | if [[ "$global_depository_path" != "" ]] |
---|
2884 | then |
---|
2885 | local_depository_path=$global_depository_path |
---|
2886 | else |
---|
2887 | printf "\n\n +++ no depository path found in configuration file" |
---|
2888 | printf "\n for local host \"$localhost\" " |
---|
2889 | printf "\n please set \"\%depository_path\" in configuration file\n" |
---|
2890 | locat=config_file; exit |
---|
2891 | fi |
---|
2892 | fi |
---|
2893 | eval local_depository_path=$local_depository_path |
---|
2894 | [[ "$cond1" != "" ]] && local_depository_path=${local_depository_path}_$cond1 |
---|
2895 | [[ "$cond2" != "" ]] && local_depository_path=${local_depository_path}_$cond2 |
---|
2896 | |
---|
2897 | |
---|
2898 | basename=`print $mainprog | cut -f1 -d"."` |
---|
2899 | eval make_depository=${local_depository_path}/${basename}_current_version.tar |
---|
2900 | if [[ ! -f $make_depository ]] |
---|
2901 | then |
---|
2902 | printf "\n" |
---|
2903 | printf "\n *** WARNING: make depository \"$make_depository\" not found" |
---|
2904 | printf "\n \"make\" will fail, if the Makefile or other source files are missing\n" |
---|
2905 | else |
---|
2906 | cp $make_depository $TEMPDIR_COMPILE |
---|
2907 | cd $TEMPDIR_COMPILE |
---|
2908 | tar -xf $make_depository > /dev/null 2>&1 |
---|
2909 | cd - > /dev/null |
---|
2910 | fi |
---|
2911 | |
---|
2912 | cp SOURCES_FOR_RUN_$fname/* $TEMPDIR_COMPILE |
---|
2913 | |
---|
2914 | else |
---|
2915 | |
---|
2916 | cp $executable ${TEMPDIR}/a.out |
---|
2917 | |
---|
2918 | fi |
---|
2919 | |
---|
2920 | |
---|
2921 | # WECHSEL IN TEMPORAEREN KATALOG |
---|
2922 | cd $TEMPDIR |
---|
2923 | printf "\n *** changed to temporary directory: $TEMPDIR" |
---|
2924 | |
---|
2925 | |
---|
2926 | # OUTPUT-DATEI-VERBINDUNGEN AUF TEMPORAERER DATEI ABLEGEN |
---|
2927 | # DIESE DATEI KANN VON SPAETER AUFZURUFENDEN BENUTZERPROZEDUREN GELESEN |
---|
2928 | # WERDEN, UM ZU LOKALEN DATEINAMEN GEHOERENDE PERMANENTE NAMEN ZU |
---|
2929 | # ERMITTELN |
---|
2930 | (( i = 0 )) |
---|
2931 | while (( i < iout )) |
---|
2932 | do |
---|
2933 | (( i = i + 1 )) |
---|
2934 | if [[ "${actionout[$i]}" = tr || "${actionout[$i]}" = tra || "${actionout[$i]}" = trpe ]] |
---|
2935 | then |
---|
2936 | printf "${localout[$i]} ${actionout[$i]}\n${pathout[$i]}\n${localhost}_${fname}${endout[$i]}\n" >> OUTPUT_FILE_CONNECTIONS |
---|
2937 | else |
---|
2938 | printf "${localout[$i]} ${actionout[$i]}\n${pathout[$i]}\n${frelout[$i]}\n" >> OUTPUT_FILE_CONNECTIONS |
---|
2939 | fi |
---|
2940 | done |
---|
2941 | |
---|
2942 | |
---|
2943 | # EVTL. UEBERSETZUNGSAKTIONEN STARTEN |
---|
2944 | if [[ $do_compile = true ]] |
---|
2945 | then |
---|
2946 | |
---|
2947 | |
---|
2948 | # COMPILING WITH MAKE (ON NEC COMPILER IS CALLED ON HOST CROSS) |
---|
2949 | printf "\n\n\n *** compilation starts \n$striche\n" |
---|
2950 | printf " *** compilation with make using following options:\n" |
---|
2951 | printf " make depository: $make_depository" |
---|
2952 | if [[ "$mopts" != "" ]] |
---|
2953 | then |
---|
2954 | printf " make options: $mopts\n" |
---|
2955 | fi |
---|
2956 | printf " compilername: $compiler_name\n" |
---|
2957 | printf " compiler options: $fopts\n" |
---|
2958 | printf " preprocessor directives: $cpp_options \n" |
---|
2959 | printf " linker options: $lopts \n" |
---|
2960 | if [[ "$modules" != "" ]] |
---|
2961 | then |
---|
2962 | printf " modules to be load: $modules \n" |
---|
2963 | fi |
---|
2964 | printf " source code files: $source_list \n" |
---|
2965 | |
---|
2966 | if [[ $localhost = nech ]] |
---|
2967 | then |
---|
2968 | # init_cmds was ". /SX/opt/etc/initsx.sh;" |
---|
2969 | ssh 136.172.44.192 -l $usern "$init_cmds $module_calls cd \$HOME/work/${usern}.$kennung; sxmake $mopts -f Makefile PROG=a.out F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$fopts\" LDFLAGS=\"$lopts\" " |
---|
2970 | cp $TEMPDIR_COMPILE/a.out . |
---|
2971 | [[ $? != 0 ]] && compile_error=true |
---|
2972 | rm -rf $TEMPDIR_COMPILE |
---|
2973 | elif [[ $localhost = ibmh ]] |
---|
2974 | then |
---|
2975 | printf " compiler is called via ssh on \"plogin1\" \n" |
---|
2976 | ssh plogin1 -l $usern "$init_cmds export PATH=/sw/ibm/xlf/13.1.0.8/usr/bin:$PATH; $module_calls cd $TEMPDIR; make $mopts -f Makefile PROG=a.out F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$fopts\" LDFLAGS=\"$lopts\" " |
---|
2977 | [[ ! -f a.out ]] && compile_error=true |
---|
2978 | continue # ANDERENFALLS IST STATUS=1, FALLS A.OUT VORHANDEN |
---|
2979 | elif [[ $localhost = lcsgib ]] |
---|
2980 | then |
---|
2981 | printf " compiler is called via ssh on \"bicegate0\" \n" |
---|
2982 | ssh bicegate0 -l $usern "$init_cmds $module_calls cd $TEMPDIR; make $mopts -f Makefile PROG=a.out F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$fopts\" LDFLAGS=\"$lopts\" " |
---|
2983 | [[ ! -f a.out ]] && compile_error=true |
---|
2984 | continue # ANDERENFALLS IST STATUS=1, FALLS A.OUT VORHANDEN |
---|
2985 | elif [[ $localhost = lcsgih ]] |
---|
2986 | then |
---|
2987 | printf " compiler is called via ssh on \"hicegate0\" \n" |
---|
2988 | ssh hicegate0 -l $usern "$init_cmds $module_calls cd $TEMPDIR; make $mopts -f Makefile PROG=a.out F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$fopts\" LDFLAGS=\"$lopts\" 2>&1 " |
---|
2989 | [[ ! -f a.out ]] && compile_error=true |
---|
2990 | continue # ANDERENFALLS IST STATUS=1, FALLS A.OUT VORHANDEN |
---|
2991 | elif [[ $localhost = lcflow ]] |
---|
2992 | then |
---|
2993 | printf " compiler is called via ssh on \"flow\" \n" |
---|
2994 | ssh flow02.hpc.uni-oldenburg.de -l $usern "$init_cmds $module_calls cd $TEMPDIR; make $mopts -f Makefile PROG=a.out F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$fopts\" LDFLAGS=\"$lopts\" " |
---|
2995 | [[ ! -f a.out ]] && compile_error=true |
---|
2996 | continue # ANDERENFALLS IST STATUS=1, FALLS A.OUT VORHANDEN |
---|
2997 | else |
---|
2998 | [[ "$init_cmds" != "" ]] && eval $init_cmds |
---|
2999 | [[ "$module_calls" != "" ]] && eval $module_calls |
---|
3000 | make $mopts -f Makefile PROG=a.out F90=$compiler_name COPT="$cpp_options" F90FLAGS="$fopts" LDFLAGS="$lopts" |
---|
3001 | |
---|
3002 | fi |
---|
3003 | |
---|
3004 | if [[ $? != 0 || "$compile_error" = true || "$module_compile_error" = true ]] |
---|
3005 | then |
---|
3006 | printf "\n +++ error occured while compiling or linking" |
---|
3007 | locat=compile |
---|
3008 | |
---|
3009 | # WORKAROUND: REMOVE IF CONSTRUCT LATER, BUT KEEP THE EXIT! |
---|
3010 | # if [[ $localhost != lcsgib && $localhost != lcsgih ]] |
---|
3011 | # then |
---|
3012 | exit |
---|
3013 | # else |
---|
3014 | # locat=normal |
---|
3015 | # fi |
---|
3016 | else |
---|
3017 | printf "$striche\n *** compilation finished \n" |
---|
3018 | fi |
---|
3019 | fi |
---|
3020 | |
---|
3021 | |
---|
3022 | # FALLS NUR TESTWEISE KOMPILIERT WERDEN SOLLTE, IST MRUN JETZT FERTIG |
---|
3023 | if [[ $local_compile = true ]] |
---|
3024 | then |
---|
3025 | cd $HOME |
---|
3026 | rm -rf $TEMPDIR |
---|
3027 | locat=local_compile; exit |
---|
3028 | fi |
---|
3029 | |
---|
3030 | |
---|
3031 | # BEREITSTELLEN DER INPUT-DATEIEN |
---|
3032 | # SCHLEIFE UEBER ALLE VOM BENUTZER ANGEGEBENEN DATEIEN |
---|
3033 | (( i = 0 )) |
---|
3034 | while (( i < iin )) |
---|
3035 | do |
---|
3036 | (( i = i + 1 )) |
---|
3037 | if (( i == 1 )) |
---|
3038 | then |
---|
3039 | printf "\n\n *** providing INPUT-files:\n$striche" |
---|
3040 | fi |
---|
3041 | |
---|
3042 | |
---|
3043 | # OPTIONALE DATEIEN BEI NICHTVORHANDENSEIN UEBERGEHEN |
---|
3044 | if [[ "${transin[$i]}" = unavailable ]] |
---|
3045 | then |
---|
3046 | if [[ "${extin[$i]}" = "" || "${extin[$i]}" = " " ]] |
---|
3047 | then |
---|
3048 | printf "\n +++ WARNING: input file \"${pathin[$i]}/${afname}${endin[$i]}\" " |
---|
3049 | printf "\n is not available!" |
---|
3050 | else |
---|
3051 | printf "\n +++ WARNING: input file \"${pathin[$i]}/${afname}${endin[$i]}.${extin[$i]}\" " |
---|
3052 | printf "\n is not available!" |
---|
3053 | fi |
---|
3054 | continue |
---|
3055 | fi |
---|
3056 | |
---|
3057 | # PRUEFEN, OB EINZELDATEI ODER DATEI PRO PROZESSOR |
---|
3058 | files_for_pes=false; datentyp=file |
---|
3059 | if [[ "${actionin[$i]}" = pe && -n $numprocs ]] |
---|
3060 | then |
---|
3061 | files_for_pes=true; datentyp=directory |
---|
3062 | actionin[$i]="" |
---|
3063 | elif [[ "${actionin[$i]}" = pe && ! -n $numprocs ]] |
---|
3064 | then |
---|
3065 | actionin[$i]="" |
---|
3066 | elif [[ "${actionin[$i]}" = arpe && -n $numprocs ]] |
---|
3067 | then |
---|
3068 | files_for_pes=true; datentyp=directory |
---|
3069 | actionin[$i]="ar" |
---|
3070 | elif [[ "${actionin[$i]}" = arpe && ! -n $numprocs ]] |
---|
3071 | then |
---|
3072 | actionin[$i]="ar" |
---|
3073 | elif [[ "${actionin[$i]}" = flpe && -n $numprocs ]] |
---|
3074 | then |
---|
3075 | files_for_pes=true; datentyp=directory |
---|
3076 | actionin[$i]="fl" |
---|
3077 | elif [[ "${actionin[$i]}" = flpe && ! -n $numprocs ]] |
---|
3078 | then |
---|
3079 | actionin[$i]="fl" |
---|
3080 | fi |
---|
3081 | |
---|
3082 | if [[ $files_for_pes = true ]] |
---|
3083 | then |
---|
3084 | printf "\n >>> INPUT: ${absnamein[$i]}/.... to ${localin[$i]}" |
---|
3085 | else |
---|
3086 | printf "\n >>> INPUT: ${absnamein[$i]} to ${localin[$i]}" |
---|
3087 | fi |
---|
3088 | |
---|
3089 | # INPUT-DATEI FUER EINEN FORTSETZUNGSLAUF. ES WIRD GEPRUEFT, |
---|
3090 | # OB DIESE DATEI NOCH AUF DEM TEMPORAEREN DATENKATALOG VORHANDEN |
---|
3091 | # IST. FALLS NICHT, WIRD VERSUCHT, SIE ANSCHLIESSEND VOM ARCHIV- |
---|
3092 | # SERVER ZU HOLEN |
---|
3093 | if [[ "${actionin[$i]}" = fl ]] |
---|
3094 | then |
---|
3095 | printf "\n $datentyp will be fetched from temporary directory \"${tmp_data_catalog}\" !" |
---|
3096 | if [[ $files_for_pes = false ]] |
---|
3097 | then |
---|
3098 | if [[ -f "$tmp_data_catalog/${frelin[$i]}" ]] |
---|
3099 | then |
---|
3100 | ln $tmp_data_catalog/${frelin[$i]} ${localin[$i]} |
---|
3101 | got_tmp[$i]=true |
---|
3102 | elif [[ -f "$WORK/${frelin[$i]}" && $ignore_archive_error = true ]] |
---|
3103 | then |
---|
3104 | printf "\n +++ $datentyp not found in \"$tmp_data_catalog\" !" |
---|
3105 | printf "\n *** trying to use backup copy in \"$WORK\" " |
---|
3106 | cp $WORK/${frelin[$i]} ${localin[$i]} |
---|
3107 | else |
---|
3108 | printf "\n +++ $datentyp not found in \"$tmp_data_catalog\" " |
---|
3109 | printf "\n or \"$tmp_data_catalog\" does not exist!" |
---|
3110 | printf "\n *** trying to get copy from archive" |
---|
3111 | actionin[$i]=ar |
---|
3112 | fi |
---|
3113 | else |
---|
3114 | if [[ -d "$tmp_data_catalog/${frelin[$i]}" ]] |
---|
3115 | then |
---|
3116 | mkdir ${localin[$i]} |
---|
3117 | cd $tmp_data_catalog/${frelin[$i]} |
---|
3118 | for file in $(ls *) |
---|
3119 | do |
---|
3120 | ln $file $TEMPDIR/${localin[$i]} |
---|
3121 | done |
---|
3122 | cd $TEMPDIR |
---|
3123 | got_tmp[$i]=true |
---|
3124 | elif [[ -d "$WORK/${frelin[$i]}" && $ignore_archive_error = true ]] |
---|
3125 | then |
---|
3126 | printf "\n +++ $datentyp not found in \"$tmp_data_catalog\" !" |
---|
3127 | printf "\n *** trying to use backup copy in \"$WORK\" " |
---|
3128 | cp -r $WORK/${frelin[$i]} ${localin[$i]} |
---|
3129 | else |
---|
3130 | printf "\n +++ $datentyp not found in \"$tmp_data_catalog\" " |
---|
3131 | printf "\n or \"$tmp_data_catalog\" does not exist!" |
---|
3132 | printf "\n *** trying to get copy from archive" |
---|
3133 | actionin[$i]=ar |
---|
3134 | fi |
---|
3135 | fi |
---|
3136 | fi |
---|
3137 | |
---|
3138 | |
---|
3139 | # DATEI LIEGT AUF ARCHIV-SERVER |
---|
3140 | if [[ "${actionin[$i]}" = ar ]] |
---|
3141 | then |
---|
3142 | |
---|
3143 | if [[ $files_for_pes = false ]] |
---|
3144 | then |
---|
3145 | printf "\n file will be restored from archive-system ($archive_system)!" |
---|
3146 | else |
---|
3147 | printf "\n directory will be restored from archive-system ($archive_system)!" |
---|
3148 | fi |
---|
3149 | |
---|
3150 | file_restored=false |
---|
3151 | |
---|
3152 | if [[ $archive_system = asterix ]] |
---|
3153 | then |
---|
3154 | do_stagein=true |
---|
3155 | (( stagein_anz = 0 )) |
---|
3156 | while [[ $do_stagein = true ]] |
---|
3157 | do |
---|
3158 | if [[ $files_for_pes = false ]] |
---|
3159 | then |
---|
3160 | stagein -O ${frelin[$i]} > STAGEIN_OUTPUT |
---|
3161 | else |
---|
3162 | stagein -t -O ${frelin[$i]} > STAGEIN_OUTPUT |
---|
3163 | fi |
---|
3164 | cat STAGEIN_OUTPUT |
---|
3165 | if [[ $(grep -c "st.msg:i24" STAGEIN_OUTPUT) != 0 ]] |
---|
3166 | then |
---|
3167 | file_restored=true |
---|
3168 | do_stagein=false |
---|
3169 | else |
---|
3170 | (( stagein_anz = stagein_anz + 1 )) |
---|
3171 | if (( stagein_anz == 10 )) |
---|
3172 | then |
---|
3173 | printf "\n +++ stagein stoped after 10 tries" |
---|
3174 | locat=stage |
---|
3175 | exit |
---|
3176 | fi |
---|
3177 | printf "\n +++ restoring from archive failed, trying again:" |
---|
3178 | sleep 900 |
---|
3179 | fi |
---|
3180 | done |
---|
3181 | elif [[ $archive_system = DMF ]] |
---|
3182 | then |
---|
3183 | if [[ $files_for_pes = false ]] |
---|
3184 | then |
---|
3185 | printf "\n +++ restoring of single files impossible with $archive_system !\n" |
---|
3186 | locat=DMF |
---|
3187 | exit |
---|
3188 | else |
---|
3189 | find $ARCHIVE/${frelin[$i]} -type m -print | dmget |
---|
3190 | cp -r $ARCHIVE/${frelin[$i]} $PWD |
---|
3191 | file_restored=true |
---|
3192 | fi |
---|
3193 | elif [[ $archive_system = tivoli ]] |
---|
3194 | then |
---|
3195 | if [[ $files_for_pes = false ]] |
---|
3196 | then |
---|
3197 | if [[ $localhost = lcsgih ]] |
---|
3198 | then |
---|
3199 | ssh $usern@hicedata.hlrn.de "cp $PERM/${frelin[$i]} $PWD" |
---|
3200 | else |
---|
3201 | ssh $usern@bicedata.hlrn.de "cp $PERM/${frelin[$i]} $PWD" |
---|
3202 | fi |
---|
3203 | else |
---|
3204 | (( inode = 0 )) |
---|
3205 | while (( inode < nodes )) |
---|
3206 | do |
---|
3207 | if [[ $localhost = lcsgih ]] |
---|
3208 | then |
---|
3209 | ssh $usern@hicedata.hlrn.de "cd $PWD; tar xf $PERM/${frelin[$i]}/${frelin[$i]}.node_$inode.tar" |
---|
3210 | else |
---|
3211 | ssh $usern@bicedata.hlrn.de "cd $PWD; tar xf $PERM/${frelin[$i]}/${frelin[$i]}.node_$inode.tar" |
---|
3212 | fi |
---|
3213 | (( inode = inode + 1 )) |
---|
3214 | done |
---|
3215 | fi |
---|
3216 | file_restored=true |
---|
3217 | elif [[ $archive_system = ut ]] |
---|
3218 | then |
---|
3219 | if [[ $files_for_pes = false ]] |
---|
3220 | then |
---|
3221 | cp $UT/${frelin[$i]} . |
---|
3222 | else |
---|
3223 | (( inode = 0 )) |
---|
3224 | while (( inode < nodes )) |
---|
3225 | do |
---|
3226 | tar xf $UT/${frelin[$i]}/${frelin[$i]}.node_$inode.tar |
---|
3227 | (( inode = inode + 1 )) |
---|
3228 | done |
---|
3229 | fi |
---|
3230 | file_restored=true |
---|
3231 | else |
---|
3232 | printf "\n +++ archive_system=\"$archive_system\" restore impossible!" |
---|
3233 | locat=rearchive |
---|
3234 | exit |
---|
3235 | fi |
---|
3236 | |
---|
3237 | if [[ $file_restored = true ]] |
---|
3238 | then |
---|
3239 | |
---|
3240 | # DATEI AUCH AUF TEMPORAERES DATENVERZEICHNIS LEGEN, DAMIT |
---|
3241 | # SIE BEI WEITEREN ZUGRIFFEN NOCH VORHANDEN IST |
---|
3242 | [[ ! -d $tmp_data_catalog ]] && mkdir -p $tmp_data_catalog; chmod g+rx $tmp_data_catalog |
---|
3243 | if [[ $files_for_pes = false ]] |
---|
3244 | then |
---|
3245 | ln -f ${frelin[$i]} $tmp_data_catalog/${frelin[$i]} |
---|
3246 | else |
---|
3247 | mkdir $tmp_data_catalog/${frelin[$i]} |
---|
3248 | ln -f ${frelin[$i]}/* $tmp_data_catalog/${frelin[$i]} |
---|
3249 | fi |
---|
3250 | got_tmp[$i]=true |
---|
3251 | |
---|
3252 | # DATEI UNTER LOKALEM NAMEN ZUR VERFUEGUNG STELLEN |
---|
3253 | mv ${frelin[$i]} ${localin[$i]} |
---|
3254 | |
---|
3255 | fi |
---|
3256 | fi |
---|
3257 | |
---|
3258 | |
---|
3259 | # DATEI LIEGT IM VOM BENUTZER ANGEGEBENEN VERZEICHNIS |
---|
3260 | if [[ "${actionin[$i]}" = "" || "${actionin[$i]}" = "di" || "${actionin[$i]}" = "npe" ]] |
---|
3261 | then |
---|
3262 | |
---|
3263 | if [[ "${actionin[$i]}" = "npe" && -n $numprocs ]] |
---|
3264 | then |
---|
3265 | |
---|
3266 | # DATEI WIRD FUER DIE PROZESSOREN EINES PARALLERECHNERS BEREITGESTELLT |
---|
3267 | printf "\n file will be provided for $numprocs processors" |
---|
3268 | mkdir ${localin[$i]} |
---|
3269 | ival=$numprocs |
---|
3270 | (( ii = 0 )) |
---|
3271 | while (( ii <= ival-1 )) |
---|
3272 | do |
---|
3273 | if (( ii < 10 )) |
---|
3274 | then |
---|
3275 | cp ${absnamein[$i]} ${localin[$i]}/_000$ii |
---|
3276 | elif (( ii < 100 )) |
---|
3277 | then |
---|
3278 | cp ${absnamein[$i]} ${localin[$i]}/_00$ii |
---|
3279 | elif (( ii < 1000 )) |
---|
3280 | then |
---|
3281 | cp ${absnamein[$i]} ${localin[$i]}/_0$ii |
---|
3282 | else |
---|
3283 | cp ${absnamein[$i]} ${localin[$i]}/_$ii |
---|
3284 | fi |
---|
3285 | (( ii = ii + 1 )) |
---|
3286 | done |
---|
3287 | |
---|
3288 | else |
---|
3289 | |
---|
3290 | if [[ $files_for_pes = true ]] |
---|
3291 | then |
---|
3292 | |
---|
3293 | # DIE DEN PROZESSOREN EINES PARALLELRECHNERS ZUGEHOERIGEN |
---|
3294 | # DATEIEN WERDEN BEREITGESTELLT, INDEM ZUERST DER GESAMTE |
---|
3295 | # KATALOGINHALT KOPIERT UND DANN DIE EINZELNEN DATEIEN |
---|
3296 | # PER MOVE UMBENANNT WERDEN |
---|
3297 | printf "\n providing $numprocs files for the respective processors" |
---|
3298 | mkdir ${localin[$i]} |
---|
3299 | if [[ $link_local_input = true ]] |
---|
3300 | then |
---|
3301 | printf " using ln -f\n" |
---|
3302 | cd ${absnamein[$i]} |
---|
3303 | for file in $(ls *) |
---|
3304 | do |
---|
3305 | ln -f $file ${localin[$i]} |
---|
3306 | done |
---|
3307 | cd $TEMPDIR |
---|
3308 | fi |
---|
3309 | # If "ln -f" fails of if "$link_local_input = false" do a normal "cp -r" |
---|
3310 | if [[ ! -f "${localin[$i]}/_0000" ]] |
---|
3311 | then |
---|
3312 | if [[ $link_local_input = true ]] |
---|
3313 | then |
---|
3314 | printf " ln failed for .../_0000, using cp...\n" |
---|
3315 | fi |
---|
3316 | cp -r ${absnamein[$i]}/* ${localin[$i]} |
---|
3317 | fi |
---|
3318 | |
---|
3319 | else |
---|
3320 | # BEREITSTELLUNG AUF EINPROZESSORRECHNERN |
---|
3321 | if [[ $link_local_input = true ]] |
---|
3322 | then |
---|
3323 | printf " using ln -f\n" |
---|
3324 | ln -f ${absnamein[$i]} ${localin[$i]} |
---|
3325 | fi |
---|
3326 | # If "ln -f" fails of if "$link_local_input = false" do a normal "cp" |
---|
3327 | if [[ ! -f "${localin[$i]}" ]] |
---|
3328 | then |
---|
3329 | if [[ $link_local_input = true ]] |
---|
3330 | then |
---|
3331 | printf " ln failed, using cp...\n" |
---|
3332 | fi |
---|
3333 | cp ${absnamein[$i]} ${localin[$i]} |
---|
3334 | fi |
---|
3335 | fi |
---|
3336 | fi |
---|
3337 | fi |
---|
3338 | |
---|
3339 | done |
---|
3340 | if (( i != 0 )) |
---|
3341 | then |
---|
3342 | printf "\n$striche\n *** all INPUT-files provided \n" |
---|
3343 | fi |
---|
3344 | |
---|
3345 | |
---|
3346 | # EVENTUELLE INPUT-KOMMANDOS ABARBEITEN |
---|
3347 | (( i = 0 )) |
---|
3348 | while (( i < iic )) |
---|
3349 | do |
---|
3350 | (( i = i + 1 )) |
---|
3351 | if (( i == 1 )) |
---|
3352 | then |
---|
3353 | printf "\n\n *** execution of INPUT-commands:\n$striche" |
---|
3354 | fi |
---|
3355 | printf "\n >>> ${in_command[$i]}" |
---|
3356 | eval ${in_command[$i]} |
---|
3357 | if (( i == iic )) |
---|
3358 | then |
---|
3359 | printf "\n$striche\n" |
---|
3360 | fi |
---|
3361 | done |
---|
3362 | |
---|
3363 | |
---|
3364 | # VERBLEIBENDE CPU-ZEIT BERECHNEN |
---|
3365 | cpurest=${cpumax}. |
---|
3366 | |
---|
3367 | |
---|
3368 | # START DVR STREAMING SERVER |
---|
3369 | if [[ $(echo $package_list | grep -c dvrp_graphics) != 0 ]] |
---|
3370 | then |
---|
3371 | if [[ "$dvr_server" != "" ]] |
---|
3372 | then |
---|
3373 | |
---|
3374 | printf "\n\n *** preparing the dvr streaming server configuration file" |
---|
3375 | |
---|
3376 | # Check, if a dvr server is already running |
---|
3377 | running_dvrserver_id=`echo $(ps -edaf | grep .dvrserver.config | grep -v grep) | cut -d" " -f2` |
---|
3378 | if [[ "$running_dvrserver_id" != "" ]] |
---|
3379 | then |
---|
3380 | |
---|
3381 | printf "\n\n +++ WARNING: A dvr server with id=$running_dvrserver_id is already running!" |
---|
3382 | printf "\n This server is used instead starting a new one!" |
---|
3383 | printf "\n If required, script \"process_dvr_output\" has to be run manually." |
---|
3384 | |
---|
3385 | else |
---|
3386 | |
---|
3387 | # COPY CONFIGURATION FILE FOR STREAMING SERVER FROM REPOSITORY TO HERE |
---|
3388 | if [[ -f ${PALM_BIN}/.dvrserver.config ]] |
---|
3389 | then |
---|
3390 | cp ${PALM_BIN}/.dvrserver.config . |
---|
3391 | |
---|
3392 | # Entering the BASEDIR, UID and GID into this file |
---|
3393 | user_id=`id -u` |
---|
3394 | group_id=`id -g` |
---|
3395 | # & is needed as seperator, because TEMPDIR contains / |
---|
3396 | sed "s&<replace by dvr data directory>&${TEMPDIR}&g" .dvrserver.config > .dvrserver.1 |
---|
3397 | sed "s/<replace by user id>/$user_id/g" .dvrserver.1 > .dvrserver.2 |
---|
3398 | sed "s/<replace by group id>/$group_id/g" .dvrserver.2 > .dvrserver.3 |
---|
3399 | mv .dvrserver.3 .dvrserver.config |
---|
3400 | rm .dvrserver.1 .dvrserver.2 |
---|
3401 | |
---|
3402 | # Start dvr server in background, get his id and print on terminal |
---|
3403 | $dvr_server .dvrserver.config >> DVR_LOGFILE 2>&1 & |
---|
3404 | dvrserver_id=`echo $(ps -edaf | grep .dvrserver.config) | cut -d" " -f2` |
---|
3405 | printf "\n *** streaming server with id=$dvrserver_id is started in background" |
---|
3406 | local_dvrserver_running=.TRUE. |
---|
3407 | else |
---|
3408 | printf "\n +++ missing file \".dvrserver.config\" in directory:" |
---|
3409 | printf "\n \"$PALM_BIN\" " |
---|
3410 | locat=dvr |
---|
3411 | exit |
---|
3412 | fi |
---|
3413 | |
---|
3414 | fi |
---|
3415 | |
---|
3416 | else |
---|
3417 | printf "\n\n --- INFORMATIVE: no dvr streaming server will be started" |
---|
3418 | fi |
---|
3419 | fi |
---|
3420 | |
---|
3421 | |
---|
3422 | # NAMELIST-DATEI MIT WERTEN VON ENVIRONMENT-VARIABLEN ERZEUGEN (ZU |
---|
3423 | # LESEN VON PALM) |
---|
3424 | cat > ENVPAR << %%END%% |
---|
3425 | &envpar run_identifier = '$fname', host = '$localhost', |
---|
3426 | write_binary = '$write_binary', tasks_per_node = $tasks_per_node, |
---|
3427 | maximum_parallel_io_streams = $maximum_parallel_io_streams, |
---|
3428 | maximum_cpu_time_allowed = ${cpumax}., |
---|
3429 | revision = '$global_revision', |
---|
3430 | local_dvrserver_running = $local_dvrserver_running / |
---|
3431 | |
---|
3432 | %%END%% |
---|
3433 | |
---|
3434 | |
---|
3435 | # PROGRAMMSTART |
---|
3436 | printf "\n\n *** execution starts in directory\n \"`pwd`\"\n$striche\n" |
---|
3437 | PATH=$PATH:$TEMPDIR |
---|
3438 | |
---|
3439 | # MPI debug option (argument checking, slows down execution due to increased latency) |
---|
3440 | if [[ "$mpi_debug" = true ]] |
---|
3441 | then |
---|
3442 | export MPI_CHECK_ARGS=1 |
---|
3443 | printf "\n +++ MPI_CHECK_ARGS=$MPI_CHECK_ARGS" |
---|
3444 | fi |
---|
3445 | |
---|
3446 | if [[ "$totalview" = true ]] |
---|
3447 | then |
---|
3448 | printf "\n *** totalview debugger will be used" |
---|
3449 | tv_opt="-tv" |
---|
3450 | else |
---|
3451 | tv_opt="" |
---|
3452 | fi |
---|
3453 | |
---|
3454 | if [[ "$cond1" = debug || "$cond2" = debug ]] |
---|
3455 | then |
---|
3456 | if [[ "$ENVIRONMENT" = BATCH ]] |
---|
3457 | then |
---|
3458 | if [[ $(echo $localhost | cut -c1-5) != lcsgi ]] |
---|
3459 | then |
---|
3460 | printf "\n +++ debug is allowed in interactive mode only" |
---|
3461 | locat=debug |
---|
3462 | exit |
---|
3463 | fi |
---|
3464 | fi |
---|
3465 | if [[ $localhost = decalpha ]] |
---|
3466 | then |
---|
3467 | dxladebug a.out |
---|
3468 | elif [[ $localhost = ibmh ]] |
---|
3469 | then |
---|
3470 | |
---|
3471 | # SETUP THE IBM MPI ENVIRONMENT |
---|
3472 | export MP_SHARED_MEMORY=yes |
---|
3473 | export AIXTHREADS_SCOPE=S |
---|
3474 | export OMP_NUM_THREADS=$threads_per_task |
---|
3475 | export AUTHSTATE=files |
---|
3476 | export XLFRTEOPTS="nlwidth=132:err_recovery=no" # RECORD-LENGTH OF NAMELIST-OUTPUT |
---|
3477 | |
---|
3478 | # FOLLOWING OPTIONS ARE MANDATORY FOR TOTALVIEW |
---|
3479 | export MP_ADAPTER_USE=shared |
---|
3480 | export MP_CPU_USE=multiple |
---|
3481 | export MP_TIMEOUT=1200 |
---|
3482 | |
---|
3483 | unset MP_TASK_AFFINITY |
---|
3484 | |
---|
3485 | # SO FAR, TOTALVIEW NEEDS HOSTFILE MECHANISM FOR EXECUTION |
---|
3486 | #(( ii = 1 )) |
---|
3487 | #while (( ii <= $numprocs )) |
---|
3488 | #do |
---|
3489 | # echo $localhost_realname >> hostfile |
---|
3490 | # (( ii = ii + 1 )) |
---|
3491 | #done |
---|
3492 | #export MP_HOSTFILE=hostfile |
---|
3493 | |
---|
3494 | if [[ "$LOADLBATCH" = yes ]] |
---|
3495 | then |
---|
3496 | totalview poe a.out $ROPTS |
---|
3497 | else |
---|
3498 | echo totalview poe -a a.out -procs $numprocs -rmpool 0 -nodes 1 $ROPTS |
---|
3499 | export TVDSVRLAUNCHCMD=ssh |
---|
3500 | totalview poe -a a.out -procs $numprocs -rmpool 0 -nodes 1 $ROPTS |
---|
3501 | fi |
---|
3502 | elif [[ $(echo $localhost | cut -c1-5) = lcsgi ]] |
---|
3503 | then |
---|
3504 | # CURRENTLY NO DEBUGGER ON LCSGI |
---|
3505 | if [[ $run_coupled_model = true ]] |
---|
3506 | then |
---|
3507 | printf "\n +++ no debug in coupled mode available on \"$localhost\" " |
---|
3508 | locat=debug |
---|
3509 | exit |
---|
3510 | else |
---|
3511 | echo "no_coupling" > runfile_atmos |
---|
3512 | fi |
---|
3513 | (( ii = $numprocs / $threads_per_task )) |
---|
3514 | export OMP_NUM_THREADS=$threads_per_task |
---|
3515 | echo "OMP_NUM_THREADS=$OMP_NUM_THREADS" |
---|
3516 | if [[ $threads_per_task != 1 ]] |
---|
3517 | then |
---|
3518 | printf "\n threads per task: $threads_per_task" |
---|
3519 | fi |
---|
3520 | printf "\n\n" |
---|
3521 | if [[ $( echo $mpilib | cut -c1-3 ) = mpt ]] |
---|
3522 | then |
---|
3523 | # export MPI_LAUNCH_TIMEOUT=360 |
---|
3524 | if [[ "$totalview" = true ]] |
---|
3525 | then |
---|
3526 | printf "\n running totalview debugger" |
---|
3527 | mpiexec_mpt $tv_opt -n $ii ./a.out $ROPTS < runfile_atmos |
---|
3528 | else |
---|
3529 | mpiexec_mpt -np $ii ./a.out $ROPTS < runfile_atmos |
---|
3530 | fi |
---|
3531 | elif [[ $( echo $mpilib | cut -c1-3 ) = mva ]] |
---|
3532 | then |
---|
3533 | # ulimit -s 300000 # A too large stack size causes problems |
---|
3534 | # export MV2_NUM_PORTS=2 |
---|
3535 | # export MV2_CPU_MAPPING=0:1:2:3 |
---|
3536 | if [[ "$totalview" = true ]] |
---|
3537 | then |
---|
3538 | printf "\n running totalview debugger" |
---|
3539 | mpiexec $tv_opt ./a.out $ROPTS < runfile_atmos |
---|
3540 | else |
---|
3541 | mpiexec ./a.out $ROPTS < runfile_atmos |
---|
3542 | fi |
---|
3543 | fi |
---|
3544 | else |
---|
3545 | printf "\n +++ no debug available on \"$localhost\" " |
---|
3546 | printf "\n or not implemented in mrun so far" |
---|
3547 | locat=debug |
---|
3548 | exit |
---|
3549 | fi |
---|
3550 | |
---|
3551 | # end debug mode |
---|
3552 | else |
---|
3553 | |
---|
3554 | # normal execution |
---|
3555 | if [[ -n $numprocs ]] |
---|
3556 | then |
---|
3557 | # RUNNING THE PROGRAM ON PARALLEL MACHINES |
---|
3558 | if [[ $(echo $host | cut -c1-3) = ibm ]] |
---|
3559 | then |
---|
3560 | # SETUP THE IBM MPI ENVIRONMENT |
---|
3561 | if [[ $host != ibmh && $host != ibmkisti ]] |
---|
3562 | then |
---|
3563 | export MP_SHARED_MEMORY=yes |
---|
3564 | export AIXTHREAD_SCOPE=S |
---|
3565 | export OMP_NUM_THREADS=$threads_per_task |
---|
3566 | export XLSMPOPTS="spins=0:yields=0:stack=20000000" |
---|
3567 | export AUTHSTATE=files |
---|
3568 | export XLFRTEOPTS="nlwidth=132:err_recovery=no" # RECORD-LENGTH OF NAMELIST-OUTPUT |
---|
3569 | # export MP_PRINTENV=yes |
---|
3570 | |
---|
3571 | # TUNING-VARIABLEN ZUR VERBESSERUNG DER KOMMUNIKATION |
---|
3572 | # ZEIGEN ABER DERZEIT (SEP 04, FEDERATION) KAUM WIRKUNG |
---|
3573 | export MP_WAIT_MODE=poll |
---|
3574 | [[ $node_usage = not_shared ]] && export MP_SINGLE_THREAD=yes |
---|
3575 | fi |
---|
3576 | |
---|
3577 | if [[ $host = ibmkisti ]] |
---|
3578 | then |
---|
3579 | export LANG=en_US |
---|
3580 | export MP_SHARED_MEMORY=yes |
---|
3581 | if [[ $threads_per_task = 1 ]] |
---|
3582 | then |
---|
3583 | export MP_SINGLE_THREAD=yes |
---|
3584 | export MEMORY_AFFINITY=MCM |
---|
3585 | else |
---|
3586 | export OMP_NUM_THREADS=$threads_per_task |
---|
3587 | fi |
---|
3588 | fi |
---|
3589 | |
---|
3590 | if [[ "$LOADLBATCH" = yes ]] |
---|
3591 | then |
---|
3592 | printf "\n--- Control: OMP_NUM_THREADS = \"$OMP_NUM_THREADS\" \n" |
---|
3593 | if [[ "$cond1" = hpmcount || "$cond2" = hpmcount ]] |
---|
3594 | then |
---|
3595 | /opt/optibm/HPM_2_4_1/bin/hpmcount a.out $ROPTS |
---|
3596 | else |
---|
3597 | if [[ $run_coupled_model = false ]] |
---|
3598 | then |
---|
3599 | if [[ "$ocean_file_appendix" = true ]] |
---|
3600 | then |
---|
3601 | echo "precursor_ocean" > runfile_atmos |
---|
3602 | else |
---|
3603 | echo "precursor_atmos" > runfile_atmos |
---|
3604 | fi |
---|
3605 | else |
---|
3606 | (( iia = $numprocs_atmos / $threads_per_task )) |
---|
3607 | (( iio = $numprocs_ocean / $threads_per_task )) |
---|
3608 | printf "\n coupled run ($iia atmosphere, $iio ocean)" |
---|
3609 | printf "\n using $coupled_mode coupling" |
---|
3610 | printf "\n\n" |
---|
3611 | echo "coupled_run $iia $iio" > runfile_atmos |
---|
3612 | fi |
---|
3613 | poe ./a.out $ROPTS < runfile_atmos |
---|
3614 | fi |
---|
3615 | else |
---|
3616 | if [[ $localhost = ibmh || $localhost = ibms ]] |
---|
3617 | then |
---|
3618 | poe a.out -procs $numprocs -nodes 1 -rmpool 0 $ROPTS |
---|
3619 | elif [[ $localhost = ibmkisti || $localhost = ibmku || $localhost = ibmy ]] |
---|
3620 | then |
---|
3621 | if [[ -f $hostfile ]] |
---|
3622 | then |
---|
3623 | cp $hostfile hostfile |
---|
3624 | else |
---|
3625 | (( ii = 1 )) |
---|
3626 | while (( ii <= $numprocs )) |
---|
3627 | do |
---|
3628 | echo $localhost_realname >> hostfile |
---|
3629 | (( ii = ii + 1 )) |
---|
3630 | done |
---|
3631 | fi |
---|
3632 | export MP_HOSTFILE=hostfile |
---|
3633 | if [[ $run_coupled_model = false ]] |
---|
3634 | then |
---|
3635 | if [[ "$ocean_file_appendix" = true ]] |
---|
3636 | then |
---|
3637 | echo "precursor_ocean" > runfile_atmos |
---|
3638 | else |
---|
3639 | echo "precursor_atmos" > runfile_atmos |
---|
3640 | fi |
---|
3641 | else |
---|
3642 | (( iia = $numprocs_atmos / $threads_per_task )) |
---|
3643 | (( iio = $numprocs_ocean / $threads_per_task )) |
---|
3644 | printf "\n coupled run ($iia atmosphere, $iio ocean)" |
---|
3645 | printf "\n using $coupled_mode coupling" |
---|
3646 | printf "\n\n" |
---|
3647 | echo "coupled_run $iia $iio" > runfile_atmos |
---|
3648 | fi |
---|
3649 | if [[ $localhost = ibmy ]] |
---|
3650 | then |
---|
3651 | ./a.out -procs $tasks_per_node $ROPTS < runfile_atmos |
---|
3652 | else |
---|
3653 | poe ./a.out -procs $numprocs $ROPTS < runfile_atmos |
---|
3654 | fi |
---|
3655 | |
---|
3656 | else |
---|
3657 | if [[ "$host_file" = "" ]] |
---|
3658 | then |
---|
3659 | printf "\n +++ no hostfile given in configuration file" |
---|
3660 | locat=config_file |
---|
3661 | exit |
---|
3662 | else |
---|
3663 | eval host_file=$host_file |
---|
3664 | fi |
---|
3665 | export MP_HOSTFILE=$host_file |
---|
3666 | poe a.out -procs $numprocs -tasks_per_node $numprocs $ROPTS |
---|
3667 | fi |
---|
3668 | fi |
---|
3669 | elif [[ $host = nech || $host = necriam ]] |
---|
3670 | then |
---|
3671 | (( ii = nodes )) |
---|
3672 | if [[ $ii = 1 ]] |
---|
3673 | then |
---|
3674 | export F_ERRCNT=0 # acceptable number of errors before program is stopped |
---|
3675 | export MPIPROGINF=YES |
---|
3676 | # export F_TRACE=YES|FMT1|FMT2 # output of ftrace informations to job protocol |
---|
3677 | echo "*** execution on single node with mpirun" |
---|
3678 | mpirun -np $numprocs ./a.out $ROPTS |
---|
3679 | else |
---|
3680 | (( i = 0 )) |
---|
3681 | while (( i < ii )) |
---|
3682 | do |
---|
3683 | echo "-h $i -p $tasks_per_node -e ./mpi_exec_shell" >> multinode_config |
---|
3684 | (( i = i + 1 )) |
---|
3685 | done |
---|
3686 | |
---|
3687 | echo "#!/bin/sh" > mpi_exec_shell |
---|
3688 | echo " " >> mpi_exec_shell |
---|
3689 | echo "set -u" >> mpi_exec_shell |
---|
3690 | echo "F_ERRCNT=0" >> mpi_exec_shell |
---|
3691 | echo "MPIPROGINV=YES" >> mpi_exec_shell |
---|
3692 | echo "OMP_NUM_THREADS=$threads_per_task" >> mpi_exec_shell |
---|
3693 | echo "cpurest=$cpurest" >> mpi_exec_shell |
---|
3694 | echo "fname=$fname" >> mpi_exec_shell |
---|
3695 | echo "localhost=$localhost" >> mpi_exec_shell |
---|
3696 | echo "return_addres=$return_addres" >> mpi_exec_shell |
---|
3697 | echo "return_username=$return_username" >> mpi_exec_shell |
---|
3698 | echo "tasks_per_node=$tasks_per_node" >> mpi_exec_shell |
---|
3699 | echo "write_binary=$write_binary" >> mpi_exec_shell |
---|
3700 | echo "use_seperate_pe_for_dvrp_output=$use_seperate_pe_for_dvrp_output" >> mpi_exec_shell |
---|
3701 | echo " " >> mpi_exec_shell |
---|
3702 | echo "export F_ERRCNT" >> mpi_exec_shell |
---|
3703 | echo "export MPIPROGINV" >> mpi_exec_shell |
---|
3704 | echo "export OMP_NUM_THREADS" >> mpi_exec_shell |
---|
3705 | echo "export cpurest" >> mpi_exec_shell |
---|
3706 | echo "export fname" >> mpi_exec_shell |
---|
3707 | echo "export localhost" >> mpi_exec_shell |
---|
3708 | echo "export return_addres" >> mpi_exec_shell |
---|
3709 | echo "export return_username" >> mpi_exec_shell |
---|
3710 | echo "export tasks_per_node" >> mpi_exec_shell |
---|
3711 | echo "export write_binary" >> mpi_exec_shell |
---|
3712 | echo "export use_seperate_pe_for_dvrp_output" >> mpi_exec_shell |
---|
3713 | echo " " >> mpi_exec_shell |
---|
3714 | echo "exec ./a.out" >> mpi_exec_shell |
---|
3715 | |
---|
3716 | chmod u+x mpi_exec_shell |
---|
3717 | export MPIPROGINF=YES |
---|
3718 | mpirun -f multinode_config & |
---|
3719 | wait |
---|
3720 | |
---|
3721 | fi |
---|
3722 | elif [[ $(echo $host | cut -c1-2) = lc && $host != lckyoto && $host != lctit ]] |
---|
3723 | then |
---|
3724 | |
---|
3725 | # COPY HOSTFILE FROM SOURCE DIRECTORY OR CREATE IT, IF IT |
---|
3726 | # DOES NOT EXIST |
---|
3727 | if [[ $host != lcsgih && $host != lcsgib ]] |
---|
3728 | then |
---|
3729 | if [[ -f $hostfile ]] |
---|
3730 | then |
---|
3731 | cp $hostfile hostfile |
---|
3732 | (( ii = $numprocs / $threads_per_task )) |
---|
3733 | else |
---|
3734 | (( ii = 1 )) |
---|
3735 | while (( ii <= $numprocs / $threads_per_task )) |
---|
3736 | do |
---|
3737 | echo $localhost_realname >> hostfile |
---|
3738 | (( ii = ii + 1 )) |
---|
3739 | done |
---|
3740 | fi |
---|
3741 | eval zeile=\"`head -n $ii hostfile`\" |
---|
3742 | printf "\n *** running on: $zeile" |
---|
3743 | fi |
---|
3744 | |
---|
3745 | (( ii = $numprocs / $threads_per_task )) |
---|
3746 | export OMP_NUM_THREADS=$threads_per_task |
---|
3747 | # echo "*** OMP_NUM_THREADS=$OMP_NUM_THREADS" |
---|
3748 | if [[ $threads_per_task != 1 ]] |
---|
3749 | then |
---|
3750 | # increase stack size to unlimited, because large runs |
---|
3751 | # may abort otherwise |
---|
3752 | ulimit -Ss unlimited |
---|
3753 | printf "\n threads per task: $threads_per_task stacksize: unlimited" |
---|
3754 | fi |
---|
3755 | if [[ $run_coupled_model = false ]] |
---|
3756 | then |
---|
3757 | if [[ "$ocean_file_appendix" = true ]] |
---|
3758 | then |
---|
3759 | echo "precursor_ocean" > runfile_atmos |
---|
3760 | else |
---|
3761 | echo "precursor_atmos" > runfile_atmos |
---|
3762 | fi |
---|
3763 | printf "\n\n" |
---|
3764 | if [[ $host = lcsgih || $host = lcsgib ]] |
---|
3765 | then |
---|
3766 | if [[ $( echo $mpilib | cut -c1-3 ) = mpt ]] |
---|
3767 | then |
---|
3768 | # MPI_DSM_DISTRIBUTE not necessary when MPI_DSM_CPULIST is set |
---|
3769 | # export MPI_DSM_DISTRIBUTE=1 |
---|
3770 | # MPI_DSM_CPULIST: pin MPI processes to cores |
---|
3771 | if [[ $use_openmp = false ]] |
---|
3772 | then |
---|
3773 | if [[ "$sgi_feature" = ice2 ]] |
---|
3774 | then |
---|
3775 | export MPI_DSM_CPULIST="0,4,1,5,2,6,3,7:allhosts" |
---|
3776 | else |
---|
3777 | export MPI_DSM_CPULIST="0,1,4,5,2,3,6,7:allhosts" |
---|
3778 | fi |
---|
3779 | else |
---|
3780 | unset MPI_DSM_CPULIST |
---|
3781 | fi |
---|
3782 | # MPI_IB_RAILS: use both IB rails on ICE2 |
---|
3783 | export MPI_BUFS_PER_HOST=512 |
---|
3784 | export MPI_IB_RAILS=2 |
---|
3785 | # NECESSARY, IF MORE THAN 4096 PEs ARE USED |
---|
3786 | export MPI_CONNECTIONS_THRESHOLD=8192 |
---|
3787 | # echo "*** MPI_DSM_CPULIST=$MPI_DSM_CPULIST" |
---|
3788 | export MPI_TYPE_DEPTH=20 |
---|
3789 | # echo "*** MPI_TYPE_DEPTH=$MPI_TYPE_DEPTH" |
---|
3790 | export MPI_GROUP_MAX=64 |
---|
3791 | # echo "*** MPI_GROUP_MAX=$MPI_GROUP_MAX" |
---|
3792 | if [[ $use_openmp = true ]] |
---|
3793 | then |
---|
3794 | echo " mpiexec -npernode $tasks_per_node ./a.out $ROPTS < runfile_atmos" |
---|
3795 | mpiexec -npernode $tasks_per_node $tv_opt ./a.out $ROPTS < runfile_atmos |
---|
3796 | else |
---|
3797 | mpiexec_mpt -np $ii $tv_opt ./a.out $ROPTS < runfile_atmos |
---|
3798 | fi |
---|
3799 | |
---|
3800 | # next is test for openmp usage |
---|
3801 | # echo "mpiexec -npernode $tasks_per_node ./a.out $ROPTS < runfile_atmos" |
---|
3802 | # mpiexec -npernode $tasks_per_node ./a.out $ROPTS < runfile_atmos |
---|
3803 | elif [[ $( echo $mpilib | cut -c1-3 ) = mva ]] |
---|
3804 | then |
---|
3805 | export MV2_NUM_PORTS=2 |
---|
3806 | # The default setting of MV2_CPU_MAPPING gives best results |
---|
3807 | # export MV2_ENABLE_AFFINITY=1 |
---|
3808 | # export MV2_CPU_MAPPING=0,1,4,5,2,3,6,7 |
---|
3809 | # if [[ "$sgi_feature" = ice2 ]] |
---|
3810 | # then |
---|
3811 | # export MV2_CPU_MAPPING=0,4,1,5,2,6,3,7 |
---|
3812 | # else |
---|
3813 | # export MV2_CPU_MAPPING=0,1,4,5,2,3,6,7 |
---|
3814 | # fi |
---|
3815 | if [[ $use_openmp = true ]] |
---|
3816 | then |
---|
3817 | unset MV2_CPU_MAPPING |
---|
3818 | export MV2_ENABLE_AFFINITY=0 |
---|
3819 | fi |
---|
3820 | echo "*** MV2_CPU_MAPPING=$MV2_CPU_MAPPING" |
---|
3821 | echo "*** MV2_ENABLE_AFFINITY=$MV2_ENABLE_AFFINITY" |
---|
3822 | if [[ $use_openmp = true ]] |
---|
3823 | then |
---|
3824 | echo " mpiexec -npernode $tasks_per_node ./a.out $ROPTS < runfile_atmos" |
---|
3825 | mpiexec -npernode $tasks_per_node $tv_opt ./a.out $ROPTS < runfile_atmos |
---|
3826 | else |
---|
3827 | mpiexec -np $ii $tv_opt ./a.out $ROPTS < runfile_atmos |
---|
3828 | fi |
---|
3829 | elif [[ "$mpilib" = impi ]] |
---|
3830 | then |
---|
3831 | echo "mpirun -np $tasks_per_node inspxe-cl -r result -collect mi3 -- ./a.out < runfile_atmos" |
---|
3832 | mpirun -np $tasks_per_node inspxe-cl -r result -collect mi3 -- ./a.out < runfile_atmos |
---|
3833 | fi |
---|
3834 | elif [[ $host = lcxe6 || $host = lcxt5m ]] |
---|
3835 | then |
---|
3836 | aprun -n $ii -N $tasks_per_node a.out $ROPTS < runfile_atmos |
---|
3837 | elif [[ $host = lcflow ]] |
---|
3838 | then |
---|
3839 | mpiexec -machinefile $TMPDIR/machines -n $ii -env I_MPI_FABRICS shm:ofa a.out < runfile_atmos $ROPTS |
---|
3840 | elif [[ $host = lcsb ]] |
---|
3841 | then |
---|
3842 | mpirun_rsh -hostfile $PBS_NODEFILE -np `cat $PBS_NODEFILE | wc -l` a.out < runfile_atmos $ROPTS |
---|
3843 | elif [[ $host = lckiaps ]] |
---|
3844 | then |
---|
3845 | mpirun -np $ii -f $PBS_NODEFILE a.out < runfile_atmos $ROPTS |
---|
3846 | else |
---|
3847 | mpiexec -machinefile hostfile -n $ii a.out < runfile_atmos $ROPTS |
---|
3848 | fi |
---|
3849 | else |
---|
3850 | |
---|
3851 | # currently there is no full MPI-2 support on ICE and XT4 |
---|
3852 | (( iia = $numprocs_atmos / $threads_per_task )) |
---|
3853 | (( iio = $numprocs_ocean / $threads_per_task )) |
---|
3854 | printf "\n coupled run ($iia atmosphere, $iio ocean)" |
---|
3855 | printf "\n using $coupled_mode coupling" |
---|
3856 | printf "\n\n" |
---|
3857 | |
---|
3858 | if [[ $coupled_mode = "mpi2" ]] |
---|
3859 | then |
---|
3860 | echo "atmosphere_to_ocean $iia $iio" > runfile_atmos |
---|
3861 | echo "ocean_to_atmosphere $iia $iio" > runfile_ocean |
---|
3862 | if [[ $host = lcsgih || $host = lcsgib ]] |
---|
3863 | then |
---|
3864 | |
---|
3865 | if [[ $( echo $mpilib | cut -c1-3 ) = mpt ]] |
---|
3866 | then |
---|
3867 | # export MPI_LAUNCH_TIMEOUT=360 |
---|
3868 | mpiexec_mpt -np $iia ./a.out $ROPTS < runfile_atmos & |
---|
3869 | mpiexec_mpt -np $iio ./a.out $ROPTS < runfile_ocean & |
---|
3870 | elif [[ $( echo $mpilib | cut -c1-3 ) = mva ]] |
---|
3871 | then |
---|
3872 | # ulimit -s 300000 # A too large stack size causes problems |
---|
3873 | # export MV2_NUM_PORTS=2 |
---|
3874 | # export MV2_CPU_MAPPING=0:1:2:3 |
---|
3875 | mpiexec -n $iia ./a.out $ROPTS < runfile_atmos & |
---|
3876 | mpiexec -n $iio ./a.out $ROPTS < runfile_ocean & |
---|
3877 | fi |
---|
3878 | |
---|
3879 | elif [[ $host = lcxe6 || $host = lcxt5m ]] |
---|
3880 | then |
---|
3881 | |
---|
3882 | aprun -n $iia -N $tasks_per_node a.out < runfile_atmos $ROPTS & |
---|
3883 | aprun -n $iio -N $tasks_per_node a.out < runfile_ocean $ROPTS & |
---|
3884 | |
---|
3885 | else |
---|
3886 | # WORKAROUND BECAUSE mpiexec WITH -env option IS NOT AVAILABLE ON SOME SYSTEMS |
---|
3887 | mpiexec -machinefile hostfile -n $iia a.out $ROPTS < runfile_atmos & |
---|
3888 | mpiexec -machinefile hostfile -n $iio a.out $ROPTS < runfile_ocean & |
---|
3889 | # mpiexec -machinefile hostfile -n $iia -env coupling_mode atmosphere_to_ocean a.out $ROPTS & |
---|
3890 | # mpiexec -machinefile hostfile -n $iio -env coupling_mode ocean_to_atmosphere a.out $ROPTS & |
---|
3891 | fi |
---|
3892 | wait |
---|
3893 | |
---|
3894 | else |
---|
3895 | |
---|
3896 | echo "coupled_run $iia $iio" > runfile_atmos |
---|
3897 | if [[ $host = lcsgih || $host = lcsgib ]] |
---|
3898 | then |
---|
3899 | |
---|
3900 | if [[ $( echo $mpilib | cut -c1-3 ) = mpt ]] |
---|
3901 | then |
---|
3902 | # export MPI_LAUNCH_TIMEOUT=360 |
---|
3903 | mpiexec_mpt -np $ii ./a.out $ROPTS < runfile_atmos |
---|
3904 | elif [[ $( echo $mpilib | cut -c1-3 ) = mva ]] |
---|
3905 | then |
---|
3906 | # ulimit -s 300000 # A too large stack size causes problems |
---|
3907 | # export MV2_NUM_PORTS=2 |
---|
3908 | # export MV2_CPU_MAPPING=0:1:2:3 |
---|
3909 | mpiexec ./a.out $ROPTS < runfile_atmos |
---|
3910 | fi |
---|
3911 | |
---|
3912 | elif [[ $host = lcxe6 || $host = lcxt5m ]] |
---|
3913 | then |
---|
3914 | |
---|
3915 | aprun -n $ii -N $tasks_per_node a.out < runfile_atmos $ROPTS |
---|
3916 | |
---|
3917 | elif [[ $host = lck || $host = lckordi ]] |
---|
3918 | then |
---|
3919 | mpiexec -n $ii ./a.out $ROPTS < runfile_atmos & |
---|
3920 | fi |
---|
3921 | wait |
---|
3922 | fi |
---|
3923 | |
---|
3924 | fi |
---|
3925 | elif [[ $host = decalpha ]] |
---|
3926 | then |
---|
3927 | dmpirun -np $numprocs a.out $ROPTS |
---|
3928 | elif [[ $host = lckyoto ]] |
---|
3929 | then |
---|
3930 | set -xv |
---|
3931 | export P4_RSHCOMMAND=plesh |
---|
3932 | echo " P4_RSHCOMMAND = $P4_RSHCOMMAND" |
---|
3933 | if [[ "$ENVIRONMENT" = BATCH ]] |
---|
3934 | then |
---|
3935 | if [[ "$cond2" = fujitsu ]] |
---|
3936 | then |
---|
3937 | mpiexec -n $numprocs ./a.out $ROPTS # for fujitsu-compiler |
---|
3938 | elif [[ "cond2" = pgi ]] |
---|
3939 | then |
---|
3940 | mpirun -np $numprocs -machinefile ${QSUB_NODEINF} ./a.out $ROPTS |
---|
3941 | else |
---|
3942 | mpirun_rsh -np $numprocs -hostfile ${QSUB_NODEINF} MV2_USE_SRQ=0 ./a.out ${ROPTS} || /bin/true |
---|
3943 | fi |
---|
3944 | else |
---|
3945 | if [[ "$cond2" = "" ]] |
---|
3946 | then |
---|
3947 | mpiruni_rsh -np $numprocs ./a.out $ROPTS # for intel |
---|
3948 | else |
---|
3949 | mpirun -np $numprocs ./a.out $ROPTS |
---|
3950 | fi |
---|
3951 | fi |
---|
3952 | set +xv |
---|
3953 | elif [[ $host = lctit ]] |
---|
3954 | then |
---|
3955 | export OMP_NUM_THREADS=$threads_per_task |
---|
3956 | echo "OMP_NUM_THREADS=$OMP_NUM_THREADS" |
---|
3957 | if [[ "$threads_per_task" != 1 ]] |
---|
3958 | then |
---|
3959 | export MV2_ENABLE_AFFINITY=0 |
---|
3960 | fi |
---|
3961 | echo "----- PBS_NODEFILE content:" |
---|
3962 | cat $PBS_NODEFILE |
---|
3963 | echo "-----" |
---|
3964 | (( ii = $numprocs / $threads_per_task )) |
---|
3965 | echo "mpirun -np $ii -hostfile $PBS_NODEFILE ./a.out $ROPTS" |
---|
3966 | mpirun -np $ii -hostfile $PBS_NODEFILE ./a.out $ROPTS |
---|
3967 | else |
---|
3968 | mpprun -n $numprocs a.out $ROPTS |
---|
3969 | fi |
---|
3970 | [[ $? != 0 ]] && execution_error=true |
---|
3971 | |
---|
3972 | |
---|
3973 | # PERFORMANCE-AUSWERTUNG MIT APPRENTICE |
---|
3974 | if [[ "$cond1" = apprentice || "$cond2" = apprentice ]] |
---|
3975 | then |
---|
3976 | apprentice |
---|
3977 | fi |
---|
3978 | else |
---|
3979 | a.out $ROPTS |
---|
3980 | fi |
---|
3981 | fi |
---|
3982 | if [[ $? != 0 || $execution_error = true ]] |
---|
3983 | then |
---|
3984 | |
---|
3985 | # ABBRUCH BEI LAUFZEITFEHLER |
---|
3986 | # [[ ! ( "$cond1" = debug || "$cond2" = debug ) ]] && cat aout_output* |
---|
3987 | printf "\n +++ runtime error occured" |
---|
3988 | locat=execution |
---|
3989 | exit |
---|
3990 | else |
---|
3991 | # [[ ! ( "$cond1" = debug || "$cond2" = debug ) ]] && cat aout_output* |
---|
3992 | printf "\n$striche\n *** execution finished \n" |
---|
3993 | |
---|
3994 | # Stop the dvr streaming server and process the dvr output in order |
---|
3995 | # to create dvrs- and html-files containing all streams |
---|
3996 | if [[ "$dvrserver_id" != "" ]] |
---|
3997 | then |
---|
3998 | kill $dvrserver_id |
---|
3999 | printf "\n *** dvr server with id=$dvrserver_id has been stopped" |
---|
4000 | |
---|
4001 | # If there is a directory, data have been output by the |
---|
4002 | # streaming server. Otherwise, user has chosen dvrp_output=local |
---|
4003 | if [[ -d DATA_DVR ]] |
---|
4004 | then |
---|
4005 | |
---|
4006 | # Add the current dvr configuration file to the dvr output |
---|
4007 | # directory |
---|
4008 | cp .dvrserver.config DATA_DVR |
---|
4009 | |
---|
4010 | # Process the dvr output (option -s for also generating |
---|
4011 | # sequence mode data) |
---|
4012 | process_dvr_output -d DATA_DVR -f $fname -s |
---|
4013 | |
---|
4014 | else |
---|
4015 | |
---|
4016 | # Process the local output |
---|
4017 | process_dvr_output -l -d DATA_DVR -f $fname |
---|
4018 | |
---|
4019 | fi |
---|
4020 | |
---|
4021 | elif [[ $(echo $package_list | grep -c dvrp_graphics) != 0 ]] |
---|
4022 | then |
---|
4023 | |
---|
4024 | # Process dvr output generated in local mode (dvrp_output=local) |
---|
4025 | process_dvr_output -l -d DATA_DVR -f $fname |
---|
4026 | |
---|
4027 | fi |
---|
4028 | fi |
---|
4029 | |
---|
4030 | |
---|
4031 | |
---|
4032 | # Call of combine_plot_fields in order to merge single files written |
---|
4033 | # by each PE into one file. |
---|
4034 | if [[ ! -f ${PALM_BIN}/combine_plot_fields${block}.x ]] |
---|
4035 | then |
---|
4036 | printf "\n\n\n +++ WARNING: no combine_plot_fields found for given block \"$cond1 $cond2\"" |
---|
4037 | printf "\n 2d- and/or 3d-data may be incomplete!" |
---|
4038 | printf "\n Run \"mbuild -u -h $localhost\" to generate utilities for this block.\n" |
---|
4039 | elif [[ "$combine_plot_fields" == true ]] |
---|
4040 | then |
---|
4041 | printf "\n\n\n *** post-processing: now executing \"combine_plot_fields${block}.x\" ..." |
---|
4042 | combine_plot_fields${block}.x |
---|
4043 | else |
---|
4044 | # Temporary solution to skip combine_plot_fields. This is necessary in case of huge amount of |
---|
4045 | # data output. To do: extend this branch by creating a batch job for combine_plot_fields. |
---|
4046 | printf "\n\n\n *** post-processing: skipping combine_plot_fields (-Z option set) ..." |
---|
4047 | fi |
---|
4048 | |
---|
4049 | |
---|
4050 | |
---|
4051 | # EVENTUELLE OUTPUT-KOMMANDOS ABARBEITEN |
---|
4052 | (( i = 0 )) |
---|
4053 | while (( i < ioc )) |
---|
4054 | do |
---|
4055 | (( i = i + 1 )) |
---|
4056 | if (( i == 1 )) |
---|
4057 | then |
---|
4058 | printf "\n\n *** execution of OUTPUT-commands:\n$striche" |
---|
4059 | fi |
---|
4060 | printf "\n >>> ${out_command[$i]}" |
---|
4061 | eval ${out_command[$i]} |
---|
4062 | if (( i == ioc )) |
---|
4063 | then |
---|
4064 | printf "\n$striche\n" |
---|
4065 | fi |
---|
4066 | done |
---|
4067 | |
---|
4068 | |
---|
4069 | # EVTL. INHALT DES AKTUELLEN VERZEICHNISSES AUSGEBEN |
---|
4070 | if [[ $do_trace = true ]] |
---|
4071 | then |
---|
4072 | printf "\n\n" |
---|
4073 | ls -al |
---|
4074 | fi |
---|
4075 | |
---|
4076 | |
---|
4077 | |
---|
4078 | # OUTPUT-DATEIEN AN IHRE ZIELORTE KOPIEREN |
---|
4079 | (( i = 0 )) |
---|
4080 | while (( i < iout )) |
---|
4081 | do |
---|
4082 | (( i = i + 1 )) |
---|
4083 | if (( i == 1 )) |
---|
4084 | then |
---|
4085 | printf "\n\n *** saving OUTPUT-files:\n$striche" |
---|
4086 | fi |
---|
4087 | |
---|
4088 | # PRUEFEN, OB EINZELDATEI ODER DATEI PRO PROZESSOR |
---|
4089 | files_for_pes=false; filetyp=file |
---|
4090 | if [[ "${actionout[$i]}" = pe && -n $numprocs ]] |
---|
4091 | then |
---|
4092 | files_for_pes=true; filetyp=directory |
---|
4093 | actionout[$i]="" |
---|
4094 | elif [[ "${actionout[$i]}" = pe && ! -n $numprocs ]] |
---|
4095 | then |
---|
4096 | actionout[$i]="" |
---|
4097 | elif [[ "${actionout[$i]}" = arpe && -n $numprocs ]] |
---|
4098 | then |
---|
4099 | files_for_pes=true; filetyp=directory |
---|
4100 | actionout[$i]="ar" |
---|
4101 | elif [[ "${actionout[$i]}" = arpe && ! -n $numprocs ]] |
---|
4102 | then |
---|
4103 | actionout[$i]="ar" |
---|
4104 | elif [[ "${actionout[$i]}" = flpe && -n $numprocs ]] |
---|
4105 | then |
---|
4106 | files_for_pes=true; filetyp=directory |
---|
4107 | actionout[$i]="fl" |
---|
4108 | elif [[ "${actionout[$i]}" = flpe && ! -n $numprocs ]] |
---|
4109 | then |
---|
4110 | actionout[$i]="fl" |
---|
4111 | elif [[ "${actionout[$i]}" = trpe && -n $numprocs ]] |
---|
4112 | then |
---|
4113 | files_for_pes=true; filetyp=directory |
---|
4114 | actionout[$i]="tr" |
---|
4115 | elif [[ "${actionout[$i]}" = trpe && ! -n $numprocs ]] |
---|
4116 | then |
---|
4117 | actionout[$i]="tr" |
---|
4118 | fi |
---|
4119 | |
---|
4120 | if [[ ! -f ${localout[$i]} && $files_for_pes = false ]] |
---|
4121 | then |
---|
4122 | printf "\n +++ temporary OUTPUT-file ${localout[$i]} does not exist\n" |
---|
4123 | elif [[ ! -d ${localout[$i]} && $files_for_pes = true ]] |
---|
4124 | then |
---|
4125 | printf "\n +++ temporary OUTPUT-file ${localout[$i]}/.... does not exist\n" |
---|
4126 | else |
---|
4127 | |
---|
4128 | |
---|
4129 | # KOPIEREN PER FTP/SCP (IMMER IM BINAERMODUS, -M: FALLS ZIELKATALOG |
---|
4130 | # NICHT VORHANDEN, WIRD VERSUCHT, IHN ANZULEGEN), ABER NUR BEI |
---|
4131 | # REMOTE-RECHNUNGEN |
---|
4132 | if [[ "${actionout[$i]}" = tr ]] |
---|
4133 | then |
---|
4134 | if [[ $localhost != $fromhost ]] |
---|
4135 | then |
---|
4136 | if [[ $files_for_pes = false ]] |
---|
4137 | then |
---|
4138 | cps="" |
---|
4139 | cst="" |
---|
4140 | else |
---|
4141 | cps=-c |
---|
4142 | cst="/" |
---|
4143 | fi |
---|
4144 | if [[ $localhost = nech ]] |
---|
4145 | then |
---|
4146 | |
---|
4147 | # TRANSFER IN EIGENSTAENDIGEM JOB |
---|
4148 | # ZUERST KOPIE DER DATEI INS TEMPORAERE DATENVERZEICHNIS |
---|
4149 | [[ ! -d $tmp_data_catalog/TRANSFER ]] && mkdir -p $tmp_data_catalog/TRANSFER |
---|
4150 | file_to_transfer=${fname}_${localout[$i]}_to_transfer_$kennung |
---|
4151 | if [[ $files_for_pes = false ]] |
---|
4152 | then |
---|
4153 | ln -f ${localout[$i]} $tmp_data_catalog/TRANSFER/$file_to_transfer |
---|
4154 | else |
---|
4155 | mkdir $tmp_data_catalog/TRANSFER/$file_to_transfer |
---|
4156 | ln ${localout[$i]}/* $tmp_data_catalog/TRANSFER/$file_to_transfer |
---|
4157 | fi |
---|
4158 | |
---|
4159 | echo "set -x" > transfer_${localout[$i]} |
---|
4160 | echo "cd $tmp_data_catalog/TRANSFER" >> transfer_${localout[$i]} |
---|
4161 | |
---|
4162 | printf "\n >>> OUTPUT: ${localout[$i]}$cst by SCP in seperate job to" |
---|
4163 | printf "\n ${pathout[$i]}/${localhost}_${fname}${endout[$i]}$cst" |
---|
4164 | printf "\n or higher cycle\n" |
---|
4165 | echo "batch_scp $cps -b -m -u $return_username $return_addres $file_to_transfer \"${pathout[$i]}\" ${localhost}_${fname}${endout[$i]} ${extout[$i]}" >> transfer_${localout[$i]} |
---|
4166 | |
---|
4167 | echo "[[ \$? = 0 ]] && rm $file_to_transfer" >> transfer_${localout[$i]} |
---|
4168 | |
---|
4169 | if [[ $localhost = nech ]] |
---|
4170 | then |
---|
4171 | subjob -d -c /pf/b/$usern/job_queue -v -q pp -X 0 -m 1000 -t 900 transfer_${localout[$i]} |
---|
4172 | else |
---|
4173 | if [[ "$LOGNAME" = b323013 ]] |
---|
4174 | then |
---|
4175 | subjob -v -q c1 -X 0 -m 1000 -t 900 -c $job_catalog transfer_${localout[$i]} |
---|
4176 | else |
---|
4177 | subjob -d -v -q c1 -X 0 -m 1000 -t 900 -c $job_catalog transfer_${localout[$i]} |
---|
4178 | fi |
---|
4179 | fi |
---|
4180 | |
---|
4181 | else |
---|
4182 | |
---|
4183 | # TRANSFER INNERHALB DIESES JOBS |
---|
4184 | transfer_failed=false |
---|
4185 | printf "\n >>> OUTPUT: ${localout[$i]}$cst by SCP to" |
---|
4186 | printf "\n ${pathout[$i]}/${localhost}_${fname}${endout[$i]}$cst\n" |
---|
4187 | batch_scp $cps -b -m -u $return_username $return_addres ${localout[$i]} "${pathout[$i]}" ${localhost}_${fname}${endout[$i]} ${extout[$i]} |
---|
4188 | [[ $? != 0 ]] && transfer_failed=true |
---|
4189 | |
---|
4190 | # BEI FEHLGESCHLAGENEM TRANSFER SICHERUNGSKOPIE AUF |
---|
4191 | # LOKALER MASCHINE ANLEGEN |
---|
4192 | if [[ $transfer_failed = true ]] |
---|
4193 | then |
---|
4194 | printf " +++ transfer failed. Trying to save a copy on the local host under:\n" |
---|
4195 | printf " ${pathout[$i]}/${localhost}_${fname}${endout[$i]}_$kennung\n" |
---|
4196 | |
---|
4197 | # ERSTMAL PRUEFEN, OB VERZEICHNIS EXISTIERT. GEGEBENENFALLS |
---|
4198 | # ANLEGEN. |
---|
4199 | eval local_catalog=${pathout[$i]} |
---|
4200 | if [[ ! -d $local_catalog ]] |
---|
4201 | then |
---|
4202 | printf " *** local directory does not exist. Trying to create:\n" |
---|
4203 | printf " $local_catalog \n" |
---|
4204 | mkdir -p $local_catalog |
---|
4205 | fi |
---|
4206 | eval cp ${localout[$i]} ${pathout[$i]}/${localhost}_${fname}${endout[$i]}_$kennung |
---|
4207 | transfer_problems=true |
---|
4208 | fi |
---|
4209 | fi |
---|
4210 | else |
---|
4211 | |
---|
4212 | # WERTZUWEISUNG, SO DASS WEITER UNTEN NUR KOPIERT WIRD |
---|
4213 | actionout[$i]="" |
---|
4214 | fi |
---|
4215 | fi |
---|
4216 | |
---|
4217 | |
---|
4218 | # APPEND PER FTP/SCP (IMMER IM BINAERMODUS, -M: FALLS ZIELKATALOG |
---|
4219 | # NICHT VORHANDEN, WIRD VERSUCHT, IHN ANZULEGEN), ABER NUR BEI |
---|
4220 | # REMOTE-RECHNUNGEN |
---|
4221 | if [[ "${actionout[$i]}" = tra ]] |
---|
4222 | then |
---|
4223 | if [[ $localhost != $fromhost ]] |
---|
4224 | then |
---|
4225 | if [[ $localhost = ibmh || $localhost = nech ]] |
---|
4226 | then |
---|
4227 | |
---|
4228 | # TRANSFER IN EIGENSTAENDIGEM JOB |
---|
4229 | # ZUERST KOPIE DER DATEI INS TEMPORAERE DATENVERZEICHNIS |
---|
4230 | [[ ! -d $tmp_data_catalog/TRANSFER ]] && mkdir -p $tmp_data_catalog/TRANSFER |
---|
4231 | file_to_transfer=${fname}_${localout[$i]}_to_transfer_$kennung |
---|
4232 | ln -f ${localout[$i]} $tmp_data_catalog/TRANSFER/$file_to_transfer |
---|
4233 | |
---|
4234 | echo "set -x" > transfer_${localout[$i]} |
---|
4235 | echo "cd $tmp_data_catalog/TRANSFER" >> transfer_${localout[$i]} |
---|
4236 | |
---|
4237 | printf "\n >>> OUTPUT: ${localout[$i]} append by SCP in seperate job to" |
---|
4238 | printf "\n ${pathout[$i]}/${localhost}_${fname}${endout[$i]}" |
---|
4239 | printf "\n or higher cycle\n" |
---|
4240 | echo "batch_scp -A -b -m -u $return_username $return_addres $file_to_transfer \"${pathout[$i]}\" ${localhost}_${fname}${endout[$i]} ${extout[$i]}" >> transfer_${localout[$i]} |
---|
4241 | |
---|
4242 | echo "[[ \$? = 0 ]] && rm $file_to_transfer" >> transfer_${localout[$i]} |
---|
4243 | |
---|
4244 | if [[ $localhost = nech ]] |
---|
4245 | then |
---|
4246 | subjob -d -c /pf/b/$usern/job_queue -v -q pp -X 0 -m 1000 -t 900 transfer_${localout[$i]} |
---|
4247 | else |
---|
4248 | if [[ $LOGNAME = b323013 ]] |
---|
4249 | then |
---|
4250 | subjob -v -q c1 -X 0 -m 1000 -t 900 -c $job_catalog transfer_${localout[$i]} |
---|
4251 | else |
---|
4252 | subjob -d -v -q c1 -X 0 -m 1000 -t 900 -c $job_catalog transfer_${localout[$i]} |
---|
4253 | fi |
---|
4254 | fi |
---|
4255 | |
---|
4256 | else |
---|
4257 | |
---|
4258 | # TRANSFER INNERHALB DIESES JOBS |
---|
4259 | transfer_failed=false |
---|
4260 | printf "\n >>> OUTPUT: ${localout[$i]} append by SCP to" |
---|
4261 | printf "\n ${pathout[$i]}/${localhost}_${fname}${endout[$i]}\n" |
---|
4262 | batch_scp -A -b -m -u $return_username $return_addres ${localout[$i]} "${pathout[$i]}" ${localhost}_${fname}${endout[$i]} ${extout[$i]} |
---|
4263 | [[ $? != 0 ]] && transfer_failed=true |
---|
4264 | |
---|
4265 | # BEI FEHLGESCHLAGENEM TRANSFER SICHERUNGSKOPIE AUF |
---|
4266 | # LOKALER MASCHINE ANLEGEN |
---|
4267 | if [[ $transfer_failed = true ]] |
---|
4268 | then |
---|
4269 | printf " +++ transfer failed. Trying to save a copy on the local host under:\n" |
---|
4270 | printf " ${pathout[$i]}/${localhost}_${fname}${endout[$i]}_$kennung\n" |
---|
4271 | |
---|
4272 | # ERSTMAL PRUEFEN, OB VERZEICHNIS EXISTIERT. GEGEBENENFALLS |
---|
4273 | # ANLEGEN |
---|
4274 | eval local_catalog=${pathout[$i]} |
---|
4275 | if [[ ! -d $local_catalog ]] |
---|
4276 | then |
---|
4277 | printf " *** local directory does not exist. Trying to create:\n" |
---|
4278 | printf " $local_catalog \n" |
---|
4279 | mkdir -p $local_catalog |
---|
4280 | fi |
---|
4281 | |
---|
4282 | eval cp ${localout[$i]} ${pathout[$i]}/${localhost}_${fname}${endout[$i]}_$kennung |
---|
4283 | transfer_problems=true |
---|
4284 | fi |
---|
4285 | fi |
---|
4286 | else |
---|
4287 | |
---|
4288 | # WERTZUWEISUNG, SO DASS WEITER UNTEN NUR APPEND AUF |
---|
4289 | # LOKALER MASCHINE DURCHGEFUEHRT WIRD |
---|
4290 | actionout[$i]=a |
---|
4291 | fi |
---|
4292 | fi |
---|
4293 | |
---|
4294 | |
---|
4295 | # OUTPUT-DATEI FUER EINEN FORTSETZUNGSLAUF. DATEI WIRD PER |
---|
4296 | # LINK AUF DEN TEMPORAEREN DATENKATALOG GELEGT. OPTION -f WIRD |
---|
4297 | # VERWENDET, FALLS DORT NOCH EINE DATEI GLEICHEN NAMENS VORHANDEN |
---|
4298 | # SEIN SOLLTE. ANSCHLIESSEND WIRD SEINE ARCHIVIERUNG ANGESTOSSEN |
---|
4299 | if [[ "${actionout[$i]}" = fl ]] |
---|
4300 | then |
---|
4301 | [[ ! -d $tmp_data_catalog ]] && mkdir -p $tmp_data_catalog |
---|
4302 | chmod g+rx $tmp_data_catalog |
---|
4303 | if [[ $files_for_pes = false ]] |
---|
4304 | then |
---|
4305 | printf "\n >>> OUTPUT: ${localout[$i]} to" |
---|
4306 | printf "\n $tmp_data_catalog/${frelout[$i]} (temporary data catalog)\n" |
---|
4307 | ln -f ${localout[$i]} $tmp_data_catalog/${frelout[$i]} |
---|
4308 | else |
---|
4309 | printf "\n >>> OUTPUT: ${localout[$i]}/.... to" |
---|
4310 | printf "\n $tmp_data_catalog/${frelout[$i]} (temporary data catalog)\n" |
---|
4311 | mkdir $tmp_data_catalog/${frelout[$i]} |
---|
4312 | cd ${localout[$i]} |
---|
4313 | for file in $(ls *) |
---|
4314 | do |
---|
4315 | ln -f $file $tmp_data_catalog/${frelout[$i]} |
---|
4316 | done |
---|
4317 | cd $TEMPDIR |
---|
4318 | fi |
---|
4319 | |
---|
4320 | |
---|
4321 | # ARCHIVIERUNGSJOB WIRD ERZEUGT UND ABGESCHICKT |
---|
4322 | if [[ $store_on_archive_system = true ]] |
---|
4323 | then |
---|
4324 | |
---|
4325 | if [[ $archive_system = asterix ]] |
---|
4326 | then |
---|
4327 | echo "cd $tmp_data_catalog" >> archive_${frelout[$i]} |
---|
4328 | if [[ $files_for_pes = false ]] |
---|
4329 | then |
---|
4330 | echo "stageout ${frelout[$i]} > STAGE_OUTPUT${i}_$kennung" >> archive_${frelout[$i]} |
---|
4331 | else |
---|
4332 | echo "stageout -t ${frelout[$i]} > STAGE_OUTPUT${i}_$kennung" >> archive_${frelout[$i]} |
---|
4333 | fi |
---|
4334 | echo "cat STAGE_OUTPUT${i}_$kennung" >> archive_${frelout[$i]} |
---|
4335 | echo "if [[ \$(grep -c \"st.msg:150\" STAGE_OUTPUT${i}_$kennung) != 0 ]]" >> archive_${frelout[$i]} |
---|
4336 | echo "then" >> archive_${frelout[$i]} |
---|
4337 | echo " do_stageout=false" >> archive_${frelout[$i]} |
---|
4338 | echo "else" >> archive_${frelout[$i]} |
---|
4339 | echo " echo \" +++ $filetyp ${frelout[$i]} could not be stored on archive-system\" " >> archive_${frelout[$i]} |
---|
4340 | echo " cat /dev/null > ~/job_queue/ARCHIVE_ERROR_$fname" >> archive_${frelout[$i]} |
---|
4341 | echo " cat STAGE_OUTPUT${i}_$kennung > ~/job_queue/archive_${frelout[$i]}_error" >> archive_${frelout[$i]} |
---|
4342 | echo " echo \" *** $filetyp ${frelout[$i]} will be copied to \$WORK as backup\" " >> archive_${frelout[$i]} |
---|
4343 | if [[ $files_for_pes = false ]] |
---|
4344 | then |
---|
4345 | echo " cp ${frelout[$i]} \$WORK" >> archive_${frelout[$i]} |
---|
4346 | else |
---|
4347 | echo " cp -r ${frelout[$i]} \$WORK/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
4348 | fi |
---|
4349 | echo " echo \" *** $filetyp ${frelout[$i]} saved\" " >> archive_${frelout[$i]} |
---|
4350 | echo "fi" >> archive_${frelout[$i]} |
---|
4351 | echo "rm STAGE_OUTPUT${i}_$kennung" >> archive_${frelout[$i]} |
---|
4352 | elif [[ $archive_system = DMF ]] |
---|
4353 | then |
---|
4354 | echo "cd $tmp_data_catalog" >> archive_${frelout[$i]} |
---|
4355 | if [[ $files_for_pes = false ]] |
---|
4356 | then |
---|
4357 | printf "\n +++ archiving of single files impossible with $archive_system !\n" |
---|
4358 | locat=DMF |
---|
4359 | exit |
---|
4360 | else |
---|
4361 | # FUER RECHNER IN JUELICH. DORT KOENNTEN AUCH |
---|
4362 | # EINZELNE DATEIEN GESICHERT WERDEN (SPAETER KORR.) |
---|
4363 | echo "rm -rf \$ARCHIVE/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
4364 | echo "cp -r ${frelout[$i]} \$ARCHIVE" >> archive_${frelout[$i]} |
---|
4365 | fi |
---|
4366 | elif [[ $archive_system = tivoli ]] |
---|
4367 | then |
---|
4368 | echo "cd $tmp_data_catalog" >> archive_${frelout[$i]} |
---|
4369 | if [[ $files_for_pes = false ]] |
---|
4370 | then |
---|
4371 | # EVENTUELL NOCH VORHANDENE DATEI IM ARCHIV LOSCHEN |
---|
4372 | echo "set -x" >> archive_${frelout[$i]} |
---|
4373 | echo "rm -rf \$PERM/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
4374 | echo "cp ${frelout[$i]} \$PERM/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
4375 | else |
---|
4376 | |
---|
4377 | echo "set -x" >> archive_${frelout[$i]} |
---|
4378 | echo "rm -rf \$PERM/${frelout[$i]}/*" >> archive_${frelout[$i]} |
---|
4379 | echo "[[ ! -d \$PERM/${frelout[$i]} ]] && mkdir $PERM/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
4380 | cd $tmp_data_catalog |
---|
4381 | all_files=`ls -1 ${frelout[$i]}/*` |
---|
4382 | cd - > /dev/null |
---|
4383 | (( inode = 0 )) |
---|
4384 | (( tp1 = tasks_per_node + 1 )) |
---|
4385 | while (( inode < nodes )) |
---|
4386 | do |
---|
4387 | # echo "*** all_files = \"$all_files\" " |
---|
4388 | files=`echo $all_files | cut -d" " -f1-$tasks_per_node` |
---|
4389 | all_files=`echo $all_files | cut -d" " -f$tp1-` |
---|
4390 | # echo "*** tasks_per_node = \"$tasks_per_node\" " |
---|
4391 | # echo "*** files = \"$files\" " |
---|
4392 | # echo "*** all_files = \"$all_files\" " |
---|
4393 | echo "tar cvf \$PERM/${frelout[$i]}/${frelout[$i]}.node_$inode.tar $files" >> archive_${frelout[$i]} |
---|
4394 | ### echo "tar cvf ${frelout[$i]}.node_$inode.tar $files" >> archive_${frelout[$i]} |
---|
4395 | ### echo "cp ${frelout[$i]}.node_$inode.tar \$PERM/${frelout[$i]}/" >> archive_${frelout[$i]} |
---|
4396 | ###echo "rm ${frelout[$i]}.node_$inode.tar" >> archive_${frelout[$i]} |
---|
4397 | # echo "dsmc incremental \$PERM/${frelout[$i]}/${frelout[$i]}.node_$inode.tar" >> archive_${frelout[$i]} |
---|
4398 | # echo "dsmmigrate \$PERM/${frelout[$i]}/${frelout[$i]}.node_$inode.tar" >> archive_${frelout[$i]} |
---|
4399 | (( inode = inode + 1 )) |
---|
4400 | done |
---|
4401 | # echo "rm -rf \$PERM/${frelout[$i]}.tar" >> archive_${frelout[$i]} |
---|
4402 | # echo "tar cvf \$PERM/${frelout[$i]}.tar ${frelout[$i]}" >> archive_${frelout[$i]} |
---|
4403 | fi |
---|
4404 | elif [[ $archive_system = ut ]] |
---|
4405 | then |
---|
4406 | echo "cd $tmp_data_catalog" >> archive_${frelout[$i]} |
---|
4407 | if [[ $files_for_pes = false ]] |
---|
4408 | then |
---|
4409 | # EVENTUELL NOCH VORHANDENE DATEI IM ARCHIV LOSCHEN |
---|
4410 | echo "set -x" >> archive_${frelout[$i]} |
---|
4411 | echo "rm -rf \$UT/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
4412 | echo "cp ${frelout[$i]} \$UT/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
4413 | else |
---|
4414 | |
---|
4415 | echo "set -x" >> archive_${frelout[$i]} |
---|
4416 | echo "rm -rf \$UT/${frelout[$i]}/*" >> archive_${frelout[$i]} |
---|
4417 | echo "[[ ! -d \$UT/${frelout[$i]} ]] && mkdir $UT/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
4418 | cd $tmp_data_catalog |
---|
4419 | all_files=`ls -1 ${frelout[$i]}/*` |
---|
4420 | cd - > /dev/null |
---|
4421 | (( inode = 0 )) |
---|
4422 | (( tp1 = tasks_per_node + 1 )) |
---|
4423 | while (( inode < nodes )) |
---|
4424 | do |
---|
4425 | files=`echo $all_files | cut -d" " -f1-$tasks_per_node` |
---|
4426 | all_files=`echo $all_files | cut -d" " -f$tp1-` |
---|
4427 | echo "tar cvf \$UT/${frelout[$i]}/${frelout[$i]}.node_$inode.tar $files" >> archive_${frelout[$i]} |
---|
4428 | (( inode = inode + 1 )) |
---|
4429 | done |
---|
4430 | fi |
---|
4431 | elif [[ $archive_system = none ]] |
---|
4432 | then |
---|
4433 | printf " +++ archiving on $localhost not available!\n" |
---|
4434 | fi |
---|
4435 | |
---|
4436 | if [[ $archive_system != none ]] |
---|
4437 | then |
---|
4438 | if [[ $localhost = lcsgih || $localhost = lcsgib ]] |
---|
4439 | then |
---|
4440 | # subjob -d -v -q cdata -X 0 -m 1000 -t 43200 -c $job_catalog archive_${frelout[$i]} |
---|
4441 | subjob -v -q permq -X 1 -T 1 -m 1000 -t 172800 -c $job_catalog archive_${frelout[$i]} |
---|
4442 | elif [[ $localhost = nech ]] |
---|
4443 | then |
---|
4444 | subjob -d -c /pf/b/$usern/job_queue -v -q pp -X 0 -m 1000 -t 7200 archive_${frelout[$i]} |
---|
4445 | fi |
---|
4446 | printf " Archiving of $tmp_data_catalog/${frelout[$i]} initiated (batch job submitted)\n" |
---|
4447 | fi |
---|
4448 | else |
---|
4449 | printf " +++ caution: option -A is switched off. No archiving on $archive_system!\n" |
---|
4450 | fi |
---|
4451 | |
---|
4452 | |
---|
4453 | # LEERDATEI IM BENUTZERVERZEICHNIS ANLEGEN, DAMIT BEKANNT IST, |
---|
4454 | # WIE DIE HOECHSTE ZYKLUSNUMMER AUF DEM ARCHIV-SYSTEM LAUTET |
---|
4455 | if [[ $files_for_pes = false ]] |
---|
4456 | then |
---|
4457 | cat /dev/null > ${pathout[$i]} |
---|
4458 | else |
---|
4459 | mkdir -p ${pathout[$i]} |
---|
4460 | fi |
---|
4461 | |
---|
4462 | fi |
---|
4463 | |
---|
4464 | |
---|
4465 | # KOPIEREN AUF LOKALER MASCHINE ZUM ARCHIV-SYSTEM |
---|
4466 | # AUSSERDEM MUSS LEERDATEI ANGELEGT WERDEN, DAMIT BEKANNT IST, |
---|
4467 | # WIE DIE HOECHSTE ZYKLUSNUMMER AUF DEM ARCHIV-SYSTEM LAUTET |
---|
4468 | # FALLS IRGENDEINE (VON MEHREREN) ARCHIVIERUNGEN SCHIEF GEHT, |
---|
4469 | # WIRD FLAG GESETZT UND BLEIBT AUCH BEI WEITEREN ORDNUNGS- |
---|
4470 | # GEMAESSEN ARCHIVIERUNGEN GESETZT |
---|
4471 | if [[ "${actionout[$i]}" = ar ]] |
---|
4472 | then |
---|
4473 | if [[ $files_for_pes = false ]] |
---|
4474 | then |
---|
4475 | printf "\n >>> OUTPUT: ${localout[$i]} to" |
---|
4476 | printf "\n ${pathout[$i]}" |
---|
4477 | printf "\n File will be copied to archive-system ($archive_system) !\n" |
---|
4478 | else |
---|
4479 | printf "\n >>> OUTPUT: ${localout[$i]}/_.... to" |
---|
4480 | printf "\n ${pathout[$i]}" |
---|
4481 | printf "\n Directory will be copied to archive-system ($archive_system) !\n" |
---|
4482 | fi |
---|
4483 | mv ${localout[$i]} ${frelout[$i]} |
---|
4484 | |
---|
4485 | file_saved=false |
---|
4486 | |
---|
4487 | if [[ $archive_system = asterix ]] |
---|
4488 | then |
---|
4489 | do_stageout=true |
---|
4490 | (( stageout_anz = 0 )) |
---|
4491 | while [[ $do_stageout = true ]] |
---|
4492 | do |
---|
4493 | if [[ $files_for_pes = false ]] |
---|
4494 | then |
---|
4495 | stageout ${frelout[$i]} > STAGE_OUTPUT |
---|
4496 | else |
---|
4497 | stageout -t ${frelout[$i]} > STAGE_OUTPUT |
---|
4498 | fi |
---|
4499 | cat STAGE_OUTPUT |
---|
4500 | if [[ $(grep -c "st.msg:150" STAGE_OUTPUT) != 0 ]] |
---|
4501 | then |
---|
4502 | file_saved=true |
---|
4503 | do_stageout=false |
---|
4504 | else |
---|
4505 | if [[ $files_for_pes = false ]] |
---|
4506 | then |
---|
4507 | printf "\n +++ file ${frelout[$i]} could not be saved on archive-system" |
---|
4508 | else |
---|
4509 | printf "\n +++ directory ${frelout[$i]} could not be saved on archive-system" |
---|
4510 | fi |
---|
4511 | (( stageout_anz = stageout_anz + 1 )) |
---|
4512 | if (( stageout_anz == 10 )) |
---|
4513 | then |
---|
4514 | printf "\n +++ stoped after 10 unsuccessful tries!" |
---|
4515 | archive_save=false |
---|
4516 | do_stageout=false |
---|
4517 | else |
---|
4518 | printf "\n *** new try to store on archive after 15 min:" |
---|
4519 | sleep 900 |
---|
4520 | fi |
---|
4521 | fi |
---|
4522 | done |
---|
4523 | elif [[ $archive_system = DMF ]] |
---|
4524 | then |
---|
4525 | if [[ $files_for_pes = false ]] |
---|
4526 | then |
---|
4527 | printf "\n +++ archiving of single files impossible on $archive_system!\n" |
---|
4528 | locat=DMF |
---|
4529 | exit |
---|
4530 | else |
---|
4531 | rm -rf $ARCHIVE/${frelout[$i]} |
---|
4532 | cp -r ${frelout[$i]} $ARCHIVE |
---|
4533 | fi |
---|
4534 | file_saved=true |
---|
4535 | elif [[ $archive_system = tivoli ]] |
---|
4536 | then |
---|
4537 | # ARCHIVIERUNG NUR PER BATCH-JOB MOEGLICH |
---|
4538 | # DATEI MUSS ZWISCHENZEITLICH INS TEMPORAERE DATENVERZEICHNIS |
---|
4539 | # GELEGT WERDEN |
---|
4540 | [[ ! -d $tmp_data_catalog ]] && mkdir -p $tmp_data_catalog |
---|
4541 | chmod g+rx $tmp_data_catalog |
---|
4542 | if [[ $files_for_pes = false ]] |
---|
4543 | then |
---|
4544 | ln -f ${frelout[$i]} $tmp_data_catalog/${frelout[$i]} |
---|
4545 | else |
---|
4546 | mkdir $tmp_data_catalog/${frelout[$i]} |
---|
4547 | ln -f ${frelout[$i]}/* $tmp_data_catalog/${frelout[$i]} |
---|
4548 | fi |
---|
4549 | |
---|
4550 | # BATCH JOB GENERIEREN UND ABSCHICKEN; DATEI MUSS WIEDER |
---|
4551 | # AUS TEMPORAEREM DATENVERZEICHNIS ENTFERNT WERDEN |
---|
4552 | echo "cd $tmp_data_catalog" > archive_${frelout[$i]} |
---|
4553 | if [[ $files_for_pes = false ]] |
---|
4554 | then |
---|
4555 | # EVENTUELL NOCH VORHANDENE DATEI IM ARCHIV LOSCHEN |
---|
4556 | echo "rm -rf \$PERM/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
4557 | echo "cp ${frelout[$i]} \$PERM/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
4558 | echo "rm -rf ${frelout[$i]}" >> archive_${frelout[$i]} |
---|
4559 | else |
---|
4560 | echo "rm -rf \$PERM/${frelout[$i]}.tar" >> archive_${frelout[$i]} |
---|
4561 | echo "tar cvf \$PERM/${frelout[$i]}.tar ${frelout[$i]}" >> archive_${frelout[$i]} |
---|
4562 | echo "rm -rf ${frelout[$i]}" >> archive_${frelout[$i]} |
---|
4563 | fi |
---|
4564 | |
---|
4565 | subjob -v -d -q cdata -X 0 -m 1000 -t 43200 -c $job_catalog archive_${frelout[$i]} |
---|
4566 | printf " Archiving of $tmp_data_catalog/${frelout[$i]} initiated (batch job submitted)\n" |
---|
4567 | file_saved=true |
---|
4568 | |
---|
4569 | elif [[ $archive_system = ut ]] |
---|
4570 | then |
---|
4571 | # ARCHIVIERUNG NUR PER BATCH-JOB MOEGLICH |
---|
4572 | # DATEI MUSS ZWISCHENZEITLICH INS TEMPORAERE DATENVERZEICHNIS |
---|
4573 | # GELEGT WERDEN |
---|
4574 | [[ ! -d $tmp_data_catalog ]] && mkdir -p $tmp_data_catalog |
---|
4575 | chmod g+rx $tmp_data_catalog |
---|
4576 | if [[ $files_for_pes = false ]] |
---|
4577 | then |
---|
4578 | ln -f ${frelout[$i]} $tmp_data_catalog/${frelout[$i]} |
---|
4579 | else |
---|
4580 | mkdir $tmp_data_catalog/${frelout[$i]} |
---|
4581 | ln -f ${frelout[$i]}/* $tmp_data_catalog/${frelout[$i]} |
---|
4582 | fi |
---|
4583 | |
---|
4584 | # BATCH JOB GENERIEREN UND ABSCHICKEN; DATEI MUSS WIEDER |
---|
4585 | # AUS TEMPORAEREM DATENVERZEICHNIS ENTFERNT WERDEN |
---|
4586 | echo "cd $tmp_data_catalog" > archive_${frelout[$i]} |
---|
4587 | if [[ $files_for_pes = false ]] |
---|
4588 | then |
---|
4589 | # EVENTUELL NOCH VORHANDENE DATEI IM ARCHIV LOSCHEN |
---|
4590 | echo "rm -rf \$UT/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
4591 | echo "cp ${frelout[$i]} \$UT/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
4592 | echo "rm -rf ${frelout[$i]}" >> archive_${frelout[$i]} |
---|
4593 | else |
---|
4594 | echo "rm -rf \$UT/${frelout[$i]}.tar" >> archive_${frelout[$i]} |
---|
4595 | echo "tar cvf \$UT/${frelout[$i]}.tar ${frelout[$i]}" >> archive_${frelout[$i]} |
---|
4596 | echo "rm -rf ${frelout[$i]}" >> archive_${frelout[$i]} |
---|
4597 | fi |
---|
4598 | |
---|
4599 | subjob -v -c /pf/b/$usern/job_queue -d -q pp -X 0 -m 1000 -t 7200 archive_${frelout[$i]} |
---|
4600 | printf " Archiving of $tmp_data_catalog/${frelout[$i]} initiated (batch job submitted)\n" |
---|
4601 | file_saved=true |
---|
4602 | |
---|
4603 | else |
---|
4604 | printf "\n +++ archive_system=\"$archive_system\" archiving impossible!" |
---|
4605 | archive_save=false |
---|
4606 | fi |
---|
4607 | if [[ $file_saved = true ]] |
---|
4608 | then |
---|
4609 | if [[ $files_for_pes = false ]] |
---|
4610 | then |
---|
4611 | cat /dev/null > ${pathout[$i]} |
---|
4612 | else |
---|
4613 | mkdir -p ${pathout[$i]} |
---|
4614 | fi |
---|
4615 | fi |
---|
4616 | fi |
---|
4617 | |
---|
4618 | # APPEND AUF LOKALER MASCHINE |
---|
4619 | if [[ "${actionout[$i]}" = "a" ]] |
---|
4620 | then |
---|
4621 | if [[ "${extout[$i]}" != " " && "${extout[$i]}" != "" ]] |
---|
4622 | then |
---|
4623 | printf "\n >>> OUTPUT: ${localout[$i]} append to ${pathout[$i]}.${extout[$i]}\n" |
---|
4624 | cat ${localout[$i]} >> ${pathout[$i]}.${extout[$i]} |
---|
4625 | else |
---|
4626 | printf "\n >>> OUTPUT: ${localout[$i]} append to ${pathout[$i]}\n" |
---|
4627 | cat ${localout[$i]} >> ${pathout[$i]} |
---|
4628 | fi |
---|
4629 | fi |
---|
4630 | |
---|
4631 | # KOPIEREN AUF LOKALER MASCHINE |
---|
4632 | # ES MUSS KOPIERT WERDEN, DA MOVE NICHT UEBER FILESYSTEM HINAUS MOEGLICH |
---|
4633 | if [[ "${actionout[$i]}" = "" && $files_for_pes = false ]] |
---|
4634 | then |
---|
4635 | |
---|
4636 | # KOPIEREN AUF EINPROZESSORMASCHINE |
---|
4637 | if [[ "${extout[$i]}" != " " && "${extout[$i]}" != "" ]] |
---|
4638 | then |
---|
4639 | printf "\n >>> OUTPUT: ${localout[$i]} to ${pathout[$i]}.${extout[$i]}\n" |
---|
4640 | if [[ $link_local_output = true ]] |
---|
4641 | then |
---|
4642 | printf " using ln -f\n" |
---|
4643 | ln -f ${localout[$i]} ${pathout[$i]}.${extout[$i]} |
---|
4644 | fi |
---|
4645 | # If "ln -f" fails of if "$link_local_output = false" do a normal "cp" |
---|
4646 | if [[ ! -f "${pathout[$i]}.${extout[$i]}" ]] |
---|
4647 | then |
---|
4648 | if [[ $link_local_output = true ]] |
---|
4649 | then |
---|
4650 | printf " ln failed, using cp...\n" |
---|
4651 | fi |
---|
4652 | cp ${localout[$i]} ${pathout[$i]}.${extout[$i]} |
---|
4653 | fi |
---|
4654 | else |
---|
4655 | printf "\n >>> OUTPUT: ${localout[$i]} to ${pathout[$i]}\n" |
---|
4656 | if [[ $link_local_output = true ]] |
---|
4657 | then |
---|
4658 | printf " using ln -f\n" |
---|
4659 | ln -f ${localout[$i]} ${pathout[$i]} |
---|
4660 | fi |
---|
4661 | # If "ln -f" fails of if "$link_local_output = false" do a normal "cp" |
---|
4662 | if [[ ! -f "${pathout[$i]}" ]] |
---|
4663 | then |
---|
4664 | if [[ $link_local_output = true ]] |
---|
4665 | then |
---|
4666 | printf " ln failed, using cp...\n" |
---|
4667 | fi |
---|
4668 | cp ${localout[$i]} ${pathout[$i]} |
---|
4669 | fi |
---|
4670 | fi |
---|
4671 | |
---|
4672 | elif [[ "${actionout[$i]}" = "" && $files_for_pes = true ]] |
---|
4673 | then |
---|
4674 | |
---|
4675 | # DIE DEN PROZESSOREN EINES PARALLELRECHNERS ZUGEHOERIGEN |
---|
4676 | # DATEIEN WERDEN ERST IN EINEM KATALOG GESAMMELT UND DIESER |
---|
4677 | # WIRD DANN KOPIERT |
---|
4678 | # PER MOVE UMBENANNT WERDEN |
---|
4679 | printf "\n >>> OUTPUT: ${localout[$i]}/_.... to ${pathout[$i]}\n" |
---|
4680 | if [[ $link_local_output = true ]] |
---|
4681 | then |
---|
4682 | printf " using ln -f\n" |
---|
4683 | mkdir ${pathout[$i]} |
---|
4684 | cd ${localout[$i]} |
---|
4685 | for file in $(ls *) |
---|
4686 | do |
---|
4687 | ln -f $file ${pathout[$i]} |
---|
4688 | done |
---|
4689 | cd $TEMPDIR |
---|
4690 | fi |
---|
4691 | # If "ln -f" fails of if "$link_local_output = false" do a normal "cp -r" |
---|
4692 | if [[ ! -f "${pathout[$i]}/_0000" ]] |
---|
4693 | then |
---|
4694 | if [[ $link_local_output = true ]] |
---|
4695 | then |
---|
4696 | printf " ln failed for .../_0000, using cp...\n" |
---|
4697 | fi |
---|
4698 | cp -r ${localout[$i]} ${pathout[$i]} |
---|
4699 | fi |
---|
4700 | |
---|
4701 | fi |
---|
4702 | fi |
---|
4703 | done |
---|
4704 | if (( i != 0 )) |
---|
4705 | then |
---|
4706 | if [[ $transfer_problems = true ]] |
---|
4707 | then |
---|
4708 | printf "\n$striche\n *** OUTPUT-files saved" |
---|
4709 | printf "\n +++ WARNING: some data transfers failed! \n" |
---|
4710 | else |
---|
4711 | printf "\n$striche\n *** all OUTPUT-files saved \n" |
---|
4712 | fi |
---|
4713 | fi |
---|
4714 | |
---|
4715 | |
---|
4716 | # EVENTUELL FOLGEJOB STARTEN |
---|
4717 | # DATEI CONTINUE_RUN MUSS VOM BENUTZERPROGRAMM AUS ERZEUGT WERDEN |
---|
4718 | if [[ -f CONTINUE_RUN ]] |
---|
4719 | then |
---|
4720 | |
---|
4721 | if [[ $archive_save = true ]] |
---|
4722 | then |
---|
4723 | |
---|
4724 | # ZUERST IN MRUN-AUFRUF OPTIONEN FUER FORTSETZUNGSLAUF, FUER |
---|
4725 | # STILLES ABARBEITEN (OHNE INTERAKTIVE RUECKFAGEN) UND FUER |
---|
4726 | # BATCH-BETRIEB (NUR WICHTIG, FALLS BATCH AUF LOKALER MASCHINE |
---|
4727 | # DURCHGEFUEHRT WERDEN SOLL) EINFUEGEN, FALLS NICHT BEREITS VOR- |
---|
4728 | # HANDEN |
---|
4729 | [[ $(echo $mc | grep -c "\-C") = 0 ]] && mc="$mc -C" |
---|
4730 | [[ $(echo $mc | grep -c "\-v") = 0 ]] && mc="$mc -v" |
---|
4731 | [[ $(echo $mc | grep -c "\-b") = 0 ]] && mc="$mc -b" |
---|
4732 | if [[ $(echo $mc | grep -c "#") != 0 ]] |
---|
4733 | then |
---|
4734 | mc=`echo $mc | sed 's/#/f/g'` |
---|
4735 | fi |
---|
4736 | |
---|
4737 | |
---|
4738 | # JOB STARTEN |
---|
4739 | printf "\n\n *** initiating restart-run on \"$return_addres\" using command:\n" |
---|
4740 | echo " $mc" |
---|
4741 | printf "\n$striche\n" |
---|
4742 | if [[ $localhost != $fromhost ]] |
---|
4743 | then |
---|
4744 | |
---|
4745 | if [[ $localhost = lcsgih || $localhost = lcsgib || $localhost = nech || $localhost = ibmh || $localhost = ibmkisti || $localhost = ibmku || $localhost = ibms ]] |
---|
4746 | then |
---|
4747 | echo "*** ssh will be used to initiate restart-runs!" |
---|
4748 | echo " return_addres=\"$return_addres\" " |
---|
4749 | echo " return_username=\"$return_username\" " |
---|
4750 | if [[ $(echo $return_addres | grep -c "130.75.105") = 1 ]] |
---|
4751 | then |
---|
4752 | ssh $return_addres -l $return_username "PATH=\$PATH:$LOCAL_MRUN_PATH;. /muksoft/packages/intel/bin/compilervars.sh intel64;export PALM_BIN=$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc " |
---|
4753 | else |
---|
4754 | if [[ $localhost = ibmkisti ]] |
---|
4755 | then |
---|
4756 | ssh $usern@gaiad "ssh $return_addres -l $return_username \"PATH=\\\$PATH:$LOCAL_MRUN_PATH;export PALM_BIN=$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc\" " |
---|
4757 | else |
---|
4758 | ssh $return_addres -l $return_username "PATH=\$PATH:$LOCAL_MRUN_PATH;export PALM_BIN=$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc " |
---|
4759 | fi |
---|
4760 | fi |
---|
4761 | else |
---|
4762 | printf "\n +++ no restart mechanism available for host \"$localhost\" " |
---|
4763 | locat=restart; exit |
---|
4764 | fi |
---|
4765 | |
---|
4766 | # WARTEN, DAMIT SICH RESTART JOB IN QUEUE EINREIHEN KANN, BEVOR |
---|
4767 | # DER AKTUELLE JOB ENDET |
---|
4768 | if [[ $queue = special1q ]] |
---|
4769 | then |
---|
4770 | sleep 120 |
---|
4771 | else |
---|
4772 | sleep 30 |
---|
4773 | fi |
---|
4774 | |
---|
4775 | else |
---|
4776 | |
---|
4777 | # BEI RECHNUNGEN AUF LOKALER MASCHINE KANN MRUN DIREKT AUFGE- |
---|
4778 | # RUFEN WERDEN, AUSSER AUF lcfimm |
---|
4779 | cd $LOCAL_PWD |
---|
4780 | if [[ $localhost = lcfimm ]] |
---|
4781 | then |
---|
4782 | ssh $return_addres -l $return_username "PATH=\$PATH:$LOCAL_MRUN_PATH;export PALM_BIN=$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc " |
---|
4783 | else |
---|
4784 | eval $mc # ' MUESSEN AUSGEWERTET WERDEN |
---|
4785 | fi |
---|
4786 | cd - > /dev/null |
---|
4787 | fi |
---|
4788 | printf "\n$striche\n *** restart-run initiated \n" |
---|
4789 | |
---|
4790 | |
---|
4791 | # EVENTUELL INPUT-DATEIEN, DIE VON TEMPORAEREM DATENVERZEICHNIS |
---|
4792 | # GEHOLT WORDEN SIND, LOESCHEN |
---|
4793 | (( i = 0 )) |
---|
4794 | while (( i < iin )) |
---|
4795 | do |
---|
4796 | (( i = i + 1 )) |
---|
4797 | if [[ "${got_tmp[$i]}" = true && $keep_data_from_previous_run = false ]] |
---|
4798 | then |
---|
4799 | rm -r $tmp_data_catalog/${frelin[$i]} |
---|
4800 | fi |
---|
4801 | done |
---|
4802 | |
---|
4803 | else |
---|
4804 | |
---|
4805 | printf "\n +++ no restart-run possible, since errors occured" |
---|
4806 | printf "\n during the archive process" |
---|
4807 | fi |
---|
4808 | |
---|
4809 | fi |
---|
4810 | |
---|
4811 | |
---|
4812 | |
---|
4813 | # EVTL. EMAIL-BENACHRICHTIGUNG UEBER ABGESCHLOSSENEN LAUF |
---|
4814 | if [[ "$email_notification" != "none" ]] |
---|
4815 | then |
---|
4816 | |
---|
4817 | if [[ $localhost != $fromhost ]] |
---|
4818 | then |
---|
4819 | if [[ -f CONTINUE_RUN ]] |
---|
4820 | then |
---|
4821 | echo "PALM restart run necessary" > email_text |
---|
4822 | echo "description header of actual run:" >> email_text |
---|
4823 | cat CONTINUE_RUN >> email_text |
---|
4824 | echo "mrun-command to restart:" >> email_text |
---|
4825 | echo "$mc" >> email_text |
---|
4826 | else |
---|
4827 | echo "PALM run with base filename \"$fname\" on host \"$localhost\" finished" > email_text |
---|
4828 | fi |
---|
4829 | mail $email_notification < email_text |
---|
4830 | printf "\n *** email notification sent to \"$email_notification\" " |
---|
4831 | fi |
---|
4832 | fi |
---|
4833 | |
---|
4834 | |
---|
4835 | |
---|
4836 | # ALLE ARBEITEN BEENDET. TEMPORAERER KATALOG KANN GELOESCHT WERDEN |
---|
4837 | cd $HOME |
---|
4838 | [[ $delete_temporary_catalog = true ]] && rm -rf $TEMPDIR |
---|
4839 | |
---|
4840 | else |
---|
4841 | |
---|
4842 | |
---|
4843 | # FALLS AUF REMOTE-MASCHINE GERECHNET WERDEN SOLL, WERDEN JETZT ENTSPRE- |
---|
4844 | # CHENDE AKTIONEN DURCHGEFUEHRT |
---|
4845 | |
---|
4846 | # MRUN-BEFEHL FUER REMOTE-MASCHINE ZUSAMMENSTELLEN |
---|
4847 | mrun_com="$mrun_script_name -a $afname -c $config_file -d $fname -h $host -H $fromhost -m $memory -t $cpumax -q $queue -R $return_addres -U $return_username -u $remote_username" |
---|
4848 | [[ "$cpp_opts" != "" ]] && mrun_com=${mrun_com}" -D \"$cpp_opts\"" |
---|
4849 | [[ "$global_revision" != "" ]] && mrun_com=${mrun_com}" -G \"$global_revision\"" |
---|
4850 | [[ $group_number != none ]] && mrun_com=${mrun_com}" -g $group_number" |
---|
4851 | [[ $do_compile = true ]] && mrun_com=${mrun_com}" -s \"$source_list\"" |
---|
4852 | [[ "$input_list" != "" ]] && mrun_com=${mrun_com}" -i \"$input_list\"" |
---|
4853 | [[ $ignore_archive_error = true ]] && mrun_com=${mrun_com}" -I" |
---|
4854 | [[ $keep_data_from_previous_run = true ]] && mrun_com=${mrun_com}" -k" |
---|
4855 | [[ "$additional_conditions" != "" ]] && mrun_com=${mrun_com}" -K \"$additional_conditions\"" |
---|
4856 | # [[ "$makefile" != "$source_path/Makefile" ]] && mrun_com=${mrun_com}" -M \"$makefile\"" |
---|
4857 | [[ "$output_list" != "" ]] && mrun_com=${mrun_com}" -o \"$output_list\"" |
---|
4858 | [[ "$read_from_config" = false ]] && mrun_com=${mrun_com}" -S" |
---|
4859 | [[ $do_trace = true ]] && mrun_com=${mrun_com}" -x" |
---|
4860 | [[ "$numprocs" != "" ]] && mrun_com=${mrun_com}" -X $numprocs" |
---|
4861 | if [[ $use_openmp = true ]] |
---|
4862 | then |
---|
4863 | mrun_com=${mrun_com}" -O $threads_per_task" |
---|
4864 | fi |
---|
4865 | [[ "$tasks_per_node" != "" ]] && mrun_com=${mrun_com}" -T $tasks_per_node" |
---|
4866 | [[ $store_on_archive_system = true ]] && mrun_com=${mrun_com}" -A" |
---|
4867 | [[ $package_list != "" ]] && mrun_com=${mrun_com}" -p \"$package_list\"" |
---|
4868 | [[ $return_password != "" ]] && mrun_com=${mrun_com}" -P $return_password" |
---|
4869 | [[ $delete_temporary_catalog = false ]] && mrun_com=${mrun_com}" -B" |
---|
4870 | [[ $node_usage != default && "$(echo $node_usage | cut -c1-3)" != "sla" && $node_usage != novice ]] && mrun_com=${mrun_com}" -n $node_usage" |
---|
4871 | [[ "$ocean_file_appendix" = true ]] && mrun_com=${mrun_com}" -y" |
---|
4872 | [[ $run_coupled_model = true ]] && mrun_com=${mrun_com}" -Y \"$coupled_dist\"" |
---|
4873 | [[ "$check_namelist_files" = false ]] && mrun_com=${mrun_com}" -z" |
---|
4874 | [[ "$combine_plot_fields" = false ]] && mrun_com=${mrun_com}" -Z" |
---|
4875 | [[ "$max_par_io_str" != "" ]] && mrun_com=${mrun_com}" -w $max_par_io_str" |
---|
4876 | if [[ $do_remote = true ]] |
---|
4877 | then |
---|
4878 | printf "\n>>>> MRUN-command on execution host:\n>>>> $mrun_com \n" |
---|
4879 | fi |
---|
4880 | |
---|
4881 | |
---|
4882 | # ZUSAMMENSTELLUNG DES JOBSCRIPTS AUF DATEI jobfile |
---|
4883 | jobfile=jobfile.$RANDOM |
---|
4884 | |
---|
4885 | |
---|
4886 | # TEMPORAERES VERZEICHNIS GENERIEREN UND NACH DORT WECHSELN |
---|
4887 | echo "mkdir $TEMPDIR" >> $jobfile |
---|
4888 | echo "cd $TEMPDIR" >> $jobfile |
---|
4889 | |
---|
4890 | |
---|
4891 | # EVENTUELL FEHLERVERFOLGUNG AKTIVIEREN |
---|
4892 | if [[ $do_trace = true ]] |
---|
4893 | then |
---|
4894 | echo "set -x" >> $jobfile |
---|
4895 | else |
---|
4896 | echo "set +vx" >> $jobfile |
---|
4897 | fi |
---|
4898 | |
---|
4899 | |
---|
4900 | # initialize the environment and load modules |
---|
4901 | if [[ "$init_cmds" != "" ]] |
---|
4902 | then |
---|
4903 | echo "$init_cmds" >> $jobfile |
---|
4904 | fi |
---|
4905 | if [[ "$module_calls" != "" ]] |
---|
4906 | then |
---|
4907 | echo "$module_calls" >> $jobfile |
---|
4908 | fi |
---|
4909 | |
---|
4910 | |
---|
4911 | # BEREITSTELLUNG VON QUELLTEXTEN, MRUN-SCRIPTS UND KONFIGURATIONS- |
---|
4912 | # DATEI FUER DEN JOB |
---|
4913 | if [[ $( echo $host | cut -c1-5 ) = lcsgi || $host = ibmkisti ]] |
---|
4914 | then |
---|
4915 | |
---|
4916 | # KONFIGURATIONSDATEI UND MRUN_SCRIPT IN DAS SOURCE-VERZEICHNIS |
---|
4917 | # KOPIEREN |
---|
4918 | if [[ $restart_run != true ]] |
---|
4919 | then |
---|
4920 | cp $config_file $working_directory/SOURCES_FOR_RUN_$fname |
---|
4921 | cp ${PALM_BIN}/$mrun_script_name $working_directory/SOURCES_FOR_RUN_$fname |
---|
4922 | fi |
---|
4923 | |
---|
4924 | # SOURCE-VERZEICHNIS VOM LOKALEN RECHNER PER SCP TRANSFERIEREN |
---|
4925 | # (BEI JOBS AUF LOKALEM RECHNER REICHT CP) |
---|
4926 | echo "set -x" >> $jobfile |
---|
4927 | if [[ $host = $localhost ]] |
---|
4928 | then |
---|
4929 | echo "cp -r $working_directory/SOURCES_FOR_RUN_$fname ." >> $jobfile |
---|
4930 | else |
---|
4931 | if [[ $host != ibmkisti ]] |
---|
4932 | then |
---|
4933 | echo "scp -r $return_username@$return_addres:$working_directory/SOURCES_FOR_RUN_$fname ." >> $jobfile |
---|
4934 | else |
---|
4935 | # on KISTI's IBM firewall is only opened on interactive node |
---|
4936 | echo "localdir=\`pwd\`" >> $jobfile |
---|
4937 | echo "ssh $remote_username@gaiad \"cd \$localdir; scp -r $return_username@$return_addres:$working_directory/SOURCES_FOR_RUN_$fname .\" " >> $jobfile |
---|
4938 | fi |
---|
4939 | fi |
---|
4940 | echo "export SOURCES_COMPLETE=true" >> $jobfile |
---|
4941 | |
---|
4942 | # QUELLTEXTE, MRUN-SCRIPT UND KONFIGURATIONSDATEI IN DAS AKTUELLE |
---|
4943 | # ARBEITSVERZEICHNIS VERSCHIEBEN |
---|
4944 | echo "mv SOURCES_FOR_RUN_$fname/$config_file . " >> $jobfile |
---|
4945 | echo "mv SOURCES_FOR_RUN_$fname/$mrun_script_name . " >> $jobfile |
---|
4946 | echo "execute_mrun=true" >> $jobfile |
---|
4947 | echo " " >> $jobfile |
---|
4948 | |
---|
4949 | else |
---|
4950 | |
---|
4951 | # ABSPEICHERN DER QUELLTEXTE (NUR FALLS UEBERSETZT WERDEN SOLL) |
---|
4952 | # SOWIE GEGEBENENFALLS DES MAKEFILES |
---|
4953 | if [[ $do_compile = true ]] |
---|
4954 | then |
---|
4955 | |
---|
4956 | source_catalog=SOURCES_FOR_RUN_$fname |
---|
4957 | |
---|
4958 | # UNTERVERZEICHNIS FUER QUELLTEXTE UND MAKEFILE ANLEGEN |
---|
4959 | # MRUN WIRD DIESES VRZEICHNIS UEBER ENVIRONMENT VARIABLE |
---|
4960 | # MITGETEILT (UEBERSTEUERT ANGABE IN KONFIGURATIONSDATEI) |
---|
4961 | echo "mkdir SOURCES_FOR_RUN_$fname" >> $jobfile |
---|
4962 | echo "export SOURCES_COMPLETE=true" >> $jobfile |
---|
4963 | echo "cd SOURCES_FOR_RUN_$fname" >> $jobfile |
---|
4964 | |
---|
4965 | for filename in $source_list |
---|
4966 | do |
---|
4967 | # ABDECKZEICHEN VERHINDERN, DASS ERSETZUNGEN ERFOLGEN |
---|
4968 | echo "cat > $filename << \"%END%\"" >> $jobfile |
---|
4969 | cat $source_catalog/$filename >> $jobfile |
---|
4970 | echo " " >> $jobfile |
---|
4971 | echo "%END%" >> $jobfile |
---|
4972 | echo " " >> $jobfile |
---|
4973 | done |
---|
4974 | |
---|
4975 | # ABDECKZEICHEN VERHINDERN, DASS ERSETZUNGEN ERFOLGEN |
---|
4976 | echo "cat > Makefile << \"%END%\"" >> $jobfile |
---|
4977 | cat $source_catalog/Makefile >> $jobfile |
---|
4978 | echo " " >> $jobfile |
---|
4979 | echo "%END%" >> $jobfile |
---|
4980 | echo " " >> $jobfile |
---|
4981 | |
---|
4982 | echo "cd - > /dev/null" >> $jobfile |
---|
4983 | |
---|
4984 | fi |
---|
4985 | |
---|
4986 | |
---|
4987 | # ABSPEICHERN DER KONFIGURATIONSDATEI |
---|
4988 | # ABDECKZEICHEN VERHINDERN, DASS ERSETZUNGEN ERFOLGEN |
---|
4989 | echo "cat > $config_file << \"%END%\"" >> $jobfile |
---|
4990 | cat $config_file >> $jobfile |
---|
4991 | echo "%END%" >> $jobfile |
---|
4992 | echo " " >> $jobfile |
---|
4993 | |
---|
4994 | |
---|
4995 | # ABSPEICHERN DER AKTUELLEN MRUN-VERSION |
---|
4996 | # ABDECKZEICHEN VERHINDERN, DASS ERSETZUNGEN ERFOLGEN |
---|
4997 | echo "cat > $mrun_script_name <<\"%END%\"" >> $jobfile |
---|
4998 | cat ${PALM_BIN}/$mrun_script_name >> $jobfile |
---|
4999 | echo "%END%" >> $jobfile |
---|
5000 | echo "chmod u+x $mrun_script_name" >> $jobfile |
---|
5001 | echo "execute_mrun=true" >> $jobfile |
---|
5002 | echo " " >> $jobfile |
---|
5003 | |
---|
5004 | fi |
---|
5005 | |
---|
5006 | |
---|
5007 | # EVTL. BENOETIGTE INPUT-DATEIEN PER FTP HOLEN ODER DEM JOB DIREKT |
---|
5008 | # MITGEBEN UND AUF DEM REMOTE-RECHNER IM BENUTZERVERZEICHNIS ABLEGEN |
---|
5009 | # FALLS DIESES NICHT EXISTIERT, WIRD VERSUCHT, DAS JEWEILS LETZTE |
---|
5010 | # UNTERVERZEICHNIS DES PFADNAMENS ANZULEGEN |
---|
5011 | if [[ $do_remote = true ]] |
---|
5012 | then |
---|
5013 | (( i = 0 )) |
---|
5014 | while (( i < iin )) |
---|
5015 | do |
---|
5016 | (( i = i + 1 )) |
---|
5017 | echo "[[ ! -d ${pathin[$i]} ]] && mkdir -p ${pathin[$i]}" >> $jobfile |
---|
5018 | if [[ "${transin[$i]}" = job ]] |
---|
5019 | then |
---|
5020 | echo "cat > ${remotepathin[$i]} <<\"%END%\"" >> $jobfile |
---|
5021 | eval cat ${pathin[$i]}/${frelin[$i]} >> $jobfile |
---|
5022 | echo " " >> $jobfile |
---|
5023 | echo "%END%" >> $jobfile |
---|
5024 | else |
---|
5025 | echo "batch_scp -b -o -g -s -u $return_username $return_addres ${remotepathin[$i]} \"${pathin[$i]}\" ${frelin[$i]}" >> $jobfile |
---|
5026 | fi |
---|
5027 | |
---|
5028 | # UEBERPRUEFEN, OB DATEI ANGELEGT WERDEN KONNTE |
---|
5029 | echo "if [[ \$? = 1 ]]" >> $jobfile |
---|
5030 | echo "then" >> $jobfile |
---|
5031 | echo " echo \" \" " >> $jobfile |
---|
5032 | echo " echo \"+++ file ${remotepathin[$i]} could not be created\" " >> $jobfile |
---|
5033 | echo " echo \" please check, if directory exists on $host!\" " >> $jobfile |
---|
5034 | echo " echo \"+++ MRUN will not be continued\" " >> $jobfile |
---|
5035 | echo " execute_mrun=false" >> $jobfile |
---|
5036 | echo "fi" >> $jobfile |
---|
5037 | done |
---|
5038 | fi |
---|
5039 | |
---|
5040 | # ARBEITSKATALOG AUF DER LOKALEN MASCHINE FUER EVENTUELLE |
---|
5041 | # FORTSETZUNGSLAUEFE PER ENV-VARIABLE UEBERGEBEN |
---|
5042 | echo "LOCAL_PWD=$working_directory" >> $jobfile |
---|
5043 | echo "export LOCAL_PWD" >> $jobfile |
---|
5044 | |
---|
5045 | # EBENSO LOKALEN MRUN-KATALOG UEBERGEBEN |
---|
5046 | echo "LOCAL_MRUN_PATH=$PALM_BIN" >> $jobfile |
---|
5047 | echo "export LOCAL_MRUN_PATH" >> $jobfile |
---|
5048 | |
---|
5049 | # WORKAROUND FUER RIAM-NEC-JOBS WEGEN PROFILE-SCHWIERIGKEITEN |
---|
5050 | if [[ $localhost_realname = "gate" || $localhost = lctit ]] |
---|
5051 | then |
---|
5052 | echo "export PALM_BIN=$PALM_BIN" >> $jobfile |
---|
5053 | fi |
---|
5054 | |
---|
5055 | # MRUN AUF ZIELRECHNER AUFRUFEN (queue is workaround for ibmkisti) |
---|
5056 | echo "set -x" >> $jobfile |
---|
5057 | echo "queue=$queue" >> $jobfile |
---|
5058 | echo "[[ \$execute_mrun = true ]] && ./$mrun_com" >> $jobfile |
---|
5059 | |
---|
5060 | echo 'ls -al; echo `pwd`' >> $jobfile |
---|
5061 | echo "cd \$HOME" >> $jobfile |
---|
5062 | echo "rm -rf $TEMPDIR" >> $jobfile |
---|
5063 | |
---|
5064 | |
---|
5065 | |
---|
5066 | |
---|
5067 | # JOB PER SUBJOB STARTEN |
---|
5068 | if [[ $silent = false ]] |
---|
5069 | then |
---|
5070 | printf "\n " |
---|
5071 | else |
---|
5072 | printf "\n\n" |
---|
5073 | fi |
---|
5074 | |
---|
5075 | subjob $job_on_file -h $host -u $remote_username -g $group_number -q $queue -m $memory -N $node_usage -t $cpumax $XOPT $TOPT $OOPT -n $fname -v -c $job_catalog -e $email_notification $jobfile |
---|
5076 | rm -rf $jobfile |
---|
5077 | |
---|
5078 | |
---|
5079 | fi # ENDE REMOTE-TEIL |
---|
5080 | |
---|
5081 | |
---|
5082 | |
---|
5083 | # ENDE DER PROZEDUR |
---|