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