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