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