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