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