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