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