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