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