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