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