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