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