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