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