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