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