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