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