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