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