[1] | 1 | #!/bin/ksh |
---|
[66] | 2 | # mbuild - Programmuebersetzungsscript |
---|
[169] | 3 | # $Id: mbuild 224 2009-01-13 17:58:15Z 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) |
---|
[206] | 96 | # 02/10/08 - Siggi - adapted for lcxt4 |
---|
[215] | 97 | # 14/11/08 - Siggi - update mechanism completely revised: source tarfile |
---|
| 98 | # remains in source directory, one depository per block |
---|
| 99 | # (given in the config-file) is created, always all files |
---|
| 100 | # from the source directory are copied to the respective |
---|
| 101 | # depository, no additional file checks are done any more |
---|
| 102 | # (version 2.1) |
---|
[224] | 103 | # 13/01/09 - Marcus- re-enable compilation more than once on lcmuk (as on |
---|
| 104 | # other machines) |
---|
[1] | 105 | |
---|
| 106 | |
---|
| 107 | |
---|
| 108 | # VARIABLENVEREINBARUNGEN + DEFAULTWERTE |
---|
[22] | 109 | compile_utility_programs=false |
---|
[1] | 110 | config_file=.mrun.config |
---|
[67] | 111 | fimm=false |
---|
[1] | 112 | host=all |
---|
| 113 | host_found=false |
---|
| 114 | locat=normal |
---|
| 115 | makefile="" |
---|
| 116 | remote_mode=interactive |
---|
| 117 | scirocco=false |
---|
| 118 | silent=false |
---|
| 119 | suf=f90 |
---|
| 120 | update=false |
---|
[83] | 121 | working_directory=`pwd` |
---|
[1] | 122 | |
---|
| 123 | typeset -i ih ihost=0 |
---|
| 124 | |
---|
[66] | 125 | typeset -R30 calltime |
---|
[1] | 126 | typeset -L20 column1 |
---|
| 127 | typeset -L50 column2 |
---|
| 128 | typeset -L70 column3 |
---|
[215] | 129 | typeset -L40 version="MBUILD 2.1 Rev$Rev: 224 $" |
---|
[1] | 130 | |
---|
| 131 | # FEHLERBEHANDLUNG |
---|
| 132 | # BEI EXIT: |
---|
[83] | 133 | trap 'rm -rf $working_directory/tmp_mbuild |
---|
[69] | 134 | if [[ $locat != normal ]] |
---|
[1] | 135 | then |
---|
| 136 | printf "\n\n +++ mbuild killed \n\n" |
---|
| 137 | else |
---|
| 138 | printf "\n\n *** mbuild finished \n\n" |
---|
| 139 | fi' exit |
---|
| 140 | |
---|
| 141 | |
---|
| 142 | # BEI TERMINAL-BREAK: |
---|
[83] | 143 | trap 'rm -rf $working_directory/tmp_mbuild |
---|
[69] | 144 | printf "\n\n +++ mbuild killed by \"^C\" \n\n" |
---|
[1] | 145 | exit |
---|
| 146 | ' 2 |
---|
| 147 | |
---|
| 148 | |
---|
[215] | 149 | tmp_mbuild=${working_directory}/tmp_mbuild |
---|
[1] | 150 | |
---|
| 151 | # SHELLSCRIPT-OPTIONEN EINLESEN |
---|
[22] | 152 | while getopts :c:h:m:rs:u option |
---|
[1] | 153 | do |
---|
| 154 | case $option in |
---|
| 155 | (c) config_file=$OPTARG;; |
---|
| 156 | (h) host=$OPTARG;; |
---|
| 157 | (m) makefile=$OPTARG;; |
---|
| 158 | (r) remote_mode=batch;; |
---|
| 159 | (s) suf=$OPTARG;; |
---|
[22] | 160 | (u) compile_utility_programs=true;; |
---|
[1] | 161 | (\?) printf "\n +++ unknown option $OPTARG \n"; |
---|
| 162 | locat=parameter; exit;; |
---|
| 163 | esac |
---|
| 164 | done |
---|
| 165 | |
---|
| 166 | |
---|
| 167 | |
---|
| 168 | # BATCH-MODE IST ZUR ZEIT NICHT FUNKTIONSFAEHIG |
---|
| 169 | if [[ $remote_mode = batch ]] |
---|
| 170 | then |
---|
| 171 | printf "\n +++ sorry, batch mode does not work! \n" |
---|
| 172 | locat=parameter; exit |
---|
| 173 | fi |
---|
| 174 | |
---|
| 175 | |
---|
| 176 | |
---|
[82] | 177 | # PRUEFEN, OB KONFIGURATIONS-DATEI VORHANDEN |
---|
| 178 | if [[ ! -f $config_file ]] |
---|
| 179 | then |
---|
| 180 | printf "\n +++ configuration file: " |
---|
| 181 | printf "\n $config_file" |
---|
| 182 | printf "\n does not exist" |
---|
| 183 | locat=configuration; exit |
---|
| 184 | fi |
---|
| 185 | |
---|
| 186 | |
---|
| 187 | |
---|
[1] | 188 | # LOKALEN RECHNER ERMITTELN |
---|
| 189 | local_host_real_name=$(hostname) |
---|
[69] | 190 | # local_addres=$(nslookup `hostname` 2>&1 | grep "Address:" | tail -1 | awk '{print $2}') |
---|
| 191 | |
---|
[1] | 192 | |
---|
[82] | 193 | |
---|
| 194 | # HOST-IDENTIFIER (local_host) AUS KONFIGURATIONSDATEI BESTIMMEN |
---|
| 195 | line="" |
---|
[215] | 196 | grep "%host_identifier" $config_file > $tmp_mbuild |
---|
[82] | 197 | while read line |
---|
| 198 | do |
---|
[116] | 199 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
[82] | 200 | then |
---|
| 201 | HOSTNAME=`echo $line | cut -d" " -s -f2` |
---|
| 202 | host_identifier=`echo $line | cut -d" " -s -f3` |
---|
[83] | 203 | if [[ $local_host_real_name = $HOSTNAME ]] |
---|
[82] | 204 | then |
---|
| 205 | local_host=$host_identifier |
---|
| 206 | break |
---|
| 207 | fi |
---|
| 208 | fi |
---|
[215] | 209 | done < $tmp_mbuild |
---|
[82] | 210 | |
---|
| 211 | if [[ "$local_host" = "" ]] |
---|
| 212 | then |
---|
| 213 | printf "\n +++ no host identifier found in configuration file \"$config_file\"" |
---|
| 214 | printf "\n for local host \"$local_host_real_name\"." |
---|
| 215 | printf "\n Please add line" |
---|
| 216 | printf "\n \"\%host_identifier $local_host_real_name <identifier>\"" |
---|
| 217 | printf "\n to the configuration file." |
---|
| 218 | locat=local_host; exit |
---|
| 219 | fi |
---|
| 220 | |
---|
| 221 | |
---|
| 222 | |
---|
[1] | 223 | [[ $local_host_real_name = scirocco ]] && scirocco=true |
---|
[67] | 224 | [[ $local_host_real_name = fimm.bccs.uib.no ]] && fimm=true |
---|
[1] | 225 | |
---|
| 226 | |
---|
| 227 | |
---|
| 228 | if [[ $local_host != ibms ]] |
---|
| 229 | then |
---|
| 230 | config_file=$PWD/$config_file |
---|
| 231 | else |
---|
| 232 | config_file=`pwd`/$config_file |
---|
| 233 | fi |
---|
| 234 | |
---|
| 235 | |
---|
| 236 | |
---|
| 237 | # BENUTZERNAMEN AUF LOKALEM RECHNER AUS KONFIGURATIONSDATEI ERMITTELN |
---|
| 238 | line="" |
---|
[215] | 239 | grep " $local_host" $config_file | grep "%remote_username" > $tmp_mbuild |
---|
[69] | 240 | while read line |
---|
[1] | 241 | do |
---|
[116] | 242 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
[1] | 243 | then |
---|
| 244 | local_username=`echo $line | cut -d" " -s -f2` |
---|
| 245 | fi |
---|
[215] | 246 | done < $tmp_mbuild |
---|
[1] | 247 | |
---|
[82] | 248 | |
---|
[1] | 249 | if [[ "$local_username" = "" ]] |
---|
| 250 | then |
---|
| 251 | printf "\n +++ no user name found in configuration file" |
---|
| 252 | printf "\n for local host \"$local_host\" " |
---|
| 253 | locat=config_file; exit |
---|
| 254 | fi |
---|
| 255 | |
---|
| 256 | |
---|
[5] | 257 | # LOKALEN QUELLTEXTPFAD ERMITTELN. |
---|
| 258 | # ZUERST PRUEFEN, OB EIN GLOBALER QUELLTEXTPFAD FUER ALLE RECHNER |
---|
| 259 | # VEREINBART WURDE. |
---|
| 260 | # DAZU ZUNAECHST ALLE IN DER KONFIGURATIONSDATEI VEREINBARTEN GLOBALEN |
---|
| 261 | # VARIABLEN SETZEN, WEIL DIESE EVTL. IN PFADNAMEN VERWENDET WERDEN |
---|
| 262 | line="" |
---|
[215] | 263 | grep "%" $config_file > $tmp_mbuild |
---|
[69] | 264 | while read line |
---|
[5] | 265 | do |
---|
[116] | 266 | if [[ "$line" != "" && "$(echo $line | cut -d" " -s -f3)" = "" && $(echo $line | cut -c1) != "#" ]] |
---|
[1] | 267 | then |
---|
[5] | 268 | var=`echo $line | cut -d" " -s -f1 | cut -c2-` |
---|
| 269 | value=`echo $line | cut -d" " -s -f2` |
---|
[8] | 270 | eval export $var=\$value |
---|
[9] | 271 | # eval echo \" $var=\$$var \" # AUSGABE ZU TESTZWECKEN |
---|
[1] | 272 | fi |
---|
[215] | 273 | done < $tmp_mbuild |
---|
[1] | 274 | |
---|
[5] | 275 | # NUN PRUEFEN, OB EIN GLOBALER QUELLTEXTPFAD VEREINBART WURDE |
---|
[1] | 276 | line="" |
---|
[215] | 277 | grep "%source_path" $config_file > $tmp_mbuild |
---|
[69] | 278 | while read line |
---|
[1] | 279 | do |
---|
| 280 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 281 | then |
---|
| 282 | if [[ "$(echo $line | cut -d" " -s -f3)" = "" ]] |
---|
| 283 | then |
---|
| 284 | global_source_path=`echo $line | cut -d" " -s -f2` |
---|
| 285 | fi |
---|
| 286 | fi |
---|
[215] | 287 | done < $tmp_mbuild |
---|
[1] | 288 | |
---|
| 289 | line="" |
---|
[215] | 290 | grep " $local_host" $config_file | grep "%source_path" > $tmp_mbuild |
---|
[69] | 291 | while read line |
---|
[1] | 292 | do |
---|
| 293 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 294 | then |
---|
| 295 | local_source_path=`echo $line | cut -d" " -s -f2` |
---|
| 296 | fi |
---|
[215] | 297 | done < $tmp_mbuild |
---|
[1] | 298 | |
---|
| 299 | if [[ "$local_source_path" = "" ]] |
---|
| 300 | then |
---|
| 301 | if [[ "$global_source_path" != "" ]] |
---|
| 302 | then |
---|
| 303 | local_source_path=$global_source_path |
---|
| 304 | else |
---|
| 305 | printf "\n +++ no source path found in configuration file" |
---|
| 306 | printf "\n for local host \"$local_host\" " |
---|
| 307 | printf "\n please set \"\%source_path\" in configuration file" |
---|
| 308 | locat=config_file; exit |
---|
| 309 | fi |
---|
| 310 | fi |
---|
| 311 | eval local_source_path=$local_source_path |
---|
[8] | 312 | eval local_source_path=$local_source_path |
---|
[1] | 313 | |
---|
| 314 | |
---|
[215] | 315 | |
---|
| 316 | # GLOBALEN DEPOSITORY-PFAD ERMITTELN |
---|
[1] | 317 | line="" |
---|
[215] | 318 | grep "%depository_path" $config_file > $tmp_mbuild |
---|
[69] | 319 | while read line |
---|
[1] | 320 | do |
---|
| 321 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 322 | then |
---|
| 323 | if [[ "$(echo $line | cut -d" " -s -f3)" = "" ]] |
---|
| 324 | then |
---|
| 325 | global_depository_path=`echo $line | cut -d" " -s -f2` |
---|
| 326 | fi |
---|
| 327 | fi |
---|
[215] | 328 | done < $tmp_mbuild |
---|
[1] | 329 | |
---|
| 330 | |
---|
| 331 | |
---|
[5] | 332 | # PRUEFEN, OB IN KONFIGURATIONSDATEI EIN HAUPTPROGRAMM |
---|
| 333 | # VEREINBART WURDE |
---|
| 334 | if [[ $(grep -c "%mainprog" $config_file) != 1 ]] |
---|
| 335 | then |
---|
| 336 | printf "\n +++ no main program or more than one main program defined" |
---|
| 337 | printf "\n in configuration file" |
---|
| 338 | locat=configuration; exit |
---|
| 339 | else |
---|
| 340 | line=`grep "%mainprog" $config_file` |
---|
| 341 | if [[ "$line" = "" || $(echo $line | cut -c1) = "#" ]] |
---|
| 342 | then |
---|
| 343 | printf "\n +++ no main program defined in configuration file" |
---|
| 344 | locat=configuration; exit |
---|
| 345 | fi |
---|
| 346 | mainprog=`echo $line | cut -d" " -s -f2 | cut -d"." -f1` |
---|
| 347 | fi |
---|
| 348 | |
---|
| 349 | |
---|
| 350 | |
---|
[1] | 351 | # MAKEFILE vorhanden |
---|
| 352 | [[ "$makefile" = "" ]] && makefile=$local_source_path/Makefile |
---|
| 353 | if [[ ! -f $makefile ]] |
---|
| 354 | then |
---|
| 355 | printf "\n +++ makefile: " |
---|
| 356 | printf "\n $makefile" |
---|
| 357 | printf "\n does not exist" |
---|
| 358 | locat=makefile; exit |
---|
| 359 | fi |
---|
| 360 | |
---|
| 361 | |
---|
| 362 | # HEADER-AUSGABE (TEIL1: MELDUNGEN UEBER LOKALEN RECHNER) |
---|
| 363 | calltime=$(date) |
---|
| 364 | printf "\n" |
---|
| 365 | printf "#------------------------------------------------------------------------# \n" |
---|
| 366 | printf "| $version$calltime | \n" |
---|
| 367 | printf "| | \n" |
---|
| 368 | column1="called on:"; column2=$local_host_real_name |
---|
| 369 | printf "| $column1$column2 | \n" |
---|
| 370 | column1="local username:"; column2=$local_username |
---|
| 371 | printf "| $column1$column2 | \n" |
---|
| 372 | column1="local IP-addres:"; column2=$local_addres |
---|
| 373 | printf "| $column1$column2 | \n" |
---|
| 374 | column1="config file:"; column2=$config_file |
---|
| 375 | printf "| $column1$column2 | \n" |
---|
| 376 | column1="makefile:"; column2=$makefile |
---|
| 377 | printf "| $column1$column2 | \n" |
---|
| 378 | column1="local source path:"; column2=$local_source_path |
---|
| 379 | printf "| $column1$column2 | \n" |
---|
| 380 | printf "#------------------------------------------------------------------------# \n" |
---|
| 381 | |
---|
| 382 | # printf "| | \n" |
---|
| 383 | |
---|
| 384 | |
---|
[40] | 385 | if [[ $compile_utility_programs = false ]] |
---|
| 386 | then |
---|
[1] | 387 | |
---|
[40] | 388 | # IN JEDEM FALL ALLEN DATEIEN WRITE-PERMIT GEBEN, DAMIT ES AUF |
---|
| 389 | # DEN REMOTE-RECHNERN NICHT EVTL. ZU PROBLEMEN BEIM UEBERSCHREIBEN KOMMT |
---|
[215] | 390 | cd $local_source_path |
---|
| 391 | printf "\n\n *** tar of makefile and source files in $local_source_path" |
---|
[40] | 392 | tar -cf ${mainprog}_sources.tar Makefile *.$suf |
---|
| 393 | printf "\n" |
---|
[1] | 394 | |
---|
[40] | 395 | fi |
---|
[1] | 396 | |
---|
| 397 | |
---|
[40] | 398 | |
---|
[1] | 399 | # BESTAETIGUNG ZUM WEITERMACHEN EINHOLEN |
---|
| 400 | if [[ $host = all ]] |
---|
| 401 | then |
---|
| 402 | printf "\n *** updates will be made for ALL hosts found in" |
---|
| 403 | printf "\n the configuration file" |
---|
| 404 | else |
---|
| 405 | printf "\n *** update will be made for host \"$host\" " |
---|
| 406 | fi |
---|
| 407 | |
---|
| 408 | if [[ $silent = false ]] |
---|
| 409 | then |
---|
| 410 | answer=dummy |
---|
| 411 | printf "\n\n" |
---|
| 412 | while [[ "$answer" != y && "$answer" != Y && "$answer" != n && "$answer" != N ]] |
---|
| 413 | do |
---|
| 414 | printf " >>> continue (y/n) ? " |
---|
| 415 | read answer |
---|
| 416 | done |
---|
| 417 | if [[ $answer = n || $answer = N ]] |
---|
| 418 | then |
---|
| 419 | locat=user_abort; exit |
---|
| 420 | fi |
---|
| 421 | fi |
---|
| 422 | |
---|
| 423 | |
---|
| 424 | |
---|
| 425 | |
---|
| 426 | # GENERIERUNG DER AKTUELLEN MODELLVERSION FUER ALLE RECHNER-/UEBERSETZUNGS- |
---|
| 427 | # VERSIONEN, DIE IN DER KONFIGURATIONSDATEI GEFUNDEN WERDEN |
---|
| 428 | printf "\n *** scanning configuration file for host(s) ..." |
---|
| 429 | |
---|
[215] | 430 | grep %fopts $config_file > $tmp_mbuild |
---|
[69] | 431 | while read line |
---|
[1] | 432 | do |
---|
| 433 | # KOMMENTARZEILEN UEBERSPRINGEN |
---|
| 434 | [[ $(echo $line | cut -c1) = "#" ]] && continue |
---|
| 435 | (( ihost = ihost + 1 )) |
---|
| 436 | hostline[$ihost]="$line" |
---|
[215] | 437 | done < $tmp_mbuild |
---|
[1] | 438 | |
---|
| 439 | |
---|
| 440 | while (( ih < ihost )) |
---|
| 441 | do |
---|
| 442 | |
---|
| 443 | (( ih = ih + 1 )) |
---|
| 444 | |
---|
| 445 | # REMOTE-RECHNER UND UEBERSETZUNGS-VERSION FESTSTELLEN |
---|
| 446 | # NUR WEITERMACHEN, WENN ENTSPRECHENDER REMOTE-RECHNER MITTELS |
---|
| 447 | # SHELLSCRIPT-OPTION AUCH AUSGEWAEHLT WURDE |
---|
| 448 | remote_host_string=`echo ${hostline[$ih]} | cut -d" " -s -f3-` |
---|
| 449 | remote_host=`echo $remote_host_string | cut -d" " -f1` |
---|
| 450 | if [[ $host != all ]] |
---|
| 451 | then |
---|
| 452 | [[ $remote_host != $host ]] && continue |
---|
| 453 | fi |
---|
| 454 | host_found=true |
---|
| 455 | condition1=`echo $remote_host_string | cut -d" " -s -f2` |
---|
| 456 | if [[ $condition1 = $remote_host ]] |
---|
| 457 | then |
---|
| 458 | condition1="" |
---|
| 459 | else |
---|
| 460 | condition2=`echo $remote_host_string | cut -d" " -s -f3` |
---|
| 461 | fi |
---|
| 462 | |
---|
[82] | 463 | netcdf_inc="" |
---|
| 464 | netcdf_lib="" |
---|
[1] | 465 | |
---|
| 466 | # IP-ADRESSE DES REMOTE-RECHNERS BESTIMMEN |
---|
| 467 | case $remote_host in |
---|
[116] | 468 | (lcmuk) remote_addres=130.75.105.2;; |
---|
[181] | 469 | (lcsgib) remote_addres=130.73.232.102;; |
---|
[210] | 470 | (lcsgih) remote_addres=130.75.4.103;; |
---|
[83] | 471 | (lctit) remote_addres=172.17.75.161;; |
---|
[206] | 472 | (lcxt4) remote_addres=129.177.20.113;; |
---|
[83] | 473 | (decalpha) remote_addres=165.132.26.56;; |
---|
| 474 | (ibmb) remote_addres=130.73.230.10;; |
---|
| 475 | (ibmh) remote_addres=130.75.4.10;; |
---|
| 476 | (ibms) remote_addres=150.183.5.101;; |
---|
| 477 | (ibmy) remote_addres=165.132.26.58;; |
---|
| 478 | (nech) remote_addres=136.172.44.192;; |
---|
| 479 | (neck) remote_addres=133.5.178.11;; |
---|
| 480 | (ground.yonsei.ac.kr) remote_addres=134.75.155.33;; |
---|
| 481 | (*) if [[ $local_host != $remote_host ]] |
---|
[1] | 482 | then |
---|
[83] | 483 | printf "\n +++ remote host \"$remote_host\" unknown"; |
---|
| 484 | printf "\n please inform S. Raasch!" |
---|
[1] | 485 | fi;; |
---|
| 486 | esac |
---|
| 487 | |
---|
| 488 | |
---|
| 489 | # REMOTE-USERNAMEN ERMITTELN |
---|
| 490 | line="" |
---|
[116] | 491 | found=false |
---|
[215] | 492 | grep "$remote_host_string" $config_file | grep "%remote_username" > $tmp_mbuild |
---|
[69] | 493 | while read line1 |
---|
[1] | 494 | do |
---|
[116] | 495 | |
---|
[1] | 496 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
| 497 | then |
---|
| 498 | line="$line1" |
---|
| 499 | fi |
---|
[116] | 500 | |
---|
| 501 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 502 | then |
---|
| 503 | remote_username=`echo $line | cut -d" " -s -f2` |
---|
| 504 | found=true |
---|
| 505 | fi |
---|
| 506 | |
---|
[215] | 507 | done < $tmp_mbuild |
---|
[1] | 508 | |
---|
[116] | 509 | if [[ $found = false ]] |
---|
[1] | 510 | then |
---|
| 511 | printf "\n +++ no remote username found in configuration file" |
---|
| 512 | printf "\n for \"$remote_host_string\" " |
---|
| 513 | locat=config_file; exit |
---|
| 514 | fi |
---|
| 515 | |
---|
| 516 | |
---|
| 517 | # REMOTE-QUELLTEXTPFAD ERMITTELN |
---|
| 518 | line="" |
---|
[54] | 519 | remote_source_path="" |
---|
[215] | 520 | grep "$remote_host_string" $config_file | grep "%source_path" > $tmp_mbuild |
---|
[69] | 521 | while read line1 |
---|
[1] | 522 | do |
---|
[116] | 523 | |
---|
[1] | 524 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
| 525 | then |
---|
| 526 | line="$line1" |
---|
| 527 | fi |
---|
[116] | 528 | |
---|
| 529 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 530 | then |
---|
| 531 | remote_source_path=`echo $line | cut -d" " -s -f2` |
---|
| 532 | fi |
---|
| 533 | |
---|
[215] | 534 | done < $tmp_mbuild |
---|
[1] | 535 | |
---|
| 536 | if [[ "$remote_source_path" = "" ]] |
---|
| 537 | then |
---|
| 538 | if [[ "$global_source_path" != "" ]] |
---|
| 539 | then |
---|
| 540 | remote_source_path=$global_source_path |
---|
| 541 | else |
---|
| 542 | printf "\n +++ no source path found in configuration file" |
---|
| 543 | printf "\n for \"$remote_host_string\" " |
---|
| 544 | locat=config_file; exit |
---|
| 545 | fi |
---|
| 546 | fi |
---|
| 547 | |
---|
[22] | 548 | remote_ud=${remote_source_path}/../UTIL |
---|
[24] | 549 | remote_ud=$(eval echo $remote_ud) |
---|
[1] | 550 | |
---|
[54] | 551 | |
---|
[1] | 552 | # REMOTE-PFAD FUER MAKE-DEPOSITORY ERMITTELN |
---|
[54] | 553 | remote_md="" |
---|
[1] | 554 | line="" |
---|
[215] | 555 | grep "$remote_host_string" $config_file | grep "%depository_path" > $tmp_mbuild |
---|
[69] | 556 | while read line1 |
---|
[1] | 557 | do |
---|
[116] | 558 | |
---|
[1] | 559 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
| 560 | then |
---|
| 561 | line="$line1" |
---|
| 562 | fi |
---|
[116] | 563 | |
---|
| 564 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 565 | then |
---|
| 566 | remote_md=`echo $line | cut -d" " -s -f2` |
---|
| 567 | fi |
---|
| 568 | |
---|
[215] | 569 | done < $tmp_mbuild |
---|
[1] | 570 | |
---|
| 571 | if [[ "$remote_md" = "" ]] |
---|
| 572 | then |
---|
| 573 | if [[ "$global_depository_path" != "" ]] |
---|
| 574 | then |
---|
| 575 | remote_md=$global_depository_path |
---|
| 576 | else |
---|
| 577 | printf "\n +++ no depository path found in configuration file" |
---|
| 578 | printf "\n for \"$remote_host_string\" " |
---|
| 579 | printf "\n please set \"\%depository_path\" in configuration file" |
---|
| 580 | locat=config_file; exit |
---|
| 581 | fi |
---|
| 582 | fi |
---|
| 583 | |
---|
[8] | 584 | remote_md=$(eval echo $remote_md) |
---|
[215] | 585 | [[ "$condition1" != "" ]] && remote_md=${remote_md}_$condition1 |
---|
| 586 | [[ "$condition2" != "" ]] && remote_md=${remote_md}_$condition2 |
---|
[1] | 587 | |
---|
[8] | 588 | |
---|
[1] | 589 | # COMPILERNAMEN ERMITTELN |
---|
| 590 | line="" |
---|
[116] | 591 | found=false |
---|
[215] | 592 | grep "$remote_host_string" $config_file | grep "%compiler_name " > $tmp_mbuild |
---|
[69] | 593 | while read line1 |
---|
[1] | 594 | do |
---|
[116] | 595 | |
---|
[1] | 596 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
| 597 | then |
---|
| 598 | line="$line1" |
---|
| 599 | fi |
---|
[116] | 600 | |
---|
| 601 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 602 | then |
---|
| 603 | compiler_name=`echo $line | cut -d" " -s -f2` |
---|
| 604 | found=true |
---|
| 605 | fi |
---|
| 606 | |
---|
[215] | 607 | done < $tmp_mbuild |
---|
[1] | 608 | |
---|
[116] | 609 | if [[ $found = false ]] |
---|
[1] | 610 | then |
---|
| 611 | printf "\n +++ no compiler name found in configuration file" |
---|
| 612 | printf "\n for \"$remote_host_string\" " |
---|
| 613 | locat=config_file; exit |
---|
| 614 | fi |
---|
| 615 | |
---|
| 616 | |
---|
[27] | 617 | # BEI BENUTZUNG EINES PARALLELEN COMPILERS MUSS AUCH EIN |
---|
| 618 | # SERIELLER COMPILERNAME ERMITTELT WERDEN |
---|
| 619 | if [[ $(echo $remote_host_string | grep -c parallel) = 1 ]] |
---|
| 620 | then |
---|
| 621 | line="" |
---|
[116] | 622 | found=false |
---|
[215] | 623 | grep "$remote_host_string" $config_file | grep "%compiler_name_ser" > $tmp_mbuild |
---|
[69] | 624 | while read line1 |
---|
[27] | 625 | do |
---|
[116] | 626 | |
---|
[27] | 627 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
| 628 | then |
---|
| 629 | line="$line1" |
---|
| 630 | fi |
---|
[116] | 631 | |
---|
| 632 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 633 | then |
---|
| 634 | compiler_name_ser=`echo $line | cut -d" " -s -f2` |
---|
| 635 | found=true |
---|
| 636 | fi |
---|
| 637 | |
---|
[215] | 638 | done < $tmp_mbuild |
---|
[1] | 639 | |
---|
[116] | 640 | if [[ $found = false ]] |
---|
[27] | 641 | then |
---|
[28] | 642 | printf "\n +++ no serial compiler name found in configuration file" |
---|
[27] | 643 | printf "\n for \"$remote_host_string\" " |
---|
| 644 | locat=config_file; exit |
---|
| 645 | fi |
---|
| 646 | else |
---|
| 647 | compiler_name_ser=$compiler_name |
---|
| 648 | fi |
---|
| 649 | |
---|
| 650 | |
---|
| 651 | |
---|
[82] | 652 | # PRAEPROZESSOR-OPTIONEN/DIREKTIVEN ERMITTELN |
---|
| 653 | line="" |
---|
[116] | 654 | found=false |
---|
[215] | 655 | grep "$remote_host_string" $config_file | grep "%cpp_options" > $tmp_mbuild |
---|
[82] | 656 | while read line1 |
---|
| 657 | do |
---|
[116] | 658 | |
---|
[82] | 659 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
| 660 | then |
---|
| 661 | line="$line1" |
---|
| 662 | fi |
---|
[116] | 663 | |
---|
| 664 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 665 | then |
---|
| 666 | # EVENTUELLE DOPPELPUNKTE AUS OPTIONSSTRING ENTFERNEN |
---|
| 667 | cpp_options=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` |
---|
| 668 | found=true |
---|
| 669 | fi |
---|
| 670 | |
---|
[215] | 671 | done < $tmp_mbuild |
---|
[116] | 672 | |
---|
| 673 | if [[ $found = false ]] |
---|
[82] | 674 | then |
---|
| 675 | printf "\n +++ no preprocessor options found in configuration file" |
---|
| 676 | printf "\n for \"$remote_host_string\" " |
---|
| 677 | locat=config_file; exit |
---|
| 678 | fi |
---|
| 679 | |
---|
[116] | 680 | |
---|
[82] | 681 | # RECHNERSPEZIFISCHE CPP-DIREKTIVEN HINZUFUEGEN |
---|
| 682 | for string in $remote_host_string |
---|
| 683 | do |
---|
| 684 | if [[ $(echo $remote_host | cut -c1-2) = lc && $(echo $string | cut -c1-2) = lc ]] |
---|
| 685 | then |
---|
| 686 | cpp_options="$cpp_options -D__lc " |
---|
[83] | 687 | elif [[ $(echo $remote_host | cut -c1-3) = ibm && $(echo $string | cut -c1-3) = ibm ]] |
---|
| 688 | then |
---|
| 689 | cpp_options="${cpp_options},-D__ibm" |
---|
| 690 | elif [[ $(echo $remote_host | cut -c1-3) = nec && $(echo $string | cut -c1-3) = nec ]] |
---|
| 691 | then |
---|
| 692 | cpp_options="${cpp_options} -D__nec" |
---|
[82] | 693 | else |
---|
[83] | 694 | if [[ $(echo $remote_host | cut -c1-3) = ibm ]] |
---|
| 695 | then |
---|
| 696 | cpp_options="${cpp_options},-D__$string" |
---|
| 697 | else |
---|
| 698 | cpp_options="$cpp_options -D__$string " |
---|
| 699 | fi |
---|
[82] | 700 | fi |
---|
| 701 | done |
---|
| 702 | |
---|
| 703 | |
---|
| 704 | |
---|
| 705 | # NETCDF-OPTIONEN ERMITTELN |
---|
| 706 | line="" |
---|
[215] | 707 | grep "$remote_host_string" $config_file | grep "%netcdf_inc" > $tmp_mbuild |
---|
[82] | 708 | while read line1 |
---|
| 709 | do |
---|
[116] | 710 | |
---|
[82] | 711 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
| 712 | then |
---|
| 713 | line="$line1" |
---|
| 714 | fi |
---|
[116] | 715 | |
---|
| 716 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 717 | then |
---|
| 718 | # EVENTUELLE DOPPELPUNKTE AUS OPTIONSSTRING ENTFERNEN |
---|
| 719 | netcdf_inc=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` |
---|
| 720 | fi |
---|
| 721 | |
---|
[215] | 722 | done < $tmp_mbuild |
---|
[82] | 723 | |
---|
| 724 | line="" |
---|
[215] | 725 | grep "$remote_host_string" $config_file | grep "%netcdf_lib" > $tmp_mbuild |
---|
[82] | 726 | while read line1 |
---|
| 727 | do |
---|
[116] | 728 | |
---|
[82] | 729 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
| 730 | then |
---|
| 731 | line="$line1" |
---|
| 732 | fi |
---|
[116] | 733 | |
---|
| 734 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 735 | then |
---|
| 736 | # EVENTUELLE DOPPELPUNKTE AUS OPTIONSSTRING ENTFERNEN |
---|
| 737 | netcdf_lib=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` |
---|
| 738 | fi |
---|
| 739 | |
---|
[215] | 740 | done < $tmp_mbuild |
---|
[82] | 741 | |
---|
| 742 | |
---|
| 743 | |
---|
[1] | 744 | # COMPILEROPTIONEN ERMITTELN |
---|
| 745 | line="" |
---|
[116] | 746 | found=false |
---|
[215] | 747 | grep "$remote_host_string" $config_file | grep "%fopts" > $tmp_mbuild |
---|
[69] | 748 | while read line1 |
---|
[1] | 749 | do |
---|
[116] | 750 | |
---|
[1] | 751 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
| 752 | then |
---|
| 753 | line="$line1" |
---|
| 754 | fi |
---|
[116] | 755 | |
---|
| 756 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 757 | then |
---|
| 758 | # EVENTUELLE DOPPELPUNKTE AUS DIREKTIVENSTRING ENTFERNEN |
---|
| 759 | compiler_options=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` |
---|
| 760 | found=true |
---|
| 761 | |
---|
| 762 | # NETCDF-INCLUDEVERZEICHNIS HINZUFUEGEN |
---|
| 763 | compiler_options="$compiler_options $netcdf_inc" |
---|
| 764 | fi |
---|
| 765 | |
---|
[215] | 766 | done < $tmp_mbuild |
---|
[116] | 767 | |
---|
| 768 | if [[ $found = false ]] |
---|
[1] | 769 | then |
---|
| 770 | printf "\n +++ no compiler options found in configuration file" |
---|
| 771 | printf "\n for \"$remote_host_string\" " |
---|
| 772 | locat=config_file; exit |
---|
| 773 | fi |
---|
[82] | 774 | |
---|
[1] | 775 | |
---|
| 776 | |
---|
[221] | 777 | # MPI LIBRARY ERMITTELN |
---|
| 778 | line="" |
---|
| 779 | found=false |
---|
| 780 | grep "$remote_host_string" $config_file | grep "%mpilib" > $tmp_mbuild |
---|
| 781 | while read line1 |
---|
| 782 | do |
---|
| 783 | |
---|
| 784 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
| 785 | then |
---|
| 786 | line="$line1" |
---|
| 787 | fi |
---|
| 788 | |
---|
| 789 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 790 | then |
---|
| 791 | # EVENTUELLE DOPPELPUNKTE AUS DIREKTIVENSTRING ENTFERNEN |
---|
| 792 | mpilib=`echo $line | cut -d" " -s -f2` |
---|
| 793 | found=true |
---|
| 794 | fi |
---|
| 795 | |
---|
| 796 | done < $tmp_mbuild |
---|
| 797 | |
---|
| 798 | [[ $found = false ]] && mpilib=mpt |
---|
| 799 | |
---|
| 800 | |
---|
| 801 | |
---|
| 802 | |
---|
[1] | 803 | # LADER-OPTIONEN ERMITTELN |
---|
| 804 | line="" |
---|
[116] | 805 | found=false |
---|
[215] | 806 | grep "$remote_host_string" $config_file | grep "%lopts" > $tmp_mbuild |
---|
[69] | 807 | while read line1 |
---|
[1] | 808 | do |
---|
[116] | 809 | |
---|
[1] | 810 | if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]] |
---|
| 811 | then |
---|
| 812 | line="$line1" |
---|
| 813 | fi |
---|
[116] | 814 | |
---|
| 815 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 816 | then |
---|
| 817 | # EVENTUELLE DOPPELPUNKTE AUS DIREKTIVENSTRING ENTFERNEN |
---|
| 818 | loader_options=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` |
---|
| 819 | found=true |
---|
| 820 | |
---|
| 821 | # NETCDF-LIBRARY HINZUFUEGEN |
---|
| 822 | loader_options="$loader_options $netcdf_lib" |
---|
| 823 | fi |
---|
| 824 | |
---|
[215] | 825 | done < $tmp_mbuild |
---|
[1] | 826 | |
---|
[116] | 827 | if [[ $found = false ]] |
---|
[1] | 828 | then |
---|
| 829 | printf "\n +++ no loader options found in configuration file" |
---|
| 830 | printf "\n for \"$remote_host_string\" " |
---|
| 831 | locat=config_file; exit |
---|
| 832 | fi |
---|
[82] | 833 | |
---|
[1] | 834 | |
---|
| 835 | printf "\n\n#------------------------------------------------------------------------# \n" |
---|
| 836 | if [[ $remote_host = $local_host ]] |
---|
| 837 | then |
---|
| 838 | column1="remote_host:"; column2="$remote_host (= local host!)" |
---|
| 839 | else |
---|
| 840 | column1="remote_host:"; column2=$remote_host |
---|
| 841 | fi |
---|
| 842 | printf "| $column1$column2 | \n" |
---|
| 843 | printf "| | \n" |
---|
| 844 | column1="conditions:"; column2="$condition1 $condition2" |
---|
| 845 | printf "| $column1$column2 | \n" |
---|
| 846 | column1="make depository:"; column2=$remote_md |
---|
| 847 | printf "| $column1$column2 | \n" |
---|
[215] | 848 | line=$(echo "$remote_md" | cut -c51-) |
---|
| 849 | while [[ "$line" != "" ]] |
---|
| 850 | do |
---|
| 851 | column1="" |
---|
| 852 | column2=$line |
---|
| 853 | printf "| $column1$column2 | \n" |
---|
| 854 | line=$(echo "$line" | cut -c51-) |
---|
| 855 | done |
---|
[25] | 856 | if [[ $compile_utility_programs = true ]] |
---|
| 857 | then |
---|
| 858 | column1="utility directory:"; column2=$remote_ud |
---|
| 859 | printf "| $column1$column2 | \n" |
---|
| 860 | fi |
---|
[1] | 861 | column1="username:"; column2=$remote_username |
---|
| 862 | printf "| $column1$column2 | \n" |
---|
| 863 | column1="addres:"; column2=$remote_addres |
---|
| 864 | printf "| $column1$column2 | \n" |
---|
| 865 | column1="compiler:"; column2=$compiler_name |
---|
| 866 | printf "| $column1$column2 | \n" |
---|
[28] | 867 | if [[ $compile_utility_programs = true ]] |
---|
| 868 | then |
---|
| 869 | column1="serial compiler:"; column2=$compiler_name_ser |
---|
| 870 | printf "| $column1$column2 | \n" |
---|
| 871 | fi |
---|
[1] | 872 | column1="cpp options:"; column2=$cpp_options |
---|
| 873 | printf "| $column1$column2 | \n" |
---|
| 874 | line=$(echo "$cpp_options" | cut -c51-) |
---|
| 875 | while [[ "$line" != "" ]] |
---|
| 876 | do |
---|
| 877 | column1="" |
---|
| 878 | column2=$line |
---|
| 879 | printf "| $column1$column2 | \n" |
---|
| 880 | line=$(echo "$line" | cut -c51-) |
---|
| 881 | done |
---|
| 882 | column1="compiler options:"; column2=$compiler_options |
---|
| 883 | printf "| $column1$column2 | \n" |
---|
| 884 | line=$(echo "$compiler_options" | cut -c51-) |
---|
| 885 | while [[ "$line" != "" ]] |
---|
| 886 | do |
---|
| 887 | column1="" |
---|
| 888 | column2=$line |
---|
| 889 | printf "| $column1$column2 | \n" |
---|
| 890 | line=$(echo "$line" | cut -c51-) |
---|
| 891 | done |
---|
[221] | 892 | if [[ $( echo $remote_host | cut -c1-5 ) = lcsgi ]] |
---|
| 893 | then |
---|
| 894 | column1="mpi library:"; column2=$mpilib |
---|
| 895 | printf "| $column1$column2 | \n" |
---|
| 896 | fi |
---|
[1] | 897 | column1="loader options:"; column2=$loader_options |
---|
| 898 | printf "| $column1$column2 | \n" |
---|
| 899 | line=$(echo "$loader_options" | cut -c51-) |
---|
| 900 | while [[ "$line" != "" ]] |
---|
| 901 | do |
---|
| 902 | column1="" |
---|
| 903 | column2=$line |
---|
| 904 | printf "| $column1$column2 | \n" |
---|
| 905 | line=$(echo "$line" | cut -c51-) |
---|
| 906 | done |
---|
| 907 | printf "#------------------------------------------------------------------------# \n" |
---|
| 908 | |
---|
| 909 | if [[ $silent = false ]] |
---|
| 910 | then |
---|
| 911 | answer=dummy |
---|
| 912 | printf "\n\n" |
---|
| 913 | while [[ "$answer" != y && "$answer" != Y && "$answer" != c && "$answer" != C && "$answer" != s && "$answer" != S && "$answer" != a && "$answer" != A ]] |
---|
| 914 | do |
---|
| 915 | printf " >>> continue (y(es)/c(ontinue)/a(bort)/s(skip)) ? " |
---|
| 916 | read answer |
---|
| 917 | done |
---|
| 918 | if [[ $answer = a || $answer = A ]] |
---|
| 919 | then |
---|
| 920 | locat=user_abort; exit |
---|
| 921 | fi |
---|
| 922 | if [[ $answer = c || $answer = C ]] |
---|
| 923 | then |
---|
| 924 | silent=false |
---|
| 925 | fi |
---|
| 926 | if [[ $answer = s || $answer = S ]] |
---|
| 927 | then |
---|
| 928 | continue |
---|
| 929 | fi |
---|
| 930 | fi |
---|
| 931 | |
---|
| 932 | |
---|
| 933 | if [[ $remote_mode = batch ]] |
---|
| 934 | then |
---|
| 935 | |
---|
| 936 | # BATCH-JOB PARAMETER SETZEN |
---|
| 937 | case $remote_host in |
---|
| 938 | (t3eb) queue=berte; memory=60; cputime=1000; xoption="-X 0";; |
---|
| 939 | (t3eh) queue=comp_t3e; memory=60; cputime=360;; |
---|
| 940 | (t3ej2) queue=normal; memory=60; cputime=1000; xoption="-X 0";; |
---|
[5] | 941 | (t3ej5|ground.yonsei.ac.kr) printf "\n --- remote host \"$remote_host\" does not allow batch jobs"; continue;; |
---|
[1] | 942 | esac |
---|
| 943 | |
---|
| 944 | |
---|
| 945 | # BATCH-JOB ZUSAMMENSTELLEN |
---|
| 946 | printf "\n *** creating batch-job for remote host" |
---|
| 947 | echo " " > mbuild_job |
---|
| 948 | |
---|
| 949 | # AUF CRAY-RECHNERN IN JUELICH WIRD KEIN BENUTZER-PROFILE AUSGEFUEHRT |
---|
| 950 | # DIES WIRD HIER GETAN, UM PFADE USW. ZU SETZEN |
---|
| 951 | if [[ $remote_host = t3ej2 ]] |
---|
| 952 | then |
---|
| 953 | echo "set +vx" >> mbuild_job |
---|
| 954 | echo ". .profile" >> mbuild_job |
---|
| 955 | echo "set -x" >> mbuild_job |
---|
| 956 | fi |
---|
| 957 | |
---|
| 958 | # AUF CRAY-RECHNERN GELADENE MODULE AUFLISTEN |
---|
| 959 | if [[ $host = t3eb || $host = t3eh || $host = t3ej2 ]] |
---|
| 960 | then |
---|
| 961 | echo "module list" >> mbuild_job |
---|
| 962 | fi |
---|
| 963 | |
---|
| 964 | |
---|
| 965 | # WECHSEL IN TEMPORAERES VERZEICHNIS |
---|
| 966 | echo "cd ${remote_md}" >> mbuild_job |
---|
| 967 | |
---|
| 968 | |
---|
| 969 | # AKTUELLE QUELLTEXTVERSION INS REMOTE-QUELLTEXTVERZEICHNIS KOPIEREN |
---|
| 970 | echo "scp ${local_username}@${local_addres}:~/modell/code_3dp/palm_current_version/${mainprog}_sources.tar ${mainprog}_sources.tar" >> mbuild_job |
---|
| 971 | # echo "[[ \$? != 0 ]] && (echo "+++ scp failed"; exit)" >> mbuild_job |
---|
| 972 | |
---|
| 973 | |
---|
| 974 | # FALLS VORHANDEN, LETZTE VERSION AUF DEM REMOTE-RECHNER AUSPACKEN |
---|
| 975 | echo "[[ -f ${mainprog}_current_version.tar ]] && tar -xvf ${mainprog}_current_version.tar" >> mbuild_job |
---|
| 976 | |
---|
| 977 | |
---|
| 978 | # AKTUELLE QUELLTEXTVERSION AUF REMOTE-RECHNER AUSPACKEN |
---|
| 979 | echo "tar -xvf ${mainprog}_sources.tar" >> mbuild_job |
---|
| 980 | |
---|
| 981 | |
---|
| 982 | # MAKE MIT ZUVOR ERMITTELTEN OPTIONEN AUF REMOTE RECHNER AUSFUEHREN |
---|
| 983 | echo "make PROG=$mainprog F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$compiler_options\" LDFLAGS=\"$loader_options\" " >> mbuild_job |
---|
| 984 | echo "chmod u+w *" >> mbuild_job |
---|
| 985 | |
---|
| 986 | # NEUE VERSION AUF REMOTE-RECHNER ZUSAMMENPACKEN |
---|
| 987 | echo "tar -cvf ${mainprog}_current_version.tar *.f90 *.o" >> mbuild_job |
---|
| 988 | |
---|
| 989 | |
---|
| 990 | # AKTUELLES VERSIONSVERZEICHNIS AUF REMOTE-RECHNER BEREINIGEN |
---|
| 991 | echo "make clean" >> mbuild_job |
---|
| 992 | echo "rm ${mainprog}_sources.tar" >> mbuild_job |
---|
| 993 | echo "rm *.f90 Makefile" >> mbuild_job |
---|
| 994 | |
---|
| 995 | |
---|
| 996 | |
---|
| 997 | # JOB MITTELS SUBJOB STARTEN |
---|
| 998 | printf "\n *** sending batch job to remote host" |
---|
| 999 | # subjob $xoption -h $remote_host -q $queue -m $memory -t $cputime -v mbuild_job |
---|
| 1000 | |
---|
| 1001 | |
---|
| 1002 | # JOBFILE LOESCHEN |
---|
| 1003 | # rm aljob |
---|
| 1004 | |
---|
| 1005 | else |
---|
| 1006 | |
---|
| 1007 | if [[ $remote_host != $local_host ]] |
---|
| 1008 | then |
---|
| 1009 | |
---|
[40] | 1010 | if [[ $compile_utility_programs = false ]] |
---|
[1] | 1011 | then |
---|
| 1012 | |
---|
[40] | 1013 | # AKTUELLE QUELLTEXTVERSION INS REMOTE-QUELLTEXTVERZEICHNIS KOPIEREN |
---|
| 1014 | # FALLS DIESES NOCH NICHT EXISTIERT, WIRD ES ERZEUGT |
---|
| 1015 | echo " *** copying \"${mainprog}_sources.tar\" to \"${remote_addres}:${remote_md}/\" " |
---|
| 1016 | if [[ $remote_host != lctit ]] |
---|
| 1017 | then |
---|
| 1018 | ssh ${remote_username}@${remote_addres} "[[ ! -d ${remote_md} ]] && (echo \" *** ${remote_md} will be created\"; mkdir -p ${remote_md})" |
---|
| 1019 | else |
---|
[206] | 1020 | # TIT ERLAUBT NUR DIE AUSFï¿œHRUNG GANZ BESTIMMTER KOMMANDOS |
---|
[40] | 1021 | # MIT SSH, DESHALB AUFRUF PER PIPE |
---|
| 1022 | print "[[ ! -d ${remote_md} ]] && (echo \" *** ${remote_md} will be created\"; mkdir -p ${remote_md})" | ssh ${remote_username}@${remote_addres} 2>&1 |
---|
| 1023 | fi |
---|
| 1024 | if [[ $local_host = decalpha ]] |
---|
| 1025 | then |
---|
[206] | 1026 | # DECALPHA BENUTZT BEI NICHTANGABE DES VOLLSTï¿œNDIGEN PFADES |
---|
[40] | 1027 | # IRGENDEIN ANDERES SCP (WAS NICHT FUNKTIONIERT). AUSSERDEM |
---|
| 1028 | # KOENNEN DOLLAR-ZEICHEN NICHT BENUTZT WERDEN |
---|
| 1029 | remote_md=`echo $remote_md | sed 's/\$HOME\///'` |
---|
[215] | 1030 | /bin/scp ${local_source_path}/${mainprog}_sources.tar ${remote_username}@${remote_addres}:${remote_md}/${mainprog}_sources.tar |
---|
[40] | 1031 | else |
---|
[215] | 1032 | scp ${local_source_path}/${mainprog}_sources.tar ${remote_username}@${remote_addres}:${remote_md}/${mainprog}_sources.tar |
---|
[40] | 1033 | fi |
---|
[1] | 1034 | |
---|
| 1035 | |
---|
| 1036 | |
---|
[40] | 1037 | # FALLS VORHANDEN, LETZTE VERSION AUF DEM REMOTE-RECHNER AUSPACKEN |
---|
| 1038 | echo " *** untar previous update on remote host, if existing" |
---|
| 1039 | if [[ $remote_host != lctit ]] |
---|
| 1040 | then |
---|
| 1041 | ssh ${remote_username}@${remote_addres} "cd ${remote_md}; [[ -f ${mainprog}_current_version.tar ]] && tar -xf ${mainprog}_current_version.tar" |
---|
| 1042 | else |
---|
[206] | 1043 | # TIT ERLAUBT NUR DIE AUSFï¿œHRUNG GANZ BESTIMMTER KOMMANDOS |
---|
[40] | 1044 | # MIT SSH, DESHALB AUFRUF PER PIPE |
---|
| 1045 | print "cd ${remote_md}; [[ -f ${mainprog}_current_version.tar ]] && tar -xf ${mainprog}_current_version.tar" | ssh ${remote_username}@${remote_addres} 2>&1 |
---|
| 1046 | fi |
---|
[1] | 1047 | |
---|
| 1048 | |
---|
[40] | 1049 | # AKTUELLE QUELLTEXTVERSION AUF REMOTE-RECHNER AUSPACKEN |
---|
| 1050 | echo " *** untar actual sources on remote host" |
---|
| 1051 | if [[ $remote_host != lctit ]] |
---|
| 1052 | then |
---|
| 1053 | ssh ${remote_username}@${remote_addres} "cd ${remote_md}; tar -xf ${mainprog}_sources.tar" |
---|
| 1054 | else |
---|
[206] | 1055 | # TIT ERLAUBT NUR DIE AUSFï¿œHRUNG GANZ BESTIMMTER KOMMANDOS |
---|
[40] | 1056 | # MIT SSH, DESHALB AUFRUF PER PIPE |
---|
| 1057 | print "cd ${remote_md}; tar -xf ${mainprog}_sources.tar" | ssh ${remote_username}@${remote_addres} 2>&1 |
---|
| 1058 | fi |
---|
[1] | 1059 | |
---|
| 1060 | |
---|
[40] | 1061 | # MAKE MIT ZUVOR ERMITTELTEN OPTIONEN AUF REMOTE RECHNER AUSFUEHREN |
---|
| 1062 | # KOMMANDOUEBERGABE AN SSH PER PIPE, DA SO DIE SYSTEM- UND |
---|
| 1063 | # BENUTZERPROFILE VOLLSTAENDIG AUSGEFUEHRT WERDEN (SONST FEHLEN MAKE |
---|
| 1064 | # Z.B. DIE PFADE ZUM COMPILER) |
---|
| 1065 | echo " *** execute \"make\" on remote host" |
---|
[1] | 1066 | |
---|
[40] | 1067 | if [[ $remote_host = nech ]] |
---|
| 1068 | then |
---|
| 1069 | make_call_string="sxmake PROG=$mainprog F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$compiler_options\" LDFLAGS=\"$loader_options\" " |
---|
| 1070 | else |
---|
| 1071 | make_call_string="make PROG=$mainprog F90=$compiler_name COPT=\"$cpp_options\" F90FLAGS=\"$compiler_options\" LDFLAGS=\"$loader_options\" " |
---|
| 1072 | fi |
---|
| 1073 | |
---|
| 1074 | if [[ $remote_host = t3eh ]] |
---|
| 1075 | then |
---|
[1] | 1076 | |
---|
[40] | 1077 | 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] | 1078 | |
---|
[40] | 1079 | elif [[ $remote_host = t3ej2 || $remote_host = ibms || $remote_host = ibmy ]] |
---|
| 1080 | then |
---|
[1] | 1081 | |
---|
[40] | 1082 | 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] | 1083 | |
---|
[40] | 1084 | elif [[ $remote_host = ibmb || $remote_host = ibmh ]] |
---|
| 1085 | then |
---|
[1] | 1086 | |
---|
[40] | 1087 | 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] | 1088 | |
---|
[181] | 1089 | elif [[ $remote_host = lcsgib || $remote_host = lcsgih ]] |
---|
| 1090 | then |
---|
| 1091 | |
---|
[221] | 1092 | print ". /usr/share/modules/init/bash; module load $mpilib; 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 |
---|
[196] | 1093 | # print ". /usr/share/modules/init/bash; module load mvapich2/1.2rc1-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 |
---|
| 1094 | # print ". /usr/share/modules/init/bash; module load mvapich2; 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 |
---|
[181] | 1095 | |
---|
[40] | 1096 | elif [[ $remote_host = lctit ]] |
---|
| 1097 | then |
---|
[1] | 1098 | |
---|
[40] | 1099 | echo " " > ${remote_host}_last_make_protokoll |
---|
| 1100 | while [[ $(cat ${remote_host}_last_make_protokoll | grep -c "Forwarding to N1GE") = 0 ]] |
---|
| 1101 | do |
---|
| 1102 | 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 |
---|
| 1103 | done |
---|
[1] | 1104 | |
---|
[206] | 1105 | elif [[ $remote_host = lcxt4 ]] |
---|
| 1106 | then |
---|
| 1107 | |
---|
| 1108 | 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 |
---|
| 1109 | |
---|
[40] | 1110 | else |
---|
[1] | 1111 | |
---|
[40] | 1112 | 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] | 1113 | |
---|
[40] | 1114 | fi |
---|
[1] | 1115 | |
---|
[40] | 1116 | if [[ $(grep -c MAKE_ERROR ${remote_host}_last_make_protokoll) != 0 ]] |
---|
[1] | 1117 | then |
---|
[40] | 1118 | printf "\a\n +++ error(s) occurred during compiling or linking on host \"$remote_host\" " |
---|
| 1119 | if [[ $silent = false ]] |
---|
| 1120 | then |
---|
| 1121 | answer=dummy |
---|
| 1122 | printf "\n" |
---|
| 1123 | while [[ "$answer" != c && "$answer" != k ]] |
---|
| 1124 | do |
---|
| 1125 | printf " >>> continue / list errors / kill mbuild (c/l/k) ? " |
---|
| 1126 | read answer |
---|
| 1127 | if [[ "$answer" = l ]] |
---|
| 1128 | then |
---|
| 1129 | more ${remote_host}_last_make_protokoll |
---|
| 1130 | fi |
---|
| 1131 | done |
---|
| 1132 | if [[ $answer = k ]] |
---|
[1] | 1133 | then |
---|
[40] | 1134 | locat=user_abort; exit |
---|
[1] | 1135 | fi |
---|
| 1136 | fi |
---|
| 1137 | fi |
---|
| 1138 | |
---|
| 1139 | |
---|
| 1140 | |
---|
[40] | 1141 | # NEUE VERSION AUF REMOTE-RECHNER ZUSAMMENPACKEN |
---|
| 1142 | printf "\n *** tar update on remote host ..." |
---|
| 1143 | if [[ $remote_host != lctit ]] |
---|
| 1144 | then |
---|
[181] | 1145 | ssh ${remote_username}@${remote_addres} "cd ${remote_md}; chmod u+w *; tar -cf ${mainprog}_current_version.tar ${mainprog} *.f90 *.o *.mod" |
---|
[40] | 1146 | else |
---|
[206] | 1147 | # TIT ERLAUBT NUR DIE AUSFï¿œHRUNG GANZ BESTIMMTER KOMMANDOS |
---|
[40] | 1148 | # MIT SSH, DESHALB AUFRUF PER PIPE |
---|
[181] | 1149 | 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] | 1150 | fi |
---|
[1] | 1151 | |
---|
| 1152 | |
---|
[40] | 1153 | # AKTUELLES VERSIONSVERZEICHNIS AUF REMOTE-RECHNER BEREINIGEN |
---|
| 1154 | # printf "\n *** \"make clean\" on remote host ..." |
---|
| 1155 | # ssh ${remote_username}@${remote_addres} "cd ${remote_md}; make clean; rm ${mainprog}_sources.tar; rm *.f90 Makefile" |
---|
| 1156 | # printf "\n" |
---|
[1] | 1157 | |
---|
| 1158 | |
---|
[25] | 1159 | |
---|
| 1160 | |
---|
[22] | 1161 | # GLEICHE AKTIONEN FUER DIE UTILITY-PROGRAMME DURCHFUEHREN |
---|
| 1162 | # AKTUELLE QUELLTEXTVERSION INS REMOTE-QUELLTEXTVERZEICHNIS KOPIEREN |
---|
| 1163 | # FALLS DIESES NOCH NICHT EXISTIERT, WIRD ES ERZEUGT |
---|
[40] | 1164 | elif [[ $compile_utility_programs = true ]] |
---|
[22] | 1165 | then |
---|
| 1166 | |
---|
[24] | 1167 | printf "\n\n" |
---|
[27] | 1168 | echo " *** copying scripts and utility programs to \"${remote_addres}:${remote_ud}/\" " |
---|
| 1169 | cd ${local_source_path}/../SCRIPTS |
---|
[22] | 1170 | |
---|
| 1171 | if [[ $remote_host != lctit ]] |
---|
| 1172 | then |
---|
[24] | 1173 | 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] | 1174 | else |
---|
[206] | 1175 | # TIT ERLAUBT NUR DIE AUSFï¿œHRUNG GANZ BESTIMMTER KOMMANDOS |
---|
[22] | 1176 | # MIT SSH, DESHALB AUFRUF PER PIPE |
---|
[24] | 1177 | 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] | 1178 | fi |
---|
| 1179 | |
---|
[27] | 1180 | # KOPIEREN DER SCRIPTE |
---|
[22] | 1181 | if [[ $local_host = decalpha ]] |
---|
| 1182 | then |
---|
[206] | 1183 | # DECALPHA BENUTZT BEI NICHTANGABE DES VOLLSTï¿œNDIGEN PFADES |
---|
[22] | 1184 | # IRGENDEIN ANDERES SCP (WAS NICHT FUNKTIONIERT). AUSSERDEM |
---|
| 1185 | # KOENNEN DOLLAR-ZEICHEN NICHT BENUTZT WERDEN |
---|
| 1186 | remote_ud=`echo $remote_ud | sed 's/\$HOME\///'` |
---|
[27] | 1187 | /bin/scp batch_scp mbuild mrun subjob ${remote_username}@${remote_addres}:${remote_ud}/../SCRIPTS > /dev/null |
---|
| 1188 | else |
---|
[28] | 1189 | scp batch_scp mbuild mrun subjob ${remote_username}@${remote_addres}:${remote_ud}/../SCRIPTS > /dev/null |
---|
[27] | 1190 | fi |
---|
| 1191 | |
---|
| 1192 | cd - > /dev/null |
---|
| 1193 | cd ${local_source_path}/../UTIL |
---|
| 1194 | |
---|
| 1195 | |
---|
| 1196 | # KOPIEREN DER UTILITY-PROGRAMME |
---|
| 1197 | if [[ $local_host = decalpha ]] |
---|
| 1198 | then |
---|
[206] | 1199 | # DECALPHA BENUTZT BEI NICHTANGABE DES VOLLSTï¿œNDIGEN PFADES |
---|
[27] | 1200 | # IRGENDEIN ANDERES SCP (WAS NICHT FUNKTIONIERT). AUSSERDEM |
---|
| 1201 | # KOENNEN DOLLAR-ZEICHEN NICHT BENUTZT WERDEN |
---|
| 1202 | remote_ud=`echo $remote_ud | sed 's/\$HOME\///'` |
---|
[24] | 1203 | /bin/scp Makefile *.f90 ${remote_username}@${remote_addres}:${remote_ud} > /dev/null |
---|
[22] | 1204 | else |
---|
[24] | 1205 | scp Makefile *.f90 ${remote_username}@${remote_addres}:${remote_ud} > /dev/null |
---|
[22] | 1206 | fi |
---|
| 1207 | |
---|
| 1208 | |
---|
| 1209 | |
---|
| 1210 | # MAKE MIT ZUVOR ERMITTELTEN OPTIONEN AUF REMOTE RECHNER AUSFUEHREN |
---|
| 1211 | # KOMMANDOUEBERGABE AN SSH PER PIPE, DA SO DIE SYSTEM- UND |
---|
| 1212 | # BENUTZERPROFILE VOLLSTAENDIG AUSGEFUEHRT WERDEN (SONST FEHLEN MAKE |
---|
| 1213 | # Z.B. DIE PFADE ZUM COMPILER) |
---|
| 1214 | echo " *** execute \"make\" on remote host" |
---|
| 1215 | |
---|
| 1216 | if [[ $remote_host = nech ]] |
---|
| 1217 | then |
---|
[27] | 1218 | make_call_string="sxmake F90=$compiler_name F90_SER=$compiler_name_ser COPT=\"$cpp_options\" F90FLAGS=\"$compiler_options\" LDFLAGS=\"$loader_options\" " |
---|
[22] | 1219 | else |
---|
[27] | 1220 | make_call_string="make F90=$compiler_name F90_SER=$compiler_name_ser COPT=\"$cpp_options\" F90FLAGS=\"$compiler_options\" LDFLAGS=\"$loader_options\" " |
---|
[22] | 1221 | fi |
---|
| 1222 | |
---|
| 1223 | if [[ $remote_host = ibms || $remote_host = ibmy ]] |
---|
| 1224 | then |
---|
| 1225 | |
---|
[25] | 1226 | ssh ${remote_username}@${remote_addres} "cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" |
---|
[22] | 1227 | |
---|
| 1228 | elif [[ $remote_host = ibmb || $remote_host = ibmh ]] |
---|
| 1229 | then |
---|
| 1230 | |
---|
[25] | 1231 | print "export OBJECT_MODE=64; cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh ${remote_username}@${remote_addres} |
---|
[22] | 1232 | |
---|
| 1233 | elif [[ $remote_host = lctit ]] |
---|
| 1234 | then |
---|
| 1235 | |
---|
| 1236 | echo " " > ${remote_host}_last_make_protokoll |
---|
| 1237 | while [[ $(cat ${remote_host}_last_make_protokoll | grep -c "Forwarding to N1GE") = 0 ]] |
---|
| 1238 | do |
---|
| 1239 | print "cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll |
---|
| 1240 | done |
---|
| 1241 | |
---|
| 1242 | else |
---|
| 1243 | |
---|
| 1244 | print "cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll |
---|
| 1245 | |
---|
| 1246 | fi |
---|
| 1247 | |
---|
| 1248 | fi # ENDE UEBERSETZUNG DER UTILITY-PROGRAMME |
---|
| 1249 | |
---|
[75] | 1250 | rm -rf ${remote_host}_last_make_protokoll |
---|
[22] | 1251 | |
---|
[1] | 1252 | else |
---|
| 1253 | |
---|
[40] | 1254 | if [[ $compile_utility_programs = false ]] |
---|
| 1255 | then |
---|
[1] | 1256 | |
---|
[215] | 1257 | # DEPOSITORY VERZEICHNIS ERZEUGEN, FALLS NOCH NICHT VORHANDEN |
---|
| 1258 | eval remote_md=$remote_md |
---|
| 1259 | if [[ ! -d $remote_md ]] |
---|
| 1260 | then |
---|
| 1261 | if mkdir $remote_md |
---|
| 1262 | then |
---|
| 1263 | printf "\n\n *** directory for make depository:" |
---|
| 1264 | printf "\n $remote_md" |
---|
| 1265 | printf "\n was created\n" |
---|
| 1266 | else |
---|
| 1267 | printf "\n +++ directory for make depository:" |
---|
| 1268 | printf "\n $remote_md" |
---|
| 1269 | printf "\n cannot be created" |
---|
| 1270 | locat=local_depository_path; exit |
---|
| 1271 | fi |
---|
| 1272 | fi |
---|
| 1273 | |
---|
| 1274 | # QUELLTEXT-DATEIEN AUS REPOSITORY INS DEPOSITORY KOPIEREN |
---|
| 1275 | echo " " |
---|
| 1276 | echo " *** updating sources in $remote_md" |
---|
| 1277 | cd $remote_md |
---|
| 1278 | cp $local_source_path/${mainprog}_sources.tar . |
---|
| 1279 | tar xf ${mainprog}_sources.tar |
---|
| 1280 | |
---|
[40] | 1281 | # MAKE MIT ZUVOR ERMITTELTEN OPTIONEN AUF LOKALEM RECHNER AUSFUEHREN |
---|
| 1282 | echo " " |
---|
| 1283 | echo " *** execute \"make\" on local host" |
---|
[1] | 1284 | |
---|
[40] | 1285 | make PROG=$mainprog F90=$compiler_name COPT="$cpp_options" F90FLAGS="$compiler_options" LDFLAGS="$loader_options" 2>&1 | tee ${remote_host}_last_make_protokoll |
---|
| 1286 | |
---|
| 1287 | if [[ $? != 0 ]] |
---|
[1] | 1288 | then |
---|
[40] | 1289 | printf "\a\n +++ error(s) occurred during compiling or linking on host \"$remote_host\" " |
---|
| 1290 | if [[ $silent = false ]] |
---|
| 1291 | then |
---|
| 1292 | answer=dummy |
---|
| 1293 | printf "\n" |
---|
| 1294 | while [[ "$answer" != c && "$answer" != k ]] |
---|
| 1295 | do |
---|
| 1296 | printf " >>> continue / list errors / kill mbuild (c/l/k) ? " |
---|
| 1297 | read answer |
---|
| 1298 | if [[ "$answer" = l ]] |
---|
| 1299 | then |
---|
| 1300 | more ${remote_host}_last_make_protokoll |
---|
| 1301 | fi |
---|
| 1302 | done |
---|
| 1303 | if [[ $answer = k ]] |
---|
[1] | 1304 | then |
---|
[40] | 1305 | locat=user_abort; exit |
---|
[1] | 1306 | fi |
---|
| 1307 | fi |
---|
| 1308 | fi |
---|
| 1309 | |
---|
| 1310 | |
---|
[40] | 1311 | # NEUE VERSION AUF LOKALEM RECHNER ZUSAMMENPACKEN |
---|
| 1312 | printf "\n *** tar update on local host ..." |
---|
| 1313 | tar -cf ${mainprog}_current_version.tar *.$suf *.o *.mod |
---|
[1] | 1314 | |
---|
[22] | 1315 | |
---|
| 1316 | # COMPILE THE UTILITY PROGRAMS |
---|
[40] | 1317 | elif [[ $compile_utility_programs = true ]] |
---|
[22] | 1318 | then |
---|
| 1319 | printf "\n\n" |
---|
| 1320 | echo " *** compiling the utility programs ..." |
---|
| 1321 | cd ${local_source_path}/../UTIL |
---|
[35] | 1322 | make F90=$compiler_name F90_SER=$compiler_name_ser COPT="$cpp_options" F90FLAGS="$compiler_options" LDFLAGS="$loader_options" |
---|
[22] | 1323 | cd - > /dev/null |
---|
| 1324 | fi |
---|
| 1325 | |
---|
[1] | 1326 | fi |
---|
| 1327 | |
---|
| 1328 | fi |
---|
| 1329 | done |
---|
| 1330 | |
---|
| 1331 | |
---|
| 1332 | if [[ $host_found = false ]] |
---|
| 1333 | then |
---|
| 1334 | if [[ $host = all ]] |
---|
| 1335 | then |
---|
| 1336 | printf "\n +++ no hosts found in configuration file" |
---|
| 1337 | else |
---|
| 1338 | printf "\n +++ host \"$host\" not found in configuration file" |
---|
| 1339 | fi |
---|
| 1340 | locat=config_file; exit |
---|
| 1341 | fi |
---|
| 1342 | |
---|
| 1343 | |
---|
| 1344 | |
---|
| 1345 | # ABSCHLIESSENDE ARBEITEN |
---|
| 1346 | rm -f hosts_found_in_config_file |
---|
| 1347 | |
---|