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