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