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