[1] | 1 | #!/bin/ksh |
---|
[66] | 2 | # mbuild - Programmuebersetzungsscript |
---|
[169] | 3 | # $Id: mbuild 181 2008-07-30 07:07:47Z raasch $ |
---|
[1] | 4 | |
---|
| 5 | # Prozedur zur Uebersetzung von Programmteilen mittels make-Mechanismus |
---|
| 6 | # auf einem Remote-Rechner, ausgehend von Quellcode auf einem lokalen |
---|
| 7 | # Rechner |
---|
| 8 | |
---|
| 9 | # Folgende Probleme existieren unter Linux, wenn keine AT&T-Korn-Shell |
---|
| 10 | # verwendet wird: |
---|
| 11 | # Wertzuweisungen an Variablen innerhalb von DO-Schleifen werden nicht |
---|
| 12 | # nach aussen weitergegeben. "while read line" funktioniert nicht |
---|
| 13 | # innerhalb einer Pipe. |
---|
| 14 | |
---|
| 15 | # letzte Aenderung: |
---|
| 16 | # 06/05/02 - Siggi - Beginn der Entwicklung |
---|
| 17 | # 12/06/02 - Siggi - Abschluss der Entwicklungsarbeiten |
---|
| 18 | # 23/06/02 - Siggi - voerst kein make-clean, Abbruch bei batch-mode |
---|
| 19 | # 24/07/02 - Siggi - Keine Verwendung der temporaeren Datei tmp_mbuild |
---|
| 20 | # unter linux mehr noetig, da nun AT&T-Korn-Shell |
---|
| 21 | # benutzt wird |
---|
| 22 | # 12/09/02 - Siggi - ibmh (hanni.hlrn.de) validiert |
---|
| 23 | # 19/12/02 - Siggi - ibmb validiert |
---|
| 24 | # 05/02/03 - Siggi - hostname nobela included |
---|
| 25 | # 04/03/03 - Siggi - host nech included |
---|
| 26 | # 06/03/03 - Siggi - make_call_string is echoed without '' to |
---|
| 27 | # file LAST_MAKE_CALL (otherwise error on NEC, because |
---|
| 28 | # '' are part of compiler options |
---|
| 29 | # 16/03/03 - Siggi - Two underscores are placed in front of every define |
---|
| 30 | # string, in case that palm.f90 version contains |
---|
| 31 | # such strings |
---|
| 32 | # 16/04/03 - Siggi - First extensions for linux machines |
---|
| 33 | # 24/06/03 - Siggi - host orkan included |
---|
| 34 | # 17/07/03 - Siggi - IP adress set to new "cross" machine at DKRZ |
---|
| 35 | # 24/07/03 - Siggi - host maestro admitted |
---|
| 36 | # 06/08/03 - Siggi - host gregale admitted |
---|
| 37 | # 05/11/03 - Siggi - hosts irifi and quanero are now belonging to lcmuk |
---|
| 38 | # 19/11/03 - Heiko - on lcmuk, mbuild does not tar the *.i files |
---|
| 39 | # 08/01/04 - Siggi - additional preprocessor directive for ibm included |
---|
| 40 | # (-D$OMP=OMP) in order to avoid problems with |
---|
| 41 | # OMP_NUM_THREADS |
---|
| 42 | # 09/01/04 - Siggi - action above cancelled |
---|
| 43 | # 28/01/04 - Siggi - action above re-cancelled |
---|
| 44 | # 08/03/04 - Siggi - host scirocco admitted |
---|
| 45 | # 26/03/04 - Siggi - .o and .mod files are also deleted in depository, if |
---|
| 46 | # the respective .f90 file is not listed in the makefile |
---|
| 47 | # and deletion is demanded by the user |
---|
| 48 | # 12/04/04 - Siggi - scp2 instead of scp used for transfer from decalpha |
---|
| 49 | # due to error in ssh installation (otherwise a prompt |
---|
| 50 | # for the password appears) |
---|
| 51 | # 23/07/04 - Siggi - changes due to the new berni configuration |
---|
| 52 | # (federation switch) |
---|
| 53 | # 08/09/04 - Siggi - hanni IP address changed to 130.75.4.10 |
---|
| 54 | # 23/09/04 - Joerg - correction of IP-Address for 'cross' (DKRZ) |
---|
| 55 | # 09/03/05 - Siggi - on nech, mbuild does not tar the *.i files |
---|
| 56 | # 31/03/05 - Siggi - mbuild does not tar *.i files any more |
---|
| 57 | # 24/04/05 - Siggi - netcdf support on lcmuk |
---|
| 58 | # 25/04/05 - Siggi - netcdf support on gfdl3 (decalpha) |
---|
| 59 | # 12/05/05 - Siggi - netcdf support on ibm |
---|
| 60 | # set OBJECT_MODE=64 for compiling on ibmb, ibmh |
---|
| 61 | # 18/05/05 - Siggi - netcdf support on nec |
---|
| 62 | # 19/05/05 - Siggi - IP addres 134.75.155.74 changed to 165.132.26.56 |
---|
| 63 | # 23/05/05 - Siggi - netcdf support on ibms |
---|
| 64 | # 01/06/05 - Siggi - reset of cpp_options to "" on lcmuk |
---|
| 65 | # 30/06/05 - Siggi - netcdf support on bora |
---|
| 66 | # 20/10/05 - Siggi - update of netcdf-version on decalpha (gfdl3) |
---|
| 67 | # 04/11/05 - Siggi - netcdf 3.6.0-p1 on ibmh/ibmb |
---|
| 68 | # 30/12/05 - Siggi - change of IP adresses in subnet 130.75.105 |
---|
| 69 | # host gfdl5 (ibmy) admitted |
---|
| 70 | # 10/01/06 - Siggi - cpp directive for NetCDF 64bit support |
---|
| 71 | # 20/01/06 - Siggi - cpp directive for ibmy |
---|
| 72 | # 09/02/06 - Marcus- compile only once on lcmuk (as on ibmh/ibmb) |
---|
| 73 | # 10/02/06 - Siggi - modifications for scp on decalpha |
---|
| 74 | # 13/04/06 - Siggi - ostria admitted |
---|
| 75 | # 19/04/06 - Siggi - preprocessor directive -D$OMP=OMP for ibm removed |
---|
| 76 | # 23/05/05 - Siggi - lctit (SUN Fire X4600) admitted |
---|
| 77 | # 29/05/05 - Siggi - atmos (lcide) admitted |
---|
| 78 | # 23/08/06 - Siggi - netcdf support for scirocco (notebook) |
---|
| 79 | # 24/11/06 - Siggi - breva and levanto admitted |
---|
| 80 | # 07/02/07 - Siggi - adapted for RIAM (neck) |
---|
[5] | 81 | # 10/02/07 - Siggi - all hpmuk-related code removed |
---|
[40] | 82 | # 02/03/07 - Siggi - compilation of utility programs and transfer of |
---|
[27] | 83 | # scripts to remote hosts added (option -u) |
---|
[66] | 84 | # 14/03/07 - Siggi - fimm admitted, revision number added to terminal |
---|
| 85 | # output |
---|
[69] | 86 | # 16/03/07 - Siggi - adjustments (netcdf) for lctit |
---|
| 87 | # adjustments for running under pdksh, local ip-addres |
---|
| 88 | # is not determined any more |
---|
[82] | 89 | # 30/03/07 - Siggi - cpp-directives/options + netcdf-options are read |
---|
| 90 | # from configuration file |
---|
| 91 | # host identifier (local_host) is read from config file |
---|
[116] | 92 | # 10/10/07 - Siggi - bugfix: handling of comment lines |
---|
[181] | 93 | # 18/07/08 - Siggi - adapted for lcsgih |
---|
| 94 | # 21/07/08 - Siggi - mainprog (executable) is added to the tar-file |
---|
| 95 | # ({mainprog}_current_version) |
---|
[1] | 96 | |
---|
| 97 | |
---|
| 98 | |
---|
| 99 | # VARIABLENVEREINBARUNGEN + DEFAULTWERTE |
---|
[22] | 100 | compile_utility_programs=false |
---|
[1] | 101 | config_file=.mrun.config |
---|
[67] | 102 | fimm=false |
---|
[1] | 103 | host=all |
---|
| 104 | host_found=false |
---|
| 105 | ibm_hb_done=false |
---|
| 106 | lcmuk_done=false |
---|
| 107 | locat=normal |
---|
| 108 | makefile="" |
---|
| 109 | remote_mode=interactive |
---|
| 110 | scirocco=false |
---|
| 111 | silent=false |
---|
| 112 | suf=f90 |
---|
| 113 | update=false |
---|
[83] | 114 | working_directory=`pwd` |
---|
[1] | 115 | |
---|
| 116 | typeset -i ih ihost=0 |
---|
| 117 | |
---|
[66] | 118 | typeset -R30 calltime |
---|
[1] | 119 | typeset -L20 column1 |
---|
| 120 | typeset -L50 column2 |
---|
| 121 | typeset -L70 column3 |
---|
[169] | 122 | typeset -L40 version="MBUILD 2.0 Rev$Rev: 116 $" |
---|
[1] | 123 | |
---|
| 124 | # FEHLERBEHANDLUNG |
---|
| 125 | # BEI EXIT: |
---|
[83] | 126 | trap 'rm -rf $working_directory/tmp_mbuild |
---|
[69] | 127 | if [[ $locat != normal ]] |
---|
[1] | 128 | then |
---|
| 129 | printf "\n\n +++ mbuild killed \n\n" |
---|
| 130 | else |
---|
| 131 | printf "\n\n *** mbuild finished \n\n" |
---|
| 132 | fi' exit |
---|
| 133 | |
---|
| 134 | |
---|
| 135 | # BEI TERMINAL-BREAK: |
---|
[83] | 136 | trap 'rm -rf $working_directory/tmp_mbuild |
---|
[69] | 137 | printf "\n\n +++ mbuild killed by \"^C\" \n\n" |
---|
[1] | 138 | exit |
---|
| 139 | ' 2 |
---|
| 140 | |
---|
| 141 | |
---|
| 142 | |
---|
| 143 | # SHELLSCRIPT-OPTIONEN EINLESEN |
---|
[22] | 144 | while getopts :c:h:m:rs:u option |
---|
[1] | 145 | do |
---|
| 146 | case $option in |
---|
| 147 | (c) config_file=$OPTARG;; |
---|
| 148 | (h) host=$OPTARG;; |
---|
| 149 | (m) makefile=$OPTARG;; |
---|
| 150 | (r) remote_mode=batch;; |
---|
| 151 | (s) suf=$OPTARG;; |
---|
[22] | 152 | (u) compile_utility_programs=true;; |
---|
[1] | 153 | (\?) printf "\n +++ unknown option $OPTARG \n"; |
---|
| 154 | locat=parameter; exit;; |
---|
| 155 | esac |
---|
| 156 | done |
---|
| 157 | |
---|
| 158 | |
---|
| 159 | |
---|
| 160 | # BATCH-MODE IST ZUR ZEIT NICHT FUNKTIONSFAEHIG |
---|
| 161 | if [[ $remote_mode = batch ]] |
---|
| 162 | then |
---|
| 163 | printf "\n +++ sorry, batch mode does not work! \n" |
---|
| 164 | locat=parameter; exit |
---|
| 165 | fi |
---|
| 166 | |
---|
| 167 | |
---|
| 168 | |
---|
[82] | 169 | # PRUEFEN, OB KONFIGURATIONS-DATEI VORHANDEN |
---|
| 170 | if [[ ! -f $config_file ]] |
---|
| 171 | then |
---|
| 172 | printf "\n +++ configuration file: " |
---|
| 173 | printf "\n $config_file" |
---|
| 174 | printf "\n does not exist" |
---|
| 175 | locat=configuration; exit |
---|
| 176 | fi |
---|
| 177 | |
---|
| 178 | |
---|
| 179 | |
---|
[1] | 180 | # LOKALEN RECHNER ERMITTELN |
---|
| 181 | local_host_real_name=$(hostname) |
---|
[69] | 182 | # local_addres=$(nslookup `hostname` 2>&1 | grep "Address:" | tail -1 | awk '{print $2}') |
---|
| 183 | |
---|
[1] | 184 | |
---|
[82] | 185 | |
---|
| 186 | # HOST-IDENTIFIER (local_host) AUS KONFIGURATIONSDATEI BESTIMMEN |
---|
| 187 | line="" |
---|
| 188 | grep "%host_identifier" $config_file > tmp_mbuild |
---|
| 189 | while read line |
---|
| 190 | do |
---|
[116] | 191 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
[82] | 192 | then |
---|
| 193 | HOSTNAME=`echo $line | cut -d" " -s -f2` |
---|
| 194 | host_identifier=`echo $line | cut -d" " -s -f3` |
---|
[83] | 195 | if [[ $local_host_real_name = $HOSTNAME ]] |
---|
[82] | 196 | then |
---|
| 197 | local_host=$host_identifier |
---|
| 198 | break |
---|
| 199 | fi |
---|
| 200 | fi |
---|
| 201 | done < tmp_mbuild |
---|
| 202 | |
---|
| 203 | if [[ "$local_host" = "" ]] |
---|
| 204 | then |
---|
| 205 | printf "\n +++ no host identifier found in configuration file \"$config_file\"" |
---|
| 206 | printf "\n for local host \"$local_host_real_name\"." |
---|
| 207 | printf "\n Please add line" |
---|
| 208 | printf "\n \"\%host_identifier $local_host_real_name <identifier>\"" |
---|
| 209 | printf "\n to the configuration file." |
---|
| 210 | locat=local_host; exit |
---|
| 211 | fi |
---|
| 212 | |
---|
| 213 | |
---|
| 214 | |
---|
[1] | 215 | [[ $local_host_real_name = scirocco ]] && scirocco=true |
---|
[67] | 216 | [[ $local_host_real_name = fimm.bccs.uib.no ]] && fimm=true |
---|
[1] | 217 | |
---|
| 218 | |
---|
| 219 | |
---|
| 220 | if [[ $local_host != ibms ]] |
---|
| 221 | then |
---|
| 222 | config_file=$PWD/$config_file |
---|
| 223 | else |
---|
| 224 | config_file=`pwd`/$config_file |
---|
| 225 | fi |
---|
| 226 | |
---|
| 227 | |
---|
| 228 | |
---|
| 229 | # BENUTZERNAMEN AUF LOKALEM RECHNER AUS KONFIGURATIONSDATEI ERMITTELN |
---|
| 230 | line="" |
---|
[69] | 231 | grep " $local_host" $config_file | grep "%remote_username" > tmp_mbuild |
---|
| 232 | while read line |
---|
[1] | 233 | do |
---|
[116] | 234 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
[1] | 235 | then |
---|
| 236 | local_username=`echo $line | cut -d" " -s -f2` |
---|
| 237 | fi |
---|
[69] | 238 | done < tmp_mbuild |
---|
[1] | 239 | |
---|
[82] | 240 | |
---|
[1] | 241 | if [[ "$local_username" = "" ]] |
---|
| 242 | then |
---|
| 243 | printf "\n +++ no user name found in configuration file" |
---|
| 244 | printf "\n for local host \"$local_host\" " |
---|
| 245 | locat=config_file; exit |
---|
| 246 | fi |
---|
| 247 | |
---|
| 248 | |
---|
[5] | 249 | # LOKALEN QUELLTEXTPFAD ERMITTELN. |
---|
| 250 | # ZUERST PRUEFEN, OB EIN GLOBALER QUELLTEXTPFAD FUER ALLE RECHNER |
---|
| 251 | # VEREINBART WURDE. |
---|
| 252 | # DAZU ZUNAECHST ALLE IN DER KONFIGURATIONSDATEI VEREINBARTEN GLOBALEN |
---|
| 253 | # VARIABLEN SETZEN, WEIL DIESE EVTL. IN PFADNAMEN VERWENDET WERDEN |
---|
| 254 | line="" |
---|
[69] | 255 | grep "%" $config_file > tmp_mbuild |
---|
| 256 | while read line |
---|
[5] | 257 | do |
---|
[116] | 258 | if [[ "$line" != "" && "$(echo $line | cut -d" " -s -f3)" = "" && $(echo $line | cut -c1) != "#" ]] |
---|
[1] | 259 | then |
---|
[5] | 260 | var=`echo $line | cut -d" " -s -f1 | cut -c2-` |
---|
| 261 | value=`echo $line | cut -d" " -s -f2` |
---|
[8] | 262 | eval export $var=\$value |
---|
[9] | 263 | # eval echo \" $var=\$$var \" # AUSGABE ZU TESTZWECKEN |
---|
[1] | 264 | fi |
---|
[69] | 265 | done < tmp_mbuild |
---|
[1] | 266 | |
---|
[5] | 267 | # NUN PRUEFEN, OB EIN GLOBALER QUELLTEXTPFAD VEREINBART WURDE |
---|
[1] | 268 | line="" |
---|
[69] | 269 | grep "%source_path" $config_file > tmp_mbuild |
---|
| 270 | while read line |
---|
[1] | 271 | do |
---|
| 272 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 273 | then |
---|
| 274 | if [[ "$(echo $line | cut -d" " -s -f3)" = "" ]] |
---|
| 275 | then |
---|
| 276 | global_source_path=`echo $line | cut -d" " -s -f2` |
---|
| 277 | fi |
---|
| 278 | fi |
---|
[69] | 279 | done < tmp_mbuild |
---|
[1] | 280 | |
---|
| 281 | line="" |
---|
[69] | 282 | grep " $local_host" $config_file | grep "%source_path" > tmp_mbuild |
---|
| 283 | while read line |
---|
[1] | 284 | do |
---|
| 285 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 286 | then |
---|
| 287 | local_source_path=`echo $line | cut -d" " -s -f2` |
---|
| 288 | fi |
---|
[69] | 289 | done < tmp_mbuild |
---|
[1] | 290 | |
---|
| 291 | if [[ "$local_source_path" = "" ]] |
---|
| 292 | then |
---|
| 293 | if [[ "$global_source_path" != "" ]] |
---|
| 294 | then |
---|
| 295 | local_source_path=$global_source_path |
---|
| 296 | else |
---|
| 297 | printf "\n +++ no source path found in configuration file" |
---|
| 298 | printf "\n for local host \"$local_host\" " |
---|
| 299 | printf "\n please set \"\%source_path\" in configuration file" |
---|
| 300 | locat=config_file; exit |
---|
| 301 | fi |
---|
| 302 | fi |
---|
| 303 | eval local_source_path=$local_source_path |
---|
[8] | 304 | eval local_source_path=$local_source_path |
---|
[1] | 305 | |
---|
| 306 | |
---|
| 307 | # EBENSO PFAD FUER DAS MAKE-DEPOSITORY ERMITTELN |
---|
| 308 | line="" |
---|
[69] | 309 | grep "%depository_path" $config_file > tmp_mbuild |
---|
| 310 | while read line |
---|
[1] | 311 | do |
---|
| 312 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 313 | then |
---|
| 314 | if [[ "$(echo $line | cut -d" " -s -f3)" = "" ]] |
---|
| 315 | then |
---|
| 316 | global_depository_path=`echo $line | cut -d" " -s -f2` |
---|
| 317 | fi |
---|
| 318 | fi |
---|
[69] | 319 | done < tmp_mbuild |
---|
[1] | 320 | |
---|
| 321 | line="" |
---|
[69] | 322 | grep " $local_host" $config_file | grep "%depository_path" > tmp_mbuild |
---|
| 323 | while read line |
---|
[1] | 324 | do |
---|
| 325 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 326 | then |
---|
| 327 | local_depository_path=`echo $line | cut -d" " -s -f2` |
---|
| 328 | fi |
---|
[69] | 329 | done < tmp_mbuild |
---|
[1] | 330 | |
---|
| 331 | if [[ "$local_depository_path" = "" ]] |
---|
| 332 | then |
---|
| 333 | if [[ "$global_depository_path" != "" ]] |
---|
| 334 | then |
---|
| 335 | local_depository_path=$global_depository_path |
---|
| 336 | else |
---|
| 337 | printf "\n +++ no depository path found in configuration file" |
---|
| 338 | printf "\n for local host \"$local_host\" " |
---|
| 339 | printf "\n please set \"\%depository_path\" in configuration file" |
---|
| 340 | locat=config_file; exit |
---|
| 341 | fi |
---|
| 342 | fi |
---|
| 343 | eval local_depository_path=$local_depository_path |
---|
[8] | 344 | eval local_depository_path=$local_depository_path |
---|
[1] | 345 | |
---|
| 346 | |
---|
| 347 | |
---|
[5] | 348 | # PRUEFEN, OB IN KONFIGURATIONSDATEI EIN HAUPTPROGRAMM |
---|
| 349 | # VEREINBART WURDE |
---|
| 350 | if [[ $(grep -c "%mainprog" $config_file) != 1 ]] |
---|
| 351 | then |
---|
| 352 | printf "\n +++ no main program or more than one main program defined" |
---|
| 353 | printf "\n in configuration file" |
---|
| 354 | locat=configuration; exit |
---|
| 355 | else |
---|
| 356 | line=`grep "%mainprog" $config_file` |
---|
| 357 | if [[ "$line" = "" || $(echo $line | cut -c1) = "#" ]] |
---|
| 358 | then |
---|
| 359 | printf "\n +++ no main program defined in configuration file" |
---|
| 360 | locat=configuration; exit |
---|
| 361 | fi |
---|
| 362 | mainprog=`echo $line | cut -d" " -s -f2 | cut -d"." -f1` |
---|
| 363 | fi |
---|
| 364 | |
---|
| 365 | |
---|
| 366 | |
---|
[1] | 367 | # MAKEFILE vorhanden |
---|
| 368 | [[ "$makefile" = "" ]] && makefile=$local_source_path/Makefile |
---|
| 369 | if [[ ! -f $makefile ]] |
---|
| 370 | then |
---|
| 371 | printf "\n +++ makefile: " |
---|
| 372 | printf "\n $makefile" |
---|
| 373 | printf "\n does not exist" |
---|
| 374 | locat=makefile; exit |
---|
| 375 | fi |
---|
| 376 | |
---|
| 377 | |
---|
| 378 | # HEADER-AUSGABE (TEIL1: MELDUNGEN UEBER LOKALEN RECHNER) |
---|
| 379 | calltime=$(date) |
---|
| 380 | printf "\n" |
---|
| 381 | printf "#------------------------------------------------------------------------# \n" |
---|
| 382 | printf "| $version$calltime | \n" |
---|
| 383 | printf "| | \n" |
---|
| 384 | column1="called on:"; column2=$local_host_real_name |
---|
| 385 | printf "| $column1$column2 | \n" |
---|
| 386 | column1="local username:"; column2=$local_username |
---|
| 387 | printf "| $column1$column2 | \n" |
---|
| 388 | column1="local IP-addres:"; column2=$local_addres |
---|
| 389 | printf "| $column1$column2 | \n" |
---|
| 390 | column1="config file:"; column2=$config_file |
---|
| 391 | printf "| $column1$column2 | \n" |
---|
| 392 | column1="makefile:"; column2=$makefile |
---|
| 393 | printf "| $column1$column2 | \n" |
---|
| 394 | column1="local source path:"; column2=$local_source_path |
---|
| 395 | printf "| $column1$column2 | \n" |
---|
| 396 | column1="make depository:"; column2=$local_depository_path |
---|
| 397 | printf "| $column1$column2 | \n" |
---|
| 398 | printf "#------------------------------------------------------------------------# \n" |
---|
| 399 | |
---|
| 400 | # printf "| | \n" |
---|
| 401 | |
---|
| 402 | |
---|
[40] | 403 | if [[ $compile_utility_programs = false ]] |
---|
| 404 | then |
---|
[1] | 405 | |
---|
[40] | 406 | cd $local_source_path |
---|
[1] | 407 | |
---|
| 408 | |
---|
[40] | 409 | # LISTE DER ZU PRUEFENDEN QUELLTEXTDATEIEN ERSTELLEN |
---|
| 410 | source_code_files=`ls -1 *.$suf` |
---|
[1] | 411 | |
---|
| 412 | |
---|
[40] | 413 | |
---|
| 414 | # VERZEICHNIS FUER DAS MAKE-DEPOSITORY ERZEUGEN, |
---|
| 415 | # FALLS NOCH NICHT VORHANDEN. ANSONSTEN ALLE DATEIEN |
---|
| 416 | # NEUEREN DATUMS IN DIESES VERZEICHNIS KOPIEREN |
---|
| 417 | if [[ ! -d $local_depository_path ]] |
---|
[1] | 418 | then |
---|
[40] | 419 | if mkdir $local_depository_path |
---|
| 420 | then |
---|
| 421 | printf "\n\n *** directory for make depository:" |
---|
| 422 | printf "\n $local_depository_path" |
---|
| 423 | printf "\n was created\n" |
---|
[1] | 424 | |
---|
[40] | 425 | # MAKEFILE UND QUELLTEXTDATEIEN UNTER BEIBEHALTUNG |
---|
| 426 | # IHRES DATUMS INS VERZEICHNIS KOPIEREN |
---|
| 427 | printf "\n *** makefile and source code files are copied to" |
---|
| 428 | printf "\n $local_depository_path\n" |
---|
| 429 | printf "\n copying makefile \"$makefile\" ..." |
---|
| 430 | cp -p $makefile $local_depository_path/Makefile |
---|
[1] | 431 | |
---|
[40] | 432 | # QUELLTEXTDATEIEN MUESSEN IM MAKEFILE AUFGEFUEHRT |
---|
| 433 | # SEIN |
---|
| 434 | for filename in $source_code_files |
---|
| 435 | do |
---|
| 436 | if [[ $(grep -c $filename $makefile) = 0 ]] |
---|
| 437 | then |
---|
| 438 | printf "\n +++ source code file:" |
---|
| 439 | printf "\n $filename" |
---|
| 440 | printf "\n is not listed in makefile" |
---|
| 441 | locat=makefile; exit |
---|
| 442 | else |
---|
| 443 | printf "\n copying source code file \"$filename\" ..." |
---|
| 444 | cp -p $filename $local_depository_path |
---|
| 445 | fi |
---|
| 446 | done |
---|
| 447 | printf "\n" |
---|
| 448 | else |
---|
| 449 | printf "\n +++ directory for make depository:" |
---|
| 450 | printf "\n $local_depository_path" |
---|
| 451 | printf "\n cannot be created" |
---|
| 452 | locat=local_depository_path; exit |
---|
| 453 | fi |
---|
| 454 | else |
---|
| 455 | |
---|
| 456 | printf "\n *** checking file status ..." |
---|
| 457 | |
---|
| 458 | # MAKEFILE KOPIEREN, FALLS NEUEREN DATUMS |
---|
| 459 | if [[ $makefile -nt $local_depository_path/Makefile ]] |
---|
| 460 | then |
---|
| 461 | printf "\n *** update of \"$makefile\" " |
---|
| 462 | cp -f -p $makefile $local_depository_path/Makefile |
---|
| 463 | update=true |
---|
| 464 | |
---|
| 465 | # PRUEFEN, OB ALLE DATEIEN IM DEPOSITORY AUCH IM NEUEN MAKEFILE |
---|
| 466 | # VERZEICHNET SIND UND GEGEBENENFALLS DATEIEN LOESCHEN |
---|
| 467 | cd $local_depository_path |
---|
| 468 | source_code_files_in_depository=`ls -1 *.$suf` |
---|
| 469 | for filename in $source_code_files_in_depository |
---|
| 470 | do |
---|
| 471 | if [[ $(grep -c $filename Makefile) = 0 ]] |
---|
| 472 | then |
---|
| 473 | printf "\n *** source code file in \"$local_depository_path\":" |
---|
| 474 | printf "\n $filename" |
---|
| 475 | printf "\n is not listed in makefile" |
---|
| 476 | if [[ $silent = false ]] |
---|
| 477 | then |
---|
| 478 | answer=dummy |
---|
| 479 | printf "\n\n" |
---|
| 480 | while [[ "$answer" != y && "$answer" != Y && "$answer" != n && "$answer" != N ]] |
---|
| 481 | do |
---|
| 482 | printf " >>> delete \"$filename\" in \"$local_depository_path\" (y/n) ? " |
---|
| 483 | read answer |
---|
| 484 | done |
---|
| 485 | if [[ $answer = y || $answer = Y ]] |
---|
| 486 | then |
---|
| 487 | base=`echo $filename | cut -d. -f2` |
---|
| 488 | rm -f $filename |
---|
| 489 | rm -f ${base}.o ${base}.mod |
---|
| 490 | printf "\n *** \"$filename\" deleted in \"$local_depository_path\" " |
---|
| 491 | else |
---|
| 492 | printf "\n *** \"$filename\" not deleted in \"$local_depository_path\" " |
---|
| 493 | fi |
---|
| 494 | fi |
---|
| 495 | fi |
---|
| 496 | done |
---|
| 497 | cd - > /dev/null 2>&1 |
---|
| 498 | |
---|
| 499 | elif [[ $local_depository_path/Makefile -nt $makefile ]] |
---|
| 500 | then |
---|
| 501 | printf "\n *** makefile in depository is newer than" |
---|
| 502 | printf "\n \"$makefile\" " |
---|
| 503 | if [[ $silent = false ]] |
---|
| 504 | then |
---|
| 505 | answer=dummy |
---|
| 506 | printf "\n\n" |
---|
| 507 | while [[ "$answer" != y && "$answer" != Y && "$answer" != n && "$answer" != N ]] |
---|
| 508 | do |
---|
| 509 | printf " >>> update \"$makefile\" (y/n) ? " |
---|
| 510 | read answer |
---|
| 511 | done |
---|
| 512 | if [[ $answer = y || $answer = Y ]] |
---|
| 513 | then |
---|
| 514 | cp -f -p $local_depository_path/Makefile $makefile |
---|
| 515 | printf "\n *** \"$makefile\" updated" |
---|
| 516 | else |
---|
| 517 | printf "\n *** \"$makefile\" not updated" |
---|
| 518 | fi |
---|
| 519 | fi |
---|
| 520 | fi |
---|
| 521 | |
---|
| 522 | # QUELLTEXTDATEIEN KOPIEREN, FALLS NEUEREN DATUMS |
---|
| 523 | # SIE MUESSEN IM MAKEFILE AUFGEFUEHRT SEIN |
---|
[1] | 524 | for filename in $source_code_files |
---|
| 525 | do |
---|
| 526 | if [[ $(grep -c $filename $makefile) = 0 ]] |
---|
| 527 | then |
---|
| 528 | printf "\n +++ source code file:" |
---|
| 529 | printf "\n $filename" |
---|
| 530 | printf "\n is not listed in makefile" |
---|
| 531 | locat=makefile; exit |
---|
| 532 | else |
---|
[40] | 533 | if [[ ! -f $local_depository_path/$filename ]] |
---|
| 534 | then |
---|
| 535 | cp -p $filename $local_depository_path |
---|
| 536 | printf "\n *** source code file \"$filename\" created in \"$local_depository_path\" " |
---|
| 537 | fi |
---|
| 538 | if [[ $filename -nt $local_depository_path/$filename ]] |
---|
| 539 | then |
---|
| 540 | printf "\n *** update of source code file \"$filename\" " |
---|
| 541 | cp -f -p $filename $local_depository_path |
---|
| 542 | update=true |
---|
| 543 | fi |
---|
[1] | 544 | fi |
---|
| 545 | done |
---|
| 546 | |
---|
| 547 | |
---|
[40] | 548 | # PRUEFEN, OB ALLE DATEIEN IM DEPOSITORY IM AKTUELLEN ARBEITSVERZEICHNIS VORHANDEN |
---|
| 549 | # ODER EVTL. NEUEREN DATUMS SIND |
---|
[1] | 550 | cd $local_depository_path |
---|
| 551 | source_code_files_in_depository=`ls -1 *.$suf` |
---|
[40] | 552 | cd - > /dev/null 2>&1 |
---|
[1] | 553 | for filename in $source_code_files_in_depository |
---|
| 554 | do |
---|
[40] | 555 | if [[ ! -f $filename ]] |
---|
[1] | 556 | then |
---|
[40] | 557 | printf "\n *** source code file \"$filename\" does not exist in current directory" |
---|
[1] | 558 | if [[ $silent = false ]] |
---|
| 559 | then |
---|
| 560 | answer=dummy |
---|
| 561 | printf "\n\n" |
---|
| 562 | while [[ "$answer" != y && "$answer" != Y && "$answer" != n && "$answer" != N ]] |
---|
| 563 | do |
---|
[40] | 564 | printf " >>> create \"$filename\" in current directory (y/n) ? " |
---|
[1] | 565 | read answer |
---|
| 566 | done |
---|
| 567 | if [[ $answer = y || $answer = Y ]] |
---|
| 568 | then |
---|
[40] | 569 | cp -p $local_depository_path/$filename $filename |
---|
| 570 | printf "\n *** source code file \"$filename\" created in current directory" |
---|
[1] | 571 | else |
---|
[40] | 572 | printf "\n *** source code file \"$filename\" not created in current directory" |
---|
[1] | 573 | fi |
---|
| 574 | fi |
---|
[40] | 575 | elif [[ $local_depository_path/$filename -nt $filename ]] |
---|
[1] | 576 | then |
---|
[40] | 577 | ls -al $local_depository_path/$filename |
---|
| 578 | ls -al $filename |
---|
| 579 | printf "\n *** source code file \"$filename\" in depository is newer than in current directory" |
---|
| 580 | if [[ $silent = false ]] |
---|
[1] | 581 | then |
---|
[40] | 582 | answer=dummy |
---|
| 583 | printf "\n\n" |
---|
| 584 | while [[ "$answer" != y && "$answer" != Y && "$answer" != n && "$answer" != N ]] |
---|
| 585 | do |
---|
| 586 | printf " >>> update \"$filename\" in current directory (y/n) ? " |
---|
| 587 | read answer |
---|
| 588 | done |
---|
| 589 | if [[ $answer = y || $answer = Y ]] |
---|
| 590 | then |
---|
| 591 | cp -f -p $local_depository_path/$filename $filename |
---|
| 592 | printf "\n *** source code file \"$filename\" updated in current directory" |
---|
| 593 | else |
---|
| 594 | printf "\n *** source code file \"$filename\" not updated in current directory" |
---|
| 595 | fi |
---|
[1] | 596 | fi |
---|
| 597 | fi |
---|
[40] | 598 | done |
---|
| 599 | |
---|
| 600 | if [[ $update = false ]] |
---|
[1] | 601 | then |
---|
[40] | 602 | printf "\n *** no updates necessary in \"$local_depository_path\" " |
---|
[1] | 603 | if [[ $silent = false ]] |
---|
| 604 | then |
---|
| 605 | answer=dummy |
---|
| 606 | printf "\n\n" |
---|
| 607 | while [[ "$answer" != y && "$answer" != Y && "$answer" != n && "$answer" != N ]] |
---|
| 608 | do |
---|
[40] | 609 | printf " >>> continue with updates on remote hosts (y/n) ? " |
---|
[1] | 610 | read answer |
---|
| 611 | done |
---|
[40] | 612 | if [[ $answer = n || $answer = N ]] |
---|
[1] | 613 | then |
---|
[40] | 614 | locat=user_abort; exit |
---|
[1] | 615 | fi |
---|
| 616 | fi |
---|
| 617 | fi |
---|
| 618 | fi |
---|
| 619 | |
---|
| 620 | |
---|
| 621 | |
---|
[40] | 622 | # QUELLTEXTDATEIEN UND MAKEFILE MIT TAR ZUSAMMENBINDEN |
---|
| 623 | # IN JEDEM FALL ALLEN DATEIEN WRITE-PERMIT GEBEN, DAMIT ES AUF |
---|
| 624 | # DEN REMOTE-RECHNERN NICHT EVTL. ZU PROBLEMEN BEIM UEBERSCHREIBEN KOMMT |
---|
| 625 | printf "\n\n *** tar of makefile and source files in depository ..." |
---|
| 626 | cd $local_depository_path |
---|
| 627 | chmod u+w Makefile *.$suf |
---|
| 628 | tar -cf ${mainprog}_sources.tar Makefile *.$suf |
---|
| 629 | printf "\n" |
---|
[1] | 630 | |
---|
[40] | 631 | fi |
---|
[1] | 632 | |
---|
| 633 | |
---|
[40] | 634 | |
---|
[1] | 635 | # BESTAETIGUNG ZUM WEITERMACHEN EINHOLEN |
---|
| 636 | if [[ $host = all ]] |
---|
| 637 | then |
---|
| 638 | printf "\n *** updates will be made for ALL hosts found in" |
---|
| 639 | printf "\n the configuration file" |
---|
| 640 | else |
---|
| 641 | printf "\n *** update will be made for host \"$host\" " |
---|
| 642 | fi |
---|
| 643 | |
---|
| 644 | if [[ $silent = false ]] |
---|
| 645 | then |
---|
| 646 | answer=dummy |
---|
| 647 | printf "\n\n" |
---|
| 648 | while [[ "$answer" != y && "$answer" != Y && "$answer" != n && "$answer" != N ]] |
---|
| 649 | do |
---|
| 650 | printf " >>> continue (y/n) ? " |
---|
| 651 | read answer |
---|
| 652 | done |
---|
| 653 | if [[ $answer = n || $answer = N ]] |
---|
| 654 | then |
---|
| 655 | locat=user_abort; exit |
---|
| 656 | fi |
---|
| 657 | fi |
---|
| 658 | |
---|
| 659 | |
---|
| 660 | |
---|
| 661 | |
---|
| 662 | # GENERIERUNG DER AKTUELLEN MODELLVERSION FUER ALLE RECHNER-/UEBERSETZUNGS- |
---|
| 663 | # VERSIONEN, DIE IN DER KONFIGURATIONSDATEI GEFUNDEN WERDEN |
---|
| 664 | printf "\n *** scanning configuration file for host(s) ..." |
---|
| 665 | |
---|
[69] | 666 | grep %fopts $config_file > tmp_mbuild |
---|
| 667 | while read line |
---|
[1] | 668 | do |
---|
| 669 | # KOMMENTARZEILEN UEBERSPRINGEN |
---|
| 670 | [[ $(echo $line | cut -c1) = "#" ]] && continue |
---|
| 671 | (( ihost = ihost + 1 )) |
---|
| 672 | hostline[$ihost]="$line" |
---|
[69] | 673 | done < tmp_mbuild |
---|
[1] | 674 | |
---|
| 675 | |
---|
| 676 | while (( ih < ihost )) |
---|
| 677 | do |
---|
| 678 | |
---|
| 679 | (( ih = ih + 1 )) |
---|
| 680 | |
---|
| 681 | # REMOTE-RECHNER UND UEBERSETZUNGS-VERSION FESTSTELLEN |
---|
| 682 | # NUR WEITERMACHEN, WENN ENTSPRECHENDER REMOTE-RECHNER MITTELS |
---|
| 683 | # SHELLSCRIPT-OPTION AUCH AUSGEWAEHLT WURDE |
---|
| 684 | remote_host_string=`echo ${hostline[$ih]} | cut -d" " -s -f3-` |
---|
| 685 | remote_host=`echo $remote_host_string | cut -d" " -f1` |
---|
| 686 | if [[ $host != all ]] |
---|
| 687 | then |
---|
| 688 | [[ $remote_host != $host ]] && continue |
---|
| 689 | fi |
---|
| 690 | host_found=true |
---|
| 691 | condition1=`echo $remote_host_string | cut -d" " -s -f2` |
---|
| 692 | if [[ $condition1 = $remote_host ]] |
---|
| 693 | then |
---|
| 694 | condition1="" |
---|
| 695 | else |
---|
| 696 | condition2=`echo $remote_host_string | cut -d" " -s -f3` |
---|
| 697 | fi |
---|
| 698 | |
---|
[82] | 699 | netcdf_inc="" |
---|
| 700 | netcdf_lib="" |
---|
[1] | 701 | |
---|
| 702 | # AUF HLRN-RECHNER NUR EINMAL UEBERSETZEN |
---|
| 703 | if [[ $remote_host = ibmb || $remote_host = ibmh ]] |
---|
| 704 | then |
---|
| 705 | if [[ $ibm_hb_done = true ]] |
---|
| 706 | then |
---|
| 707 | printf "\n *** remote host \"$remote_host\" skipped since compilation has already" |
---|
| 708 | printf "\n been carried out on one of the HLRN machines\n" |
---|
| 709 | continue |
---|
| 710 | fi |
---|
| 711 | fi |
---|
| 712 | |
---|
| 713 | # AUF LCMUK-RECHNER NUR EINMAL UEBERSETZEN |
---|
| 714 | if [[ $remote_host = lcmuk ]] |
---|
| 715 | then |
---|
| 716 | if [[ $lcmuk_done = true ]] |
---|
| 717 | then |
---|
| 718 | printf "\n *** local host \"$remote_host\" skipped since compilation has already" |
---|
| 719 | printf "\n been carried out on this host\n" |
---|
| 720 | continue |
---|
| 721 | fi |
---|
| 722 | fi |
---|
| 723 | |
---|
| 724 | |
---|
| 725 | # IP-ADRESSE DES REMOTE-RECHNERS BESTIMMEN |
---|
| 726 | case $remote_host in |
---|
[116] | 727 | (lcmuk) remote_addres=130.75.105.2;; |
---|
[181] | 728 | (lcsgib) remote_addres=130.73.232.102;; |
---|
| 729 | (lcsgih) remote_addres=130.75.4.102;; |
---|
[83] | 730 | (lctit) remote_addres=172.17.75.161;; |
---|
| 731 | (decalpha) remote_addres=165.132.26.56;; |
---|
| 732 | (ibmb) remote_addres=130.73.230.10;; |
---|
| 733 | (ibmh) remote_addres=130.75.4.10;; |
---|
| 734 | (ibms) remote_addres=150.183.5.101;; |
---|
| 735 | (ibmy) remote_addres=165.132.26.58;; |
---|
| 736 | (nech) remote_addres=136.172.44.192;; |
---|
| 737 | (neck) remote_addres=133.5.178.11;; |
---|
| 738 | (ground.yonsei.ac.kr) remote_addres=134.75.155.33;; |
---|
| 739 | (*) if [[ $local_host != $remote_host ]] |
---|
[1] | 740 | then |
---|
[83] | 741 | printf "\n +++ remote host \"$remote_host\" unknown"; |
---|
| 742 | printf "\n please inform S. Raasch!" |
---|
[1] | 743 | fi;; |
---|
| 744 | esac |
---|
| 745 | |
---|
| 746 | |
---|
| 747 | # REMOTE-USERNAMEN ERMITTELN |
---|
| 748 | line="" |
---|
[116] | 749 | found=false |
---|
[69] | 750 | grep "$remote_host_string" $config_file | grep "%remote_username" > tmp_mbuild |
---|
| 751 | while read line1 |
---|
[1] | 752 | do |
---|
[116] | 753 | |
---|
[1] | 754 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
| 755 | then |
---|
| 756 | line="$line1" |
---|
| 757 | fi |
---|
[116] | 758 | |
---|
| 759 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 760 | then |
---|
| 761 | remote_username=`echo $line | cut -d" " -s -f2` |
---|
| 762 | found=true |
---|
| 763 | fi |
---|
| 764 | |
---|
[69] | 765 | done < tmp_mbuild |
---|
[1] | 766 | |
---|
[116] | 767 | if [[ $found = false ]] |
---|
[1] | 768 | then |
---|
| 769 | printf "\n +++ no remote username found in configuration file" |
---|
| 770 | printf "\n for \"$remote_host_string\" " |
---|
| 771 | locat=config_file; exit |
---|
| 772 | fi |
---|
| 773 | |
---|
| 774 | |
---|
| 775 | # REMOTE-QUELLTEXTPFAD ERMITTELN |
---|
| 776 | line="" |
---|
[54] | 777 | remote_source_path="" |
---|
[69] | 778 | grep "$remote_host_string" $config_file | grep "%source_path" > tmp_mbuild |
---|
| 779 | while read line1 |
---|
[1] | 780 | do |
---|
[116] | 781 | |
---|
[1] | 782 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
| 783 | then |
---|
| 784 | line="$line1" |
---|
| 785 | fi |
---|
[116] | 786 | |
---|
| 787 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 788 | then |
---|
| 789 | remote_source_path=`echo $line | cut -d" " -s -f2` |
---|
| 790 | fi |
---|
| 791 | |
---|
[69] | 792 | done < tmp_mbuild |
---|
[1] | 793 | |
---|
| 794 | if [[ "$remote_source_path" = "" ]] |
---|
| 795 | then |
---|
| 796 | if [[ "$global_source_path" != "" ]] |
---|
| 797 | then |
---|
| 798 | remote_source_path=$global_source_path |
---|
| 799 | else |
---|
| 800 | printf "\n +++ no source path found in configuration file" |
---|
| 801 | printf "\n for \"$remote_host_string\" " |
---|
| 802 | locat=config_file; exit |
---|
| 803 | fi |
---|
| 804 | fi |
---|
| 805 | |
---|
[22] | 806 | remote_ud=${remote_source_path}/../UTIL |
---|
[24] | 807 | remote_ud=$(eval echo $remote_ud) |
---|
[1] | 808 | |
---|
[54] | 809 | |
---|
[1] | 810 | # REMOTE-PFAD FUER MAKE-DEPOSITORY ERMITTELN |
---|
[54] | 811 | remote_md="" |
---|
[1] | 812 | line="" |
---|
[69] | 813 | grep "$remote_host_string" $config_file | grep "%depository_path" > tmp_mbuild |
---|
| 814 | while read line1 |
---|
[1] | 815 | do |
---|
[116] | 816 | |
---|
[1] | 817 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
| 818 | then |
---|
| 819 | line="$line1" |
---|
| 820 | fi |
---|
[116] | 821 | |
---|
| 822 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 823 | then |
---|
| 824 | remote_md=`echo $line | cut -d" " -s -f2` |
---|
| 825 | fi |
---|
| 826 | |
---|
[69] | 827 | done < tmp_mbuild |
---|
[1] | 828 | |
---|
| 829 | if [[ "$remote_md" = "" ]] |
---|
| 830 | then |
---|
| 831 | if [[ "$global_depository_path" != "" ]] |
---|
| 832 | then |
---|
| 833 | remote_md=$global_depository_path |
---|
| 834 | else |
---|
| 835 | printf "\n +++ no depository path found in configuration file" |
---|
| 836 | printf "\n for \"$remote_host_string\" " |
---|
| 837 | printf "\n please set \"\%depository_path\" in configuration file" |
---|
| 838 | locat=config_file; exit |
---|
| 839 | fi |
---|
| 840 | fi |
---|
| 841 | |
---|
[8] | 842 | remote_md=$(eval echo $remote_md) |
---|
[1] | 843 | |
---|
[8] | 844 | |
---|
[1] | 845 | # COMPILERNAMEN ERMITTELN |
---|
| 846 | line="" |
---|
[116] | 847 | found=false |
---|
[69] | 848 | grep "$remote_host_string" $config_file | grep "%compiler_name " > tmp_mbuild |
---|
| 849 | while read line1 |
---|
[1] | 850 | do |
---|
[116] | 851 | |
---|
[1] | 852 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
| 853 | then |
---|
| 854 | line="$line1" |
---|
| 855 | fi |
---|
[116] | 856 | |
---|
| 857 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 858 | then |
---|
| 859 | compiler_name=`echo $line | cut -d" " -s -f2` |
---|
| 860 | found=true |
---|
| 861 | fi |
---|
| 862 | |
---|
[69] | 863 | done < tmp_mbuild |
---|
[1] | 864 | |
---|
[116] | 865 | if [[ $found = false ]] |
---|
[1] | 866 | then |
---|
| 867 | printf "\n +++ no compiler name found in configuration file" |
---|
| 868 | printf "\n for \"$remote_host_string\" " |
---|
| 869 | locat=config_file; exit |
---|
| 870 | fi |
---|
| 871 | |
---|
| 872 | |
---|
[27] | 873 | # BEI BENUTZUNG EINES PARALLELEN COMPILERS MUSS AUCH EIN |
---|
| 874 | # SERIELLER COMPILERNAME ERMITTELT WERDEN |
---|
| 875 | if [[ $(echo $remote_host_string | grep -c parallel) = 1 ]] |
---|
| 876 | then |
---|
| 877 | line="" |
---|
[116] | 878 | found=false |
---|
[69] | 879 | grep "$remote_host_string" $config_file | grep "%compiler_name_ser" > tmp_mbuild |
---|
| 880 | while read line1 |
---|
[27] | 881 | do |
---|
[116] | 882 | |
---|
[27] | 883 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
| 884 | then |
---|
| 885 | line="$line1" |
---|
| 886 | fi |
---|
[116] | 887 | |
---|
| 888 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 889 | then |
---|
| 890 | compiler_name_ser=`echo $line | cut -d" " -s -f2` |
---|
| 891 | found=true |
---|
| 892 | fi |
---|
| 893 | |
---|
[69] | 894 | done < tmp_mbuild |
---|
[1] | 895 | |
---|
[116] | 896 | if [[ $found = false ]] |
---|
[27] | 897 | then |
---|
[28] | 898 | printf "\n +++ no serial compiler name found in configuration file" |
---|
[27] | 899 | printf "\n for \"$remote_host_string\" " |
---|
| 900 | locat=config_file; exit |
---|
| 901 | fi |
---|
| 902 | else |
---|
| 903 | compiler_name_ser=$compiler_name |
---|
| 904 | fi |
---|
| 905 | |
---|
| 906 | |
---|
| 907 | |
---|
[82] | 908 | # PRAEPROZESSOR-OPTIONEN/DIREKTIVEN ERMITTELN |
---|
| 909 | line="" |
---|
[116] | 910 | found=false |
---|
[82] | 911 | grep "$remote_host_string" $config_file | grep "%cpp_options" > tmp_mbuild |
---|
| 912 | while read line1 |
---|
| 913 | do |
---|
[116] | 914 | |
---|
[82] | 915 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
| 916 | then |
---|
| 917 | line="$line1" |
---|
| 918 | fi |
---|
[116] | 919 | |
---|
| 920 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 921 | then |
---|
| 922 | # EVENTUELLE DOPPELPUNKTE AUS OPTIONSSTRING ENTFERNEN |
---|
| 923 | cpp_options=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` |
---|
| 924 | found=true |
---|
| 925 | fi |
---|
| 926 | |
---|
[82] | 927 | done < tmp_mbuild |
---|
[116] | 928 | |
---|
| 929 | if [[ $found = false ]] |
---|
[82] | 930 | then |
---|
| 931 | printf "\n +++ no preprocessor options found in configuration file" |
---|
| 932 | printf "\n for \"$remote_host_string\" " |
---|
| 933 | locat=config_file; exit |
---|
| 934 | fi |
---|
| 935 | |
---|
[116] | 936 | |
---|
[82] | 937 | # RECHNERSPEZIFISCHE CPP-DIREKTIVEN HINZUFUEGEN |
---|
| 938 | for string in $remote_host_string |
---|
| 939 | do |
---|
| 940 | if [[ $(echo $remote_host | cut -c1-2) = lc && $(echo $string | cut -c1-2) = lc ]] |
---|
| 941 | then |
---|
| 942 | cpp_options="$cpp_options -D__lc " |
---|
[83] | 943 | elif [[ $(echo $remote_host | cut -c1-3) = ibm && $(echo $string | cut -c1-3) = ibm ]] |
---|
| 944 | then |
---|
| 945 | cpp_options="${cpp_options},-D__ibm" |
---|
| 946 | elif [[ $(echo $remote_host | cut -c1-3) = nec && $(echo $string | cut -c1-3) = nec ]] |
---|
| 947 | then |
---|
| 948 | cpp_options="${cpp_options} -D__nec" |
---|
[82] | 949 | else |
---|
[83] | 950 | if [[ $(echo $remote_host | cut -c1-3) = ibm ]] |
---|
| 951 | then |
---|
| 952 | cpp_options="${cpp_options},-D__$string" |
---|
| 953 | else |
---|
| 954 | cpp_options="$cpp_options -D__$string " |
---|
| 955 | fi |
---|
[82] | 956 | fi |
---|
| 957 | done |
---|
| 958 | |
---|
| 959 | |
---|
| 960 | |
---|
| 961 | # NETCDF-OPTIONEN ERMITTELN |
---|
| 962 | line="" |
---|
| 963 | grep "$remote_host_string" $config_file | grep "%netcdf_inc" > tmp_mbuild |
---|
| 964 | while read line1 |
---|
| 965 | do |
---|
[116] | 966 | |
---|
[82] | 967 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
| 968 | then |
---|
| 969 | line="$line1" |
---|
| 970 | fi |
---|
[116] | 971 | |
---|
| 972 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 973 | then |
---|
| 974 | # EVENTUELLE DOPPELPUNKTE AUS OPTIONSSTRING ENTFERNEN |
---|
| 975 | netcdf_inc=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` |
---|
| 976 | fi |
---|
| 977 | |
---|
[82] | 978 | done < tmp_mbuild |
---|
| 979 | |
---|
| 980 | line="" |
---|
| 981 | grep "$remote_host_string" $config_file | grep "%netcdf_lib" > tmp_mbuild |
---|
| 982 | while read line1 |
---|
| 983 | do |
---|
[116] | 984 | |
---|
[82] | 985 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
| 986 | then |
---|
| 987 | line="$line1" |
---|
| 988 | fi |
---|
[116] | 989 | |
---|
| 990 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 991 | then |
---|
| 992 | # EVENTUELLE DOPPELPUNKTE AUS OPTIONSSTRING ENTFERNEN |
---|
| 993 | netcdf_lib=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` |
---|
| 994 | fi |
---|
| 995 | |
---|
[82] | 996 | done < tmp_mbuild |
---|
| 997 | |
---|
| 998 | |
---|
| 999 | |
---|
[1] | 1000 | # COMPILEROPTIONEN ERMITTELN |
---|
| 1001 | line="" |
---|
[116] | 1002 | found=false |
---|
[69] | 1003 | grep "$remote_host_string" $config_file | grep "%fopts" > tmp_mbuild |
---|
| 1004 | while read line1 |
---|
[1] | 1005 | do |
---|
[116] | 1006 | |
---|
[1] | 1007 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
| 1008 | then |
---|
| 1009 | line="$line1" |
---|
| 1010 | fi |
---|
[116] | 1011 | |
---|
| 1012 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 1013 | then |
---|
| 1014 | # EVENTUELLE DOPPELPUNKTE AUS DIREKTIVENSTRING ENTFERNEN |
---|
| 1015 | compiler_options=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` |
---|
| 1016 | found=true |
---|
| 1017 | |
---|
| 1018 | # NETCDF-INCLUDEVERZEICHNIS HINZUFUEGEN |
---|
| 1019 | compiler_options="$compiler_options $netcdf_inc" |
---|
| 1020 | fi |
---|
| 1021 | |
---|
[69] | 1022 | done < tmp_mbuild |
---|
[116] | 1023 | |
---|
| 1024 | if [[ $found = false ]] |
---|
[1] | 1025 | then |
---|
| 1026 | printf "\n +++ no compiler options found in configuration file" |
---|
| 1027 | printf "\n for \"$remote_host_string\" " |
---|
| 1028 | locat=config_file; exit |
---|
| 1029 | fi |
---|
[82] | 1030 | |
---|
[1] | 1031 | |
---|
| 1032 | |
---|
| 1033 | # LADER-OPTIONEN ERMITTELN |
---|
| 1034 | line="" |
---|
[116] | 1035 | found=false |
---|
[69] | 1036 | grep "$remote_host_string" $config_file | grep "%lopts" > tmp_mbuild |
---|
| 1037 | while read line1 |
---|
[1] | 1038 | do |
---|
[116] | 1039 | |
---|
[1] | 1040 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
| 1041 | then |
---|
| 1042 | line="$line1" |
---|
| 1043 | fi |
---|
[116] | 1044 | |
---|
| 1045 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 1046 | then |
---|
| 1047 | # EVENTUELLE DOPPELPUNKTE AUS DIREKTIVENSTRING ENTFERNEN |
---|
| 1048 | loader_options=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` |
---|
| 1049 | found=true |
---|
| 1050 | |
---|
| 1051 | # NETCDF-LIBRARY HINZUFUEGEN |
---|
| 1052 | loader_options="$loader_options $netcdf_lib" |
---|
| 1053 | fi |
---|
| 1054 | |
---|
[69] | 1055 | done < tmp_mbuild |
---|
[1] | 1056 | |
---|
[116] | 1057 | if [[ $found = false ]] |
---|
[1] | 1058 | then |
---|
| 1059 | printf "\n +++ no loader options found in configuration file" |
---|
| 1060 | printf "\n for \"$remote_host_string\" " |
---|
| 1061 | locat=config_file; exit |
---|
| 1062 | fi |
---|
[82] | 1063 | |
---|
[1] | 1064 | |
---|
| 1065 | printf "\n\n#------------------------------------------------------------------------# \n" |
---|
| 1066 | if [[ $remote_host = $local_host ]] |
---|
| 1067 | then |
---|
| 1068 | column1="remote_host:"; column2="$remote_host (= local host!)" |
---|
| 1069 | else |
---|
| 1070 | column1="remote_host:"; column2=$remote_host |
---|
| 1071 | fi |
---|
| 1072 | printf "| $column1$column2 | \n" |
---|
| 1073 | printf "| | \n" |
---|
| 1074 | column1="conditions:"; column2="$condition1 $condition2" |
---|
| 1075 | printf "| $column1$column2 | \n" |
---|
| 1076 | column1="make depository:"; column2=$remote_md |
---|
| 1077 | printf "| $column1$column2 | \n" |
---|
[25] | 1078 | if [[ $compile_utility_programs = true ]] |
---|
| 1079 | then |
---|
| 1080 | column1="utility directory:"; column2=$remote_ud |
---|
| 1081 | printf "| $column1$column2 | \n" |
---|
| 1082 | fi |
---|
[1] | 1083 | column1="username:"; column2=$remote_username |
---|
| 1084 | printf "| $column1$column2 | \n" |
---|
| 1085 | column1="addres:"; column2=$remote_addres |
---|
| 1086 | printf "| $column1$column2 | \n" |
---|
| 1087 | column1="compiler:"; column2=$compiler_name |
---|
| 1088 | printf "| $column1$column2 | \n" |
---|
[28] | 1089 | if [[ $compile_utility_programs = true ]] |
---|
| 1090 | then |
---|
| 1091 | column1="serial compiler:"; column2=$compiler_name_ser |
---|
| 1092 | printf "| $column1$column2 | \n" |
---|
| 1093 | fi |
---|
[1] | 1094 | column1="cpp options:"; column2=$cpp_options |
---|
| 1095 | printf "| $column1$column2 | \n" |
---|
| 1096 | line=$(echo "$cpp_options" | cut -c51-) |
---|
| 1097 | while [[ "$line" != "" ]] |
---|
| 1098 | do |
---|
| 1099 | column1="" |
---|
| 1100 | column2=$line |
---|
| 1101 | printf "| $column1$column2 | \n" |
---|
| 1102 | line=$(echo "$line" | cut -c51-) |
---|
| 1103 | done |
---|
| 1104 | column1="compiler options:"; column2=$compiler_options |
---|
| 1105 | printf "| $column1$column2 | \n" |
---|
| 1106 | line=$(echo "$compiler_options" | cut -c51-) |
---|
| 1107 | while [[ "$line" != "" ]] |
---|
| 1108 | do |
---|
| 1109 | column1="" |
---|
| 1110 | column2=$line |
---|
| 1111 | printf "| $column1$column2 | \n" |
---|
| 1112 | line=$(echo "$line" | cut -c51-) |
---|
| 1113 | done |
---|
| 1114 | column1="loader options:"; column2=$loader_options |
---|
| 1115 | printf "| $column1$column2 | \n" |
---|
| 1116 | line=$(echo "$loader_options" | cut -c51-) |
---|
| 1117 | while [[ "$line" != "" ]] |
---|
| 1118 | do |
---|
| 1119 | column1="" |
---|
| 1120 | column2=$line |
---|
| 1121 | printf "| $column1$column2 | \n" |
---|
| 1122 | line=$(echo "$line" | cut -c51-) |
---|
| 1123 | done |
---|
| 1124 | printf "#------------------------------------------------------------------------# \n" |
---|
| 1125 | |
---|
| 1126 | if [[ $silent = false ]] |
---|
| 1127 | then |
---|
| 1128 | answer=dummy |
---|
| 1129 | printf "\n\n" |
---|
| 1130 | while [[ "$answer" != y && "$answer" != Y && "$answer" != c && "$answer" != C && "$answer" != s && "$answer" != S && "$answer" != a && "$answer" != A ]] |
---|
| 1131 | do |
---|
| 1132 | printf " >>> continue (y(es)/c(ontinue)/a(bort)/s(skip)) ? " |
---|
| 1133 | read answer |
---|
| 1134 | done |
---|
| 1135 | if [[ $answer = a || $answer = A ]] |
---|
| 1136 | then |
---|
| 1137 | locat=user_abort; exit |
---|
| 1138 | fi |
---|
| 1139 | if [[ $answer = c || $answer = C ]] |
---|
| 1140 | then |
---|
| 1141 | silent=false |
---|
| 1142 | fi |
---|
| 1143 | if [[ $answer = s || $answer = S ]] |
---|
| 1144 | then |
---|
| 1145 | continue |
---|
| 1146 | fi |
---|
| 1147 | fi |
---|
| 1148 | |
---|
| 1149 | |
---|
| 1150 | if [[ $remote_mode = batch ]] |
---|
| 1151 | then |
---|
| 1152 | |
---|
| 1153 | # BATCH-JOB PARAMETER SETZEN |
---|
| 1154 | case $remote_host in |
---|
| 1155 | (t3eb) queue=berte; memory=60; cputime=1000; xoption="-X 0";; |
---|
| 1156 | (t3eh) queue=comp_t3e; memory=60; cputime=360;; |
---|
| 1157 | (t3ej2) queue=normal; memory=60; cputime=1000; xoption="-X 0";; |
---|
[5] | 1158 | (t3ej5|ground.yonsei.ac.kr) printf "\n --- remote host \"$remote_host\" does not allow batch jobs"; continue;; |
---|
[1] | 1159 | esac |
---|
| 1160 | |
---|
| 1161 | |
---|
| 1162 | # BATCH-JOB ZUSAMMENSTELLEN |
---|
| 1163 | printf "\n *** creating batch-job for remote host" |
---|
| 1164 | echo " " > mbuild_job |
---|
| 1165 | |
---|
| 1166 | # AUF CRAY-RECHNERN IN JUELICH WIRD KEIN BENUTZER-PROFILE AUSGEFUEHRT |
---|
| 1167 | # DIES WIRD HIER GETAN, UM PFADE USW. ZU SETZEN |
---|
| 1168 | if [[ $remote_host = t3ej2 ]] |
---|
| 1169 | then |
---|
| 1170 | echo "set +vx" >> mbuild_job |
---|
| 1171 | echo ". .profile" >> mbuild_job |
---|
| 1172 | echo "set -x" >> mbuild_job |
---|
| 1173 | fi |
---|
| 1174 | |
---|
| 1175 | # AUF CRAY-RECHNERN GELADENE MODULE AUFLISTEN |
---|
| 1176 | if [[ $host = t3eb || $host = t3eh || $host = t3ej2 ]] |
---|
| 1177 | then |
---|
| 1178 | echo "module list" >> mbuild_job |
---|
| 1179 | fi |
---|
| 1180 | |
---|
| 1181 | |
---|
| 1182 | # WECHSEL IN TEMPORAERES VERZEICHNIS |
---|
| 1183 | echo "cd ${remote_md}" >> mbuild_job |
---|
| 1184 | |
---|
| 1185 | |
---|
| 1186 | # AKTUELLE QUELLTEXTVERSION INS REMOTE-QUELLTEXTVERZEICHNIS KOPIEREN |
---|
| 1187 | echo "scp ${local_username}@${local_addres}:~/modell/code_3dp/palm_current_version/${mainprog}_sources.tar ${mainprog}_sources.tar" >> mbuild_job |
---|
| 1188 | # echo "[[ \$? != 0 ]] && (echo "+++ scp failed"; exit)" >> mbuild_job |
---|
| 1189 | |
---|
| 1190 | |
---|
| 1191 | # FALLS VORHANDEN, LETZTE VERSION AUF DEM REMOTE-RECHNER AUSPACKEN |
---|
| 1192 | echo "[[ -f ${mainprog}_current_version.tar ]] && tar -xvf ${mainprog}_current_version.tar" >> mbuild_job |
---|
| 1193 | |
---|
| 1194 | |
---|
| 1195 | # AKTUELLE QUELLTEXTVERSION AUF REMOTE-RECHNER AUSPACKEN |
---|
| 1196 | echo "tar -xvf ${mainprog}_sources.tar" >> mbuild_job |
---|
| 1197 | |
---|
| 1198 | |
---|
| 1199 | # MAKE MIT ZUVOR ERMITTELTEN OPTIONEN AUF REMOTE RECHNER AUSFUEHREN |
---|
| 1200 | echo "make PROG=$mainprog F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$compiler_options\" LDFLAGS=\"$loader_options\" " >> mbuild_job |
---|
| 1201 | echo "chmod u+w *" >> mbuild_job |
---|
| 1202 | |
---|
| 1203 | # NEUE VERSION AUF REMOTE-RECHNER ZUSAMMENPACKEN |
---|
| 1204 | echo "tar -cvf ${mainprog}_current_version.tar *.f90 *.o" >> mbuild_job |
---|
| 1205 | |
---|
| 1206 | |
---|
| 1207 | # AKTUELLES VERSIONSVERZEICHNIS AUF REMOTE-RECHNER BEREINIGEN |
---|
| 1208 | echo "make clean" >> mbuild_job |
---|
| 1209 | echo "rm ${mainprog}_sources.tar" >> mbuild_job |
---|
| 1210 | echo "rm *.f90 Makefile" >> mbuild_job |
---|
| 1211 | |
---|
| 1212 | |
---|
| 1213 | |
---|
| 1214 | # JOB MITTELS SUBJOB STARTEN |
---|
| 1215 | printf "\n *** sending batch job to remote host" |
---|
| 1216 | # subjob $xoption -h $remote_host -q $queue -m $memory -t $cputime -v mbuild_job |
---|
| 1217 | |
---|
| 1218 | |
---|
| 1219 | # JOBFILE LOESCHEN |
---|
| 1220 | # rm aljob |
---|
| 1221 | |
---|
| 1222 | else |
---|
| 1223 | |
---|
| 1224 | if [[ $remote_host != $local_host ]] |
---|
| 1225 | then |
---|
| 1226 | |
---|
[40] | 1227 | if [[ $compile_utility_programs = false ]] |
---|
[1] | 1228 | then |
---|
| 1229 | |
---|
[40] | 1230 | # AKTUELLE QUELLTEXTVERSION INS REMOTE-QUELLTEXTVERZEICHNIS KOPIEREN |
---|
| 1231 | # FALLS DIESES NOCH NICHT EXISTIERT, WIRD ES ERZEUGT |
---|
| 1232 | echo " *** copying \"${mainprog}_sources.tar\" to \"${remote_addres}:${remote_md}/\" " |
---|
| 1233 | if [[ $remote_host != lctit ]] |
---|
| 1234 | then |
---|
| 1235 | ssh ${remote_username}@${remote_addres} "[[ ! -d ${remote_md} ]] && (echo \" *** ${remote_md} will be created\"; mkdir -p ${remote_md})" |
---|
| 1236 | else |
---|
| 1237 | # TIT ERLAUBT NUR DIE AUSFÜHRUNG GANZ BESTIMMTER KOMMANDOS |
---|
| 1238 | # MIT SSH, DESHALB AUFRUF PER PIPE |
---|
| 1239 | print "[[ ! -d ${remote_md} ]] && (echo \" *** ${remote_md} will be created\"; mkdir -p ${remote_md})" | ssh ${remote_username}@${remote_addres} 2>&1 |
---|
| 1240 | fi |
---|
| 1241 | if [[ $local_host = decalpha ]] |
---|
| 1242 | then |
---|
| 1243 | # DECALPHA BENUTZT BEI NICHTANGABE DES VOLLSTÄNDIGEN PFADES |
---|
| 1244 | # IRGENDEIN ANDERES SCP (WAS NICHT FUNKTIONIERT). AUSSERDEM |
---|
| 1245 | # KOENNEN DOLLAR-ZEICHEN NICHT BENUTZT WERDEN |
---|
| 1246 | remote_md=`echo $remote_md | sed 's/\$HOME\///'` |
---|
| 1247 | /bin/scp ${mainprog}_sources.tar ${remote_username}@${remote_addres}:${remote_md}/${mainprog}_sources.tar |
---|
| 1248 | else |
---|
| 1249 | scp ${mainprog}_sources.tar ${remote_username}@${remote_addres}:${remote_md}/${mainprog}_sources.tar |
---|
| 1250 | fi |
---|
[1] | 1251 | |
---|
| 1252 | |
---|
| 1253 | |
---|
[40] | 1254 | # FALLS VORHANDEN, LETZTE VERSION AUF DEM REMOTE-RECHNER AUSPACKEN |
---|
| 1255 | echo " *** untar previous update on remote host, if existing" |
---|
| 1256 | if [[ $remote_host != lctit ]] |
---|
| 1257 | then |
---|
| 1258 | ssh ${remote_username}@${remote_addres} "cd ${remote_md}; [[ -f ${mainprog}_current_version.tar ]] && tar -xf ${mainprog}_current_version.tar" |
---|
| 1259 | else |
---|
| 1260 | # TIT ERLAUBT NUR DIE AUSFÜHRUNG GANZ BESTIMMTER KOMMANDOS |
---|
| 1261 | # MIT SSH, DESHALB AUFRUF PER PIPE |
---|
| 1262 | print "cd ${remote_md}; [[ -f ${mainprog}_current_version.tar ]] && tar -xf ${mainprog}_current_version.tar" | ssh ${remote_username}@${remote_addres} 2>&1 |
---|
| 1263 | fi |
---|
[1] | 1264 | |
---|
| 1265 | |
---|
[40] | 1266 | # AKTUELLE QUELLTEXTVERSION AUF REMOTE-RECHNER AUSPACKEN |
---|
| 1267 | echo " *** untar actual sources on remote host" |
---|
| 1268 | if [[ $remote_host != lctit ]] |
---|
| 1269 | then |
---|
| 1270 | ssh ${remote_username}@${remote_addres} "cd ${remote_md}; tar -xf ${mainprog}_sources.tar" |
---|
| 1271 | else |
---|
| 1272 | # TIT ERLAUBT NUR DIE AUSFÜHRUNG GANZ BESTIMMTER KOMMANDOS |
---|
| 1273 | # MIT SSH, DESHALB AUFRUF PER PIPE |
---|
| 1274 | print "cd ${remote_md}; tar -xf ${mainprog}_sources.tar" | ssh ${remote_username}@${remote_addres} 2>&1 |
---|
| 1275 | fi |
---|
[1] | 1276 | |
---|
| 1277 | |
---|
[40] | 1278 | # MAKE MIT ZUVOR ERMITTELTEN OPTIONEN AUF REMOTE RECHNER AUSFUEHREN |
---|
| 1279 | # KOMMANDOUEBERGABE AN SSH PER PIPE, DA SO DIE SYSTEM- UND |
---|
| 1280 | # BENUTZERPROFILE VOLLSTAENDIG AUSGEFUEHRT WERDEN (SONST FEHLEN MAKE |
---|
| 1281 | # Z.B. DIE PFADE ZUM COMPILER) |
---|
| 1282 | echo " *** execute \"make\" on remote host" |
---|
[1] | 1283 | |
---|
[40] | 1284 | if [[ $remote_host = nech ]] |
---|
| 1285 | then |
---|
| 1286 | make_call_string="sxmake PROG=$mainprog F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$compiler_options\" LDFLAGS=\"$loader_options\" " |
---|
| 1287 | else |
---|
| 1288 | make_call_string="make PROG=$mainprog F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$compiler_options\" LDFLAGS=\"$loader_options\" " |
---|
| 1289 | fi |
---|
| 1290 | |
---|
| 1291 | if [[ $remote_host = t3eh ]] |
---|
| 1292 | then |
---|
[1] | 1293 | |
---|
[40] | 1294 | print "xterm\nexit\n cd ${remote_md}; make PROG=$mainprog F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$compiler_options\" LDFLAGS=\"$loader_options\" " | ssh ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll |
---|
[1] | 1295 | |
---|
[40] | 1296 | elif [[ $remote_host = t3ej2 || $remote_host = ibms || $remote_host = ibmy ]] |
---|
| 1297 | then |
---|
[1] | 1298 | |
---|
[40] | 1299 | ssh ${remote_username}@${remote_addres} "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] | 1300 | |
---|
[40] | 1301 | elif [[ $remote_host = ibmb || $remote_host = ibmh ]] |
---|
| 1302 | then |
---|
[1] | 1303 | |
---|
[40] | 1304 | print "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] | 1305 | |
---|
[181] | 1306 | elif [[ $remote_host = lcsgib || $remote_host = lcsgih ]] |
---|
| 1307 | then |
---|
| 1308 | |
---|
| 1309 | print ". /usr/share/modules/init/bash; module load mvapich/mvapich-0.9.9-intel; 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 |
---|
| 1310 | # print ". /usr/share/modules/init/bash; module load mvapich2/1.2-intel; 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 |
---|
| 1311 | |
---|
[40] | 1312 | elif [[ $remote_host = lctit ]] |
---|
| 1313 | then |
---|
[1] | 1314 | |
---|
[40] | 1315 | echo " " > ${remote_host}_last_make_protokoll |
---|
| 1316 | while [[ $(cat ${remote_host}_last_make_protokoll | grep -c "Forwarding to N1GE") = 0 ]] |
---|
| 1317 | do |
---|
| 1318 | 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 |
---|
| 1319 | done |
---|
[1] | 1320 | |
---|
[40] | 1321 | else |
---|
[1] | 1322 | |
---|
[40] | 1323 | 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 |
---|
[1] | 1324 | |
---|
[40] | 1325 | fi |
---|
[1] | 1326 | |
---|
[40] | 1327 | if [[ $(grep -c MAKE_ERROR ${remote_host}_last_make_protokoll) != 0 ]] |
---|
[1] | 1328 | then |
---|
[40] | 1329 | printf "\a\n +++ error(s) occurred during compiling or linking on host \"$remote_host\" " |
---|
| 1330 | if [[ $silent = false ]] |
---|
| 1331 | then |
---|
| 1332 | answer=dummy |
---|
| 1333 | printf "\n" |
---|
| 1334 | while [[ "$answer" != c && "$answer" != k ]] |
---|
| 1335 | do |
---|
| 1336 | printf " >>> continue / list errors / kill mbuild (c/l/k) ? " |
---|
| 1337 | read answer |
---|
| 1338 | if [[ "$answer" = l ]] |
---|
| 1339 | then |
---|
| 1340 | more ${remote_host}_last_make_protokoll |
---|
| 1341 | fi |
---|
| 1342 | done |
---|
| 1343 | if [[ $answer = k ]] |
---|
[1] | 1344 | then |
---|
[40] | 1345 | locat=user_abort; exit |
---|
[1] | 1346 | fi |
---|
| 1347 | fi |
---|
| 1348 | fi |
---|
| 1349 | |
---|
| 1350 | |
---|
| 1351 | |
---|
[40] | 1352 | # NEUE VERSION AUF REMOTE-RECHNER ZUSAMMENPACKEN |
---|
| 1353 | printf "\n *** tar update on remote host ..." |
---|
| 1354 | if [[ $remote_host != lctit ]] |
---|
| 1355 | then |
---|
[181] | 1356 | ssh ${remote_username}@${remote_addres} "cd ${remote_md}; chmod u+w *; tar -cf ${mainprog}_current_version.tar ${mainprog} *.f90 *.o *.mod" |
---|
[40] | 1357 | else |
---|
| 1358 | # TIT ERLAUBT NUR DIE AUSFÜHRUNG GANZ BESTIMMTER KOMMANDOS |
---|
| 1359 | # MIT SSH, DESHALB AUFRUF PER PIPE |
---|
[181] | 1360 | print "cd ${remote_md}; chmod u+w *; tar -cf ${mainprog}_current_version.tar ${mainprog} *.f90 *.o *.mod" | ssh ${remote_username}@${remote_addres} 2>&1 |
---|
[40] | 1361 | fi |
---|
[1] | 1362 | |
---|
| 1363 | |
---|
[40] | 1364 | # AKTUELLES VERSIONSVERZEICHNIS AUF REMOTE-RECHNER BEREINIGEN |
---|
| 1365 | # printf "\n *** \"make clean\" on remote host ..." |
---|
| 1366 | # ssh ${remote_username}@${remote_addres} "cd ${remote_md}; make clean; rm ${mainprog}_sources.tar; rm *.f90 Makefile" |
---|
| 1367 | # printf "\n" |
---|
[1] | 1368 | |
---|
| 1369 | |
---|
[25] | 1370 | |
---|
| 1371 | |
---|
[22] | 1372 | # GLEICHE AKTIONEN FUER DIE UTILITY-PROGRAMME DURCHFUEHREN |
---|
| 1373 | # AKTUELLE QUELLTEXTVERSION INS REMOTE-QUELLTEXTVERZEICHNIS KOPIEREN |
---|
| 1374 | # FALLS DIESES NOCH NICHT EXISTIERT, WIRD ES ERZEUGT |
---|
[40] | 1375 | elif [[ $compile_utility_programs = true ]] |
---|
[22] | 1376 | then |
---|
| 1377 | |
---|
[24] | 1378 | printf "\n\n" |
---|
[27] | 1379 | echo " *** copying scripts and utility programs to \"${remote_addres}:${remote_ud}/\" " |
---|
| 1380 | cd ${local_source_path}/../SCRIPTS |
---|
[22] | 1381 | |
---|
| 1382 | if [[ $remote_host != lctit ]] |
---|
| 1383 | then |
---|
[24] | 1384 | 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)" |
---|
[22] | 1385 | else |
---|
| 1386 | # TIT ERLAUBT NUR DIE AUSFÜHRUNG GANZ BESTIMMTER KOMMANDOS |
---|
| 1387 | # MIT SSH, DESHALB AUFRUF PER PIPE |
---|
[24] | 1388 | 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 |
---|
[22] | 1389 | fi |
---|
| 1390 | |
---|
[27] | 1391 | # KOPIEREN DER SCRIPTE |
---|
[22] | 1392 | if [[ $local_host = decalpha ]] |
---|
| 1393 | then |
---|
| 1394 | # DECALPHA BENUTZT BEI NICHTANGABE DES VOLLSTÄNDIGEN PFADES |
---|
| 1395 | # IRGENDEIN ANDERES SCP (WAS NICHT FUNKTIONIERT). AUSSERDEM |
---|
| 1396 | # KOENNEN DOLLAR-ZEICHEN NICHT BENUTZT WERDEN |
---|
| 1397 | remote_ud=`echo $remote_ud | sed 's/\$HOME\///'` |
---|
[27] | 1398 | /bin/scp batch_scp mbuild mrun subjob ${remote_username}@${remote_addres}:${remote_ud}/../SCRIPTS > /dev/null |
---|
| 1399 | else |
---|
[28] | 1400 | scp batch_scp mbuild mrun subjob ${remote_username}@${remote_addres}:${remote_ud}/../SCRIPTS > /dev/null |
---|
[27] | 1401 | fi |
---|
| 1402 | |
---|
| 1403 | cd - > /dev/null |
---|
| 1404 | cd ${local_source_path}/../UTIL |
---|
| 1405 | |
---|
| 1406 | |
---|
| 1407 | # KOPIEREN DER UTILITY-PROGRAMME |
---|
| 1408 | if [[ $local_host = decalpha ]] |
---|
| 1409 | then |
---|
| 1410 | # DECALPHA BENUTZT BEI NICHTANGABE DES VOLLSTÄNDIGEN PFADES |
---|
| 1411 | # IRGENDEIN ANDERES SCP (WAS NICHT FUNKTIONIERT). AUSSERDEM |
---|
| 1412 | # KOENNEN DOLLAR-ZEICHEN NICHT BENUTZT WERDEN |
---|
| 1413 | remote_ud=`echo $remote_ud | sed 's/\$HOME\///'` |
---|
[24] | 1414 | /bin/scp Makefile *.f90 ${remote_username}@${remote_addres}:${remote_ud} > /dev/null |
---|
[22] | 1415 | else |
---|
[24] | 1416 | scp Makefile *.f90 ${remote_username}@${remote_addres}:${remote_ud} > /dev/null |
---|
[22] | 1417 | fi |
---|
| 1418 | |
---|
| 1419 | |
---|
| 1420 | |
---|
| 1421 | # MAKE MIT ZUVOR ERMITTELTEN OPTIONEN AUF REMOTE RECHNER AUSFUEHREN |
---|
| 1422 | # KOMMANDOUEBERGABE AN SSH PER PIPE, DA SO DIE SYSTEM- UND |
---|
| 1423 | # BENUTZERPROFILE VOLLSTAENDIG AUSGEFUEHRT WERDEN (SONST FEHLEN MAKE |
---|
| 1424 | # Z.B. DIE PFADE ZUM COMPILER) |
---|
| 1425 | echo " *** execute \"make\" on remote host" |
---|
| 1426 | |
---|
| 1427 | if [[ $remote_host = nech ]] |
---|
| 1428 | then |
---|
[27] | 1429 | make_call_string="sxmake F90=$compiler_name F90_SER=$compiler_name_ser COPT=\"$cpp_options\" F90FLAGS=\"$compiler_options\" LDFLAGS=\"$loader_options\" " |
---|
[22] | 1430 | else |
---|
[27] | 1431 | make_call_string="make F90=$compiler_name F90_SER=$compiler_name_ser COPT=\"$cpp_options\" F90FLAGS=\"$compiler_options\" LDFLAGS=\"$loader_options\" " |
---|
[22] | 1432 | fi |
---|
| 1433 | |
---|
| 1434 | if [[ $remote_host = ibms || $remote_host = ibmy ]] |
---|
| 1435 | then |
---|
| 1436 | |
---|
[25] | 1437 | ssh ${remote_username}@${remote_addres} "cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" |
---|
[22] | 1438 | |
---|
| 1439 | elif [[ $remote_host = ibmb || $remote_host = ibmh ]] |
---|
| 1440 | then |
---|
| 1441 | |
---|
[25] | 1442 | print "export OBJECT_MODE=64; cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh ${remote_username}@${remote_addres} |
---|
[22] | 1443 | |
---|
| 1444 | elif [[ $remote_host = lctit ]] |
---|
| 1445 | then |
---|
| 1446 | |
---|
| 1447 | echo " " > ${remote_host}_last_make_protokoll |
---|
| 1448 | while [[ $(cat ${remote_host}_last_make_protokoll | grep -c "Forwarding to N1GE") = 0 ]] |
---|
| 1449 | do |
---|
| 1450 | print "cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll |
---|
| 1451 | done |
---|
| 1452 | |
---|
| 1453 | else |
---|
| 1454 | |
---|
| 1455 | print "cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll |
---|
| 1456 | |
---|
| 1457 | fi |
---|
| 1458 | |
---|
| 1459 | fi # ENDE UEBERSETZUNG DER UTILITY-PROGRAMME |
---|
| 1460 | |
---|
[75] | 1461 | rm -rf ${remote_host}_last_make_protokoll |
---|
[22] | 1462 | |
---|
[1] | 1463 | # NUR AUF EINEM HLRN-RECHNER UEBERSETZEN |
---|
| 1464 | [[ $remote_host = ibmb || $remote_host = ibmh ]] && ibm_hb_done=true |
---|
| 1465 | |
---|
| 1466 | else |
---|
| 1467 | |
---|
[40] | 1468 | if [[ $compile_utility_programs = false ]] |
---|
| 1469 | then |
---|
[1] | 1470 | |
---|
[40] | 1471 | # MAKE MIT ZUVOR ERMITTELTEN OPTIONEN AUF LOKALEM RECHNER AUSFUEHREN |
---|
| 1472 | echo " " |
---|
| 1473 | echo " *** execute \"make\" on local host" |
---|
[1] | 1474 | |
---|
[40] | 1475 | make PROG=$mainprog F90=$compiler_name COPT="$cpp_options" F90FLAGS="$compiler_options" LDFLAGS="$loader_options" 2>&1 | tee ${remote_host}_last_make_protokoll |
---|
| 1476 | |
---|
| 1477 | if [[ $? != 0 ]] |
---|
[1] | 1478 | then |
---|
[40] | 1479 | printf "\a\n +++ error(s) occurred during compiling or linking on host \"$remote_host\" " |
---|
| 1480 | if [[ $silent = false ]] |
---|
| 1481 | then |
---|
| 1482 | answer=dummy |
---|
| 1483 | printf "\n" |
---|
| 1484 | while [[ "$answer" != c && "$answer" != k ]] |
---|
| 1485 | do |
---|
| 1486 | printf " >>> continue / list errors / kill mbuild (c/l/k) ? " |
---|
| 1487 | read answer |
---|
| 1488 | if [[ "$answer" = l ]] |
---|
| 1489 | then |
---|
| 1490 | more ${remote_host}_last_make_protokoll |
---|
| 1491 | fi |
---|
| 1492 | done |
---|
| 1493 | if [[ $answer = k ]] |
---|
[1] | 1494 | then |
---|
[40] | 1495 | locat=user_abort; exit |
---|
[1] | 1496 | fi |
---|
| 1497 | fi |
---|
| 1498 | fi |
---|
| 1499 | |
---|
| 1500 | |
---|
[40] | 1501 | # NEUE VERSION AUF LOKALEM RECHNER ZUSAMMENPACKEN |
---|
| 1502 | printf "\n *** tar update on local host ..." |
---|
| 1503 | tar -cf ${mainprog}_current_version.tar *.$suf *.o *.mod |
---|
[1] | 1504 | |
---|
[22] | 1505 | |
---|
| 1506 | # COMPILE THE UTILITY PROGRAMS |
---|
[40] | 1507 | elif [[ $compile_utility_programs = true ]] |
---|
[22] | 1508 | then |
---|
| 1509 | printf "\n\n" |
---|
| 1510 | echo " *** compiling the utility programs ..." |
---|
| 1511 | cd ${local_source_path}/../UTIL |
---|
[35] | 1512 | make F90=$compiler_name F90_SER=$compiler_name_ser COPT="$cpp_options" F90FLAGS="$compiler_options" LDFLAGS="$loader_options" |
---|
[22] | 1513 | cd - > /dev/null |
---|
| 1514 | fi |
---|
| 1515 | |
---|
| 1516 | |
---|
[1] | 1517 | # NUR EINMAL AUF LCMUK UEBERSETZEN |
---|
| 1518 | [[ $remote_host = lcmuk ]] && lcmuk_done=true |
---|
| 1519 | |
---|
| 1520 | fi |
---|
| 1521 | |
---|
| 1522 | fi |
---|
| 1523 | done |
---|
| 1524 | |
---|
| 1525 | |
---|
| 1526 | if [[ $host_found = false ]] |
---|
| 1527 | then |
---|
| 1528 | if [[ $host = all ]] |
---|
| 1529 | then |
---|
| 1530 | printf "\n +++ no hosts found in configuration file" |
---|
| 1531 | else |
---|
| 1532 | printf "\n +++ host \"$host\" not found in configuration file" |
---|
| 1533 | fi |
---|
| 1534 | locat=config_file; exit |
---|
| 1535 | fi |
---|
| 1536 | |
---|
| 1537 | |
---|
| 1538 | |
---|
| 1539 | # ABSCHLIESSENDE ARBEITEN |
---|
| 1540 | rm -f hosts_found_in_config_file |
---|
| 1541 | |
---|