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