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