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