source: palm/trunk/SCRIPTS/mbuild @ 686

Last change on this file since 686 was 678, checked in by raasch, 13 years ago

New:
---

further adjustments on Tsubame and concerning openMP usage
(mrun, mbuild, subjob)

Changed:


Errors:


Bugfix in calculation of divergence of vertical flux of resolved scale
energy, pressure fluctuations, and flux of pressure fluctuation itself
(flow statistics)

Bugfix: module pegrid was missing. (user_statistics)

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