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