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