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