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