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