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