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