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