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 | # Default queues for HLRN-III (lccrayb/lccrayh) defined |
---|
25 | # |
---|
26 | # Former revisions: |
---|
27 | # ----------------- |
---|
28 | # $Id: mrun 1442 2014-07-28 07:09:10Z raasch $ |
---|
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: 1442 $" |
---|
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 | (lccrayb) queue=mpp1q;; |
---|
1136 | (lccrayh) queue=mpp1q;; |
---|
1137 | (lckiaps) queue=normal;; |
---|
1138 | (lckyoto) queue=ph;; |
---|
1139 | (lckyuh) queue=fx-single;; |
---|
1140 | (lckyut) queue=cx-single;; |
---|
1141 | (lctit) queue=S;; |
---|
1142 | (nech) queue=none;; |
---|
1143 | (unics) queue=unics;; |
---|
1144 | esac |
---|
1145 | fi |
---|
1146 | |
---|
1147 | |
---|
1148 | # GENERATE FULL FILENAMES OF INPUT-FILES, INCLUDING THEIR PATH |
---|
1149 | # CHECK, IF INPUT-FILES EXIST, AND DETERMINE HIGHEST CYCLE NUMBER (IF CYCLES EXIST) |
---|
1150 | (( i = 0 )) |
---|
1151 | while (( i < iin )) |
---|
1152 | do |
---|
1153 | (( i = i + 1 )) |
---|
1154 | (( maxcycle = 0 )) |
---|
1155 | |
---|
1156 | # GENERATE PATH AND FULL FILE NAME (then-BRANCH: FIXED FULL NAME IS GIVEN, I.E. THE |
---|
1157 | # FILE IDENTIFIER IS NOT PART OF THE FILENAME)) |
---|
1158 | if [[ "${actionin[$i]}" = di ]] |
---|
1159 | then |
---|
1160 | remotepathin[$i]=${pathin[$i]}/${endin[$i]} # EVALUATE REMOTE-PATH ON THE REMOTE |
---|
1161 | # HOST ONLY |
---|
1162 | eval filename=${pathin[$i]}/${endin[$i]} |
---|
1163 | else |
---|
1164 | remotepathin[$i]=${pathin[$i]}/${afname}${endin[$i]} # EVALUATE REMOTE-PATH ON THE REMOTE |
---|
1165 | # HOST ONLY |
---|
1166 | eval filename=${pathin[$i]}/${afname}${endin[$i]} |
---|
1167 | fi |
---|
1168 | eval pathname=${pathin[$i]} |
---|
1169 | |
---|
1170 | # SAVE INPUT FILE NAME FOR PARAMETER FILE CHECK |
---|
1171 | if [[ ("${transin[$i]}" = job) && (-f $filename) ]] |
---|
1172 | then |
---|
1173 | filename_input=$filename |
---|
1174 | fi |
---|
1175 | |
---|
1176 | # CHECK IF FILE EXISTS |
---|
1177 | if [[ $(ls $filename* 2>&1 | grep -c "not found") = 1 || \ |
---|
1178 | $(ls $filename* 2>&1 | grep -c "nicht gefunden") = 1 || \ |
---|
1179 | $(ls $filename* 2>&1 | grep -c "No such file") = 1 || \ |
---|
1180 | $(ls $filename* 2>&1 | grep -c "does not exist") = 1 ]] |
---|
1181 | then |
---|
1182 | |
---|
1183 | # FILES WITH ATTRIBUTE locopt ARE OPTIONAL. NO ABORT, IF THEY DO NOT EXIST. |
---|
1184 | if [[ "${transin[$i]}" != "locopt" ]] |
---|
1185 | then |
---|
1186 | printf "\n\n +++ INPUT-file: " |
---|
1187 | if [[ "${extin[$i]}" = "" ]] |
---|
1188 | then |
---|
1189 | printf "\n $filename" |
---|
1190 | else |
---|
1191 | printf "\n $filename.${extin[$i]}" |
---|
1192 | fi |
---|
1193 | printf "\n does not exist\n" |
---|
1194 | locat=input; exit |
---|
1195 | else |
---|
1196 | transin[$i]="unavailable" |
---|
1197 | fi |
---|
1198 | else |
---|
1199 | |
---|
1200 | # DETERMINE THE FILE'S CYCLE NUMBER |
---|
1201 | ls -1 -d $filename > filelist 2>/dev/null |
---|
1202 | ls -1 -d $filename.* >> filelist 2>/dev/null |
---|
1203 | while read zeile |
---|
1204 | do |
---|
1205 | cycle=$(echo $zeile | cut -f2 -d".") |
---|
1206 | if [[ "$cycle" = "$zeile" ]] |
---|
1207 | then |
---|
1208 | (( icycle = 0 )) |
---|
1209 | elif [[ "$cycle" = "${extin[$i]}" ]] |
---|
1210 | then |
---|
1211 | (( icycle = 0 )) |
---|
1212 | else |
---|
1213 | (( icycle = $cycle )) |
---|
1214 | fi |
---|
1215 | if (( icycle > maxcycle )) |
---|
1216 | then |
---|
1217 | (( maxcycle = icycle )) |
---|
1218 | file_to_be_used=$zeile |
---|
1219 | fi |
---|
1220 | done <filelist |
---|
1221 | rm filelist |
---|
1222 | |
---|
1223 | # APPEND CYCLE NUMBER TO FILENAME |
---|
1224 | if (( maxcycle > 0 )) |
---|
1225 | then |
---|
1226 | if [[ "${extin[$i]}" != " " && "${extin[$i]}" != "" ]] |
---|
1227 | then |
---|
1228 | filename=${filename}.$maxcycle.${extin[$i]} |
---|
1229 | else |
---|
1230 | filename=${filename}.$maxcycle |
---|
1231 | fi |
---|
1232 | else |
---|
1233 | if [[ "${extin[$i]}" != " " && "${extin[$i]}" != "" ]] |
---|
1234 | then |
---|
1235 | filename=${filename}.${extin[$i]} |
---|
1236 | fi |
---|
1237 | fi |
---|
1238 | |
---|
1239 | # STORE FILENAME WITHOUT PATH BUT WITH CYCLE NUMBER, |
---|
1240 | # BECAUSE IT MIGHT BE REQUIRED LATER TO RESTORE THE FILE FROM AN ARCHIVE-SYSTEM |
---|
1241 | absnamein[$i]=$filename |
---|
1242 | if (( maxcycle > 0 )) |
---|
1243 | then |
---|
1244 | if [[ "${actionin[$i]}" = di ]] |
---|
1245 | then |
---|
1246 | frelin[$i]=${endin[$i]}.$maxcycle |
---|
1247 | else |
---|
1248 | frelin[$i]=${afname}${endin[$i]}.$maxcycle |
---|
1249 | fi |
---|
1250 | else |
---|
1251 | if [[ "${actionin[$i]}" = di ]] |
---|
1252 | then |
---|
1253 | frelin[$i]=${endin[$i]} |
---|
1254 | else |
---|
1255 | frelin[$i]=${afname}${endin[$i]} |
---|
1256 | fi |
---|
1257 | fi |
---|
1258 | |
---|
1259 | fi |
---|
1260 | done |
---|
1261 | |
---|
1262 | # GENERATE FULL FILENAMES OF OUTPUT-FILES (WITHOUT $ OR ~), |
---|
1263 | # CHECK, IF OUTPUT-FILES EXIST, AND DETERMINE HIGHEST CYCLE NUMBER (IF CYCLES EXIST), |
---|
1264 | # OR, IN CASE THAT FILE DOES NOT EXIST, CHECK, IF IT CAN BE CREATED |
---|
1265 | # THESE ACTIONS ARE NOT CARRIED OUT, IF FILES SHALL BE TRASFERRED FROM THE REMOTE TO |
---|
1266 | # THE LOCAL HOST (BECAUSE THEIR IS NO DIRECT ACCESS TO THE LOCAL DIRECTORIES FROM THE |
---|
1267 | # REMOTE HOST) |
---|
1268 | (( i = 0 )) |
---|
1269 | while (( i < iout )) |
---|
1270 | do |
---|
1271 | (( i = i + 1 )) |
---|
1272 | if [[ ! ( $fromhost != $localhost && ( "${actionout[$i]}" = tr || "${actionout[$i]}" = tra || "${actionout[$i]}" = trpe ) ) ]] |
---|
1273 | then |
---|
1274 | if [[ "${actionout[$i]}" = tr ]] |
---|
1275 | then |
---|
1276 | actionout[$i]="" |
---|
1277 | elif [[ "${actionout[$i]}" = trpe ]] |
---|
1278 | then |
---|
1279 | actionout[$i]=pe |
---|
1280 | elif [[ "${actionout[$i]}" = tra ]] |
---|
1281 | then |
---|
1282 | actionout[$i]=a |
---|
1283 | fi |
---|
1284 | (( maxcycle = 0 )) |
---|
1285 | eval filename=${pathout[$i]}/${fname}${endout[$i]} |
---|
1286 | eval catalogname=${pathout[$i]} |
---|
1287 | if [[ $(ls $filename* 2>&1 | grep -c "not found") = 1 || \ |
---|
1288 | $(ls $filename* 2>&1 | grep -c "nicht gefunden") = 1 || \ |
---|
1289 | $(ls $filename* 2>&1 | grep -c "No such file") = 1 || \ |
---|
1290 | $(ls $filename* 2>&1 | grep -c "does not exist") = 1 ]] |
---|
1291 | then |
---|
1292 | |
---|
1293 | # IF OUTPUT-FILE DOES NOT EXIST CHECK, IF IT CAN BE CREATED |
---|
1294 | if cat /dev/null > $filename |
---|
1295 | then |
---|
1296 | rm $filename |
---|
1297 | else |
---|
1298 | |
---|
1299 | # CHECK, IF THE DIRECTORY WHERE FILE SHALL BE COPIED TO EXISTS |
---|
1300 | # IF IT DOES NOT EXIST, TRY TO CREATE IT |
---|
1301 | if [[ ! -d $catalogname ]] |
---|
1302 | then |
---|
1303 | if mkdir -p $catalogname |
---|
1304 | then |
---|
1305 | printf "\n\n *** directory:" |
---|
1306 | printf "\n $catalogname" |
---|
1307 | printf "\n was created\n" |
---|
1308 | else |
---|
1309 | printf "\n\n +++ OUTPUT-file:" |
---|
1310 | printf "\n $filename" |
---|
1311 | printf "\n cannot be created, because directory does not exist" |
---|
1312 | printf "\n and cannot be created either" |
---|
1313 | printf "\n" |
---|
1314 | locat=output ; exit |
---|
1315 | fi 2>/dev/null |
---|
1316 | else |
---|
1317 | printf "\n\n +++ OUTPUT-file:" |
---|
1318 | printf "\n $filename" |
---|
1319 | printf "\n cannot be created, although directory exists" |
---|
1320 | printf "\n" |
---|
1321 | locat=output ; exit |
---|
1322 | fi |
---|
1323 | fi 2>/dev/null |
---|
1324 | else |
---|
1325 | |
---|
1326 | # DETERMINE THE CYCLE NUMBER |
---|
1327 | ls -1 -d $filename > filelist 2>/dev/null |
---|
1328 | ls -1 -d $filename.* >> filelist 2>/dev/null |
---|
1329 | while read zeile |
---|
1330 | do |
---|
1331 | cycle=$(echo $zeile | cut -f2 -d".") |
---|
1332 | if [[ "$cycle" = "$zeile" || "$cycle" = ${extout[$i]} ]] |
---|
1333 | then |
---|
1334 | (( icycle = 1 )) |
---|
1335 | else |
---|
1336 | (( icycle = $cycle + 1 )) |
---|
1337 | fi |
---|
1338 | if (( icycle > maxcycle )) |
---|
1339 | then |
---|
1340 | (( maxcycle = icycle )) |
---|
1341 | fi |
---|
1342 | done <filelist |
---|
1343 | rm filelist |
---|
1344 | fi |
---|
1345 | |
---|
1346 | # APPEND CYCLE NUMBER TO FILENAME AND CHECK, IF FILE CAN BE CREATED |
---|
1347 | # IN CASE OF FILE-APPEND, FILE MUST BE APPENDED TO THE ONE WITH HIGHEST CYCLE NUMBER |
---|
1348 | if [[ "${actionout[$i]}" != a ]] |
---|
1349 | then |
---|
1350 | if (( maxcycle > 0 )) |
---|
1351 | then |
---|
1352 | filename=${filename}.$maxcycle |
---|
1353 | if cat /dev/null > $filename |
---|
1354 | then |
---|
1355 | rm $filename |
---|
1356 | else |
---|
1357 | printf "\n +++ OUTPUT-file:" |
---|
1358 | printf "\n $filename" |
---|
1359 | printf "\n cannot be created" |
---|
1360 | locat=output ; exit |
---|
1361 | fi |
---|
1362 | fi |
---|
1363 | else |
---|
1364 | (( maxcycle = maxcycle - 1 )) |
---|
1365 | if (( maxcycle > 0 )) |
---|
1366 | then |
---|
1367 | filename=${filename}.$maxcycle |
---|
1368 | fi |
---|
1369 | fi |
---|
1370 | |
---|
1371 | # STORE FILENAME WITHOUT PATH BUT WITH CYCLE NUMBER, |
---|
1372 | # BECAUSE IT MIGHT BE REQUIRED LATER TO STORE THE FILE ON AN ARCHIVE-SYSTEM |
---|
1373 | # OR TO PUT THIS FILENAME ON FILE OUTPUT_FILE_CONNECTIONS |
---|
1374 | pathout[$i]=$filename |
---|
1375 | if (( maxcycle > 0 )) |
---|
1376 | then |
---|
1377 | frelout[$i]=${fname}${endout[$i]}.$maxcycle |
---|
1378 | else |
---|
1379 | frelout[$i]=${fname}${endout[$i]} |
---|
1380 | fi |
---|
1381 | |
---|
1382 | fi |
---|
1383 | done |
---|
1384 | |
---|
1385 | |
---|
1386 | # THE DVR-PACKAGE REQUIRES ITS OWN LIBRARY |
---|
1387 | if [[ $(echo $package_list | grep -c dvrp_graphics) != 0 ]] |
---|
1388 | then |
---|
1389 | if [[ "$dvr_inc" = "" ]] |
---|
1390 | then |
---|
1391 | printf "\n\n +++ no value for \"dvr_inc\" given in configuration file" |
---|
1392 | printf "\n This is required for the dvrp_graphics package.\n" |
---|
1393 | locat=dvr; exit |
---|
1394 | fi |
---|
1395 | if [[ "$dvr_lib" = "" ]] |
---|
1396 | then |
---|
1397 | printf "\n\n +++ no value for \"dvr_lib\" given in configuration file" |
---|
1398 | printf "\n This is required for the dvrp_graphics package.\n" |
---|
1399 | locat=dvr; exit |
---|
1400 | fi |
---|
1401 | fi |
---|
1402 | |
---|
1403 | |
---|
1404 | # CHECK, WETHER A MAIN PROGRAM OR AN EXECUTABLE HAVE BEEN DECLARED. |
---|
1405 | # EXECUTABLES DO NOT NEED TO BE COMPILED. |
---|
1406 | if [[ "$mainprog" = "" && "$executable" = "" ]] |
---|
1407 | then |
---|
1408 | printf "\n +++ neither main program nor executable defined" |
---|
1409 | locat=source; exit |
---|
1410 | elif [[ "$mainprog" != "" && "$executable" != "" ]] |
---|
1411 | then |
---|
1412 | printf "\n +++ main program as well as executable defined" |
---|
1413 | locat=source; exit |
---|
1414 | elif [[ "$mainprog" = "" && "$executable" != "" ]] |
---|
1415 | then |
---|
1416 | do_compile=false |
---|
1417 | fi |
---|
1418 | |
---|
1419 | |
---|
1420 | # CREATE SOURCE-DIRECTORY TO COLLECT ROUTINES TO BE COMPILED. |
---|
1421 | # LATER THE MRUN-SCRIPT AND CONFIGURATION-FILE WILL ALSO BE COPIED TO THIS DIRECTORY. |
---|
1422 | if [[ $restart_run != true && "$SOURCES_COMPLETE" = "" ]] |
---|
1423 | then |
---|
1424 | rm -rf SOURCES_FOR_RUN_$fname |
---|
1425 | mkdir SOURCES_FOR_RUN_$fname |
---|
1426 | fi |
---|
1427 | |
---|
1428 | |
---|
1429 | # COLLECT ALL ROUTINES TO BE COMPILED |
---|
1430 | # THIS IS NOT REQUIRED WITHIN BATCH-JOBS, BECAUSE ROUTINES HAVE ALREADY BEEN COLLECTED |
---|
1431 | # BY THE MRUN-CALL WHICH CREATED THE BATCH-JOB. |
---|
1432 | if [[ $do_compile = true && "$SOURCES_COMPLETE" = "" ]] |
---|
1433 | then |
---|
1434 | |
---|
1435 | [[ "$source_list" = LM ]] && source_list=LOCALLY_MODIFIED |
---|
1436 | |
---|
1437 | if [[ "$source_list" = LOCALLY_MODIFIED ]] |
---|
1438 | then |
---|
1439 | |
---|
1440 | # DETERMINE MODIFIED FILES OF THE SVN WORKING COPY |
---|
1441 | source_list="" |
---|
1442 | cd $source_path |
---|
1443 | |
---|
1444 | |
---|
1445 | # CHECK, IF DIRECTORY IS UNDER SVN CONTROL |
---|
1446 | if [[ ! -d .svn ]] |
---|
1447 | then |
---|
1448 | printf "\n\n +++ source directory" |
---|
1449 | printf "\n \"$source_path\" " |
---|
1450 | printf "\n is not under control of \"subversion\"." |
---|
1451 | printf "\n Please do not use mrun-option \"-s LOCALLY_MODIFIED\"\n" |
---|
1452 | fi |
---|
1453 | |
---|
1454 | |
---|
1455 | # LIST ALL MODIFIED SOURCE CODE FILES |
---|
1456 | Filenames="" |
---|
1457 | svn status > tmp_mrun |
---|
1458 | while read line |
---|
1459 | do |
---|
1460 | firstc=`echo $line | cut -c1` |
---|
1461 | if [[ $firstc = M || $firstc = "?" ]] |
---|
1462 | then |
---|
1463 | Name=`echo "$line" | cut -c8-` |
---|
1464 | extension=`echo $Name | cut -d. -f2` |
---|
1465 | if [[ "$extension" = f90 || "$extension" = F90 || "$extension" = f || "$extension" = F || "$extension" = c ]] |
---|
1466 | then |
---|
1467 | Filenames="$Filenames "$Name |
---|
1468 | fi |
---|
1469 | fi |
---|
1470 | done < tmp_mrun |
---|
1471 | |
---|
1472 | |
---|
1473 | # COPY FILES TO SOURCES_FOR_RUN_... |
---|
1474 | for dateiname in $Filenames |
---|
1475 | do |
---|
1476 | cp $dateiname $working_directory/SOURCES_FOR_RUN_$fname |
---|
1477 | source_list=$source_list"$dateiname " |
---|
1478 | done |
---|
1479 | |
---|
1480 | cd - > /dev/null |
---|
1481 | |
---|
1482 | |
---|
1483 | # COPY FILES GIVEN BY OPTION -s TO DIRECTORY SOURCES_FOR_RUN_... |
---|
1484 | # AUTOMATIC RESTART RUNS JUST ACCESS THE DIRECTORY CREATED BY THE INITIAL RUN |
---|
1485 | elif [[ "$source_list" != "" && $restart_run != true ]] |
---|
1486 | then |
---|
1487 | |
---|
1488 | cd $source_path |
---|
1489 | |
---|
1490 | for filename in $source_list |
---|
1491 | do |
---|
1492 | |
---|
1493 | # SOURCE CODE FILE IS NOT ALLOWED TO INCLUDE PATH |
---|
1494 | if [[ $(echo $filename | grep -c "/") != 0 ]] |
---|
1495 | then |
---|
1496 | printf "\n +++ source code file: $filename" |
---|
1497 | printf "\n must not contain (\"/\") " |
---|
1498 | locat=source; exit |
---|
1499 | fi |
---|
1500 | |
---|
1501 | if [[ ! -f $filename ]] |
---|
1502 | then |
---|
1503 | printf "\n +++ source code file: $filename" |
---|
1504 | printf "\n does not exist" |
---|
1505 | locat=source; exit |
---|
1506 | else |
---|
1507 | cp $filename $working_directory/SOURCES_FOR_RUN_$fname |
---|
1508 | fi |
---|
1509 | |
---|
1510 | done |
---|
1511 | |
---|
1512 | cd - > /dev/null |
---|
1513 | |
---|
1514 | fi |
---|
1515 | |
---|
1516 | |
---|
1517 | # CHECK, IF A MAIN PROGRAM EXISTS AND IF IT IS PART OF THE LIST OF FILES |
---|
1518 | # TO BE COMPILED. IF NOT, ADD IT TO THE LIST. |
---|
1519 | if [[ $restart_run != true ]] |
---|
1520 | then |
---|
1521 | |
---|
1522 | if [[ ! -f "$source_path/$mainprog" ]] |
---|
1523 | then |
---|
1524 | printf "\n\n +++ main program: $mainprog" |
---|
1525 | printf "\n does not exist in source directory" |
---|
1526 | printf "\n \"$source_path\"\n" |
---|
1527 | locat=source; exit |
---|
1528 | else |
---|
1529 | if [[ $(echo $source_list | grep -c $mainprog) = 0 ]] |
---|
1530 | then |
---|
1531 | cp $source_path/$mainprog SOURCES_FOR_RUN_$fname |
---|
1532 | source_list=${mainprog}" $source_list" |
---|
1533 | fi |
---|
1534 | fi |
---|
1535 | fi |
---|
1536 | |
---|
1537 | |
---|
1538 | # CHECK, IF MAKEFILE EXISTS AND COPY IT TO THE SOURCES_FOR_RUN... DIRECTORY |
---|
1539 | # NOT REQUIRED FOR RESTART RUNS, SOURCES_FOR_RUN... HAS BEEN CREATED BY THE INITIAL RUN |
---|
1540 | if [[ "$restart_run" != true ]] |
---|
1541 | then |
---|
1542 | [[ "$makefile" = "" ]] && makefile=$source_path/Makefile |
---|
1543 | if [[ ! -f $makefile ]] |
---|
1544 | then |
---|
1545 | printf "\n +++ file \"$makefile\" does not exist" |
---|
1546 | locat=make; exit |
---|
1547 | else |
---|
1548 | cp $makefile SOURCES_FOR_RUN_$fname/Makefile |
---|
1549 | fi |
---|
1550 | fi |
---|
1551 | |
---|
1552 | |
---|
1553 | # COPY FILES FROM OPTIONAL SOURCE PATH GIVEN IN THE CONFIGURATION FILE |
---|
1554 | if [[ $restart_run != true && "$add_source_path" != "" ]] |
---|
1555 | then |
---|
1556 | |
---|
1557 | # DOES THE DIRECTORY EXIST? |
---|
1558 | if [[ ! -d $add_source_path ]] |
---|
1559 | then |
---|
1560 | printf "\n\n +++ WARNING: additional source code directory" |
---|
1561 | printf "\n \"$add_source_path\" " |
---|
1562 | printf "\n does not exist or is not a directory." |
---|
1563 | printf "\n No source code will be used from this directory!\n" |
---|
1564 | add_source_path="" |
---|
1565 | if [[ $silent == false ]] |
---|
1566 | then |
---|
1567 | sleep 3 |
---|
1568 | fi |
---|
1569 | else |
---|
1570 | |
---|
1571 | cd $add_source_path |
---|
1572 | found=false |
---|
1573 | |
---|
1574 | Names=$(ls -1 *.f90 2>&1) |
---|
1575 | [[ $(echo $Names | grep -c '*.f90') = 0 ]] && AddFilenames="$Names" |
---|
1576 | Names=$(ls -1 *.F90 2>&1) |
---|
1577 | [[ $(echo $Names | grep -c '*.F90') = 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 *.f 2>&1) |
---|
1581 | [[ $(echo $Names | grep -c '*.f') = 0 ]] && AddFilenames="$AddFilenames $Names" |
---|
1582 | Names=$(ls -1 *.c 2>&1) |
---|
1583 | [[ $(echo $Names | grep -c '*.c') = 0 ]] && AddFilenames="$AddFilenames $Names" |
---|
1584 | |
---|
1585 | cd - > /dev/null |
---|
1586 | cd SOURCES_FOR_RUN_$fname |
---|
1587 | |
---|
1588 | # COPY MAKEFILE IF EXISTING |
---|
1589 | if [[ -f $add_source_path/Makefile ]] |
---|
1590 | then |
---|
1591 | printf "\n\n *** user Makefile from directory" |
---|
1592 | printf "\n \"$add_source_path\" is used \n" |
---|
1593 | if [[ $silent == false ]] |
---|
1594 | then |
---|
1595 | sleep 1 |
---|
1596 | fi |
---|
1597 | cp $add_source_path/Makefile . |
---|
1598 | fi |
---|
1599 | |
---|
1600 | for dateiname in $AddFilenames |
---|
1601 | do |
---|
1602 | if [[ -f $dateiname ]] |
---|
1603 | then |
---|
1604 | printf "\n +++ source code file \"$dateiname\" found in additional" |
---|
1605 | printf "\n source code directory \"$add_source_path\" " |
---|
1606 | printf "\n but was also given with option \"-s\" which means that it should be taken" |
---|
1607 | printf "\n from directory \"$source_path\"." |
---|
1608 | locat=source; exit |
---|
1609 | fi |
---|
1610 | |
---|
1611 | cp $add_source_path/$dateiname . |
---|
1612 | source_list="$source_list $dateiname" |
---|
1613 | |
---|
1614 | # CHECK IF FILE IS CONTAINED IN MAKEFILE |
---|
1615 | if [[ $(grep -c $dateiname Makefile) = 0 ]] |
---|
1616 | then |
---|
1617 | printf "\n\n +++ user file \"$dateiname\" " |
---|
1618 | printf "\n is not listed in Makefile \n" |
---|
1619 | locat=source; exit |
---|
1620 | else |
---|
1621 | |
---|
1622 | if [[ $found = false ]] |
---|
1623 | then |
---|
1624 | found=true |
---|
1625 | printf "\n\n *** following user file(s) added to the" |
---|
1626 | printf " files to be translated:\n " |
---|
1627 | fi |
---|
1628 | printf "$dateiname " |
---|
1629 | if [[ $silent == false ]] |
---|
1630 | then |
---|
1631 | sleep 0.5 |
---|
1632 | fi |
---|
1633 | |
---|
1634 | fi |
---|
1635 | done |
---|
1636 | [[ $found = true ]] && printf "\n" |
---|
1637 | cd - > /dev/null |
---|
1638 | fi |
---|
1639 | fi |
---|
1640 | |
---|
1641 | |
---|
1642 | # ADD ALL ROUTINES BELONGING TO SOFTWARE PACKAGES (GIVEN BY OPTION -p) |
---|
1643 | # TO THE LIST OF FILES TO BE COMPILED |
---|
1644 | if [[ $restart_run != true && -n $package_list ]] |
---|
1645 | then |
---|
1646 | |
---|
1647 | cd $source_path |
---|
1648 | |
---|
1649 | for package in $package_list |
---|
1650 | do |
---|
1651 | |
---|
1652 | [[ $package = "dvrp_graphics+1PE" ]] && package=dvrp_graphics |
---|
1653 | |
---|
1654 | # DETERMINE FILES BELONGING TO THE PACKAGE |
---|
1655 | # ERROR MESSAGE ARE REDIRECTED TO /dev/null, BECAUSE WILDCARD (*) ALSO GIVES |
---|
1656 | # THE NAME OF THE DIRECTORY |
---|
1657 | package_source_list=`grep "defined( __$package " * 2>/dev/null | cut -f1 -d:` |
---|
1658 | |
---|
1659 | |
---|
1660 | # ADD THESE FILES TO THE LIST OF FILES TO BE COMPILED, |
---|
1661 | # IF THEY ARE NOT ALREADY PART OF THE LIST |
---|
1662 | for source_list_name in $package_source_list |
---|
1663 | do |
---|
1664 | if [[ $(echo $source_list | grep -c $source_list_name) = 0 ]] |
---|
1665 | then |
---|
1666 | |
---|
1667 | # ONLY TAKE FILES WITH VALID SUFFIX |
---|
1668 | ending=`echo $source_list_name | cut -f2 -d.` |
---|
1669 | if [[ "$ending" = f90 || "$ending" = F90 || "$ending" = f || "$ending" = F || "$ending" = c ]] |
---|
1670 | then |
---|
1671 | cp $source_list_name $working_directory/SOURCES_FOR_RUN_$fname |
---|
1672 | source_list="$source_list $source_list_name" |
---|
1673 | fi |
---|
1674 | fi |
---|
1675 | done |
---|
1676 | done |
---|
1677 | |
---|
1678 | cd - > /dev/null |
---|
1679 | fi |
---|
1680 | |
---|
1681 | fi # do_compile=true |
---|
1682 | |
---|
1683 | |
---|
1684 | # IF SOURCE CODE IS TO BE COMPILED, DO SOME MORE CHECKS |
---|
1685 | # AND SET PRE-PROCESSOR DIRECTIVES |
---|
1686 | if [[ $do_compile = true || $create_executable_for_batch = true ]] |
---|
1687 | then |
---|
1688 | |
---|
1689 | # SET PREPROCESSOR-DIRECTIVES TO SELECT OPERATING SYSTEM SPECIFIC CODE |
---|
1690 | if [[ $(echo $localhost | cut -c1-3) = ibm ]] |
---|
1691 | then |
---|
1692 | cpp_options="${cpp_options},-D__ibm=__ibm" |
---|
1693 | elif [[ $(echo $localhost | cut -c1-3) = nec ]] |
---|
1694 | then |
---|
1695 | cpp_options="$cpp_options -D__nec" |
---|
1696 | elif [[ $(echo $localhost | cut -c1-2) = lc ]] |
---|
1697 | then |
---|
1698 | cpp_options="$cpp_options -D__lc" |
---|
1699 | else |
---|
1700 | cpp_options="$cpp_options -D__$localhost" |
---|
1701 | fi |
---|
1702 | |
---|
1703 | # SET DIRECTIVES GIVEN BY OPTION -K (E.G. parallel) |
---|
1704 | if [[ $(echo $localhost | cut -c1-3) = ibm ]] |
---|
1705 | then |
---|
1706 | [[ -n $cond1 ]] && cpp_options="${cpp_options},-D__$cond1=__$cond1" |
---|
1707 | [[ -n $cond2 ]] && cpp_options="${cpp_options},-D__$cond2=__$cond2" |
---|
1708 | else |
---|
1709 | [[ -n $cond1 ]] && cpp_options="$cpp_options -D__$cond1" |
---|
1710 | [[ -n $cond2 ]] && cpp_options="$cpp_options -D__$cond2" |
---|
1711 | fi |
---|
1712 | |
---|
1713 | # SET DIRECTIVES FOR ACTIVATING SOFTWARE-PACKAGES (OPTION -p) |
---|
1714 | if [[ -n $package_list ]] |
---|
1715 | then |
---|
1716 | for package in $package_list |
---|
1717 | do |
---|
1718 | if [[ $(echo $localhost | cut -c1-3) = ibm ]] |
---|
1719 | then |
---|
1720 | if [[ $package != "dvrp_graphics+1PE" ]] |
---|
1721 | then |
---|
1722 | cpp_options="${cpp_options},-D__$package=__$package" |
---|
1723 | else |
---|
1724 | cpp_options="${cpp_options},-D__dvrp_graphics=__dvrp_graphics" |
---|
1725 | export use_seperate_pe_for_dvrp_output=true |
---|
1726 | fi |
---|
1727 | else |
---|
1728 | if [[ $package != "dvrp_graphics+1PE" ]] |
---|
1729 | then |
---|
1730 | cpp_options="$cpp_options -D__$package" |
---|
1731 | else |
---|
1732 | cpp_options="$cpp_options -D__dvrp_graphics" |
---|
1733 | export use_seperate_pe_for_dvrp_output=true |
---|
1734 | fi |
---|
1735 | fi |
---|
1736 | done |
---|
1737 | fi |
---|
1738 | |
---|
1739 | # SET DIRECTIVES GIVEN BY OPTION -D |
---|
1740 | if [[ -n $cpp_opts ]] |
---|
1741 | then |
---|
1742 | for popts in $cpp_opts |
---|
1743 | do |
---|
1744 | if [[ $(echo $localhost | cut -c1-3) = ibm ]] |
---|
1745 | then |
---|
1746 | cpp_options="${cpp_options},-D__$popts=__$popts" |
---|
1747 | else |
---|
1748 | cpp_options="$cpp_options -D__$popts" |
---|
1749 | fi |
---|
1750 | done |
---|
1751 | fi |
---|
1752 | |
---|
1753 | else |
---|
1754 | |
---|
1755 | |
---|
1756 | # FOR LOCAL RUNS CHECK AGAIN, IF EXECUTABLE EXISTS |
---|
1757 | if [[ $do_remote = false ]] |
---|
1758 | then |
---|
1759 | if [[ ! -f $executable ]] |
---|
1760 | then |
---|
1761 | printf "\n +++ executable file: $executable" |
---|
1762 | printf "\n does not exist" |
---|
1763 | locat=executable; exit |
---|
1764 | fi |
---|
1765 | fi |
---|
1766 | fi |
---|
1767 | |
---|
1768 | |
---|
1769 | # DETERMINE THE JOB MODE |
---|
1770 | if [[ "$ENVIRONMENT" = BATCH ]] |
---|
1771 | then |
---|
1772 | batch_job=.TRUE. |
---|
1773 | jobmo=BATCH |
---|
1774 | else |
---|
1775 | batch_job=.FALSE. |
---|
1776 | jobmo=INTERACTIVE |
---|
1777 | fi |
---|
1778 | |
---|
1779 | |
---|
1780 | # NO INTERACTIVE RUNS ALLOWED ON LCTIT |
---|
1781 | if [[ $host = lctit && $jobmo = INTERACTIVE && $do_batch = false ]] |
---|
1782 | then |
---|
1783 | printf "\n +++ no interactive runs allowed on host \"$host\" " |
---|
1784 | printf "\n please submit batch job using mrun option \"-b\" \n" |
---|
1785 | locat=normal; exit |
---|
1786 | fi |
---|
1787 | |
---|
1788 | |
---|
1789 | # CHECK, IF USER DEFINED A COMPILER |
---|
1790 | if [[ "$compiler_name" = "" ]] |
---|
1791 | then |
---|
1792 | |
---|
1793 | printf "\n +++ no compiler specified for \"$host $cond1 $cond2\"" |
---|
1794 | locat=compiler_name; exit |
---|
1795 | |
---|
1796 | fi |
---|
1797 | |
---|
1798 | |
---|
1799 | # DETERMINE THE NAME OF MRUN'S TEMPORARY WORKING DIRECTORY |
---|
1800 | kennung=$RANDOM |
---|
1801 | if [[ "$tmp_user_catalog" = "" ]] |
---|
1802 | then |
---|
1803 | if [[ $localhost = ibmh ]] |
---|
1804 | then |
---|
1805 | tmp_user_catalog=$SCRATCH |
---|
1806 | elif [[ $localhost = nech ]] |
---|
1807 | then |
---|
1808 | tmp_user_catalog=$WRKSHR |
---|
1809 | else |
---|
1810 | tmp_user_catalog=/tmp |
---|
1811 | fi |
---|
1812 | fi |
---|
1813 | TEMPDIR=$tmp_user_catalog/${usern}.$kennung |
---|
1814 | |
---|
1815 | |
---|
1816 | # DETERMINE THE NAME OF THE DIRECTORY WHICH IS USED TO TEMPORARILY STORE DATA FOR RESTART RUNS |
---|
1817 | if [[ "$tmp_data_catalog" = "" ]] |
---|
1818 | then |
---|
1819 | if [[ $localhost = nech ]] |
---|
1820 | then |
---|
1821 | tmp_data_catalog=$WRKSHR/mrun_restart_data |
---|
1822 | else |
---|
1823 | tmp_data_catalog=/tmp/mrun_restart_data |
---|
1824 | fi |
---|
1825 | fi |
---|
1826 | |
---|
1827 | |
---|
1828 | # IN CASE OF LOCAL RUNS REPLACE ENVIRONMENT VARIABLES BY THEIR VALUES |
---|
1829 | if [[ $do_remote = false && $do_compile = true || $create_executable_for_batch = true ]] |
---|
1830 | then |
---|
1831 | eval fopts=\"$fopts\" |
---|
1832 | eval lopts=\"$lopts\" |
---|
1833 | fi |
---|
1834 | |
---|
1835 | |
---|
1836 | |
---|
1837 | # DETERMINE COMPILE- AND LINK-OPTIONS |
---|
1838 | fopts="$fopts $netcdf_inc $fftw_inc $dvr_inc" |
---|
1839 | lopts="$lopts $netcdf_lib $fftw_lib $dvr_lib" |
---|
1840 | ROPTS="$ropts" |
---|
1841 | # 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 ]] |
---|
1842 | # then |
---|
1843 | XOPT="-X $numprocs" |
---|
1844 | # fi |
---|
1845 | |
---|
1846 | |
---|
1847 | |
---|
1848 | # CHECK THE CPU-LIMIT. IT MUST BE GIVEN FOR BATCH-JOBS AND IS COMMUNICATED TO THE |
---|
1849 | # EXECUTABLE VIA NAMELIST-PARAMETER cputime |
---|
1850 | done=false |
---|
1851 | while [[ $done = false ]] |
---|
1852 | do |
---|
1853 | cputime=$cpumax |
---|
1854 | if (( $cputime == 0 )) |
---|
1855 | then |
---|
1856 | if [[ $do_batch = true ]] |
---|
1857 | then |
---|
1858 | printf "\n +++ cpu-time is undefined" |
---|
1859 | printf "\n >>> Please type CPU-time in seconds as INTEGER:" |
---|
1860 | printf "\n >>> " |
---|
1861 | read cputime 1>/dev/null 2>&1 |
---|
1862 | else |
---|
1863 | cputime=10000000 # NO CPU LIMIT FOR INTERACTIVE RUNS |
---|
1864 | fi |
---|
1865 | else |
---|
1866 | done=true |
---|
1867 | fi |
---|
1868 | cpumax=$cputime |
---|
1869 | done |
---|
1870 | |
---|
1871 | (( minuten = cputime / 60 )) |
---|
1872 | (( sekunden = cputime - minuten * 60 )) |
---|
1873 | |
---|
1874 | |
---|
1875 | # CHECK THE MEMORY DEMAND |
---|
1876 | if [[ $do_batch = true ]] |
---|
1877 | then |
---|
1878 | done=false |
---|
1879 | while [[ $done = false ]] |
---|
1880 | do |
---|
1881 | if (( memory == 0 )) |
---|
1882 | then |
---|
1883 | printf "\n +++ memory demand is undefined" |
---|
1884 | printf "\n >>> Please type memory in MByte per process as INTEGER:" |
---|
1885 | printf "\n >>> " |
---|
1886 | read memory 1>/dev/null 2>&1 |
---|
1887 | else |
---|
1888 | done=true |
---|
1889 | fi |
---|
1890 | done |
---|
1891 | fi |
---|
1892 | |
---|
1893 | |
---|
1894 | # IN CASE OF REMOTE-JOBS CHECK, IF A USERNAME FOR THE REMOTE HOST IS GIVEN |
---|
1895 | if [[ $do_remote = true && -z $remote_username ]] |
---|
1896 | then |
---|
1897 | while [[ -z $remote_username ]] |
---|
1898 | do |
---|
1899 | printf "\n +++ username on remote host \"$host\" is undefined" |
---|
1900 | printf "\n >>> Please type username:" |
---|
1901 | printf "\n >>> " |
---|
1902 | read remote_username |
---|
1903 | done |
---|
1904 | mc="$mc -u$remote_username" |
---|
1905 | fi |
---|
1906 | |
---|
1907 | # CHECK FOR INITIAL COMMANDS AFTER LOGIN |
---|
1908 | if [[ "$login_init_cmd" != "" ]] |
---|
1909 | then |
---|
1910 | export init_cmds="${login_init_cmd};" |
---|
1911 | fi |
---|
1912 | |
---|
1913 | |
---|
1914 | # SET THE MODULE-LOAD COMMAD AND EXPORT IT FOR subjob |
---|
1915 | if [[ "$modules" != "" ]] |
---|
1916 | then |
---|
1917 | if [[ $host = lctit ]] |
---|
1918 | then |
---|
1919 | export module_calls=". $modules" |
---|
1920 | else |
---|
1921 | export module_calls="module load ${modules};" |
---|
1922 | fi |
---|
1923 | fi |
---|
1924 | |
---|
1925 | |
---|
1926 | |
---|
1927 | # OUTPUT OF THE MRUN-HEADER |
---|
1928 | calltime=$(date) |
---|
1929 | printf "\n" |
---|
1930 | printf "#------------------------------------------------------------------------# \n" |
---|
1931 | printf "| %-35s%35s | \n" "$version" "$calltime" |
---|
1932 | printf "| | \n" |
---|
1933 | spalte1="called on:"; spalte2=$localhost_realname |
---|
1934 | printf "| %-25s%-45s | \n" "$spalte1" "$spalte2" |
---|
1935 | if [[ $do_remote = true ]] |
---|
1936 | then |
---|
1937 | spalte1="execution on:"; spalte2="$host (username: $remote_username)" |
---|
1938 | else |
---|
1939 | spalte1="execution on:"; spalte2="$host ($localhost_realname)" |
---|
1940 | fi |
---|
1941 | printf "| %-25s%-45s | \n" "$spalte1" "$spalte2" |
---|
1942 | if [[ -n $numprocs ]] |
---|
1943 | then |
---|
1944 | if [[ $run_coupled_model = false ]] |
---|
1945 | then |
---|
1946 | spalte1="number of PEs:"; spalte2=$numprocs |
---|
1947 | else |
---|
1948 | spalte1="number of PEs:"; spalte2="$numprocs (atmosphere: $numprocs_atmos, ocean: $numprocs_ocean)" |
---|
1949 | fi |
---|
1950 | printf "| %-25s%-45s | \n" "$spalte1" "$spalte2" |
---|
1951 | fi |
---|
1952 | if [[ -n $tasks_per_node ]] |
---|
1953 | then |
---|
1954 | spalte1="tasks per node:"; spalte2="$tasks_per_node (number of nodes: $nodes)" |
---|
1955 | printf "| %-25s%-45s | \n" "$spalte1" "$spalte2" |
---|
1956 | if (( remaining_pes > 0 )) |
---|
1957 | then |
---|
1958 | spalte1=" "; spalte2="one of the nodes only filled with $remaining_pes tasks" |
---|
1959 | printf "| %-25s%-45s | \n" "$spalte1" "$spalte2" |
---|
1960 | fi |
---|
1961 | fi |
---|
1962 | if [[ $maximum_parallel_io_streams != $numprocs ]] |
---|
1963 | then |
---|
1964 | spalte1="max par io streams:"; spalte2="$maximum_parallel_io_streams" |
---|
1965 | printf "| %-25s%-45s | \n" "$spalte1" "$spalte2" |
---|
1966 | fi |
---|
1967 | if [[ $use_openmp = true ]] |
---|
1968 | then |
---|
1969 | spalte1="threads per task:"; spalte2="$threads_per_task" |
---|
1970 | printf "| %-25s%-45s | \n" "$spalte1" "$spalte2" |
---|
1971 | fi |
---|
1972 | printf "| | \n" |
---|
1973 | if [[ $do_compile = true ]] |
---|
1974 | then |
---|
1975 | if [[ "$mopts" != "" ]] |
---|
1976 | then |
---|
1977 | spalte1="make options:"; spalte2=$(echo "$mopts" | cut -c-45) |
---|
1978 | printf "| %-25s%-45s | \n" "$spalte1" "$spalte2" |
---|
1979 | zeile=$(echo "$mopts" | cut -c46-) |
---|
1980 | while [[ "$zeile" != "" ]] |
---|
1981 | do |
---|
1982 | spalte1="" |
---|
1983 | spalte2=$(echo "$zeile" | cut -c-45) |
---|
1984 | printf "| %-25s%-45s | \n" "$spalte1" "$spalte2" |
---|
1985 | zeile=$(echo "$zeile" | cut -c46-) |
---|
1986 | done |
---|
1987 | fi |
---|
1988 | |
---|
1989 | spalte1="cpp directives:"; spalte2=$(echo "$cpp_options" | cut -c-45) |
---|
1990 | printf "| %-25s%-45s | \n" "$spalte1" "$spalte2" |
---|
1991 | zeile=$(echo "$cpp_options" | cut -c46-) |
---|
1992 | while [[ "$zeile" != "" ]] |
---|
1993 | do |
---|
1994 | spalte1="" |
---|
1995 | spalte2=$(echo "$zeile" | cut -c-45) |
---|
1996 | printf "| %-25s%-45s | \n" "$spalte1" "$spalte2" |
---|
1997 | zeile=$(echo "$zeile" | cut -c46-) |
---|
1998 | done |
---|
1999 | |
---|
2000 | spalte1="compiler options:"; spalte2=$(echo "$fopts" | cut -c-45) |
---|
2001 | printf "| %-25s%-45s | \n" "$spalte1" "$spalte2" |
---|
2002 | zeile=$(echo "$fopts" | cut -c46-) |
---|
2003 | while [[ "$zeile" != "" ]] |
---|
2004 | do |
---|
2005 | spalte1="" |
---|
2006 | spalte2=$(echo "$zeile" | cut -c-45) |
---|
2007 | printf "| %-25s%-45s | \n" "$spalte1" "$spalte2" |
---|
2008 | zeile=$(echo "$zeile" | cut -c46-) |
---|
2009 | done |
---|
2010 | |
---|
2011 | spalte1="linker options:"; spalte2=$(echo "$lopts" | cut -c-45) |
---|
2012 | printf "| %-25s%-45s | \n" "$spalte1" "$spalte2" |
---|
2013 | zeile=$(echo "$lopts" | cut -c46-) |
---|
2014 | while [[ "$zeile" != "" ]] |
---|
2015 | do |
---|
2016 | spalte1="" |
---|
2017 | spalte2=$(echo "$zeile" | cut -c-45) |
---|
2018 | printf "| %-25s%-45s | \n" "$spalte1" "$spalte2" |
---|
2019 | zeile=$(echo "$zeile" | cut -c46-) |
---|
2020 | done |
---|
2021 | |
---|
2022 | spalte1="modules to be load:"; spalte2=$(echo "$modules" | cut -c-45) |
---|
2023 | printf "| %-25s%-45s | \n" "$spalte1" "$spalte2" |
---|
2024 | zeile=$(echo "$modules" | cut -c46-) |
---|
2025 | while [[ "$zeile" != "" ]] |
---|
2026 | do |
---|
2027 | spalte1="" |
---|
2028 | spalte2=$(echo "$zeile" | cut -c-45) |
---|
2029 | printf "| %-25s%-45s | \n" "$spalte1" "$spalte2" |
---|
2030 | zeile=$(echo "$zeile" | cut -c46-) |
---|
2031 | done |
---|
2032 | |
---|
2033 | spalte1="main program:"; spalte2=$mainprog |
---|
2034 | printf "| %-25s%-45s | \n" "$spalte1" "$spalte2" |
---|
2035 | else |
---|
2036 | spalte1=executable:; spalte2=$executable |
---|
2037 | printf "| %-25s%-45s | \n" "$spalte1" "$spalte2" |
---|
2038 | fi |
---|
2039 | printf "| | \n" |
---|
2040 | spalte1="base name of files:"; spalte2=$fname |
---|
2041 | printf "| %-25s%-45s | \n" "$spalte1" "$spalte2" |
---|
2042 | if [[ $fname != $afname ]] |
---|
2043 | then |
---|
2044 | spalte1="base name of input files:"; spalte2=$afname |
---|
2045 | printf "| %-25s%-45s | \n" "$spalte1" "$spalte2" |
---|
2046 | fi |
---|
2047 | spalte1="INPUT control list:"; spalte2=$(echo $input_list) |
---|
2048 | printf "| %-25s%-45s | \n" "$spalte1" "$spalte2" |
---|
2049 | spalte1="OUTPUT control list:"; spalte2=$(echo $output_list) |
---|
2050 | printf "| %-25s%-45s | \n" "$spalte1" "$spalte2" |
---|
2051 | |
---|
2052 | if [[ "$ocean_file_appendix" = true ]] |
---|
2053 | then |
---|
2054 | printf "| %-35s%-35s | \n" "suffix \"_O\" is added to local files" " " |
---|
2055 | fi |
---|
2056 | |
---|
2057 | if [[ $do_batch = true || "$LOADLBATCH" = yes ]] |
---|
2058 | then |
---|
2059 | spalte1="memory demand / PE":; spalte2="$memory MB" |
---|
2060 | printf "| %-25s%-45s | \n" "$spalte1" "$spalte2" |
---|
2061 | spalte1=CPU-time:; spalte2="$minuten:$sekunden" |
---|
2062 | printf "| %-25s%-45s | \n" "$spalte1" "$spalte2" |
---|
2063 | fi |
---|
2064 | |
---|
2065 | if [[ $do_compile = true ]] |
---|
2066 | then |
---|
2067 | printf "| | \n" |
---|
2068 | printf "| Files to be compiled: | \n" |
---|
2069 | zeile=$source_list |
---|
2070 | while [[ "$zeile" != "" ]] |
---|
2071 | do |
---|
2072 | linestart=$(echo $zeile | cut -c-70) |
---|
2073 | printf "| %-70s | \n" "$linestart" |
---|
2074 | zeile=$(echo "$zeile" | cut -c71-) |
---|
2075 | done |
---|
2076 | fi |
---|
2077 | printf "#------------------------------------------------------------------------#" |
---|
2078 | |
---|
2079 | |
---|
2080 | |
---|
2081 | # OUTPUT OF FILE CONNECTIONS IN CASE OF TRACEBACK |
---|
2082 | if [[ $do_trace = true ]] |
---|
2083 | then |
---|
2084 | (( i = 0 )) |
---|
2085 | while (( i < iin )) |
---|
2086 | do |
---|
2087 | (( i = i + 1 )) |
---|
2088 | if (( i == 1 )) |
---|
2089 | then |
---|
2090 | printf "\n\n >>> INPUT-file assignments:\n" |
---|
2091 | fi |
---|
2092 | printf "\n ${localin[$i]} : ${absnamein[$i]}" |
---|
2093 | done |
---|
2094 | (( i = 0 )) |
---|
2095 | while (( i < iout )) |
---|
2096 | do |
---|
2097 | (( i = i + 1 )) |
---|
2098 | if (( i == 1 )) |
---|
2099 | then |
---|
2100 | printf "\n\n >>> OUTPUT-file assignments:\n" |
---|
2101 | fi |
---|
2102 | printf "\n ${localout[$i]} : ${pathout[$i]}" |
---|
2103 | done |
---|
2104 | (( i = 0 )) |
---|
2105 | while (( i < iic )) |
---|
2106 | do |
---|
2107 | (( i = i + 1 )) |
---|
2108 | if (( i == 1 )) |
---|
2109 | then |
---|
2110 | printf "\n\n >>> INPUT-commands:\n" |
---|
2111 | fi |
---|
2112 | printf "\n ${in_command[$i]}" |
---|
2113 | done |
---|
2114 | (( i = 0 )) |
---|
2115 | while (( i < ioc )) |
---|
2116 | do |
---|
2117 | (( i = i + 1 )) |
---|
2118 | if (( i == 1 )) |
---|
2119 | then |
---|
2120 | printf "\n\n >>> OUTPUT-commands:\n" |
---|
2121 | fi |
---|
2122 | printf "\n ${out_command[$i]}" |
---|
2123 | done |
---|
2124 | fi |
---|
2125 | |
---|
2126 | |
---|
2127 | # QUERY FOR CONTINUE (ON LOCAL MACHINES ONLY) |
---|
2128 | if [[ $remotecall = false && $silent = false && $jobmo != BATCH ]] |
---|
2129 | then |
---|
2130 | antwort=dummy |
---|
2131 | printf "\n\n" |
---|
2132 | printf " >>> everything o.k. (y/n) ? " |
---|
2133 | while read antwort |
---|
2134 | do |
---|
2135 | if [[ "$antwort" != y && "$antwort" != Y && "$antwort" != n && "$antwort" != N ]] |
---|
2136 | then |
---|
2137 | printf " >>> everything o.k. (y/n) ? " |
---|
2138 | else |
---|
2139 | break |
---|
2140 | fi |
---|
2141 | done |
---|
2142 | if [[ $antwort = n || $antwort = N ]] |
---|
2143 | then |
---|
2144 | locat=user_abort; (( iec = 0 )); exit |
---|
2145 | fi |
---|
2146 | if [[ $do_batch = true ]] |
---|
2147 | then |
---|
2148 | printf " >>> batch-job will be created and submitted" |
---|
2149 | else |
---|
2150 | printf " >>> MRUN will now continue to execute on this machine" |
---|
2151 | fi |
---|
2152 | fi |
---|
2153 | |
---|
2154 | |
---|
2155 | # PERFORM PARAMETER FILE CHECK (COUPLED RUNS ARE NOT SUPPORTED YET) |
---|
2156 | # DEFINE VARIABLES FOR FREQUENTLY USED DIRECTORIES |
---|
2157 | check_depository="${working_directory}/trunk/UTIL" |
---|
2158 | check_sources="${working_directory}/tmp_check_namelist_files" |
---|
2159 | skip_check=false |
---|
2160 | |
---|
2161 | # CHECK IF NAMELIST_FILE_CHECK HAS BEEN COMPILED SUCCESSFULLY |
---|
2162 | if [[ ! -f $check_depository/check_namelist_files.tar ]] |
---|
2163 | then |
---|
2164 | skip_check=true |
---|
2165 | reason="run on remote host or parameter file check has not been compiled." |
---|
2166 | fi |
---|
2167 | if [[ ! -f $PALM_BIN/check_namelist_files.x ]] |
---|
2168 | then |
---|
2169 | skip_check=true |
---|
2170 | reason="parameter file check has not been compiled." |
---|
2171 | fi |
---|
2172 | |
---|
2173 | # CHECK FOR PARALLEL RUN; OTHERWISE SKIP CHECK |
---|
2174 | if [[ "$cond1" != "parallel" && "$cond2" != "parallel" ]] |
---|
2175 | then |
---|
2176 | skip_check=true |
---|
2177 | reason="serial run." |
---|
2178 | fi |
---|
2179 | |
---|
2180 | # ONLY PERFORM CHECK IF -z OPTION IS NOT SET, NO RESTART RUN IS CARRIED OUT |
---|
2181 | # AND IF THE EXECUTION HOST IS THE LOCAL HOST |
---|
2182 | # ATTENTION: THIS ROUTINE DOES NOT WORK IF THE COMPILER ON THE LOCAL HOST |
---|
2183 | # DIFFERS FROM THE COMPILER ON THE REMOTE HOST |
---|
2184 | if [[ $check_namelist_files == false ]] |
---|
2185 | then |
---|
2186 | skip_check=true |
---|
2187 | reason="-z option set." |
---|
2188 | fi |
---|
2189 | |
---|
2190 | if [[ $fromhost != $localhost ]] |
---|
2191 | then |
---|
2192 | skip_check=true |
---|
2193 | reason="submitting host is local host." |
---|
2194 | fi |
---|
2195 | |
---|
2196 | if [[ $run_coupled_model == true ]] |
---|
2197 | then |
---|
2198 | skip_check=true |
---|
2199 | reason="coupled run." |
---|
2200 | fi |
---|
2201 | |
---|
2202 | if [[ $restart_run == true ]] |
---|
2203 | then |
---|
2204 | skip_check=true |
---|
2205 | reason="restart run." |
---|
2206 | fi |
---|
2207 | |
---|
2208 | # SKIP CHECK IN CASE OF RESTART RUN: CHECK WHETHER THE LAST CHAR IS "f" IN PARIN |
---|
2209 | (( last_char_int = `echo $filename_input | wc -c` - 1 )) |
---|
2210 | last_char=`echo $filename_input | cut -c $last_char_int` |
---|
2211 | if [[ "$last_char" == "f" ]] |
---|
2212 | then |
---|
2213 | skip_check=true |
---|
2214 | reason="restart run." |
---|
2215 | fi |
---|
2216 | |
---|
2217 | if [[ $skip_check == false ]] |
---|
2218 | then |
---|
2219 | tmp_check=${working_directory}/tmp_check |
---|
2220 | |
---|
2221 | # GET TOPOGRAPHY PARAMETER FILE SUFFIX (USUALLY "_TOPO"). THIS FILE IS |
---|
2222 | # NOT NECESSARILY REQUIRED |
---|
2223 | line="" |
---|
2224 | found=false |
---|
2225 | grep "TOPOGRAPHY_DATA" $config_file > $tmp_check |
---|
2226 | while read line1 |
---|
2227 | do |
---|
2228 | line="$line1" |
---|
2229 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
2230 | then |
---|
2231 | topo_suffix=`echo $line | tr -s " " | cut -d" " -s -f5` |
---|
2232 | found=true |
---|
2233 | fi |
---|
2234 | done < $tmp_check |
---|
2235 | |
---|
2236 | if [[ $found = false ]] |
---|
2237 | then |
---|
2238 | printf "\n +++ no TOPOGRAPHY list entry found in the configuration file." |
---|
2239 | fi |
---|
2240 | |
---|
2241 | # GET NUDGING PARAMETER FILE SUFFIX (USUALLY "_NUDGE"). THIS FILE IS |
---|
2242 | # NOT NECESSARILY REQUIRED |
---|
2243 | line="" |
---|
2244 | found=false |
---|
2245 | grep "NUDGING_DATA" $config_file > $tmp_check |
---|
2246 | while read line1 |
---|
2247 | do |
---|
2248 | line="$line1" |
---|
2249 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
2250 | then |
---|
2251 | nudge_suffix=`echo $line | tr -s " " | cut -d" " -s -f5` |
---|
2252 | found=true |
---|
2253 | fi |
---|
2254 | done < $tmp_check |
---|
2255 | |
---|
2256 | if [[ $found = false ]] |
---|
2257 | then |
---|
2258 | printf "\n +++ no NUDGING list entry found in the configuration file." |
---|
2259 | fi |
---|
2260 | |
---|
2261 | # GET LARGE SCALE FORCING PARAMETER FILE SUFFIX (USUALLY "_LSF"). THIS FILE IS |
---|
2262 | # NOT NECESSARILY REQUIRED |
---|
2263 | line="" |
---|
2264 | found=false |
---|
2265 | grep "LSF_DATA" $config_file > $tmp_check |
---|
2266 | while read line1 |
---|
2267 | do |
---|
2268 | line="$line1" |
---|
2269 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
2270 | then |
---|
2271 | lsf_suffix=`echo $line | tr -s " " | cut -d" " -s -f5` |
---|
2272 | found=true |
---|
2273 | fi |
---|
2274 | done < $tmp_check |
---|
2275 | |
---|
2276 | if [[ $found = false ]] |
---|
2277 | then |
---|
2278 | printf "\n +++ no LSF list entry found in the configuration file." |
---|
2279 | fi |
---|
2280 | |
---|
2281 | rm -rf ${working_directory}/tmp_check |
---|
2282 | |
---|
2283 | # CHECK IF THE P3DF FILE MUST BE CHECKED |
---|
2284 | for item in $input_list |
---|
2285 | do |
---|
2286 | if [[ "$item" == "restart" ]] |
---|
2287 | then |
---|
2288 | check_restart=1 |
---|
2289 | else |
---|
2290 | check_restart=0 |
---|
2291 | fi |
---|
2292 | done |
---|
2293 | |
---|
2294 | # ERROR IF NO PARAMETER FILE WAS FOUND, OTHERWISE PROCEED |
---|
2295 | if [[ (! -f $filename_input) && ( "$filename_input" != "" ) ]] |
---|
2296 | then |
---|
2297 | printf "\n\n +++ ERROR: parameter file ($filename_input) not found." |
---|
2298 | locat=check_namelist; exit |
---|
2299 | fi |
---|
2300 | |
---|
2301 | # CHECK IF THE RESTART PARAMETER FILE EXISTS (IF NECESSARY) |
---|
2302 | if [[ $check_restart == 1 ]] |
---|
2303 | then |
---|
2304 | |
---|
2305 | filenamef="${filename_input}f" |
---|
2306 | if [[ ! -f $filenamef ]] |
---|
2307 | then |
---|
2308 | printf "\n\n +++ WARNING: restart parameter file ($filenamef) is missing." |
---|
2309 | check_restart=0 |
---|
2310 | answer=dummy |
---|
2311 | printf "\n\n" |
---|
2312 | |
---|
2313 | if [[ $silent == false ]] |
---|
2314 | then |
---|
2315 | while [[ "$answer" != c && "$answer" != C && "$answer" != a && "$answer" != A ]] |
---|
2316 | do |
---|
2317 | printf " >>> continue anyway (c(ontinue)/a(bort)) ? " |
---|
2318 | read answer |
---|
2319 | done |
---|
2320 | if [[ $answer = a || $answer = A ]] |
---|
2321 | then |
---|
2322 | printf "\n +++ Aborting...." |
---|
2323 | locat=normal; exit |
---|
2324 | fi |
---|
2325 | fi |
---|
2326 | else |
---|
2327 | check_restart=1 |
---|
2328 | fi |
---|
2329 | fi |
---|
2330 | |
---|
2331 | # CREATE TEMPORARY SOURCES_FOR_CHECK PATH |
---|
2332 | mkdir $check_sources |
---|
2333 | cd $check_sources |
---|
2334 | |
---|
2335 | |
---|
2336 | # CHECK FOR USER CODE, OTHERWISE USE THE PRECOMPILED CHECK_NAMELIST_FILES.X |
---|
2337 | if [[ -d $add_source_path ]] |
---|
2338 | then |
---|
2339 | printf "\n\n *** copying files from $check_depository" |
---|
2340 | cp $check_depository/check_namelist_files.tar ./ |
---|
2341 | |
---|
2342 | printf "\n\n *** untar of makefile and source files in $check_sources" |
---|
2343 | tar -xf check_namelist_files.tar > /dev/null 2>&1 |
---|
2344 | |
---|
2345 | printf "\n\n *** adding user code." |
---|
2346 | cp $add_source_path/* ./ |
---|
2347 | touch check_namelist_files.f90 |
---|
2348 | |
---|
2349 | # GET COMPILER OPTIONS AND PERFORM MAKE |
---|
2350 | printf "\n\n *** compiling code if necessary...\n" |
---|
2351 | |
---|
2352 | # workaround for batch jobs on local machine (lcxe6) |
---|
2353 | if [[ $do_batch == true && $do_remote == false ]] |
---|
2354 | then |
---|
2355 | eval $init_cmds |
---|
2356 | fi |
---|
2357 | |
---|
2358 | # GET CHECK OPTIONS |
---|
2359 | line="" |
---|
2360 | found=false |
---|
2361 | |
---|
2362 | grep "$localhost" ${base_directory}/${config_file} | grep "%cpp_options" > $tmp_check |
---|
2363 | |
---|
2364 | while read line1 |
---|
2365 | do |
---|
2366 | |
---|
2367 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$localhost" ]] |
---|
2368 | then |
---|
2369 | line="$line1" |
---|
2370 | fi |
---|
2371 | |
---|
2372 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
2373 | then |
---|
2374 | # REMOVE COLONS FROM OPTION-STRING, REMOVE ALL -D OPTIONS |
---|
2375 | line="$line " |
---|
2376 | 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'` |
---|
2377 | found=true |
---|
2378 | fi |
---|
2379 | |
---|
2380 | done < $tmp_check |
---|
2381 | copts_check="$copts_check -D__check -D__parallel" |
---|
2382 | |
---|
2383 | make -f Makefile_check F90=$compiler_name_ser COPT="$copts_check" |
---|
2384 | |
---|
2385 | # GET MAKE OUTPUT |
---|
2386 | if [[ $? != 0 ]] |
---|
2387 | then |
---|
2388 | printf "\n +++ error during make." |
---|
2389 | answer=dummy |
---|
2390 | printf "\n\n" |
---|
2391 | if [[ $silent == false ]] |
---|
2392 | then |
---|
2393 | while [[ "$answer" != c && "$answer" != C && "$answer" != a && "$answer" != A ]] |
---|
2394 | do |
---|
2395 | printf " >>> continue anyway (c(ontinue)/a(bort)) ? " |
---|
2396 | read answer |
---|
2397 | done |
---|
2398 | if [[ $answer = a || $answer = A ]] |
---|
2399 | then |
---|
2400 | printf "\n +++ Aborting..." |
---|
2401 | rm -rf $check_sources |
---|
2402 | locat=normal; exit |
---|
2403 | else |
---|
2404 | skip_check=true |
---|
2405 | fi |
---|
2406 | else |
---|
2407 | skip_check=true |
---|
2408 | fi |
---|
2409 | fi |
---|
2410 | else |
---|
2411 | cp $PALM_BIN/check_namelist_files.x ./ |
---|
2412 | fi |
---|
2413 | |
---|
2414 | cp $filename_input ./PARIN |
---|
2415 | if [[ $check_restart == 1 ]] |
---|
2416 | then |
---|
2417 | cp $filenamef ./PARINF |
---|
2418 | fi |
---|
2419 | |
---|
2420 | if [[ -f ${pathname}/${fname}${topo_suffix} && $skip_check == false ]] |
---|
2421 | then |
---|
2422 | printf "\n *** adding topography data" |
---|
2423 | cp ${pathname}/${fname}${topo_suffix} ./TOPOGRAPHY_DATA |
---|
2424 | |
---|
2425 | # IN CASE OF TOPOGRAPHY AND HIGH GRID POINT NUMBERS, THE STACK SIZE |
---|
2426 | # MUST BE INCREASED. THIS IS DUE TO THE ARRAY nzb_local AND topo_height, |
---|
2427 | # WHICH REQUIRE SUFFICIENT MEMORY |
---|
2428 | ulimit -s unlimited |
---|
2429 | fi |
---|
2430 | |
---|
2431 | if [[ -f ${pathname}/${fname}${nudge_suffix} && $skip_check == false ]] |
---|
2432 | then |
---|
2433 | printf "\n *** adding nudging data" |
---|
2434 | cp ${pathname}/${fname}${nudge_suffix} ./NUDGING_DATA |
---|
2435 | fi |
---|
2436 | |
---|
2437 | if [[ -f ${pathname}/${fname}${lsf_suffix} && $skip_check == false ]] |
---|
2438 | then |
---|
2439 | printf "\n *** adding large scale forcing data" |
---|
2440 | cp ${pathname}/${fname}${lsf_suffix} ./LSF_DATA |
---|
2441 | fi |
---|
2442 | |
---|
2443 | # CREATE ENVPAR FILE, WHICH IS NEEDED BY CHECK_NAMELIST_FILES.X |
---|
2444 | cat > ENVPAR << %%END%% |
---|
2445 | &envpar run_identifier = '$fname', host = '$host', |
---|
2446 | write_binary = '$write_binary', tasks_per_node = $tasks_per_node, |
---|
2447 | maximum_parallel_io_streams = $maximum_parallel_io_streams, |
---|
2448 | maximum_cpu_time_allowed = ${cpumax}., |
---|
2449 | revision = '$global_revision', |
---|
2450 | local_dvrserver_running = $local_dvrserver_running / |
---|
2451 | |
---|
2452 | %%END%% |
---|
2453 | |
---|
2454 | # SAFETY CHECK: ONLY PROCEED IF THE PARAMETER CHECK PROGRAM WAS PROPERLY COMPILED |
---|
2455 | if [[ ! -f check_namelist_files.x && $skip_check == false ]] |
---|
2456 | then |
---|
2457 | printf "\n +++ WARNING: check_namelist_files.x not found." |
---|
2458 | answer=dummy |
---|
2459 | printf "\n\n" |
---|
2460 | |
---|
2461 | if [[ $silent == false ]] |
---|
2462 | then |
---|
2463 | while [[ "$answer" != c && "$answer" != C && "$answer" != a && "$answer" != A ]] |
---|
2464 | do |
---|
2465 | printf " >>> continue anyway (c(ontinue)/a(bort)) ? " |
---|
2466 | read answer |
---|
2467 | done |
---|
2468 | if [[ $answer = a || $answer = A ]] |
---|
2469 | then |
---|
2470 | printf "\n +++ Aborting..." |
---|
2471 | rm -rf $check_sources |
---|
2472 | locat=normal; exit |
---|
2473 | else |
---|
2474 | printf "\n *** skipping parameter file check." |
---|
2475 | fi |
---|
2476 | fi |
---|
2477 | |
---|
2478 | elif [[ $skip_check == false ]] |
---|
2479 | then |
---|
2480 | # STARTING THE PARAMETER FILE CHECK |
---|
2481 | printf "\n\n *** starting parameter file check..." |
---|
2482 | |
---|
2483 | # CHECKING THE P3D FILE |
---|
2484 | printf "\n\n (1) checking $filename_input" |
---|
2485 | echo "$numprocs 0 0" > VARIN |
---|
2486 | errors=`./check_namelist_files.x < VARIN 2>&1` |
---|
2487 | |
---|
2488 | check_error=false |
---|
2489 | if [[ "$errors" == "" ]] |
---|
2490 | then |
---|
2491 | printf " --> o.k." |
---|
2492 | else |
---|
2493 | printf " --> failed." |
---|
2494 | check_error=true |
---|
2495 | printf "\n\n $errors" |
---|
2496 | fi |
---|
2497 | |
---|
2498 | # CHECKING THE PD3F FILE IF NECESSARY |
---|
2499 | if [[ $check_restart == 1 && $check_error == false ]] |
---|
2500 | then |
---|
2501 | printf "\n\n (2) checking $filenamef" |
---|
2502 | |
---|
2503 | # FIRST CHECK IF INITIALIZING_ACTIONS="READ_RESTART_DATA" IS SET |
---|
2504 | # IN &INIPAR LIST |
---|
2505 | found=false |
---|
2506 | cat PARINF | while read line |
---|
2507 | do |
---|
2508 | line=$(echo $line|sed 's/ //g') |
---|
2509 | if [[ $line == *"&inipar"* ]] |
---|
2510 | then |
---|
2511 | start_search=true |
---|
2512 | fi |
---|
2513 | |
---|
2514 | if [[ $start_search == true ]] |
---|
2515 | then |
---|
2516 | if [[ $line == *"initializing_actions='read_restart_data'"* ]] |
---|
2517 | then |
---|
2518 | found=true |
---|
2519 | break |
---|
2520 | fi |
---|
2521 | fi |
---|
2522 | |
---|
2523 | if [[ $line == *"/"* ]] |
---|
2524 | then |
---|
2525 | start_search=false |
---|
2526 | fi |
---|
2527 | |
---|
2528 | done |
---|
2529 | |
---|
2530 | if [[ $found = false ]] |
---|
2531 | then |
---|
2532 | printf "\n\n +++ ERROR: initializing_actions = 'read_restart_data' not found" |
---|
2533 | printf "\n in &inipar list in $fname$p3df_suffix." |
---|
2534 | rm -rf $check_sources |
---|
2535 | locat=check_namelist; exit |
---|
2536 | fi |
---|
2537 | |
---|
2538 | # READ max_user_pr FROM FILES |
---|
2539 | if [[ -f parin_for_check ]] |
---|
2540 | then |
---|
2541 | read max_pr_user < parin_for_check |
---|
2542 | else |
---|
2543 | max_user_pr=0 |
---|
2544 | fi |
---|
2545 | |
---|
2546 | echo "$numprocs 1 $max_pr_user" > VARIN |
---|
2547 | errors=`./check_namelist_files.x < VARIN 2>&1` |
---|
2548 | |
---|
2549 | if [[ "$errors" == "" ]] |
---|
2550 | then |
---|
2551 | printf " --> o.k." |
---|
2552 | else |
---|
2553 | printf " --> failed." |
---|
2554 | check_error=true |
---|
2555 | printf "\n\n $errors" |
---|
2556 | fi |
---|
2557 | fi |
---|
2558 | |
---|
2559 | # REPORT ERRORS AND CONTINUE/EXIT |
---|
2560 | if [[ $check_error == true ]] |
---|
2561 | then |
---|
2562 | printf "\n +++ errors found in the parameter file!\n" |
---|
2563 | answer=dummy |
---|
2564 | printf "\n\n" |
---|
2565 | |
---|
2566 | while [[ "$answer" != c && "$answer" != C && "$answer" != a && "$answer" != A ]] |
---|
2567 | do |
---|
2568 | printf " >>> continue anyway (c(ontinue)/a(bort)) ? " |
---|
2569 | read answer |
---|
2570 | done |
---|
2571 | |
---|
2572 | if [[ $answer = a || $answer = A ]] |
---|
2573 | then |
---|
2574 | printf "\n +++ Aborting..." |
---|
2575 | rm -rf $check_sources |
---|
2576 | locat=normal; exit |
---|
2577 | fi |
---|
2578 | else |
---|
2579 | printf "\n\n *** parameter file(s) seem(s) to be o.k.\n" |
---|
2580 | fi |
---|
2581 | rm -rf $check_sources |
---|
2582 | fi |
---|
2583 | else |
---|
2584 | printf "\n\n +++ skipping parameter file check due to following reason: $reason \n" |
---|
2585 | fi |
---|
2586 | |
---|
2587 | # DELETE TEMPORARY DIRECTORY AND FINISH NAMELIST FILE CHECK |
---|
2588 | rm -rf $check_sources |
---|
2589 | cd $working_directory |
---|
2590 | |
---|
2591 | |
---|
2592 | # DETERMINE PATH FOR MAKE DEPOSITORY |
---|
2593 | if [[ $do_batch = false || $create_executable_for_batch = true ]] |
---|
2594 | then |
---|
2595 | |
---|
2596 | line="" |
---|
2597 | grep "%depository_path" $config_file > tmp_mrun |
---|
2598 | while read line |
---|
2599 | do |
---|
2600 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
2601 | then |
---|
2602 | if [[ "$(echo $line | cut -d" " -s -f3)" = "" ]] |
---|
2603 | then |
---|
2604 | global_depository_path=`echo $line | cut -d" " -s -f2` |
---|
2605 | fi |
---|
2606 | fi |
---|
2607 | done < tmp_mrun |
---|
2608 | |
---|
2609 | line="" |
---|
2610 | grep " $localhost" $config_file | grep "%depository_path" > tmp_mrun |
---|
2611 | while read line |
---|
2612 | do |
---|
2613 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
2614 | then |
---|
2615 | if [[ "$(echo $line | cut -d" " -s -f4)" = "$cond1" && "$(echo $line | cut -d" " -s -f5)" = "$cond2" ]] |
---|
2616 | then |
---|
2617 | local_depository_path=`echo $line | cut -d" " -s -f2` |
---|
2618 | fi |
---|
2619 | fi |
---|
2620 | done < tmp_mrun |
---|
2621 | |
---|
2622 | if [[ "$local_depository_path" = "" ]] |
---|
2623 | then |
---|
2624 | if [[ "$global_depository_path" != "" ]] |
---|
2625 | then |
---|
2626 | local_depository_path=$global_depository_path |
---|
2627 | else |
---|
2628 | printf "\n\n +++ no depository path found in configuration file" |
---|
2629 | printf "\n for local host \"$localhost\" " |
---|
2630 | printf "\n please set \"\%depository_path\" in configuration file\n" |
---|
2631 | locat=config_file; exit |
---|
2632 | fi |
---|
2633 | fi |
---|
2634 | eval local_depository_path=$local_depository_path |
---|
2635 | [[ "$cond1" != "" ]] && local_depository_path=${local_depository_path}_$cond1 |
---|
2636 | [[ "$cond2" != "" ]] && local_depository_path=${local_depository_path}_$cond2 |
---|
2637 | |
---|
2638 | |
---|
2639 | basename=`echo $mainprog | cut -f1 -d"."` |
---|
2640 | eval make_depository=${local_depository_path}/${basename}_current_version.tar |
---|
2641 | if [[ ! -f $make_depository ]] |
---|
2642 | then |
---|
2643 | printf "\n" |
---|
2644 | printf "\n *** WARNING: make depository \"$make_depository\" not found" |
---|
2645 | printf "\n \"make\" will fail, if the Makefile or other source files are missing\n" |
---|
2646 | fi |
---|
2647 | |
---|
2648 | fi |
---|
2649 | |
---|
2650 | |
---|
2651 | # NOW PERFORM THOSE ACTIONS REQUIRED TO EXECUTE THE PROGRAM (PALM) ON THIS MACHINE |
---|
2652 | # (COMPILING/LINKING, EXECUTING, COPYING I/O FILES) |
---|
2653 | if [[ $do_batch = false ]] |
---|
2654 | then |
---|
2655 | |
---|
2656 | |
---|
2657 | # CREATE THE TEMPORARY WORKING DIRECTORY |
---|
2658 | mkdir -p $TEMPDIR |
---|
2659 | chmod go+rx $TEMPDIR |
---|
2660 | tmpcreate=true |
---|
2661 | |
---|
2662 | |
---|
2663 | # COPY EITHER THE COMPLETE SOURCE CODE FILES TO BE COMPILED OR THE EXECUTABLE |
---|
2664 | # INTO THE TEMPORARY WORKING DIRECTORY |
---|
2665 | if [[ $do_compile = true ]] |
---|
2666 | then |
---|
2667 | |
---|
2668 | # ON NEC, COMPILATION IS DONE ON HOST CROSS VIA CROSS COMPILING |
---|
2669 | # CREATE A TEMPORARY DIRECTORY ON THAT MACHINE (HOME MOUNTED VIA NFS) |
---|
2670 | if [[ $localhost = nech ]] |
---|
2671 | then |
---|
2672 | TEMPDIR_COMPILE=$HOME/work/${usern}.$kennung |
---|
2673 | if mkdir -p $TEMPDIR_COMPILE |
---|
2674 | then |
---|
2675 | printf "\n *** \"$TEMPDIR_COMPILE\" " |
---|
2676 | printf "\n is generated as temporary directory for cross compiling\n" |
---|
2677 | else |
---|
2678 | printf "\n +++ creating directory \"$TEMPDIR_COMPILE\" " |
---|
2679 | printf "\n needed for cross compilation failed" |
---|
2680 | locat=compile |
---|
2681 | exit |
---|
2682 | fi |
---|
2683 | else |
---|
2684 | TEMPDIR_COMPILE=$TEMPDIR |
---|
2685 | fi |
---|
2686 | |
---|
2687 | cp $make_depository $TEMPDIR_COMPILE |
---|
2688 | cd $TEMPDIR_COMPILE |
---|
2689 | tar -xf $make_depository > /dev/null 2>&1 |
---|
2690 | cd - > /dev/null |
---|
2691 | |
---|
2692 | # DUE TO UNKNOWN REASONS, COPY WITH cp COMMAND CREATES CORRUPT |
---|
2693 | # FILES ON CRAY XC30 SYSTEMS (HLRN III), rsync IS USED INSTEAD |
---|
2694 | if [[ $(echo $host | cut -c1-6) = lccray ]] |
---|
2695 | then |
---|
2696 | rsync -av -t SOURCES_FOR_RUN_$fname/* $TEMPDIR_COMPILE > /dev/null |
---|
2697 | else |
---|
2698 | cp SOURCES_FOR_RUN_$fname/* $TEMPDIR_COMPILE > /dev/null |
---|
2699 | fi |
---|
2700 | |
---|
2701 | else |
---|
2702 | |
---|
2703 | cp $executable ${TEMPDIR}/a.out |
---|
2704 | |
---|
2705 | fi |
---|
2706 | |
---|
2707 | |
---|
2708 | # CHANGE TO THE TEMPORARY WORKING DIRECTORY |
---|
2709 | cd $TEMPDIR |
---|
2710 | printf "\n *** changed to temporary directory: $TEMPDIR" |
---|
2711 | |
---|
2712 | |
---|
2713 | # THE FOLLOWING IS REQUIRED FPR AVS-OUTPUT WITH PALM ??? REMOVE ??? |
---|
2714 | # WRITE INFORMATIONS ABOUT THE OUTPUT-FILE CONNECTIONS TO A TEMPORARY FILE |
---|
2715 | # THIS FILE CAN LATER BE READ FROM USER-DEFINED CODE TO DETERMINE THE |
---|
2716 | # RELATION BETWEEN THE LOCAL TEMPORARY AND PERMANENT FILE NAMES |
---|
2717 | (( i = 0 )) |
---|
2718 | while (( i < iout )) |
---|
2719 | do |
---|
2720 | (( i = i + 1 )) |
---|
2721 | if [[ "${actionout[$i]}" = tr || "${actionout[$i]}" = tra || "${actionout[$i]}" = trpe ]] |
---|
2722 | then |
---|
2723 | printf "${localout[$i]} ${actionout[$i]}\n${pathout[$i]}\n${localhost}_${fname}${endout[$i]}\n" >> OUTPUT_FILE_CONNECTIONS |
---|
2724 | else |
---|
2725 | printf "${localout[$i]} ${actionout[$i]}\n${pathout[$i]}\n${frelout[$i]}\n" >> OUTPUT_FILE_CONNECTIONS |
---|
2726 | fi |
---|
2727 | done |
---|
2728 | |
---|
2729 | |
---|
2730 | # IF REQUIRED, START WITH COMPILING |
---|
2731 | if [[ $do_compile = true ]] |
---|
2732 | then |
---|
2733 | |
---|
2734 | |
---|
2735 | if [[ -f a.out ]] |
---|
2736 | then |
---|
2737 | |
---|
2738 | # EXECUTABLE WAS CREATED DURING INTERACTIVE CALL OF MRUN |
---|
2739 | printf "\n\n\n *** executable a.out found" |
---|
2740 | printf "\n no compilation required \n" |
---|
2741 | |
---|
2742 | else |
---|
2743 | |
---|
2744 | # COMPILING WITH MAKE (ON NEC COMPILER IS CALLED ON HOST CROSS) |
---|
2745 | printf "\n\n\n *** compilation starts \n$dashes\n" |
---|
2746 | printf " *** compilation with make using following options:\n" |
---|
2747 | printf " make depository: $make_depository" |
---|
2748 | if [[ "$mopts" != "" ]] |
---|
2749 | then |
---|
2750 | printf " make options: $mopts\n" |
---|
2751 | fi |
---|
2752 | printf " compilername: $compiler_name\n" |
---|
2753 | printf " compiler options: $fopts\n" |
---|
2754 | printf " preprocessor directives: $cpp_options \n" |
---|
2755 | printf " linker options: $lopts \n" |
---|
2756 | if [[ "$modules" != "" ]] |
---|
2757 | then |
---|
2758 | printf " modules to be load: $modules \n" |
---|
2759 | fi |
---|
2760 | printf " source code files: $source_list \n" |
---|
2761 | |
---|
2762 | if [[ $localhost = nech ]] |
---|
2763 | then |
---|
2764 | 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\" " |
---|
2765 | cp $TEMPDIR_COMPILE/a.out . |
---|
2766 | [[ $? != 0 ]] && compile_error=true |
---|
2767 | rm -rf $TEMPDIR_COMPILE |
---|
2768 | elif [[ $localhost = ibmh ]] |
---|
2769 | then |
---|
2770 | printf " compiler is called via ssh on \"plogin1\" \n" |
---|
2771 | 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\" " |
---|
2772 | [[ ! -f a.out ]] && compile_error=true |
---|
2773 | continue # STATUS=1, IF a.out EXISTS |
---|
2774 | elif [[ $localhost = lcflow ]] |
---|
2775 | then |
---|
2776 | printf " compiler is called via ssh on \"flow\" \n" |
---|
2777 | /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\" " |
---|
2778 | check_for_file=`/usr/bin/ssh $SSH_PORTOPT flow02.hpc.uni-oldenburg.de -l $usern "ls $TEMPDIR/a.out 2> /dev/null"` |
---|
2779 | [[ "$check_for_file" = "" ]] && compile_error=true |
---|
2780 | continue # STATUS=1, IF a.out EXISTS |
---|
2781 | elif [[ $localhost = lccrayb || $localhost = lccrayf || $localhost = lccrayh ]] |
---|
2782 | then |
---|
2783 | make $mopts -f Makefile PROG=a.out F90=$compiler_name COPT="$cpp_options" F90FLAGS="$fopts" LDFLAGS="$lopts" |
---|
2784 | else |
---|
2785 | [[ "$init_cmds" != "" ]] && eval $init_cmds |
---|
2786 | [[ "$module_calls" != "" ]] && eval $module_calls |
---|
2787 | make $mopts -f Makefile PROG=a.out F90=$compiler_name COPT="$cpp_options" F90FLAGS="$fopts" LDFLAGS="$lopts" |
---|
2788 | fi |
---|
2789 | |
---|
2790 | if [[ $? != 0 || "$compile_error" = true || "$module_compile_error" = true ]] |
---|
2791 | then |
---|
2792 | printf "\n +++ error occured while compiling or linking" |
---|
2793 | locat=compile |
---|
2794 | |
---|
2795 | exit |
---|
2796 | else |
---|
2797 | printf "$dashes\n *** compilation finished \n" |
---|
2798 | fi |
---|
2799 | |
---|
2800 | fi |
---|
2801 | |
---|
2802 | fi |
---|
2803 | |
---|
2804 | |
---|
2805 | # PROVIDE THE INPUT FILES |
---|
2806 | # LOOP OVER ALL ACTIVATED FILES (LISTED IN THE CONFIGURATION FILE) |
---|
2807 | (( i = 0 )) |
---|
2808 | while (( i < iin )) |
---|
2809 | do |
---|
2810 | (( i = i + 1 )) |
---|
2811 | if (( i == 1 )) |
---|
2812 | then |
---|
2813 | printf "\n\n *** providing INPUT-files:\n$dashes" |
---|
2814 | fi |
---|
2815 | |
---|
2816 | |
---|
2817 | # SKIP OPTIONAL FILES, IF THEY DO NOT EXIST |
---|
2818 | if [[ "${transin[$i]}" = unavailable ]] |
---|
2819 | then |
---|
2820 | if [[ "${extin[$i]}" = "" || "${extin[$i]}" = " " ]] |
---|
2821 | then |
---|
2822 | printf "\n +++ WARNING: input file \"${pathin[$i]}/${afname}${endin[$i]}\" " |
---|
2823 | printf "\n is not available!" |
---|
2824 | else |
---|
2825 | printf "\n +++ WARNING: input file \"${pathin[$i]}/${afname}${endin[$i]}.${extin[$i]}\" " |
---|
2826 | printf "\n is not available!" |
---|
2827 | fi |
---|
2828 | continue |
---|
2829 | fi |
---|
2830 | |
---|
2831 | # CHECK FOR SINGLE FILE (SERIAL RUN) OR DIRECTORY (ONE FILE PER CORE FOR PARELLEL EXECUTION) |
---|
2832 | files_for_pes=false; datentyp=file |
---|
2833 | if [[ "${actionin[$i]}" = pe && -n $numprocs ]] |
---|
2834 | then |
---|
2835 | files_for_pes=true; datentyp=directory |
---|
2836 | actionin[$i]="" |
---|
2837 | elif [[ "${actionin[$i]}" = pe && ! -n $numprocs ]] |
---|
2838 | then |
---|
2839 | actionin[$i]="" |
---|
2840 | elif [[ "${actionin[$i]}" = arpe && -n $numprocs ]] |
---|
2841 | then |
---|
2842 | files_for_pes=true; datentyp=directory |
---|
2843 | actionin[$i]="ar" |
---|
2844 | elif [[ "${actionin[$i]}" = arpe && ! -n $numprocs ]] |
---|
2845 | then |
---|
2846 | actionin[$i]="ar" |
---|
2847 | elif [[ "${actionin[$i]}" = flpe && -n $numprocs ]] |
---|
2848 | then |
---|
2849 | files_for_pes=true; datentyp=directory |
---|
2850 | actionin[$i]="fl" |
---|
2851 | elif [[ "${actionin[$i]}" = flpe && ! -n $numprocs ]] |
---|
2852 | then |
---|
2853 | actionin[$i]="fl" |
---|
2854 | fi |
---|
2855 | |
---|
2856 | if [[ $files_for_pes = true ]] |
---|
2857 | then |
---|
2858 | printf "\n >>> INPUT: ${absnamein[$i]}/.... to ${localin[$i]}" |
---|
2859 | else |
---|
2860 | printf "\n >>> INPUT: ${absnamein[$i]} to ${localin[$i]}" |
---|
2861 | fi |
---|
2862 | |
---|
2863 | # INPUT-FILE FOR A RESTART RUN. |
---|
2864 | # CHECK, IF THIS FILE STILL EXISTS ON THE TEMPORARY DATA DIRECTORY. |
---|
2865 | # IF NOT, TRY TO GET IT FROM THE ARCHIVE SYSTEM |
---|
2866 | if [[ "${actionin[$i]}" = fl ]] |
---|
2867 | then |
---|
2868 | printf "\n $datentyp will be fetched from temporary directory \"${tmp_data_catalog}\" !" |
---|
2869 | if [[ $files_for_pes = false ]] |
---|
2870 | then |
---|
2871 | if [[ -f "$tmp_data_catalog/${frelin[$i]}" ]] |
---|
2872 | then |
---|
2873 | ln $tmp_data_catalog/${frelin[$i]} ${localin[$i]} |
---|
2874 | got_tmp[$i]=true |
---|
2875 | elif [[ -f "$WORK/${frelin[$i]}" && $ignore_archive_error = true ]] |
---|
2876 | then |
---|
2877 | printf "\n +++ $datentyp not found in \"$tmp_data_catalog\" !" |
---|
2878 | printf "\n *** trying to use backup copy in \"$WORK\" " |
---|
2879 | cp $WORK/${frelin[$i]} ${localin[$i]} |
---|
2880 | else |
---|
2881 | printf "\n +++ $datentyp not found in \"$tmp_data_catalog\" " |
---|
2882 | printf "\n or \"$tmp_data_catalog\" does not exist!" |
---|
2883 | printf "\n *** trying to get copy from archive" |
---|
2884 | actionin[$i]=ar |
---|
2885 | fi |
---|
2886 | else |
---|
2887 | if [[ -d "$tmp_data_catalog/${frelin[$i]}" ]] |
---|
2888 | then |
---|
2889 | mkdir ${localin[$i]} |
---|
2890 | cd $tmp_data_catalog/${frelin[$i]} |
---|
2891 | for file in $(ls *) |
---|
2892 | do |
---|
2893 | ln $file $TEMPDIR/${localin[$i]} |
---|
2894 | done |
---|
2895 | cd $TEMPDIR |
---|
2896 | got_tmp[$i]=true |
---|
2897 | elif [[ -d "$WORK/${frelin[$i]}" && $ignore_archive_error = true ]] |
---|
2898 | then |
---|
2899 | printf "\n +++ $datentyp not found in \"$tmp_data_catalog\" !" |
---|
2900 | printf "\n *** trying to use backup copy in \"$WORK\" " |
---|
2901 | cp -r $WORK/${frelin[$i]} ${localin[$i]} |
---|
2902 | else |
---|
2903 | printf "\n +++ $datentyp not found in \"$tmp_data_catalog\" " |
---|
2904 | printf "\n or \"$tmp_data_catalog\" does not exist!" |
---|
2905 | printf "\n *** trying to get copy from archive" |
---|
2906 | actionin[$i]=ar |
---|
2907 | fi |
---|
2908 | fi |
---|
2909 | fi |
---|
2910 | |
---|
2911 | |
---|
2912 | # FILE IS STORED ON THE ARCHIVE SYSTEM |
---|
2913 | if [[ "${actionin[$i]}" = ar ]] |
---|
2914 | then |
---|
2915 | |
---|
2916 | if [[ $files_for_pes = false ]] |
---|
2917 | then |
---|
2918 | printf "\n file will be restored from archive-system ($archive_system)!" |
---|
2919 | else |
---|
2920 | printf "\n directory will be restored from archive-system ($archive_system)!" |
---|
2921 | fi |
---|
2922 | |
---|
2923 | file_restored=false |
---|
2924 | |
---|
2925 | if [[ $archive_system = asterix ]] |
---|
2926 | then |
---|
2927 | do_stagein=true |
---|
2928 | (( stagein_anz = 0 )) |
---|
2929 | while [[ $do_stagein = true ]] |
---|
2930 | do |
---|
2931 | if [[ $files_for_pes = false ]] |
---|
2932 | then |
---|
2933 | stagein -O ${frelin[$i]} > STAGEIN_OUTPUT |
---|
2934 | else |
---|
2935 | stagein -t -O ${frelin[$i]} > STAGEIN_OUTPUT |
---|
2936 | fi |
---|
2937 | cat STAGEIN_OUTPUT |
---|
2938 | if [[ $(grep -c "st.msg:i24" STAGEIN_OUTPUT) != 0 ]] |
---|
2939 | then |
---|
2940 | file_restored=true |
---|
2941 | do_stagein=false |
---|
2942 | else |
---|
2943 | (( stagein_anz = stagein_anz + 1 )) |
---|
2944 | if (( stagein_anz == 10 )) |
---|
2945 | then |
---|
2946 | printf "\n +++ stagein stoped after 10 tries" |
---|
2947 | locat=stage |
---|
2948 | exit |
---|
2949 | fi |
---|
2950 | printf "\n +++ restoring from archive failed, trying again:" |
---|
2951 | sleep 900 |
---|
2952 | fi |
---|
2953 | done |
---|
2954 | elif [[ $archive_system = DMF ]] |
---|
2955 | then |
---|
2956 | if [[ $files_for_pes = false ]] |
---|
2957 | then |
---|
2958 | printf "\n +++ restoring of single files impossible with $archive_system !\n" |
---|
2959 | locat=DMF |
---|
2960 | exit |
---|
2961 | else |
---|
2962 | find $ARCHIVE/${frelin[$i]} -type m -print | dmget |
---|
2963 | cp -r $ARCHIVE/${frelin[$i]} $PWD |
---|
2964 | file_restored=true |
---|
2965 | fi |
---|
2966 | elif [[ $archive_system = tivoli ]] |
---|
2967 | then |
---|
2968 | if [[ $files_for_pes = false ]] |
---|
2969 | then |
---|
2970 | ssh $SSH_PORTOPT $usern@bicedata.hlrn.de "cp $PERM/${frelin[$i]} $PWD" |
---|
2971 | else |
---|
2972 | (( inode = 0 )) |
---|
2973 | while (( inode < nodes )) |
---|
2974 | do |
---|
2975 | ssh $SSH_PORTOPT $usern@bicedata.hlrn.de "cd $PWD; tar xf $PERM/${frelin[$i]}/${frelin[$i]}.node_$inode.tar" |
---|
2976 | (( inode = inode + 1 )) |
---|
2977 | done |
---|
2978 | fi |
---|
2979 | file_restored=true |
---|
2980 | elif [[ $archive_system = ut ]] |
---|
2981 | then |
---|
2982 | if [[ $files_for_pes = false ]] |
---|
2983 | then |
---|
2984 | cp $UT/${frelin[$i]} . |
---|
2985 | else |
---|
2986 | (( inode = 0 )) |
---|
2987 | while (( inode < nodes )) |
---|
2988 | do |
---|
2989 | tar xf $UT/${frelin[$i]}/${frelin[$i]}.node_$inode.tar |
---|
2990 | (( inode = inode + 1 )) |
---|
2991 | done |
---|
2992 | fi |
---|
2993 | file_restored=true |
---|
2994 | else |
---|
2995 | printf "\n +++ archive_system=\"$archive_system\" restore impossible!" |
---|
2996 | locat=rearchive |
---|
2997 | exit |
---|
2998 | fi |
---|
2999 | |
---|
3000 | if [[ $file_restored = true ]] |
---|
3001 | then |
---|
3002 | |
---|
3003 | # PUT FILE ON THE TEMPORARY DATA DIRECTORY TOO. |
---|
3004 | # THIS WILL MAKE FILE ACCESS EASIER FOR LATER RUNS |
---|
3005 | [[ ! -d $tmp_data_catalog ]] && mkdir -p $tmp_data_catalog; chmod g+rx $tmp_data_catalog |
---|
3006 | if [[ $files_for_pes = false ]] |
---|
3007 | then |
---|
3008 | ln -f ${frelin[$i]} $tmp_data_catalog/${frelin[$i]} |
---|
3009 | else |
---|
3010 | mkdir $tmp_data_catalog/${frelin[$i]} |
---|
3011 | ln -f ${frelin[$i]}/* $tmp_data_catalog/${frelin[$i]} |
---|
3012 | fi |
---|
3013 | got_tmp[$i]=true |
---|
3014 | |
---|
3015 | # PROVIDE THE FILE UNDER ITS LOCAL NAME |
---|
3016 | mv ${frelin[$i]} ${localin[$i]} |
---|
3017 | |
---|
3018 | fi |
---|
3019 | fi |
---|
3020 | |
---|
3021 | |
---|
3022 | # FILE IS STORED IN THE RESPECTIVE DIRECTORY GIVEN IN THE CONFIGURATION FILE |
---|
3023 | if [[ "${actionin[$i]}" = "" || "${actionin[$i]}" = "di" || "${actionin[$i]}" = "npe" ]] |
---|
3024 | then |
---|
3025 | |
---|
3026 | if [[ "${actionin[$i]}" = "npe" && -n $numprocs ]] |
---|
3027 | then |
---|
3028 | |
---|
3029 | # FILE COPIES ARE PROVIDED FOR ALL CORES |
---|
3030 | # EACH FILE GETS A UNIQUE FILENAME WITH A FOUR DIGIT NUMBER |
---|
3031 | printf "\n file will be provided for $numprocs processors" |
---|
3032 | mkdir ${localin[$i]} |
---|
3033 | ival=$numprocs |
---|
3034 | (( ii = 0 )) |
---|
3035 | while (( ii <= ival-1 )) |
---|
3036 | do |
---|
3037 | if (( ii < 10 )) |
---|
3038 | then |
---|
3039 | cp ${absnamein[$i]} ${localin[$i]}/_000$ii |
---|
3040 | elif (( ii < 100 )) |
---|
3041 | then |
---|
3042 | cp ${absnamein[$i]} ${localin[$i]}/_00$ii |
---|
3043 | elif (( ii < 1000 )) |
---|
3044 | then |
---|
3045 | cp ${absnamein[$i]} ${localin[$i]}/_0$ii |
---|
3046 | else |
---|
3047 | cp ${absnamein[$i]} ${localin[$i]}/_$ii |
---|
3048 | fi |
---|
3049 | (( ii = ii + 1 )) |
---|
3050 | done |
---|
3051 | |
---|
3052 | else |
---|
3053 | |
---|
3054 | if [[ $files_for_pes = true ]] |
---|
3055 | then |
---|
3056 | |
---|
3057 | # PROVIDE FILES FOR EACH CORE |
---|
3058 | # FIRST CREATE THE LOCAL DIRECTORY, THEN COPY FILES |
---|
3059 | # FROM THE PERMANENT DIRECTORY BY LINKING THEM TO THE LOCAL ONE |
---|
3060 | printf "\n providing $numprocs files for the respective processors" |
---|
3061 | mkdir ${localin[$i]} |
---|
3062 | if [[ $link_local_input = true ]] |
---|
3063 | then |
---|
3064 | printf " using ln -f\n" |
---|
3065 | cd ${absnamein[$i]} |
---|
3066 | for file in $(ls *) |
---|
3067 | do |
---|
3068 | ln -f $file ${localin[$i]} |
---|
3069 | done |
---|
3070 | cd $TEMPDIR |
---|
3071 | fi |
---|
3072 | |
---|
3073 | # IF "ln -f" FAILED OR IF "$link_local_input = false" DO A NORMAL "cp -r" |
---|
3074 | if [[ ! -f "${localin[$i]}/_0000" ]] |
---|
3075 | then |
---|
3076 | if [[ $link_local_input = true ]] |
---|
3077 | then |
---|
3078 | printf " ln failed for .../_0000, using cp...\n" |
---|
3079 | fi |
---|
3080 | cp -r ${absnamein[$i]}/* ${localin[$i]} |
---|
3081 | fi |
---|
3082 | |
---|
3083 | else |
---|
3084 | |
---|
3085 | # PROVIDE FILE FOR RUNS ON A SINGLE CORE |
---|
3086 | if [[ $link_local_input = true ]] |
---|
3087 | then |
---|
3088 | printf " using ln -f\n" |
---|
3089 | ln -f ${absnamein[$i]} ${localin[$i]} |
---|
3090 | fi |
---|
3091 | # If "ln -f" fails of if "$link_local_input = false" do a normal "cp" |
---|
3092 | if [[ ! -f "${localin[$i]}" ]] |
---|
3093 | then |
---|
3094 | if [[ $link_local_input = true ]] |
---|
3095 | then |
---|
3096 | printf " ln failed, using cp...\n" |
---|
3097 | fi |
---|
3098 | cp ${absnamein[$i]} ${localin[$i]} |
---|
3099 | fi |
---|
3100 | fi |
---|
3101 | fi |
---|
3102 | fi |
---|
3103 | |
---|
3104 | done |
---|
3105 | if (( i != 0 )) |
---|
3106 | then |
---|
3107 | printf "\n$dashes\n *** all INPUT-files provided \n" |
---|
3108 | fi |
---|
3109 | |
---|
3110 | |
---|
3111 | # EXECUTE INPUT-COMMANDS GIVEN IN THE CONFIGURATION FILE |
---|
3112 | (( i = 0 )) |
---|
3113 | while (( i < iic )) |
---|
3114 | do |
---|
3115 | (( i = i + 1 )) |
---|
3116 | if (( i == 1 )) |
---|
3117 | then |
---|
3118 | printf "\n\n *** execution of INPUT-commands:\n$dashes" |
---|
3119 | fi |
---|
3120 | printf "\n >>> ${in_command[$i]}" |
---|
3121 | eval ${in_command[$i]} |
---|
3122 | if (( i == iic )) |
---|
3123 | then |
---|
3124 | printf "\n$dashes\n" |
---|
3125 | fi |
---|
3126 | done |
---|
3127 | |
---|
3128 | |
---|
3129 | # SET THE REMAINING CPU-TIME |
---|
3130 | cpurest=${cpumax}. |
---|
3131 | |
---|
3132 | |
---|
3133 | # START DVR STREAMING SERVER |
---|
3134 | if [[ $(echo $package_list | grep -c dvrp_graphics) != 0 ]] |
---|
3135 | then |
---|
3136 | if [[ "$dvr_server" != "" ]] |
---|
3137 | then |
---|
3138 | |
---|
3139 | printf "\n\n *** preparing the dvr streaming server configuration file" |
---|
3140 | |
---|
3141 | # CHECK, IF A DVR SERVER IS ALREADY RUNNING |
---|
3142 | running_dvrserver_id=`echo $(ps -edaf | grep .dvrserver.config | grep -v grep) | cut -d" " -f2` |
---|
3143 | if [[ "$running_dvrserver_id" != "" ]] |
---|
3144 | then |
---|
3145 | |
---|
3146 | printf "\n\n +++ WARNING: A dvr server with id=$running_dvrserver_id is already running!" |
---|
3147 | printf "\n This server is used instead starting a new one!" |
---|
3148 | printf "\n If required, script \"process_dvr_output\" has to be run manually." |
---|
3149 | |
---|
3150 | else |
---|
3151 | |
---|
3152 | # COPY CONFIGURATION FILE FOR STREAMING SERVER FROM REPOSITORY TO HERE |
---|
3153 | if [[ -f ${PALM_BIN}/.dvrserver.config ]] |
---|
3154 | then |
---|
3155 | cp ${PALM_BIN}/.dvrserver.config . |
---|
3156 | |
---|
3157 | # ENTERING THE BASEDIR, UID AND GID INTO THIS FILE |
---|
3158 | user_id=`id -u` |
---|
3159 | group_id=`id -g` |
---|
3160 | |
---|
3161 | # "&" IS REQUIRED AS A SEPERATOR, BECAUSE TEMPDIR CONTAINS "/" |
---|
3162 | sed "s&<replace by dvr data directory>&${TEMPDIR}&g" .dvrserver.config > .dvrserver.1 |
---|
3163 | sed "s/<replace by user id>/$user_id/g" .dvrserver.1 > .dvrserver.2 |
---|
3164 | sed "s/<replace by group id>/$group_id/g" .dvrserver.2 > .dvrserver.3 |
---|
3165 | mv .dvrserver.3 .dvrserver.config |
---|
3166 | rm .dvrserver.1 .dvrserver.2 |
---|
3167 | |
---|
3168 | # START DVR SERVER IN BACKGROUND, GET HIS ID AND PRINT ON TERMINAL |
---|
3169 | $dvr_server .dvrserver.config >> DVR_LOGFILE 2>&1 & |
---|
3170 | dvrserver_id=`echo $(ps -edaf | grep .dvrserver.config) | cut -d" " -f2` |
---|
3171 | printf "\n *** streaming server with id=$dvrserver_id is started in background" |
---|
3172 | local_dvrserver_running=.TRUE. |
---|
3173 | else |
---|
3174 | printf "\n +++ missing file \".dvrserver.config\" in directory:" |
---|
3175 | printf "\n \"$PALM_BIN\" " |
---|
3176 | locat=dvr |
---|
3177 | exit |
---|
3178 | fi |
---|
3179 | |
---|
3180 | fi |
---|
3181 | |
---|
3182 | else |
---|
3183 | printf "\n\n --- INFORMATIVE: no dvr streaming server will be started" |
---|
3184 | fi |
---|
3185 | fi |
---|
3186 | |
---|
3187 | |
---|
3188 | # CREATE THE NAMELIST-FILE WITH VALUES OF ENVIRONMENT-VARIABLES REQUIRED BY PALM |
---|
3189 | # (FILE ENVPAR WILL BE READ BY PALM) |
---|
3190 | cat > ENVPAR << %%END%% |
---|
3191 | &envpar run_identifier = '$fname', host = '$localhost', |
---|
3192 | write_binary = '$write_binary', tasks_per_node = $tasks_per_node, |
---|
3193 | maximum_parallel_io_streams = $maximum_parallel_io_streams, |
---|
3194 | maximum_cpu_time_allowed = ${cpumax}., |
---|
3195 | revision = '$global_revision', |
---|
3196 | local_dvrserver_running = $local_dvrserver_running, |
---|
3197 | batch_job = $batch_job / |
---|
3198 | |
---|
3199 | %%END%% |
---|
3200 | |
---|
3201 | |
---|
3202 | # STARTING THE EXECUTABLE |
---|
3203 | printf "\n\n *** execution starts in directory\n \"`pwd`\"\n$dashes\n" |
---|
3204 | PATH=$PATH:$TEMPDIR |
---|
3205 | |
---|
3206 | # MPI DEBUG OPTION (ARGUMENT CHECKING, SLOWS DOWN EXECUTION DUE TO INCREASED LATENCY) |
---|
3207 | if [[ "$mpi_debug" = true ]] |
---|
3208 | then |
---|
3209 | export MPI_CHECK_ARGS=1 |
---|
3210 | printf "\n +++ MPI_CHECK_ARGS=$MPI_CHECK_ARGS" |
---|
3211 | fi |
---|
3212 | |
---|
3213 | if [[ "$totalview" = true ]] |
---|
3214 | then |
---|
3215 | printf "\n *** totalview debugger will be used" |
---|
3216 | tv_opt="-tv" |
---|
3217 | else |
---|
3218 | tv_opt="" |
---|
3219 | fi |
---|
3220 | |
---|
3221 | if [[ "$cond1" = debug || "$cond2" = debug ]] |
---|
3222 | then |
---|
3223 | if [[ "$ENVIRONMENT" = BATCH ]] |
---|
3224 | then |
---|
3225 | continue |
---|
3226 | fi |
---|
3227 | if [[ $localhost = ibmh ]] |
---|
3228 | then |
---|
3229 | |
---|
3230 | # SETUP THE IBM MPI ENVIRONMENT |
---|
3231 | export MP_SHARED_MEMORY=yes |
---|
3232 | export AIXTHREADS_SCOPE=S |
---|
3233 | export OMP_NUM_THREADS=$threads_per_task |
---|
3234 | export AUTHSTATE=files |
---|
3235 | export XLFRTEOPTS="nlwidth=132:err_recovery=no" # RECORD-LENGTH OF NAMELIST-OUTPUT |
---|
3236 | |
---|
3237 | # FOLLOWING OPTIONS ARE MANDATORY FOR TOTALVIEW |
---|
3238 | export MP_ADAPTER_USE=shared |
---|
3239 | export MP_CPU_USE=multiple |
---|
3240 | export MP_TIMEOUT=1200 |
---|
3241 | |
---|
3242 | unset MP_TASK_AFFINITY |
---|
3243 | |
---|
3244 | # SO FAR, TOTALVIEW NEEDS HOSTFILE MECHANISM FOR EXECUTION |
---|
3245 | #(( ii = 1 )) |
---|
3246 | #while (( ii <= $numprocs )) |
---|
3247 | #do |
---|
3248 | # echo $localhost_realname >> hostfile |
---|
3249 | # (( ii = ii + 1 )) |
---|
3250 | #done |
---|
3251 | #export MP_HOSTFILE=hostfile |
---|
3252 | |
---|
3253 | if [[ "$LOADLBATCH" = yes ]] |
---|
3254 | then |
---|
3255 | totalview poe a.out $ROPTS |
---|
3256 | else |
---|
3257 | echo totalview poe -a a.out -procs $numprocs -rmpool 0 -nodes 1 $ROPTS |
---|
3258 | export TVDSVRLAUNCHCMD=ssh |
---|
3259 | totalview poe -a a.out -procs $numprocs -rmpool 0 -nodes 1 $ROPTS |
---|
3260 | fi |
---|
3261 | |
---|
3262 | fi # END DEBUG MODE |
---|
3263 | |
---|
3264 | else |
---|
3265 | |
---|
3266 | # NORMAL EXECUTION |
---|
3267 | if [[ -n $numprocs ]] |
---|
3268 | then |
---|
3269 | |
---|
3270 | # RUNNING THE PROGRAM ON PARALLEL MACHINES |
---|
3271 | if [[ $(echo $host | cut -c1-3) = ibm ]] |
---|
3272 | then |
---|
3273 | |
---|
3274 | # SETUP THE IBM MPI ENVIRONMENT |
---|
3275 | if [[ $host != ibmh && $host != ibmkisti ]] |
---|
3276 | then |
---|
3277 | export MP_SHARED_MEMORY=yes |
---|
3278 | export AIXTHREAD_SCOPE=S |
---|
3279 | export OMP_NUM_THREADS=$threads_per_task |
---|
3280 | export XLSMPOPTS="spins=0:yields=0:stack=20000000" |
---|
3281 | export AUTHSTATE=files |
---|
3282 | export XLFRTEOPTS="nlwidth=132:err_recovery=no" # RECORD-LENGTH OF NAMELIST-OUTPUT |
---|
3283 | # export MP_PRINTENV=yes |
---|
3284 | |
---|
3285 | # TUNING-VARIABLES TO IMPROVE COMMUNICATION SPEED |
---|
3286 | # DO NOT SHOW SIGNIFICANT EFFECTS (SEP 04, FEDERATION-SWITCH) |
---|
3287 | export MP_WAIT_MODE=poll |
---|
3288 | [[ $node_usage = not_shared ]] && export MP_SINGLE_THREAD=yes |
---|
3289 | fi |
---|
3290 | |
---|
3291 | if [[ $host = ibmkisti ]] |
---|
3292 | then |
---|
3293 | export LANG=en_US |
---|
3294 | export MP_SHARED_MEMORY=yes |
---|
3295 | if [[ $threads_per_task = 1 ]] |
---|
3296 | then |
---|
3297 | export MP_SINGLE_THREAD=yes |
---|
3298 | export MEMORY_AFFINITY=MCM |
---|
3299 | else |
---|
3300 | export OMP_NUM_THREADS=$threads_per_task |
---|
3301 | fi |
---|
3302 | fi |
---|
3303 | |
---|
3304 | if [[ "$LOADLBATCH" = yes ]] |
---|
3305 | then |
---|
3306 | printf "\n--- Control: OMP_NUM_THREADS = \"$OMP_NUM_THREADS\" \n" |
---|
3307 | if [[ "$cond1" = hpmcount || "$cond2" = hpmcount ]] |
---|
3308 | then |
---|
3309 | /opt/optibm/HPM_2_4_1/bin/hpmcount a.out $ROPTS |
---|
3310 | else |
---|
3311 | if [[ $run_coupled_model = false ]] |
---|
3312 | then |
---|
3313 | if [[ "$ocean_file_appendix" = true ]] |
---|
3314 | then |
---|
3315 | echo "precursor_ocean" > runfile_atmos |
---|
3316 | else |
---|
3317 | echo "precursor_atmos" > runfile_atmos |
---|
3318 | fi |
---|
3319 | else |
---|
3320 | (( iia = $numprocs_atmos / $threads_per_task )) |
---|
3321 | (( iio = $numprocs_ocean / $threads_per_task )) |
---|
3322 | printf "\n coupled run ($iia atmosphere, $iio ocean)" |
---|
3323 | printf "\n using $coupled_mode coupling" |
---|
3324 | printf "\n\n" |
---|
3325 | echo "coupled_run $iia $iio" > runfile_atmos |
---|
3326 | fi |
---|
3327 | poe ./a.out $ROPTS < runfile_atmos |
---|
3328 | fi |
---|
3329 | else |
---|
3330 | if [[ $localhost = ibmh || $localhost = ibms ]] |
---|
3331 | then |
---|
3332 | poe a.out -procs $numprocs -nodes 1 -rmpool 0 $ROPTS |
---|
3333 | elif [[ $localhost = ibmkisti || $localhost = ibmku ]] |
---|
3334 | then |
---|
3335 | if [[ -f $hostfile ]] |
---|
3336 | then |
---|
3337 | cp $hostfile hostfile |
---|
3338 | else |
---|
3339 | (( ii = 1 )) |
---|
3340 | while (( ii <= $numprocs )) |
---|
3341 | do |
---|
3342 | echo $localhost_realname >> hostfile |
---|
3343 | (( ii = ii + 1 )) |
---|
3344 | done |
---|
3345 | fi |
---|
3346 | export MP_HOSTFILE=hostfile |
---|
3347 | if [[ $run_coupled_model = false ]] |
---|
3348 | then |
---|
3349 | if [[ "$ocean_file_appendix" = true ]] |
---|
3350 | then |
---|
3351 | echo "precursor_ocean" > runfile_atmos |
---|
3352 | else |
---|
3353 | echo "precursor_atmos" > runfile_atmos |
---|
3354 | fi |
---|
3355 | else |
---|
3356 | (( iia = $numprocs_atmos / $threads_per_task )) |
---|
3357 | (( iio = $numprocs_ocean / $threads_per_task )) |
---|
3358 | printf "\n coupled run ($iia atmosphere, $iio ocean)" |
---|
3359 | printf "\n using $coupled_mode coupling" |
---|
3360 | printf "\n\n" |
---|
3361 | echo "coupled_run $iia $iio" > runfile_atmos |
---|
3362 | fi |
---|
3363 | |
---|
3364 | poe ./a.out -procs $numprocs $ROPTS < runfile_atmos |
---|
3365 | |
---|
3366 | else |
---|
3367 | if [[ "$host_file" = "" ]] |
---|
3368 | then |
---|
3369 | printf "\n +++ no hostfile given in configuration file" |
---|
3370 | locat=config_file |
---|
3371 | exit |
---|
3372 | else |
---|
3373 | eval host_file=$host_file |
---|
3374 | fi |
---|
3375 | export MP_HOSTFILE=$host_file |
---|
3376 | poe a.out -procs $numprocs -tasks_per_node $numprocs $ROPTS |
---|
3377 | fi |
---|
3378 | fi |
---|
3379 | elif [[ $host = nech ]] |
---|
3380 | then |
---|
3381 | (( ii = nodes )) |
---|
3382 | if [[ $ii = 1 ]] |
---|
3383 | then |
---|
3384 | export F_ERRCNT=0 # acceptable number of errors before program is stopped |
---|
3385 | export MPIPROGINF=YES |
---|
3386 | # export F_TRACE=YES|FMT1|FMT2 # output of ftrace informations to job protocol |
---|
3387 | echo "*** execution on single node with mpirun" |
---|
3388 | mpirun -np $numprocs ./a.out $ROPTS |
---|
3389 | else |
---|
3390 | (( i = 0 )) |
---|
3391 | while (( i < ii )) |
---|
3392 | do |
---|
3393 | echo "-h $i -p $tasks_per_node -e ./mpi_exec_shell" >> multinode_config |
---|
3394 | (( i = i + 1 )) |
---|
3395 | done |
---|
3396 | |
---|
3397 | echo "#!/bin/sh" > mpi_exec_shell |
---|
3398 | echo " " >> mpi_exec_shell |
---|
3399 | echo "set -u" >> mpi_exec_shell |
---|
3400 | echo "F_ERRCNT=0" >> mpi_exec_shell |
---|
3401 | echo "MPIPROGINV=YES" >> mpi_exec_shell |
---|
3402 | echo "OMP_NUM_THREADS=$threads_per_task" >> mpi_exec_shell |
---|
3403 | echo "cpurest=$cpurest" >> mpi_exec_shell |
---|
3404 | echo "fname=$fname" >> mpi_exec_shell |
---|
3405 | echo "localhost=$localhost" >> mpi_exec_shell |
---|
3406 | echo "return_addres=$return_addres" >> mpi_exec_shell |
---|
3407 | echo "return_username=$return_username" >> mpi_exec_shell |
---|
3408 | echo "tasks_per_node=$tasks_per_node" >> mpi_exec_shell |
---|
3409 | echo "write_binary=$write_binary" >> mpi_exec_shell |
---|
3410 | echo "use_seperate_pe_for_dvrp_output=$use_seperate_pe_for_dvrp_output" >> mpi_exec_shell |
---|
3411 | echo " " >> mpi_exec_shell |
---|
3412 | echo "export F_ERRCNT" >> mpi_exec_shell |
---|
3413 | echo "export MPIPROGINV" >> mpi_exec_shell |
---|
3414 | echo "export OMP_NUM_THREADS" >> mpi_exec_shell |
---|
3415 | echo "export cpurest" >> mpi_exec_shell |
---|
3416 | echo "export fname" >> mpi_exec_shell |
---|
3417 | echo "export localhost" >> mpi_exec_shell |
---|
3418 | echo "export return_addres" >> mpi_exec_shell |
---|
3419 | echo "export return_username" >> mpi_exec_shell |
---|
3420 | echo "export tasks_per_node" >> mpi_exec_shell |
---|
3421 | echo "export write_binary" >> mpi_exec_shell |
---|
3422 | echo "export use_seperate_pe_for_dvrp_output" >> mpi_exec_shell |
---|
3423 | echo " " >> mpi_exec_shell |
---|
3424 | echo "exec ./a.out" >> mpi_exec_shell |
---|
3425 | |
---|
3426 | chmod u+x mpi_exec_shell |
---|
3427 | export MPIPROGINF=YES |
---|
3428 | mpirun -f multinode_config & |
---|
3429 | wait |
---|
3430 | |
---|
3431 | fi |
---|
3432 | elif [[ $(echo $host | cut -c1-2) = lc && $host != lckyoto && $host != lctit ]] |
---|
3433 | then |
---|
3434 | |
---|
3435 | # COPY HOSTFILE FROM SOURCE DIRECTORY OR CREATE IT, IF IT |
---|
3436 | # DOES NOT EXIST |
---|
3437 | if [[ $host != lccrayb &&$host != lccrayf && $host != lccrayh && $host != lckyuh && $host != lckyut ]] |
---|
3438 | then |
---|
3439 | if [[ -f $hostfile ]] |
---|
3440 | then |
---|
3441 | cp $hostfile hostfile |
---|
3442 | (( ii = $numprocs / $threads_per_task )) |
---|
3443 | else |
---|
3444 | (( ii = 1 )) |
---|
3445 | while (( ii <= $numprocs / $threads_per_task )) |
---|
3446 | do |
---|
3447 | echo $localhost_realname >> hostfile |
---|
3448 | (( ii = ii + 1 )) |
---|
3449 | done |
---|
3450 | fi |
---|
3451 | eval zeile=\"`head -n $ii hostfile`\" |
---|
3452 | printf "\n *** running on: $zeile" |
---|
3453 | fi |
---|
3454 | |
---|
3455 | (( ii = $numprocs / $threads_per_task )) |
---|
3456 | export OMP_NUM_THREADS=$threads_per_task |
---|
3457 | |
---|
3458 | if [[ $threads_per_task != 1 ]] |
---|
3459 | then |
---|
3460 | # INCREASE STACK SIZE TO UNLIMITED, BECAUSE OTHERWISE LARGE RUNS |
---|
3461 | # MAY ABORT |
---|
3462 | ulimit -s unlimited |
---|
3463 | printf "\n threads per task: $threads_per_task stacksize: unlimited" |
---|
3464 | fi |
---|
3465 | if [[ $run_coupled_model = false ]] |
---|
3466 | then |
---|
3467 | if [[ "$ocean_file_appendix" = true ]] |
---|
3468 | then |
---|
3469 | echo "precursor_ocean" > runfile_atmos |
---|
3470 | else |
---|
3471 | echo "precursor_atmos" > runfile_atmos |
---|
3472 | fi |
---|
3473 | printf "\n\n" |
---|
3474 | |
---|
3475 | if [[ $host = lccrayb || $host = lccrayh ]] |
---|
3476 | then |
---|
3477 | echo "--- aprun -n $ii -N $tasks_per_node a.out $ROPTS < runfile_atmos" |
---|
3478 | aprun -n $ii -N $tasks_per_node a.out $ROPTS < runfile_atmos |
---|
3479 | # aprun -n $ii -ss -r2 -j1 a.out $ROPTS < runfile_atmos |
---|
3480 | elif [[ $host = lccrayf ]] |
---|
3481 | then |
---|
3482 | aprun -j1 -n $ii -N $tasks_per_node -m ${memory}M a.out $ROPTS < runfile_atmos |
---|
3483 | elif [[ $host = lcxe6 || $host = lcxt5m ]] |
---|
3484 | then |
---|
3485 | aprun -n $ii -N $tasks_per_node a.out $ROPTS < runfile_atmos |
---|
3486 | elif [[ $host = lcflow ]] |
---|
3487 | then |
---|
3488 | mpirun -bootstrap sge -np $ii -env I_MPI_FABRICS shm:ofa a.out < runfile_atmos $ROPTS |
---|
3489 | elif [[ $host = lcsb ]] |
---|
3490 | then |
---|
3491 | mpirun_rsh -hostfile $PBS_NODEFILE -np `cat $PBS_NODEFILE | wc -l` a.out < runfile_atmos $ROPTS |
---|
3492 | elif [[ $host = lckiaps ]] |
---|
3493 | then |
---|
3494 | mpirun -np $ii -f $PBS_NODEFILE a.out < runfile_atmos $ROPTS |
---|
3495 | elif [[ $host = lckyu* ]] |
---|
3496 | then |
---|
3497 | mpiexec -n $ii --stdin runfile_atmos ./a.out $ROPTS |
---|
3498 | else |
---|
3499 | mpiexec -machinefile hostfile -n $ii a.out < runfile_atmos $ROPTS |
---|
3500 | fi |
---|
3501 | else |
---|
3502 | |
---|
3503 | # CURRENTLY THERE IS NO FULL MPI-2 SUPPORT ON ICE AND XT4 |
---|
3504 | (( iia = $numprocs_atmos / $threads_per_task )) |
---|
3505 | (( iio = $numprocs_ocean / $threads_per_task )) |
---|
3506 | printf "\n coupled run ($iia atmosphere, $iio ocean)" |
---|
3507 | printf "\n using $coupled_mode coupling" |
---|
3508 | printf "\n\n" |
---|
3509 | |
---|
3510 | if [[ $coupled_mode = "mpi2" ]] |
---|
3511 | then |
---|
3512 | echo "atmosphere_to_ocean $iia $iio" > runfile_atmos |
---|
3513 | echo "ocean_to_atmosphere $iia $iio" > runfile_ocean |
---|
3514 | |
---|
3515 | if [[ $host = lccrayf || $host = lcxe6 || $host = lcxt5m ]] |
---|
3516 | then |
---|
3517 | |
---|
3518 | aprun -n $iia -N $tasks_per_node a.out < runfile_atmos $ROPTS & |
---|
3519 | aprun -n $iio -N $tasks_per_node a.out < runfile_ocean $ROPTS & |
---|
3520 | |
---|
3521 | else |
---|
3522 | # WORKAROUND BECAUSE mpiexec WITH -env option IS NOT AVAILABLE ON SOME SYSTEMS |
---|
3523 | mpiexec -machinefile hostfile -n $iia a.out $ROPTS < runfile_atmos & |
---|
3524 | mpiexec -machinefile hostfile -n $iio a.out $ROPTS < runfile_ocean & |
---|
3525 | # mpiexec -machinefile hostfile -n $iia -env coupling_mode atmosphere_to_ocean a.out $ROPTS & |
---|
3526 | # mpiexec -machinefile hostfile -n $iio -env coupling_mode ocean_to_atmosphere a.out $ROPTS & |
---|
3527 | fi |
---|
3528 | wait |
---|
3529 | |
---|
3530 | else |
---|
3531 | |
---|
3532 | echo "coupled_run $iia $iio" > runfile_atmos |
---|
3533 | |
---|
3534 | if [[ $host = lccrayf || $host = lcxe6 || $host = lcxt5m ]] |
---|
3535 | then |
---|
3536 | |
---|
3537 | aprun -n $ii -N $tasks_per_node a.out < runfile_atmos $ROPTS |
---|
3538 | |
---|
3539 | elif [[ $host = lck || $host = lckordi ]] |
---|
3540 | then |
---|
3541 | |
---|
3542 | mpiexec -n $ii ./a.out $ROPTS < runfile_atmos & |
---|
3543 | |
---|
3544 | elif [[ $host = lckyu* ]] |
---|
3545 | then |
---|
3546 | |
---|
3547 | mpiexec -n $ii --stdin runfile_atmos ./a.out $ROPTS |
---|
3548 | |
---|
3549 | fi |
---|
3550 | wait |
---|
3551 | fi |
---|
3552 | |
---|
3553 | fi |
---|
3554 | |
---|
3555 | elif [[ $host = lckyoto ]] |
---|
3556 | then |
---|
3557 | set -xv |
---|
3558 | export P4_RSHCOMMAND=plesh |
---|
3559 | echo " P4_RSHCOMMAND = $P4_RSHCOMMAND" |
---|
3560 | if [[ "$ENVIRONMENT" = BATCH ]] |
---|
3561 | then |
---|
3562 | if [[ "$cond2" = fujitsu ]] |
---|
3563 | then |
---|
3564 | mpiexec -n $numprocs ./a.out $ROPTS # for fujitsu-compiler |
---|
3565 | elif [[ "cond2" = pgi ]] |
---|
3566 | then |
---|
3567 | mpirun -np $numprocs -machinefile ${QSUB_NODEINF} ./a.out $ROPTS |
---|
3568 | else |
---|
3569 | mpirun_rsh -np $numprocs -hostfile ${QSUB_NODEINF} MV2_USE_SRQ=0 ./a.out ${ROPTS} || /bin/true |
---|
3570 | fi |
---|
3571 | else |
---|
3572 | if [[ "$cond2" = "" ]] |
---|
3573 | then |
---|
3574 | mpiruni_rsh -np $numprocs ./a.out $ROPTS # for intel |
---|
3575 | else |
---|
3576 | mpirun -np $numprocs ./a.out $ROPTS |
---|
3577 | fi |
---|
3578 | fi |
---|
3579 | set +xv |
---|
3580 | |
---|
3581 | elif [[ $host = lctit ]] |
---|
3582 | then |
---|
3583 | export OMP_NUM_THREADS=$threads_per_task |
---|
3584 | echo "OMP_NUM_THREADS=$OMP_NUM_THREADS" |
---|
3585 | if [[ "$threads_per_task" != 1 ]] |
---|
3586 | then |
---|
3587 | export MV2_ENABLE_AFFINITY=0 |
---|
3588 | fi |
---|
3589 | echo "----- PBS_NODEFILE content:" |
---|
3590 | cat $PBS_NODEFILE |
---|
3591 | echo "-----" |
---|
3592 | (( ii = $numprocs / $threads_per_task )) |
---|
3593 | echo "mpirun -np $ii -hostfile $PBS_NODEFILE ./a.out $ROPTS" |
---|
3594 | mpirun -np $ii -hostfile $PBS_NODEFILE ./a.out $ROPTS |
---|
3595 | else |
---|
3596 | mpprun -n $numprocs a.out $ROPTS |
---|
3597 | fi |
---|
3598 | else |
---|
3599 | a.out $ROPTS |
---|
3600 | fi |
---|
3601 | fi |
---|
3602 | |
---|
3603 | if [[ $? != 0 ]] |
---|
3604 | then |
---|
3605 | |
---|
3606 | # ABORT IN CASE OF RUNTIME ERRORS |
---|
3607 | printf "\n +++ runtime error occured" |
---|
3608 | locat=execution |
---|
3609 | exit |
---|
3610 | |
---|
3611 | else |
---|
3612 | |
---|
3613 | printf "\n$dashes\n *** execution finished \n" |
---|
3614 | |
---|
3615 | # STOP THE DVR STREAMING SERVER AND PROCESS THE DVR OUTPUT IN ORDER |
---|
3616 | # TO CREAT DVRS- AND HTML-FILES CONTAINING ALL STREAMS |
---|
3617 | if [[ "$dvrserver_id" != "" ]] |
---|
3618 | then |
---|
3619 | kill $dvrserver_id |
---|
3620 | printf "\n *** dvr server with id=$dvrserver_id has been stopped" |
---|
3621 | |
---|
3622 | # IF THERE IS A DIRECTORY, DATA HAVE BEEN OUTPUT BY THE |
---|
3623 | # STREAMING SERVER. OTHERWISE, USER HAS CHOSEN dvrp_output=local |
---|
3624 | if [[ -d DATA_DVR ]] |
---|
3625 | then |
---|
3626 | |
---|
3627 | # ADD THE CURRENT DVR CONFIGURATION FILE TO THE DVR OUTPUT |
---|
3628 | # DIRECTORY |
---|
3629 | cp .dvrserver.config DATA_DVR |
---|
3630 | |
---|
3631 | # PROCESS THE DVR OUTPUT (OPTION -s FOR GENERATING |
---|
3632 | # SEQUENCE MODE DATA TOO) |
---|
3633 | process_dvr_output -d DATA_DVR -f $fname -s |
---|
3634 | |
---|
3635 | else |
---|
3636 | |
---|
3637 | # PROCESS THE LOCAL OUTPUT |
---|
3638 | process_dvr_output -l -d DATA_DVR -f $fname |
---|
3639 | |
---|
3640 | fi |
---|
3641 | |
---|
3642 | elif [[ $(echo $package_list | grep -c dvrp_graphics) != 0 ]] |
---|
3643 | then |
---|
3644 | |
---|
3645 | # PROCESS DVR OUTPUT GENERATD IN LOCAL MODE (dvrp_output=local) |
---|
3646 | process_dvr_output -l -d DATA_DVR -f $fname |
---|
3647 | |
---|
3648 | fi |
---|
3649 | fi |
---|
3650 | |
---|
3651 | |
---|
3652 | |
---|
3653 | # CALL OF combine_plot_fields IN ORDER TO MERGE SINGLE FILES WRITTEN |
---|
3654 | # BY EACH CORE INTO ONE FILE |
---|
3655 | if [[ ! -f ${PALM_BIN}/combine_plot_fields${block}.x ]] |
---|
3656 | then |
---|
3657 | printf "\n\n\n +++ WARNING: no combine_plot_fields found for given block \"$cond1 $cond2\"" |
---|
3658 | printf "\n 2d- and/or 3d-data may be incomplete!" |
---|
3659 | printf "\n Run \"mbuild -u -h $localhost\" to generate utilities for this block.\n" |
---|
3660 | elif [[ "$combine_plot_fields" == true ]] |
---|
3661 | then |
---|
3662 | if [[ $localhost = lccrayh || $localhost = lccrayb ]] |
---|
3663 | then |
---|
3664 | printf "\n\n\n *** post-processing: now executing \"aprun -n 1 -N 1 combine_plot_fields${block}.x\" ..." |
---|
3665 | aprun -n 1 -N 1 combine_plot_fields${block}.x #$ROPTS < runfile_atmos |
---|
3666 | else |
---|
3667 | printf "\n\n\n *** post-processing: now executing \"combine_plot_fields${block}.x\" ..." |
---|
3668 | combine_plot_fields${block}.x |
---|
3669 | fi |
---|
3670 | else |
---|
3671 | |
---|
3672 | # TEMPORARY SOLUTION TO SKIP combine_plot_fields. THIS IS REQUIRED IN CASE OF HUGE AMOUNT OF |
---|
3673 | # DATA OUTPUT. TO DO: EXTEND THIS BRANCH BY CREATING A BATCH JOB for combine_plot_fields. |
---|
3674 | # ??? koennen wir das streichen ??? |
---|
3675 | printf "\n\n\n *** post-processing: skipping combine_plot_fields (-Z option set) ..." |
---|
3676 | fi |
---|
3677 | |
---|
3678 | |
---|
3679 | |
---|
3680 | # EXECUTE OUTPUT-COMMANDS GIVEN IN THE CONFIGURATION FILE |
---|
3681 | (( i = 0 )) |
---|
3682 | while (( i < ioc )) |
---|
3683 | do |
---|
3684 | (( i = i + 1 )) |
---|
3685 | if (( i == 1 )) |
---|
3686 | then |
---|
3687 | printf "\n\n *** execution of OUTPUT-commands:\n$dashes" |
---|
3688 | fi |
---|
3689 | printf "\n >>> ${out_command[$i]}" |
---|
3690 | eval ${out_command[$i]} |
---|
3691 | if (( i == ioc )) |
---|
3692 | then |
---|
3693 | printf "\n$dashes\n" |
---|
3694 | fi |
---|
3695 | done |
---|
3696 | |
---|
3697 | |
---|
3698 | # IN TRACE-MODE PRINT CONTENTS OF THE CURRENT (TEMPORARY) WORKING DIRECTORY |
---|
3699 | if [[ $do_trace = true ]] |
---|
3700 | then |
---|
3701 | printf "\n\n" |
---|
3702 | ls -al |
---|
3703 | fi |
---|
3704 | |
---|
3705 | |
---|
3706 | |
---|
3707 | # COPY LOCAL OUTPUT-FILES TO THEIR PERMANENT DESTINATIONS |
---|
3708 | (( i = 0 )) |
---|
3709 | while (( i < iout )) |
---|
3710 | do |
---|
3711 | (( i = i + 1 )) |
---|
3712 | if (( i == 1 )) |
---|
3713 | then |
---|
3714 | printf "\n\n *** saving OUTPUT-files:\n$dashes" |
---|
3715 | fi |
---|
3716 | |
---|
3717 | # CHECK FOR SINGLE FILE (SERIAL RUN) OR DIRECTORY (ONE FILE PER CORE FOR PARELLEL EXECUTION) |
---|
3718 | files_for_pes=false; filetyp=file |
---|
3719 | if [[ "${actionout[$i]}" = pe && -n $numprocs ]] |
---|
3720 | then |
---|
3721 | files_for_pes=true; filetyp=directory |
---|
3722 | actionout[$i]="" |
---|
3723 | elif [[ "${actionout[$i]}" = pe && ! -n $numprocs ]] |
---|
3724 | then |
---|
3725 | actionout[$i]="" |
---|
3726 | elif [[ "${actionout[$i]}" = arpe && -n $numprocs ]] |
---|
3727 | then |
---|
3728 | files_for_pes=true; filetyp=directory |
---|
3729 | actionout[$i]="ar" |
---|
3730 | elif [[ "${actionout[$i]}" = arpe && ! -n $numprocs ]] |
---|
3731 | then |
---|
3732 | actionout[$i]="ar" |
---|
3733 | elif [[ "${actionout[$i]}" = flpe && -n $numprocs ]] |
---|
3734 | then |
---|
3735 | files_for_pes=true; filetyp=directory |
---|
3736 | actionout[$i]="fl" |
---|
3737 | elif [[ "${actionout[$i]}" = flpe && ! -n $numprocs ]] |
---|
3738 | then |
---|
3739 | actionout[$i]="fl" |
---|
3740 | elif [[ "${actionout[$i]}" = trpe && -n $numprocs ]] |
---|
3741 | then |
---|
3742 | files_for_pes=true; filetyp=directory |
---|
3743 | actionout[$i]="tr" |
---|
3744 | elif [[ "${actionout[$i]}" = trpe && ! -n $numprocs ]] |
---|
3745 | then |
---|
3746 | actionout[$i]="tr" |
---|
3747 | fi |
---|
3748 | |
---|
3749 | if [[ ! -f ${localout[$i]} && $files_for_pes = false ]] |
---|
3750 | then |
---|
3751 | printf "\n +++ temporary OUTPUT-file ${localout[$i]} does not exist\n" |
---|
3752 | elif [[ ! -d ${localout[$i]} && $files_for_pes = true ]] |
---|
3753 | then |
---|
3754 | printf "\n +++ temporary OUTPUT-file ${localout[$i]}/.... does not exist\n" |
---|
3755 | else |
---|
3756 | |
---|
3757 | |
---|
3758 | # COPY VIA SCP TO LOCAL HOST (ALWAYS IN BINARY MODE USING batch_scp option -m) |
---|
3759 | # IF TARGET DIRECTORY DOES NOT EXISTS, TRY TO CREATE IT |
---|
3760 | if [[ "${actionout[$i]}" = tr ]] |
---|
3761 | then |
---|
3762 | if [[ $localhost != $fromhost ]] |
---|
3763 | then |
---|
3764 | if [[ $files_for_pes = false ]] |
---|
3765 | then |
---|
3766 | cps="" |
---|
3767 | cst="" |
---|
3768 | else |
---|
3769 | cps=-c |
---|
3770 | cst="/" |
---|
3771 | fi |
---|
3772 | if [[ $localhost = nech ]] |
---|
3773 | then |
---|
3774 | |
---|
3775 | # TRANSFER IN SEPERATE JOB |
---|
3776 | # FIRST COPY FILE TO TEMPORY DATA DIRECTORY |
---|
3777 | [[ ! -d $tmp_data_catalog/TRANSFER ]] && mkdir -p $tmp_data_catalog/TRANSFER |
---|
3778 | file_to_transfer=${fname}_${localout[$i]}_to_transfer_$kennung |
---|
3779 | if [[ $files_for_pes = false ]] |
---|
3780 | then |
---|
3781 | ln -f ${localout[$i]} $tmp_data_catalog/TRANSFER/$file_to_transfer |
---|
3782 | else |
---|
3783 | mkdir $tmp_data_catalog/TRANSFER/$file_to_transfer |
---|
3784 | ln ${localout[$i]}/* $tmp_data_catalog/TRANSFER/$file_to_transfer |
---|
3785 | fi |
---|
3786 | |
---|
3787 | echo "set -x" > transfer_${localout[$i]} |
---|
3788 | echo "cd $tmp_data_catalog/TRANSFER" >> transfer_${localout[$i]} |
---|
3789 | |
---|
3790 | printf "\n >>> OUTPUT: ${localout[$i]}$cst by SCP in seperate job to" |
---|
3791 | printf "\n ${pathout[$i]}/${localhost}_${fname}${endout[$i]}$cst" |
---|
3792 | printf "\n or higher cycle\n" |
---|
3793 | 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]} |
---|
3794 | |
---|
3795 | echo "[[ \$? = 0 ]] && rm $file_to_transfer" >> transfer_${localout[$i]} |
---|
3796 | |
---|
3797 | if [[ $localhost = nech ]] |
---|
3798 | then |
---|
3799 | subjob -d -c /pf/b/$usern/job_queue -v -q pp -X 0 -m 1000 -t 900 $PORTOPT transfer_${localout[$i]} |
---|
3800 | else |
---|
3801 | if [[ "$LOGNAME" = b323013 ]] |
---|
3802 | then |
---|
3803 | subjob -v -q c1 -X 0 -m 1000 -t 900 -c $job_catalog $PORTOPT transfer_${localout[$i]} |
---|
3804 | else |
---|
3805 | subjob -d -v -q c1 -X 0 -m 1000 -t 900 -c $job_catalog $PORTOPT transfer_${localout[$i]} |
---|
3806 | fi |
---|
3807 | fi |
---|
3808 | |
---|
3809 | else |
---|
3810 | |
---|
3811 | # TRANSFER WITHIN THIS JOB |
---|
3812 | transfer_failed=false |
---|
3813 | printf "\n >>> OUTPUT: ${localout[$i]}$cst by SCP to" |
---|
3814 | printf "\n ${pathout[$i]}/${localhost}_${fname}${endout[$i]}$cst\n" |
---|
3815 | if [[ $localhost = lccrayb ]] |
---|
3816 | then |
---|
3817 | 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]}" |
---|
3818 | elif [[ $localhost = lccrayh ]] |
---|
3819 | then |
---|
3820 | 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]}" |
---|
3821 | else |
---|
3822 | batch_scp $PORTOPT $cps -b -m -u $return_username $return_addres ${localout[$i]} "${pathout[$i]}" ${localhost}_${fname}${endout[$i]} ${extout[$i]} |
---|
3823 | fi |
---|
3824 | [[ $? != 0 ]] && transfer_failed=true |
---|
3825 | |
---|
3826 | # IF TRANSFER FAILED, CREATE BACKUP COPY ON THIS MACHINE |
---|
3827 | if [[ $transfer_failed = true ]] |
---|
3828 | then |
---|
3829 | printf " +++ transfer failed. Trying to save a copy on this host under:\n" |
---|
3830 | printf " ${pathout[$i]}/${localhost}_${fname}${endout[$i]}_$kennung\n" |
---|
3831 | |
---|
3832 | # FIRST CHECK, IF DIRECTORY EXISTS, AND CREATE IT, IF NECESSARY |
---|
3833 | eval local_catalog=${pathout[$i]} |
---|
3834 | if [[ ! -d $local_catalog ]] |
---|
3835 | then |
---|
3836 | printf " *** local directory does not exist. Trying to create:\n" |
---|
3837 | printf " $local_catalog \n" |
---|
3838 | mkdir -p $local_catalog |
---|
3839 | fi |
---|
3840 | eval cp ${localout[$i]} ${pathout[$i]}/${localhost}_${fname}${endout[$i]}_$kennung |
---|
3841 | transfer_problems=true |
---|
3842 | fi |
---|
3843 | fi |
---|
3844 | else |
---|
3845 | |
---|
3846 | # UNSET actionout. DUE TO THIS SETTING, FILE WILL LATER JUST BE COPIED ON THIS MACHINE |
---|
3847 | actionout[$i]="" |
---|
3848 | fi |
---|
3849 | fi |
---|
3850 | |
---|
3851 | |
---|
3852 | # APPEND VIA SCP TO LOCAL HOST (ALWAYS IN BINARY MODE USING batch_scp option -m) |
---|
3853 | # IF TARGET DIRECTORY DOES NOT EXISTS, TRY TO CREATE IT |
---|
3854 | if [[ "${actionout[$i]}" = tra ]] |
---|
3855 | then |
---|
3856 | if [[ $localhost != $fromhost ]] |
---|
3857 | then |
---|
3858 | if [[ $localhost = ibmh || $localhost = nech ]] |
---|
3859 | then |
---|
3860 | |
---|
3861 | # TRANSFER IN SEPERATE JOB |
---|
3862 | # FIRST COPY FILE TO TEMPORY DATA DIRECTORY |
---|
3863 | [[ ! -d $tmp_data_catalog/TRANSFER ]] && mkdir -p $tmp_data_catalog/TRANSFER |
---|
3864 | file_to_transfer=${fname}_${localout[$i]}_to_transfer_$kennung |
---|
3865 | ln -f ${localout[$i]} $tmp_data_catalog/TRANSFER/$file_to_transfer |
---|
3866 | |
---|
3867 | echo "set -x" > transfer_${localout[$i]} |
---|
3868 | echo "cd $tmp_data_catalog/TRANSFER" >> transfer_${localout[$i]} |
---|
3869 | |
---|
3870 | printf "\n >>> OUTPUT: ${localout[$i]} append by SCP in seperate job to" |
---|
3871 | printf "\n ${pathout[$i]}/${localhost}_${fname}${endout[$i]}" |
---|
3872 | printf "\n or higher cycle\n" |
---|
3873 | 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]} |
---|
3874 | |
---|
3875 | echo "[[ \$? = 0 ]] && rm $file_to_transfer" >> transfer_${localout[$i]} |
---|
3876 | |
---|
3877 | if [[ $localhost = nech ]] |
---|
3878 | then |
---|
3879 | subjob -d -c /pf/b/$usern/job_queue -v -q pp -X 0 -m 1000 -t 900 $PORTOPT transfer_${localout[$i]} |
---|
3880 | else |
---|
3881 | if [[ $LOGNAME = b323013 ]] |
---|
3882 | then |
---|
3883 | subjob -v -q c1 -X 0 -m 1000 -t 900 -c $job_catalog $PORTOPT transfer_${localout[$i]} |
---|
3884 | else |
---|
3885 | subjob -d -v -q c1 -X 0 -m 1000 -t 900 -c $job_catalog $PORTOPT transfer_${localout[$i]} |
---|
3886 | fi |
---|
3887 | fi |
---|
3888 | |
---|
3889 | else |
---|
3890 | |
---|
3891 | # TRANSFER WITHIN THIS JOB |
---|
3892 | transfer_failed=false |
---|
3893 | printf "\n >>> OUTPUT: ${localout[$i]} append by SCP to" |
---|
3894 | printf "\n ${pathout[$i]}/${localhost}_${fname}${endout[$i]}\n" |
---|
3895 | if [[ $localhost = lccrayb ]] |
---|
3896 | then |
---|
3897 | 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]}" |
---|
3898 | elif [[ $localhost = lccrayh ]] |
---|
3899 | then |
---|
3900 | 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]}" |
---|
3901 | else |
---|
3902 | batch_scp $PORTOPT -A -b -m -u $return_username $return_addres ${localout[$i]} "${pathout[$i]}" ${localhost}_${fname}${endout[$i]} ${extout[$i]} |
---|
3903 | fi |
---|
3904 | [[ $? != 0 ]] && transfer_failed=true |
---|
3905 | |
---|
3906 | # IF TRANSFER FAILED, CREATE BACKUP COPY ON THIS MACHINE |
---|
3907 | if [[ $transfer_failed = true ]] |
---|
3908 | then |
---|
3909 | printf " +++ transfer failed. Trying to save a copy on this host under:\n" |
---|
3910 | printf " ${pathout[$i]}/${localhost}_${fname}${endout[$i]}_$kennung\n" |
---|
3911 | |
---|
3912 | # FIRST CHECK, IF DIRECTORY EXISTS, AND CREATE IT, IF NECESSARY |
---|
3913 | eval local_catalog=${pathout[$i]} |
---|
3914 | if [[ ! -d $local_catalog ]] |
---|
3915 | then |
---|
3916 | printf " *** local directory does not exist. Trying to create:\n" |
---|
3917 | printf " $local_catalog \n" |
---|
3918 | mkdir -p $local_catalog |
---|
3919 | fi |
---|
3920 | |
---|
3921 | eval cp ${localout[$i]} ${pathout[$i]}/${localhost}_${fname}${endout[$i]}_$kennung |
---|
3922 | transfer_problems=true |
---|
3923 | fi |
---|
3924 | fi |
---|
3925 | else |
---|
3926 | |
---|
3927 | # RESET actionout. DUE TO THIS SETTING, FILE WILL LATER JUST BE APPENDED ON THIS MACHINE |
---|
3928 | actionout[$i]=a |
---|
3929 | fi |
---|
3930 | fi |
---|
3931 | |
---|
3932 | |
---|
3933 | # OUTPUT-FILE FOR A RESTART-RUN. |
---|
3934 | # FILE IS MOVED TO THE TEMPORARY DATA DIRECTORY USING link COMMAND. |
---|
3935 | # OPTION -f IS USED TO OVERWRITE EXISTING FILES. |
---|
3936 | # AS LAST ACTION, ARCHIVING IS INITIATED. |
---|
3937 | if [[ "${actionout[$i]}" = fl ]] |
---|
3938 | then |
---|
3939 | [[ ! -d $tmp_data_catalog ]] && mkdir -p $tmp_data_catalog |
---|
3940 | chmod g+rx $tmp_data_catalog |
---|
3941 | if [[ $files_for_pes = false ]] |
---|
3942 | then |
---|
3943 | printf "\n >>> OUTPUT: ${localout[$i]} to" |
---|
3944 | printf "\n $tmp_data_catalog/${frelout[$i]} (temporary data catalog)\n" |
---|
3945 | ln -f ${localout[$i]} $tmp_data_catalog/${frelout[$i]} |
---|
3946 | else |
---|
3947 | printf "\n >>> OUTPUT: ${localout[$i]}/.... to" |
---|
3948 | printf "\n $tmp_data_catalog/${frelout[$i]} (temporary data catalog)\n" |
---|
3949 | mkdir $tmp_data_catalog/${frelout[$i]} |
---|
3950 | cd ${localout[$i]} |
---|
3951 | for file in $(ls *) |
---|
3952 | do |
---|
3953 | ln -f $file $tmp_data_catalog/${frelout[$i]} |
---|
3954 | done |
---|
3955 | cd $TEMPDIR |
---|
3956 | fi |
---|
3957 | |
---|
3958 | |
---|
3959 | # CREATE AND SUBMIT ARCHIVING-JOB |
---|
3960 | if [[ $store_on_archive_system = true ]] |
---|
3961 | then |
---|
3962 | |
---|
3963 | if [[ $archive_system = asterix ]] |
---|
3964 | then |
---|
3965 | echo "cd $tmp_data_catalog" >> archive_${frelout[$i]} |
---|
3966 | if [[ $files_for_pes = false ]] |
---|
3967 | then |
---|
3968 | echo "stageout ${frelout[$i]} > STAGE_OUTPUT${i}_$kennung" >> archive_${frelout[$i]} |
---|
3969 | else |
---|
3970 | echo "stageout -t ${frelout[$i]} > STAGE_OUTPUT${i}_$kennung" >> archive_${frelout[$i]} |
---|
3971 | fi |
---|
3972 | echo "cat STAGE_OUTPUT${i}_$kennung" >> archive_${frelout[$i]} |
---|
3973 | echo "if [[ \$(grep -c \"st.msg:150\" STAGE_OUTPUT${i}_$kennung) != 0 ]]" >> archive_${frelout[$i]} |
---|
3974 | echo "then" >> archive_${frelout[$i]} |
---|
3975 | echo " do_stageout=false" >> archive_${frelout[$i]} |
---|
3976 | echo "else" >> archive_${frelout[$i]} |
---|
3977 | echo " echo \" +++ $filetyp ${frelout[$i]} could not be stored on archive-system\" " >> archive_${frelout[$i]} |
---|
3978 | echo " cat /dev/null > ~/job_queue/ARCHIVE_ERROR_$fname" >> archive_${frelout[$i]} |
---|
3979 | echo " cat STAGE_OUTPUT${i}_$kennung > ~/job_queue/archive_${frelout[$i]}_error" >> archive_${frelout[$i]} |
---|
3980 | echo " echo \" *** $filetyp ${frelout[$i]} will be copied to \$WORK as backup\" " >> archive_${frelout[$i]} |
---|
3981 | if [[ $files_for_pes = false ]] |
---|
3982 | then |
---|
3983 | echo " cp ${frelout[$i]} \$WORK" >> archive_${frelout[$i]} |
---|
3984 | else |
---|
3985 | echo " cp -r ${frelout[$i]} \$WORK/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
3986 | fi |
---|
3987 | echo " echo \" *** $filetyp ${frelout[$i]} saved\" " >> archive_${frelout[$i]} |
---|
3988 | echo "fi" >> archive_${frelout[$i]} |
---|
3989 | echo "rm STAGE_OUTPUT${i}_$kennung" >> archive_${frelout[$i]} |
---|
3990 | elif [[ $archive_system = DMF ]] |
---|
3991 | then |
---|
3992 | echo "cd $tmp_data_catalog" >> archive_${frelout[$i]} |
---|
3993 | if [[ $files_for_pes = false ]] |
---|
3994 | then |
---|
3995 | printf "\n +++ archiving of single files impossible with $archive_system !\n" |
---|
3996 | locat=DMF |
---|
3997 | exit |
---|
3998 | else |
---|
3999 | # ??? nicht benötigte Archiv-Systeme entfernen ??? |
---|
4000 | # FUER RECHNER IN JUELICH. DORT KOENNTEN AUCH |
---|
4001 | # EINZELNE DATEIEN GESICHERT WERDEN (SPAETER KORR.) |
---|
4002 | echo "rm -rf \$ARCHIVE/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
4003 | echo "cp -r ${frelout[$i]} \$ARCHIVE" >> archive_${frelout[$i]} |
---|
4004 | fi |
---|
4005 | elif [[ $archive_system = tivoli ]] |
---|
4006 | then |
---|
4007 | echo "cd $tmp_data_catalog" >> archive_${frelout[$i]} |
---|
4008 | if [[ $files_for_pes = false ]] |
---|
4009 | then |
---|
4010 | # REMOVE EXISTING OLD FILES FROM THE ARCHIVE |
---|
4011 | echo "set -x" >> archive_${frelout[$i]} |
---|
4012 | echo "rm -rf \$PERM/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
4013 | echo "cp ${frelout[$i]} \$PERM/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
4014 | else |
---|
4015 | |
---|
4016 | echo "set -x" >> archive_${frelout[$i]} |
---|
4017 | echo "rm -rf \$PERM/${frelout[$i]}/*" >> archive_${frelout[$i]} |
---|
4018 | echo "[[ ! -d \$PERM/${frelout[$i]} ]] && mkdir $PERM/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
4019 | cd $tmp_data_catalog |
---|
4020 | all_files=`ls -1 ${frelout[$i]}/*` |
---|
4021 | cd - > /dev/null |
---|
4022 | (( inode = 0 )) |
---|
4023 | (( tp1 = tasks_per_node + 1 )) |
---|
4024 | while (( inode < nodes )) |
---|
4025 | do |
---|
4026 | files=`echo $all_files | cut -d" " -f1-$tasks_per_node` |
---|
4027 | all_files=`echo $all_files | cut -d" " -f$tp1-` |
---|
4028 | echo "tar cvf \$PERM/${frelout[$i]}/${frelout[$i]}.node_$inode.tar $files" >> archive_${frelout[$i]} |
---|
4029 | (( inode = inode + 1 )) |
---|
4030 | done |
---|
4031 | fi |
---|
4032 | elif [[ $archive_system = ut ]] |
---|
4033 | then |
---|
4034 | echo "cd $tmp_data_catalog" >> archive_${frelout[$i]} |
---|
4035 | if [[ $files_for_pes = false ]] |
---|
4036 | then |
---|
4037 | # REMOVE EXISTING OLD FILES FROM THE ARCHIVE |
---|
4038 | echo "set -x" >> archive_${frelout[$i]} |
---|
4039 | echo "rm -rf \$UT/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
4040 | echo "cp ${frelout[$i]} \$UT/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
4041 | else |
---|
4042 | |
---|
4043 | echo "set -x" >> archive_${frelout[$i]} |
---|
4044 | echo "rm -rf \$UT/${frelout[$i]}/*" >> archive_${frelout[$i]} |
---|
4045 | echo "[[ ! -d \$UT/${frelout[$i]} ]] && mkdir $UT/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
4046 | cd $tmp_data_catalog |
---|
4047 | all_files=`ls -1 ${frelout[$i]}/*` |
---|
4048 | cd - > /dev/null |
---|
4049 | (( inode = 0 )) |
---|
4050 | (( tp1 = tasks_per_node + 1 )) |
---|
4051 | while (( inode < nodes )) |
---|
4052 | do |
---|
4053 | files=`echo $all_files | cut -d" " -f1-$tasks_per_node` |
---|
4054 | all_files=`echo $all_files | cut -d" " -f$tp1-` |
---|
4055 | echo "tar cvf \$UT/${frelout[$i]}/${frelout[$i]}.node_$inode.tar $files" >> archive_${frelout[$i]} |
---|
4056 | (( inode = inode + 1 )) |
---|
4057 | done |
---|
4058 | fi |
---|
4059 | elif [[ $archive_system = none ]] |
---|
4060 | then |
---|
4061 | printf " +++ archiving on $localhost not available!\n" |
---|
4062 | fi |
---|
4063 | |
---|
4064 | if [[ $archive_system != none ]] |
---|
4065 | then |
---|
4066 | if [[ $localhost = nech ]] |
---|
4067 | then |
---|
4068 | subjob -d -c /pf/b/$usern/job_queue -v -q pp -X 0 -m 1000 -t 7200 $PORTOPT archive_${frelout[$i]} |
---|
4069 | fi |
---|
4070 | printf " Archiving of $tmp_data_catalog/${frelout[$i]} initiated (batch job submitted)\n" |
---|
4071 | fi |
---|
4072 | else |
---|
4073 | printf " +++ caution: option -A is switched off. No archiving on $archive_system!\n" |
---|
4074 | fi |
---|
4075 | |
---|
4076 | |
---|
4077 | # CREATE AN EMPTY DIRECTORY IN THE USERS PERMANENT DIRECTORY, |
---|
4078 | # IN ORDER TO NOTE THE RESPECTIVE CYCLE NUMBER ON THE ARCHIVE SYSTEM |
---|
4079 | # RESTART-JOBS ARE USING THESE EMPTY-DIRECTORIES TO GET THE CURRENT HIGHEST |
---|
4080 | # CYCLE NUMBER ON THE ARCHIVE SYSTEM (IN CASE THAT INFORMATIONS ARE DIFFICULT TO |
---|
4081 | # TO ACCESS FROM THE ARCHIVE-SYSTEM DIRECTLY)) |
---|
4082 | if [[ $files_for_pes = false ]] |
---|
4083 | then |
---|
4084 | cat /dev/null > ${pathout[$i]} |
---|
4085 | else |
---|
4086 | mkdir -p ${pathout[$i]} |
---|
4087 | fi |
---|
4088 | |
---|
4089 | fi |
---|
4090 | |
---|
4091 | |
---|
4092 | # COPY FROM THIS HOST TO THE ARCHIVE-SYSTEM |
---|
4093 | # IF ANY ARCHIVING FAILS, AN ERROR-FLAG-FILE IS SET |
---|
4094 | # THIS FILE REMAINS TO BE SET, EVEN IF ARCHIVING OF FURTHER FILES IS SUCCESSFULL |
---|
4095 | if [[ "${actionout[$i]}" = ar ]] |
---|
4096 | then |
---|
4097 | if [[ $files_for_pes = false ]] |
---|
4098 | then |
---|
4099 | printf "\n >>> OUTPUT: ${localout[$i]} to" |
---|
4100 | printf "\n ${pathout[$i]}" |
---|
4101 | printf "\n File will be copied to archive-system ($archive_system) !\n" |
---|
4102 | else |
---|
4103 | printf "\n >>> OUTPUT: ${localout[$i]}/_.... to" |
---|
4104 | printf "\n ${pathout[$i]}" |
---|
4105 | printf "\n Directory will be copied to archive-system ($archive_system) !\n" |
---|
4106 | fi |
---|
4107 | mv ${localout[$i]} ${frelout[$i]} |
---|
4108 | |
---|
4109 | file_saved=false |
---|
4110 | |
---|
4111 | if [[ $archive_system = asterix ]] |
---|
4112 | then |
---|
4113 | do_stageout=true |
---|
4114 | (( stageout_anz = 0 )) |
---|
4115 | while [[ $do_stageout = true ]] |
---|
4116 | do |
---|
4117 | if [[ $files_for_pes = false ]] |
---|
4118 | then |
---|
4119 | stageout ${frelout[$i]} > STAGE_OUTPUT |
---|
4120 | else |
---|
4121 | stageout -t ${frelout[$i]} > STAGE_OUTPUT |
---|
4122 | fi |
---|
4123 | cat STAGE_OUTPUT |
---|
4124 | if [[ $(grep -c "st.msg:150" STAGE_OUTPUT) != 0 ]] |
---|
4125 | then |
---|
4126 | file_saved=true |
---|
4127 | do_stageout=false |
---|
4128 | else |
---|
4129 | if [[ $files_for_pes = false ]] |
---|
4130 | then |
---|
4131 | printf "\n +++ file ${frelout[$i]} could not be saved on archive-system" |
---|
4132 | else |
---|
4133 | printf "\n +++ directory ${frelout[$i]} could not be saved on archive-system" |
---|
4134 | fi |
---|
4135 | (( stageout_anz = stageout_anz + 1 )) |
---|
4136 | if (( stageout_anz == 10 )) |
---|
4137 | then |
---|
4138 | printf "\n +++ stoped after 10 unsuccessful tries!" |
---|
4139 | archive_save=false |
---|
4140 | do_stageout=false |
---|
4141 | else |
---|
4142 | printf "\n *** new try to store on archive after 15 min:" |
---|
4143 | sleep 900 |
---|
4144 | fi |
---|
4145 | fi |
---|
4146 | done |
---|
4147 | elif [[ $archive_system = DMF ]] |
---|
4148 | then |
---|
4149 | if [[ $files_for_pes = false ]] |
---|
4150 | then |
---|
4151 | printf "\n +++ archiving of single files impossible on $archive_system!\n" |
---|
4152 | locat=DMF |
---|
4153 | exit |
---|
4154 | else |
---|
4155 | rm -rf $ARCHIVE/${frelout[$i]} |
---|
4156 | cp -r ${frelout[$i]} $ARCHIVE |
---|
4157 | fi |
---|
4158 | file_saved=true |
---|
4159 | elif [[ $archive_system = tivoli ]] |
---|
4160 | then |
---|
4161 | # ARCHIVING ONLY POSSIBLE VIA BATCH-JOB |
---|
4162 | # IN THE MEANTIME, FILE IS STORED IN THE TEMPORARY DATA DIRECTORY, |
---|
4163 | # BECAUSE MRUN'S CURRENT TEMPORARY WORKING DIRECTORY MAY ALREADY BE DELETED |
---|
4164 | # WHEN THE ARCHIVE-JOB IS EXECUTED |
---|
4165 | [[ ! -d $tmp_data_catalog ]] && mkdir -p $tmp_data_catalog |
---|
4166 | chmod g+rx $tmp_data_catalog |
---|
4167 | if [[ $files_for_pes = false ]] |
---|
4168 | then |
---|
4169 | ln -f ${frelout[$i]} $tmp_data_catalog/${frelout[$i]} |
---|
4170 | else |
---|
4171 | mkdir $tmp_data_catalog/${frelout[$i]} |
---|
4172 | ln -f ${frelout[$i]}/* $tmp_data_catalog/${frelout[$i]} |
---|
4173 | fi |
---|
4174 | |
---|
4175 | # GENERATE AND SUBMIT BATCH-JOB |
---|
4176 | # FILE HAS TO BE DELETED FROM THE TEMPORARY DATA DIRECTORY |
---|
4177 | # DELETE OLD EXISTING FILES FROM THE ARCHIVE |
---|
4178 | echo "cd $tmp_data_catalog" > archive_${frelout[$i]} |
---|
4179 | if [[ $files_for_pes = false ]] |
---|
4180 | then |
---|
4181 | echo "rm -rf \$PERM/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
4182 | echo "cp ${frelout[$i]} \$PERM/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
4183 | echo "rm -rf ${frelout[$i]}" >> archive_${frelout[$i]} |
---|
4184 | else |
---|
4185 | echo "rm -rf \$PERM/${frelout[$i]}.tar" >> archive_${frelout[$i]} |
---|
4186 | echo "tar cvf \$PERM/${frelout[$i]}.tar ${frelout[$i]}" >> archive_${frelout[$i]} |
---|
4187 | echo "rm -rf ${frelout[$i]}" >> archive_${frelout[$i]} |
---|
4188 | fi |
---|
4189 | |
---|
4190 | subjob -v -d -q cdata -X 0 -m 1000 -t 43200 -c $job_catalog $PORTOPT archive_${frelout[$i]} |
---|
4191 | printf " Archiving of $tmp_data_catalog/${frelout[$i]} initiated (batch job submitted)\n" |
---|
4192 | file_saved=true |
---|
4193 | |
---|
4194 | elif [[ $archive_system = ut ]] |
---|
4195 | then |
---|
4196 | # ARCHIVING ONLY POSSIBLE VIA BATCH-JOB |
---|
4197 | # IN THE MEANTIME, FILE IS STORED IN THE TEMPORARY DATA DIRECTORY, |
---|
4198 | # BECAUSE MRUN'S CURRENT TEMPORARY WORKING DIRECTORY MAY ALREADY BE DELETED |
---|
4199 | # WHEN THE ARCHIVE-JOB IS EXECUTED |
---|
4200 | [[ ! -d $tmp_data_catalog ]] && mkdir -p $tmp_data_catalog |
---|
4201 | chmod g+rx $tmp_data_catalog |
---|
4202 | if [[ $files_for_pes = false ]] |
---|
4203 | then |
---|
4204 | ln -f ${frelout[$i]} $tmp_data_catalog/${frelout[$i]} |
---|
4205 | else |
---|
4206 | mkdir $tmp_data_catalog/${frelout[$i]} |
---|
4207 | ln -f ${frelout[$i]}/* $tmp_data_catalog/${frelout[$i]} |
---|
4208 | fi |
---|
4209 | |
---|
4210 | # GENERATE AND SUBMIT BATCH-JOB |
---|
4211 | # FILE HAS TO BE DELETED FROM THE TEMPORARY DATA DIRECTORY |
---|
4212 | # DELETE OLD EXISTING FILES FROM THE ARCHIVE |
---|
4213 | echo "cd $tmp_data_catalog" > archive_${frelout[$i]} |
---|
4214 | if [[ $files_for_pes = false ]] |
---|
4215 | then |
---|
4216 | echo "rm -rf \$UT/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
4217 | echo "cp ${frelout[$i]} \$UT/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
4218 | echo "rm -rf ${frelout[$i]}" >> archive_${frelout[$i]} |
---|
4219 | else |
---|
4220 | echo "rm -rf \$UT/${frelout[$i]}.tar" >> archive_${frelout[$i]} |
---|
4221 | echo "tar cvf \$UT/${frelout[$i]}.tar ${frelout[$i]}" >> archive_${frelout[$i]} |
---|
4222 | echo "rm -rf ${frelout[$i]}" >> archive_${frelout[$i]} |
---|
4223 | fi |
---|
4224 | |
---|
4225 | subjob -v -c /pf/b/$usern/job_queue -d -q pp -X 0 -m 1000 -t 7200 $PORTOPT archive_${frelout[$i]} |
---|
4226 | printf " Archiving of $tmp_data_catalog/${frelout[$i]} initiated (batch job submitted)\n" |
---|
4227 | file_saved=true |
---|
4228 | |
---|
4229 | else |
---|
4230 | printf "\n +++ archive_system=\"$archive_system\" archiving impossible!" |
---|
4231 | archive_save=false |
---|
4232 | fi |
---|
4233 | |
---|
4234 | # CREATE EMPTY FLAG-FILE OR -DIRECTORY |
---|
4235 | # IN ORDER TO NOTE THE RESPECTIVE CYCLE NUMBER ON THE ARCHIVE SYSTEM |
---|
4236 | # RESTART-JOBS ARE USING THESE EMPTY-DIRECTORIES TO GET THE CURRENT HIGHEST |
---|
4237 | # CYCLE NUMBER ON THE ARCHIVE SYSTEM (IN CASE THAT INFORMATIONS ARE DIFFICULT TO |
---|
4238 | # TO ACCESS FROM THE ARCHIVE-SYSTEM DIRECTLY)) |
---|
4239 | if [[ $file_saved = true ]] |
---|
4240 | then |
---|
4241 | if [[ $files_for_pes = false ]] |
---|
4242 | then |
---|
4243 | cat /dev/null > ${pathout[$i]} |
---|
4244 | else |
---|
4245 | mkdir -p ${pathout[$i]} |
---|
4246 | fi |
---|
4247 | fi |
---|
4248 | |
---|
4249 | fi |
---|
4250 | |
---|
4251 | # APPEND ON THIS MACHINE |
---|
4252 | if [[ "${actionout[$i]}" = "a" ]] |
---|
4253 | then |
---|
4254 | if [[ "${extout[$i]}" != " " && "${extout[$i]}" != "" ]] |
---|
4255 | then |
---|
4256 | printf "\n >>> OUTPUT: ${localout[$i]} append to ${pathout[$i]}.${extout[$i]}\n" |
---|
4257 | cat ${localout[$i]} >> ${pathout[$i]}.${extout[$i]} |
---|
4258 | else |
---|
4259 | printf "\n >>> OUTPUT: ${localout[$i]} append to ${pathout[$i]}\n" |
---|
4260 | cat ${localout[$i]} >> ${pathout[$i]} |
---|
4261 | fi |
---|
4262 | fi |
---|
4263 | |
---|
4264 | # COPY ON THIS MACHINE |
---|
4265 | # COPY HAS TO BE USED, BECAUSE MOVE DOES NOT WORK IF FILE-ORIGIN AND TARGET ARE |
---|
4266 | # ON DIFFERENT FILE-SYSTEMS |
---|
4267 | if [[ "${actionout[$i]}" = "" && $files_for_pes = false ]] |
---|
4268 | then |
---|
4269 | |
---|
4270 | # COPY IN CASE OF RUNS ON SINGLE CORES |
---|
4271 | if [[ "${extout[$i]}" != " " && "${extout[$i]}" != "" ]] |
---|
4272 | then |
---|
4273 | printf "\n >>> OUTPUT: ${localout[$i]} to ${pathout[$i]}.${extout[$i]}\n" |
---|
4274 | if [[ $link_local_output = true ]] |
---|
4275 | then |
---|
4276 | printf " using ln -f\n" |
---|
4277 | ln -f ${localout[$i]} ${pathout[$i]}.${extout[$i]} |
---|
4278 | fi |
---|
4279 | # If "ln -f" fails of if "$link_local_output = false" do a normal "cp" |
---|
4280 | if [[ ! -f "${pathout[$i]}.${extout[$i]}" ]] |
---|
4281 | then |
---|
4282 | if [[ $link_local_output = true ]] |
---|
4283 | then |
---|
4284 | printf " ln failed, using cp...\n" |
---|
4285 | fi |
---|
4286 | cp ${localout[$i]} ${pathout[$i]}.${extout[$i]} |
---|
4287 | fi |
---|
4288 | else |
---|
4289 | printf "\n >>> OUTPUT: ${localout[$i]} to ${pathout[$i]}\n" |
---|
4290 | if [[ $link_local_output = true ]] |
---|
4291 | then |
---|
4292 | printf " using ln -f\n" |
---|
4293 | ln -f ${localout[$i]} ${pathout[$i]} |
---|
4294 | fi |
---|
4295 | # If "ln -f" fails of if "$link_local_output = false" do a normal "cp" |
---|
4296 | if [[ ! -f "${pathout[$i]}" ]] |
---|
4297 | then |
---|
4298 | if [[ $link_local_output = true ]] |
---|
4299 | then |
---|
4300 | printf " ln failed, using cp...\n" |
---|
4301 | fi |
---|
4302 | cp ${localout[$i]} ${pathout[$i]} |
---|
4303 | fi |
---|
4304 | fi |
---|
4305 | |
---|
4306 | elif [[ "${actionout[$i]}" = "" && $files_for_pes = true ]] |
---|
4307 | then |
---|
4308 | |
---|
4309 | # FILES FROM THE DIFFERENT CORES ARE MOVED WITH ln-COMMAND TO THE PERMANENT DIRECTORY |
---|
4310 | # AS A FIRST STEP, THE PERMANENT DIRECTORY IS CREATED |
---|
4311 | printf "\n >>> OUTPUT: ${localout[$i]}/_.... to ${pathout[$i]}\n" |
---|
4312 | if [[ $link_local_output = true ]] |
---|
4313 | then |
---|
4314 | printf " using ln -f\n" |
---|
4315 | mkdir ${pathout[$i]} |
---|
4316 | cd ${localout[$i]} |
---|
4317 | for file in $(ls *) |
---|
4318 | do |
---|
4319 | ln -f $file ${pathout[$i]} |
---|
4320 | done |
---|
4321 | cd $TEMPDIR |
---|
4322 | fi |
---|
4323 | |
---|
4324 | # IF "ln -f" HAS FAILED OR IF "$link_local_output = false" DO A NORMAL COPY "cp -r" |
---|
4325 | if [[ ! -f "${pathout[$i]}/_0000" ]] |
---|
4326 | then |
---|
4327 | if [[ $link_local_output = true ]] |
---|
4328 | then |
---|
4329 | printf " ln failed for .../_0000, using cp...\n" |
---|
4330 | fi |
---|
4331 | cp -r ${localout[$i]} ${pathout[$i]} |
---|
4332 | fi |
---|
4333 | |
---|
4334 | fi |
---|
4335 | fi |
---|
4336 | done |
---|
4337 | if (( i != 0 )) |
---|
4338 | then |
---|
4339 | if [[ $transfer_problems = true ]] |
---|
4340 | then |
---|
4341 | printf "\n$dashes\n *** OUTPUT-files saved" |
---|
4342 | printf "\n +++ WARNING: some data transfers failed! \n" |
---|
4343 | else |
---|
4344 | printf "\n$dashes\n *** all OUTPUT-files saved \n" |
---|
4345 | fi |
---|
4346 | fi |
---|
4347 | |
---|
4348 | |
---|
4349 | # IF REQUIRED, START A RESTART-JOB |
---|
4350 | # FILE CONTINUE_RUN MUST HAVE BEEN CREATED BY THE EXECUTABLE (PALM) |
---|
4351 | if [[ -f CONTINUE_RUN ]] |
---|
4352 | then |
---|
4353 | |
---|
4354 | if [[ $archive_save = true ]] |
---|
4355 | then |
---|
4356 | |
---|
4357 | # ADD RESTART-OPTIONS TO THE MRUN-CALL (IF THEY ARE NOT USED ALREADY): |
---|
4358 | # -C TELLS MRUN THAT IT IS A RESTART-RUN |
---|
4359 | # -v SILENT MODE WITHOUT INTERACTIVE QUERIES |
---|
4360 | # -n BATCH-MODE (IMPORTANT ONLY IN CASE OF BATCH JOBS ON THE LOCAL MACHINE) |
---|
4361 | [[ $(echo $mc | grep -c "\-C") = 0 ]] && mc="$mc -C" |
---|
4362 | [[ $(echo $mc | grep -c "\-v") = 0 ]] && mc="$mc -v" |
---|
4363 | [[ $(echo $mc | grep -c "\-b") = 0 ]] && mc="$mc -b" |
---|
4364 | if [[ $(echo $mc | grep -c "#") != 0 ]] |
---|
4365 | then |
---|
4366 | mc=`echo $mc | sed 's/#/f/g'` |
---|
4367 | fi |
---|
4368 | |
---|
4369 | |
---|
4370 | # START THE RESTART-JOB |
---|
4371 | printf "\n\n *** initiating restart-run on \"$return_addres\" using command:\n" |
---|
4372 | echo " $mc" |
---|
4373 | printf "\n$dashes\n" |
---|
4374 | if [[ $localhost != $fromhost ]] |
---|
4375 | then |
---|
4376 | |
---|
4377 | if [[ $localhost = lccrayb || $localhost = lccrayh || $localhost = nech || $localhost = ibmh || $localhost = ibmkisti || $localhost = ibmku || $localhost = ibms || $localhost = lcflow || $localhost = lckyu* ]] |
---|
4378 | then |
---|
4379 | echo "*** ssh will be used to initiate restart-runs!" |
---|
4380 | echo " return_addres=\"$return_addres\" " |
---|
4381 | echo " return_username=\"$return_username\" " |
---|
4382 | if [[ $(echo $return_addres | grep -c "130.75.105") = 1 ]] |
---|
4383 | then |
---|
4384 | if [[ $localhost = ibmh ]] |
---|
4385 | then |
---|
4386 | 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\" " |
---|
4387 | elif [[ $localhost = lccrayb ]] |
---|
4388 | then |
---|
4389 | 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\" " |
---|
4390 | elif [[ $localhost = lccrayh ]] |
---|
4391 | then |
---|
4392 | 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\" " |
---|
4393 | |
---|
4394 | else |
---|
4395 | 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 " |
---|
4396 | fi |
---|
4397 | else |
---|
4398 | if [[ $localhost = ibmkisti ]] |
---|
4399 | then |
---|
4400 | 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\" " |
---|
4401 | elif [[ $localhost = lcflow ]] |
---|
4402 | then |
---|
4403 | /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 " |
---|
4404 | elif [[ $localhost = lccrayb ]] |
---|
4405 | then |
---|
4406 | 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\" " |
---|
4407 | elif [[ $localhost = lccrayh ]] |
---|
4408 | then |
---|
4409 | 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\" " |
---|
4410 | else |
---|
4411 | ssh $SSH_PORTOPT $return_addres -l $return_username "PATH=\$PATH:$LOCAL_MRUN_PATH;export PALM_BIN=$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc " |
---|
4412 | fi |
---|
4413 | fi |
---|
4414 | else |
---|
4415 | printf "\n +++ no restart mechanism available for host \"$localhost\" " |
---|
4416 | locat=restart; exit |
---|
4417 | fi |
---|
4418 | |
---|
4419 | # WAIT TO ALLOW THE RESTART-JOB TO BE QUEUED, BEFORE THE CURRENT JOB IS FINISHED |
---|
4420 | if [[ $queue = special1q ]] |
---|
4421 | then |
---|
4422 | sleep 120 |
---|
4423 | else |
---|
4424 | sleep 30 |
---|
4425 | fi |
---|
4426 | |
---|
4427 | else |
---|
4428 | |
---|
4429 | # JOBS RUNNING (AND STARTED) ON THE LOCAL MACHINE CAN DIRECTLY CALL MRUN (WITHOUT |
---|
4430 | # USING SSH) |
---|
4431 | cd $LOCAL_PWD |
---|
4432 | if [[ $localhost = lckyuh ]] |
---|
4433 | then |
---|
4434 | printf "\n +++ WARNING: no restart mechanism available for host \"$localhost\" " |
---|
4435 | printf "\n please restart job manually using command:\n" |
---|
4436 | printf "\n \"$mc\" " |
---|
4437 | else |
---|
4438 | eval $mc # THE ' MUST BE EVALUATED |
---|
4439 | fi |
---|
4440 | cd - > /dev/null |
---|
4441 | fi |
---|
4442 | if [[ $localhost = lckyuh ]] |
---|
4443 | then |
---|
4444 | printf "\n$dashes\n *** restart-run to be initiated manually\n" |
---|
4445 | else |
---|
4446 | printf "\n$dashes\n *** restart-run initiated \n" |
---|
4447 | fi |
---|
4448 | |
---|
4449 | |
---|
4450 | # DELETE INPUT-(RESTART)FILES, WHICH HAVE BEEN FETCHED FROM THE TEMPORARY DATA |
---|
4451 | # DIRECTORY, BACAUSE THEY ARE NOT REQUIRED BY THE RESTART-JOB. |
---|
4452 | # THIS IS DONE IN ORDER TO AVOID EXCEEDING DISC QUOTAS OR DISC SPACE (RESTART-FILES |
---|
4453 | # MAY BE VERY HUGE) |
---|
4454 | (( i = 0 )) |
---|
4455 | while (( i < iin )) |
---|
4456 | do |
---|
4457 | (( i = i + 1 )) |
---|
4458 | if [[ "${got_tmp[$i]}" = true && $keep_data_from_previous_run = false ]] |
---|
4459 | then |
---|
4460 | rm -r $tmp_data_catalog/${frelin[$i]} |
---|
4461 | fi |
---|
4462 | done |
---|
4463 | |
---|
4464 | else |
---|
4465 | |
---|
4466 | printf "\n +++ no restart-run possible, since errors occured" |
---|
4467 | printf "\n during the archive process" |
---|
4468 | fi |
---|
4469 | |
---|
4470 | fi |
---|
4471 | |
---|
4472 | |
---|
4473 | |
---|
4474 | # SEND EMAIL NOTIFICATION ABOUT THE FINISHED RUN |
---|
4475 | if [[ "$email_notification" != "none" ]] |
---|
4476 | then |
---|
4477 | |
---|
4478 | if [[ $localhost != $fromhost ]] |
---|
4479 | then |
---|
4480 | if [[ -f CONTINUE_RUN ]] |
---|
4481 | then |
---|
4482 | echo "PALM restart run necessary" > email_text |
---|
4483 | echo "description header of actual run:" >> email_text |
---|
4484 | cat CONTINUE_RUN >> email_text |
---|
4485 | echo "mrun-command to restart:" >> email_text |
---|
4486 | echo "$mc" >> email_text |
---|
4487 | else |
---|
4488 | echo "PALM run with base filename \"$fname\" on host \"$localhost\" finished" > email_text |
---|
4489 | fi |
---|
4490 | mail $email_notification < email_text |
---|
4491 | printf "\n *** email notification sent to \"$email_notification\" " |
---|
4492 | fi |
---|
4493 | fi |
---|
4494 | |
---|
4495 | |
---|
4496 | |
---|
4497 | # ALL ACTIONS FINISHED, TEMPORARY WORKING-DIRECTORY CAN BE DELETED |
---|
4498 | cd $HOME |
---|
4499 | [[ $delete_temporary_catalog = true ]] && rm -rf $TEMPDIR |
---|
4500 | |
---|
4501 | else |
---|
4502 | |
---|
4503 | |
---|
4504 | # PREPARING ACTIONS, |
---|
4505 | # IF A BATCH-JOB IS TO BE GENERATED AND STARTED ON A REMOTE-MACHINE GERECHNET |
---|
4506 | |
---|
4507 | # BUILD THE MRUN-COMMAND TO BE CALLED IN THE BATCH-JOB ON THE REMOTE-MACHINE |
---|
4508 | 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" |
---|
4509 | [[ "$cpp_opts" != "" ]] && mrun_com=${mrun_com}" -D \"$cpp_opts\"" |
---|
4510 | [[ "$global_revision" != "" ]] && mrun_com=${mrun_com}" -G \"$global_revision\"" |
---|
4511 | [[ $group_number != none ]] && mrun_com=${mrun_com}" -g $group_number" |
---|
4512 | [[ $do_compile = true ]] && mrun_com=${mrun_com}" -s \"$source_list\"" |
---|
4513 | [[ "$input_list" != "" ]] && mrun_com=${mrun_com}" -i \"$input_list\"" |
---|
4514 | [[ $ignore_archive_error = true ]] && mrun_com=${mrun_com}" -I" |
---|
4515 | [[ $keep_data_from_previous_run = true ]] && mrun_com=${mrun_com}" -k" |
---|
4516 | [[ "$additional_conditions" != "" ]] && mrun_com=${mrun_com}" -K \"$additional_conditions\"" |
---|
4517 | [[ "$output_list" != "" ]] && mrun_com=${mrun_com}" -o \"$output_list\"" |
---|
4518 | [[ "$read_from_config" = false ]] && mrun_com=${mrun_com}" -S" |
---|
4519 | [[ $do_trace = true ]] && mrun_com=${mrun_com}" -x" |
---|
4520 | [[ "$numprocs" != "" ]] && mrun_com=${mrun_com}" -X $numprocs" |
---|
4521 | if [[ $use_openmp = true ]] |
---|
4522 | then |
---|
4523 | mrun_com=${mrun_com}" -O $threads_per_task" |
---|
4524 | fi |
---|
4525 | [[ "$tasks_per_node" != "" ]] && mrun_com=${mrun_com}" -T $tasks_per_node" |
---|
4526 | [[ $store_on_archive_system = true ]] && mrun_com=${mrun_com}" -A" |
---|
4527 | [[ $package_list != "" ]] && mrun_com=${mrun_com}" -p \"$package_list\"" |
---|
4528 | [[ $return_password != "" ]] && mrun_com=${mrun_com}" -P $return_password" |
---|
4529 | [[ $delete_temporary_catalog = false ]] && mrun_com=${mrun_com}" -B" |
---|
4530 | [[ $node_usage != default && "$(echo $node_usage | cut -c1-3)" != "sla" && $node_usage != novice ]] && mrun_com=${mrun_com}" -n $node_usage" |
---|
4531 | [[ "$ocean_file_appendix" = true ]] && mrun_com=${mrun_com}" -y" |
---|
4532 | [[ $run_coupled_model = true ]] && mrun_com=${mrun_com}" -Y \"$coupled_dist\"" |
---|
4533 | [[ "$check_namelist_files" = false ]] && mrun_com=${mrun_com}" -z" |
---|
4534 | [[ "$combine_plot_fields" = false ]] && mrun_com=${mrun_com}" -Z" |
---|
4535 | [[ "$max_par_io_str" != "" ]] && mrun_com=${mrun_com}" -w $max_par_io_str" |
---|
4536 | if [[ $do_remote = true ]] |
---|
4537 | then |
---|
4538 | printf "\n>>>> MRUN-command on execution host:\n>>>> $mrun_com \n" |
---|
4539 | fi |
---|
4540 | |
---|
4541 | |
---|
4542 | # CREATE EXECUTABLE FOR BATCH JOB |
---|
4543 | if [[ $create_executable_for_batch = true && $restart_run != true ]] |
---|
4544 | then |
---|
4545 | |
---|
4546 | printf "\n *** creating the executable for batch job\n" |
---|
4547 | |
---|
4548 | # METHOD ONLY WORKS FOR BATCH JOBS ON LOCAL HOSTS |
---|
4549 | if [[ $host != $localhost ]] |
---|
4550 | then |
---|
4551 | printf "\n +++ creation of executables is only allowed for batch jobs on local hosts." |
---|
4552 | printf "\n Please set create_executable_for_batch = false in the config-file.\n" |
---|
4553 | locat=create_executable; exit |
---|
4554 | fi |
---|
4555 | |
---|
4556 | mkdir $working_directory/SOURCES_FOR_RUN_${fname}/TMPDIR_FOR_CREATING_EXECUTABLE |
---|
4557 | cd $working_directory/SOURCES_FOR_RUN_${fname}/TMPDIR_FOR_CREATING_EXECUTABLE |
---|
4558 | |
---|
4559 | cp $make_depository . |
---|
4560 | tar -xf $make_depository > /dev/null 2>&1 |
---|
4561 | cp ../* . > /dev/null 2>&1 |
---|
4562 | |
---|
4563 | make $mopts -f Makefile PROG=a.out F90=$compiler_name COPT="$cpp_options" F90FLAGS="$fopts" LDFLAGS="$lopts" |
---|
4564 | |
---|
4565 | if [[ $? != 0 || "$compile_error" = true || "$module_compile_error" = true ]] |
---|
4566 | then |
---|
4567 | printf "\n +++ error occured while compiling or linking" |
---|
4568 | locat=compile |
---|
4569 | exit |
---|
4570 | fi |
---|
4571 | |
---|
4572 | mv a.out .. |
---|
4573 | cd - > /dev/null 2>&1 |
---|
4574 | rm -rf $working_directory/SOURCES_FOR_RUN_${fname}/TMPDIR_FOR_CREATING_EXECUTABLE |
---|
4575 | |
---|
4576 | printf " *** executable created in \"$working_directory/SOURCES_FOR_RUN_${fname}\"\n " |
---|
4577 | |
---|
4578 | fi |
---|
4579 | |
---|
4580 | |
---|
4581 | # BUILD THE JOB-SCRIPTS ON FILE jobfile |
---|
4582 | jobfile=jobfile.$RANDOM |
---|
4583 | |
---|
4584 | |
---|
4585 | # CREATE TEMPORARY DIRECTORY AND SWITCH TO IT |
---|
4586 | echo "mkdir $TEMPDIR" >> $jobfile |
---|
4587 | echo "cd $TEMPDIR" >> $jobfile |
---|
4588 | |
---|
4589 | |
---|
4590 | # ACTIVATE ERROR-TRACEBACK |
---|
4591 | if [[ $do_trace = true ]] |
---|
4592 | then |
---|
4593 | echo "set -x" >> $jobfile |
---|
4594 | else |
---|
4595 | echo "set +vx" >> $jobfile |
---|
4596 | fi |
---|
4597 | |
---|
4598 | |
---|
4599 | # INITIALIZE THE ENVIRONMENT AND LOAD MODULES |
---|
4600 | if [[ "$init_cmds" != "" ]] |
---|
4601 | then |
---|
4602 | echo "$init_cmds" >> $jobfile |
---|
4603 | fi |
---|
4604 | if [[ "$module_calls" != "" ]] |
---|
4605 | then |
---|
4606 | echo "$module_calls" >> $jobfile |
---|
4607 | fi |
---|
4608 | |
---|
4609 | |
---|
4610 | # PROVIDE SOURCE-CODE FILES, MRUN-SCRIPT AND CONFIGURATION-FILE FOR THE JOB |
---|
4611 | # then-CLAUSE: FILES ARE COLLECTED IN THE SOURCES_FOR_RUN_... DIRECTORY ON THE LOCAL HOST, |
---|
4612 | # WHICH IS THEN FETCHED FROM THE BATCH-JOB BY USING cp/scp |
---|
4613 | # THE SOURCE-CODE FILES ALREADY EXIST IN THIS DIRECTORY |
---|
4614 | # else-CLAUSE: FILE-CONTENTS ARE PUT INTO THE JOB-FILE AS HERE-DOCUMENTS |
---|
4615 | # THIS MAY CREATE A QUITE LARGE JOB-FILE, WHICH CAN CAUSE PROBLEMS WITH SOME |
---|
4616 | # QUEUEING-SYSTEMS |
---|
4617 | if [[ $host = ibmkisti || $host = lccrayb || $host = lccrayf || $host = lccrayh ]] |
---|
4618 | then |
---|
4619 | |
---|
4620 | # COPY CONFIGURATION-FILE AND MRUN-SCRIPT INTO THE SOURCES_FOR_RUN... DIRECTORY |
---|
4621 | if [[ $restart_run != true ]] |
---|
4622 | then |
---|
4623 | cp $config_file $working_directory/SOURCES_FOR_RUN_$fname |
---|
4624 | cp ${PALM_BIN}/$mrun_script_name $working_directory/SOURCES_FOR_RUN_$fname |
---|
4625 | fi |
---|
4626 | |
---|
4627 | # COPY THE SOURCES_FOR_RUN... DIRECTORY FROM THE LOCAL HOST TO THE JOB VIA scp |
---|
4628 | # (then-CLAUSE: JOBS ON THE LOCAL HOST CAN JUST USE cp) |
---|
4629 | echo "set -x" >> $jobfile |
---|
4630 | if [[ $host = $localhost ]] |
---|
4631 | then |
---|
4632 | |
---|
4633 | # DUE TO UNKNOWN REASONS, COPY WITH cp COMMAND CREATES CORRUPT |
---|
4634 | # FILES ON CRAY XC30 SYSTEMS (CSC HELSINKI), rsync IS USED INSTEAD |
---|
4635 | if [[ $(echo $host | cut -c1-6) = lccray ]] |
---|
4636 | then |
---|
4637 | echo "rsync -av -t $working_directory/SOURCES_FOR_RUN_$fname ." >> $jobfile |
---|
4638 | else |
---|
4639 | echo "cp -r $working_directory/SOURCES_FOR_RUN_$fname ." >> $jobfile |
---|
4640 | fi |
---|
4641 | |
---|
4642 | else |
---|
4643 | if [[ $host = ibmkisti ]] |
---|
4644 | then |
---|
4645 | # ON KISTI'S IBM FIREWALL IS ONLY OPENED ON INTERACTIVE NODE |
---|
4646 | echo "localdir=\`pwd\`" >> $jobfile |
---|
4647 | echo "ssh $SSH_PORTOPT $remote_username@gaiad \"cd \$localdir; scp $PORTOPT -r $return_username@$return_addres:$working_directory/SOURCES_FOR_RUN_$fname .\" " >> $jobfile |
---|
4648 | elif [[ $host = lccrayb ]] |
---|
4649 | then |
---|
4650 | echo "localdir=\`pwd\`" >> $jobfile |
---|
4651 | echo "ssh $SSH_PORTOPT $remote_username@blogin1 \"cd \$localdir; scp $PORTOPT -r $return_username@$return_addres:$working_directory/SOURCES_FOR_RUN_$fname .\" " >> $jobfile |
---|
4652 | elif [[ $host = lccrayh ]] |
---|
4653 | then |
---|
4654 | echo "localdir=\`pwd\`" >> $jobfile |
---|
4655 | echo "ssh $SSH_PORTOPT $remote_username@hlogin1 \"cd \$localdir; scp $PORTOPT -r $return_username@$return_addres:$working_directory/SOURCES_FOR_RUN_$fname .\" " >> $jobfile |
---|
4656 | |
---|
4657 | else |
---|
4658 | echo "scp $PORTOPT -r $return_username@$return_addres:$working_directory/SOURCES_FOR_RUN_$fname ." >> $jobfile |
---|
4659 | fi |
---|
4660 | fi |
---|
4661 | echo "export SOURCES_COMPLETE=true" >> $jobfile |
---|
4662 | |
---|
4663 | # MOVE MRUN-SCRIPT AND CONFIGURATION-FILE FROM THE SOURCES_FOR_RUN... DIRECTORY TO THE |
---|
4664 | # WORKING DIRECTORY OF THE JOB |
---|
4665 | echo "mv SOURCES_FOR_RUN_$fname/$config_file . " >> $jobfile |
---|
4666 | echo "mv SOURCES_FOR_RUN_$fname/$mrun_script_name . " >> $jobfile |
---|
4667 | echo "chmod u+rwx $mrun_script_name" >> $jobfile |
---|
4668 | echo "execute_mrun=true" >> $jobfile |
---|
4669 | echo " " >> $jobfile |
---|
4670 | |
---|
4671 | else |
---|
4672 | |
---|
4673 | # PROVIDE SOURCE-CODE FILES AND MAKEFILE AS HERE DOCUMENT |
---|
4674 | if [[ $do_compile = true ]] |
---|
4675 | then |
---|
4676 | |
---|
4677 | source_catalog=SOURCES_FOR_RUN_$fname |
---|
4678 | |
---|
4679 | # CREATE SOURCES_FOR_RUN... DIRECTORY TO STORE THE SOURCE CODE FILES AND THE MAKEFILE |
---|
4680 | echo "mkdir SOURCES_FOR_RUN_$fname" >> $jobfile |
---|
4681 | echo "export SOURCES_COMPLETE=true" >> $jobfile |
---|
4682 | echo "cd SOURCES_FOR_RUN_$fname" >> $jobfile |
---|
4683 | |
---|
4684 | for filename in $source_list |
---|
4685 | do |
---|
4686 | # BACKSLASH IS USED FOR MASKING |
---|
4687 | echo "cat > $filename << \"%END%\"" >> $jobfile |
---|
4688 | cat $source_catalog/$filename >> $jobfile |
---|
4689 | echo " " >> $jobfile |
---|
4690 | echo "%END%" >> $jobfile |
---|
4691 | echo " " >> $jobfile |
---|
4692 | done |
---|
4693 | |
---|
4694 | # BACKSLASH IS USED FOR MASKING |
---|
4695 | echo "cat > Makefile << \"%END%\"" >> $jobfile |
---|
4696 | cat $source_catalog/Makefile >> $jobfile |
---|
4697 | echo " " >> $jobfile |
---|
4698 | echo "%END%" >> $jobfile |
---|
4699 | echo " " >> $jobfile |
---|
4700 | |
---|
4701 | echo "cd - > /dev/null" >> $jobfile |
---|
4702 | |
---|
4703 | fi |
---|
4704 | |
---|
4705 | |
---|
4706 | # PROVIDE THE CONFIGURATION-FILE AS HERE-DOCUMENT |
---|
4707 | # BACKSLASH IS USED FOR MASKING |
---|
4708 | # LINES WITH #$ IN THE CONFIGURATION-FILE, COMING FROM THE SVN KEYWORD SUBSTITUTION, |
---|
4709 | # ARE REMOVED FROM THE FILE IN ORDER TO AVOID PROBLEMS WITH THE SGE BATCH SYSTEM |
---|
4710 | echo "cat > $config_file << \"%END%\"" >> $jobfile |
---|
4711 | if [[ $host = lckyuh ]] |
---|
4712 | then |
---|
4713 | # NO CROSS-COMPILER ON COMPUTE NODE |
---|
4714 | sed 's/frtpx/frt/g' $config_file >> $jobfile |
---|
4715 | else |
---|
4716 | sed 's/#$.*//g' $config_file >> $jobfile |
---|
4717 | fi |
---|
4718 | echo "%END%" >> $jobfile |
---|
4719 | echo " " >> $jobfile |
---|
4720 | |
---|
4721 | |
---|
4722 | # PROVIDE THE MRUN-SCRIPTS AS HERE-DOCUMENT |
---|
4723 | # BACKSLASH IS USED FOR MASKING |
---|
4724 | echo "cat > $mrun_script_name <<\"%END%\"" >> $jobfile |
---|
4725 | if [[ $host = lckyuh ]] |
---|
4726 | then |
---|
4727 | sed 's/\/bin\/ksh/\/bin\/bash/g' ${PALM_BIN}/$mrun_script_name >> $jobfile |
---|
4728 | else |
---|
4729 | cat ${PALM_BIN}/$mrun_script_name >> $jobfile |
---|
4730 | fi |
---|
4731 | echo "%END%" >> $jobfile |
---|
4732 | echo "chmod u+x $mrun_script_name" >> $jobfile |
---|
4733 | echo "execute_mrun=true" >> $jobfile |
---|
4734 | echo " " >> $jobfile |
---|
4735 | |
---|
4736 | fi |
---|
4737 | |
---|
4738 | |
---|
4739 | # GET REQUIRED INPUT-FILES BY SCP OR BY SENDING THEM WITH THE JOB AS HERE-DOCUMENT |
---|
4740 | # PUT THESE FILES INTO THE USER'S RESPECTIVE PERMANENT DIRECTORIES ON THE REMOTE-HOST |
---|
4741 | # IF THE DIRECTORIES DO NOT EXIST, TRY TO CREATE THEM |
---|
4742 | if [[ $do_remote = true ]] |
---|
4743 | then |
---|
4744 | (( i = 0 )) |
---|
4745 | while (( i < iin )) |
---|
4746 | do |
---|
4747 | (( i = i + 1 )) |
---|
4748 | echo "[[ ! -d ${pathin[$i]} ]] && mkdir -p ${pathin[$i]}" >> $jobfile |
---|
4749 | if [[ "${transin[$i]}" = job ]] |
---|
4750 | then |
---|
4751 | echo "cat > ${remotepathin[$i]} <<\"%END%\"" >> $jobfile |
---|
4752 | eval cat ${pathin[$i]}/${frelin[$i]} >> $jobfile |
---|
4753 | echo " " >> $jobfile |
---|
4754 | echo "%END%" >> $jobfile |
---|
4755 | else |
---|
4756 | echo "batch_scp $PORTOPT -b -o -g -s -u $return_username $return_addres ${remotepathin[$i]} \"${pathin[$i]}\" ${frelin[$i]}" >> $jobfile |
---|
4757 | fi |
---|
4758 | |
---|
4759 | # CHECK, IF FILE COULD BE CREATED |
---|
4760 | echo "if [[ \$? = 1 ]]" >> $jobfile |
---|
4761 | echo "then" >> $jobfile |
---|
4762 | echo " echo \" \" " >> $jobfile |
---|
4763 | echo " echo \"+++ file ${remotepathin[$i]} could not be created\" " >> $jobfile |
---|
4764 | echo " echo \" please check, if directory exists on $host!\" " >> $jobfile |
---|
4765 | echo " echo \"+++ MRUN will not be continued\" " >> $jobfile |
---|
4766 | echo " execute_mrun=false" >> $jobfile |
---|
4767 | echo "fi" >> $jobfile |
---|
4768 | done |
---|
4769 | fi |
---|
4770 | |
---|
4771 | # PROVIDE NAME OF THE CURRENT WORKING-DIRECTORY ON THE LOCAL MACHINE (FROM WHERE THE JOB IS |
---|
4772 | # STARTED) BY SETTING AN ENVIRONMENT-VARIABLE. THIS INFORMATION IS USED IN THE JOB BY MRUN |
---|
4773 | # IN CASE THAT RESTART-RUNS HAVE TO BE GENERATED |
---|
4774 | echo "LOCAL_PWD=$working_directory" >> $jobfile |
---|
4775 | echo "export LOCAL_PWD" >> $jobfile |
---|
4776 | |
---|
4777 | # PROVIDE THE PATH OF THE LOCAL MRUN-SCRIPT FOR THE SAME REASON |
---|
4778 | echo "LOCAL_MRUN_PATH=$PALM_BIN" >> $jobfile |
---|
4779 | echo "export LOCAL_MRUN_PATH" >> $jobfile |
---|
4780 | |
---|
4781 | # lcflow ALSO REQUIRES TO PROVIDE PATH FOR THE PALM-SCRIPTS |
---|
4782 | if [[ $host = lcflow || $localhost = lcflow ]] |
---|
4783 | then |
---|
4784 | echo "export PALM_BIN=$PALM_BIN" | sed -e 's:'$HOME':$HOME:' >> $jobfile |
---|
4785 | echo "export PATH=\$PATH:\$PALM_BIN" >> $jobfile |
---|
4786 | fi |
---|
4787 | |
---|
4788 | # CALL MRUN WITHIN THE JOB (SETTING QUEUE IS A WORKAROUND FOR ibmkisti) |
---|
4789 | # AS FINAL ACTION, REMOVE THE TEMPORARY DIRECTORY CREATED AT THE BEGINNING OF THE JOB |
---|
4790 | echo "set -x" >> $jobfile |
---|
4791 | echo "queue=$queue" >> $jobfile |
---|
4792 | echo "[[ \$execute_mrun = true ]] && ./$mrun_com" >> $jobfile |
---|
4793 | echo 'ls -al; echo `pwd`' >> $jobfile |
---|
4794 | echo "cd \$HOME" >> $jobfile |
---|
4795 | echo "rm -rf $TEMPDIR" >> $jobfile |
---|
4796 | |
---|
4797 | |
---|
4798 | |
---|
4799 | |
---|
4800 | # START THE JOB USING SUBJOB-COMMAND |
---|
4801 | if [[ $silent = false ]] |
---|
4802 | then |
---|
4803 | printf "\n " |
---|
4804 | else |
---|
4805 | printf "\n\n" |
---|
4806 | fi |
---|
4807 | |
---|
4808 | 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 |
---|
4809 | rm -rf $jobfile |
---|
4810 | |
---|
4811 | |
---|
4812 | fi # END OF REMOTE-PART |
---|