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