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