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