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