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