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