[1] | 1 | #!/bin/ksh |
---|
[1046] | 2 | |
---|
[1090] | 3 | # mbuild - script for compiling the PALM code and its utility programs |
---|
| 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 | # |
---|
[1310] | 19 | # Copyright 1997-2014 Leibniz Universitaet Hannover |
---|
[1046] | 20 | #--------------------------------------------------------------------------------# |
---|
| 21 | # |
---|
| 22 | # Current revisions: |
---|
[1090] | 23 | # ------------------ |
---|
[1351] | 24 | # |
---|
[1391] | 25 | # |
---|
[1046] | 26 | # Former revisions: |
---|
| 27 | # ----------------- |
---|
[1047] | 28 | # $Id: mbuild 1391 2014-05-06 07:58:01Z maronga $ |
---|
| 29 | # |
---|
[1391] | 30 | # 1390 2014-05-06 07:57:37Z maronga |
---|
| 31 | # disabled compilation of parameter file check (currently not working), |
---|
| 32 | # adjustments for lcxe6 |
---|
| 33 | # |
---|
[1389] | 34 | # 1388 2014-05-06 07:42:38Z maronga |
---|
| 35 | # small adjustments for lcxe6 |
---|
| 36 | # |
---|
[1351] | 37 | # 1350 2014-04-04 13:01:30Z maronga |
---|
[1388] | 38 | # init_cmds is now executed before module calls in case of compilation on local |
---|
[1351] | 39 | # host |
---|
| 40 | # |
---|
[1290] | 41 | # 1289 2014-03-04 07:12:34Z raasch |
---|
| 42 | # comments translated from German to English |
---|
| 43 | # fimm-, scirocco-, ibmy-, and sgi-specific code removed |
---|
| 44 | # |
---|
[1275] | 45 | # 1274 2014-01-09 13:14:54Z heinze |
---|
| 46 | # adjustments for lccrayh |
---|
| 47 | # |
---|
[1256] | 48 | # 1255 2013-11-07 14:43:35Z raasch |
---|
| 49 | # further adjustments for lccrayb remote access |
---|
| 50 | # |
---|
[1230] | 51 | # 1229 2013-09-20 06:55:19Z raasch |
---|
| 52 | # adjustments for lccrayb |
---|
| 53 | # |
---|
[1217] | 54 | # 1216 2013-08-26 09:31:42Z raasch |
---|
[1230] | 55 | # RCS renamed SOURCES |
---|
[1217] | 56 | # |
---|
[1211] | 57 | # 1210 2013-08-14 10:58:20Z raasch |
---|
| 58 | # fftw support added |
---|
| 59 | # |
---|
[1210] | 60 | # 1197 2013-07-04 06:19:45Z raasch |
---|
| 61 | # adjustments for CSC Helsinki (lccrayf) |
---|
| 62 | # |
---|
[1100] | 63 | # 1099 2013-02-10 01:47:43Z raasch |
---|
| 64 | # adjustments for Forwind cluster (lcflow) |
---|
| 65 | # |
---|
[1096] | 66 | # 1096 2013-02-03 01:52:12Z raasch |
---|
| 67 | # decalpha parts (yonsei) removed |
---|
| 68 | # |
---|
[1091] | 69 | # 2013-02-02 07:06:13Z raasch |
---|
| 70 | # adjustments for Kyushu-University computing center (lckyut) |
---|
| 71 | # old changelog messages removed |
---|
| 72 | # |
---|
[1084] | 73 | # 1083 2013-01-04 10:22:09Z maronga |
---|
| 74 | # bugfix in parameter file check (in case that no preprocessor flag, i.e. -cpp was |
---|
| 75 | # set in %cpp_options, the last directive in the variable was processed. |
---|
| 76 | # |
---|
| 77 | # 1081 2013-01-03 08:44:36Z maronga |
---|
[1082] | 78 | # loader options set for parameter file check_depository_path |
---|
| 79 | # |
---|
[1070] | 80 | # 1069 2012-11-28 16:18:43Z maronga |
---|
| 81 | # added copy of nc2vdf tools to remote host_found |
---|
| 82 | # |
---|
[1047] | 83 | # 1046 2012-11-09 14:38:45Z maronga |
---|
| 84 | # code put under GPL (PALM 3.9) |
---|
| 85 | # |
---|
[1090] | 86 | # 12/06/02 - Siggi - first version finished |
---|
| 87 | # 06/05/02 - Siggi - script development started |
---|
| 88 | # |
---|
| 89 | #--------------------------------------------------------------------------------# |
---|
[503] | 90 | # mbuild - script for compiling the PALM code and its utility programs |
---|
[1090] | 91 | # |
---|
| 92 | # Procedure to compile code on local and remote hosts using the |
---|
| 93 | # make-mechanism. The source code must be provided on the local host. |
---|
| 94 | #--------------------------------------------------------------------------------# |
---|
[1] | 95 | |
---|
| 96 | |
---|
[503] | 97 | # VARIABLE DECLARATIONS + DEFAULT VALUES |
---|
[936] | 98 | block_conditions=none |
---|
| 99 | block_conditions_found=false |
---|
[22] | 100 | compile_utility_programs=false |
---|
[1] | 101 | config_file=.mrun.config |
---|
| 102 | host=all |
---|
| 103 | host_found=false |
---|
| 104 | locat=normal |
---|
| 105 | makefile="" |
---|
[493] | 106 | module_calls="" |
---|
[811] | 107 | util_compiled_localhost=false |
---|
[1] | 108 | silent=false |
---|
| 109 | suf=f90 |
---|
| 110 | update=false |
---|
[83] | 111 | working_directory=`pwd` |
---|
[1] | 112 | |
---|
| 113 | typeset -i ih ihost=0 |
---|
| 114 | |
---|
[66] | 115 | typeset -R30 calltime |
---|
[1] | 116 | typeset -L20 column1 |
---|
| 117 | typeset -L50 column2 |
---|
| 118 | typeset -L70 column3 |
---|
[215] | 119 | typeset -L40 version="MBUILD 2.1 Rev$Rev: 1391 $" |
---|
[1] | 120 | |
---|
[503] | 121 | # ERROR HANDLING |
---|
| 122 | # IN CASE OF EXIT: |
---|
[83] | 123 | trap 'rm -rf $working_directory/tmp_mbuild |
---|
[69] | 124 | if [[ $locat != normal ]] |
---|
[1] | 125 | then |
---|
| 126 | printf "\n\n +++ mbuild killed \n\n" |
---|
| 127 | else |
---|
| 128 | printf "\n\n *** mbuild finished \n\n" |
---|
| 129 | fi' exit |
---|
| 130 | |
---|
| 131 | |
---|
[503] | 132 | # IN CASE OF TERMINAL-BREAK: |
---|
[83] | 133 | trap 'rm -rf $working_directory/tmp_mbuild |
---|
[69] | 134 | printf "\n\n +++ mbuild killed by \"^C\" \n\n" |
---|
[1] | 135 | exit |
---|
| 136 | ' 2 |
---|
| 137 | |
---|
| 138 | |
---|
[215] | 139 | tmp_mbuild=${working_directory}/tmp_mbuild |
---|
[1] | 140 | |
---|
[503] | 141 | # READ SHELLSCRIPT-OPTIONS |
---|
[936] | 142 | while getopts :c:h:K:m:s:uv option |
---|
[1] | 143 | do |
---|
| 144 | case $option in |
---|
| 145 | (c) config_file=$OPTARG;; |
---|
| 146 | (h) host=$OPTARG;; |
---|
[936] | 147 | (K) block_conditions=$OPTARG;; |
---|
[1] | 148 | (m) makefile=$OPTARG;; |
---|
| 149 | (s) suf=$OPTARG;; |
---|
[22] | 150 | (u) compile_utility_programs=true;; |
---|
[935] | 151 | (v) silent=true;; |
---|
[1] | 152 | (\?) printf "\n +++ unknown option $OPTARG \n"; |
---|
| 153 | locat=parameter; exit;; |
---|
| 154 | esac |
---|
| 155 | done |
---|
| 156 | |
---|
| 157 | |
---|
| 158 | |
---|
[503] | 159 | # CHECK, IF CONFIGURATION-FILE EXISTS |
---|
[82] | 160 | if [[ ! -f $config_file ]] |
---|
| 161 | then |
---|
| 162 | printf "\n +++ configuration file: " |
---|
| 163 | printf "\n $config_file" |
---|
| 164 | printf "\n does not exist" |
---|
| 165 | locat=configuration; exit |
---|
| 166 | fi |
---|
| 167 | |
---|
| 168 | |
---|
| 169 | |
---|
[503] | 170 | # DETERMINE THE LOCAL HOST |
---|
[1] | 171 | local_host_real_name=$(hostname) |
---|
[69] | 172 | # local_addres=$(nslookup `hostname` 2>&1 | grep "Address:" | tail -1 | awk '{print $2}') |
---|
| 173 | |
---|
[1] | 174 | |
---|
[82] | 175 | |
---|
[503] | 176 | # DETERMINE HOST-IDENTIFIER (local_host) FROM THE CONFIG-FILE |
---|
[82] | 177 | line="" |
---|
[215] | 178 | grep "%host_identifier" $config_file > $tmp_mbuild |
---|
[82] | 179 | while read line |
---|
| 180 | do |
---|
[116] | 181 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
[82] | 182 | then |
---|
| 183 | HOSTNAME=`echo $line | cut -d" " -s -f2` |
---|
| 184 | host_identifier=`echo $line | cut -d" " -s -f3` |
---|
[83] | 185 | if [[ $local_host_real_name = $HOSTNAME ]] |
---|
[82] | 186 | then |
---|
| 187 | local_host=$host_identifier |
---|
| 188 | break |
---|
| 189 | fi |
---|
| 190 | fi |
---|
[215] | 191 | done < $tmp_mbuild |
---|
[82] | 192 | |
---|
| 193 | if [[ "$local_host" = "" ]] |
---|
| 194 | then |
---|
| 195 | printf "\n +++ no host identifier found in configuration file \"$config_file\"" |
---|
| 196 | printf "\n for local host \"$local_host_real_name\"." |
---|
| 197 | printf "\n Please add line" |
---|
| 198 | printf "\n \"\%host_identifier $local_host_real_name <identifier>\"" |
---|
| 199 | printf "\n to the configuration file." |
---|
| 200 | locat=local_host; exit |
---|
| 201 | fi |
---|
| 202 | |
---|
| 203 | |
---|
[1] | 204 | if [[ $local_host != ibms ]] |
---|
| 205 | then |
---|
| 206 | config_file=$PWD/$config_file |
---|
| 207 | else |
---|
| 208 | config_file=`pwd`/$config_file |
---|
| 209 | fi |
---|
| 210 | |
---|
| 211 | |
---|
[1289] | 212 | # DETERMINE THE BLOCK CONDITIONS |
---|
[936] | 213 | if [[ $block_conditions != none ]] |
---|
| 214 | then |
---|
| 215 | block_condition1=`echo $block_conditions | cut -d" " -f1` |
---|
| 216 | block_condition2=`echo $block_conditions | cut -d" " -f2` |
---|
| 217 | if [[ "$block_condition2" = "$block_condition1" ]] |
---|
| 218 | then |
---|
| 219 | block_condition2="" |
---|
| 220 | fi |
---|
| 221 | fi |
---|
| 222 | |
---|
[1] | 223 | |
---|
[503] | 224 | # DETERMINE USER NAME ON LOCAL HOST FROM THE CONFIG-FILE |
---|
[1] | 225 | line="" |
---|
[215] | 226 | grep " $local_host" $config_file | grep "%remote_username" > $tmp_mbuild |
---|
[69] | 227 | while read line |
---|
[1] | 228 | do |
---|
[116] | 229 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
[1] | 230 | then |
---|
| 231 | local_username=`echo $line | cut -d" " -s -f2` |
---|
| 232 | fi |
---|
[215] | 233 | done < $tmp_mbuild |
---|
[1] | 234 | |
---|
[82] | 235 | |
---|
[1] | 236 | if [[ "$local_username" = "" ]] |
---|
| 237 | then |
---|
| 238 | printf "\n +++ no user name found in configuration file" |
---|
| 239 | printf "\n for local host \"$local_host\" " |
---|
| 240 | locat=config_file; exit |
---|
| 241 | fi |
---|
| 242 | |
---|
| 243 | |
---|
[503] | 244 | # DETERMINE LOCAL SOURCE-CODE PATH. |
---|
| 245 | # FIRST CHECK, IF A GLOBAL SOURCE-CODE PATH HAS BEEN DECLARED FOR ALL HOSTS. |
---|
| 246 | # THEREFORE, FIRST SET ALL GLOBAL VARIABLES DECLARED IN THE CONFIG-FILE, |
---|
| 247 | # BECAUSE THEY MAY BE USED AS PART OF THE PATH NAME. |
---|
[5] | 248 | line="" |
---|
[215] | 249 | grep "%" $config_file > $tmp_mbuild |
---|
[69] | 250 | while read line |
---|
[5] | 251 | do |
---|
[116] | 252 | if [[ "$line" != "" && "$(echo $line | cut -d" " -s -f3)" = "" && $(echo $line | cut -c1) != "#" ]] |
---|
[1] | 253 | then |
---|
[5] | 254 | var=`echo $line | cut -d" " -s -f1 | cut -c2-` |
---|
| 255 | value=`echo $line | cut -d" " -s -f2` |
---|
[8] | 256 | eval export $var=\$value |
---|
[1] | 257 | fi |
---|
[215] | 258 | done < $tmp_mbuild |
---|
[1] | 259 | |
---|
[503] | 260 | # NOW CHECK, IF A GLOBAL SOURCE-CODE-PATH HAS BEEN DECLARED |
---|
[1] | 261 | line="" |
---|
[215] | 262 | grep "%source_path" $config_file > $tmp_mbuild |
---|
[69] | 263 | while read line |
---|
[1] | 264 | do |
---|
| 265 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 266 | then |
---|
| 267 | if [[ "$(echo $line | cut -d" " -s -f3)" = "" ]] |
---|
| 268 | then |
---|
| 269 | global_source_path=`echo $line | cut -d" " -s -f2` |
---|
| 270 | fi |
---|
| 271 | fi |
---|
[215] | 272 | done < $tmp_mbuild |
---|
[1] | 273 | |
---|
| 274 | line="" |
---|
[215] | 275 | grep " $local_host" $config_file | grep "%source_path" > $tmp_mbuild |
---|
[69] | 276 | while read line |
---|
[1] | 277 | do |
---|
| 278 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 279 | then |
---|
| 280 | local_source_path=`echo $line | cut -d" " -s -f2` |
---|
| 281 | fi |
---|
[215] | 282 | done < $tmp_mbuild |
---|
[1] | 283 | |
---|
| 284 | if [[ "$local_source_path" = "" ]] |
---|
| 285 | then |
---|
| 286 | if [[ "$global_source_path" != "" ]] |
---|
| 287 | then |
---|
| 288 | local_source_path=$global_source_path |
---|
| 289 | else |
---|
| 290 | printf "\n +++ no source path found in configuration file" |
---|
| 291 | printf "\n for local host \"$local_host\" " |
---|
| 292 | printf "\n please set \"\%source_path\" in configuration file" |
---|
| 293 | locat=config_file; exit |
---|
| 294 | fi |
---|
| 295 | fi |
---|
| 296 | eval local_source_path=$local_source_path |
---|
[8] | 297 | eval local_source_path=$local_source_path |
---|
[1] | 298 | |
---|
| 299 | |
---|
[215] | 300 | |
---|
[503] | 301 | # DETERMINE GLOBAL DEPOSITORY-PATH |
---|
[1] | 302 | line="" |
---|
[215] | 303 | grep "%depository_path" $config_file > $tmp_mbuild |
---|
[69] | 304 | while read line |
---|
[1] | 305 | do |
---|
| 306 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 307 | then |
---|
| 308 | if [[ "$(echo $line | cut -d" " -s -f3)" = "" ]] |
---|
| 309 | then |
---|
| 310 | global_depository_path=`echo $line | cut -d" " -s -f2` |
---|
| 311 | fi |
---|
| 312 | fi |
---|
[215] | 313 | done < $tmp_mbuild |
---|
[1] | 314 | |
---|
[807] | 315 | if [[ $found = false ]] |
---|
| 316 | then |
---|
| 317 | printf "\n +++ no \%depository_path found in" |
---|
| 318 | printf "\n $config_file" |
---|
| 319 | locat=depository_path; exit |
---|
| 320 | fi |
---|
[1] | 321 | |
---|
[503] | 322 | # CHECK, IF A MAIN PROGRAM HAS BEEN DEFINED IN THE CONFIG-FILE |
---|
[5] | 323 | if [[ $(grep -c "%mainprog" $config_file) != 1 ]] |
---|
| 324 | then |
---|
| 325 | printf "\n +++ no main program or more than one main program defined" |
---|
| 326 | printf "\n in configuration file" |
---|
| 327 | locat=configuration; exit |
---|
| 328 | else |
---|
| 329 | line=`grep "%mainprog" $config_file` |
---|
| 330 | if [[ "$line" = "" || $(echo $line | cut -c1) = "#" ]] |
---|
| 331 | then |
---|
| 332 | printf "\n +++ no main program defined in configuration file" |
---|
| 333 | locat=configuration; exit |
---|
| 334 | fi |
---|
| 335 | mainprog=`echo $line | cut -d" " -s -f2 | cut -d"." -f1` |
---|
| 336 | fi |
---|
| 337 | |
---|
| 338 | |
---|
| 339 | |
---|
[503] | 340 | # CHECK IF MAKEFILE EXITS |
---|
[1] | 341 | [[ "$makefile" = "" ]] && makefile=$local_source_path/Makefile |
---|
| 342 | if [[ ! -f $makefile ]] |
---|
| 343 | then |
---|
| 344 | printf "\n +++ makefile: " |
---|
| 345 | printf "\n $makefile" |
---|
| 346 | printf "\n does not exist" |
---|
| 347 | locat=makefile; exit |
---|
| 348 | fi |
---|
| 349 | |
---|
| 350 | |
---|
[503] | 351 | # HEADER-OUTPUT (PART1: MESSAGES CONCERNING THE LOCAL HOST) |
---|
[1] | 352 | calltime=$(date) |
---|
| 353 | printf "\n" |
---|
| 354 | printf "#------------------------------------------------------------------------# \n" |
---|
| 355 | printf "| $version$calltime | \n" |
---|
| 356 | printf "| | \n" |
---|
| 357 | column1="called on:"; column2=$local_host_real_name |
---|
| 358 | printf "| $column1$column2 | \n" |
---|
| 359 | column1="local username:"; column2=$local_username |
---|
| 360 | printf "| $column1$column2 | \n" |
---|
| 361 | column1="local IP-addres:"; column2=$local_addres |
---|
| 362 | printf "| $column1$column2 | \n" |
---|
| 363 | column1="config file:"; column2=$config_file |
---|
| 364 | printf "| $column1$column2 | \n" |
---|
| 365 | column1="makefile:"; column2=$makefile |
---|
| 366 | printf "| $column1$column2 | \n" |
---|
| 367 | column1="local source path:"; column2=$local_source_path |
---|
| 368 | printf "| $column1$column2 | \n" |
---|
| 369 | printf "#------------------------------------------------------------------------# \n" |
---|
| 370 | |
---|
| 371 | # printf "| | \n" |
---|
| 372 | |
---|
| 373 | |
---|
[40] | 374 | if [[ $compile_utility_programs = false ]] |
---|
| 375 | then |
---|
[1] | 376 | |
---|
[503] | 377 | # IN ANY CASE, GIVE ALL FILES WRITE-PERMIT, IN ORDER TO AVOID PROBLEMS |
---|
| 378 | # WITH OVERWRITING FILES ON THE REMOTE HOST |
---|
[215] | 379 | cd $local_source_path |
---|
| 380 | printf "\n\n *** tar of makefile and source files in $local_source_path" |
---|
[40] | 381 | tar -cf ${mainprog}_sources.tar Makefile *.$suf |
---|
| 382 | printf "\n" |
---|
[1] | 383 | |
---|
[807] | 384 | else |
---|
| 385 | cd $local_source_path |
---|
| 386 | printf "\n\n *** tar of makefile and source files in $local_source_path" |
---|
| 387 | |
---|
| 388 | cat Makefile_check|while read line |
---|
| 389 | do |
---|
[1216] | 390 | line=$(echo $line|grep SOURCES) |
---|
| 391 | if [[ $line == *"SOURCES"* ]] |
---|
[807] | 392 | then |
---|
[1216] | 393 | line=$(echo $line|sed 's/SOURCES = //g') |
---|
[807] | 394 | break |
---|
| 395 | fi |
---|
| 396 | done |
---|
| 397 | |
---|
| 398 | tar -cf ${mainprog}_sources_check.tar Makefile_check $line |
---|
| 399 | printf "\n" |
---|
[40] | 400 | fi |
---|
[1] | 401 | |
---|
| 402 | |
---|
[40] | 403 | |
---|
[503] | 404 | # GET CONFIRMATION TO CONTINUE |
---|
[1] | 405 | if [[ $host = all ]] |
---|
| 406 | then |
---|
| 407 | printf "\n *** updates will be made for ALL hosts found in" |
---|
| 408 | printf "\n the configuration file" |
---|
| 409 | else |
---|
| 410 | printf "\n *** update will be made for host \"$host\" " |
---|
| 411 | fi |
---|
| 412 | |
---|
| 413 | if [[ $silent = false ]] |
---|
| 414 | then |
---|
| 415 | answer=dummy |
---|
| 416 | printf "\n\n" |
---|
| 417 | while [[ "$answer" != y && "$answer" != Y && "$answer" != n && "$answer" != N ]] |
---|
| 418 | do |
---|
| 419 | printf " >>> continue (y/n) ? " |
---|
| 420 | read answer |
---|
| 421 | done |
---|
| 422 | if [[ $answer = n || $answer = N ]] |
---|
| 423 | then |
---|
| 424 | locat=user_abort; exit |
---|
| 425 | fi |
---|
| 426 | fi |
---|
| 427 | |
---|
| 428 | |
---|
| 429 | |
---|
| 430 | |
---|
[1289] | 431 | # GENERATE MODEL-VERSIONS FOR ALL HOST-BLOCKS |
---|
| 432 | # FOUND IN THE CONFIGURATION-FILE |
---|
[1] | 433 | printf "\n *** scanning configuration file for host(s) ..." |
---|
| 434 | |
---|
[215] | 435 | grep %fopts $config_file > $tmp_mbuild |
---|
[69] | 436 | while read line |
---|
[1] | 437 | do |
---|
[1289] | 438 | # SKIP COMMENT-LINES |
---|
[1] | 439 | [[ $(echo $line | cut -c1) = "#" ]] && continue |
---|
| 440 | (( ihost = ihost + 1 )) |
---|
| 441 | hostline[$ihost]="$line" |
---|
[215] | 442 | done < $tmp_mbuild |
---|
[1] | 443 | |
---|
| 444 | |
---|
| 445 | while (( ih < ihost )) |
---|
| 446 | do |
---|
| 447 | |
---|
| 448 | (( ih = ih + 1 )) |
---|
| 449 | |
---|
[1289] | 450 | # DETERMINE REMOTE HOST AND CONDITIONS FOR THE RESPECTIVE BLOCK |
---|
| 451 | # CONTINUE, ONLY IF THIS HOST HAS BEEN CHOSEN VIA -h OPTION AND IF |
---|
| 452 | # CONDITIONS HAVE BEEN CHOSEN VIA -K OPTION |
---|
[1] | 453 | remote_host_string=`echo ${hostline[$ih]} | cut -d" " -s -f3-` |
---|
| 454 | remote_host=`echo $remote_host_string | cut -d" " -f1` |
---|
| 455 | if [[ $host != all ]] |
---|
| 456 | then |
---|
| 457 | [[ $remote_host != $host ]] && continue |
---|
| 458 | fi |
---|
| 459 | host_found=true |
---|
| 460 | condition1=`echo $remote_host_string | cut -d" " -s -f2` |
---|
| 461 | if [[ $condition1 = $remote_host ]] |
---|
| 462 | then |
---|
| 463 | condition1="" |
---|
| 464 | else |
---|
| 465 | condition2=`echo $remote_host_string | cut -d" " -s -f3` |
---|
| 466 | fi |
---|
| 467 | |
---|
[936] | 468 | if [[ $block_conditions != none ]] |
---|
| 469 | then |
---|
| 470 | if [[ "$condition1" != "$block_condition1" || "$condition2" != "$block_condition2" ]] |
---|
| 471 | then |
---|
| 472 | continue |
---|
| 473 | fi |
---|
| 474 | block_conditions_found=true |
---|
| 475 | fi |
---|
| 476 | |
---|
[1210] | 477 | fftw_inc="" |
---|
| 478 | fftw_lib="" |
---|
[493] | 479 | modules="" |
---|
[82] | 480 | netcdf_inc="" |
---|
| 481 | netcdf_lib="" |
---|
[784] | 482 | make_options="" |
---|
[1] | 483 | |
---|
[1289] | 484 | # DETERMINE IP-ADDRES OF THE REMOTE-HOST |
---|
[1] | 485 | case $remote_host in |
---|
[1255] | 486 | (lccrayb) remote_addres=130.73.233.1;; |
---|
[1274] | 487 | (lccrayh) remote_addres=130.75.4.1;; |
---|
[1099] | 488 | (lcflow) remote_addres="flow.hpc.uni-oldenburg.de";; |
---|
[980] | 489 | (lckordi) remote_adress=210.219.61.8;; |
---|
[116] | 490 | (lcmuk) remote_addres=130.75.105.2;; |
---|
[622] | 491 | (lcrte) remote_addres=133.5.185.60;; |
---|
[1099] | 492 | (lcsb) remote_addres=147.46.30.151;; |
---|
[367] | 493 | (lck) remote_addres=165.132.26.61;; |
---|
[1040] | 494 | (lckiaps) remote_addres=118.128.66.223;; |
---|
[1090] | 495 | (lckyut) remote_addres=133.5.4.37;; |
---|
[635] | 496 | (lctit) remote_addres=10.1.6.170;; |
---|
[892] | 497 | (lcxe6) remote_addres=129.177.20.113;; |
---|
[437] | 498 | (lcxt5m) remote_addres=193.166.211.144;; |
---|
[305] | 499 | (ibmh) remote_addres=136.172.40.15;; |
---|
[693] | 500 | (ibmkisti) remote_addres=150.183.146.24;; |
---|
[622] | 501 | (ibmku) remote_addres=133.5.4.129;; |
---|
[83] | 502 | (ibms) remote_addres=150.183.5.101;; |
---|
| 503 | (nech) remote_addres=136.172.44.192;; |
---|
| 504 | (neck) remote_addres=133.5.178.11;; |
---|
| 505 | (ground.yonsei.ac.kr) remote_addres=134.75.155.33;; |
---|
| 506 | (*) if [[ $local_host != $remote_host ]] |
---|
[1] | 507 | then |
---|
[83] | 508 | printf "\n +++ remote host \"$remote_host\" unknown"; |
---|
[503] | 509 | printf "\n please inform PALM group support!" |
---|
[1040] | 510 | locat=remote_host; exit |
---|
[1] | 511 | fi;; |
---|
| 512 | esac |
---|
| 513 | |
---|
| 514 | |
---|
[1289] | 515 | # DETERMINE REMOTE-USERNAME |
---|
[1] | 516 | line="" |
---|
[116] | 517 | found=false |
---|
[215] | 518 | grep "$remote_host_string" $config_file | grep "%remote_username" > $tmp_mbuild |
---|
[69] | 519 | while read line1 |
---|
[1] | 520 | do |
---|
[116] | 521 | |
---|
[1] | 522 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
| 523 | then |
---|
| 524 | line="$line1" |
---|
| 525 | fi |
---|
[116] | 526 | |
---|
| 527 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 528 | then |
---|
| 529 | remote_username=`echo $line | cut -d" " -s -f2` |
---|
| 530 | found=true |
---|
| 531 | fi |
---|
| 532 | |
---|
[215] | 533 | done < $tmp_mbuild |
---|
[1] | 534 | |
---|
[116] | 535 | if [[ $found = false ]] |
---|
[1] | 536 | then |
---|
| 537 | printf "\n +++ no remote username found in configuration file" |
---|
| 538 | printf "\n for \"$remote_host_string\" " |
---|
| 539 | locat=config_file; exit |
---|
| 540 | fi |
---|
| 541 | |
---|
| 542 | |
---|
[1289] | 543 | # DETERMINE REMOTE-SOURCE-CODE-PATH |
---|
[1] | 544 | line="" |
---|
[54] | 545 | remote_source_path="" |
---|
[215] | 546 | grep "$remote_host_string" $config_file | grep "%source_path" > $tmp_mbuild |
---|
[69] | 547 | while read line1 |
---|
[1] | 548 | do |
---|
[116] | 549 | |
---|
[1] | 550 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
| 551 | then |
---|
| 552 | line="$line1" |
---|
| 553 | fi |
---|
[116] | 554 | |
---|
| 555 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 556 | then |
---|
| 557 | remote_source_path=`echo $line | cut -d" " -s -f2` |
---|
| 558 | fi |
---|
| 559 | |
---|
[215] | 560 | done < $tmp_mbuild |
---|
[1] | 561 | |
---|
| 562 | if [[ "$remote_source_path" = "" ]] |
---|
| 563 | then |
---|
| 564 | if [[ "$global_source_path" != "" ]] |
---|
| 565 | then |
---|
| 566 | remote_source_path=$global_source_path |
---|
| 567 | else |
---|
| 568 | printf "\n +++ no source path found in configuration file" |
---|
| 569 | printf "\n for \"$remote_host_string\" " |
---|
| 570 | locat=config_file; exit |
---|
| 571 | fi |
---|
| 572 | fi |
---|
| 573 | |
---|
[22] | 574 | remote_ud=${remote_source_path}/../UTIL |
---|
[24] | 575 | remote_ud=$(eval echo $remote_ud) |
---|
[1] | 576 | |
---|
[54] | 577 | |
---|
[1289] | 578 | # DETERMINE REMOTE-PATH FOR MAKE-DEPOSITORY |
---|
[54] | 579 | remote_md="" |
---|
[1] | 580 | line="" |
---|
[215] | 581 | grep "$remote_host_string" $config_file | grep "%depository_path" > $tmp_mbuild |
---|
[69] | 582 | while read line1 |
---|
[1] | 583 | do |
---|
[116] | 584 | |
---|
[1] | 585 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
| 586 | then |
---|
| 587 | line="$line1" |
---|
| 588 | fi |
---|
[116] | 589 | |
---|
| 590 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 591 | then |
---|
| 592 | remote_md=`echo $line | cut -d" " -s -f2` |
---|
| 593 | fi |
---|
| 594 | |
---|
[215] | 595 | done < $tmp_mbuild |
---|
[1] | 596 | |
---|
| 597 | if [[ "$remote_md" = "" ]] |
---|
| 598 | then |
---|
| 599 | if [[ "$global_depository_path" != "" ]] |
---|
| 600 | then |
---|
| 601 | remote_md=$global_depository_path |
---|
| 602 | else |
---|
| 603 | printf "\n +++ no depository path found in configuration file" |
---|
| 604 | printf "\n for \"$remote_host_string\" " |
---|
| 605 | printf "\n please set \"\%depository_path\" in configuration file" |
---|
| 606 | locat=config_file; exit |
---|
| 607 | fi |
---|
| 608 | fi |
---|
| 609 | |
---|
[8] | 610 | remote_md=$(eval echo $remote_md) |
---|
[503] | 611 | block="" |
---|
| 612 | [[ "$condition1" != "" ]] && block=_$condition1 |
---|
| 613 | [[ "$condition2" != "" ]] && block=${block}_$condition2 |
---|
[508] | 614 | remote_md=${remote_md}$block |
---|
[1] | 615 | |
---|
[8] | 616 | |
---|
[1289] | 617 | # DETERMINE COMPILERNAME |
---|
[1] | 618 | line="" |
---|
[116] | 619 | found=false |
---|
[215] | 620 | grep "$remote_host_string" $config_file | grep "%compiler_name " > $tmp_mbuild |
---|
[69] | 621 | while read line1 |
---|
[1] | 622 | do |
---|
[116] | 623 | |
---|
[1] | 624 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
| 625 | then |
---|
| 626 | line="$line1" |
---|
| 627 | fi |
---|
[116] | 628 | |
---|
| 629 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 630 | then |
---|
| 631 | compiler_name=`echo $line | cut -d" " -s -f2` |
---|
| 632 | found=true |
---|
| 633 | fi |
---|
| 634 | |
---|
[215] | 635 | done < $tmp_mbuild |
---|
[1] | 636 | |
---|
[116] | 637 | if [[ $found = false ]] |
---|
[1] | 638 | then |
---|
| 639 | printf "\n +++ no compiler name found in configuration file" |
---|
| 640 | printf "\n for \"$remote_host_string\" " |
---|
| 641 | locat=config_file; exit |
---|
| 642 | fi |
---|
| 643 | |
---|
| 644 | |
---|
[1289] | 645 | # IN CASE OF PARALLEL EXECUTION (COMPILER FOR PARALLEL EXECUTION), |
---|
| 646 | # A SERIAL COMPILERNAME MUST BE DETERMINED ALSO |
---|
[27] | 647 | if [[ $(echo $remote_host_string | grep -c parallel) = 1 ]] |
---|
| 648 | then |
---|
| 649 | line="" |
---|
[116] | 650 | found=false |
---|
[215] | 651 | grep "$remote_host_string" $config_file | grep "%compiler_name_ser" > $tmp_mbuild |
---|
[69] | 652 | while read line1 |
---|
[27] | 653 | do |
---|
[116] | 654 | |
---|
[27] | 655 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
| 656 | then |
---|
| 657 | line="$line1" |
---|
| 658 | fi |
---|
[116] | 659 | |
---|
| 660 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 661 | then |
---|
| 662 | compiler_name_ser=`echo $line | cut -d" " -s -f2` |
---|
| 663 | found=true |
---|
| 664 | fi |
---|
| 665 | |
---|
[215] | 666 | done < $tmp_mbuild |
---|
[1] | 667 | |
---|
[116] | 668 | if [[ $found = false ]] |
---|
[27] | 669 | then |
---|
[28] | 670 | printf "\n +++ no serial compiler name found in configuration file" |
---|
[27] | 671 | printf "\n for \"$remote_host_string\" " |
---|
| 672 | locat=config_file; exit |
---|
| 673 | fi |
---|
| 674 | else |
---|
| 675 | compiler_name_ser=$compiler_name |
---|
| 676 | fi |
---|
| 677 | |
---|
| 678 | |
---|
| 679 | |
---|
[1289] | 680 | # DETERMINE PREPROCESSOR-OPTIONS AND DIRECTIVES |
---|
[82] | 681 | line="" |
---|
[116] | 682 | found=false |
---|
[215] | 683 | grep "$remote_host_string" $config_file | grep "%cpp_options" > $tmp_mbuild |
---|
[82] | 684 | while read line1 |
---|
| 685 | do |
---|
[116] | 686 | |
---|
[82] | 687 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
| 688 | then |
---|
| 689 | line="$line1" |
---|
| 690 | fi |
---|
[116] | 691 | |
---|
| 692 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 693 | then |
---|
[1289] | 694 | # REMOVE COLONS FROM THE OPTION-STRING, IF THERE ARE ANY |
---|
[116] | 695 | cpp_options=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` |
---|
| 696 | found=true |
---|
| 697 | fi |
---|
| 698 | |
---|
[215] | 699 | done < $tmp_mbuild |
---|
[116] | 700 | |
---|
| 701 | if [[ $found = false ]] |
---|
[82] | 702 | then |
---|
| 703 | printf "\n +++ no preprocessor options found in configuration file" |
---|
| 704 | printf "\n for \"$remote_host_string\" " |
---|
| 705 | locat=config_file; exit |
---|
| 706 | fi |
---|
| 707 | |
---|
[116] | 708 | |
---|
[1289] | 709 | # ADD HOST-SPECIFIC PREPROCESSOR-DIRECTIVES |
---|
[82] | 710 | for string in $remote_host_string |
---|
| 711 | do |
---|
| 712 | if [[ $(echo $remote_host | cut -c1-2) = lc && $(echo $string | cut -c1-2) = lc ]] |
---|
| 713 | then |
---|
| 714 | cpp_options="$cpp_options -D__lc " |
---|
[83] | 715 | elif [[ $(echo $remote_host | cut -c1-3) = ibm && $(echo $string | cut -c1-3) = ibm ]] |
---|
| 716 | then |
---|
| 717 | cpp_options="${cpp_options},-D__ibm" |
---|
| 718 | elif [[ $(echo $remote_host | cut -c1-3) = nec && $(echo $string | cut -c1-3) = nec ]] |
---|
| 719 | then |
---|
| 720 | cpp_options="${cpp_options} -D__nec" |
---|
[82] | 721 | else |
---|
[83] | 722 | if [[ $(echo $remote_host | cut -c1-3) = ibm ]] |
---|
| 723 | then |
---|
| 724 | cpp_options="${cpp_options},-D__$string" |
---|
| 725 | else |
---|
| 726 | cpp_options="$cpp_options -D__$string " |
---|
| 727 | fi |
---|
[82] | 728 | fi |
---|
| 729 | done |
---|
| 730 | |
---|
| 731 | |
---|
| 732 | |
---|
[1289] | 733 | # GET netCDF OPTIONS |
---|
[82] | 734 | line="" |
---|
[215] | 735 | grep "$remote_host_string" $config_file | grep "%netcdf_inc" > $tmp_mbuild |
---|
[82] | 736 | while read line1 |
---|
| 737 | do |
---|
[116] | 738 | |
---|
[82] | 739 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
| 740 | then |
---|
| 741 | line="$line1" |
---|
| 742 | fi |
---|
[116] | 743 | |
---|
| 744 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 745 | then |
---|
[1289] | 746 | # REMOVE COLONS FROM THE OPTION-STRING, IF THERE ARE ANY |
---|
[116] | 747 | netcdf_inc=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` |
---|
| 748 | fi |
---|
| 749 | |
---|
[215] | 750 | done < $tmp_mbuild |
---|
[82] | 751 | |
---|
| 752 | line="" |
---|
[215] | 753 | grep "$remote_host_string" $config_file | grep "%netcdf_lib" > $tmp_mbuild |
---|
[82] | 754 | while read line1 |
---|
| 755 | do |
---|
[116] | 756 | |
---|
[82] | 757 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
| 758 | then |
---|
| 759 | line="$line1" |
---|
| 760 | fi |
---|
[116] | 761 | |
---|
| 762 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 763 | then |
---|
[1289] | 764 | # REMOVE COLONS FROM THE OPTION-STRING, IF THERE ARE ANY |
---|
[116] | 765 | netcdf_lib=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` |
---|
| 766 | fi |
---|
| 767 | |
---|
[215] | 768 | done < $tmp_mbuild |
---|
[82] | 769 | |
---|
| 770 | |
---|
| 771 | |
---|
[1289] | 772 | # GET FFTW OPTIONS |
---|
[1210] | 773 | line="" |
---|
| 774 | grep "$remote_host_string" $config_file | grep "%fftw_inc" > $tmp_mbuild |
---|
| 775 | while read line1 |
---|
| 776 | do |
---|
| 777 | |
---|
| 778 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
| 779 | then |
---|
| 780 | line="$line1" |
---|
| 781 | fi |
---|
| 782 | |
---|
| 783 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 784 | then |
---|
[1289] | 785 | # REMOVE COLONS FROM THE OPTION-STRING, IF THERE ARE ANY |
---|
[1210] | 786 | fftw_inc=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` |
---|
| 787 | fi |
---|
| 788 | |
---|
| 789 | done < $tmp_mbuild |
---|
| 790 | |
---|
| 791 | line="" |
---|
| 792 | grep "$remote_host_string" $config_file | grep "%fftw_lib" > $tmp_mbuild |
---|
| 793 | while read line1 |
---|
| 794 | do |
---|
| 795 | |
---|
| 796 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
| 797 | then |
---|
| 798 | line="$line1" |
---|
| 799 | fi |
---|
| 800 | |
---|
| 801 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 802 | then |
---|
[1289] | 803 | # REMOVE COLONS FROM THE OPTION-STRING, IF THERE ARE ANY |
---|
[1210] | 804 | fftw_lib=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` |
---|
| 805 | fi |
---|
| 806 | |
---|
| 807 | done < $tmp_mbuild |
---|
| 808 | |
---|
| 809 | |
---|
| 810 | |
---|
[1289] | 811 | # GET MAKE OPTIONS |
---|
[475] | 812 | line="" |
---|
| 813 | found=false |
---|
| 814 | grep "$remote_host_string" $config_file | grep "%mopts" > $tmp_mbuild |
---|
| 815 | while read line1 |
---|
| 816 | do |
---|
| 817 | |
---|
| 818 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
| 819 | then |
---|
| 820 | line="$line1" |
---|
| 821 | fi |
---|
| 822 | |
---|
| 823 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 824 | then |
---|
[1289] | 825 | # REMOVE COLONS FROM THE OPTION-STRING, IF THERE ARE ANY |
---|
[475] | 826 | make_options=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` |
---|
| 827 | |
---|
| 828 | fi |
---|
| 829 | |
---|
| 830 | done < $tmp_mbuild |
---|
| 831 | |
---|
| 832 | |
---|
| 833 | |
---|
[1289] | 834 | # GET COMPILER OPTIONS |
---|
[1] | 835 | line="" |
---|
[116] | 836 | found=false |
---|
[215] | 837 | grep "$remote_host_string" $config_file | grep "%fopts" > $tmp_mbuild |
---|
[69] | 838 | while read line1 |
---|
[1] | 839 | do |
---|
[116] | 840 | |
---|
[1] | 841 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
| 842 | then |
---|
| 843 | line="$line1" |
---|
| 844 | fi |
---|
[116] | 845 | |
---|
| 846 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 847 | then |
---|
[1289] | 848 | # REMOVE COLONS FROM THE OPTION-STRING, IF THERE ARE ANY |
---|
[116] | 849 | compiler_options=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` |
---|
| 850 | found=true |
---|
| 851 | |
---|
[1289] | 852 | # ADD INCLUDE PATHS FOR netCDF AND FFTW |
---|
[1210] | 853 | compiler_options="$compiler_options $netcdf_inc $fftw_inc" |
---|
[116] | 854 | fi |
---|
| 855 | |
---|
[215] | 856 | done < $tmp_mbuild |
---|
[116] | 857 | |
---|
| 858 | if [[ $found = false ]] |
---|
[1] | 859 | then |
---|
| 860 | printf "\n +++ no compiler options found in configuration file" |
---|
| 861 | printf "\n for \"$remote_host_string\" " |
---|
| 862 | locat=config_file; exit |
---|
| 863 | fi |
---|
[82] | 864 | |
---|
[1] | 865 | |
---|
[1289] | 866 | # GET LOGIN INIT COMMANDS |
---|
[892] | 867 | line="" |
---|
| 868 | grep "$remote_host_string" $config_file | grep "%login_init_cmd" > $tmp_mbuild |
---|
| 869 | while read line1 |
---|
| 870 | do |
---|
[1] | 871 | |
---|
[892] | 872 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
| 873 | then |
---|
| 874 | line="$line1" |
---|
| 875 | fi |
---|
| 876 | |
---|
| 877 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 878 | then |
---|
[1289] | 879 | # REMOVE COLONS FROM THE OPTION-STRING, IF THERE ARE ANY |
---|
[892] | 880 | init_cmds=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` |
---|
[1255] | 881 | init_cmds="${init_cmds};" |
---|
[892] | 882 | fi |
---|
| 883 | done < $tmp_mbuild |
---|
| 884 | |
---|
| 885 | |
---|
[1289] | 886 | # GET MODULES TO BE LOADED |
---|
[221] | 887 | line="" |
---|
[493] | 888 | grep "$remote_host_string" $config_file | grep "%modules" > $tmp_mbuild |
---|
[221] | 889 | while read line1 |
---|
| 890 | do |
---|
| 891 | |
---|
| 892 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
| 893 | then |
---|
| 894 | line="$line1" |
---|
| 895 | fi |
---|
| 896 | |
---|
| 897 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 898 | then |
---|
[1289] | 899 | # REMOVE COLONS FROM THE OPTION-STRING, IF THERE ARE ANY |
---|
[493] | 900 | modules=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` |
---|
[221] | 901 | fi |
---|
| 902 | |
---|
| 903 | done < $tmp_mbuild |
---|
| 904 | |
---|
| 905 | |
---|
[1289] | 906 | # GET LINKER OPTIONS |
---|
[1] | 907 | line="" |
---|
[116] | 908 | found=false |
---|
[215] | 909 | grep "$remote_host_string" $config_file | grep "%lopts" > $tmp_mbuild |
---|
[69] | 910 | while read line1 |
---|
[1] | 911 | do |
---|
[116] | 912 | |
---|
[1] | 913 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
| 914 | then |
---|
| 915 | line="$line1" |
---|
| 916 | fi |
---|
[116] | 917 | |
---|
| 918 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 919 | then |
---|
[1289] | 920 | # REMOVE COLONS FROM THE OPTION-STRING, IF THERE ARE ANY |
---|
[116] | 921 | loader_options=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` |
---|
| 922 | found=true |
---|
| 923 | |
---|
[1289] | 924 | # ADD netCDF- AND FFTW-LIBRARY |
---|
[1210] | 925 | loader_options="$loader_options $netcdf_lib $fftw_lib" |
---|
[116] | 926 | fi |
---|
| 927 | |
---|
[215] | 928 | done < $tmp_mbuild |
---|
[1] | 929 | |
---|
[116] | 930 | if [[ $found = false ]] |
---|
[1] | 931 | then |
---|
| 932 | printf "\n +++ no loader options found in configuration file" |
---|
| 933 | printf "\n for \"$remote_host_string\" " |
---|
| 934 | locat=config_file; exit |
---|
| 935 | fi |
---|
[82] | 936 | |
---|
[1] | 937 | |
---|
| 938 | printf "\n\n#------------------------------------------------------------------------# \n" |
---|
| 939 | if [[ $remote_host = $local_host ]] |
---|
| 940 | then |
---|
| 941 | column1="remote_host:"; column2="$remote_host (= local host!)" |
---|
| 942 | else |
---|
| 943 | column1="remote_host:"; column2=$remote_host |
---|
| 944 | fi |
---|
| 945 | printf "| $column1$column2 | \n" |
---|
| 946 | printf "| | \n" |
---|
| 947 | column1="conditions:"; column2="$condition1 $condition2" |
---|
| 948 | printf "| $column1$column2 | \n" |
---|
| 949 | column1="make depository:"; column2=$remote_md |
---|
| 950 | printf "| $column1$column2 | \n" |
---|
[215] | 951 | line=$(echo "$remote_md" | cut -c51-) |
---|
| 952 | while [[ "$line" != "" ]] |
---|
| 953 | do |
---|
| 954 | column1="" |
---|
| 955 | column2=$line |
---|
| 956 | printf "| $column1$column2 | \n" |
---|
| 957 | line=$(echo "$line" | cut -c51-) |
---|
| 958 | done |
---|
[25] | 959 | if [[ $compile_utility_programs = true ]] |
---|
| 960 | then |
---|
| 961 | column1="utility directory:"; column2=$remote_ud |
---|
| 962 | printf "| $column1$column2 | \n" |
---|
| 963 | fi |
---|
[1] | 964 | column1="username:"; column2=$remote_username |
---|
| 965 | printf "| $column1$column2 | \n" |
---|
| 966 | column1="addres:"; column2=$remote_addres |
---|
| 967 | printf "| $column1$column2 | \n" |
---|
| 968 | column1="compiler:"; column2=$compiler_name |
---|
| 969 | printf "| $column1$column2 | \n" |
---|
[28] | 970 | if [[ $compile_utility_programs = true ]] |
---|
| 971 | then |
---|
| 972 | column1="serial compiler:"; column2=$compiler_name_ser |
---|
| 973 | printf "| $column1$column2 | \n" |
---|
| 974 | fi |
---|
[475] | 975 | if [[ "$make_options" != "" ]] |
---|
| 976 | then |
---|
| 977 | column1="make options:"; column2=$make_options |
---|
| 978 | printf "| $column1$column2 | \n" |
---|
| 979 | fi |
---|
[1] | 980 | column1="cpp options:"; column2=$cpp_options |
---|
| 981 | printf "| $column1$column2 | \n" |
---|
| 982 | line=$(echo "$cpp_options" | cut -c51-) |
---|
| 983 | while [[ "$line" != "" ]] |
---|
| 984 | do |
---|
| 985 | column1="" |
---|
| 986 | column2=$line |
---|
| 987 | printf "| $column1$column2 | \n" |
---|
| 988 | line=$(echo "$line" | cut -c51-) |
---|
| 989 | done |
---|
| 990 | column1="compiler options:"; column2=$compiler_options |
---|
| 991 | printf "| $column1$column2 | \n" |
---|
| 992 | line=$(echo "$compiler_options" | cut -c51-) |
---|
| 993 | while [[ "$line" != "" ]] |
---|
| 994 | do |
---|
| 995 | column1="" |
---|
| 996 | column2=$line |
---|
| 997 | printf "| $column1$column2 | \n" |
---|
| 998 | line=$(echo "$line" | cut -c51-) |
---|
| 999 | done |
---|
| 1000 | column1="loader options:"; column2=$loader_options |
---|
| 1001 | printf "| $column1$column2 | \n" |
---|
| 1002 | line=$(echo "$loader_options" | cut -c51-) |
---|
| 1003 | while [[ "$line" != "" ]] |
---|
| 1004 | do |
---|
| 1005 | column1="" |
---|
| 1006 | column2=$line |
---|
| 1007 | printf "| $column1$column2 | \n" |
---|
| 1008 | line=$(echo "$line" | cut -c51-) |
---|
| 1009 | done |
---|
[493] | 1010 | if [[ $modules != "" ]] |
---|
| 1011 | then |
---|
| 1012 | column1="modules to be load:"; column2=$modules |
---|
| 1013 | printf "| $column1$column2 | \n" |
---|
| 1014 | line=$(echo "$modules" | cut -c51-) |
---|
| 1015 | while [[ "$line" != "" ]] |
---|
| 1016 | do |
---|
| 1017 | column1="" |
---|
| 1018 | column2=$line |
---|
| 1019 | printf "| $column1$column2 | \n" |
---|
| 1020 | line=$(echo "$line" | cut -c51-) |
---|
| 1021 | done |
---|
| 1022 | fi |
---|
[1] | 1023 | printf "#------------------------------------------------------------------------# \n" |
---|
| 1024 | |
---|
| 1025 | if [[ $silent = false ]] |
---|
| 1026 | then |
---|
| 1027 | answer=dummy |
---|
| 1028 | printf "\n\n" |
---|
| 1029 | while [[ "$answer" != y && "$answer" != Y && "$answer" != c && "$answer" != C && "$answer" != s && "$answer" != S && "$answer" != a && "$answer" != A ]] |
---|
| 1030 | do |
---|
| 1031 | printf " >>> continue (y(es)/c(ontinue)/a(bort)/s(skip)) ? " |
---|
| 1032 | read answer |
---|
| 1033 | done |
---|
| 1034 | if [[ $answer = a || $answer = A ]] |
---|
| 1035 | then |
---|
| 1036 | locat=user_abort; exit |
---|
| 1037 | fi |
---|
| 1038 | if [[ $answer = c || $answer = C ]] |
---|
| 1039 | then |
---|
[503] | 1040 | silent=true |
---|
[1] | 1041 | fi |
---|
| 1042 | if [[ $answer = s || $answer = S ]] |
---|
| 1043 | then |
---|
| 1044 | continue |
---|
| 1045 | fi |
---|
| 1046 | fi |
---|
| 1047 | |
---|
| 1048 | |
---|
[1289] | 1049 | # MAKE ON REMOTE HOST |
---|
[475] | 1050 | if [[ $remote_host != $local_host ]] |
---|
[1] | 1051 | then |
---|
[475] | 1052 | if [[ $compile_utility_programs = false ]] |
---|
[1] | 1053 | then |
---|
| 1054 | |
---|
[1289] | 1055 | # COPY CURRENT SOURCE CODE TO SOURCE-CODE DIRECTORY ON THE REMOTE HOST |
---|
| 1056 | # CREATE THIS DIRECTORY, IF IT DOES NOT EXIST |
---|
[475] | 1057 | echo " *** copying \"${mainprog}_sources.tar\" to \"${remote_addres}:${remote_md}/\" " |
---|
| 1058 | if [[ $remote_host != lctit ]] |
---|
| 1059 | then |
---|
| 1060 | ssh ${remote_username}@${remote_addres} "[[ ! -d ${remote_md} ]] && (echo \" *** ${remote_md} will be created\"; mkdir -p ${remote_md})" |
---|
| 1061 | else |
---|
[1289] | 1062 | # USING PIPE, BECAUSE TIT ALLOWS SSH TO EXECUTE ONLY SOME SELECTED COMMANDS |
---|
[475] | 1063 | print "[[ ! -d ${remote_md} ]] && (echo \" *** ${remote_md} will be created\"; mkdir -p ${remote_md})" | ssh ${remote_username}@${remote_addres} 2>&1 |
---|
| 1064 | fi |
---|
[1] | 1065 | |
---|
[1096] | 1066 | scp ${local_source_path}/${mainprog}_sources.tar ${remote_username}@${remote_addres}:${remote_md}/${mainprog}_sources.tar |
---|
[1] | 1067 | |
---|
| 1068 | |
---|
[1096] | 1069 | |
---|
[1289] | 1070 | # UNTAR PREVIOUS UPDATE ON REMOTE HOST, IF EXISTING |
---|
[475] | 1071 | echo " *** untar previous update on remote host, if existing" |
---|
| 1072 | if [[ $remote_host != lctit ]] |
---|
| 1073 | then |
---|
| 1074 | ssh ${remote_username}@${remote_addres} "cd ${remote_md}; [[ -f ${mainprog}_current_version.tar ]] && tar -xf ${mainprog}_current_version.tar" |
---|
| 1075 | else |
---|
[1289] | 1076 | # USING PIPE, BECAUSE TIT ALLOWS SSH TO EXECUTE ONLY SOME SELECTED COMMANDS |
---|
[475] | 1077 | print "cd ${remote_md}; [[ -f ${mainprog}_current_version.tar ]] && tar -xf ${mainprog}_current_version.tar" | ssh ${remote_username}@${remote_addres} 2>&1 |
---|
| 1078 | fi |
---|
[1] | 1079 | |
---|
| 1080 | |
---|
[1289] | 1081 | # UNTAR CURRENT SOURCES ON REMOTE HOST |
---|
| 1082 | echo " *** untar current sources on remote host" |
---|
[475] | 1083 | if [[ $remote_host != lctit ]] |
---|
| 1084 | then |
---|
| 1085 | ssh ${remote_username}@${remote_addres} "cd ${remote_md}; tar -xf ${mainprog}_sources.tar" |
---|
| 1086 | else |
---|
[1289] | 1087 | # USING PIPE, BECAUSE TIT ALLOWS SSH TO EXECUTE ONLY SOME SELECTED COMMANDS |
---|
[475] | 1088 | print "cd ${remote_md}; tar -xf ${mainprog}_sources.tar" | ssh ${remote_username}@${remote_addres} 2>&1 |
---|
| 1089 | fi |
---|
[1] | 1090 | |
---|
| 1091 | |
---|
[1289] | 1092 | # EXECUTE MAKE WITH THOSE OPTIONS DETERMINED ABOVE |
---|
| 1093 | # COMMANDS WILL BE COMMUNICATED TO SSH VIA PIPE, SINCE THIS WAY THE SYSTEM- AND |
---|
| 1094 | # USER-PROFILES OF THE SHELL ARE COMPLETELY EXECUTED (OTHERWISE, MAKE |
---|
| 1095 | # WILL E.G. MISS THE COMPILER-PATHS) |
---|
[475] | 1096 | echo " *** execute \"make\" on remote host" |
---|
[1] | 1097 | |
---|
[493] | 1098 | |
---|
[1289] | 1099 | # GENERATE MAKE CALL WITH MAKE OPTIONS |
---|
[475] | 1100 | if [[ $remote_host = nech ]] |
---|
| 1101 | then |
---|
| 1102 | make_call_string="sxmake $make_options PROG=$mainprog F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$compiler_options\" LDFLAGS=\"$loader_options\" " |
---|
| 1103 | else |
---|
| 1104 | make_call_string="make $make_options PROG=$mainprog F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$compiler_options\" LDFLAGS=\"$loader_options\" " |
---|
| 1105 | fi |
---|
[1] | 1106 | |
---|
[1289] | 1107 | # GENERATE COMMAND TO LOAD MODULES, IF MODULES ARE GIVEN |
---|
[493] | 1108 | if [[ "$modules" != "" ]] |
---|
| 1109 | then |
---|
[678] | 1110 | if [[ $remote_host = lctit ]] |
---|
| 1111 | then |
---|
| 1112 | module_calls=". $modules" |
---|
| 1113 | else |
---|
| 1114 | module_calls="module load ${modules};" |
---|
| 1115 | fi |
---|
[503] | 1116 | else |
---|
| 1117 | module_calls="" |
---|
[493] | 1118 | fi |
---|
| 1119 | |
---|
[1289] | 1120 | if [[ $remote_host = ibmkisti || $remote_host = ibms ]] |
---|
[475] | 1121 | then |
---|
[1] | 1122 | |
---|
[892] | 1123 | ssh ${remote_username}@${remote_addres} "$init_cmds $module_calls cd ${remote_md}; echo '$make_call_string' > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" 2>&1 | tee ${remote_host}_last_make_protokoll |
---|
[1] | 1124 | |
---|
[475] | 1125 | elif [[ $remote_host = ibmh ]] |
---|
| 1126 | then |
---|
[1] | 1127 | |
---|
[892] | 1128 | print "$init_cmds $module_calls export OBJECT_MODE=64; cd ${remote_md}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll |
---|
[1] | 1129 | |
---|
[475] | 1130 | elif [[ $remote_host = lctit ]] |
---|
| 1131 | then |
---|
[1] | 1132 | |
---|
[475] | 1133 | echo " " > ${remote_host}_last_make_protokoll |
---|
| 1134 | while [[ $(cat ${remote_host}_last_make_protokoll | grep -c "Forwarding to N1GE") = 0 ]] |
---|
| 1135 | do |
---|
| 1136 | print "cd ${remote_md}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll |
---|
| 1137 | done |
---|
[1] | 1138 | |
---|
[892] | 1139 | elif [[ $remote_host = lcxe6 ]] |
---|
[1] | 1140 | then |
---|
| 1141 | |
---|
[892] | 1142 | ssh ${remote_username}@${remote_addres} "$init_cmds $module_calls cd ${remote_md}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" 2>&1 | tee ${remote_host}_last_make_protokoll |
---|
[1] | 1143 | |
---|
[475] | 1144 | else |
---|
[1] | 1145 | |
---|
[892] | 1146 | print "$init_cmds $module_calls cd ${remote_md}; echo $make_call_string > LAST_MAKE_CALL; chmod u+x LAST_MAKE_CALL; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll |
---|
[1] | 1147 | |
---|
[475] | 1148 | fi |
---|
[1] | 1149 | |
---|
[475] | 1150 | if [[ $(grep -c MAKE_ERROR ${remote_host}_last_make_protokoll) != 0 ]] |
---|
| 1151 | then |
---|
| 1152 | printf "\a\n +++ error(s) occurred during compiling or linking on host \"$remote_host\" " |
---|
| 1153 | if [[ $silent = false ]] |
---|
[40] | 1154 | then |
---|
[475] | 1155 | answer=dummy |
---|
| 1156 | printf "\n" |
---|
| 1157 | while [[ "$answer" != c && "$answer" != k ]] |
---|
[40] | 1158 | do |
---|
[475] | 1159 | printf " >>> continue / list errors / kill mbuild (c/l/k) ? " |
---|
| 1160 | read answer |
---|
| 1161 | if [[ "$answer" = l ]] |
---|
| 1162 | then |
---|
| 1163 | more ${remote_host}_last_make_protokoll |
---|
| 1164 | fi |
---|
[40] | 1165 | done |
---|
[475] | 1166 | if [[ $answer = k ]] |
---|
[40] | 1167 | then |
---|
[475] | 1168 | locat=user_abort; exit |
---|
[1] | 1169 | fi |
---|
| 1170 | fi |
---|
[475] | 1171 | fi |
---|
[1] | 1172 | |
---|
| 1173 | |
---|
| 1174 | |
---|
[1289] | 1175 | # TAR UPDATED VERSION ON THE REMOTE HOST |
---|
[475] | 1176 | printf "\n *** tar update on remote host ..." |
---|
| 1177 | if [[ $remote_host != lctit ]] |
---|
| 1178 | then |
---|
| 1179 | ssh ${remote_username}@${remote_addres} "cd ${remote_md}; chmod u+w *; tar -cf ${mainprog}_current_version.tar ${mainprog} *.f90 *.o *.mod" |
---|
| 1180 | else |
---|
[1289] | 1181 | # USING PIPE, BECAUSE TIT ALLOWS SSH TO EXECUTE ONLY SOME SELECTED COMMANDS |
---|
[475] | 1182 | print "cd ${remote_md}; chmod u+w *; tar -cf ${mainprog}_current_version.tar ${mainprog} *.f90 *.o *.mod" | ssh ${remote_username}@${remote_addres} 2>&1 |
---|
| 1183 | fi |
---|
[1] | 1184 | |
---|
| 1185 | |
---|
| 1186 | |
---|
[1289] | 1187 | # DO THE SAME THINGS FOR THE UTILITY-ROUTINES: |
---|
| 1188 | # COPY CURRENT SOURCE CODE TO SOURCE-CODE DIRECTORY ON THE REMOTE HOST |
---|
| 1189 | # CREATE THIS DIRECTORY, IF IT DOES NOT EXIST |
---|
[475] | 1190 | elif [[ $compile_utility_programs = true ]] |
---|
| 1191 | then |
---|
| 1192 | |
---|
| 1193 | printf "\n\n" |
---|
| 1194 | echo " *** copying scripts and utility programs to \"${remote_addres}:${remote_ud}/\" " |
---|
| 1195 | cd ${local_source_path}/../SCRIPTS |
---|
| 1196 | |
---|
| 1197 | if [[ $remote_host != lctit ]] |
---|
[22] | 1198 | then |
---|
[475] | 1199 | ssh ${remote_username}@${remote_addres} "[[ ! -d ${remote_ud} ]] && (echo \" *** ${remote_ud} will be created\"; mkdir -p ${remote_ud}); [[ ! -d ${remote_ud}/../SCRIPTS ]] && (echo \" *** ${remote_ud}/../SCRIPTS will be created\"; mkdir -p ${remote_ud}/../SCRIPTS)" |
---|
| 1200 | else |
---|
[1289] | 1201 | # USING PIPE, BECAUSE TIT ALLOWS SSH TO EXECUTE ONLY SOME SELECTED COMMANDS |
---|
[475] | 1202 | print "[[ ! -d ${remote_ud} ]] && (echo \" *** ${remote_ud} will be created\"; mkdir -p ${remote_ud}); [[ ! -d ${remote_ud}/../SCRIPTS ]] && (echo \" *** ${remote_ud}/../SCRIPTS will be created\"; mkdir -p ${remote_ud}/../SCRIPTS)" | ssh ${remote_username}@${remote_addres} 2>&1 |
---|
| 1203 | fi |
---|
[22] | 1204 | |
---|
[1289] | 1205 | # COPY SHELL-SCRIPTS |
---|
[1096] | 1206 | scp batch_scp mbuild mrun process_dvr_output .dvrserver.config subjob batch_nc2vdf nc2vdf nc2vdf.ncl nc2vdf.config ${remote_username}@${remote_addres}:${remote_ud}/../SCRIPTS > /dev/null |
---|
[22] | 1207 | |
---|
[475] | 1208 | cd - > /dev/null |
---|
| 1209 | cd ${local_source_path}/../UTIL |
---|
[22] | 1210 | |
---|
[27] | 1211 | |
---|
[1289] | 1212 | # COPY UTILITY-ROUTINES |
---|
[1096] | 1213 | scp Makefile *.f90 ${remote_username}@${remote_addres}:${remote_ud} > /dev/null |
---|
[27] | 1214 | |
---|
| 1215 | |
---|
[22] | 1216 | |
---|
[1289] | 1217 | # EXECUTE MAKE WITH THOSE OPTIONS DETERMINED ABOVE |
---|
| 1218 | # COMMANDS WILL BE COMMUNICATED TO SSH VIA PIPE, SINCE THIS WAY THE SYSTEM- AND |
---|
| 1219 | # USER-PROFILES OF THE SHELL ARE COMPLETELY EXECUTED (OTHERWISE, MAKE |
---|
| 1220 | # WILL E.G. MISS THE COMPILER-PATHS) |
---|
[475] | 1221 | echo " *** execute \"make\" on remote host" |
---|
[22] | 1222 | |
---|
[475] | 1223 | if [[ $remote_host = nech ]] |
---|
| 1224 | then |
---|
[503] | 1225 | make_call_string="sxmake $make_options BLOCK=$block F90=$compiler_name F90_SER=$compiler_name_ser COPT=\"$cpp_options\" F90FLAGS=\"$compiler_options\" LDFLAGS=\"$loader_options\" " |
---|
[475] | 1226 | else |
---|
[503] | 1227 | make_call_string="make $make_options BLOCK=$block F90=$compiler_name F90_SER=$compiler_name_ser COPT=\"$cpp_options\" F90FLAGS=\"$compiler_options\" LDFLAGS=\"$loader_options\" " |
---|
[475] | 1228 | fi |
---|
[22] | 1229 | |
---|
[1289] | 1230 | # GENERATE COMMAND TO LOAD MODULES, IF MODULES ARE GIVEN |
---|
[493] | 1231 | if [[ "$modules" != "" ]] |
---|
| 1232 | then |
---|
[678] | 1233 | if [[ $remote_host = lctit ]] |
---|
| 1234 | then |
---|
| 1235 | module_calls=". $modules" |
---|
| 1236 | else |
---|
| 1237 | module_calls="module load ${modules};" |
---|
| 1238 | fi |
---|
[503] | 1239 | else |
---|
| 1240 | module_calls="" |
---|
[493] | 1241 | fi |
---|
| 1242 | |
---|
[892] | 1243 | |
---|
[1289] | 1244 | if [[ $remote_host = ibms ]] |
---|
[475] | 1245 | then |
---|
[22] | 1246 | |
---|
[892] | 1247 | ssh ${remote_username}@${remote_addres} "$init_cmds $module_calls cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" |
---|
[22] | 1248 | |
---|
[475] | 1249 | elif [[ $remote_host = ibmh ]] |
---|
| 1250 | then |
---|
[22] | 1251 | |
---|
[892] | 1252 | print "$init_cmds $module_calls export OBJECT_MODE=64; cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh ${remote_username}@${remote_addres} |
---|
[22] | 1253 | |
---|
[475] | 1254 | elif [[ $remote_host = lctit ]] |
---|
| 1255 | then |
---|
[22] | 1256 | |
---|
[475] | 1257 | echo " " > ${remote_host}_last_make_protokoll |
---|
| 1258 | while [[ $(cat ${remote_host}_last_make_protokoll | grep -c "Forwarding to N1GE") = 0 ]] |
---|
| 1259 | do |
---|
[892] | 1260 | print "$init_cmds $module_calls cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll |
---|
[475] | 1261 | done |
---|
[22] | 1262 | |
---|
[892] | 1263 | elif [[ $remote_host = lcxe6 ]] |
---|
[475] | 1264 | then |
---|
[22] | 1265 | |
---|
[892] | 1266 | ssh ${remote_username}@${remote_addres} "$init_cmds $module_calls cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" 2>&1 | tee ${remote_host}_last_make_protokoll |
---|
[22] | 1267 | |
---|
[475] | 1268 | else |
---|
[407] | 1269 | |
---|
[892] | 1270 | print "$init_cmds $module_calls cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll |
---|
[407] | 1271 | |
---|
[475] | 1272 | fi |
---|
[22] | 1273 | |
---|
[1289] | 1274 | fi # END OF COMPILING UTILITY-ROUTINES |
---|
[22] | 1275 | |
---|
[475] | 1276 | rm -rf ${remote_host}_last_make_protokoll |
---|
[22] | 1277 | |
---|
[1289] | 1278 | # MAKE ON LOCAL HOST |
---|
[475] | 1279 | else |
---|
[22] | 1280 | |
---|
[1289] | 1281 | # INIT WORKAROUND FOR lcxe6 |
---|
[1274] | 1282 | if [[ $remote_host = lcxe6 || $remote_host = lccrayb || $remote_host = lccrayf || $remote_host = lccrayh ]] |
---|
[544] | 1283 | then |
---|
[920] | 1284 | |
---|
[1197] | 1285 | eval $init_cmds > /dev/null 2>&1 |
---|
[920] | 1286 | |
---|
[544] | 1287 | fi |
---|
| 1288 | |
---|
[1289] | 1289 | # FIRST LOAD MODULES, IF GIVEN |
---|
[544] | 1290 | if [[ "$modules" != "" ]] |
---|
| 1291 | then |
---|
[678] | 1292 | if [[ $remote_host = lctit ]] |
---|
| 1293 | then |
---|
| 1294 | . $modules |
---|
[1099] | 1295 | elif [[ $remote_host = lcflow ]] |
---|
| 1296 | then |
---|
| 1297 | eval `$MODULESHOME/bin/modulecmd ksh load ${modules}` |
---|
[678] | 1298 | else |
---|
[1390] | 1299 | eval init_cmds=$init_cmds |
---|
[678] | 1300 | module load ${modules} |
---|
| 1301 | fi |
---|
[544] | 1302 | fi |
---|
| 1303 | |
---|
| 1304 | |
---|
[475] | 1305 | if [[ $compile_utility_programs = false ]] |
---|
| 1306 | then |
---|
[22] | 1307 | |
---|
[1289] | 1308 | # CREATE MAKE-DEPOSITORY, IF IT DOES NOT EXIST |
---|
[475] | 1309 | eval remote_md=$remote_md |
---|
| 1310 | if [[ ! -d $remote_md ]] |
---|
[40] | 1311 | then |
---|
[475] | 1312 | if mkdir $remote_md |
---|
[215] | 1313 | then |
---|
[475] | 1314 | printf "\n\n *** directory for make depository:" |
---|
| 1315 | printf "\n $remote_md" |
---|
| 1316 | printf "\n was created\n" |
---|
| 1317 | else |
---|
| 1318 | printf "\n +++ directory for make depository:" |
---|
| 1319 | printf "\n $remote_md" |
---|
| 1320 | printf "\n cannot be created" |
---|
| 1321 | locat=local_depository_path; exit |
---|
[215] | 1322 | fi |
---|
[475] | 1323 | fi |
---|
[215] | 1324 | |
---|
[1289] | 1325 | # COPY SOURCE-CODE FROM REPOSITORY TO MAKE-DEPOSITORY |
---|
[475] | 1326 | echo " " |
---|
| 1327 | echo " *** updating sources in $remote_md" |
---|
| 1328 | cd $remote_md |
---|
| 1329 | cp $local_source_path/${mainprog}_sources.tar . |
---|
| 1330 | tar xf ${mainprog}_sources.tar |
---|
[215] | 1331 | |
---|
[1289] | 1332 | # CALL MAKE ON LOCAL HOST USING THE OPTIONS DETERMINED FURTHER ABOVE |
---|
[475] | 1333 | echo " " |
---|
| 1334 | echo " *** execute \"make\" on local host" |
---|
[1] | 1335 | |
---|
[475] | 1336 | make $make_options PROG=$mainprog F90=$compiler_name COPT="$cpp_options" F90FLAGS="$compiler_options" LDFLAGS="$loader_options" 2>&1 | tee ${remote_host}_last_make_protokoll |
---|
[40] | 1337 | |
---|
[475] | 1338 | if [[ $? != 0 ]] |
---|
| 1339 | then |
---|
| 1340 | printf "\a\n +++ error(s) occurred during compiling or linking on host \"$remote_host\" " |
---|
| 1341 | if [[ $silent = false ]] |
---|
[1] | 1342 | then |
---|
[475] | 1343 | answer=dummy |
---|
| 1344 | printf "\n" |
---|
| 1345 | while [[ "$answer" != c && "$answer" != k ]] |
---|
| 1346 | do |
---|
| 1347 | printf " >>> continue / list errors / kill mbuild (c/l/k) ? " |
---|
| 1348 | read answer |
---|
| 1349 | if [[ "$answer" = l ]] |
---|
[1] | 1350 | then |
---|
[475] | 1351 | more ${remote_host}_last_make_protokoll |
---|
[1] | 1352 | fi |
---|
[475] | 1353 | done |
---|
| 1354 | if [[ $answer = k ]] |
---|
| 1355 | then |
---|
| 1356 | locat=user_abort; exit |
---|
[1] | 1357 | fi |
---|
| 1358 | fi |
---|
[475] | 1359 | fi |
---|
[1] | 1360 | |
---|
| 1361 | |
---|
[503] | 1362 | # TAR NEW VERSION ON LOCAL HOST |
---|
[475] | 1363 | printf "\n *** tar update on local host ..." |
---|
| 1364 | tar -cf ${mainprog}_current_version.tar *.$suf *.o *.mod |
---|
[1] | 1365 | |
---|
[22] | 1366 | |
---|
[475] | 1367 | # COMPILE THE UTILITY PROGRAMS |
---|
| 1368 | elif [[ $compile_utility_programs = true ]] |
---|
| 1369 | then |
---|
| 1370 | printf "\n\n" |
---|
| 1371 | echo " *** compiling the utility programs ..." |
---|
| 1372 | cd ${local_source_path}/../UTIL |
---|
[503] | 1373 | |
---|
| 1374 | # TOUCH FILES IN ORDER TO FORCE COMPILATION FOR EVERY BLOCK |
---|
| 1375 | touch *.f90 |
---|
[1390] | 1376 | eval init_cmds=$init_cmds |
---|
[503] | 1377 | make $make_options BLOCK=$block F90=$compiler_name F90_SER=$compiler_name_ser COPT="$cpp_options" F90FLAGS="$compiler_options" LDFLAGS="$loader_options" |
---|
[793] | 1378 | |
---|
[807] | 1379 | # CHECK IF QMAKE IS AVAILABLE AND COMPILE MRUNGUI |
---|
[811] | 1380 | if [[ $util_compiled_localhost == false ]] |
---|
| 1381 | then |
---|
| 1382 | printf "\n\n" |
---|
| 1383 | echo " *** compiling the mrun GUI" |
---|
| 1384 | if which qmake >/dev/null; then |
---|
| 1385 | cd mrungui |
---|
| 1386 | touch * |
---|
| 1387 | qmake |
---|
| 1388 | make |
---|
| 1389 | make clean |
---|
| 1390 | rm Makefile |
---|
| 1391 | cd .. |
---|
| 1392 | else |
---|
| 1393 | echo " +++ no qmake found. The (optional) GUI will not be compiled." |
---|
| 1394 | fi |
---|
[793] | 1395 | |
---|
[1390] | 1396 | # # COMPILE CHECK_NAMELIST_FILES (ONLY FOR ONE BRANCH on LOCALHOST NEEDED) |
---|
| 1397 | # printf "\n\n" |
---|
| 1398 | # echo " *** compiling check_namelist_files ..." |
---|
| 1399 | # |
---|
| 1400 | # # GET CHECK OPTIONS |
---|
| 1401 | # line="" |
---|
| 1402 | # found=false |
---|
| 1403 | # grep "$remote_host_string" $config_file | grep "%cpp_options" > $tmp_mbuild |
---|
| 1404 | # while read line1 |
---|
| 1405 | # do |
---|
| 1406 | # |
---|
| 1407 | # if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
| 1408 | # then |
---|
| 1409 | # line="$line1" |
---|
| 1410 | # fi |
---|
| 1411 | # |
---|
| 1412 | # if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 1413 | # then |
---|
| 1414 | # # REMOVE COLONS FROM THE OPTION-STRING, IF THERE ARE ANY |
---|
| 1415 | # line="$line " |
---|
| 1416 | # copts_check=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g' | sed 's/-D[^ ]* //g' | sed 's/ -D.*//g'` |
---|
| 1417 | # found=true |
---|
| 1418 | # fi |
---|
| 1419 | # |
---|
| 1420 | # done < $tmp_mbuild |
---|
| 1421 | # copts_check="$copts_check -D__check -D__parallel" |
---|
| 1422 | # |
---|
| 1423 | # check_depository_path=${local_source_path}/../UTIL |
---|
| 1424 | # cd $check_depository_path |
---|
| 1425 | # mkdir check_tmp |
---|
| 1426 | # cp ${local_source_path}/${mainprog}_sources_check.tar ./check_tmp |
---|
| 1427 | # cd check_tmp |
---|
| 1428 | # tar -xf ${mainprog}_sources_check.tar |
---|
| 1429 | # rm -rf ${mainprog}_sources_check.tar |
---|
| 1430 | # make -f Makefile_check $make_options F90=$compiler_name_ser COPT="$copts_check" F90FLAGS="$compiler_options" |
---|
| 1431 | # tar -cf check_namelist_files.tar Makefile_check check_namelist_files.x *.f90 *.o *.mod |
---|
| 1432 | # mv check_namelist_files.tar $check_depository_path |
---|
| 1433 | # mv check_namelist_files.x $PALM_BIN |
---|
| 1434 | # cd $check_depository_path |
---|
| 1435 | # rm -rf check_tmp |
---|
| 1436 | # util_compiled_localhost=true |
---|
[811] | 1437 | else |
---|
| 1438 | cd $check_depository_path |
---|
| 1439 | printf "\n\n" |
---|
[818] | 1440 | echo " *** skipped compilation of mrun GUI." |
---|
[811] | 1441 | printf "\n\n" |
---|
[1390] | 1442 | echo " *** skipped compilation of check_namelist_files (currently not available)." |
---|
[811] | 1443 | fi |
---|
| 1444 | |
---|
[1] | 1445 | fi |
---|
| 1446 | fi |
---|
| 1447 | done |
---|
| 1448 | |
---|
| 1449 | |
---|
| 1450 | if [[ $host_found = false ]] |
---|
| 1451 | then |
---|
| 1452 | if [[ $host = all ]] |
---|
| 1453 | then |
---|
| 1454 | printf "\n +++ no hosts found in configuration file" |
---|
| 1455 | else |
---|
| 1456 | printf "\n +++ host \"$host\" not found in configuration file" |
---|
| 1457 | fi |
---|
| 1458 | locat=config_file; exit |
---|
| 1459 | fi |
---|
| 1460 | |
---|
[936] | 1461 | if [[ "$block_conditions" != none && $block_conditions_found = false ]] |
---|
| 1462 | then |
---|
| 1463 | printf "\n +++ block conditions \"$block_conditions\" not found for host \"$host\"" |
---|
| 1464 | fi |
---|
[1] | 1465 | |
---|
| 1466 | |
---|
[503] | 1467 | # FINAL WORK |
---|
[1] | 1468 | rm -f hosts_found_in_config_file |
---|
[811] | 1469 | rm -f ${local_source_path}/${mainprog}_sources_check.tar |
---|