source: palm/trunk/SCRIPTS/mbuild @ 622

Last change on this file since 622 was 622, checked in by raasch, 14 years ago

New:
---

Optional barriers included in order to speed up collective operations
MPI_ALLTOALL and MPI_ALLREDUCE. This feature is controlled with new initial
parameter collective_wait. Default is .FALSE, but .TRUE. on SGI-type
systems. (advec_particles, advec_s_bc, buoyancy, check_for_restart,
cpu_statistics, data_output_2d, data_output_ptseries, flow_statistics,
global_min_max, inflow_turbulence, init_3d_model, init_particles, init_pegrid,
init_slope, parin, pres, poismg, set_particle_attributes, timestep,
read_var_list, user_statistics, write_compressed, write_var_list)

Adjustments for Kyushu Univ. (lcrte, ibmku). Concerning hybrid
(MPI/openMP) runs, the number of openMP threads per MPI tasks can now
be given as an argument to mrun-option -O. (mbuild, mrun, subjob)

Changed:


Initialization of the module command changed for SGI-ICE/lcsgi (mbuild, subjob)

Errors:


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