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