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