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