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