source: palm/tags/release-3.3/SCRIPTS/mbuild @ 336

Last change on this file since 336 was 83, checked in by raasch, 17 years ago

New:
---

Changed:


PALM can be generally installed on any kind of Linux-, IBM-AIX-, or NEC-SX-system by adding appropriate settings to the configuration file.

Scripts are also running under the public domain ksh.

All system relevant compile and link options as well as the host identifier (local_host) are specified in the configuration file.

Filetransfer by ftp removed (options -f removed from mrun and mbuild).

Call of (system-)FLUSH routine moved to new routine local_flush.

return_addres and return_username are read from ENVPAR-NAMELIST-file instead of using local_getenv.

Preprocessor strings for different linux clusters changed to "lc", some preprocessor directives renamed (new: intel_openmp_bug), preprocessor directives for old systems removed

advec_particles, check_open, cpu_log, cpu_statistics, data_output_dvrp, flow_statistics, header, init_dvrp, init_particles, init_1d_model, init_dvrp, init_pegrid, local_getenv, local_system, local_tremain, local_tremain_ini, modules, palm, parin, run_control

new:
local_flush

mbuild, mrun

Errors:


  • Property svn:keywords set to Rev
File size: 53.1 KB
Line 
1#!/bin/ksh
2# mbuild - Programmuebersetzungsscript
3# $Id: mbuild 54 2007-03-08 00:00:02Z raasch $
4
5     # Prozedur zur Uebersetzung von Programmteilen mittels make-Mechanismus
6     # auf einem Remote-Rechner, ausgehend von Quellcode auf einem lokalen
7     # Rechner
8
9     # Folgende Probleme existieren unter Linux, wenn keine AT&T-Korn-Shell
10     # verwendet wird:
11     # Wertzuweisungen an Variablen innerhalb von DO-Schleifen werden nicht
12     # nach aussen weitergegeben. "while read line" funktioniert nicht
13     # innerhalb einer Pipe.
14
15     # letzte Aenderung:
16     # 06/05/02 - Siggi - Beginn der Entwicklung
17     # 12/06/02 - Siggi - Abschluss der Entwicklungsarbeiten
18     # 23/06/02 - Siggi - voerst kein make-clean, Abbruch bei batch-mode
19     # 24/07/02 - Siggi - Keine Verwendung der temporaeren Datei tmp_mbuild
20     #                    unter linux mehr noetig, da nun AT&T-Korn-Shell
21     #                    benutzt wird
22     # 12/09/02 - Siggi - ibmh (hanni.hlrn.de) validiert
23     # 19/12/02 - Siggi - ibmb validiert
24     # 05/02/03 - Siggi - hostname nobela included
25     # 04/03/03 - Siggi - host nech included
26     # 06/03/03 - Siggi - make_call_string is echoed without '' to
27     #                    file LAST_MAKE_CALL (otherwise error on NEC, because
28     #                    '' are part of compiler options
29     # 16/03/03 - Siggi - Two underscores are placed in front of every define
30     #                    string, in case that palm.f90 version contains
31     #                    such strings
32     # 16/04/03 - Siggi - First extensions for linux machines
33     # 24/06/03 - Siggi - host orkan included
34     # 17/07/03 - Siggi - IP adress set to new "cross" machine at DKRZ
35     # 24/07/03 - Siggi - host maestro admitted
36     # 06/08/03 - Siggi - host gregale admitted
37     # 05/11/03 - Siggi - hosts irifi and quanero are now belonging to lcmuk
38     # 19/11/03 - Heiko - on lcmuk, mbuild does not tar the *.i files
39     # 08/01/04 - Siggi - additional preprocessor directive for ibm included
40     #                    (-D$OMP=OMP) in order to avoid problems with
41     #                    OMP_NUM_THREADS
42     # 09/01/04 - Siggi - action above cancelled
43     # 28/01/04 - Siggi - action above re-cancelled
44     # 08/03/04 - Siggi - host scirocco admitted
45     # 26/03/04 - Siggi - .o and .mod files are also deleted in depository, if
46     #                    the respective .f90 file is not listed in the makefile
47     #                    and deletion is demanded by the user
48     # 12/04/04 - Siggi - scp2 instead of scp used for transfer from decalpha
49     #                    due to error in ssh installation (otherwise a prompt
50     #                    for the password appears)
51     # 23/07/04 - Siggi - changes due to the new berni configuration
52     #                    (federation switch)
53     # 08/09/04 - Siggi - hanni IP address changed to 130.75.4.10
54     # 23/09/04 - Joerg - correction of IP-Address for 'cross' (DKRZ)
55     # 09/03/05 - Siggi - on nech, mbuild does not tar the *.i files
56     # 31/03/05 - Siggi - mbuild does not tar *.i files any more
57     # 24/04/05 - Siggi - netcdf support on lcmuk
58     # 25/04/05 - Siggi - netcdf support on gfdl3 (decalpha)
59     # 12/05/05 - Siggi - netcdf support on ibm
60     #                    set OBJECT_MODE=64 for compiling on ibmb, ibmh
61     # 18/05/05 - Siggi - netcdf support on nec
62     # 19/05/05 - Siggi - IP addres 134.75.155.74 changed to 165.132.26.56
63     # 23/05/05 - Siggi - netcdf support on ibms
64     # 01/06/05 - Siggi - reset of cpp_options to "" on lcmuk
65     # 30/06/05 - Siggi - netcdf support on bora
66     # 20/10/05 - Siggi - update of netcdf-version on decalpha (gfdl3)
67     # 04/11/05 - Siggi - netcdf 3.6.0-p1 on ibmh/ibmb
68     # 30/12/05 - Siggi - change of IP adresses in subnet 130.75.105
69     #                    host gfdl5 (ibmy) admitted
70     # 10/01/06 - Siggi - cpp directive for NetCDF 64bit support
71     # 20/01/06 - Siggi - cpp directive for ibmy
72     # 09/02/06 - Marcus- compile only once on lcmuk (as on ibmh/ibmb)
73     # 10/02/06 - Siggi - modifications for scp on decalpha
74     # 13/04/06 - Siggi - ostria admitted
75     # 19/04/06 - Siggi - preprocessor directive -D$OMP=OMP for ibm removed
76     # 23/05/05 - Siggi - lctit (SUN Fire X4600) admitted
77     # 29/05/05 - Siggi - atmos (lcide) admitted
78     # 23/08/06 - Siggi - netcdf support for scirocco (notebook)
79     # 24/11/06 - Siggi - breva and levanto admitted
80     # 07/02/07 - Siggi - adapted for RIAM (neck)
81     # 10/02/07 - Siggi - all hpmuk-related code removed
82     # 02/03/07 - Siggi - compilation of utility programs and transfer of
83     #                    scripts to remote hosts added (option -u)
84     # 14/03/07 - Siggi - fimm admitted, revision number added to terminal
85     #                    output
86     # 16/03/07 - Siggi - adjustments (netcdf) for lctit
87     #                    adjustments for running under pdksh, local ip-addres
88     #                    is not determined any more
89     # 30/03/07 - Siggi - cpp-directives/options + netcdf-options are read
90     #                    from configuration file
91     #                    host identifier (local_host) is read from config file
92
93
94
95    # VARIABLENVEREINBARUNGEN + DEFAULTWERTE
96 compile_utility_programs=false
97 config_file=.mrun.config
98 fimm=false
99 host=all
100 host_found=false
101 ibm_hb_done=false
102 lcmuk_done=false
103 locat=normal
104 makefile=""
105 remote_mode=interactive
106 scirocco=false
107 silent=false
108 suf=f90
109 update=false
110 working_directory=`pwd`
111
112 typeset -i  ih ihost=0
113
114 typeset  -R30 calltime
115 typeset  -L20 column1
116 typeset  -L50 column2
117 typeset  -L70 column3
118 typeset  -L40 version="MBUILD  2.0  Rev$Rev: 83 $"
119
120    # FEHLERBEHANDLUNG
121    # BEI EXIT:
122 trap 'rm -rf  $working_directory/tmp_mbuild
123       if [[ $locat != normal ]]
124       then
125          printf "\n\n +++ mbuild killed \n\n"
126       else
127          printf "\n\n *** mbuild finished \n\n"
128       fi' exit
129
130
131    # BEI TERMINAL-BREAK:
132 trap 'rm -rf  $working_directory/tmp_mbuild
133       printf "\n\n +++ mbuild killed by \"^C\" \n\n"
134       exit
135      ' 2
136
137
138
139    # SHELLSCRIPT-OPTIONEN EINLESEN
140 while  getopts  :c:h:m:rs:u  option
141 do
142   case  $option  in
143       (c)   config_file=$OPTARG;;
144       (h)   host=$OPTARG;;
145       (m)   makefile=$OPTARG;;
146       (r)   remote_mode=batch;;
147       (s)   suf=$OPTARG;;
148       (u)   compile_utility_programs=true;;
149       (\?)  printf "\n  +++ unknown option $OPTARG \n";
150             locat=parameter; exit;;
151   esac
152 done
153
154
155
156    # BATCH-MODE IST ZUR ZEIT NICHT FUNKTIONSFAEHIG
157 if [[ $remote_mode = batch ]]
158 then
159    printf "\n  +++ sorry, batch mode does not work! \n"
160    locat=parameter; exit
161 fi
162
163
164
165    # PRUEFEN, OB KONFIGURATIONS-DATEI VORHANDEN
166 if [[ ! -f $config_file ]]
167 then
168    printf "\n  +++ configuration file: "
169    printf "\n           $config_file"
170    printf "\n      does not exist"
171    locat=configuration; exit 
172 fi
173
174
175
176    # LOKALEN RECHNER ERMITTELN
177 local_host_real_name=$(hostname)
178# local_addres=$(nslookup `hostname` 2>&1 | grep "Address:" | tail -1 | awk '{print $2}')
179
180
181
182    # HOST-IDENTIFIER (local_host) AUS KONFIGURATIONSDATEI BESTIMMEN
183 line=""
184 grep  "%host_identifier"  $config_file  >  tmp_mbuild
185 while read line
186 do
187    if [[ "$line" != ""  ||  $(echo $line | cut -c1) != "#" ]]
188    then
189       HOSTNAME=`echo $line | cut -d" " -s -f2`
190       host_identifier=`echo $line | cut -d" " -s -f3`
191       if [[ $local_host_real_name = $HOSTNAME ]]
192       then
193          local_host=$host_identifier
194          break
195       fi
196    fi
197 done < tmp_mbuild
198
199 if [[ "$local_host" = "" ]]
200 then
201    printf "\n  +++ no host identifier found in configuration file \"$config_file\""
202    printf "\n      for local host \"$local_host_real_name\"."
203    printf "\n      Please add line"
204    printf "\n      \"\%host_identifier $local_host_real_name <identifier>\""
205    printf "\n      to the configuration file."
206    locat=local_host; exit
207 fi
208
209
210
211 [[ $local_host_real_name = scirocco ]]  &&  scirocco=true
212 [[ $local_host_real_name = fimm.bccs.uib.no ]]  &&  fimm=true
213
214
215
216 if [[ $local_host != ibms ]]
217 then
218    config_file=$PWD/$config_file
219 else
220    config_file=`pwd`/$config_file
221 fi
222
223
224 
225    # BENUTZERNAMEN AUF LOKALEM RECHNER AUS KONFIGURATIONSDATEI ERMITTELN
226 line=""
227 grep  " $local_host" $config_file | grep "%remote_username"  >  tmp_mbuild
228 while read line
229 do
230    if [[ "$line" != ""  ||  $(echo $line | cut -c1) != "#" ]]
231    then
232       local_username=`echo $line | cut -d" " -s -f2`
233    fi
234 done < tmp_mbuild
235
236
237 if [[ "$local_username" = "" ]]
238 then
239    printf "\n  +++ no user name found in configuration file"
240    printf "\n      for local host \"$local_host\" "
241    locat=config_file; exit
242 fi
243
244
245    # LOKALEN QUELLTEXTPFAD ERMITTELN.
246    # ZUERST PRUEFEN, OB EIN GLOBALER QUELLTEXTPFAD FUER ALLE RECHNER
247    # VEREINBART WURDE.
248    # DAZU ZUNAECHST ALLE IN DER KONFIGURATIONSDATEI VEREINBARTEN GLOBALEN
249    # VARIABLEN SETZEN, WEIL DIESE EVTL. IN PFADNAMEN VERWENDET WERDEN
250 line=""
251 grep "%" $config_file  >  tmp_mbuild
252 while read line
253 do
254    if [[ "$line" != ""  &&  "$(echo $line | cut -d" " -s -f3)" = "" ]]
255    then
256       var=`echo $line | cut -d" " -s -f1 | cut -c2-`
257       value=`echo $line | cut -d" " -s -f2`
258       eval export $var=\$value
259#       eval echo \"   $var=\$$var \"   # AUSGABE ZU TESTZWECKEN
260    fi
261 done < tmp_mbuild
262
263    # NUN PRUEFEN, OB EIN GLOBALER QUELLTEXTPFAD VEREINBART WURDE
264 line=""
265 grep "%source_path" $config_file  >  tmp_mbuild
266 while read line
267 do
268    if [[ "$line" != ""  &&  $(echo $line | cut -c1) != "#" ]]
269    then
270       if [[ "$(echo $line | cut -d" " -s -f3)" = "" ]]
271       then
272          global_source_path=`echo $line | cut -d" " -s -f2`
273       fi
274    fi
275 done < tmp_mbuild
276
277 line=""
278 grep  " $local_host" $config_file | grep "%source_path"  >  tmp_mbuild
279 while read line
280 do
281    if [[ "$line" != ""  &&  $(echo $line | cut -c1) != "#" ]]
282    then
283       local_source_path=`echo $line | cut -d" " -s -f2`
284    fi
285 done < tmp_mbuild
286
287 if [[ "$local_source_path" = "" ]]
288 then
289    if [[ "$global_source_path" != "" ]]
290    then
291       local_source_path=$global_source_path
292    else
293       printf "\n  +++ no source path found in configuration file"
294       printf "\n      for local host \"$local_host\" "
295       printf "\n      please set \"\%source_path\" in configuration file"
296       locat=config_file; exit
297    fi
298 fi
299 eval local_source_path=$local_source_path
300 eval local_source_path=$local_source_path
301
302
303     # EBENSO PFAD FUER DAS MAKE-DEPOSITORY ERMITTELN
304 line=""
305 grep "%depository_path" $config_file  >  tmp_mbuild
306 while read line
307 do
308    if [[ "$line" != ""  &&  $(echo $line | cut -c1) != "#" ]]
309    then
310       if [[ "$(echo $line | cut -d" " -s -f3)" = "" ]]
311       then
312          global_depository_path=`echo $line | cut -d" " -s -f2`
313       fi
314    fi
315 done < tmp_mbuild
316
317 line=""
318 grep  " $local_host" $config_file | grep "%depository_path"  >  tmp_mbuild
319 while read line
320 do
321    if [[ "$line" != ""  &&  $(echo $line | cut -c1) != "#" ]]
322    then
323       local_depository_path=`echo $line | cut -d" " -s -f2`
324    fi
325 done < tmp_mbuild
326
327 if [[ "$local_depository_path" = "" ]]
328 then
329    if [[ "$global_depository_path" != "" ]]
330    then
331       local_depository_path=$global_depository_path
332    else
333       printf "\n  +++ no depository path found in configuration file"
334       printf "\n      for local host \"$local_host\" "
335       printf "\n      please set \"\%depository_path\" in configuration file"
336       locat=config_file; exit
337    fi
338 fi
339 eval local_depository_path=$local_depository_path
340 eval local_depository_path=$local_depository_path
341
342
343
344    # PRUEFEN, OB IN KONFIGURATIONSDATEI EIN HAUPTPROGRAMM
345    # VEREINBART WURDE
346 if [[ $(grep -c "%mainprog" $config_file) != 1 ]]
347 then
348    printf "\n  +++ no main program or more than one main program defined"
349    printf "\n      in configuration file"
350    locat=configuration; exit
351 else
352    line=`grep "%mainprog" $config_file`
353    if [[ "$line" = ""  ||  $(echo $line | cut -c1) = "#" ]]
354    then
355       printf "\n  +++ no main program defined in configuration file"
356       locat=configuration; exit
357    fi
358    mainprog=`echo $line | cut -d" " -s -f2 | cut -d"." -f1`
359 fi
360
361
362
363    # MAKEFILE vorhanden
364 [[ "$makefile" = "" ]]  &&  makefile=$local_source_path/Makefile
365 if [[ ! -f $makefile ]]
366 then
367    printf "\n  +++ makefile: "
368    printf "\n           $makefile"
369    printf "\n      does not exist"
370    locat=makefile; exit 
371 fi
372
373
374    # HEADER-AUSGABE (TEIL1: MELDUNGEN UEBER LOKALEN RECHNER)
375 calltime=$(date)
376 printf "\n"
377 printf "#------------------------------------------------------------------------# \n"
378 printf "| $version$calltime | \n"
379 printf "|                                                                        | \n"
380 column1="called on:"; column2=$local_host_real_name
381 printf "| $column1$column2 | \n"
382 column1="local username:"; column2=$local_username
383 printf "| $column1$column2 | \n"
384 column1="local IP-addres:"; column2=$local_addres
385 printf "| $column1$column2 | \n"
386 column1="config file:"; column2=$config_file
387 printf "| $column1$column2 | \n"
388 column1="makefile:"; column2=$makefile
389 printf "| $column1$column2 | \n"
390 column1="local source path:"; column2=$local_source_path
391 printf "| $column1$column2 | \n"
392 column1="make depository:"; column2=$local_depository_path
393 printf "| $column1$column2 | \n"
394 printf "#------------------------------------------------------------------------# \n"
395
396# printf "|                                                                        | \n"
397
398
399 if [[ $compile_utility_programs = false ]]
400 then
401
402    cd  $local_source_path
403
404
405       # LISTE DER ZU PRUEFENDEN QUELLTEXTDATEIEN ERSTELLEN
406    source_code_files=`ls -1  *.$suf`
407
408
409
410       # VERZEICHNIS FUER DAS MAKE-DEPOSITORY ERZEUGEN,
411       # FALLS NOCH NICHT VORHANDEN. ANSONSTEN ALLE DATEIEN
412       # NEUEREN DATUMS IN DIESES VERZEICHNIS KOPIEREN
413    if [[ ! -d $local_depository_path ]]
414    then
415       if  mkdir $local_depository_path
416       then
417          printf "\n\n  *** directory for make depository:"
418          printf "\n           $local_depository_path"
419          printf "\n      was created\n"
420
421             # MAKEFILE UND QUELLTEXTDATEIEN UNTER BEIBEHALTUNG
422             # IHRES DATUMS INS VERZEICHNIS KOPIEREN
423          printf "\n  *** makefile and source code files are copied to"
424          printf "\n      $local_depository_path\n"
425          printf "\n      copying makefile \"$makefile\" ..."
426          cp -p  $makefile  $local_depository_path/Makefile
427
428             # QUELLTEXTDATEIEN MUESSEN IM MAKEFILE AUFGEFUEHRT
429             # SEIN
430          for  filename  in  $source_code_files
431          do
432             if [[ $(grep -c $filename  $makefile) = 0 ]]
433             then
434                printf "\n  +++ source code file:"
435                printf "\n         $filename"
436                printf "\n      is not listed in makefile"
437                locat=makefile; exit
438             else
439                printf "\n      copying source code file \"$filename\" ..."
440                cp -p  $filename  $local_depository_path
441             fi
442          done
443          printf "\n"
444       else
445          printf "\n  +++ directory for make depository:"
446          printf "\n           $local_depository_path"
447          printf "\n      cannot be created"
448          locat=local_depository_path; exit
449       fi
450    else
451 
452       printf "\n  *** checking file status ..."
453
454          # MAKEFILE KOPIEREN, FALLS NEUEREN DATUMS
455       if [[ $makefile -nt $local_depository_path/Makefile ]]
456       then
457          printf "\n  *** update of \"$makefile\" "
458          cp -f -p  $makefile  $local_depository_path/Makefile
459          update=true
460
461             # PRUEFEN, OB ALLE DATEIEN IM DEPOSITORY AUCH IM NEUEN MAKEFILE
462             # VERZEICHNET SIND UND GEGEBENENFALLS DATEIEN LOESCHEN
463          cd  $local_depository_path
464          source_code_files_in_depository=`ls -1  *.$suf`
465          for  filename  in  $source_code_files_in_depository
466          do
467             if [[ $(grep -c $filename  Makefile) = 0 ]]
468             then
469                printf "\n  *** source code file in \"$local_depository_path\":"
470                printf "\n         $filename"
471                printf "\n      is not listed in makefile"
472                if [[ $silent = false ]]
473                then
474                   answer=dummy
475                   printf "\n\n"
476                   while [[ "$answer" != y  &&  "$answer" != Y  &&  "$answer" != n  &&  "$answer" != N ]]
477                   do
478                      printf " >>> delete \"$filename\" in \"$local_depository_path\" (y/n) ?  "
479                      read  answer
480                   done
481                   if [[ $answer = y  ||  $answer = Y ]]
482                   then
483                      base=`echo $filename | cut -d. -f2`
484                      rm -f  $filename
485                      rm -f  ${base}.o  ${base}.mod
486                      printf "\n  *** \"$filename\" deleted in \"$local_depository_path\" "
487                   else
488                      printf "\n  *** \"$filename\" not deleted in \"$local_depository_path\" "
489                   fi
490                fi
491             fi
492          done
493          cd  -  > /dev/null  2>&1
494
495       elif [[ $local_depository_path/Makefile -nt $makefile ]]
496       then
497          printf "\n  *** makefile in depository is newer than"
498          printf "\n      \"$makefile\" "
499          if [[ $silent = false ]]
500          then
501             answer=dummy
502             printf "\n\n"
503             while [[ "$answer" != y  &&  "$answer" != Y  &&  "$answer" != n  &&  "$answer" != N ]]
504             do
505                printf " >>> update \"$makefile\" (y/n) ?  "
506                read  answer
507             done
508             if [[ $answer = y  ||  $answer = Y ]]
509             then
510                cp -f -p  $local_depository_path/Makefile  $makefile
511                printf "\n  *** \"$makefile\" updated"
512             else
513                printf "\n  *** \"$makefile\" not updated"
514             fi
515          fi
516       fi
517
518          # QUELLTEXTDATEIEN KOPIEREN, FALLS NEUEREN DATUMS
519          # SIE MUESSEN IM MAKEFILE AUFGEFUEHRT SEIN
520       for  filename  in  $source_code_files
521       do
522          if [[ $(grep -c $filename  $makefile) = 0 ]]
523          then
524             printf "\n  +++ source code file:"
525             printf "\n         $filename"
526             printf "\n      is not listed in makefile"
527             locat=makefile; exit
528          else
529             if [[ ! -f $local_depository_path/$filename ]]
530             then
531                cp -p  $filename  $local_depository_path
532                printf "\n  *** source code file \"$filename\" created in \"$local_depository_path\" "
533             fi
534             if [[ $filename -nt $local_depository_path/$filename ]]
535             then
536                printf "\n  *** update of source code file \"$filename\" "
537                cp -f -p  $filename  $local_depository_path
538                update=true
539             fi
540          fi
541       done
542
543
544          # PRUEFEN, OB ALLE DATEIEN IM DEPOSITORY IM AKTUELLEN ARBEITSVERZEICHNIS VORHANDEN
545          # ODER EVTL. NEUEREN DATUMS SIND
546       cd  $local_depository_path
547       source_code_files_in_depository=`ls -1  *.$suf`
548       cd  -  > /dev/null  2>&1
549       for  filename  in  $source_code_files_in_depository
550       do
551          if [[ ! -f $filename ]]
552          then
553             printf "\n  *** source code file \"$filename\" does not exist in current directory"
554             if [[ $silent = false ]]
555             then
556                answer=dummy
557                printf "\n\n"
558                while [[ "$answer" != y  &&  "$answer" != Y  &&  "$answer" != n  &&  "$answer" != N ]]
559                do
560                   printf " >>> create \"$filename\" in current directory (y/n) ?  "
561                   read  answer
562                done
563                if [[ $answer = y  ||  $answer = Y ]]
564                then
565                   cp -p  $local_depository_path/$filename  $filename
566                   printf "\n  *** source code file \"$filename\" created in current directory"
567                else
568                   printf "\n  *** source code file \"$filename\" not created in current directory"
569                fi
570             fi
571          elif [[ $local_depository_path/$filename -nt $filename ]]
572          then
573             ls -al $local_depository_path/$filename
574             ls -al $filename
575             printf "\n  *** source code file \"$filename\" in depository is newer than in current directory"
576             if [[ $silent = false ]]
577             then
578                answer=dummy
579                printf "\n\n"
580                while [[ "$answer" != y  &&  "$answer" != Y  &&  "$answer" != n  &&  "$answer" != N ]]
581                do
582                   printf " >>> update \"$filename\" in current directory (y/n) ?  "
583                   read  answer
584                done
585                if [[ $answer = y  ||  $answer = Y ]]
586                then
587                   cp -f -p  $local_depository_path/$filename  $filename
588                   printf "\n  *** source code file \"$filename\" updated in current directory"
589                else
590                   printf "\n  *** source code file \"$filename\" not updated in current directory"
591                fi
592             fi
593          fi
594       done
595
596       if [[ $update = false ]]
597       then
598          printf "\n  *** no updates necessary in \"$local_depository_path\" "
599          if [[ $silent = false ]]
600          then
601             answer=dummy
602             printf "\n\n"
603             while [[ "$answer" != y  &&  "$answer" != Y  &&  "$answer" != n  &&  "$answer" != N ]]
604             do
605                printf " >>> continue with updates on remote hosts (y/n) ?  "
606                read  answer
607             done
608             if [[ $answer = n  ||  $answer = N ]]
609             then
610                locat=user_abort; exit
611             fi
612          fi
613       fi
614    fi
615 
616
617 
618       # QUELLTEXTDATEIEN UND MAKEFILE MIT TAR ZUSAMMENBINDEN
619       # IN JEDEM FALL ALLEN DATEIEN WRITE-PERMIT GEBEN, DAMIT ES AUF
620       # DEN REMOTE-RECHNERN NICHT EVTL. ZU PROBLEMEN BEIM UEBERSCHREIBEN KOMMT
621    printf "\n\n  *** tar of makefile and source files in depository ..." 
622    cd  $local_depository_path
623    chmod u+w  Makefile  *.$suf
624    tar -cf  ${mainprog}_sources.tar  Makefile  *.$suf
625    printf "\n"
626
627 fi
628
629
630
631    # BESTAETIGUNG ZUM WEITERMACHEN EINHOLEN
632 if [[ $host = all ]]
633 then
634    printf "\n  *** updates will be made for ALL hosts found in"
635    printf "\n      the configuration file"
636 else
637    printf "\n  *** update will be made for host \"$host\" "
638 fi
639
640 if [[ $silent = false ]]
641 then
642    answer=dummy
643    printf "\n\n"
644    while [[ "$answer" != y  &&  "$answer" != Y  &&  "$answer" != n  &&  "$answer" != N ]]
645    do
646       printf " >>> continue (y/n) ?  "
647       read  answer
648    done
649    if [[ $answer = n  ||  $answer = N ]]
650    then
651       locat=user_abort; exit
652    fi
653 fi
654 
655 
656
657   
658    # GENERIERUNG DER AKTUELLEN MODELLVERSION FUER ALLE RECHNER-/UEBERSETZUNGS-
659    # VERSIONEN, DIE IN DER KONFIGURATIONSDATEI GEFUNDEN WERDEN
660 printf "\n  *** scanning configuration file for host(s) ..."
661
662 grep  %fopts  $config_file  >  tmp_mbuild
663 while read line
664 do
665       # KOMMENTARZEILEN UEBERSPRINGEN
666    [[ $(echo $line | cut -c1) = "#" ]]  &&  continue
667    (( ihost = ihost + 1 ))
668    hostline[$ihost]="$line"
669 done < tmp_mbuild
670
671 
672 while (( ih < ihost ))
673 do
674
675    (( ih = ih + 1 ))
676
677       # REMOTE-RECHNER UND UEBERSETZUNGS-VERSION FESTSTELLEN
678       # NUR WEITERMACHEN, WENN ENTSPRECHENDER REMOTE-RECHNER MITTELS
679       # SHELLSCRIPT-OPTION AUCH AUSGEWAEHLT WURDE
680    remote_host_string=`echo ${hostline[$ih]} | cut -d" " -s -f3-`
681    remote_host=`echo $remote_host_string | cut -d" " -f1`
682    if [[ $host != all ]]
683    then
684       [[ $remote_host != $host ]]  &&  continue
685    fi
686    host_found=true
687    condition1=`echo $remote_host_string | cut -d" " -s -f2`
688    if [[ $condition1 = $remote_host ]]
689    then
690       condition1=""
691    else
692       condition2=`echo $remote_host_string | cut -d" " -s -f3`
693    fi
694
695    netcdf_inc=""
696    netcdf_lib=""
697
698       # AUF HLRN-RECHNER NUR EINMAL UEBERSETZEN
699    if [[ $remote_host = ibmb  ||  $remote_host = ibmh ]]
700    then
701       if [[ $ibm_hb_done = true ]]
702       then
703          printf "\n *** remote host \"$remote_host\" skipped since compilation has already"
704          printf "\n     been carried out on one of the HLRN machines\n"
705          continue
706       fi
707    fi
708
709       # AUF LCMUK-RECHNER NUR EINMAL UEBERSETZEN
710    if [[ $remote_host = lcmuk ]]
711    then
712       if [[ $lcmuk_done = true ]]
713       then
714          printf "\n *** local host \"$remote_host\" skipped since compilation has already"
715          printf "\n     been carried out on this host\n"
716          continue
717       fi
718    fi
719
720
721       # IP-ADRESSE DES REMOTE-RECHNERS BESTIMMEN
722    case  $remote_host  in
723        (lcmuk)          remote_addres=130.75.105.3;;
724        (lctit)          remote_addres=172.17.75.161;;
725        (decalpha)       remote_addres=165.132.26.56;;
726        (ibmb)           remote_addres=130.73.230.10;;
727        (ibmh)           remote_addres=130.75.4.10;;
728        (ibms)           remote_addres=150.183.5.101;;
729        (ibmy)           remote_addres=165.132.26.58;;
730        (nech)           remote_addres=136.172.44.192;;
731        (neck)           remote_addres=133.5.178.11;;
732        (ground.yonsei.ac.kr) remote_addres=134.75.155.33;;
733        (*)              if [[ $local_host != $remote_host ]]
734                         then
735                            printf "\n  +++ remote host \"$remote_host\" unknown";
736                            printf "\n      please inform S. Raasch!"
737                         fi;;
738    esac
739
740
741       # REMOTE-USERNAMEN ERMITTELN
742    line=""
743    grep  "$remote_host_string" $config_file | grep "%remote_username"  >  tmp_mbuild
744    while read line1
745    do
746       if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]]
747       then
748          line="$line1"
749       fi
750    done < tmp_mbuild
751
752    if [[ "$line" = ""  ||  $(echo $line | cut -c1) = "#" ]]
753    then
754       printf "\n  +++ no remote username found in configuration file"
755       printf "\n      for \"$remote_host_string\" "
756       locat=config_file; exit
757    else
758       remote_username=`echo $line | cut -d" " -s -f2`
759    fi
760
761
762       # REMOTE-QUELLTEXTPFAD ERMITTELN
763    line=""
764    remote_source_path=""
765    grep  "$remote_host_string" $config_file | grep "%source_path"  >  tmp_mbuild
766    while read line1
767    do
768       if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]]
769       then
770          line="$line1"
771       fi
772    done < tmp_mbuild
773
774    if [[ "$line" != ""  &&  $(echo $line | cut -c1) != "#" ]]
775    then
776       remote_source_path=`echo $line | cut -d" " -s -f2`
777    fi
778    if [[ "$remote_source_path" = "" ]]
779    then
780       if [[ "$global_source_path" != "" ]]
781       then
782          remote_source_path=$global_source_path
783       else
784          printf "\n  +++ no source path found in configuration file"
785          printf "\n      for \"$remote_host_string\" "
786          locat=config_file; exit
787       fi
788    fi
789
790    remote_ud=${remote_source_path}/../UTIL
791    remote_ud=$(eval echo $remote_ud)
792
793
794       # REMOTE-PFAD FUER MAKE-DEPOSITORY ERMITTELN
795    remote_md=""
796    line=""
797    grep  "$remote_host_string" $config_file | grep "%depository_path"  >  tmp_mbuild
798    while read line1
799    do
800       if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]]
801       then
802          line="$line1"
803       fi
804    done < tmp_mbuild
805
806    if [[ "$line" != ""  &&  $(echo $line | cut -c1) != "#" ]]
807    then
808       remote_md=`echo $line | cut -d" " -s -f2`
809    fi
810    if [[ "$remote_md" = "" ]]
811    then
812       if [[ "$global_depository_path" != "" ]]
813       then
814          remote_md=$global_depository_path
815       else
816          printf "\n  +++ no depository path found in configuration file"
817          printf "\n      for \"$remote_host_string\" "
818          printf "\n      please set \"\%depository_path\" in configuration file"
819          locat=config_file; exit
820       fi
821    fi
822
823    remote_md=$(eval echo $remote_md)
824
825
826       # COMPILERNAMEN ERMITTELN
827    line=""
828    grep  "$remote_host_string" $config_file | grep "%compiler_name "  >  tmp_mbuild
829    while read line1
830    do
831       if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]]
832       then
833          line="$line1"
834       fi
835    done < tmp_mbuild
836
837    if [[ "$line" = ""  ||  $(echo $line | cut -c1) = "#" ]]
838    then
839       printf "\n  +++ no compiler name found in configuration file"
840       printf "\n      for \"$remote_host_string\" "
841       locat=config_file; exit
842    else
843       compiler_name=`echo $line | cut -d" " -s -f2`
844    fi
845
846
847       # BEI BENUTZUNG EINES PARALLELEN COMPILERS MUSS AUCH EIN
848       # SERIELLER COMPILERNAME ERMITTELT WERDEN
849    if [[ $(echo $remote_host_string | grep -c parallel) = 1 ]]
850    then
851       line=""
852       grep  "$remote_host_string" $config_file | grep "%compiler_name_ser"  >  tmp_mbuild
853       while read line1
854       do
855          if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]]
856          then
857             line="$line1"
858          fi
859       done < tmp_mbuild
860
861       if [[ "$line" = ""  ||  $(echo $line | cut -c1) = "#" ]]
862       then
863          printf "\n  +++ no serial compiler name found in configuration file"
864          printf "\n      for \"$remote_host_string\" "
865          locat=config_file; exit
866       else
867          compiler_name_ser=`echo $line | cut -d" " -s -f2`
868       fi
869    else
870       compiler_name_ser=$compiler_name
871    fi
872
873
874
875       # PRAEPROZESSOR-OPTIONEN/DIREKTIVEN ERMITTELN
876    line=""
877    grep  "$remote_host_string" $config_file | grep "%cpp_options"  >  tmp_mbuild
878    while read line1
879    do
880       if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]]
881       then
882          line="$line1"
883       fi
884    done < tmp_mbuild
885    if [[ "$line" = ""  ||  $(echo $line | cut -c1) = "#" ]]
886    then
887       printf "\n  +++ no preprocessor options found in configuration file"
888       printf "\n      for \"$remote_host_string\" "
889       locat=config_file; exit
890    else
891          # EVENTUELLE DOPPELPUNKTE AUS OPTIONSSTRING ENTFERNEN
892       cpp_options=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'`
893    fi
894
895       # RECHNERSPEZIFISCHE CPP-DIREKTIVEN HINZUFUEGEN
896    for  string  in  $remote_host_string
897    do
898       if [[ $(echo $remote_host | cut -c1-2) = lc  &&  $(echo $string | cut -c1-2) = lc ]]
899       then
900          cpp_options="$cpp_options -D__lc "
901       elif [[ $(echo $remote_host | cut -c1-3) = ibm  &&  $(echo $string | cut -c1-3) = ibm ]]
902       then
903          cpp_options="${cpp_options},-D__ibm"
904       elif [[ $(echo $remote_host | cut -c1-3) = nec  &&  $(echo $string | cut -c1-3) = nec ]]
905       then
906          cpp_options="${cpp_options} -D__nec"
907       else
908          if [[ $(echo $remote_host | cut -c1-3) = ibm ]]
909          then
910             cpp_options="${cpp_options},-D__$string"
911          else
912             cpp_options="$cpp_options -D__$string "
913          fi
914       fi
915    done
916
917
918
919       # NETCDF-OPTIONEN ERMITTELN
920    line=""
921    grep  "$remote_host_string" $config_file | grep "%netcdf_inc"  >  tmp_mbuild
922    while read line1
923    do
924       if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]]
925       then
926          line="$line1"
927       fi
928    done < tmp_mbuild
929    if [[ "$line" != ""  &&  $(echo $line | cut -c1) != "#" ]]
930    then
931          # EVENTUELLE DOPPELPUNKTE AUS OPTIONSSTRING ENTFERNEN
932       netcdf_inc=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'`
933    fi
934
935    line=""
936    grep  "$remote_host_string" $config_file | grep "%netcdf_lib"  >  tmp_mbuild
937    while read line1
938    do
939       if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]]
940       then
941          line="$line1"
942       fi
943    done < tmp_mbuild
944    if [[ "$line" != ""  &&  $(echo $line | cut -c1) != "#" ]]
945    then
946          # EVENTUELLE DOPPELPUNKTE AUS OPTIONSSTRING ENTFERNEN
947       netcdf_lib=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'`
948    fi
949
950
951
952       # COMPILEROPTIONEN ERMITTELN
953    line=""
954    grep  "$remote_host_string" $config_file | grep "%fopts"  >  tmp_mbuild
955    while read line1
956    do
957       if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]]
958       then
959          line="$line1"
960       fi
961    done < tmp_mbuild
962    if [[ "$line" = ""  ||  $(echo $line | cut -c1) = "#" ]]
963    then
964       printf "\n  +++ no compiler options found in configuration file"
965       printf "\n      for \"$remote_host_string\" "
966       locat=config_file; exit
967    else
968          # EVENTUELLE DOPPELPUNKTE AUS DIREKTIVENSTRING ENTFERNEN
969       compiler_options=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'`
970
971          # NETCDF-INCLUDEVERZEICHNIS HINZUFUEGEN
972       compiler_options="$compiler_options $netcdf_inc"
973    fi
974
975
976
977       # LADER-OPTIONEN ERMITTELN
978    line=""
979    grep  "$remote_host_string" $config_file | grep "%lopts"  >  tmp_mbuild
980    while read line1
981    do
982       if [[ $(echo $line1 | cut -d" " -s -f3-) = "$remote_host_string" ]]
983       then
984          line="$line1"
985       fi
986    done < tmp_mbuild
987
988    if [[ "$line" = ""  ||  $(echo $line | cut -c1) = "#" ]]
989    then
990       printf "\n  +++ no loader options found in configuration file"
991       printf "\n      for \"$remote_host_string\" "
992       locat=config_file; exit
993    else
994          # EVENTUELLE DOPPELPUNKTE AUS DIREKTIVENSTRING ENTFERNEN
995       loader_options=`echo $line | cut -d" " -s -f2 | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'`
996
997          # NETCDF-LIBRARY HINZUFUEGEN
998       loader_options="$loader_options $netcdf_lib"
999    fi
1000
1001
1002    printf "\n\n#------------------------------------------------------------------------# \n"
1003    if [[ $remote_host = $local_host ]]
1004    then
1005       column1="remote_host:"; column2="$remote_host (= local host!)"
1006    else
1007       column1="remote_host:"; column2=$remote_host
1008    fi
1009    printf "| $column1$column2 | \n"
1010    printf "|                                                                        | \n"
1011    column1="conditions:"; column2="$condition1 $condition2"
1012    printf "| $column1$column2 | \n"
1013    column1="make depository:"; column2=$remote_md
1014    printf "| $column1$column2 | \n"
1015    if [[ $compile_utility_programs = true ]]
1016    then
1017       column1="utility directory:"; column2=$remote_ud
1018       printf "| $column1$column2 | \n"
1019    fi
1020    column1="username:"; column2=$remote_username
1021    printf "| $column1$column2 | \n"
1022    column1="addres:"; column2=$remote_addres
1023    printf "| $column1$column2 | \n"
1024    column1="compiler:"; column2=$compiler_name
1025    printf "| $column1$column2 | \n"
1026    if [[ $compile_utility_programs = true ]]
1027    then
1028       column1="serial compiler:"; column2=$compiler_name_ser
1029       printf "| $column1$column2 | \n"
1030    fi
1031    column1="cpp options:"; column2=$cpp_options
1032    printf "| $column1$column2 | \n"
1033    line=$(echo "$cpp_options" | cut -c51-)
1034    while [[ "$line" != "" ]]
1035    do
1036       column1=""
1037       column2=$line
1038       printf "| $column1$column2 | \n"
1039       line=$(echo "$line" | cut -c51-)
1040    done
1041    column1="compiler options:"; column2=$compiler_options
1042    printf "| $column1$column2 | \n"
1043    line=$(echo "$compiler_options" | cut -c51-)
1044    while [[ "$line" != "" ]]
1045    do
1046       column1=""
1047       column2=$line
1048       printf "| $column1$column2 | \n"
1049       line=$(echo "$line" | cut -c51-)
1050    done
1051    column1="loader options:"; column2=$loader_options
1052    printf "| $column1$column2 | \n"
1053    line=$(echo "$loader_options" | cut -c51-)
1054    while [[ "$line" != "" ]]
1055    do
1056       column1=""
1057       column2=$line
1058       printf "| $column1$column2 | \n"
1059       line=$(echo "$line" | cut -c51-)
1060    done
1061    printf "#------------------------------------------------------------------------# \n"
1062
1063    if [[ $silent = false ]]
1064    then
1065       answer=dummy
1066       printf "\n\n"
1067       while [[ "$answer" != y  &&  "$answer" != Y  && "$answer" != c  &&  "$answer" != C  && "$answer" != s  &&  "$answer" != S  &&  "$answer" != a  &&  "$answer" != A ]]
1068       do
1069          printf " >>> continue (y(es)/c(ontinue)/a(bort)/s(skip)) ?  "
1070          read  answer
1071       done
1072       if [[ $answer = a  ||  $answer = A ]]
1073       then
1074          locat=user_abort; exit
1075       fi
1076       if [[ $answer = c  ||  $answer = C ]]
1077       then
1078          silent=false
1079       fi
1080       if [[ $answer = s  ||  $answer = S ]]
1081       then
1082          continue
1083       fi
1084    fi
1085
1086
1087    if [[ $remote_mode = batch ]]
1088    then
1089
1090          # BATCH-JOB PARAMETER SETZEN
1091       case  $remote_host  in
1092           (t3eb)           queue=berte; memory=60; cputime=1000; xoption="-X 0";;
1093           (t3eh)           queue=comp_t3e; memory=60; cputime=360;;
1094           (t3ej2)          queue=normal; memory=60; cputime=1000; xoption="-X 0";;
1095           (t3ej5|ground.yonsei.ac.kr)  printf "\n  --- remote host \"$remote_host\" does not allow batch jobs"; continue;;
1096       esac
1097
1098
1099          # BATCH-JOB ZUSAMMENSTELLEN
1100       printf "\n  *** creating batch-job for remote host"
1101       echo " "  >  mbuild_job
1102
1103          # AUF CRAY-RECHNERN IN JUELICH WIRD KEIN BENUTZER-PROFILE AUSGEFUEHRT
1104          # DIES WIRD HIER GETAN, UM PFADE USW. ZU SETZEN
1105       if [[ $remote_host = t3ej2 ]]
1106       then
1107          echo "set +vx"                       >>  mbuild_job
1108          echo ". .profile"                    >>  mbuild_job
1109          echo "set -x"                        >>  mbuild_job
1110       fi
1111
1112          # AUF CRAY-RECHNERN GELADENE MODULE AUFLISTEN
1113       if [[ $host = t3eb  || $host = t3eh  ||  $host = t3ej2 ]]
1114       then
1115          echo "module list"                   >>  mbuild_job
1116       fi
1117
1118
1119          # WECHSEL IN TEMPORAERES VERZEICHNIS
1120       echo "cd ${remote_md}"  >>  mbuild_job
1121
1122
1123          # AKTUELLE QUELLTEXTVERSION INS REMOTE-QUELLTEXTVERZEICHNIS KOPIEREN
1124       echo  "scp  ${local_username}@${local_addres}:~/modell/code_3dp/palm_current_version/${mainprog}_sources.tar  ${mainprog}_sources.tar"  >>  mbuild_job
1125#       echo  "[[ \$? != 0 ]]  &&  (echo "+++ scp failed"; exit)"  >>  mbuild_job
1126
1127
1128          # FALLS VORHANDEN, LETZTE VERSION AUF DEM REMOTE-RECHNER AUSPACKEN
1129       echo  "[[ -f ${mainprog}_current_version.tar ]]  &&  tar -xvf  ${mainprog}_current_version.tar"  >>  mbuild_job
1130
1131
1132          # AKTUELLE QUELLTEXTVERSION AUF REMOTE-RECHNER AUSPACKEN
1133       echo  "tar -xvf  ${mainprog}_sources.tar"              >>  mbuild_job
1134
1135
1136          # MAKE MIT ZUVOR ERMITTELTEN OPTIONEN AUF REMOTE RECHNER AUSFUEHREN
1137       echo  "make  PROG=$mainprog  F90=$compiler_name  COPT=\"$cpp_options\"  F90FLAGS=\"$compiler_options\"  LDFLAGS=\"$loader_options\" "  >>  mbuild_job
1138       echo  "chmod  u+w  *"                                  >>  mbuild_job
1139
1140          # NEUE VERSION AUF REMOTE-RECHNER ZUSAMMENPACKEN
1141       echo  "tar -cvf  ${mainprog}_current_version.tar  *.f90  *.o"  >>  mbuild_job
1142
1143
1144          # AKTUELLES VERSIONSVERZEICHNIS AUF REMOTE-RECHNER BEREINIGEN
1145       echo  "make  clean"                                    >>  mbuild_job
1146       echo  "rm ${mainprog}_sources.tar"                     >>  mbuild_job
1147       echo  "rm *.f90 Makefile"                              >>  mbuild_job
1148
1149
1150
1151          # JOB MITTELS SUBJOB STARTEN
1152       printf "\n  *** sending batch job to remote host"
1153#       subjob  $xoption  -h $remote_host  -q $queue  -m $memory  -t $cputime  -v  mbuild_job
1154
1155
1156          # JOBFILE LOESCHEN
1157#       rm  aljob
1158
1159    else
1160
1161       if [[ $remote_host != $local_host ]]
1162       then
1163
1164          if [[ $compile_utility_programs = false ]]
1165          then
1166
1167                # AKTUELLE QUELLTEXTVERSION INS REMOTE-QUELLTEXTVERZEICHNIS KOPIEREN
1168                # FALLS DIESES NOCH NICHT EXISTIERT, WIRD ES ERZEUGT
1169             echo "  *** copying \"${mainprog}_sources.tar\" to \"${remote_addres}:${remote_md}/\" "
1170             if [[ $remote_host != lctit ]]
1171             then
1172                ssh  ${remote_username}@${remote_addres} "[[ ! -d ${remote_md} ]]  &&  (echo \"  *** ${remote_md} will be created\"; mkdir -p  ${remote_md})"
1173             else
1174                   # TIT ERLAUBT NUR DIE AUSFÜHRUNG GANZ BESTIMMTER KOMMANDOS
1175                   # MIT SSH, DESHALB AUFRUF PER PIPE
1176                print "[[ ! -d ${remote_md} ]]  &&  (echo \"  *** ${remote_md} will be created\"; mkdir -p  ${remote_md})"  |  ssh ${remote_username}@${remote_addres}  2>&1
1177             fi
1178             if [[ $local_host = decalpha ]]
1179             then
1180                   # DECALPHA BENUTZT BEI NICHTANGABE DES VOLLSTÄNDIGEN PFADES
1181                   # IRGENDEIN ANDERES SCP (WAS NICHT FUNKTIONIERT). AUSSERDEM
1182                   # KOENNEN DOLLAR-ZEICHEN NICHT BENUTZT WERDEN
1183                remote_md=`echo $remote_md | sed 's/\$HOME\///'`
1184                /bin/scp  ${mainprog}_sources.tar  ${remote_username}@${remote_addres}:${remote_md}/${mainprog}_sources.tar
1185             else
1186                scp  ${mainprog}_sources.tar  ${remote_username}@${remote_addres}:${remote_md}/${mainprog}_sources.tar
1187             fi
1188
1189
1190
1191                # FALLS VORHANDEN, LETZTE VERSION AUF DEM REMOTE-RECHNER AUSPACKEN
1192             echo "  *** untar previous update on remote host, if existing"
1193             if [[ $remote_host != lctit ]]
1194             then
1195                ssh  ${remote_username}@${remote_addres}  "cd ${remote_md}; [[ -f ${mainprog}_current_version.tar ]]  &&  tar -xf  ${mainprog}_current_version.tar"
1196             else
1197                   # TIT ERLAUBT NUR DIE AUSFÜHRUNG GANZ BESTIMMTER KOMMANDOS
1198                   # MIT SSH, DESHALB AUFRUF PER PIPE
1199                print  "cd ${remote_md}; [[ -f ${mainprog}_current_version.tar ]]  &&  tar -xf  ${mainprog}_current_version.tar"  |  ssh  ${remote_username}@${remote_addres}  2>&1
1200             fi
1201
1202
1203                # AKTUELLE QUELLTEXTVERSION AUF REMOTE-RECHNER AUSPACKEN
1204             echo "  *** untar actual sources on remote host"
1205             if [[ $remote_host != lctit ]]
1206             then
1207                ssh  ${remote_username}@${remote_addres}  "cd ${remote_md}; tar -xf  ${mainprog}_sources.tar"
1208             else
1209                   # TIT ERLAUBT NUR DIE AUSFÜHRUNG GANZ BESTIMMTER KOMMANDOS
1210                   # MIT SSH, DESHALB AUFRUF PER PIPE
1211                print  "cd ${remote_md}; tar -xf  ${mainprog}_sources.tar"  |  ssh  ${remote_username}@${remote_addres}  2>&1
1212             fi
1213
1214
1215                # MAKE MIT ZUVOR ERMITTELTEN OPTIONEN AUF REMOTE RECHNER AUSFUEHREN
1216                # KOMMANDOUEBERGABE AN SSH PER PIPE, DA SO DIE SYSTEM- UND
1217                # BENUTZERPROFILE VOLLSTAENDIG AUSGEFUEHRT WERDEN (SONST FEHLEN MAKE
1218                # Z.B. DIE PFADE ZUM COMPILER)
1219             echo "  *** execute \"make\" on remote host"
1220
1221             if [[ $remote_host = nech ]]
1222             then
1223                make_call_string="sxmake  PROG=$mainprog  F90=$compiler_name  COPT=\"$cpp_options\"  F90FLAGS=\"$compiler_options\"  LDFLAGS=\"$loader_options\" "
1224             else
1225                make_call_string="make  PROG=$mainprog  F90=$compiler_name  COPT=\"$cpp_options\"  F90FLAGS=\"$compiler_options\"  LDFLAGS=\"$loader_options\" "
1226             fi
1227
1228             if [[ $remote_host = t3eh ]]
1229             then
1230       
1231                print "xterm\nexit\n cd ${remote_md}; make  PROG=$mainprog  F90=$compiler_name  COPT=\"$cpp_options\"  F90FLAGS=\"$compiler_options\"  LDFLAGS=\"$loader_options\" " | ssh  ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll
1232
1233             elif [[ $remote_host = t3ej2  ||  $remote_host = ibms  ||  $remote_host = ibmy ]]
1234             then
1235
1236                ssh  ${remote_username}@${remote_addres}  "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
1237
1238             elif [[ $remote_host = ibmb  ||  $remote_host = ibmh ]]
1239             then
1240
1241                print "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
1242
1243             elif [[ $remote_host = lctit ]]
1244             then
1245
1246                echo  " "  >  ${remote_host}_last_make_protokoll
1247                while [[ $(cat ${remote_host}_last_make_protokoll | grep -c "Forwarding to N1GE") = 0 ]]
1248                do
1249                   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
1250                done
1251
1252             else
1253
1254                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
1255
1256             fi
1257
1258             if [[ $(grep -c MAKE_ERROR ${remote_host}_last_make_protokoll) != 0 ]]
1259             then
1260                printf "\a\n  +++ error(s) occurred during compiling or linking on host \"$remote_host\" "
1261                if [[ $silent = false ]]
1262                then
1263                   answer=dummy
1264                   printf "\n"
1265                   while [[ "$answer" != c  &&  "$answer" != k ]]
1266                   do
1267                      printf "  >>> continue / list errors / kill mbuild (c/l/k) ? "
1268                      read  answer
1269                      if [[ "$answer" = l ]]
1270                      then
1271                         more ${remote_host}_last_make_protokoll
1272                      fi
1273                   done
1274                   if [[ $answer = k ]]
1275                   then
1276                      locat=user_abort; exit
1277                   fi
1278                fi
1279             fi
1280
1281
1282
1283                # NEUE VERSION AUF REMOTE-RECHNER ZUSAMMENPACKEN
1284             printf "\n  *** tar update on remote host ..."
1285             if [[ $remote_host != lctit ]]
1286             then
1287                ssh  ${remote_username}@${remote_addres}  "cd ${remote_md}; chmod u+w *; tar -cf  ${mainprog}_current_version.tar  *.f90 *.o *.mod"
1288             else
1289                   # TIT ERLAUBT NUR DIE AUSFÜHRUNG GANZ BESTIMMTER KOMMANDOS
1290                   # MIT SSH, DESHALB AUFRUF PER PIPE
1291                print  "cd ${remote_md}; chmod u+w *; tar -cf  ${mainprog}_current_version.tar  *.f90 *.o *.mod"  |  ssh  ${remote_username}@${remote_addres}  2>&1
1292             fi
1293
1294
1295                # AKTUELLES VERSIONSVERZEICHNIS AUF REMOTE-RECHNER BEREINIGEN
1296#             printf "\n  *** \"make clean\" on remote host ..."
1297#             ssh  ${remote_username}@${remote_addres}  "cd ${remote_md}; make clean; rm ${mainprog}_sources.tar; rm *.f90 Makefile"
1298#             printf "\n"
1299
1300
1301
1302
1303             # GLEICHE AKTIONEN FUER DIE UTILITY-PROGRAMME DURCHFUEHREN
1304             # AKTUELLE QUELLTEXTVERSION INS REMOTE-QUELLTEXTVERZEICHNIS KOPIEREN
1305             # FALLS DIESES NOCH NICHT EXISTIERT, WIRD ES ERZEUGT
1306          elif [[ $compile_utility_programs = true ]]
1307          then
1308
1309             printf "\n\n"
1310             echo "  *** copying scripts and utility programs to \"${remote_addres}:${remote_ud}/\" "
1311             cd  ${local_source_path}/../SCRIPTS
1312
1313             if [[ $remote_host != lctit ]]
1314             then
1315                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)"
1316             else
1317                   # TIT ERLAUBT NUR DIE AUSFÜHRUNG GANZ BESTIMMTER KOMMANDOS
1318                   # MIT SSH, DESHALB AUFRUF PER PIPE
1319                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
1320             fi
1321
1322                # KOPIEREN DER SCRIPTE
1323             if [[ $local_host = decalpha ]]
1324             then
1325                   # DECALPHA BENUTZT BEI NICHTANGABE DES VOLLSTÄNDIGEN PFADES
1326                   # IRGENDEIN ANDERES SCP (WAS NICHT FUNKTIONIERT). AUSSERDEM
1327                   # KOENNEN DOLLAR-ZEICHEN NICHT BENUTZT WERDEN
1328                remote_ud=`echo $remote_ud | sed 's/\$HOME\///'`
1329                /bin/scp  batch_scp mbuild mrun subjob  ${remote_username}@${remote_addres}:${remote_ud}/../SCRIPTS  >  /dev/null
1330             else
1331                scp  batch_scp mbuild mrun subjob  ${remote_username}@${remote_addres}:${remote_ud}/../SCRIPTS  >  /dev/null
1332             fi
1333
1334             cd  -  > /dev/null
1335             cd  ${local_source_path}/../UTIL
1336
1337
1338                # KOPIEREN DER UTILITY-PROGRAMME
1339             if [[ $local_host = decalpha ]]
1340             then
1341                   # DECALPHA BENUTZT BEI NICHTANGABE DES VOLLSTÄNDIGEN PFADES
1342                   # IRGENDEIN ANDERES SCP (WAS NICHT FUNKTIONIERT). AUSSERDEM
1343                   # KOENNEN DOLLAR-ZEICHEN NICHT BENUTZT WERDEN
1344                remote_ud=`echo $remote_ud | sed 's/\$HOME\///'`
1345                /bin/scp  Makefile  *.f90  ${remote_username}@${remote_addres}:${remote_ud}  >  /dev/null
1346             else
1347                scp  Makefile  *.f90  ${remote_username}@${remote_addres}:${remote_ud}  >  /dev/null
1348             fi
1349
1350
1351
1352                # MAKE MIT ZUVOR ERMITTELTEN OPTIONEN AUF REMOTE RECHNER AUSFUEHREN
1353                # KOMMANDOUEBERGABE AN SSH PER PIPE, DA SO DIE SYSTEM- UND
1354                # BENUTZERPROFILE VOLLSTAENDIG AUSGEFUEHRT WERDEN (SONST FEHLEN MAKE
1355                # Z.B. DIE PFADE ZUM COMPILER)
1356             echo "  *** execute \"make\" on remote host"
1357
1358             if [[ $remote_host = nech ]]
1359             then
1360                make_call_string="sxmake  F90=$compiler_name  F90_SER=$compiler_name_ser  COPT=\"$cpp_options\"  F90FLAGS=\"$compiler_options\"  LDFLAGS=\"$loader_options\" "
1361             else
1362                make_call_string="make  F90=$compiler_name  F90_SER=$compiler_name_ser  COPT=\"$cpp_options\"  F90FLAGS=\"$compiler_options\"  LDFLAGS=\"$loader_options\" "
1363             fi
1364
1365             if [[ $remote_host = ibms  ||  $remote_host = ibmy ]]
1366             then
1367
1368                ssh  ${remote_username}@${remote_addres}  "cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR"
1369
1370             elif [[ $remote_host = ibmb  ||  $remote_host = ibmh ]]
1371             then
1372
1373                print "export OBJECT_MODE=64; cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_addres}
1374
1375             elif [[ $remote_host = lctit ]]
1376             then
1377
1378                echo  " "  >  ${remote_host}_last_make_protokoll
1379                while [[ $(cat ${remote_host}_last_make_protokoll | grep -c "Forwarding to N1GE") = 0 ]]
1380                do
1381                   print "cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll
1382                done
1383
1384             else
1385
1386                print "cd ${remote_ud}; $make_call_string; [[ \$? != 0 ]] && echo MAKE_ERROR" | ssh  ${remote_username}@${remote_addres} 2>&1 | tee ${remote_host}_last_make_protokoll
1387
1388             fi
1389
1390          fi    # ENDE UEBERSETZUNG DER UTILITY-PROGRAMME
1391
1392          rm -rf  ${remote_host}_last_make_protokoll
1393
1394             # NUR AUF EINEM HLRN-RECHNER UEBERSETZEN
1395          [[ $remote_host = ibmb  ||  $remote_host = ibmh ]]  &&  ibm_hb_done=true
1396
1397       else
1398
1399          if [[ $compile_utility_programs = false ]]
1400          then
1401
1402                # MAKE MIT ZUVOR ERMITTELTEN OPTIONEN AUF LOKALEM RECHNER AUSFUEHREN
1403             echo " "
1404             echo "  *** execute \"make\" on local host"
1405
1406             make  PROG=$mainprog  F90=$compiler_name  COPT="$cpp_options"  F90FLAGS="$compiler_options"  LDFLAGS="$loader_options"  2>&1 | tee ${remote_host}_last_make_protokoll
1407
1408             if [[ $? != 0 ]]
1409             then
1410                printf "\a\n  +++ error(s) occurred during compiling or linking on host \"$remote_host\" "
1411                if [[ $silent = false ]]
1412                then
1413                   answer=dummy
1414                   printf "\n"
1415                   while [[ "$answer" != c  &&  "$answer" != k ]]
1416                   do
1417                      printf "  >>> continue / list errors / kill mbuild (c/l/k) ? "
1418                      read  answer
1419                      if [[ "$answer" = l ]]
1420                      then
1421                         more ${remote_host}_last_make_protokoll
1422                      fi
1423                   done
1424                   if [[ $answer = k ]]
1425                   then
1426                      locat=user_abort; exit
1427                   fi
1428                fi
1429             fi
1430
1431
1432                # NEUE VERSION AUF LOKALEM RECHNER ZUSAMMENPACKEN
1433             printf "\n  *** tar update on local host ..."
1434             tar -cf  ${mainprog}_current_version.tar  *.$suf *.o *.mod
1435
1436
1437             # COMPILE THE UTILITY PROGRAMS
1438          elif [[ $compile_utility_programs = true ]]
1439          then
1440             printf "\n\n"
1441             echo "  *** compiling the utility programs ..."
1442             cd ${local_source_path}/../UTIL
1443             make  F90=$compiler_name  F90_SER=$compiler_name_ser  COPT="$cpp_options"  F90FLAGS="$compiler_options"  LDFLAGS="$loader_options"
1444             cd  -  > /dev/null
1445          fi
1446
1447
1448             # NUR EINMAL AUF LCMUK UEBERSETZEN
1449          [[ $remote_host = lcmuk ]]  &&  lcmuk_done=true
1450
1451       fi
1452
1453    fi
1454 done
1455
1456
1457 if [[ $host_found = false ]]
1458 then
1459    if [[ $host = all ]]
1460    then
1461       printf "\n  +++ no hosts found in configuration file"
1462    else
1463       printf "\n  +++ host \"$host\" not found in configuration file"
1464    fi
1465    locat=config_file; exit
1466 fi
1467
1468
1469
1470    # ABSCHLIESSENDE ARBEITEN
1471 rm -f  hosts_found_in_config_file
1472
Note: See TracBrowser for help on using the repository browser.