source: palm/trunk/SCRIPTS/mbuild @ 67

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

small adjustments for fimm

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