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