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