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