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