[1] | 1 | #!/bin/ksh |
---|
[66] | 2 | # mbuild - Programmuebersetzungsscript |
---|
[169] | 3 | # $Id: mbuild 266 2009-03-25 07:43:59Z weinreis $ |
---|
[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 |
---|
[1] | 107 | |
---|
| 108 | |
---|
| 109 | |
---|
| 110 | # VARIABLENVEREINBARUNGEN + DEFAULTWERTE |
---|
[22] | 111 | compile_utility_programs=false |
---|
[1] | 112 | config_file=.mrun.config |
---|
[67] | 113 | fimm=false |
---|
[1] | 114 | host=all |
---|
| 115 | host_found=false |
---|
| 116 | locat=normal |
---|
| 117 | makefile="" |
---|
| 118 | remote_mode=interactive |
---|
| 119 | scirocco=false |
---|
| 120 | silent=false |
---|
| 121 | suf=f90 |
---|
| 122 | update=false |
---|
[83] | 123 | working_directory=`pwd` |
---|
[1] | 124 | |
---|
| 125 | typeset -i ih ihost=0 |
---|
| 126 | |
---|
[66] | 127 | typeset -R30 calltime |
---|
[1] | 128 | typeset -L20 column1 |
---|
| 129 | typeset -L50 column2 |
---|
| 130 | typeset -L70 column3 |
---|
[215] | 131 | typeset -L40 version="MBUILD 2.1 Rev$Rev: 266 $" |
---|
[1] | 132 | |
---|
| 133 | # FEHLERBEHANDLUNG |
---|
| 134 | # BEI EXIT: |
---|
[83] | 135 | trap 'rm -rf $working_directory/tmp_mbuild |
---|
[69] | 136 | if [[ $locat != normal ]] |
---|
[1] | 137 | then |
---|
| 138 | printf "\n\n +++ mbuild killed \n\n" |
---|
| 139 | else |
---|
| 140 | printf "\n\n *** mbuild finished \n\n" |
---|
| 141 | fi' exit |
---|
| 142 | |
---|
| 143 | |
---|
| 144 | # BEI TERMINAL-BREAK: |
---|
[83] | 145 | trap 'rm -rf $working_directory/tmp_mbuild |
---|
[69] | 146 | printf "\n\n +++ mbuild killed by \"^C\" \n\n" |
---|
[1] | 147 | exit |
---|
| 148 | ' 2 |
---|
| 149 | |
---|
| 150 | |
---|
[215] | 151 | tmp_mbuild=${working_directory}/tmp_mbuild |
---|
[1] | 152 | |
---|
| 153 | # SHELLSCRIPT-OPTIONEN EINLESEN |
---|
[22] | 154 | while getopts :c:h:m:rs:u option |
---|
[1] | 155 | do |
---|
| 156 | case $option in |
---|
| 157 | (c) config_file=$OPTARG;; |
---|
| 158 | (h) host=$OPTARG;; |
---|
| 159 | (m) makefile=$OPTARG;; |
---|
| 160 | (r) remote_mode=batch;; |
---|
| 161 | (s) suf=$OPTARG;; |
---|
[22] | 162 | (u) compile_utility_programs=true;; |
---|
[1] | 163 | (\?) printf "\n +++ unknown option $OPTARG \n"; |
---|
| 164 | locat=parameter; exit;; |
---|
| 165 | esac |
---|
| 166 | done |
---|
| 167 | |
---|
| 168 | |
---|
| 169 | |
---|
| 170 | # BATCH-MODE IST ZUR ZEIT NICHT FUNKTIONSFAEHIG |
---|
| 171 | if [[ $remote_mode = batch ]] |
---|
| 172 | then |
---|
| 173 | printf "\n +++ sorry, batch mode does not work! \n" |
---|
| 174 | locat=parameter; exit |
---|
| 175 | fi |
---|
| 176 | |
---|
| 177 | |
---|
| 178 | |
---|
[82] | 179 | # PRUEFEN, OB KONFIGURATIONS-DATEI VORHANDEN |
---|
| 180 | if [[ ! -f $config_file ]] |
---|
| 181 | then |
---|
| 182 | printf "\n +++ configuration file: " |
---|
| 183 | printf "\n $config_file" |
---|
| 184 | printf "\n does not exist" |
---|
| 185 | locat=configuration; exit |
---|
| 186 | fi |
---|
| 187 | |
---|
| 188 | |
---|
| 189 | |
---|
[1] | 190 | # LOKALEN RECHNER ERMITTELN |
---|
| 191 | local_host_real_name=$(hostname) |
---|
[69] | 192 | # local_addres=$(nslookup `hostname` 2>&1 | grep "Address:" | tail -1 | awk '{print $2}') |
---|
| 193 | |
---|
[1] | 194 | |
---|
[82] | 195 | |
---|
| 196 | # HOST-IDENTIFIER (local_host) AUS KONFIGURATIONSDATEI BESTIMMEN |
---|
| 197 | line="" |
---|
[215] | 198 | grep "%host_identifier" $config_file > $tmp_mbuild |
---|
[82] | 199 | while read line |
---|
| 200 | do |
---|
[116] | 201 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
[82] | 202 | then |
---|
| 203 | HOSTNAME=`echo $line | cut -d" " -s -f2` |
---|
| 204 | host_identifier=`echo $line | cut -d" " -s -f3` |
---|
[83] | 205 | if [[ $local_host_real_name = $HOSTNAME ]] |
---|
[82] | 206 | then |
---|
| 207 | local_host=$host_identifier |
---|
| 208 | break |
---|
| 209 | fi |
---|
| 210 | fi |
---|
[215] | 211 | done < $tmp_mbuild |
---|
[82] | 212 | |
---|
| 213 | if [[ "$local_host" = "" ]] |
---|
| 214 | then |
---|
| 215 | printf "\n +++ no host identifier found in configuration file \"$config_file\"" |
---|
| 216 | printf "\n for local host \"$local_host_real_name\"." |
---|
| 217 | printf "\n Please add line" |
---|
| 218 | printf "\n \"\%host_identifier $local_host_real_name <identifier>\"" |
---|
| 219 | printf "\n to the configuration file." |
---|
| 220 | locat=local_host; exit |
---|
| 221 | fi |
---|
| 222 | |
---|
| 223 | |
---|
| 224 | |
---|
[1] | 225 | [[ $local_host_real_name = scirocco ]] && scirocco=true |
---|
[67] | 226 | [[ $local_host_real_name = fimm.bccs.uib.no ]] && fimm=true |
---|
[1] | 227 | |
---|
| 228 | |
---|
| 229 | |
---|
| 230 | if [[ $local_host != ibms ]] |
---|
| 231 | then |
---|
| 232 | config_file=$PWD/$config_file |
---|
| 233 | else |
---|
| 234 | config_file=`pwd`/$config_file |
---|
| 235 | fi |
---|
| 236 | |
---|
| 237 | |
---|
| 238 | |
---|
| 239 | # BENUTZERNAMEN AUF LOKALEM RECHNER AUS KONFIGURATIONSDATEI ERMITTELN |
---|
| 240 | line="" |
---|
[215] | 241 | grep " $local_host" $config_file | grep "%remote_username" > $tmp_mbuild |
---|
[69] | 242 | while read line |
---|
[1] | 243 | do |
---|
[116] | 244 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
[1] | 245 | then |
---|
| 246 | local_username=`echo $line | cut -d" " -s -f2` |
---|
| 247 | fi |
---|
[215] | 248 | done < $tmp_mbuild |
---|
[1] | 249 | |
---|
[82] | 250 | |
---|
[1] | 251 | if [[ "$local_username" = "" ]] |
---|
| 252 | then |
---|
| 253 | printf "\n +++ no user name found in configuration file" |
---|
| 254 | printf "\n for local host \"$local_host\" " |
---|
| 255 | locat=config_file; exit |
---|
| 256 | fi |
---|
| 257 | |
---|
| 258 | |
---|
[5] | 259 | # LOKALEN QUELLTEXTPFAD ERMITTELN. |
---|
| 260 | # ZUERST PRUEFEN, OB EIN GLOBALER QUELLTEXTPFAD FUER ALLE RECHNER |
---|
| 261 | # VEREINBART WURDE. |
---|
| 262 | # DAZU ZUNAECHST ALLE IN DER KONFIGURATIONSDATEI VEREINBARTEN GLOBALEN |
---|
| 263 | # VARIABLEN SETZEN, WEIL DIESE EVTL. IN PFADNAMEN VERWENDET WERDEN |
---|
| 264 | line="" |
---|
[215] | 265 | grep "%" $config_file > $tmp_mbuild |
---|
[69] | 266 | while read line |
---|
[5] | 267 | do |
---|
[116] | 268 | if [[ "$line" != "" && "$(echo $line | cut -d" " -s -f3)" = "" && $(echo $line | cut -c1) != "#" ]] |
---|
[1] | 269 | then |
---|
[5] | 270 | var=`echo $line | cut -d" " -s -f1 | cut -c2-` |
---|
| 271 | value=`echo $line | cut -d" " -s -f2` |
---|
[8] | 272 | eval export $var=\$value |
---|
[9] | 273 | # eval echo \" $var=\$$var \" # AUSGABE ZU TESTZWECKEN |
---|
[1] | 274 | fi |
---|
[215] | 275 | done < $tmp_mbuild |
---|
[1] | 276 | |
---|
[5] | 277 | # NUN PRUEFEN, OB EIN GLOBALER QUELLTEXTPFAD VEREINBART WURDE |
---|
[1] | 278 | line="" |
---|
[215] | 279 | grep "%source_path" $config_file > $tmp_mbuild |
---|
[69] | 280 | while read line |
---|
[1] | 281 | do |
---|
| 282 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 283 | then |
---|
| 284 | if [[ "$(echo $line | cut -d" " -s -f3)" = "" ]] |
---|
| 285 | then |
---|
| 286 | global_source_path=`echo $line | cut -d" " -s -f2` |
---|
| 287 | fi |
---|
| 288 | fi |
---|
[215] | 289 | done < $tmp_mbuild |
---|
[1] | 290 | |
---|
| 291 | line="" |
---|
[215] | 292 | grep " $local_host" $config_file | grep "%source_path" > $tmp_mbuild |
---|
[69] | 293 | while read line |
---|
[1] | 294 | do |
---|
| 295 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 296 | then |
---|
| 297 | local_source_path=`echo $line | cut -d" " -s -f2` |
---|
| 298 | fi |
---|
[215] | 299 | done < $tmp_mbuild |
---|
[1] | 300 | |
---|
| 301 | if [[ "$local_source_path" = "" ]] |
---|
| 302 | then |
---|
| 303 | if [[ "$global_source_path" != "" ]] |
---|
| 304 | then |
---|
| 305 | local_source_path=$global_source_path |
---|
| 306 | else |
---|
| 307 | printf "\n +++ no source path found in configuration file" |
---|
| 308 | printf "\n for local host \"$local_host\" " |
---|
| 309 | printf "\n please set \"\%source_path\" in configuration file" |
---|
| 310 | locat=config_file; exit |
---|
| 311 | fi |
---|
| 312 | fi |
---|
| 313 | eval local_source_path=$local_source_path |
---|
[8] | 314 | eval local_source_path=$local_source_path |
---|
[1] | 315 | |
---|
| 316 | |
---|
[215] | 317 | |
---|
| 318 | # GLOBALEN DEPOSITORY-PFAD ERMITTELN |
---|
[1] | 319 | line="" |
---|
[215] | 320 | grep "%depository_path" $config_file > $tmp_mbuild |
---|
[69] | 321 | while read line |
---|
[1] | 322 | do |
---|
| 323 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
| 324 | then |
---|
| 325 | if [[ "$(echo $line | cut -d" " -s -f3)" = "" ]] |
---|
| 326 | then |
---|
| 327 | global_depository_path=`echo $line | cut -d" " -s -f2` |
---|
| 328 | fi |
---|
| 329 | fi |
---|
[215] | 330 | done < $tmp_mbuild |
---|
[1] | 331 | |
---|
| 332 | |
---|
| 333 | |
---|
[5] | 334 | # PRUEFEN, OB IN KONFIGURATIONSDATEI EIN HAUPTPROGRAMM |
---|
| 335 | # VEREINBART WURDE |
---|
| 336 | if [[ $(grep -c "%mainprog" $config_file) != 1 ]] |
---|
| 337 | then |
---|
| 338 | printf "\n +++ no main program or more than one main program defined" |
---|
| 339 | printf "\n in configuration file" |
---|
| 340 | locat=configuration; exit |
---|
| 341 | else |
---|
| 342 | line=`grep "%mainprog" $config_file` |
---|
| 343 | if [[ "$line" = "" || $(echo $line | cut -c1) = "#" ]] |
---|
| 344 | then |
---|
| 345 | printf "\n +++ no main program defined in configuration file" |
---|
| 346 | locat=configuration; exit |
---|
| 347 | fi |
---|
| 348 | mainprog=`echo $line | cut -d" " -s -f2 | cut -d"." -f1` |
---|
| 349 | fi |
---|
| 350 | |
---|
| 351 | |
---|
| 352 | |
---|
[1] | 353 | # MAKEFILE vorhanden |
---|
| 354 | [[ "$makefile" = "" ]] && makefile=$local_source_path/Makefile |
---|
| 355 | if [[ ! -f $makefile ]] |
---|
| 356 | then |
---|
| 357 | printf "\n +++ makefile: " |
---|
| 358 | printf "\n $makefile" |
---|
| 359 | printf "\n does not exist" |
---|
| 360 | locat=makefile; exit |
---|
| 361 | fi |
---|
| 362 | |
---|
| 363 | |
---|
| 364 | # HEADER-AUSGABE (TEIL1: MELDUNGEN UEBER LOKALEN RECHNER) |
---|
| 365 | calltime=$(date) |
---|
| 366 | printf "\n" |
---|
| 367 | printf "#------------------------------------------------------------------------# \n" |
---|
| 368 | printf "| $version$calltime | \n" |
---|
| 369 | printf "| | \n" |
---|
| 370 | column1="called on:"; column2=$local_host_real_name |
---|
| 371 | printf "| $column1$column2 | \n" |
---|
| 372 | column1="local username:"; column2=$local_username |
---|
| 373 | printf "| $column1$column2 | \n" |
---|
| 374 | column1="local IP-addres:"; column2=$local_addres |
---|
| 375 | printf "| $column1$column2 | \n" |
---|
| 376 | column1="config file:"; column2=$config_file |
---|
| 377 | printf "| $column1$column2 | \n" |
---|
| 378 | column1="makefile:"; column2=$makefile |
---|
| 379 | printf "| $column1$column2 | \n" |
---|
| 380 | column1="local source path:"; column2=$local_source_path |
---|
| 381 | printf "| $column1$column2 | \n" |
---|
| 382 | printf "#------------------------------------------------------------------------# \n" |
---|
| 383 | |
---|
| 384 | # printf "| | \n" |
---|
| 385 | |
---|
| 386 | |
---|
[40] | 387 | if [[ $compile_utility_programs = false ]] |
---|
| 388 | then |
---|
[1] | 389 | |
---|
[40] | 390 | # IN JEDEM FALL ALLEN DATEIEN WRITE-PERMIT GEBEN, DAMIT ES AUF |
---|
| 391 | # DEN REMOTE-RECHNERN NICHT EVTL. ZU PROBLEMEN BEIM UEBERSCHREIBEN KOMMT |
---|
[215] | 392 | cd $local_source_path |
---|
| 393 | printf "\n\n *** tar of makefile and source files in $local_source_path" |
---|
[40] | 394 | tar -cf ${mainprog}_sources.tar Makefile *.$suf |
---|
| 395 | printf "\n" |
---|
[1] | 396 | |
---|
[40] | 397 | fi |
---|
[1] | 398 | |
---|
| 399 | |
---|
[40] | 400 | |
---|
[1] | 401 | # BESTAETIGUNG ZUM WEITERMACHEN EINHOLEN |
---|
| 402 | if [[ $host = all ]] |
---|
| 403 | then |
---|
| 404 | printf "\n *** updates will be made for ALL hosts found in" |
---|
| 405 | printf "\n the configuration file" |
---|
| 406 | else |
---|
| 407 | printf "\n *** update will be made for host \"$host\" " |
---|
| 408 | fi |
---|
| 409 | |
---|
| 410 | if [[ $silent = false ]] |
---|
| 411 | then |
---|
| 412 | answer=dummy |
---|
| 413 | printf "\n\n" |
---|
| 414 | while [[ "$answer" != y && "$answer" != Y && "$answer" != n && "$answer" != N ]] |
---|
| 415 | do |
---|
| 416 | printf " >>> continue (y/n) ? " |
---|
| 417 | read answer |
---|
| 418 | done |
---|
| 419 | if [[ $answer = n || $answer = N ]] |
---|
| 420 | then |
---|
| 421 | locat=user_abort; exit |
---|
| 422 | fi |
---|
| 423 | fi |
---|
| 424 | |
---|
| 425 | |
---|
| 426 | |
---|
| 427 | |
---|
| 428 | # GENERIERUNG DER AKTUELLEN MODELLVERSION FUER ALLE RECHNER-/UEBERSETZUNGS- |
---|
| 429 | # VERSIONEN, DIE IN DER KONFIGURATIONSDATEI GEFUNDEN WERDEN |
---|
| 430 | printf "\n *** scanning configuration file for host(s) ..." |
---|
| 431 | |
---|
[215] | 432 | grep %fopts $config_file > $tmp_mbuild |
---|
[69] | 433 | while read line |
---|
[1] | 434 | do |
---|
| 435 | # KOMMENTARZEILEN UEBERSPRINGEN |
---|
| 436 | [[ $(echo $line | cut -c1) = "#" ]] && continue |
---|
| 437 | (( ihost = ihost + 1 )) |
---|
| 438 | hostline[$ihost]="$line" |
---|
[215] | 439 | done < $tmp_mbuild |
---|
[1] | 440 | |
---|
| 441 | |
---|
| 442 | while (( ih < ihost )) |
---|
| 443 | do |
---|
| 444 | |
---|
| 445 | (( ih = ih + 1 )) |
---|
| 446 | |
---|
| 447 | # REMOTE-RECHNER UND UEBERSETZUNGS-VERSION FESTSTELLEN |
---|
| 448 | # NUR WEITERMACHEN, WENN ENTSPRECHENDER REMOTE-RECHNER MITTELS |
---|
| 449 | # SHELLSCRIPT-OPTION AUCH AUSGEWAEHLT WURDE |
---|
| 450 | remote_host_string=`echo ${hostline[$ih]} | cut -d" " -s -f3-` |
---|
| 451 | remote_host=`echo $remote_host_string | cut -d" " -f1` |
---|
| 452 | if [[ $host != all ]] |
---|
| 453 | then |
---|
| 454 | [[ $remote_host != $host ]] && continue |
---|
| 455 | fi |
---|
| 456 | host_found=true |
---|
| 457 | condition1=`echo $remote_host_string | cut -d" " -s -f2` |
---|
| 458 | if [[ $condition1 = $remote_host ]] |
---|
| 459 | then |
---|
| 460 | condition1="" |
---|
| 461 | else |
---|
| 462 | condition2=`echo $remote_host_string | cut -d" " -s -f3` |
---|
| 463 | fi |
---|
| 464 | |
---|
[82] | 465 | netcdf_inc="" |
---|
| 466 | netcdf_lib="" |
---|
[1] | 467 | |
---|
| 468 | # IP-ADRESSE DES REMOTE-RECHNERS BESTIMMEN |
---|
| 469 | case $remote_host in |
---|
[116] | 470 | (lcmuk) remote_addres=130.75.105.2;; |
---|
[181] | 471 | (lcsgib) remote_addres=130.73.232.102;; |
---|
[210] | 472 | (lcsgih) remote_addres=130.75.4.103;; |
---|
[83] | 473 | (lctit) remote_addres=172.17.75.161;; |
---|
[206] | 474 | (lcxt4) remote_addres=129.177.20.113;; |
---|
[83] | 475 | (decalpha) remote_addres=165.132.26.56;; |
---|
| 476 | (ibmb) remote_addres=130.73.230.10;; |
---|
| 477 | (ibmh) remote_addres=130.75.4.10;; |
---|
| 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 | |
---|
[40] | 1086 | elif [[ $remote_host = ibmb || $remote_host = ibmh ]] |
---|
| 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 | |
---|
| 1230 | elif [[ $remote_host = ibmb || $remote_host = ibmh ]] |
---|
| 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 | |
---|