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