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