1 | #!/bin/ksh |
---|
2 | |
---|
3 | ##!/home/DSRC/NC/tatuyama/pub/ksh NEEDED ON NEC AT RIAM !!!!!!!!!! |
---|
4 | |
---|
5 | # mrun - Plot-Shellskript Version: @(#)MRUN 1.8 07/02/07 |
---|
6 | |
---|
7 | # Prozedur zum Starten von Modellaeufen |
---|
8 | |
---|
9 | # letzte Aenderung: |
---|
10 | # 03/03/94 - Siggi - Entwicklungsbeginn |
---|
11 | # 21/03/94 - Siggi - Entwicklungsabschluss (Version 1.0) |
---|
12 | # 09/12/94 - Siggi - allexport unterbunden; statt dessen werden jetzt ein- |
---|
13 | # zelne Variable exportiert. Dies ist noetig, weil an- |
---|
14 | # sonsten irgendein Speicher ueberlaeuft und von mrun |
---|
15 | # aufgerufene Programme (z.B. stageout) mit Fehlern |
---|
16 | # abbrechen (too many arguments) |
---|
17 | # 20/06/95 - Siggi - noclobber muss explizit abgeschaltet, da jetzt |
---|
18 | # defaultmaessig im RRZN-Profile eingeschaltet |
---|
19 | # 10/06/97 - Siggi - Zusaetzliche Option -C bei cpp, damit // nicht |
---|
20 | # wegfallen |
---|
21 | # 25/04/00 - Siggi - Version 1.5 |
---|
22 | # remote_addres und remote_user in return_addres bzw. |
---|
23 | # return_username umbenannt, return_username wird dem |
---|
24 | # mrun-Aufruf im Job ueber Option -U mitgegeben. |
---|
25 | # Neue Variable remote_username, die beim interaktiven |
---|
26 | # mrun-Aufruf zwingend ueber die neue Option -u oder |
---|
27 | # in der Konfigurationsdatei angegeben werden muss. |
---|
28 | # 08/02/01 - Siggi - Alle mrun-Meldungen ins englische uebersetzt, |
---|
29 | # Version 1.7 |
---|
30 | # 05/05/02 - Siggi - Uebersetzungen mittels make-Mechanismus moeglich |
---|
31 | # 21/11/02 - Siggi - ENV-Variable XLFRTEOPTS wird vor Ausfuehrung auf |
---|
32 | # IBM gesetzt, um Record-Laenge der NAMELIST-Dateien, |
---|
33 | # zu bestimmen; Praeprozessoroptionen haben nun alle |
---|
34 | # die Form -Dtext=text, weil auf IBM sonst text durch |
---|
35 | # die leere Zeichenkette ersetzt wird |
---|
36 | # 01/08/03 - Siggi - Test of implementing dvrp+1PE on ibm |
---|
37 | # 07/01/04 - Siggi - additional preprocessor directive for ibm included |
---|
38 | # (-D$OMP=OMP) in order to avoid problems with |
---|
39 | # OMP_NUM_THREADS |
---|
40 | # 04/01/05 - Siggi - archiving on hanni and berni is done in separate |
---|
41 | # tar files, one for each node used |
---|
42 | # 07/01/04 - Siggi - old code for t3e, vpp and hpcs eliminated |
---|
43 | # 09/01/05 - Siggi - workaround for getting the IP address on gfdl3 |
---|
44 | # 17/01/05 - Siggi - job for data transfer to local machine now within |
---|
45 | # job class c1 (HLRN) |
---|
46 | # 27/01/05 - Siggi - IP address workaround for gfdl3 removed |
---|
47 | # 28/01/05 - Siggi - tar-filenames on $PERM (HLRN) now include the |
---|
48 | # base filename and cycle number |
---|
49 | # 16/02/05 - Gerald - hababai validated |
---|
50 | # 14/03/05 - Siggi - abort on NEC after first runtime error (F_ERRCNT) |
---|
51 | # 29/03/05 - Marcus - berni*-en0 validated |
---|
52 | # 21/04/05 - Siggi - transfer-job-protocol for avs-data is no more stored |
---|
53 | # 24/04/05 - Siggi - netcdf support on lcmuk |
---|
54 | # 25/04/05 - Siggi - netcdf support on gfld3 (decalpha) |
---|
55 | # 11/05/05 - Siggi - files with non-numeric extensions (.xxx after cycle |
---|
56 | # number) can now be used within interactive runs |
---|
57 | # 12/05/05 - Siggi - netcdf support on ibm |
---|
58 | # 13/05/05 - Siggi - error in tar-filenames on $PERM (HLRN) removed |
---|
59 | # 18/05/05 - Siggi - netcdf support on nec |
---|
60 | # 24/05/05 - Siggi - netcdf support on ibms |
---|
61 | # 14/06/05 - Siggi - sleep interval after submit of restart job increased |
---|
62 | # to 30 seconds |
---|
63 | # 28/06/05 - Siggi - bora adjusted to new intel compiler (LD_LIBRARY_ |
---|
64 | # PATH is temporarily set) |
---|
65 | # 07/09/05 - Siggi - setting of MP_EAGER_LIMIT switched off because it |
---|
66 | # caused warnings in the job protocol |
---|
67 | # 20/10/05 - Siggi - update of netcdf-version on decalpha (gfdl3) |
---|
68 | # 25/10/05 - Siggi - error in listing files for getting the cycle number |
---|
69 | # removed |
---|
70 | # 26/10/05 - Siggi - new paths for dvrp-library, transfer of catalogs |
---|
71 | # realized by file attribute trpe |
---|
72 | # 28/10/05 - Siggi - if existing, the file extension is output in case |
---|
73 | # of missing input file - no job abort in case of |
---|
74 | # missing input files with file extensions |
---|
75 | # (preliminary solution) |
---|
76 | # 31/10/05 - Siggi - data transfer from nech now within seperate job |
---|
77 | # 04/11/05 - Siggi - netcdf 3.6.0-p1 on ibmh/ibmb |
---|
78 | # 07/12/05 - Siggi - gallego and elephanta admitted |
---|
79 | # 30/12/05 - Siggi - gfdl5 (ibmy) admitted |
---|
80 | # 10/01/06 - Siggi - cpp directive for NetCDF 64bit support |
---|
81 | # 20/01/06 - Siggi - cpp directive for ibmy |
---|
82 | # 09/02/06 - Siggi - ibmy admitted for batch mode |
---|
83 | # 13/04/06 - Siggi - ostria admitted |
---|
84 | # 18/04/06 - Siggi - usage of OpenMP implemented (additional option -O) |
---|
85 | # 10/05/06 - Siggi - environment variable XLSMPOPTS set on IBM for |
---|
86 | # optimization of OpenMP runs (option stacksize is |
---|
87 | # necessary for large gridpoint numbers because |
---|
88 | # otherwise a segmentation fault occurs) |
---|
89 | # 23/05/05 - Siggi - lctit (SUN Fire X4600) admitted |
---|
90 | # 21/08/06 - Siggi - standard mrun path on scirocco is as on bora |
---|
91 | # 23/08/06 - Siggi - netcdf support for scirocco (notebook) |
---|
92 | # 20/09/06 - Marcus - add DVRP library on nech |
---|
93 | # 24/10/06 - Siggi - Environment variables for PALM steering are written |
---|
94 | # on local NAMELIST file ENVPAR |
---|
95 | # 24/11/06 - Siggi - levanto admitted, maestro switched to ifc 9.1 |
---|
96 | # 28/11/06 - Siggi - call to interpret_config.x_levanto because of SuSe 10 |
---|
97 | # 06/02/07 - Siggi - add DVRP library on lcmuk |
---|
98 | # 07/02/07 - Siggi - revision of source code handling, source code is |
---|
99 | # now expected in directory given by source_path and |
---|
100 | # not in the current working directory, source code |
---|
101 | # files provided in add_source_path are allways |
---|
102 | # compiled, source code to be compiled is allways |
---|
103 | # sampled in SOURCES_FOR_RUN_$fname which is a |
---|
104 | # subdirectory of the current working directory, |
---|
105 | # -s TEST changed to -s CHANGED_FILES or -s CF, |
---|
106 | # adapted for RIAM (neck) |
---|
107 | |
---|
108 | |
---|
109 | |
---|
110 | |
---|
111 | # VARIABLENVEREINBARUNGEN + DEFAULTWERTE |
---|
112 | |
---|
113 | set +o allexport # SICHERHEITSHALBER UNTERBINDEN, DA SONST EVTL. STAGEOUT |
---|
114 | # NICHT LAUEFT (TOO MANY ARGUMENTS - PROBLEM) |
---|
115 | set +o noclobber # EXISTIERENDE DATEIEN DUERFEN UEBERSCHRIEBEN WERDEN |
---|
116 | |
---|
117 | AddFilenames="" |
---|
118 | additional_conditions="" |
---|
119 | add_source_path="" |
---|
120 | afname="" |
---|
121 | archive_save=true |
---|
122 | archive_system=none |
---|
123 | compiler_name="" |
---|
124 | cond1="" |
---|
125 | cond2="" |
---|
126 | config_file=.mrun.config |
---|
127 | continuation_run=false |
---|
128 | cpp_opts="" |
---|
129 | cpumax=0 |
---|
130 | cpurest=0 |
---|
131 | delete_temporary_catalog=true |
---|
132 | do_batch=false |
---|
133 | do_compile=true |
---|
134 | do_remote=false |
---|
135 | do_stagein=true |
---|
136 | do_stageout=true |
---|
137 | do_trace=false |
---|
138 | email_notification="" |
---|
139 | exclude="" |
---|
140 | executable="" |
---|
141 | execution_error=false |
---|
142 | filetransfer_protocol="" |
---|
143 | fname=test |
---|
144 | fromhost="" |
---|
145 | host="" |
---|
146 | host_file="" |
---|
147 | hp="" |
---|
148 | ignore_archive_error=false |
---|
149 | input_list="" |
---|
150 | interpreted_config_file="" |
---|
151 | job_on_file="" |
---|
152 | keep_data_from_previous_run=false |
---|
153 | localhost_realname=$(hostname) |
---|
154 | local_compile=false |
---|
155 | locat=normal |
---|
156 | mainprog="" |
---|
157 | makefile="" |
---|
158 | mc=$0 |
---|
159 | while [[ $(echo $mc | grep -c "/") != 0 ]] |
---|
160 | do |
---|
161 | mc=`echo $mc | cut -f2- -d"/"` |
---|
162 | done |
---|
163 | module_files="" |
---|
164 | MODULE_OPTIONS="" |
---|
165 | mrun_script_name=$mc |
---|
166 | netcdf_support=false |
---|
167 | node_usage=default |
---|
168 | numprocs="" |
---|
169 | OOPT="" |
---|
170 | openmp=false |
---|
171 | output_list="" |
---|
172 | package_list="" |
---|
173 | punkte="..........................................................." |
---|
174 | queue=none |
---|
175 | read_from_config="" |
---|
176 | return_addres=$(nslookup `hostname` 2>&1 | grep "Address:" | tail -1 | awk '{print $2}') |
---|
177 | if [[ $return_addres = 130.75.105.158 ]] |
---|
178 | then |
---|
179 | return_addres=172.20.25.41 |
---|
180 | echo "+++ WARNING: return_addres changed to $return_addres !!!!!" |
---|
181 | fi |
---|
182 | # if [[ $return_addres = 210.117.65.1 ]] |
---|
183 | # if [[ $(nslookup `hostname` 2>&1 | grep -c 210.117.65.1) = 1 ]] |
---|
184 | # then |
---|
185 | # [[ $localhost_realname = gfdl3.yonsei.ac.kr ]] && return_addres=165.132.26.56 |
---|
186 | # fi |
---|
187 | return_password="" |
---|
188 | return_username=$LOGNAME |
---|
189 | remotecall=false |
---|
190 | remote_username="" |
---|
191 | run_mode="" |
---|
192 | scirocco=false |
---|
193 | store_on_archive_system=true |
---|
194 | striche=" ----------------------------------------------------------------------------" |
---|
195 | silent=false |
---|
196 | source_list="" |
---|
197 | source_path=SOURCE |
---|
198 | tasks_per_node="" |
---|
199 | threads_per_task=1 |
---|
200 | tmpcreate=false |
---|
201 | tmp_data_catalog="" |
---|
202 | transfer_problems=false |
---|
203 | usern=$LOGNAME |
---|
204 | use_makefile="" |
---|
205 | working_directory=`pwd` |
---|
206 | TOPT="" |
---|
207 | XOPT="" |
---|
208 | zeit=$( date | cut -c 12-19 ) |
---|
209 | |
---|
210 | typeset -i iec=0 iic=0 iin=0 ioc=0 iout=0 memory=0 stagein_anz=0 stageout_anz=0 |
---|
211 | typeset -i cputime i ii icycle inode ival jobges jobsek maxcycle minuten nodes pes sekunden tp1 |
---|
212 | |
---|
213 | typeset -R40 calltime |
---|
214 | typeset -L20 spalte1 |
---|
215 | typeset -L40 spalte2 |
---|
216 | typeset -L60 spalte3 |
---|
217 | typeset -L35 string1=`date` |
---|
218 | typeset -L12 string2=$usern |
---|
219 | typeset -L12 string3=$localhost_realname |
---|
220 | typeset -L12 string4 |
---|
221 | typeset -L12 string5 |
---|
222 | typeset -L20 version="MRUN 1.8" |
---|
223 | |
---|
224 | |
---|
225 | |
---|
226 | # EINZELNE VARIABLE FUER HAUPTPROGRAMM EXPORTIEREN |
---|
227 | export cpurest fname host localhost return_addres return_username remotecall tasks_per_node |
---|
228 | |
---|
229 | # FOLGENDE VARIABLEN MUESSEN FUER DIE INTERPRETATION DER KONFIGURATIONSDATEI |
---|
230 | # EXPORTIERT WERDEN |
---|
231 | export afname config_file cpp_opts cpumax do_batch do_trace fname fromhost |
---|
232 | export input_list memory numprocs output_list queue run_mode |
---|
233 | |
---|
234 | |
---|
235 | |
---|
236 | # FEHLERBEHANDLUNG |
---|
237 | # BEI EXIT: |
---|
238 | trap 'if [[ $locat != localhost ]] |
---|
239 | then |
---|
240 | if [[ ! -f ${mrun_path}/statistik/mrun_statistik ]] |
---|
241 | then |
---|
242 | cat > ${mrun_path}/statistik/mrun_statistik << %STATEND% |
---|
243 | MRUN-calls on $localhost |
---|
244 | |
---|
245 | date and time user localhost remotehost termination mrun-command |
---|
246 | -------------------------------------------------------------------------------------------------------------------- |
---|
247 | %STATEND% |
---|
248 | chmod 666 ${mrun_path}/statistik/mrun_statistik |
---|
249 | fi |
---|
250 | |
---|
251 | # EINTRAG IN DIE STATISTIK-DATEI |
---|
252 | string4=$host |
---|
253 | string5=$locat |
---|
254 | if [[ "$job_on_file" = "" && $locat != control_c && $locat != user_abort ]] |
---|
255 | then |
---|
256 | if [[ $do_batch = true ]] |
---|
257 | then |
---|
258 | printf "$string1$string2$string3$string4$string5$mrun_com \n" >> ${mrun_path}/statistik/mrun_statistik |
---|
259 | else |
---|
260 | printf "$string1$string2$string3$string4$string5$mc \n" >> ${mrun_path}/statistik/mrun_statistik |
---|
261 | fi |
---|
262 | fi |
---|
263 | fi |
---|
264 | |
---|
265 | if [[ $locat != normal && $locat != control_c && $locat != local_compile ]] |
---|
266 | then |
---|
267 | |
---|
268 | # EVENTUELLE ERROR-KOMMANDOS ABARBEITEN |
---|
269 | (( i = 0 )) |
---|
270 | while (( i < iec )) |
---|
271 | do |
---|
272 | (( i = i + 1 )) |
---|
273 | printf "\n *** Execution of ERROR-command:\n" |
---|
274 | printf " >>> ${err_command[$i]}\n" |
---|
275 | eval ${err_command[$i]} |
---|
276 | done |
---|
277 | if [[ -n $interpreted_config_file ]] then |
---|
278 | rm -rf $interpreted_config_file |
---|
279 | fi |
---|
280 | if [[ $tmpcreate = true ]] |
---|
281 | then |
---|
282 | printf "\n *** Contents of \"$TEMPDIR\":\n" |
---|
283 | ls -al; cd |
---|
284 | [[ $delete_temporary_catalog = true ]] && rm -rf $TEMPDIR |
---|
285 | fi |
---|
286 | if [[ -f ~/job_queue/JOBINFO.$QSUB_REQID ]] |
---|
287 | then |
---|
288 | rm -rf ~/job_queue/JOBINFO.$QSUB_REQID |
---|
289 | fi |
---|
290 | printf "\n\n+++ MRUN killed \n\n" |
---|
291 | elif [[ $locat != control_c ]] |
---|
292 | then |
---|
293 | printf "\n\n --> all actions finished\n\n" |
---|
294 | printf " Bye, bye $usern !!\n\n" |
---|
295 | fi' exit |
---|
296 | |
---|
297 | |
---|
298 | # BEI TERMINAL-BREAK: |
---|
299 | trap '[[ $tmpcreate = true ]] && (cd; rm -rf $TEMPDIR) |
---|
300 | if [[ -f ~/job_queue/JOBINFO.$QSUB_REQID ]] |
---|
301 | then |
---|
302 | rm -rf ~/job_queue/JOBINFO.$QSUB_REQID |
---|
303 | fi |
---|
304 | printf "\n+++ MRUN killed by \"^C\" \n\n" |
---|
305 | locat=control_c |
---|
306 | exit |
---|
307 | ' 2 |
---|
308 | |
---|
309 | |
---|
310 | # EVTL. NAMEN DES LOKALEN RECHNERS MIT UEBERGREIFENDEM NAMEN VERSEHEN |
---|
311 | case $localhost_realname in |
---|
312 | (atmos) mrun_path=/home/siggi/pub |
---|
313 | localhost=lcide;; |
---|
314 | (bora|breva|elephanta|gallego|gregale|hababai|irifi|levanto|maestro|orkan|ostria|poniente|quanero|scirocco|vorias) mrun_path=/home/raasch/pub |
---|
315 | localhost=lcmuk;; |
---|
316 | (caurus|caver|gharra|samun|twister|viracao|yalka) mrun_path=/home/raasch/pub/ |
---|
317 | localhost=hpmuk;; |
---|
318 | (breg*-en0|berni*-en0) mrun_path=/home/b/niksiraa/pub |
---|
319 | localhost=ibmb; archive_system=tivoli;; |
---|
320 | (cs*) mrun_path=/pf/b/b323011/pub |
---|
321 | localhost=nech; archive_system=ut;; |
---|
322 | (gate|n-sx) mrun_path=/home/DSRC/NC/tatuyama/pub |
---|
323 | PATH=$PATH:/usr/bin/nqsII:$mrun_path |
---|
324 | localhost=neck;; |
---|
325 | (ground.yonsei.ac.kr) mrun_path=/usr/users/raasch/pub |
---|
326 | localhost=decalpha;; |
---|
327 | (gfdl3.yonsei.ac.kr) mrun_path=/usr2/users/raasch/pub |
---|
328 | localhost=decalpha;; |
---|
329 | (gfdl5) mrun_path=/usr1/users/raasch/pub |
---|
330 | localhost=ibmy;; |
---|
331 | (gwdk081.gwdg.de|gwdk082.gwdg.de|gwdk083.gwdg.de) mrun_path=/usr/users/sraasch/pub |
---|
332 | localhost=ibm;; |
---|
333 | (hreg*-en0|hanni*-en0) mrun_path=/home/h/niksiraa/pub |
---|
334 | localhost=ibmh; archive_system=tivoli;; |
---|
335 | (nobel*) mrun_path=/edun/z051nyg/pub |
---|
336 | localhost=ibms;; |
---|
337 | (sun1|sun2) mrun_path=/home/nhbksira/pub/ |
---|
338 | localhost=unics;; |
---|
339 | (tgg*) mrun_path=/home2/usr5/mkanda/pub |
---|
340 | localhost=lctit;; |
---|
341 | (*) printf "\n +++ Host \"$localhost_realname\" not admitted for mrun \n" |
---|
342 | locat=localhost; exit;; |
---|
343 | esac |
---|
344 | |
---|
345 | [[ $localhost_realname = scirocco ]] && scirocco=true |
---|
346 | |
---|
347 | |
---|
348 | |
---|
349 | # SHELLSCRIPT-OPTIONEN EINLESEN UND KOMMANDO NEU ZUSAMMENSETZEN, FALLS ES |
---|
350 | # FUER FOLGEJOBS BENOETIGT WIRD |
---|
351 | while getopts :a:AbBc:Cd:D:f:Fh:H:i:IkK:m:M:n:o:Op:P:q:r:R:s:St:T:u:U:vxX: option |
---|
352 | do |
---|
353 | case $option in |
---|
354 | (a) afname=$OPTARG;; |
---|
355 | (A) store_on_archive_system=false; mc="$mc -A";; |
---|
356 | (b) do_batch=true; mc="$mc -b";; |
---|
357 | (B) delete_temporary_catalog=false; mc="$mc -B";; |
---|
358 | (c) config_file=$OPTARG; mc="$mc -c$OPTARG";; |
---|
359 | (C) continuation_run=true; mc="$mc -C";; |
---|
360 | (d) fname=$OPTARG; mc="$mc -d$OPTARG";; |
---|
361 | (D) cpp_opts="$cpp_opts $OPTARG"; mc="$mc -D$OPTARG";; |
---|
362 | (f) filetransfer_protocol=$OPTARG; mc="$mc -f$OPTARG";; |
---|
363 | (F) job_on_file="-D"; mc="$mc -F";; |
---|
364 | (h) host=$OPTARG; mc="$mc -h$OPTARG";; |
---|
365 | (H) fromhost=$OPTARG; mc="$mc -H$OPTARG";; |
---|
366 | (i) input_list=$OPTARG; mc="$mc -i'$OPTARG'";; |
---|
367 | (I) ignore_archive_error=true; mc="$mc -I";; |
---|
368 | (k) keep_data_from_previous_run=true; mc="$mc -k";; |
---|
369 | (K) additional_conditions="$OPTARG"; mc="$mc -K$OPTARG";; |
---|
370 | (m) memory=$OPTARG; mc="$mc -m$OPTARG";; |
---|
371 | (M) makefile=$OPTARG; mc="$mc -M$OPTARG";; |
---|
372 | (n) node_usage=$OPTARG; mc="$mc -n$OPTARG";; |
---|
373 | (o) output_list=$OPTARG; mc="$mc -o'$OPTARG'";; |
---|
374 | (O) use_openmp=true; mc="$mc -O";; |
---|
375 | (p) package_list=$OPTARG; mc="$mc -p'$OPTARG'";; |
---|
376 | (P) return_password=$OPTARG; mc="$mc -P$OPTARG";; |
---|
377 | (q) queue=$OPTARG; mc="$mc -q$OPTARG";; |
---|
378 | (r) run_mode=$OPTARG; mc="$mc -r'$OPTARG'";; |
---|
379 | (R) remotecall=true;return_addres=$OPTARG; mc="$mc -R$OPTARG";; |
---|
380 | (s) source_list=$OPTARG; mc="$mc -s'$OPTARG'";; |
---|
381 | (S) read_from_config=false; mc="$mc -S";; |
---|
382 | (t) cpumax=$OPTARG; mc="$mc -t$OPTARG";; |
---|
383 | (T) tasks_per_node=$OPTARG; mc="$mc -T$OPTARG";; |
---|
384 | (u) remote_username=$OPTARG; mc="$mc -u$OPTARG";; |
---|
385 | (U) return_username=$OPTARG; mc="$mc -U$OPTARG";; |
---|
386 | (v) silent=true; mc="$mc -v";; |
---|
387 | (x) do_trace=true;set -x; mc="$mc -x";; |
---|
388 | (X) numprocs=$OPTARG; mc="$mc -X$OPTARG";; |
---|
389 | (\?) printf "\n +++ unknown option $OPTARG \n" |
---|
390 | printf "\n --> type \"$0 ?\" for available options \n" |
---|
391 | locat=parameter;exit;; |
---|
392 | esac |
---|
393 | done |
---|
394 | |
---|
395 | |
---|
396 | # EVTL. POSITIONSPARAMETER EINLESEN |
---|
397 | # ZUR ZEIT GIBT ES NUR DEN PARAMETER ? (=KURZINFO) |
---|
398 | shift OPTIND-1 |
---|
399 | |
---|
400 | |
---|
401 | # KURZE AUFRUFBESCHREIBUNG WIRD HIER AUSGEGEBEN |
---|
402 | if [[ "$1" = "?" ]] |
---|
403 | then |
---|
404 | (printf "\n *** mrun can be called as follows:\n" |
---|
405 | printf "\n $mrun_script_name -b -c.. -d.. -D.. -f.. -F -h.. -i.. -I -K.. -m.. -o.. -p.. -r.. -R -s.. -t.. -T.. -v -x -X.. <modus>\n" |
---|
406 | printf "\n Description of available options:\n" |
---|
407 | printf "\n Option Description Default-Value" |
---|
408 | printf "\n -a base name of input files equiv. -d" |
---|
409 | printf "\n -A no archiving when using file-attribute fl" |
---|
410 | printf "\n -b batch-job on local machine ---" |
---|
411 | printf "\n -B do not delete temporary directory at end ---" |
---|
412 | printf "\n -c configuration file .mrun.config" |
---|
413 | printf "\n -d base name of files attached to program test" |
---|
414 | printf "\n -D preprocessor(cpp)-directives \"\" " |
---|
415 | printf "\n -f filetransfer protocol (ftp or scp) depending on -h" |
---|
416 | printf "\n -F create remote job file only ---" |
---|
417 | printf "\n -h execution host $localhost_realname" |
---|
418 | printf "\n -i INPUT control list \"\" " |
---|
419 | printf "\n -I archiving errors of previous batch-jobs" |
---|
420 | printf "\n will be ignored" |
---|
421 | printf "\n -k keep data from previous run" |
---|
422 | printf "\n -K additional conditions for controling" |
---|
423 | printf "\n usage of conditional code and" |
---|
424 | printf "\n env-variables in configuration file \"\" " |
---|
425 | printf "\n -m memory demand in MB (batch-jobs) 0 MB" |
---|
426 | printf "\n -M Makefile name Makefile" |
---|
427 | printf "\n -n node usage (shared/not_shared) depending on -h" |
---|
428 | printf "\n -o OUTPUT control list \"\" " |
---|
429 | printf "\n -O use OpenMP ---" |
---|
430 | printf "\n -p software package list \"\" " |
---|
431 | printf "\n -q queue \"$queue\" " |
---|
432 | printf "\n -r run control list (combines -i -o) \"\" " |
---|
433 | printf "\n -s filenames of routines to be compiled \"\" " |
---|
434 | printf "\n must end with .f, .f90, .F, or .c !" |
---|
435 | printf "\n use \"..\" for more than one file and wildcards" |
---|
436 | printf "\n -s TEST compiles all files with w-permit" |
---|
437 | printf "\n -S config file interpreted by shellscript ---" |
---|
438 | printf "\n -t allowed cpu-time in seconds (batch) 0" |
---|
439 | printf "\n -T tasks per node depending on -h" |
---|
440 | printf "\n -u username on remote machine \"\" " |
---|
441 | printf "\n -v no prompt for confirmation ---" |
---|
442 | printf "\n -x tracing of mrun for debug purposes ---" |
---|
443 | printf "\n -X # of processors (on parallel machines) 1" |
---|
444 | printf "\n " |
---|
445 | printf "\n Possible values of positional parameter <modus>:" |
---|
446 | printf "\n \"?\" - this outline \n\n") | more |
---|
447 | exit |
---|
448 | elif [[ "$1" != "" ]] |
---|
449 | then |
---|
450 | printf "\n +++ positional parameter $1 unknown \n" |
---|
451 | locat=parameter; exit |
---|
452 | fi |
---|
453 | |
---|
454 | |
---|
455 | |
---|
456 | # KURZE STARTMELDUNG |
---|
457 | printf "\n*** $version " |
---|
458 | printf "\n will be executed. Please wait ..." |
---|
459 | |
---|
460 | |
---|
461 | # BASISNAME DER INPUT-DATEIEN GLEICH ALLGEMEINEM BASISNAMEN SETZEN, |
---|
462 | # WENN NICHT VOM BENUTZER ANDERS BESTIMMT |
---|
463 | [[ "$afname" = "" ]] && afname=$fname |
---|
464 | |
---|
465 | |
---|
466 | # EVTL. RUN-MODUS DEN I/O-LISTEN HINZUFUEGEN |
---|
467 | if [[ "$run_mode" != "" ]] |
---|
468 | then |
---|
469 | input_list="$input_list $run_mode" |
---|
470 | output_list="$output_list $run_mode" |
---|
471 | fi |
---|
472 | |
---|
473 | |
---|
474 | # RECHNERNAMEN ABSPEICHERN, VON DEM AUS JOB GESTARTET WIRD, |
---|
475 | # ALLERDINGS NUR DANN, WENN NICHT PER OPTION -H BEREITS EIN WERT |
---|
476 | # ZUGEWIESEN WURDE (MRUN MACHT DIES IMMER, WENN ES SELBST BATCH-JOBS |
---|
477 | # STARTET) |
---|
478 | if [[ "$fromhost" = "" ]] |
---|
479 | then |
---|
480 | fromhost=$localhost |
---|
481 | fi |
---|
482 | |
---|
483 | |
---|
484 | # PRUEFEN, OB MRUN NUR TESTWEISE AUF DER LOKALEN MASCHINE KOMPILIEREN SOLL |
---|
485 | if [[ "$source_list" = LOCAL_COMPILE_TEST ]] |
---|
486 | then |
---|
487 | source_list=TEST |
---|
488 | local_compile=true |
---|
489 | host=$localhost |
---|
490 | fi |
---|
491 | |
---|
492 | |
---|
493 | # PRUEFEN, OB AUF REMOTE-MASCHINE GERECHNET WERDEN SOLL |
---|
494 | # WERT VON do_remote WIRD FUER DATEIVERBINDUNGEN BENOETIGT. |
---|
495 | # WENN AUF REMOTE-MASCHINE GERECHNET WIRD, IST GLEICHZEITIG KLAR, |
---|
496 | # DASS EIN BATCH-JOB GESTARTET WERDEN MUSS |
---|
497 | if [[ -n $host && "$host" != $localhost ]] |
---|
498 | then |
---|
499 | do_batch=true |
---|
500 | do_remote=true |
---|
501 | case $host in |
---|
502 | (hpmuk|ibm|ibmb|ibmh|ibms|ibmy|nech|neck|lctit|unics) true;; |
---|
503 | (*) printf "\n" |
---|
504 | printf "\n +++ execution host \"$host\" not admitted for MRUN," |
---|
505 | printf "\n or NQS not available on execution host!" |
---|
506 | locat=nqs; (( iec = 0 )); exit;; |
---|
507 | esac |
---|
508 | else |
---|
509 | host=$localhost |
---|
510 | fi |
---|
511 | |
---|
512 | |
---|
513 | # ZUSATZBEDINGUNGEN (OPTION -K) AUSWERTEN |
---|
514 | if [[ -n $additional_conditions ]] |
---|
515 | then |
---|
516 | echo $additional_conditions | cut -d" " -f1-3 | read cond1 cond2 dummy |
---|
517 | # cond1=`echo $additional_conditions | cut -d" " -f1` |
---|
518 | # cond2=`echo $additional_conditions | cut -d" " -s -f2` |
---|
519 | # dummy=`echo $additional_conditions | cut -d" " -s -f3` |
---|
520 | if [[ -n $dummy ]] |
---|
521 | then |
---|
522 | printf "\n +++ more than 2 additional conditions given for Option \"-K\"" |
---|
523 | locat=options; exit |
---|
524 | fi |
---|
525 | fi |
---|
526 | |
---|
527 | |
---|
528 | # PRUEFEN, OB EVTL. BEI VORHERGEHENDEM LAUF (KETTENJOB) EINE |
---|
529 | # ARCHIVIERUNG FEHLGESCHLAGEN IST |
---|
530 | if [[ -f ~/job_queue/ARCHIVE_ERROR_$fname ]] |
---|
531 | then |
---|
532 | if [[ $ignore_archive_error = false ]] |
---|
533 | then |
---|
534 | printf "\n +++ data archiving of previous run failed" |
---|
535 | printf "\n see directory \~/job_queue on remote machine" |
---|
536 | locat=archive; exit |
---|
537 | else |
---|
538 | printf "\n +++ warning: data archiving in a previous run failed" |
---|
539 | printf "\n MRUN continues, trying to get backup copy" |
---|
540 | fi |
---|
541 | fi |
---|
542 | |
---|
543 | |
---|
544 | # PRUEFEN, OB KONFIGURATIONS-DATEI VORHANDEN |
---|
545 | if [[ ! -f $config_file ]] |
---|
546 | then |
---|
547 | printf "\n\n +++ configuration file: " |
---|
548 | printf "\n $config_file" |
---|
549 | printf "\n does not exist" |
---|
550 | locat=connect; exit |
---|
551 | fi |
---|
552 | |
---|
553 | |
---|
554 | |
---|
555 | # LESEN UND INTERPRETIEREN DER KONFIGURATIONS-DATEI VOM SHELLSCRIPT AUS |
---|
556 | # VORUEBERGEHEND ZWINGEND AUF LINUX-RECHNERN |
---|
557 | if [[ "$read_from_config" = false ]] |
---|
558 | then |
---|
559 | |
---|
560 | [[ $silent = false ]] && printf "\n Reading the configuration file... " |
---|
561 | while read zeile |
---|
562 | do |
---|
563 | [[ $silent = false ]] && printf "." |
---|
564 | |
---|
565 | |
---|
566 | # ZUERST EVENTUELL VORKOMMENDE ENVIRONMENT-VARIABLEN DURCH IHRE WERTE |
---|
567 | # ERSETZEN |
---|
568 | eval zeile=\"$zeile\" |
---|
569 | |
---|
570 | |
---|
571 | # INTERPRETATION DER ZEILE |
---|
572 | if [[ "$(echo $zeile | cut -c1)" = "#" ]] |
---|
573 | then |
---|
574 | |
---|
575 | # ZEILE IST KOMMENTARZEILE |
---|
576 | true |
---|
577 | |
---|
578 | elif [[ "$(echo $zeile | cut -c1)" = "%" ]] |
---|
579 | then |
---|
580 | |
---|
581 | # ZEILE DEFINIERT ENVIRONMENT-VARIABLE |
---|
582 | zeile=$(echo $zeile | cut -c2-) |
---|
583 | echo $zeile | cut -d" " -f1-5 | read var value for_host for_cond1 for_cond2 |
---|
584 | # var=`echo $zeile | cut -d" " -f1` |
---|
585 | # value=`echo $zeile | cut -d" " -s -f2` |
---|
586 | # for_host=`echo $zeile | cut -d" " -s -f3` |
---|
587 | # for_cond1=`echo $zeile | cut -d" " -s -f4` |
---|
588 | # for_cond2=`echo $zeile | cut -d" " -s -f5` |
---|
589 | |
---|
590 | if [[ "$for_host" = "" || ( "$for_host" = $host && "$for_cond1" = "$cond1" && "$for_cond2" = "$cond2" ) || $(echo "$input_list$output_list"|grep -c "$for_host") != 0 ]] |
---|
591 | then |
---|
592 | |
---|
593 | # BEI COMPILER- CPP- ODER LINKEROPTIONEN EVTL ":" DURCH " " |
---|
594 | # ERSETZEN. "::" WIRD DURCH ":" ERSETZT. |
---|
595 | value=`echo $value | sed 's/::/%DUM%/g' | sed 's/:/ /g' | sed 's/%DUM%/:/g'` |
---|
596 | |
---|
597 | |
---|
598 | # ENVIRONMENT-VARIABLE WIRD WERT AUS KONFIGURATIONSDATEI |
---|
599 | # ZUGEWIESEN, WENN SIE SELBST NOCH KEINEN WERT UEBER DIE |
---|
600 | # ENTSPRECHENDE SCRIPT-OPTION ERHALTEN HAT. SOLCHE |
---|
601 | # VARIABLEN HAETTEN DANN DEN WERT "" ODER IM INTEGER-FALL DEN |
---|
602 | # WERT 0. ALLGEMEINE REGEL ALSO: SCRIPT-OPTION GEHT UEBER |
---|
603 | # KONFIGURATIONSDATEI |
---|
604 | if [[ "$(eval echo \$$var)" = "" || "$(eval echo \$$var)" = "0" ]] |
---|
605 | then |
---|
606 | eval $var=\$value |
---|
607 | |
---|
608 | # EVTL. BILDSCHIRMAUSGABEN DER ENVIRONMENT-VARIABLEN |
---|
609 | if [[ $do_trace = true ]] |
---|
610 | then |
---|
611 | printf "\n*** ENVIRONMENT-VARIABLE $var = $value" |
---|
612 | fi |
---|
613 | fi |
---|
614 | |
---|
615 | # WENN ENVIRONMENT-VARIABLE HOST VEREINBART, DANN SOFORT AUSWERTEN |
---|
616 | # WERT VON do-remote WIRD BEI DATEIVERBINDUNGEN BENOETIGT |
---|
617 | # WENN AUF REMOTE-MASCHINE GERECHNET WIRD, IST GLEICHZEITIG KLAR, |
---|
618 | # DASS EIN BATCH-JOB GESTARTET WERDEN MUSS |
---|
619 | if [[ $var = host ]] |
---|
620 | then |
---|
621 | if [[ -n $host && "$host" != $localhost ]] |
---|
622 | then |
---|
623 | do_batch=true |
---|
624 | do_remote=true |
---|
625 | case $host in |
---|
626 | (ibm|ibms|ibmy|lctit|nech|neck|unics) true;; |
---|
627 | (*) printf "\n +++ no queueing system available on execution host \"$host\"" |
---|
628 | locat=nqs; exit;; |
---|
629 | esac |
---|
630 | else |
---|
631 | host=$localhost |
---|
632 | fi |
---|
633 | fi |
---|
634 | |
---|
635 | # VOM BENUTZER DEFINIERTE ENVIRONMENT VARIABLEN MUESSEN PRINZIPIELL |
---|
636 | # EXPORTIERT WERDEN, DA SIE VIELLEICHT IN WEITER UNTEN AUFZURUFEN- |
---|
637 | # DEN PROGRAMMEN BENOETIGT WERDEN |
---|
638 | export $var |
---|
639 | fi |
---|
640 | |
---|
641 | |
---|
642 | |
---|
643 | |
---|
644 | elif [[ "$(echo $zeile | cut -c1-3)" = "EC:" ]] |
---|
645 | then |
---|
646 | |
---|
647 | # ZEILE DEFINIERT ERROR-KOMMANDO |
---|
648 | (( iec = iec + 1 )) |
---|
649 | zeile=$(echo $zeile | cut -c4-) |
---|
650 | err_command[$iec]="$zeile" |
---|
651 | |
---|
652 | elif [[ "$(echo $zeile | cut -c1-3)" = "IC:" ]] |
---|
653 | then |
---|
654 | |
---|
655 | # ZEILE DEFINIERT INPUT-KOMMANDO |
---|
656 | (( iic = iic + 1 )) |
---|
657 | zeile=$(echo $zeile | cut -c4-) |
---|
658 | in_command[$iic]="$zeile" |
---|
659 | |
---|
660 | elif [[ "$(echo $zeile | cut -c1-3)" = "OC:" ]] |
---|
661 | then |
---|
662 | |
---|
663 | # ZEILE DEFINIERT OUTPUT-KOMMANDO |
---|
664 | (( ioc = ioc + 1 )) |
---|
665 | zeile=$(echo $zeile | cut -c4-) |
---|
666 | out_command[$ioc]="$zeile" |
---|
667 | |
---|
668 | else |
---|
669 | |
---|
670 | # ZEILE DEFINIERT DATEIVERBINDUNG. EINLESEN DER DATEIEIGENSCHAFTEN |
---|
671 | # s2a: in/out - Feld |
---|
672 | # s2b: loc - Feld (optional) |
---|
673 | # s2c: tr/ar - Feld (optional) |
---|
674 | echo $zeile | cut -d" " -f1-2 | read s1 s2 |
---|
675 | # s1=`echo $zeile | cut -d" " -f1` |
---|
676 | # s2=`echo $zeile | cut -d" " -s -f2` |
---|
677 | s2a=$(echo $s2 | cut -d":" -f1) |
---|
678 | if [[ $(echo $s2 | grep -c ":") = 0 ]] |
---|
679 | then |
---|
680 | s2b="" |
---|
681 | s2c="" |
---|
682 | else |
---|
683 | echo $s2 | cut -d":" -f2-3 | sed 's/:/ /g' | read s2b s2c |
---|
684 | # s2b=`echo $s2 | cut -d":" -f2 | sed 's/:/ /g'` |
---|
685 | # s2c=`echo $s2 | cut -d":" -s -f3 | sed 's/:/ /g'` |
---|
686 | fi |
---|
687 | echo $zeile | cut -d" " -f3-6 | read s3 s4 s5 s6 |
---|
688 | # s3=`echo $zeile | cut -d" " -f3` |
---|
689 | # s4=`echo $zeile | cut -d" " -s -f4` |
---|
690 | # s5=`echo $zeile | cut -d" " -s -f5` |
---|
691 | # s6=`echo $zeile | cut -d" " -s -f6` |
---|
692 | |
---|
693 | |
---|
694 | # ABSPEICHERN DER DATEIVERBINDUNG, FALLS IN INPUT- ODER OUTPUT-LIST |
---|
695 | # VERMERKT. VARIABLE S3 KANN AUCH LISTE ENTHALTEN (FELDTRENNER ":") |
---|
696 | # DATEIVERBINDUNG WIRD DANN NICHT ABGESPEICHERT UND GEPRUEFT, WENN |
---|
697 | # PROGRAMMLAUF AUF REMOTE-MASCHINE ERFOLGT UND DATEI NUR LOKAL VOR- |
---|
698 | # HANDEN SEIN MUSS (D.H. s2b = loc) |
---|
699 | IFSALT="$IFS"; IFS="$IFS:" |
---|
700 | if [[ "$s2a" = in && ! ( $do_remote = true && ( "$s2b" = loc || "$s2b" = locopt ) ) ]] |
---|
701 | then |
---|
702 | found=false |
---|
703 | for actual in $input_list |
---|
704 | do |
---|
705 | for formal in $s3 |
---|
706 | do |
---|
707 | [[ $actual = $formal || "$formal" = "-" ]] && found=true |
---|
708 | done |
---|
709 | done |
---|
710 | if [[ $found = true ]] |
---|
711 | then |
---|
712 | (( iin = iin + 1 )) |
---|
713 | localin[$iin]=$s1; transin[$iin]=$s2b; actionin[$iin]=$s2c; |
---|
714 | typein[$iin]=$s3; pathin[$iin]=$s4; endin[$iin]=$s5; |
---|
715 | extin[$iin]=$s6 |
---|
716 | fi |
---|
717 | elif [[ "$s2a" = out && ! ( $do_remote = true && "$s2b" = loc ) ]] |
---|
718 | then |
---|
719 | found=false |
---|
720 | for actual in $output_list |
---|
721 | do |
---|
722 | for formal in $s3 |
---|
723 | do |
---|
724 | [[ $actual = $formal || "$formal" = "-" ]] && found=true |
---|
725 | done |
---|
726 | done |
---|
727 | if [[ $found = true ]] |
---|
728 | then |
---|
729 | (( iout = iout + 1 )) |
---|
730 | localout[$iout]=$s1; actionout[$iout]=$s2c; typeout[$iout]=$s3; |
---|
731 | pathout[$iout]=$s4; endout[$iout]=$s5; extout[$iout]=$s6 |
---|
732 | fi |
---|
733 | elif [[ "$s2a" != in && "$s2a" != out ]] |
---|
734 | then |
---|
735 | printf "\n +++ I/O-attribute in configuration file $config_file has the invalid" |
---|
736 | printf "\n value \"$s2\". Only \"in\" and \"out\" are allowed!" |
---|
737 | locat=connect; exit |
---|
738 | fi |
---|
739 | IFS="$IFSALT" |
---|
740 | fi |
---|
741 | done < $config_file |
---|
742 | |
---|
743 | else |
---|
744 | |
---|
745 | |
---|
746 | # INTERPRETATION DER KONFIGURATIONSDATEI MITTELS FORTRAN 90 - PROGRAMM |
---|
747 | [[ $silent = false ]] && printf "..." |
---|
748 | export cond1 cond2 config_file do_remote do_trace input_list localhost output_list |
---|
749 | export interpreted_config_file=.icf.$RANDOM |
---|
750 | |
---|
751 | case $localhost_realname in |
---|
752 | (caurus|twister) interpret_config.hp;; |
---|
753 | (bora|breva|elephanta|gallego|gregale|hababai|maestro|orkan|ostria) export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/muksoft/packages/intel_ifc/8.1/lib/; interpret_config_9.x;; |
---|
754 | (levanto|vorias) export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/muksoft/packages/intel/ifort/9.1.037/lib/; interpret_config_9.x_levanto;; |
---|
755 | (quanero) export LD_LIBRARY_PATH=$LD_LIBRARY_PATH:/opt/intel_fc_80/lib; interpret_config_9.x;; |
---|
756 | (*) interpret_config.x;; |
---|
757 | esac |
---|
758 | |
---|
759 | |
---|
760 | # AUSFUEHRUNG DER GENERIERTEN SHELL-KOMMANDOS IN DIESER SHELL |
---|
761 | chmod u+x $interpreted_config_file |
---|
762 | export PATH=$PATH:. |
---|
763 | . $interpreted_config_file |
---|
764 | rm $interpreted_config_file |
---|
765 | |
---|
766 | fi |
---|
767 | |
---|
768 | |
---|
769 | # QUELLTEXTVERZEICHNIS AUF LOKALER MASCHINE AUS KONFIGURATIONSDATEI |
---|
770 | # BESTIMMEN (WUERDE SONST EVTL. DAS VERZEICHNIS DES JEWEILS UNTER -h |
---|
771 | # ANGEGEBENEN REMOTE-RECHNERS SEIN) |
---|
772 | # BEI BATCH-JOBS SIND DIE ZU UEBERSETZENDEN PROGRAMMTEILE SCHON KOMPLETT |
---|
773 | if [[ "$SOURCES_COMPLETE" = "" ]] |
---|
774 | then |
---|
775 | |
---|
776 | # ZUERST PRUEFEN, OB EIN GLOBALER QUELLTEXTPFAD FUER ALLE RECHNER |
---|
777 | # VEREINBART WURDE |
---|
778 | source_path="" |
---|
779 | line="" |
---|
780 | grep "%source_path" $config_file > tmp_mrun |
---|
781 | while read line |
---|
782 | do |
---|
783 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
784 | then |
---|
785 | if [[ "$(echo $line | cut -d" " -f3)" = "" ]] |
---|
786 | then |
---|
787 | global_source_path=`echo $line | cut -d" " -f2` |
---|
788 | fi |
---|
789 | fi |
---|
790 | done < tmp_mrun |
---|
791 | |
---|
792 | line="" |
---|
793 | found=false |
---|
794 | grep " $localhost" $config_file | grep "%source_path" > tmp_mrun |
---|
795 | while read line |
---|
796 | do |
---|
797 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
798 | then |
---|
799 | if [[ $found = true ]] |
---|
800 | then |
---|
801 | printf "\n\n +++ more than one source path found in configuration file" |
---|
802 | printf "\n for local host \"$localhost\" " |
---|
803 | locat=source_path; exit |
---|
804 | fi |
---|
805 | source_path=`echo $line | cut -d" " -f2` |
---|
806 | found=true |
---|
807 | fi |
---|
808 | done < tmp_mrun |
---|
809 | rm tmp_mrun |
---|
810 | |
---|
811 | if [[ "$source_path" = "" ]] |
---|
812 | then |
---|
813 | if [[ "$global_source_path" != "" ]] |
---|
814 | then |
---|
815 | source_path=$global_source_path |
---|
816 | else |
---|
817 | printf "\n\n +++ no source path found in configuration file" |
---|
818 | printf "\n for local host \"$localhost\" " |
---|
819 | locat=source_path; exit |
---|
820 | fi |
---|
821 | fi |
---|
822 | eval source_path=$source_path |
---|
823 | |
---|
824 | if [[ ! -d $source_path ]] |
---|
825 | then |
---|
826 | printf "\n\n +++ source path \"$source_path\" on local host" |
---|
827 | printf "\n \"$localhost\" does not exist" |
---|
828 | locat=source_path; exit |
---|
829 | fi |
---|
830 | |
---|
831 | fi |
---|
832 | |
---|
833 | |
---|
834 | |
---|
835 | # NOCHMAL PRUEFEN, OB AUF REMOTE-MASCHINE GERECHNET WERDEN SOLL |
---|
836 | # (HOST KANN IN KONFIGURATIONSDATEI ANDERS FESTGELEGT WORDEN SEIN) |
---|
837 | # WERT VON do_remote WIRD FUER DATEIVERBINDUNGEN BENOETIGT. |
---|
838 | # WENN AUF REMOTE-MASCHINE GERECHNET WIRD, IST GLEICHZEITIG KLAR, |
---|
839 | # DASS EIN BATCH-JOB GESTARTET WERDEN MUSS |
---|
840 | if [[ -n $host && "$host" != $localhost ]] |
---|
841 | then |
---|
842 | do_batch=true |
---|
843 | do_remote=true |
---|
844 | case $host in |
---|
845 | (hpmuk|ibm|ibmb|ibmh|ibms|ibmy|lctit|nech|neck|unics) true;; |
---|
846 | (*) printf "\n" |
---|
847 | printf "\n +++ execution host \"$host\" not admitted for MRUN," |
---|
848 | printf "\n or no queueing system available on execution host!" |
---|
849 | locat=nqs; (( iec = 0 )); exit;; |
---|
850 | esac |
---|
851 | else |
---|
852 | host=$localhost |
---|
853 | fi |
---|
854 | |
---|
855 | |
---|
856 | # PRUEFUNG EINIGER PROZESSORZAHLANGABEN BEI RECHNUNGEN AUF PARALLELRECHNERN |
---|
857 | if [[ "$cond1" = parallel || "$cond2" = parallel ]] |
---|
858 | then |
---|
859 | |
---|
860 | # PRUEFEN, OB DIE ANZAHL DER ZU VERWENDENDEN PES ANGEGEBEN WURDE |
---|
861 | if [[ ! -n $numprocs ]] |
---|
862 | then |
---|
863 | printf "\n" |
---|
864 | printf "\n +++ option \"-K parallel\" requires additional specification" |
---|
865 | printf "\n of the number of processors to be used by" |
---|
866 | printf "\n mrun-option \"-X\" or by environment-variable" |
---|
867 | printf "\n \"numprocs\" in the configuration file" |
---|
868 | locat=numprocs; (( iec = 0 )); exit |
---|
869 | fi |
---|
870 | |
---|
871 | # PRUEFEN, OB DIE PROZESSORANZAHL PRO KNOTEN ANGEGEBEN WURDE (GGF. |
---|
872 | # DEFAULT-WERT SETZEN) UND OB SIE EIN GANZZAHLIGER TEILER DER |
---|
873 | # GESAMTPROZESSORANZAHL IST |
---|
874 | if [[ $host = nech || $host = neck || $host = ibmh || $host = ibmb || $host = ibms ]] |
---|
875 | then |
---|
876 | [[ "$tasks_per_node" = "" ]] && tasks_per_node=6 |
---|
877 | (( ival = $tasks_per_node )) |
---|
878 | (( pes = numprocs )) |
---|
879 | # if [[ $(echo $package_list | grep -c dvrp_graphics+1PE) = 1 ]] |
---|
880 | # then |
---|
881 | # (( pes = pes - 1 )) |
---|
882 | # fi |
---|
883 | (( ii = pes / ival )) |
---|
884 | if (( pes - ii * ival > 0 )) |
---|
885 | then |
---|
886 | printf "\n" |
---|
887 | printf "\n +++ tasks per node (option \"-T\") must be an integral" |
---|
888 | printf "\n divisor of the total number of processors (option \"-X\")" |
---|
889 | printf "\n values of this mrun-call: \"-T $tasks_per_node\" \"-X $numprocs\"" |
---|
890 | locat=tasks_per_node; (( iec = 0 )); exit |
---|
891 | fi |
---|
892 | fi |
---|
893 | |
---|
894 | # IBMY HAT NUR EINEN KNOTEN |
---|
895 | if [[ $host = ibmy ]] |
---|
896 | then |
---|
897 | if [[ "$tasks_per_node" != "" && "$tasks_per_node" != "$numprocs" ]] |
---|
898 | then |
---|
899 | printf "\n" |
---|
900 | printf "\n +++ on ibmy, tasks per node (option \"-T\") must be equal to the" |
---|
901 | printf "\n total number of processors (option \"-X\")" |
---|
902 | printf "\n values of this mrun-call: \"-T $tasks_per_node\" \"-X $numprocs\"" |
---|
903 | locat=tasks_per_node; (( iec = 0 )); exit |
---|
904 | fi |
---|
905 | fi |
---|
906 | |
---|
907 | # FALLS OPENMP PARALLELISIERUNG VERWENDET WERDEN SOLL, ANZAHL VON THREADS |
---|
908 | # SETZEN UND ZAHL DER TASKS PRO KNOTEN AUF 1 SETZEN |
---|
909 | if [[ $use_openmp = true ]] |
---|
910 | then |
---|
911 | threads_per_task=$tasks_per_node |
---|
912 | tasks_per_node=1 |
---|
913 | fi |
---|
914 | OOPT="-O $threads_per_task" |
---|
915 | TOPT="-T $tasks_per_node" |
---|
916 | |
---|
917 | # GESAMTZAHL DER KNOTEN BESTIMMEN |
---|
918 | if [[ "$tasks_per_node" != "" ]] |
---|
919 | then |
---|
920 | (( nodes = numprocs / ( tasks_per_node * threads_per_task ) )) |
---|
921 | fi |
---|
922 | |
---|
923 | # PRUEFEN, OB NODE USAGE EINEN ERLAUBTEN WERT HAT BZW. DEN DEFAULT |
---|
924 | # SETZEN |
---|
925 | if [[ $node_usage = default ]] |
---|
926 | then |
---|
927 | if [[ $host = ibms ]] |
---|
928 | then |
---|
929 | node_usage=shared |
---|
930 | else |
---|
931 | node_usage=not_shared |
---|
932 | fi |
---|
933 | fi |
---|
934 | if [[ $node_usage != shared && $node_usage != not_shared ]] |
---|
935 | then |
---|
936 | printf "\n" |
---|
937 | printf "\n +++ node usage (option \"-n\") is only allowed to be set" |
---|
938 | printf "\n \"shared\" or \"not_shared\"" |
---|
939 | locat=tasks_per_node; (( iec = 0 )); exit |
---|
940 | fi |
---|
941 | |
---|
942 | fi |
---|
943 | |
---|
944 | # PRUEFEN, OB HOSTFILE EXISTIERT |
---|
945 | if [[ -n $hostfile ]] |
---|
946 | then |
---|
947 | if [[ ! -f $hostfile ]] |
---|
948 | then |
---|
949 | printf "\n" |
---|
950 | printf "\n +++ hostfile \"$hostfile\" does not exist" |
---|
951 | locat=hostfile; exit |
---|
952 | fi |
---|
953 | fi |
---|
954 | |
---|
955 | # PRUEFEN, OB RHOSTS DATEI EXISTIERT. GEGEBENENFALLS ANLEGEN BZW. ERWEITERN |
---|
956 | if [[ $host = ibmy && $do_remote = false ]] |
---|
957 | then |
---|
958 | if [[ ! -f $HOME/.rhosts ]] |
---|
959 | then |
---|
960 | echo "gfdl5.yonsei.ac.kr" > $HOME/.rhosts |
---|
961 | printf "\n\n *** file:" |
---|
962 | printf "\n $HOME/.rhosts" |
---|
963 | printf "\n was created\n" |
---|
964 | fi |
---|
965 | if [[ $(grep -c gfdl5.yonsei.ac.kr $HOME/.rhosts) = 0 ]] |
---|
966 | then |
---|
967 | echo "gfdl5.yonsei.ac.kr" >> $HOME/.rhosts |
---|
968 | printf "\n\n *** file:" |
---|
969 | printf "\n $HOME/.rhosts" |
---|
970 | printf "\n was extended by the name of the current host\n" |
---|
971 | fi |
---|
972 | fi |
---|
973 | |
---|
974 | # DEFAULT-DATEITRANSFER-PROTOKOLL FESTLEGEN |
---|
975 | if [[ "$filetransfer_protocol" = "" ]] |
---|
976 | then |
---|
977 | case $host in |
---|
978 | (nech|neck|ibm|ibmb|ibmh|ibms|ibmy|lctit) filetransfer_protocol=scp;; |
---|
979 | (*) filetransfer_protocol=ftp;; |
---|
980 | esac |
---|
981 | fi |
---|
982 | |
---|
983 | # PRUEFEN, OB ZULAESSIGES DATEITRANSFER-PROTOKOLL GEWAEHLT WURDE |
---|
984 | if [[ "$filetransfer_protocol" != ftp && "$filetransfer_protocol" != scp ]] |
---|
985 | then |
---|
986 | printf "\n" |
---|
987 | printf "\n +++ illegal value \"$filetransfer_protocol\" for Option -f" |
---|
988 | printf "\n only \"ftp\" or \"scp\" are allowed" |
---|
989 | locat=options; exit |
---|
990 | fi |
---|
991 | |
---|
992 | |
---|
993 | # FALLS NICHT VORGEGEBEN, DEFAULT-QUEUE AUF DER ZIELMASCHINE FESTLEGEN |
---|
994 | if [[ $queue = none ]] |
---|
995 | then |
---|
996 | case $host in |
---|
997 | (hpmuk) queue=hpmuk;; |
---|
998 | (ibmb) if [[ $node_usage = shared ]] |
---|
999 | then |
---|
1000 | queue=cshare |
---|
1001 | else |
---|
1002 | queue=csolo |
---|
1003 | fi;; |
---|
1004 | (ibmh) if [[ $node_usage = shared ]] |
---|
1005 | then |
---|
1006 | queue=cshare |
---|
1007 | else |
---|
1008 | queue=csolo |
---|
1009 | fi;; |
---|
1010 | (ibmy) queue=parallel;; |
---|
1011 | (lctit) queue=default;; |
---|
1012 | (nech) queue=none;; |
---|
1013 | (neck) queue=P;; |
---|
1014 | (unics) queue=unics;; |
---|
1015 | esac |
---|
1016 | fi |
---|
1017 | |
---|
1018 | |
---|
1019 | # EVTL. NETCDF-UNTERSTUETZUNG SETZEN |
---|
1020 | case $host in |
---|
1021 | (decalpha) netcdf_support=true |
---|
1022 | netcdf_path=/usr/local/netcdf-3.5.1;; |
---|
1023 | (ibmb|ibmh) netcdf_support=true |
---|
1024 | netcdf_path=/aws/dataformats/netcdf-3.6.0-p1/64-32;; |
---|
1025 | (ibms) netcdf_support=true |
---|
1026 | netcdf_path=/applic/lib/NETCDF64;; |
---|
1027 | (ibmy) netcdf_support=true |
---|
1028 | netcdf_path=/usr1/users/raasch/pub/netcdf-3.6.0-p1;; |
---|
1029 | (lcmuk) netcdf_support=true |
---|
1030 | if [[ $scirocco = true ]] |
---|
1031 | then |
---|
1032 | netcdf_path=/opt/netcdf/3.6.2-beta4 |
---|
1033 | else |
---|
1034 | netcdf_path=/muksoft/packages/netcdf/linux |
---|
1035 | fi;; |
---|
1036 | (lctit) netcdf_support=true |
---|
1037 | netcdf_path=/home2/usr5/mkanda/netcdf-3.6.1;; |
---|
1038 | (nech) netcdf_support=true |
---|
1039 | netcdf_path=/pool/SX-6/netcdf/netcdf-3.6.0-p1;; |
---|
1040 | (neck) netcdf_support=true |
---|
1041 | netcdf_path=/home/DSRC/NC/tatuyama/pub/netcdf-3.6.0-p1;; |
---|
1042 | esac |
---|
1043 | |
---|
1044 | |
---|
1045 | # VOLLSTAENDIGE DATEINAMEN DER INPUT-FILES BILDEN, |
---|
1046 | # INPUT-DATEIEN AUF VORHANDENSEIN PRUEFEN UND EVTL. HOECHSTE ZYKLUSNUMMER |
---|
1047 | # ERMITTELN |
---|
1048 | (( i = 0 )) |
---|
1049 | while (( i < iin )) |
---|
1050 | do |
---|
1051 | (( i = i + 1 )) |
---|
1052 | (( maxcycle = 0 )) |
---|
1053 | |
---|
1054 | # NAMENSBILDUNG (EVTL. IST FESTER DATEINAME VORGEGEBEN) |
---|
1055 | if [[ "${actionin[$i]}" = di ]] |
---|
1056 | then |
---|
1057 | remotepathin[$i]=${pathin[$i]}/${endin[$i]} # REMOTE-PFAD ERST AUF |
---|
1058 | # REM-MASCHINE AUSWERTEN |
---|
1059 | eval filename=${pathin[$i]}/${endin[$i]} |
---|
1060 | else |
---|
1061 | remotepathin[$i]=${pathin[$i]}/${afname}${endin[$i]} # REMOTE-PFAD ERST AUF |
---|
1062 | # REM-MASCHINE AUSWERTEN |
---|
1063 | eval filename=${pathin[$i]}/${afname}${endin[$i]} |
---|
1064 | fi |
---|
1065 | |
---|
1066 | # PRUEFEN AUF VORHANDENSEIN |
---|
1067 | if [[ $(ls $filename* 2>&1 | grep -c "not found") = 1 || \ |
---|
1068 | $(ls $filename* 2>&1 | grep -c "No such file") = 1 || \ |
---|
1069 | $(ls $filename* 2>&1 | grep -c "does not exist") = 1 ]] |
---|
1070 | then |
---|
1071 | # DATEIEN MIT EXTENSION (Z.B. NC) MUESSEN NICHT ZWINGEND VORHANDEN |
---|
1072 | # SEIN, DESHALB IN SOLCHEN FAELLEN KEIN ABBRUCH. DIES IST NUR EINE |
---|
1073 | # VORUEBERGEHENDE LOESUNG (OKT 05). NICHT ZWINGEND BENOETIGTE |
---|
1074 | # EINGABEDATEIEN SOLLTEN EINE SPEZIELLE OPTION IN DER DATEI- |
---|
1075 | # VERBINDUNGSANWEISUNG BEKOMMEN (Z.B. inopt?) |
---|
1076 | if [[ "${transin[$i]}" != "locopt" ]] |
---|
1077 | then |
---|
1078 | printf "\n\n +++ INPUT-file: " |
---|
1079 | if [[ "${extin[$i]}" = "" ]] |
---|
1080 | then |
---|
1081 | printf "\n $filename" |
---|
1082 | else |
---|
1083 | printf "\n $filename.${extin[$i]}" |
---|
1084 | fi |
---|
1085 | printf "\n does not exist\n" |
---|
1086 | locat=input; exit |
---|
1087 | else |
---|
1088 | transin[$i]="unavailable" |
---|
1089 | fi |
---|
1090 | else |
---|
1091 | |
---|
1092 | # ZYKLUSNUMMER FESTSTELLEN |
---|
1093 | ls -1 -d $filename > filelist 2>/dev/null |
---|
1094 | ls -1 -d $filename.* >> filelist 2>/dev/null |
---|
1095 | while read zeile |
---|
1096 | do |
---|
1097 | cycle=$(print $zeile | cut -f2 -d".") |
---|
1098 | if [[ "$cycle" = "$zeile" ]] |
---|
1099 | then |
---|
1100 | (( icycle = 0 )) |
---|
1101 | elif [[ "$cycle" = "${extin[$i]}" ]] |
---|
1102 | then |
---|
1103 | (( icycle = 0 )) |
---|
1104 | else |
---|
1105 | (( icycle = $cycle )) |
---|
1106 | fi |
---|
1107 | if (( icycle > maxcycle )) |
---|
1108 | then |
---|
1109 | (( maxcycle = icycle )) |
---|
1110 | file_to_be_used=$zeile |
---|
1111 | fi |
---|
1112 | done <filelist |
---|
1113 | rm filelist |
---|
1114 | |
---|
1115 | # EVTL. ZYKLUSNUMMER AN DATEINAMEN ANFUEGEN |
---|
1116 | if (( maxcycle > 0 )) |
---|
1117 | then |
---|
1118 | if [[ "${extin[$i]}" != " " && "${extin[$i]}" != "" ]] |
---|
1119 | then |
---|
1120 | filename=${filename}.$maxcycle.${extin[$i]} |
---|
1121 | else |
---|
1122 | filename=${filename}.$maxcycle |
---|
1123 | fi |
---|
1124 | else |
---|
1125 | if [[ "${extin[$i]}" != " " && "${extin[$i]}" != "" ]] |
---|
1126 | then |
---|
1127 | filename=${filename}.${extin[$i]} |
---|
1128 | fi |
---|
1129 | fi |
---|
1130 | |
---|
1131 | # DATEINAMEN OHNE PFAD ABER MIT ZYKLUSNUMMER ABSPEICHERN, |
---|
1132 | # DA SPAETER BEI RUECKSPEICHERN VOM ARCHIVSYSTEM EVTL. BENOETIGT |
---|
1133 | absnamein[$i]=$filename |
---|
1134 | if (( maxcycle > 0 )) |
---|
1135 | then |
---|
1136 | if [[ "${actionin[$i]}" = di ]] |
---|
1137 | then |
---|
1138 | frelin[$i]=${endin[$i]}.$maxcycle |
---|
1139 | else |
---|
1140 | frelin[$i]=${afname}${endin[$i]}.$maxcycle |
---|
1141 | fi |
---|
1142 | else |
---|
1143 | if [[ "${actionin[$i]}" = di ]] |
---|
1144 | then |
---|
1145 | frelin[$i]=${endin[$i]} |
---|
1146 | else |
---|
1147 | frelin[$i]=${afname}${endin[$i]} |
---|
1148 | fi |
---|
1149 | fi |
---|
1150 | |
---|
1151 | fi |
---|
1152 | done |
---|
1153 | |
---|
1154 | |
---|
1155 | # VOLLSTAENDIGE DATEINAMEN (OHNE $ ODER ~) DER OUTPUT-FILES BILDEN, |
---|
1156 | # OUTPUT-DATEIEN AUF VORHANDENSEIN PRUEFEN UND EVTL. HOECHSTE ZYKLUSNUMMER |
---|
1157 | # ERMITTELN ODER, FALLS NICHT VORHANDEN, PRUEFEN, OB SIE SICH ANLEGEN LASSEN |
---|
1158 | # DIESE AKTIONEN FINDEN NICHT STATT, WENN PROGRAMM AUF REMOTE-MASCHINE |
---|
1159 | # RECHNET UND DATEI ANSCHLIESSEND TRANSFERIERT WERDEN SOLL! |
---|
1160 | (( i = 0 )) |
---|
1161 | while (( i < iout )) |
---|
1162 | do |
---|
1163 | (( i = i + 1 )) |
---|
1164 | if [[ ! ( $fromhost != $localhost && ( "${actionout[$i]}" = tr || "${actionout[$i]}" = tra || "${actionout[$i]}" = trpe ) ) ]] |
---|
1165 | then |
---|
1166 | if [[ "${actionout[$i]}" = tr || "${actionout[$i]}" = trpe ]] |
---|
1167 | then |
---|
1168 | actionout[$i]="" |
---|
1169 | elif [[ "${actionout[$i]}" = tra ]] |
---|
1170 | then |
---|
1171 | actionout[$i]=a |
---|
1172 | fi |
---|
1173 | (( maxcycle = 0 )) |
---|
1174 | eval filename=${pathout[$i]}/${fname}${endout[$i]} |
---|
1175 | eval catalogname=${pathout[$i]} |
---|
1176 | if [[ $(ls $filename* 2>&1 | grep -c "not found") = 1 || \ |
---|
1177 | $(ls $filename* 2>&1 | grep -c "No such file") = 1 || \ |
---|
1178 | $(ls $filename* 2>&1 | grep -c "does not exist") = 1 ]] |
---|
1179 | then |
---|
1180 | |
---|
1181 | # OUTPUT-DATEI NICHT VORHANDEN. PRUEFEN, OB ANLEGEN MOEGLICH. |
---|
1182 | if cat /dev/null > $filename |
---|
1183 | then |
---|
1184 | rm $filename |
---|
1185 | else |
---|
1186 | |
---|
1187 | # PRUEFEN, OB KATALOG VORHANDEN UND EVTL. DIESEN ANLEGEN |
---|
1188 | if [[ ! -d $catalogname ]] |
---|
1189 | then |
---|
1190 | if mkdir -p $catalogname |
---|
1191 | then |
---|
1192 | printf "\n\n *** directory:" |
---|
1193 | printf "\n $catalogname" |
---|
1194 | printf "\n was created\n" |
---|
1195 | else |
---|
1196 | printf "\n\n +++ OUTPUT-file:" |
---|
1197 | printf "\n $filename" |
---|
1198 | printf "\n cannot be created, because directory does not exist" |
---|
1199 | printf "\n and cannot be created either" |
---|
1200 | printf "\n" |
---|
1201 | locat=output ; exit |
---|
1202 | fi 2>/dev/null |
---|
1203 | else |
---|
1204 | printf "\n\n +++ OUTPUT-file:" |
---|
1205 | printf "\n $filename" |
---|
1206 | printf "\n cannot be created, although directory exists" |
---|
1207 | printf "\n" |
---|
1208 | locat=output ; exit |
---|
1209 | fi |
---|
1210 | fi 2>/dev/null |
---|
1211 | else |
---|
1212 | |
---|
1213 | # ZYKLUSNUMMER FESTSTELLEN |
---|
1214 | ls -1 -d $filename > filelist 2>/dev/null |
---|
1215 | ls -1 -d $filename.* >> filelist 2>/dev/null |
---|
1216 | while read zeile |
---|
1217 | do |
---|
1218 | cycle=$(print $zeile | cut -f2 -d".") |
---|
1219 | if [[ "$cycle" = "$zeile" || "$cycle" = ${extout[$i]} ]] |
---|
1220 | then |
---|
1221 | (( icycle = 1 )) |
---|
1222 | else |
---|
1223 | (( icycle = $cycle + 1 )) |
---|
1224 | fi |
---|
1225 | if (( icycle > maxcycle )) |
---|
1226 | then |
---|
1227 | (( maxcycle = icycle )) |
---|
1228 | fi |
---|
1229 | done <filelist |
---|
1230 | rm filelist |
---|
1231 | fi |
---|
1232 | |
---|
1233 | # EVTL. ZYKLUSNUMMER AN DATEINAMEN ANFUEGEN UND PRUEFEN, OB SICH |
---|
1234 | # DATEI AUCH WIRKLICH ANLEGEN LAESST. IM APPEND-FALL MUSS AN DEN |
---|
1235 | # HOECHSTEN VORHANDENEN ZYKLUS-ANGEHAENGT WERDEN. ANLAGEPRUEFUNG |
---|
1236 | # IST DANN NATUERLICH NICHT ZULAESSIG BZW. MOEGLICH |
---|
1237 | if [[ "${actionout[$i]}" != a ]] |
---|
1238 | then |
---|
1239 | if (( maxcycle > 0 )) |
---|
1240 | then |
---|
1241 | filename=${filename}.$maxcycle |
---|
1242 | if cat /dev/null > $filename |
---|
1243 | then |
---|
1244 | rm $filename |
---|
1245 | else |
---|
1246 | printf "\n +++ OUTPUT-file:" |
---|
1247 | printf "\n $filename" |
---|
1248 | printf "\n cannot be created" |
---|
1249 | locat=output ; exit |
---|
1250 | fi |
---|
1251 | fi |
---|
1252 | else |
---|
1253 | (( maxcycle = maxcycle - 1 )) |
---|
1254 | if (( maxcycle > 0 )) |
---|
1255 | then |
---|
1256 | filename=${filename}.$maxcycle |
---|
1257 | fi |
---|
1258 | fi |
---|
1259 | |
---|
1260 | # DATEINAMEN OHNE PFAD ABER MIT ZYKLUSNUMMER ABSPEICHERN, |
---|
1261 | # DA SPAETER BEI ABLAGE AUF ARCHIVSYSTEM BZW. FUER |
---|
1262 | # DATEI OUTPUT_FILE_CONNECTIONS EVTL. BENOETIGT |
---|
1263 | pathout[$i]=$filename |
---|
1264 | if (( maxcycle > 0 )) |
---|
1265 | then |
---|
1266 | frelout[$i]=${fname}${endout[$i]}.$maxcycle |
---|
1267 | else |
---|
1268 | frelout[$i]=${fname}${endout[$i]} |
---|
1269 | fi |
---|
1270 | |
---|
1271 | fi |
---|
1272 | done |
---|
1273 | |
---|
1274 | |
---|
1275 | # PRUEFEN, OB ENTWEDER HAUPTPROGRAMM ODER NUR EIN AUSFUEHRBARES |
---|
1276 | # PROGRAMM VEREINBART WURDE (IN DIESEM FALL BRAUCHT IM WEITEREN NICHT |
---|
1277 | # UEBERSETZT ZU WERDEN) |
---|
1278 | if [[ "$mainprog" = "" && "$executable" = "" ]] |
---|
1279 | then |
---|
1280 | printf "\n +++ neither main program nor executable defined" |
---|
1281 | locat=source; exit |
---|
1282 | elif [[ "$mainprog" != "" && "$executable" != "" ]] |
---|
1283 | then |
---|
1284 | printf "\n +++ main program as well as executable defined" |
---|
1285 | locat=source; exit |
---|
1286 | elif [[ "$mainprog" = "" && "$executable" != "" ]] |
---|
1287 | then |
---|
1288 | do_compile=false |
---|
1289 | fi |
---|
1290 | |
---|
1291 | |
---|
1292 | # ALLE ZU UEBERSETZENDEN PROGRAMMTEILE ZUSAMMENSAMMELN |
---|
1293 | # BEI BATCH-JOBS IST DIES NICHT NOETIG, WEIL DIE PROGRAMMTEILE BEREITS DURCH |
---|
1294 | # DEN MRUN-AUFRUF ERMITTELT SIND, DER DEN BATCH-JOB GENERIERT HAT, UND |
---|
1295 | # IM VERZEICHNIS SOURCES_FOR_RUN_... ABGELEGT SIND |
---|
1296 | if [[ $do_compile = true && "$SOURCES_COMPLETE" = "" ]] |
---|
1297 | then |
---|
1298 | |
---|
1299 | [[ "$source_list" = CF ]] && source_list=CHANGED_FILES |
---|
1300 | |
---|
1301 | if [[ "$source_list" = CHANGED_FILES || $continuation_run != true ]] |
---|
1302 | then |
---|
1303 | rm -rf SOURCES_FOR_RUN_$fname |
---|
1304 | mkdir SOURCES_FOR_RUN_$fname |
---|
1305 | fi |
---|
1306 | |
---|
1307 | |
---|
1308 | # EVTL. ZU UEBERSETZENDE PROGRAMMTEILE DADURCH BESTIMMEN, DASS GEPRUEFT |
---|
1309 | # WIRD, WELCHE DATEIEN WRITE-PERMIT BESITZEN (DATEIEN SOLLTEN DESHALB |
---|
1310 | # UNTER RCS-KONTROLLE STEHEN). MIT DER VARIABLEN EXCLUDE KOENNEN |
---|
1311 | # BESTIMMTE DATEIEN GRUNDSAETZLICH VON DER UEBERSETZUNG AUSGESCHLOSSEN |
---|
1312 | # WERDEN. DIES IST NUR BEI MANUELLEM START VON MRUN DURCH DEN BENUTZER |
---|
1313 | # MOEGLICH, DA BEI AUTOMATISCHEN RESTARTS TEST DURCH DIE TATSAECHLICH |
---|
1314 | # ZU UBERSETZENDEN DATEIEN ERSETZT IST. |
---|
1315 | # ALLE ERMITTELTEN DATEIEN WERDEN IM VERZEICHNIS SOURCES_FOR_RUN_... |
---|
1316 | # GESAMMELT |
---|
1317 | if [[ "$source_list" = CHANGED_FILES ]] |
---|
1318 | then |
---|
1319 | |
---|
1320 | source_list="" |
---|
1321 | |
---|
1322 | # ZUERST DAS DURCH DIE KONFIGURATIONSDATEI FESTGELEGTE |
---|
1323 | # QUELLTEXTVERZEICHNIS DURCHSUCHEN |
---|
1324 | cd $source_path |
---|
1325 | |
---|
1326 | |
---|
1327 | # ALLE MOEGLICHEN QUELLCODEDATEIEN AUFLISTEN |
---|
1328 | Names=$(ls -1 *.f90 2>&1) |
---|
1329 | [[ $(echo $Names | grep -c '*.f90') = 0 ]] && Filenames="$Names" |
---|
1330 | Names=$(ls -1 *.F90 2>&1) |
---|
1331 | [[ $(echo $Names | grep -c '*.F90') = 0 ]] && Filenames="$Filenames $Names" |
---|
1332 | Names=$(ls -1 *.F 2>&1) |
---|
1333 | [[ $(echo $Names | grep -c '*.F') = 0 ]] && Filenames="$Filenames $Names" |
---|
1334 | Names=$(ls -1 *.f 2>&1) |
---|
1335 | [[ $(echo $Names | grep -c '*.f') = 0 ]] && Filenames="$Filenames $Names" |
---|
1336 | Names=$(ls -1 *.c 2>&1) |
---|
1337 | [[ $(echo $Names | grep -c '*.c') = 0 ]] && Filenames="$Filenames $Names" |
---|
1338 | |
---|
1339 | |
---|
1340 | # DATEIEN MIT WRITE-PERMIT NACH SOURCES_FOR_RUN_... KOPIEREN |
---|
1341 | for dateiname in $Filenames |
---|
1342 | do |
---|
1343 | if [[ -w $dateiname ]] |
---|
1344 | then |
---|
1345 | if [[ "$exclude" = "" || $(echo $exclude | grep -c $dateiname) = 0 ]] |
---|
1346 | then |
---|
1347 | cp $dateiname $working_directory/SOURCES_FOR_RUN_$fname |
---|
1348 | source_list=$source_list"$dateiname " |
---|
1349 | fi |
---|
1350 | fi |
---|
1351 | done |
---|
1352 | |
---|
1353 | cd - > /dev/null |
---|
1354 | |
---|
1355 | |
---|
1356 | # MITTELS OPTION -s ANGEGEBENE DATEIEN NACH SOURCES_FOR_RUN_... KOPIEREN |
---|
1357 | # BEI AUTOMATISCHEN FORTSETZUNGSLAEUFEN SIND DORT SCHON ALLE DATEIEN |
---|
1358 | # VORHANDEN |
---|
1359 | elif [[ "$source_list" != "" && $continuation_run != true ]] |
---|
1360 | then |
---|
1361 | |
---|
1362 | cd $source_path |
---|
1363 | |
---|
1364 | for filename in $source_list |
---|
1365 | do |
---|
1366 | |
---|
1367 | # QUELLTEXT-DATEI DARF KEINE PFADE BEINHALTEN |
---|
1368 | if [[ $(print $filename | grep -c "/") != 0 ]] |
---|
1369 | then |
---|
1370 | printf "\n +++ source code file: $filename" |
---|
1371 | printf "\n must not contain (\"/\") " |
---|
1372 | locat=source; exit |
---|
1373 | fi |
---|
1374 | |
---|
1375 | if [[ ! -f $filename ]] |
---|
1376 | then |
---|
1377 | printf "\n +++ source code file: $filename" |
---|
1378 | printf "\n does not exist" |
---|
1379 | locat=source; exit |
---|
1380 | else |
---|
1381 | cp $filename $working_directory/SOURCES_FOR_RUN_$fname |
---|
1382 | fi |
---|
1383 | |
---|
1384 | done |
---|
1385 | |
---|
1386 | cd - > /dev/null |
---|
1387 | |
---|
1388 | fi |
---|
1389 | |
---|
1390 | |
---|
1391 | # PRUEFEN, OB ENTWEDER HAUPTPROGRAMM VORHANDEN UND ES EVTL. IN DER |
---|
1392 | # LISTE DER ZU UEBERSETZENDEN PROGRAMMTEILE MIT ENTHALTEN IST (WENN |
---|
1393 | # NICHT, WIRD ES DIESER LISTE HINZUGEFUEGT) |
---|
1394 | if [[ $continuation_run != true ]] |
---|
1395 | then |
---|
1396 | |
---|
1397 | if [[ ! -f "$source_path/$mainprog" ]] |
---|
1398 | then |
---|
1399 | printf "\n\n +++ main program: $mainprog" |
---|
1400 | printf "\n does not exist in source directory" |
---|
1401 | printf "\n \"$source_path\"\n" |
---|
1402 | locat=source; exit |
---|
1403 | else |
---|
1404 | if [[ $(echo $source_list | grep -c $mainprog) = 0 ]] |
---|
1405 | then |
---|
1406 | cp $source_path/$mainprog SOURCES_FOR_RUN_$fname |
---|
1407 | source_list=${mainprog}" $source_list" |
---|
1408 | fi |
---|
1409 | fi |
---|
1410 | fi |
---|
1411 | |
---|
1412 | |
---|
1413 | # DATEIEN AUS ZUSAETZLICHEM QUELLVERZEICHNIS HINZUFUEGEN |
---|
1414 | if [[ $continuation_run != true && "$add_source_path" != "" ]] |
---|
1415 | then |
---|
1416 | |
---|
1417 | # GIBT ES DAS VERZEICHNIS UEBERHAUPT? |
---|
1418 | if [[ ! -d $add_source_path ]] |
---|
1419 | then |
---|
1420 | printf "\n\n +++ WARNING: additional source code directory" |
---|
1421 | printf "\n \"$add_source_path\" " |
---|
1422 | printf "\n does not exist or is not a directory." |
---|
1423 | printf "\n No source code will be used from this directory!\n" |
---|
1424 | add_source_path="" |
---|
1425 | sleep 3 |
---|
1426 | else |
---|
1427 | |
---|
1428 | cd $add_source_path |
---|
1429 | |
---|
1430 | Names=$(ls -1 *.f90 2>&1) |
---|
1431 | [[ $(echo $Names | grep -c '*.f90') = 0 ]] && AddFilenames="$Names" |
---|
1432 | Names=$(ls -1 *.F90 2>&1) |
---|
1433 | [[ $(echo $Names | grep -c '*.F90') = 0 ]] && AddFilenames="$AddFilenames $Names" |
---|
1434 | Names=$(ls -1 *.F 2>&1) |
---|
1435 | [[ $(echo $Names | grep -c '*.F') = 0 ]] && AddFilenames="$AddFilenames $Names" |
---|
1436 | Names=$(ls -1 *.f 2>&1) |
---|
1437 | [[ $(echo $Names | grep -c '*.f') = 0 ]] && AddFilenames="$AddFilenames $Names" |
---|
1438 | Names=$(ls -1 *.c 2>&1) |
---|
1439 | [[ $(echo $Names | grep -c '*.c') = 0 ]] && AddFilenames="$AddFilenames $Names" |
---|
1440 | |
---|
1441 | cd - > /dev/null |
---|
1442 | cd SOURCES_FOR_RUN_$fname |
---|
1443 | |
---|
1444 | for dateiname in $AddFilenames |
---|
1445 | do |
---|
1446 | if [[ -f $dateiname ]] |
---|
1447 | then |
---|
1448 | printf "\n +++ source code file \"$dateiname\" found in additional" |
---|
1449 | printf "\n source code directory \"$add_source_path\" " |
---|
1450 | printf "\n as well as in directory \"$source_path\"." |
---|
1451 | locat=source; exit |
---|
1452 | fi |
---|
1453 | |
---|
1454 | cp $add_source_path/$dateiname . |
---|
1455 | source_list="$source_list $dateiname" |
---|
1456 | |
---|
1457 | # Default User-Interface von der Liste entfernen, falls Datei |
---|
1458 | # ein User-Interface enthaelt |
---|
1459 | if [[ $( cat $dateiname | grep -c "END SUBROUTINE user_parin" ) != 0 ]] |
---|
1460 | then |
---|
1461 | if [[ -f user_interface.f90 ]] |
---|
1462 | then |
---|
1463 | rm -rf user_interface.f90 |
---|
1464 | source_list=`echo $source_list | sed -e 's/user_interface.f90//'` |
---|
1465 | printf "\n\n *** \"user_interface.f90\" removed from the files to be translated" |
---|
1466 | printf "\n since a user-interface is found in file" |
---|
1467 | printf "\n \"$add_source_path/$dateiname\" \n" |
---|
1468 | sleep 3 |
---|
1469 | else |
---|
1470 | printf "\n\n *** user-interface file \"$dateiname\" " |
---|
1471 | printf "\n added to the files to be translated \n" |
---|
1472 | sleep 3 |
---|
1473 | fi |
---|
1474 | fi |
---|
1475 | done |
---|
1476 | |
---|
1477 | cd - > /dev/null |
---|
1478 | fi |
---|
1479 | fi |
---|
1480 | |
---|
1481 | |
---|
1482 | # ALLE UNTERPROGRAMME, DIE ZU VEREINBARTEN SOFTWAREPAKETEN GEHOEREN, |
---|
1483 | # DER LISTE DER ZU UEBERSETZENDEN DATEIEN HINZUFUEGEN |
---|
1484 | if [[ $continuation_run != true && -n $package_list ]] |
---|
1485 | then |
---|
1486 | |
---|
1487 | cd $source_path |
---|
1488 | |
---|
1489 | for package in $package_list |
---|
1490 | do |
---|
1491 | |
---|
1492 | [[ $package = "dvrp_graphics+1PE" ]] && package=dvrp_graphics |
---|
1493 | |
---|
1494 | # ERMITTELE ALLE DATEIEN, DIE ZUM PAKET GEHOEREN |
---|
1495 | # FEHLERMELDUNGEN WERDEN ABGEFANGEN, DA * AUCH VERZEICHNISSNAMEN |
---|
1496 | # LIEFERT |
---|
1497 | package_source_list=`grep "defined( __$package " * 2>/dev/null | cut -f1 -d:` |
---|
1498 | |
---|
1499 | |
---|
1500 | # FUEGE DIESE DATEIEN DER LISTE DER ZU UEBERSETZENDEN DATEIEN |
---|
1501 | # HINZU, FALLS SIE NOCH NICHT DAZUGEHOEREN |
---|
1502 | for source_list_name in $package_source_list |
---|
1503 | do |
---|
1504 | if [[ $(echo $source_list | grep -c $source_list_name) = 0 ]] |
---|
1505 | then |
---|
1506 | |
---|
1507 | # NUR DATEIEN MIT GUELTIGEN ENDUNGEN VERWENDEN |
---|
1508 | ending=`echo $source_list_name | cut -f2 -d.` |
---|
1509 | if [[ "$ending" = f90 || "$ending" = F90 || "$ending" = f || "$ending" = F || "$ending" = c ]] |
---|
1510 | then |
---|
1511 | cp $source_list_name $working_directory/SOURCES_FOR_RUN_$fname |
---|
1512 | source_list="$source_list $source_list_name" |
---|
1513 | fi |
---|
1514 | fi |
---|
1515 | done |
---|
1516 | done |
---|
1517 | |
---|
1518 | cd - > /dev/null |
---|
1519 | fi |
---|
1520 | |
---|
1521 | |
---|
1522 | # MAKEFILE AUF VORHANDENSEIN PRUEFEN UND KOPIEREN |
---|
1523 | # BEI RESTART-LAEUFEN LIEGT ES SCHON IM VERZEICHNIS SOURCES_FOR_RUN... |
---|
1524 | if [[ "$use_makefile" = true && "$continuation_run" != true ]] |
---|
1525 | then |
---|
1526 | [[ "$makefile" = "" ]] && makefile=$source_path/Makefile |
---|
1527 | if [[ ! -f $makefile ]] |
---|
1528 | then |
---|
1529 | printf "\n +++ file \"$makefile\" does not exist" |
---|
1530 | printf "\n provide this file or set \"use_makefile=false\" in configuration file\n" |
---|
1531 | locat=make; exit |
---|
1532 | else |
---|
1533 | cp $makefile SOURCES_FOR_RUN_$fname/Makefile |
---|
1534 | fi |
---|
1535 | fi |
---|
1536 | |
---|
1537 | fi # do_compile=true |
---|
1538 | |
---|
1539 | |
---|
1540 | # FALLS PROGRAMMTEILE UEBERSETZT WERDEN SOLLEN, FOLGEN JETZT EINIGE |
---|
1541 | # UEBERPRUEFUNGEN UND DAS SETZEN DER PRAEPROZESSOR-DIREKTIVEN |
---|
1542 | if [[ $do_compile = true ]] |
---|
1543 | then |
---|
1544 | |
---|
1545 | # PRAEPROZESSOR-DIREKTIVEN ZUM SELEKTIVEN AUSWAEHLEN VON CODETEILEN |
---|
1546 | # ZUSAMMENSETZEN |
---|
1547 | if [[ $(echo $localhost | cut -c1-3) = ibm ]] |
---|
1548 | then |
---|
1549 | PPOPTS=-Dibm=ibm |
---|
1550 | elif [[ $(echo $localhost | cut -c1-3) = nec ]] |
---|
1551 | then |
---|
1552 | PPOPTS=-Dnec |
---|
1553 | else |
---|
1554 | PPOPTS=-D$localhost |
---|
1555 | fi |
---|
1556 | if [[ $(echo $localhost | cut -c1-3) = ibm ]] |
---|
1557 | then |
---|
1558 | [[ -n $cond1 ]] && PPOPTS="$PPOPTS -D$cond1=$cond1" |
---|
1559 | [[ -n $cond2 ]] && PPOPTS="$PPOPTS -D$cond2=$cond2" |
---|
1560 | if [[ $netcdf_support = true ]] |
---|
1561 | then |
---|
1562 | PPOPTS="$PPOPTS -Dnetcdf=netcdf" |
---|
1563 | [[ $localhost != ibms ]] && PPOPTS="$PPOPTS -Dnetcdf_64bit=netcdf_64bit" |
---|
1564 | fi |
---|
1565 | if [[ $localhost = ibmy ]] |
---|
1566 | then |
---|
1567 | PPOPTS="$PPOPTS -Dibmy_special=ibmy_special" |
---|
1568 | fi |
---|
1569 | else |
---|
1570 | [[ -n $cond1 ]] && PPOPTS="$PPOPTS -D$cond1" |
---|
1571 | [[ -n $cond2 ]] && PPOPTS="$PPOPTS -D$cond2" |
---|
1572 | if [[ $netcdf_support = true ]] |
---|
1573 | then |
---|
1574 | PPOPTS="$PPOPTS -Dnetcdf" |
---|
1575 | [[ $localhost != decalpha && $localhost != lctit ]] && PPOPTS="$PPOPTS -Dnetcdf_64bit" |
---|
1576 | fi |
---|
1577 | fi |
---|
1578 | if [[ -n $package_list ]] |
---|
1579 | then |
---|
1580 | for package in $package_list |
---|
1581 | do |
---|
1582 | if [[ $(echo $localhost | cut -c1-3) = ibm ]] |
---|
1583 | then |
---|
1584 | if [[ $package != "dvrp_graphics+1PE" ]] |
---|
1585 | then |
---|
1586 | PPOPTS="$PPOPTS -D$package=$package" |
---|
1587 | else |
---|
1588 | PPOPTS="$PPOPTS -Ddvrp_graphics" |
---|
1589 | export use_seperate_pe_for_dvrp_output=true |
---|
1590 | fi |
---|
1591 | else |
---|
1592 | if [[ $package != "dvrp_graphics+1PE" ]] |
---|
1593 | then |
---|
1594 | PPOPTS="$PPOPTS -D$package" |
---|
1595 | else |
---|
1596 | PPOPTS="$PPOPTS -Ddvrp_graphics" |
---|
1597 | export use_seperate_pe_for_dvrp_output=true |
---|
1598 | fi |
---|
1599 | fi |
---|
1600 | done |
---|
1601 | fi |
---|
1602 | if [[ -n $cpp_opts ]] |
---|
1603 | then |
---|
1604 | for popts in $cpp_opts |
---|
1605 | do |
---|
1606 | PPOPTS="$PPOPTS -D$popts" |
---|
1607 | done |
---|
1608 | fi |
---|
1609 | |
---|
1610 | # -D ARGUMENTEN EINEN DOPPELTEN UNTERSTRICH VORANSTELLEN |
---|
1611 | PPOPTS=`echo " $PPOPTS" | sed 's/ -D/ -D__/g'` |
---|
1612 | |
---|
1613 | # OPTION ZUM EINSCHALTEN DES PRAEPROZESSORS HINZUFUEGEN |
---|
1614 | if [[ $host = decalpha ]] |
---|
1615 | then |
---|
1616 | C_PPOPTS="-cpp -DMPI_REAL=MPI_DOUBLE_PRECISION -DMPI_2REAL=MPI_2DOUBLE_PRECISION $PPOPTS" |
---|
1617 | elif [[ $(echo $host | cut -c1-3) = ibm ]] |
---|
1618 | then |
---|
1619 | # blanks in PPOPTS muessen durch "," ersetzt werden |
---|
1620 | PPOPTS=`echo $PPOPTS | sed 's/ -/,-/g'` |
---|
1621 | C_PPOPTS="-qsuffix=cpp=f90 -WF,-DMPI_REAL=MPI_DOUBLE_PRECISION,$PPOPTS" |
---|
1622 | elif [[ $host = lcmuk ]] |
---|
1623 | then |
---|
1624 | C_PPOPTS="$PPOPTS -DMPI_REAL=MPI_DOUBLE_PRECISION -DMPI_2REAL=MPI_2DOUBLE_PRECISION" |
---|
1625 | elif [[ $host = lctit ]] |
---|
1626 | then |
---|
1627 | C_PPOPTS="$PPOPTS -Mpreprocess -DMPI_REAL=MPI_DOUBLE_PRECISION -DMPI_2REAL=MPI_2DOUBLE_PRECISION" |
---|
1628 | elif [[ $(echo $host | cut -c1-3) = nec ]] |
---|
1629 | then |
---|
1630 | C_PPOPTS="-Ep -DMPI_REAL=MPI_REAL8 -DMPI_2REAL=MPI_2REAL8 -DSCFFT=dzfft -DCSFFT=zdfft $PPOPTS" |
---|
1631 | else |
---|
1632 | C_PPOPTS="$PPOPTS" |
---|
1633 | fi |
---|
1634 | |
---|
1635 | else |
---|
1636 | |
---|
1637 | |
---|
1638 | # BEI LOKALEN RECHNUNGEN PRUEFEN, OB EXECUTABLE VORHANDEN |
---|
1639 | if [[ $do_remote = false ]] |
---|
1640 | then |
---|
1641 | if [[ ! -f $executable ]] |
---|
1642 | then |
---|
1643 | printf "\n +++ executable file: $executable" |
---|
1644 | printf "\n does not exist" |
---|
1645 | locat=executable; exit |
---|
1646 | fi |
---|
1647 | fi |
---|
1648 | fi |
---|
1649 | |
---|
1650 | |
---|
1651 | # JOBMODUS FESTSTELLEN |
---|
1652 | if [[ "$ENVIRONMENT" = BATCH && $localhost != lctit || "$QUEUE" != interactive && $localhost = lctit ]] |
---|
1653 | then |
---|
1654 | jobmo=BATCH |
---|
1655 | else |
---|
1656 | jobmo=INTERACTIVE |
---|
1657 | fi |
---|
1658 | |
---|
1659 | |
---|
1660 | # HOSTSPEZIFISCHE DEFAULT-COMPILER SETZEN, FALLS NICHT BEREITS |
---|
1661 | # DURCH BENUTZER ANDERWEITIG VEREINBART |
---|
1662 | if [[ "$compiler_name" = "" ]] |
---|
1663 | then |
---|
1664 | case $localhost in |
---|
1665 | (hpmuk|unics) compiler_name=f77;; |
---|
1666 | (lcmuk) if [[ "$cond1" = parallel || "$cond2" = parallel ]] |
---|
1667 | then |
---|
1668 | compiler_name=mpif90 |
---|
1669 | else |
---|
1670 | compiler_name=ifc |
---|
1671 | fi;; |
---|
1672 | (lctit) if [[ "$cond1" = parallel || "$cond2" = parallel ]] |
---|
1673 | then |
---|
1674 | compiler_name=mpif90 |
---|
1675 | echo ">>> compiler=mpif90" |
---|
1676 | else |
---|
1677 | compiler_name=pgf95 |
---|
1678 | echo ">>> compiler=pgf95" |
---|
1679 | fi;; |
---|
1680 | (nech) compiler_name=sxmpif90;; |
---|
1681 | (decalpha) compiler_name=f95;; |
---|
1682 | (ibm|ibmb|ibmh|ibms|ibmy) compiler_name=mpxlf95_r;; |
---|
1683 | (*) printf "\n +++ unknown host name: $localhost \n"; |
---|
1684 | locat=localhost; exit;; |
---|
1685 | esac |
---|
1686 | fi |
---|
1687 | |
---|
1688 | |
---|
1689 | # COMPILER AUF NECK UEBERSCHREIBEN |
---|
1690 | [[ $localhost = neck ]] && compiler_name=mpif90 |
---|
1691 | |
---|
1692 | |
---|
1693 | |
---|
1694 | # PRAEPROZESSOR-PFAD BESTIMMEN |
---|
1695 | case $localhost in |
---|
1696 | (decalpha|ibm|ibmb|ibmh|ibms|ibmy|unics) praeproc=cpp;; |
---|
1697 | (hpmuk) praeproc=/usr/ccs/lbin/cpp;; |
---|
1698 | esac |
---|
1699 | |
---|
1700 | |
---|
1701 | # TEMPORAEREN KATALOGNAMEN BESTIMMEN |
---|
1702 | kennung=$RANDOM |
---|
1703 | if [[ "$tmp_user_catalog" = "" ]] |
---|
1704 | then |
---|
1705 | if [[ $localhost = ibmb || $localhost = ibmh ]] |
---|
1706 | then |
---|
1707 | tmp_user_catalog=$TMPDIR |
---|
1708 | elif [[ $localhost = nech ]] |
---|
1709 | then |
---|
1710 | tmp_user_catalog=$WRKSHR |
---|
1711 | else |
---|
1712 | tmp_user_catalog=/tmp |
---|
1713 | fi |
---|
1714 | fi |
---|
1715 | TEMPDIR=$tmp_user_catalog/${usern}.$kennung |
---|
1716 | |
---|
1717 | |
---|
1718 | # KATALOGNAMEN FUER ZWISCHENSPEICHERUNG VON FORTSETZUNGSLAUFDATEIEN |
---|
1719 | # BESTIMMEN |
---|
1720 | if [[ "$tmp_data_catalog" = "" ]] |
---|
1721 | then |
---|
1722 | if [[ $localhost = ibmb || $localhost = ibmh ]] |
---|
1723 | then |
---|
1724 | tmp_data_catalog=$WORK/mrun_restart_data |
---|
1725 | elif [[ $localhost = nech ]] |
---|
1726 | then |
---|
1727 | tmp_data_catalog=$WRKSHR/mrun_restart_data |
---|
1728 | else |
---|
1729 | tmp_data_catalog=/tmp/mrun_restart_data |
---|
1730 | fi |
---|
1731 | fi |
---|
1732 | |
---|
1733 | |
---|
1734 | # EVENTUELL BEI LOKALEN RECHNUNGEN $-ZEICHEN IN ENVIRONMENT-VARIABLEN |
---|
1735 | # ERSETZEN |
---|
1736 | if [[ $do_remote = false && $do_compile = true ]] |
---|
1737 | then |
---|
1738 | eval fopts=\"$fopts\" |
---|
1739 | eval lopts=\"$lopts\" |
---|
1740 | fi |
---|
1741 | |
---|
1742 | |
---|
1743 | |
---|
1744 | # COMPILE- UND LINK-OPTIONEN BESTIMMEN |
---|
1745 | FOPTS="$fopts" |
---|
1746 | LOPTS="$lopts" |
---|
1747 | ROPTS="$ropts" |
---|
1748 | if [[ ( $(echo $host | cut -c1-3) = nec || $(echo $host | cut -c1-3) = ibm || $host = lctit ) && -n $numprocs ]] |
---|
1749 | then |
---|
1750 | XOPT="-X $numprocs" |
---|
1751 | fi |
---|
1752 | |
---|
1753 | |
---|
1754 | # BEI VERWENDUNG VON DVRP-SOFTWARE MUSS ENTSPECHENDE GRAFIK-BIBLIOTHEK |
---|
1755 | # MIT EINGEBUNDEN WERDEN |
---|
1756 | if [[ -n $package_list ]] |
---|
1757 | then |
---|
1758 | if [[ $(echo $package_list | grep -c dvrp_graphics) != 0 ]] |
---|
1759 | then |
---|
1760 | |
---|
1761 | # DVRP-GRAFIK GIBT ES NUR AUF DER IBM AM HLRN, AUF NECH UND |
---|
1762 | # DEM NOTEBOOK SCIROCCO |
---|
1763 | if [[ $host != ibmh && $host != nech && $host != lcmuk && "$local_compile" != true ]] |
---|
1764 | then |
---|
1765 | printf "\n" |
---|
1766 | printf "\n +++ option -p with package \"dvrp_graphics\" only allowed on nech and ibmh" |
---|
1767 | locat=parameter; exit |
---|
1768 | fi |
---|
1769 | if [[ $host = ibmh ]] |
---|
1770 | then |
---|
1771 | if [[ $cond1 = debug || $cond2 = debug ]] |
---|
1772 | then |
---|
1773 | FOPTS="-I/home/h/hzazchmi/lib/debug $FOPTS" |
---|
1774 | LOPTS="$LOPTS -L/home/h/hzazchmi/lib/debug -lDVRP2 -lftp" |
---|
1775 | else |
---|
1776 | FOPTS="-I/home/h/nikevita/lib_stable/optimize $FOPTS" |
---|
1777 | LOPTS="$LOPTS -L/home/h/nikevita/lib_stable/optimize -lDVRP2 -lftp" |
---|
1778 | fi |
---|
1779 | elif [[ $host = nech ]] |
---|
1780 | then |
---|
1781 | FOPTS="-I/import/ds9b/ipf2/b/b323013/lib/optimize $FOPTS" |
---|
1782 | LOPTS="$LOPTS -L/import/ds9b/ipf2/b/b323013/lib/optimize -lDVRP2 -lftp" |
---|
1783 | elif [[ $host = lcmuk ]] |
---|
1784 | then |
---|
1785 | FOPTS="-I/usr/local/lib/dvrp/optimize $FOPTS" |
---|
1786 | LOPTS="$LOPTS -L/usr/local/lib/dvrp/optimize -lDVRP2 -lftp" |
---|
1787 | fi |
---|
1788 | fi |
---|
1789 | fi |
---|
1790 | |
---|
1791 | |
---|
1792 | # EVTL. EINBINDEN DER NETCDF-BIBLIOTHEK |
---|
1793 | if [[ $netcdf_support = true ]] |
---|
1794 | then |
---|
1795 | case $host in |
---|
1796 | (decalpha) FOPTS="-I${netcdf_path}/include $FOPTS" |
---|
1797 | LOPTS="$LOPTS -L${netcdf_path}/lib -lnetcdf";; |
---|
1798 | (ibmb|ibmh) FOPTS="-I ${netcdf_path}/include-64 $FOPTS" |
---|
1799 | LOPTS="$LOPTS -L${netcdf_path}/lib -lnetcdf";; |
---|
1800 | (ibms) FOPTS="-I /applic/netcdf64/src/f90 $FOPTS" |
---|
1801 | LOPTS="$LOPTS -L${netcdf_path} -lnetcdf";; |
---|
1802 | (ibmy) FOPTS="-I ${netcdf_path}/include $FOPTS" |
---|
1803 | LOPTS="$LOPTS -L${netcdf_path}/lib -lnetcdf";; |
---|
1804 | (lcmuk|nech|neck) FOPTS="-I ${netcdf_path}/include $FOPTS" |
---|
1805 | LOPTS="$LOPTS -L${netcdf_path}/lib -lnetcdf";; |
---|
1806 | (lctit) FOPTS="-I ${netcdf_path}/src/f90 $FOPTS" |
---|
1807 | LOPTS="$LOPTS -L${netcdf_path}/src/libsrc -lnetcdf";; |
---|
1808 | |
---|
1809 | esac |
---|
1810 | fi |
---|
1811 | |
---|
1812 | # PRUEFEN DER CPU-ZEIT. (CPUMAX WIRD ALS ENV-VARIABLE VOM HAUTPRO- |
---|
1813 | # GRAMM BENOETIGT |
---|
1814 | done=false |
---|
1815 | while [[ $done = false ]] |
---|
1816 | do |
---|
1817 | cputime=$cpumax |
---|
1818 | if (( $cputime == 0 )) |
---|
1819 | then |
---|
1820 | printf "\n +++ cpu-time is undefined" |
---|
1821 | printf "\n >>> Please type CPU-time in seconds as INTEGER:" |
---|
1822 | printf "\n >>> " |
---|
1823 | read cputime 1>/dev/null 2>&1 |
---|
1824 | else |
---|
1825 | done=true |
---|
1826 | fi |
---|
1827 | cpumax=$cputime |
---|
1828 | done |
---|
1829 | |
---|
1830 | (( minuten = cputime / 60 )) |
---|
1831 | (( sekunden = cputime - minuten * 60 )) |
---|
1832 | |
---|
1833 | |
---|
1834 | # PRUEFEN DER KERNSPEICHERANFORDERUNG |
---|
1835 | if [[ $do_batch = true ]] |
---|
1836 | then |
---|
1837 | done=false |
---|
1838 | while [[ $done = false ]] |
---|
1839 | do |
---|
1840 | if (( memory == 0 )) |
---|
1841 | then |
---|
1842 | printf "\n +++ memory demand is undefined" |
---|
1843 | printf "\n >>> Please type memory in MByte per process as INTEGER:" |
---|
1844 | printf "\n >>> " |
---|
1845 | read memory 1>/dev/null 2>&1 |
---|
1846 | else |
---|
1847 | done=true |
---|
1848 | fi |
---|
1849 | done |
---|
1850 | fi |
---|
1851 | |
---|
1852 | |
---|
1853 | # PRUEFEN, OB FUER REMOTE-RECHNUNGEN EIN BENUTZERNAME ANGEGEBEN WURDE |
---|
1854 | if [[ $do_remote = true && -z $remote_username ]] |
---|
1855 | then |
---|
1856 | while [[ -z $remote_username ]] |
---|
1857 | do |
---|
1858 | printf "\n +++ username on remote host \"$host\" is undefined" |
---|
1859 | printf "\n >>> Please type username:" |
---|
1860 | printf "\n >>> " |
---|
1861 | read remote_username |
---|
1862 | done |
---|
1863 | mc="$mc -u$remote_username" |
---|
1864 | fi |
---|
1865 | |
---|
1866 | ########################################################################### |
---|
1867 | # HEADER-AUSGABE |
---|
1868 | ########################################################################### |
---|
1869 | |
---|
1870 | |
---|
1871 | calltime=$(date) |
---|
1872 | printf "\n" |
---|
1873 | # [[ $silent = false ]] && clear |
---|
1874 | printf "#--------------------------------------------------------------# \n" |
---|
1875 | printf "| $version$calltime | \n" |
---|
1876 | printf "| | \n" |
---|
1877 | spalte1="called on:"; spalte2=$localhost_realname |
---|
1878 | printf "| $spalte1$spalte2 | \n" |
---|
1879 | if [[ $local_compile = false ]] |
---|
1880 | then |
---|
1881 | if [[ $do_remote = true ]] |
---|
1882 | then |
---|
1883 | spalte1="execution on:"; spalte2="$host (username: $remote_username)" |
---|
1884 | else |
---|
1885 | spalte1="execution on:"; spalte2="$host ($localhost_realname)" |
---|
1886 | fi |
---|
1887 | else |
---|
1888 | spalte1="compiling test only!"; spalte2="" |
---|
1889 | fi |
---|
1890 | printf "| $spalte1$spalte2 | \n" |
---|
1891 | if [[ -n $numprocs ]] |
---|
1892 | then |
---|
1893 | spalte1="number of PEs:"; spalte2=$numprocs |
---|
1894 | printf "| $spalte1$spalte2 | \n" |
---|
1895 | fi |
---|
1896 | if [[ -n $tasks_per_node ]] |
---|
1897 | then |
---|
1898 | spalte1="tasks per node:"; spalte2="$tasks_per_node (number of nodes: $nodes)" |
---|
1899 | printf "| $spalte1$spalte2 | \n" |
---|
1900 | fi |
---|
1901 | if [[ $threads_per_task != 1 ]] |
---|
1902 | then |
---|
1903 | spalte1="threads per task:"; spalte2="$threads_per_task" |
---|
1904 | printf "| $spalte1$spalte2 | \n" |
---|
1905 | fi |
---|
1906 | printf "| | \n" |
---|
1907 | if [[ $do_compile = true ]] |
---|
1908 | then |
---|
1909 | spalte1=cpp-directives:; spalte2=$C_PPOPTS |
---|
1910 | printf "| $spalte1$spalte2 | \n" |
---|
1911 | zeile=$(echo "$C_PPOPTS" | cut -c41-) |
---|
1912 | while [[ "$zeile" != "" ]] |
---|
1913 | do |
---|
1914 | spalte1="" |
---|
1915 | spalte2=$zeile |
---|
1916 | printf "| $spalte1$spalte2 | \n" |
---|
1917 | zeile=$(echo "$zeile" | cut -c41-) |
---|
1918 | done |
---|
1919 | |
---|
1920 | spalte1=compiler-options:; spalte2="$FOPTS $MODULE_OPTIONS" |
---|
1921 | printf "| $spalte1$spalte2 | \n" |
---|
1922 | zeile=$(echo "$FOPTS $MODULE_OPTIONS" | cut -c41-) |
---|
1923 | while [[ "$zeile" != "" ]] |
---|
1924 | do |
---|
1925 | spalte1="" |
---|
1926 | spalte2=$zeile |
---|
1927 | printf "| $spalte1$spalte2 | \n" |
---|
1928 | zeile=$(echo "$zeile" | cut -c41-) |
---|
1929 | done |
---|
1930 | |
---|
1931 | spalte1=linker-options:; spalte2=$LOPTS |
---|
1932 | printf "| $spalte1$spalte2 | \n" |
---|
1933 | zeile=$(echo "$LOPTS" | cut -c41-) |
---|
1934 | while [[ "$zeile" != "" ]] |
---|
1935 | do |
---|
1936 | spalte1="" |
---|
1937 | spalte2=$zeile |
---|
1938 | printf "| $spalte1$spalte2 | \n" |
---|
1939 | zeile=$(echo "$zeile" | cut -c41-) |
---|
1940 | done |
---|
1941 | |
---|
1942 | spalte1="main program":; spalte2=$mainprog |
---|
1943 | printf "| $spalte1$spalte2 | \n" |
---|
1944 | if [[ "$use_makefile" = true ]] |
---|
1945 | then |
---|
1946 | spalte1="using \"make\" for com"; spalte2="piling and linking" |
---|
1947 | printf "| $spalte1$spalte2 | \n" |
---|
1948 | fi |
---|
1949 | # if [[ $vtk_graphics = true ]] |
---|
1950 | # then |
---|
1951 | # spalte1=""; spalte2="wird in C++ - Programm eingebunden (vtk)" |
---|
1952 | # printf "| $spalte1$spalte2 | \n" |
---|
1953 | # fi |
---|
1954 | else |
---|
1955 | spalte1=executable:; spalte2=$executable |
---|
1956 | printf "| $spalte1$spalte2 | \n" |
---|
1957 | fi |
---|
1958 | printf "| | \n" |
---|
1959 | spalte1="base name of files":; spalte2=$fname |
---|
1960 | printf "| $spalte1$spalte2 | \n" |
---|
1961 | if [[ $fname != $afname ]] |
---|
1962 | then |
---|
1963 | spalte1="base name of input files":; spalte2=$afname |
---|
1964 | printf "| $spalte1$spalte2 | \n" |
---|
1965 | fi |
---|
1966 | spalte1="INPUT control list":; spalte2=$input_list |
---|
1967 | printf "| $spalte1$spalte2 | \n" |
---|
1968 | spalte1="OUTPUT control list":; spalte2=$output_list |
---|
1969 | printf "| $spalte1$spalte2 | \n" |
---|
1970 | |
---|
1971 | if [[ $do_batch = true || "$LOADLBATCH" = yes ]] |
---|
1972 | then |
---|
1973 | spalte1="memory demand / PE":; spalte2="$memory MB" |
---|
1974 | printf "| $spalte1$spalte2 | \n" |
---|
1975 | spalte1=CPU-time:; spalte2="$minuten:$sekunden" |
---|
1976 | printf "| $spalte1$spalte2 | \n" |
---|
1977 | fi |
---|
1978 | |
---|
1979 | if [[ $do_compile = true ]] |
---|
1980 | then |
---|
1981 | printf "| | \n" |
---|
1982 | printf "| Files to be compiled: | \n" |
---|
1983 | zeile=$source_list |
---|
1984 | while [[ "$zeile" != "" ]] |
---|
1985 | do |
---|
1986 | spalte3=$zeile |
---|
1987 | printf "| $spalte3 | \n" |
---|
1988 | zeile=$(echo "$zeile" | cut -c61-) |
---|
1989 | done |
---|
1990 | fi |
---|
1991 | printf "#--------------------------------------------------------------#" |
---|
1992 | |
---|
1993 | |
---|
1994 | |
---|
1995 | # BEDINGTE AUSGABE DER DATEIVERBINDUNGEN |
---|
1996 | if [[ $do_trace = true ]] |
---|
1997 | then |
---|
1998 | (( i = 0 )) |
---|
1999 | while (( i < iin )) |
---|
2000 | do |
---|
2001 | (( i = i + 1 )) |
---|
2002 | if (( i == 1 )) |
---|
2003 | then |
---|
2004 | printf "\n\n >>> INPUT-file assignments:\n" |
---|
2005 | fi |
---|
2006 | printf "\n ${localin[$i]} : ${absnamein[$i]}" |
---|
2007 | done |
---|
2008 | (( i = 0 )) |
---|
2009 | while (( i < iout )) |
---|
2010 | do |
---|
2011 | (( i = i + 1 )) |
---|
2012 | if (( i == 1 )) |
---|
2013 | then |
---|
2014 | printf "\n\n >>> OUTPUT-file assignments:\n" |
---|
2015 | fi |
---|
2016 | printf "\n ${localout[$i]} : ${pathout[$i]}" |
---|
2017 | done |
---|
2018 | (( i = 0 )) |
---|
2019 | while (( i < iic )) |
---|
2020 | do |
---|
2021 | (( i = i + 1 )) |
---|
2022 | if (( i == 1 )) |
---|
2023 | then |
---|
2024 | printf "\n\n >>> INPUT-commands:\n" |
---|
2025 | fi |
---|
2026 | printf "\n ${in_command[$i]}" |
---|
2027 | done |
---|
2028 | (( i = 0 )) |
---|
2029 | while (( i < ioc )) |
---|
2030 | do |
---|
2031 | (( i = i + 1 )) |
---|
2032 | if (( i == 1 )) |
---|
2033 | then |
---|
2034 | printf "\n\n >>> OUTPUT-commands:\n" |
---|
2035 | fi |
---|
2036 | printf "\n ${out_command[$i]}" |
---|
2037 | done |
---|
2038 | fi |
---|
2039 | |
---|
2040 | |
---|
2041 | # ABFRAGEN BEI AUFRUF AUF LOKALER MASCHINE |
---|
2042 | if [[ $remotecall = false && $silent = false && $jobmo != BATCH ]] |
---|
2043 | then |
---|
2044 | antwort=dummy |
---|
2045 | printf "\n\n" |
---|
2046 | while [[ "$antwort" != y && "$antwort" != Y && "$antwort" != n && "$antwort" != N ]] |
---|
2047 | do |
---|
2048 | printf " >>> everything o.k. (y/n) ? " |
---|
2049 | read antwort |
---|
2050 | done |
---|
2051 | if [[ $antwort = n || $antwort = N ]] |
---|
2052 | then |
---|
2053 | locat=user_abort; (( iec = 0 )); exit |
---|
2054 | fi |
---|
2055 | if [[ $do_batch = true ]] |
---|
2056 | then |
---|
2057 | printf " >>> batch-job will be created and submitted" |
---|
2058 | else |
---|
2059 | if [[ $local_compile = false ]] |
---|
2060 | then |
---|
2061 | printf " >>> MRUN will now continue to execute on this machine" |
---|
2062 | else |
---|
2063 | printf " >>> a test compilation will now be carried out on this machine" |
---|
2064 | fi |
---|
2065 | fi |
---|
2066 | fi |
---|
2067 | |
---|
2068 | |
---|
2069 | |
---|
2070 | |
---|
2071 | # FALLS AUF DIESER MASCHINE GERECHNET WERDEN SOLL, WERDEN JETZT ENTSPRE- |
---|
2072 | # CHENDE AKTIONEN DURCHGEFUEHRT |
---|
2073 | if [[ $do_batch = false ]] |
---|
2074 | then |
---|
2075 | |
---|
2076 | |
---|
2077 | # TEMPORAEREN KATALOG ERZEUGEN |
---|
2078 | mkdir -p $TEMPDIR |
---|
2079 | chmod go+rx $TEMPDIR |
---|
2080 | tmpcreate=true |
---|
2081 | |
---|
2082 | |
---|
2083 | # SAEMTLICHE QUELLTEXT-DATEIEN BZW. AUSFUEHRBARES PROGRAMM IN |
---|
2084 | # TEMPORAERES VERZEICHNIS KOPIEREN |
---|
2085 | if [[ $do_compile = true ]] |
---|
2086 | then |
---|
2087 | |
---|
2088 | # ON NEC, COMPILATION IS DONE ON HOST CROSS VIA CROSS COMPILING |
---|
2089 | # CREATE A TEMPORARY DIRECTORY ON THAT MACHINE (HOME MOUNTED VIA NFS) |
---|
2090 | if [[ $localhost = nech ]] |
---|
2091 | then |
---|
2092 | TEMPDIR_COMPILE=$HOME/work/${usern}.$kennung |
---|
2093 | if mkdir -p $TEMPDIR_COMPILE |
---|
2094 | then |
---|
2095 | printf "\n *** \"$TEMPDIR_COMPILE\" " |
---|
2096 | printf "\n is generated as temporary directory for cross compiling\n" |
---|
2097 | else |
---|
2098 | printf "\n +++ creating directory \"$TEMPDIR_COMPILE\" " |
---|
2099 | printf "\n needed for cross compilation failed" |
---|
2100 | locat=compile |
---|
2101 | exit |
---|
2102 | fi |
---|
2103 | else |
---|
2104 | TEMPDIR_COMPILE=$TEMPDIR |
---|
2105 | fi |
---|
2106 | |
---|
2107 | if [[ "$use_makefile" = true ]] |
---|
2108 | then |
---|
2109 | |
---|
2110 | # PFADNAMEN FUER DAS MAKE-DEPOSITORY ERMITTELN |
---|
2111 | line="" |
---|
2112 | grep "%depository_path" $config_file | while read line |
---|
2113 | do |
---|
2114 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
2115 | then |
---|
2116 | if [[ "$(echo $line | cut -d" " -s -f3)" = "" ]] |
---|
2117 | then |
---|
2118 | global_depository_path=`echo $line | cut -d" " -s -f2` |
---|
2119 | fi |
---|
2120 | fi |
---|
2121 | done |
---|
2122 | |
---|
2123 | line="" |
---|
2124 | grep " $localhost" $config_file | grep "%depository_path" | while read line |
---|
2125 | do |
---|
2126 | if [[ "$line" != "" && $(echo $line | cut -c1) != "#" ]] |
---|
2127 | then |
---|
2128 | local_depository_path=`echo $line | cut -d" " -s -f2` |
---|
2129 | fi |
---|
2130 | done |
---|
2131 | |
---|
2132 | if [[ "$local_depository_path" = "" ]] |
---|
2133 | then |
---|
2134 | if [[ "$global_depository_path" != "" ]] |
---|
2135 | then |
---|
2136 | local_depository_path=$global_depository_path |
---|
2137 | else |
---|
2138 | printf "\n\n +++ no depository path found in configuration file" |
---|
2139 | printf "\n for local host \"$localhost\" " |
---|
2140 | printf "\n please set \"\%depository_path\" in configuration file\n" |
---|
2141 | locat=config_file; exit |
---|
2142 | fi |
---|
2143 | fi |
---|
2144 | eval local_depository_path=$local_depository_path |
---|
2145 | |
---|
2146 | basename=`print $mainprog | cut -f1 -d"."` |
---|
2147 | eval make_depository=${local_depository_path}/${basename}_current_version.tar |
---|
2148 | if [[ ! -f $make_depository ]] |
---|
2149 | then |
---|
2150 | printf "\n" |
---|
2151 | printf "\n *** WARNING: make depository \"$make_depository\" not found" |
---|
2152 | printf "\n \"make\" will fail, if the Makefile or other source files are missing\n" |
---|
2153 | else |
---|
2154 | cp $make_depository $TEMPDIR_COMPILE |
---|
2155 | cd $TEMPDIR_COMPILE |
---|
2156 | tar -xf $make_depository > /dev/null |
---|
2157 | cd - > /dev/null |
---|
2158 | fi |
---|
2159 | |
---|
2160 | cp SOURCES_FOR_RUN_$fname/* $TEMPDIR_COMPILE |
---|
2161 | |
---|
2162 | # FALLS USER-INTERFACE VORHANDEN UND AUF DATEI MIT ANDEREM NAMEN |
---|
2163 | # ALS user_interface.f90 LIEGT, DIESEN GEAENDERTEN NAMEN INS |
---|
2164 | # MAKEFILE EINTRAGEN |
---|
2165 | cd $TEMPDIR_COMPILE |
---|
2166 | interface_file=`grep -l "END SUBROUTINE user_parin" $source_list` |
---|
2167 | if [[ "$interface_file" != "" ]] |
---|
2168 | then |
---|
2169 | interface_file=`echo $interface_file | cut -d"." -f1` |
---|
2170 | mv Makefile Makefile_old |
---|
2171 | sed "s/user_interface/$interface_file/g" Makefile_old > Makefile |
---|
2172 | fi |
---|
2173 | cd - > /dev/null |
---|
2174 | fi |
---|
2175 | else |
---|
2176 | cp $executable ${TEMPDIR}/a.out |
---|
2177 | fi |
---|
2178 | |
---|
2179 | |
---|
2180 | # WECHSEL IN TEMPORAEREN KATALOG |
---|
2181 | cd $TEMPDIR |
---|
2182 | printf "\n *** changed to temporary directory: $TEMPDIR" |
---|
2183 | |
---|
2184 | |
---|
2185 | # OUTPUT-DATEI-VERBINDUNGEN AUF TEMPORAERER DATEI ABLEGEN |
---|
2186 | # DIESE DATEI KANN VON SPAETER AUFZURUFENDEN BENUTZERPROZEDUREN GELESEN |
---|
2187 | # WERDEN, UM ZU LOKALEN DATEINAMEN GEHOERENDE PERMANENTE NAMEN ZU |
---|
2188 | # ERMITTELN |
---|
2189 | (( i = 0 )) |
---|
2190 | while (( i < iout )) |
---|
2191 | do |
---|
2192 | (( i = i + 1 )) |
---|
2193 | if [[ "${actionout[$i]}" = tr || "${actionout[$i]}" = tra || "${actionout[$i]}" = trpe ]] |
---|
2194 | then |
---|
2195 | printf "${localout[$i]} ${actionout[$i]}\n${pathout[$i]}\n${localhost}_${fname}${endout[$i]}\n" >> OUTPUT_FILE_CONNECTIONS |
---|
2196 | else |
---|
2197 | printf "${localout[$i]} ${actionout[$i]}\n${pathout[$i]}\n${frelout[$i]}\n" >> OUTPUT_FILE_CONNECTIONS |
---|
2198 | fi |
---|
2199 | done |
---|
2200 | |
---|
2201 | |
---|
2202 | # EVTL. UEBERSETZUNGSAKTIONEN STARTEN |
---|
2203 | if [[ $do_compile = true ]] |
---|
2204 | then |
---|
2205 | |
---|
2206 | |
---|
2207 | # COMPILING WITH MAKE (ON NEC COMPILER IS CALLED ON HOST CROSS) |
---|
2208 | if [[ "$use_makefile" = true ]] |
---|
2209 | then |
---|
2210 | printf "\n\n\n *** compilation starts \n$striche\n" |
---|
2211 | printf " *** compilation with make using following options:\n" |
---|
2212 | printf " compilername: $compiler_name\n" |
---|
2213 | printf " options: $FOPTS\n" |
---|
2214 | printf " preprocessor-directives: $C_PPOPTS \n" |
---|
2215 | printf " linker-options: $LOPTS \n" |
---|
2216 | printf " source code files: $source_list \n" |
---|
2217 | |
---|
2218 | if [[ $localhost = nech ]] |
---|
2219 | then |
---|
2220 | ssh 136.172.44.192 -l $usern ". /SX/opt/etc/initsx.sh; cd \$HOME/work/${usern}.$kennung; sxmake -f Makefile PROG=a.out F90=$compiler_name COPT=\"$C_PPOPTS\" F90FLAGS=\"$FOPTS\" LDFLAGS=\"$LOPTS\" " |
---|
2221 | cp $TEMPDIR_COMPILE/a.out . |
---|
2222 | [[ $? != 0 ]] && compile_error=true |
---|
2223 | rm -rf $TEMPDIR_COMPILE |
---|
2224 | else |
---|
2225 | make -f Makefile PROG=a.out F90=$compiler_name COPT="$C_PPOPTS" F90FLAGS="$FOPTS" LDFLAGS="$LOPTS" |
---|
2226 | fi |
---|
2227 | |
---|
2228 | # UEBERSETZUNG "VON HAND" (OHNE MAKE) |
---|
2229 | else |
---|
2230 | |
---|
2231 | # HPMUK EVTL. PRAEPROZESSOR LAUFEN LASSEN |
---|
2232 | if [[ $localhost = hpmuk ]] |
---|
2233 | then |
---|
2234 | (( i = 0 )) |
---|
2235 | new_source_list="" |
---|
2236 | for filename in $source_list |
---|
2237 | do |
---|
2238 | basename=`print $filename | cut -f1 -d"."` |
---|
2239 | extension=`print $filename | cut -f2 -d"."` |
---|
2240 | if [[ $extension = F && $localhost != hpmuk ]] |
---|
2241 | then |
---|
2242 | (( i = i + 1 )) |
---|
2243 | if (( i == 1 )) |
---|
2244 | then |
---|
2245 | printf "\n\n *** preprocessor-calls:\n$striche" |
---|
2246 | fi |
---|
2247 | printf "\n $praeproc $PPOPTS -P $filename > ${basename}.f 2> /dev/null" |
---|
2248 | $praeproc $PPOPTS -P $filename > ${basename}.f 2> /dev/null |
---|
2249 | new_source_list="$new_source_list "${basename}.f |
---|
2250 | elif [[ $extension = f90 ]] |
---|
2251 | then |
---|
2252 | (( i = i + 1 )) |
---|
2253 | if (( i == 1 )) |
---|
2254 | then |
---|
2255 | printf "\n\n *** preprocessor-calls:\n$striche" |
---|
2256 | fi |
---|
2257 | mv $filename ${basename}.F90 |
---|
2258 | printf "\n $praeproc $PPOPTS -C -P ${basename}.F90 > $filename 2> /dev/null" |
---|
2259 | $praeproc $PPOPTS -C -P ${basename}.F90 > $filename 2> /dev/null |
---|
2260 | new_source_list="$new_source_list "$filename |
---|
2261 | rm -f ${basename}.F90 |
---|
2262 | else |
---|
2263 | new_source_list="$new_source_list "$filename |
---|
2264 | fi |
---|
2265 | done |
---|
2266 | source_list="$new_source_list" |
---|
2267 | if (( i != 0 )) |
---|
2268 | then |
---|
2269 | printf "\n$striche\n *** preprocessor-calls finished\n" |
---|
2270 | fi |
---|
2271 | fi |
---|
2272 | |
---|
2273 | |
---|
2274 | # UEBERSETZUNG DER QUELLTEXT-DATEIEN UND DES HAUPTPROGRAMMS |
---|
2275 | # $CPPOPTS FUER CPP-PRAEPROZESSOR WURDEN OBEN BESTIMMT |
---|
2276 | printf "\n\n\n *** compilation starts \n$striche\n" |
---|
2277 | |
---|
2278 | |
---|
2279 | # VORWEG EVTL. UEBERSETZUNG VON PROGRAMMTEILEN MIT SPEZIELLEN |
---|
2280 | # COMPILERN UND/ODER COMPILEROPTIONEN. DIESE WERDEN BEI DER SPAETEREN |
---|
2281 | # EIGENTLICHEN UEBERSETZUNG ALS OBJECT-FILES EINGEBUNDEN |
---|
2282 | new_source_list="" |
---|
2283 | for filename in $source_list |
---|
2284 | do |
---|
2285 | |
---|
2286 | basename=`print $filename | cut -f1 -d"."` |
---|
2287 | |
---|
2288 | # EVTL. SPEZIELLEN COMPILER FUER UP BESTIMMEN |
---|
2289 | comp_var=$(eval echo \$comp_$basename) # \$ liefert evtl. fuer source alternativ vereinbarten Compiler |
---|
2290 | comp_opt_var=$(eval echo \$$basename) # \$$ liefert evtl. fuer source vereinbarte Compiler-Environment-Variable |
---|
2291 | |
---|
2292 | if [[ "$comp_var" = "" && "$comp_opt_var" = "" ]] |
---|
2293 | then |
---|
2294 | new_source_list="$new_source_list "$filename |
---|
2295 | else |
---|
2296 | |
---|
2297 | if [[ "$comp_var" = "" ]] |
---|
2298 | then |
---|
2299 | SPECIAL_COMPILER=$compiler_name |
---|
2300 | else |
---|
2301 | SPECIAL_COMPILER=$comp_var |
---|
2302 | fi |
---|
2303 | |
---|
2304 | if [[ "$comp_opt_var" = "" ]] |
---|
2305 | then |
---|
2306 | SPECIAL_FOPTS=$FOPTS |
---|
2307 | else |
---|
2308 | SPECIAL_FOPTS="$parallel_options $(eval echo \$$comp_opt_var)" |
---|
2309 | fi |
---|
2310 | |
---|
2311 | printf " *** compiling of $filename with special compiler call: $SPECIAL_COMPILER $CPPOPTS -c $SPECIAL_FOPTS \n" |
---|
2312 | $SPECIAL_COMPILER $C_PPOPTS -c $SPECIAL_FOPTS $MODULE_OPTIONS $filename |
---|
2313 | if [[ $? != 0 ]] |
---|
2314 | then |
---|
2315 | printf "\n +++ compiling error occured" |
---|
2316 | locat=compile |
---|
2317 | exit |
---|
2318 | fi |
---|
2319 | new_source_list="$new_source_list "${basename}.o |
---|
2320 | fi |
---|
2321 | done |
---|
2322 | source_list="$new_source_list" |
---|
2323 | |
---|
2324 | |
---|
2325 | # EIGENTLICHE UEBERSETZUNG MIT DEN NORMALEN OPTIONEN |
---|
2326 | printf " *** compilation with standard options: $compiler_name $FOPTS $MODULE_OPTIONS \n" |
---|
2327 | printf " preprocessor-directives: $C_PPOPTS \n" |
---|
2328 | printf " linker-options: $LOPTS \n" |
---|
2329 | printf " source code files: $source_list \n" |
---|
2330 | if [[ $localhost = hpmuk ]] |
---|
2331 | then |
---|
2332 | if [[ $localhost_realname = caurus ]] |
---|
2333 | then |
---|
2334 | $compiler_name $C_PPOPTS $FOPTS $MODULE_OPTIONS $source_list $LOPTS |
---|
2335 | else |
---|
2336 | remsh caurus "export PATH=/opt/fortran90/bin:$PATH; cd `pwd`; $compiler_name $C_PPOPTS $FOPTS $MODULE_OPTIONS $source_list $LOPTS" |
---|
2337 | fi |
---|
2338 | else |
---|
2339 | $compiler_name $C_PPOPTS $FOPTS $MODULE_OPTIONS $LOPTS $source_list |
---|
2340 | fi |
---|
2341 | fi |
---|
2342 | if [[ $? != 0 || "$compile_error" = true || "$module_compile_error" = true ]] |
---|
2343 | then |
---|
2344 | printf "\n +++ error occured while compiling or linking" |
---|
2345 | locat=compile |
---|
2346 | exit |
---|
2347 | else |
---|
2348 | printf "$striche\n *** compilation finished \n" |
---|
2349 | fi |
---|
2350 | fi |
---|
2351 | |
---|
2352 | |
---|
2353 | # FALLS NUR TESTWEISE KOMPILIERT WERDEN SOLLTE, IST MRUN JETZT FERTIG |
---|
2354 | if [[ $local_compile = true ]] |
---|
2355 | then |
---|
2356 | cd $HOME |
---|
2357 | rm -rf $TEMPDIR |
---|
2358 | locat=local_compile; exit |
---|
2359 | fi |
---|
2360 | |
---|
2361 | |
---|
2362 | # BEREITSTELLEN DER INPUT-DATEIEN |
---|
2363 | # SCHLEIFE UEBER ALLE VOM BENUTZER ANGEGEBENEN DATEIEN |
---|
2364 | (( i = 0 )) |
---|
2365 | while (( i < iin )) |
---|
2366 | do |
---|
2367 | (( i = i + 1 )) |
---|
2368 | if (( i == 1 )) |
---|
2369 | then |
---|
2370 | printf "\n\n *** providing INPUT-files:\n$striche" |
---|
2371 | fi |
---|
2372 | |
---|
2373 | |
---|
2374 | # OPTIONALE DATEIEN BEI NICHTVORHANDENSEIN UEBERGEHEN |
---|
2375 | if [[ "${transin[$i]}" = unavailable ]] |
---|
2376 | then |
---|
2377 | if [[ "${extin[$i]}" = "" || "${extin[$i]}" = " " ]] |
---|
2378 | then |
---|
2379 | printf "\n +++ WARNING: input file \"${pathin[$i]}/${afname}${endin[$i]}\" " |
---|
2380 | printf "\n is not available!" |
---|
2381 | else |
---|
2382 | printf "\n +++ WARNING: input file \"${pathin[$i]}/${afname}${endin[$i]}.${extin[$i]}\" " |
---|
2383 | printf "\n is not available!" |
---|
2384 | fi |
---|
2385 | continue |
---|
2386 | fi |
---|
2387 | |
---|
2388 | # PRUEFEN, OB EINZELDATEI ODER DATEI PRO PROZESSOR |
---|
2389 | files_for_pes=false; datentyp=file |
---|
2390 | if [[ "${actionin[$i]}" = pe && -n $numprocs ]] |
---|
2391 | then |
---|
2392 | files_for_pes=true; datentyp=directory |
---|
2393 | actionin[$i]="" |
---|
2394 | elif [[ "${actionin[$i]}" = pe && ! -n $numprocs ]] |
---|
2395 | then |
---|
2396 | actionin[$i]="" |
---|
2397 | elif [[ "${actionin[$i]}" = arpe && -n $numprocs ]] |
---|
2398 | then |
---|
2399 | files_for_pes=true; datentyp=directory |
---|
2400 | actionin[$i]="ar" |
---|
2401 | elif [[ "${actionin[$i]}" = arpe && ! -n $numprocs ]] |
---|
2402 | then |
---|
2403 | actionin[$i]="ar" |
---|
2404 | elif [[ "${actionin[$i]}" = flpe && -n $numprocs ]] |
---|
2405 | then |
---|
2406 | files_for_pes=true; datentyp=directory |
---|
2407 | actionin[$i]="fl" |
---|
2408 | elif [[ "${actionin[$i]}" = flpe && ! -n $numprocs ]] |
---|
2409 | then |
---|
2410 | actionin[$i]="fl" |
---|
2411 | fi |
---|
2412 | |
---|
2413 | if [[ $files_for_pes = true ]] |
---|
2414 | then |
---|
2415 | printf "\n >>> INPUT: ${absnamein[$i]}/.... to ${localin[$i]}" |
---|
2416 | else |
---|
2417 | printf "\n >>> INPUT: ${absnamein[$i]} to ${localin[$i]}" |
---|
2418 | fi |
---|
2419 | |
---|
2420 | # INPUT-DATEI FUER EINEN FORTSETZUNGSLAUF. ES WIRD GEPRUEFT, |
---|
2421 | # OB DIESE DATEI NOCH AUF DEM TEMPORAEREN DATENKATALOG VORHANDEN |
---|
2422 | # IST. FALLS NICHT, WIRD VERSUCHT, SIE ANSCHLIESSEND VOM ARCHIV- |
---|
2423 | # SERVER ZU HOLEN |
---|
2424 | if [[ "${actionin[$i]}" = fl ]] |
---|
2425 | then |
---|
2426 | printf "\n $datentyp will be fetched from temporary directory \"${tmp_data_catalog}\" !" |
---|
2427 | if [[ $files_for_pes = false ]] |
---|
2428 | then |
---|
2429 | if [[ -f "$tmp_data_catalog/${frelin[$i]}" ]] |
---|
2430 | then |
---|
2431 | ln $tmp_data_catalog/${frelin[$i]} ${localin[$i]} |
---|
2432 | got_tmp[$i]=true |
---|
2433 | elif [[ -f "$WORK/${frelin[$i]}" && $ignore_archive_error = true ]] |
---|
2434 | then |
---|
2435 | printf "\n +++ $datentyp not found in \"$tmp_data_catalog\" !" |
---|
2436 | printf "\n *** trying to use backup copy in \"$WORK\" " |
---|
2437 | cp $WORK/${frelin[$i]} ${localin[$i]} |
---|
2438 | else |
---|
2439 | printf "\n +++ $datentyp not found in \"$tmp_data_catalog\" " |
---|
2440 | printf "\n or \"$tmp_data_catalog\" does not exist!" |
---|
2441 | printf "\n *** trying to get copy from archive" |
---|
2442 | actionin[$i]=ar |
---|
2443 | fi |
---|
2444 | else |
---|
2445 | if [[ -d "$tmp_data_catalog/${frelin[$i]}" ]] |
---|
2446 | then |
---|
2447 | mkdir ${localin[$i]} |
---|
2448 | ln $tmp_data_catalog/${frelin[$i]}/* ${localin[$i]} |
---|
2449 | got_tmp[$i]=true |
---|
2450 | elif [[ -d "$WORK/${frelin[$i]}" && $ignore_archive_error = true ]] |
---|
2451 | then |
---|
2452 | printf "\n +++ $datentyp not found in \"$tmp_data_catalog\" !" |
---|
2453 | printf "\n *** trying to use backup copy in \"$WORK\" " |
---|
2454 | cp -r $WORK/${frelin[$i]} ${localin[$i]} |
---|
2455 | else |
---|
2456 | printf "\n +++ $datentyp not found in \"$tmp_data_catalog\" " |
---|
2457 | printf "\n or \"$tmp_data_catalog\" does not exist!" |
---|
2458 | printf "\n *** trying to get copy from archive" |
---|
2459 | actionin[$i]=ar |
---|
2460 | fi |
---|
2461 | fi |
---|
2462 | fi |
---|
2463 | |
---|
2464 | |
---|
2465 | # DATEI LIEGT AUF ARCHIV-SERVER |
---|
2466 | if [[ "${actionin[$i]}" = ar ]] |
---|
2467 | then |
---|
2468 | |
---|
2469 | if [[ $files_for_pes = false ]] |
---|
2470 | then |
---|
2471 | printf "\n file will be restored from archive-system ($archive_system)!" |
---|
2472 | else |
---|
2473 | printf "\n directory will be restored from archive-system ($archive_system)!" |
---|
2474 | fi |
---|
2475 | |
---|
2476 | file_restored=false |
---|
2477 | |
---|
2478 | if [[ $archive_system = asterix ]] |
---|
2479 | then |
---|
2480 | do_stagein=true |
---|
2481 | (( stagein_anz = 0 )) |
---|
2482 | while [[ $do_stagein = true ]] |
---|
2483 | do |
---|
2484 | if [[ $files_for_pes = false ]] |
---|
2485 | then |
---|
2486 | stagein -O ${frelin[$i]} > STAGEIN_OUTPUT |
---|
2487 | else |
---|
2488 | stagein -t -O ${frelin[$i]} > STAGEIN_OUTPUT |
---|
2489 | fi |
---|
2490 | cat STAGEIN_OUTPUT |
---|
2491 | if [[ $(grep -c "st.msg:i24" STAGEIN_OUTPUT) != 0 ]] |
---|
2492 | then |
---|
2493 | file_restored=true |
---|
2494 | do_stagein=false |
---|
2495 | else |
---|
2496 | (( stagein_anz = stagein_anz + 1 )) |
---|
2497 | if (( stagein_anz == 10 )) |
---|
2498 | then |
---|
2499 | printf "\n +++ stagein stoped after 10 tries" |
---|
2500 | locat=stage |
---|
2501 | exit |
---|
2502 | fi |
---|
2503 | printf "\n +++ restoring from archive failed, trying again:" |
---|
2504 | sleep 900 |
---|
2505 | fi |
---|
2506 | done |
---|
2507 | elif [[ $archive_system = DMF ]] |
---|
2508 | then |
---|
2509 | if [[ $files_for_pes = false ]] |
---|
2510 | then |
---|
2511 | printf "\n +++ restoring of single files impossible with $archive_system !\n" |
---|
2512 | locat=DMF |
---|
2513 | exit |
---|
2514 | else |
---|
2515 | find $ARCHIVE/${frelin[$i]} -type m -print | dmget |
---|
2516 | cp -r $ARCHIVE/${frelin[$i]} $PWD |
---|
2517 | file_restored=true |
---|
2518 | fi |
---|
2519 | elif [[ $archive_system = tivoli ]] |
---|
2520 | then |
---|
2521 | if [[ $files_for_pes = false ]] |
---|
2522 | then |
---|
2523 | if [[ $localhost = ibmh ]] |
---|
2524 | then |
---|
2525 | ssh $usern@hdata.hlrn.de "cp $PERM/${frelin[$i]} $PWD" |
---|
2526 | else |
---|
2527 | ssh $usern@bdata.hlrn.de "cp $PERM/${frelin[$i]} $PWD" |
---|
2528 | fi |
---|
2529 | else |
---|
2530 | (( inode = 0 )) |
---|
2531 | while (( inode < nodes )) |
---|
2532 | do |
---|
2533 | if [[ $localhost = ibmh ]] |
---|
2534 | then |
---|
2535 | ssh $usern@hdata.hlrn.de "cd $PWD; tar xf $PERM/${frelin[$i]}/${frelin[$i]}.node_$inode.tar" |
---|
2536 | else |
---|
2537 | ssh $usern@bdata.hlrn.de "cd $PWD; tar xf $PERM/${frelin[$i]}/${frelin[$i]}.node_$inode.tar" |
---|
2538 | fi |
---|
2539 | (( inode = inode + 1 )) |
---|
2540 | done |
---|
2541 | fi |
---|
2542 | file_restored=true |
---|
2543 | elif [[ $archive_system = ut ]] |
---|
2544 | then |
---|
2545 | if [[ $files_for_pes = false ]] |
---|
2546 | then |
---|
2547 | cp $UT/${frelin[$i]} . |
---|
2548 | else |
---|
2549 | (( inode = 0 )) |
---|
2550 | while (( inode < nodes )) |
---|
2551 | do |
---|
2552 | tar xf $UT/${frelin[$i]}/${frelin[$i]}.node_$inode.tar |
---|
2553 | (( inode = inode + 1 )) |
---|
2554 | done |
---|
2555 | fi |
---|
2556 | file_restored=true |
---|
2557 | else |
---|
2558 | printf "\n +++ archive_system=\"$archive_system\" restore impossible!" |
---|
2559 | locat=rearchive |
---|
2560 | exit |
---|
2561 | fi |
---|
2562 | |
---|
2563 | if [[ $file_restored = true ]] |
---|
2564 | then |
---|
2565 | |
---|
2566 | # DATEI AUCH AUF TEMPORAERES DATENVERZEICHNIS LEGEN, DAMIT |
---|
2567 | # SIE BEI WEITEREN ZUGRIFFEN NOCH VORHANDEN IST |
---|
2568 | [[ ! -d $tmp_data_catalog ]] && mkdir -p $tmp_data_catalog; chmod g+rx $tmp_data_catalog |
---|
2569 | if [[ $files_for_pes = false ]] |
---|
2570 | then |
---|
2571 | ln -f ${frelin[$i]} $tmp_data_catalog/${frelin[$i]} |
---|
2572 | else |
---|
2573 | mkdir $tmp_data_catalog/${frelin[$i]} |
---|
2574 | ln -f ${frelin[$i]}/* $tmp_data_catalog/${frelin[$i]} |
---|
2575 | fi |
---|
2576 | got_tmp[$i]=true |
---|
2577 | |
---|
2578 | # DATEI UNTER LOKALEM NAMEN ZUR VERFUEGUNG STELLEN |
---|
2579 | mv ${frelin[$i]} ${localin[$i]} |
---|
2580 | |
---|
2581 | fi |
---|
2582 | fi |
---|
2583 | |
---|
2584 | |
---|
2585 | # DATEI LIEGT IM VOM BENUTZER ANGEGEBENEN VERZEICHNIS |
---|
2586 | if [[ "${actionin[$i]}" = "" || "${actionin[$i]}" = "di" || "${actionin[$i]}" = "npe" ]] |
---|
2587 | then |
---|
2588 | |
---|
2589 | if [[ "${actionin[$i]}" = "npe" && -n $numprocs ]] |
---|
2590 | then |
---|
2591 | |
---|
2592 | # DATEI WIRD FUER DIE PROZESSOREN EINES PARALLERECHNERS BEREITGESTELLT |
---|
2593 | printf "\n file will be provided for $numprocs processors" |
---|
2594 | mkdir ${localin[$i]} |
---|
2595 | ival=$numprocs |
---|
2596 | (( ii = 0 )) |
---|
2597 | while (( ii <= ival-1 )) |
---|
2598 | do |
---|
2599 | if (( ii < 10 )) |
---|
2600 | then |
---|
2601 | cp ${absnamein[$i]} ${localin[$i]}/_000$ii |
---|
2602 | elif (( ii < 100 )) |
---|
2603 | then |
---|
2604 | cp ${absnamein[$i]} ${localin[$i]}/_00$ii |
---|
2605 | elif (( ii < 1000 )) |
---|
2606 | then |
---|
2607 | cp ${absnamein[$i]} ${localin[$i]}/_0$ii |
---|
2608 | else |
---|
2609 | cp ${absnamein[$i]} ${localin[$i]}/_$ii |
---|
2610 | fi |
---|
2611 | (( ii = ii + 1 )) |
---|
2612 | done |
---|
2613 | |
---|
2614 | else |
---|
2615 | |
---|
2616 | if [[ $files_for_pes = true ]] |
---|
2617 | then |
---|
2618 | |
---|
2619 | # DIE DEN PROZESSOREN EINES PARALLELRECHNERS ZUGEHOERIGEN |
---|
2620 | # DATEIEN WERDEN BEREITGESTELLT, INDEM ZUERST DER GESAMTE |
---|
2621 | # KATALOGINHALT KOPIERT UND DANN DIE EINZELNEN DATEIEN |
---|
2622 | # PER MOVE UMBENANNT WERDEN |
---|
2623 | printf "\n providing $numprocs files for the respective processors" |
---|
2624 | mkdir ${localin[$i]} |
---|
2625 | cp -r ${absnamein[$i]}/* ${localin[$i]} |
---|
2626 | |
---|
2627 | else |
---|
2628 | # BEREITSTELLUNG AUF EINPROZESSORRECHNERN |
---|
2629 | cp ${absnamein[$i]} ${localin[$i]} |
---|
2630 | fi |
---|
2631 | fi |
---|
2632 | fi |
---|
2633 | |
---|
2634 | done |
---|
2635 | if (( i != 0 )) |
---|
2636 | then |
---|
2637 | printf "\n$striche\n *** all INPUT-files provided \n" |
---|
2638 | fi |
---|
2639 | |
---|
2640 | |
---|
2641 | # NAMELIST-DATEI MIT WERTEN VON ENVIRONMENT-VARIABLEN ERZEUGEN (ZU |
---|
2642 | # LESEN VON PALM) |
---|
2643 | cat > ENVPAR << %%END%% |
---|
2644 | &envpar run_identifier = '$fname', host = '$localhost', |
---|
2645 | write_binary = '$write_binary', tasks_per_node = $tasks_per_node, |
---|
2646 | maximum_cpu_time_allowed = ${cpumax}. / |
---|
2647 | |
---|
2648 | %%END%% |
---|
2649 | |
---|
2650 | |
---|
2651 | # EVENTUELLE INPUT-KOMMANDOS ABARBEITEN |
---|
2652 | (( i = 0 )) |
---|
2653 | while (( i < iic )) |
---|
2654 | do |
---|
2655 | (( i = i + 1 )) |
---|
2656 | if (( i == 1 )) |
---|
2657 | then |
---|
2658 | printf "\n\n *** execution of INPUT-commands:\n$striche" |
---|
2659 | fi |
---|
2660 | printf "\n >>> ${in_command[$i]}" |
---|
2661 | eval ${in_command[$i]} |
---|
2662 | if (( i == iic )) |
---|
2663 | then |
---|
2664 | printf "\n$striche\n" |
---|
2665 | fi |
---|
2666 | done |
---|
2667 | |
---|
2668 | |
---|
2669 | # VERBLEIBENDE CPU-ZEIT BERECHNEN |
---|
2670 | cpurest=${cpumax}. |
---|
2671 | |
---|
2672 | |
---|
2673 | # PROGRAMMSTART |
---|
2674 | printf "\n\n *** execution starts in directory\n \"`pwd`\"\n$striche\n" |
---|
2675 | PATH=$PATH:$TEMPDIR |
---|
2676 | |
---|
2677 | if [[ "$cond1" = debug || "$cond2" = debug ]] |
---|
2678 | then |
---|
2679 | if [[ "$ENVIRONMENT" = BATCH ]] |
---|
2680 | then |
---|
2681 | printf "\n +++ debug is allowed in interactive mode only" |
---|
2682 | locat=debug |
---|
2683 | exit |
---|
2684 | fi |
---|
2685 | if [[ $localhost = hpmuk ]] |
---|
2686 | then |
---|
2687 | echo "property sdir .,${source_path}, ${add_source_path}" > .dderc |
---|
2688 | dde a.out |
---|
2689 | elif [[ $localhost = decalpha ]] |
---|
2690 | then |
---|
2691 | dxladebug a.out |
---|
2692 | elif [[ $localhost = ibmb || $localhost = ibmh ]] |
---|
2693 | then |
---|
2694 | |
---|
2695 | # SETUP THE IBM MPI ENVIRONMENT |
---|
2696 | export MP_SHARED_MEMORY=yes |
---|
2697 | export AIXTHREADS_SCOPE=S |
---|
2698 | export OMP_NUM_THREADS=$threads_per_task |
---|
2699 | export AUTHSTATE=files |
---|
2700 | export XLFRTEOPTS="nlwidth=132:err_recovery=no" # RECORD-LENGTH OF NAMELIST-OUTPUT |
---|
2701 | |
---|
2702 | # FOLLOWING OPTIONS ARE MANDATORY FOR TOTALVIEW |
---|
2703 | export MP_ADAPTER_USE=shared |
---|
2704 | export MP_CPU_USE=multiple |
---|
2705 | export MP_TIMEOUT=1200 |
---|
2706 | |
---|
2707 | unset MP_TASK_AFFINITY |
---|
2708 | |
---|
2709 | # SO FAR, TOTALVIEW NEEDS HOSTFILE MECHANISM FOR EXECUTION |
---|
2710 | #(( ii = 1 )) |
---|
2711 | #while (( ii <= $numprocs )) |
---|
2712 | #do |
---|
2713 | # echo $localhost_realname >> hostfile |
---|
2714 | # (( ii = ii + 1 )) |
---|
2715 | #done |
---|
2716 | #export MP_HOSTFILE=hostfile |
---|
2717 | |
---|
2718 | if [[ "$LOADLBATCH" = yes ]] |
---|
2719 | then |
---|
2720 | totalview poe a.out $ROPTS |
---|
2721 | else |
---|
2722 | echo totalview poe -a a.out -procs $numprocs -rmpool 0 -nodes 1 $ROPTS |
---|
2723 | export TVDSVRLAUNCHCMD=ssh |
---|
2724 | totalview poe -a a.out -procs $numprocs -rmpool 0 -nodes 1 $ROPTS |
---|
2725 | fi |
---|
2726 | else |
---|
2727 | printf "\n +++ no debug available on \"$localhost\" " |
---|
2728 | printf "\n or not implemented in mrun so far" |
---|
2729 | locat=debug |
---|
2730 | exit |
---|
2731 | fi |
---|
2732 | else |
---|
2733 | if [[ -n $numprocs ]] |
---|
2734 | then |
---|
2735 | |
---|
2736 | # RUNNING THE PROGRAM ON PARALLEL MACHINES |
---|
2737 | if [[ $(echo $host | cut -c1-3) = ibm ]] |
---|
2738 | then |
---|
2739 | # SETUP THE IBM MPI ENVIRONMENT |
---|
2740 | export MP_SHARED_MEMORY=yes |
---|
2741 | export AIXTHREAD_SCOPE=S |
---|
2742 | export OMP_NUM_THREADS=$threads_per_task |
---|
2743 | export XLSMPOPTS="spins=0:yields=0:stack=20000000" |
---|
2744 | export AUTHSTATE=files |
---|
2745 | export XLFRTEOPTS="nlwidth=132:err_recovery=no" # RECORD-LENGTH OF NAMELIST-OUTPUT |
---|
2746 | # export MP_PRINTENV=yes |
---|
2747 | |
---|
2748 | # TUNING-VARIABLEN ZUR VERBESSERUNG DER KOMMUNIKATION |
---|
2749 | # ZEIGEN ABER DERZEIT (SEP 04, FEDERATION) KAUM WIRKUNG |
---|
2750 | export MP_WAIT_MODE=poll |
---|
2751 | [[ $node_usage = not_shared ]] && export MP_SINGLE_THREAD=yes |
---|
2752 | # export MP_EAGER_LIMIT=65535 |
---|
2753 | |
---|
2754 | # # TESTWEISE FUER TURBOMPI (JAN 05) |
---|
2755 | # export MPJ_MTAB=128 |
---|
2756 | # export MPJ_ALLTOALL=1 |
---|
2757 | # export MPJ_ALLTOALLV=1 |
---|
2758 | |
---|
2759 | if [[ "$LOADLBATCH" = yes ]] |
---|
2760 | then |
---|
2761 | printf "\n--- Control: OMP_NUM_THREADS = \"$OMP_NUM_THREADS\" \n" |
---|
2762 | if [[ "$cond1" = hpmcount || "$cond2" = hpmcount ]] |
---|
2763 | then |
---|
2764 | /opt/optibm/HPM_2_4_1/bin/hpmcount a.out $ROPTS > aout_output 2>&1 |
---|
2765 | else |
---|
2766 | poe ./a.out $ROPTS > aout_output 2>&1 |
---|
2767 | fi |
---|
2768 | else |
---|
2769 | if [[ $localhost = ibmb || $localhost = ibmh || $localhost = ibms ]] |
---|
2770 | then |
---|
2771 | poe a.out -procs $numprocs -nodes 1 -rmpool 0 $ROPTS > aout_output 2>&1 |
---|
2772 | elif [[ $localhost = ibmy ]] |
---|
2773 | then |
---|
2774 | if [[ -f $hostfile ]] |
---|
2775 | then |
---|
2776 | cp $hostfile hostfile |
---|
2777 | else |
---|
2778 | (( ii = 1 )) |
---|
2779 | while (( ii <= $numprocs )) |
---|
2780 | do |
---|
2781 | echo $localhost_realname >> hostfile |
---|
2782 | (( ii = ii + 1 )) |
---|
2783 | done |
---|
2784 | fi |
---|
2785 | export MP_HOSTFILE=hostfile |
---|
2786 | ./a.out -procs $tasks_per_node $ROPTS > aout_output 2>&1 |
---|
2787 | else |
---|
2788 | if [[ "$host_file" = "" ]] |
---|
2789 | then |
---|
2790 | printf "\n +++ no hostfile given in configuration file" |
---|
2791 | locat=config_file |
---|
2792 | exit |
---|
2793 | else |
---|
2794 | eval host_file=$host_file |
---|
2795 | fi |
---|
2796 | export MP_HOSTFILE=$host_file |
---|
2797 | poe a.out -procs $numprocs -tasks_per_node $numprocs $ROPTS > aout_output 2>&1 |
---|
2798 | fi |
---|
2799 | fi |
---|
2800 | elif [[ $host = nech || $host = neck ]] |
---|
2801 | then |
---|
2802 | (( ii = nodes )) |
---|
2803 | if [[ $ii = 1 ]] |
---|
2804 | then |
---|
2805 | export F_ERRCNT=0 # acceptable number of errors before program is stopped |
---|
2806 | export MPIPROGINF=YES |
---|
2807 | echo "*** execution on single node with mpirun" |
---|
2808 | mpirun -np $numprocs ./a.out $ROPTS > aout_output 2>&1 |
---|
2809 | else |
---|
2810 | (( i = 0 )) |
---|
2811 | while (( i < ii )) |
---|
2812 | do |
---|
2813 | echo "-h $i -p $tasks_per_node -e ./mpi_exec_shell" >> multinode_config |
---|
2814 | (( i = i + 1 )) |
---|
2815 | done |
---|
2816 | |
---|
2817 | echo "#!/bin/sh" > mpi_exec_shell |
---|
2818 | echo " " >> mpi_exec_shell |
---|
2819 | echo "set -u" >> mpi_exec_shell |
---|
2820 | echo "F_ERRCNT=0" >> mpi_exec_shell |
---|
2821 | echo "MPIPROGINV=YES" >> mpi_exec_shell |
---|
2822 | echo "OMP_NUM_THREADS=$threads_per_task" >> mpi_exec_shell |
---|
2823 | echo "cpurest=$cpurest" >> mpi_exec_shell |
---|
2824 | echo "fname=$fname" >> mpi_exec_shell |
---|
2825 | echo "localhost=$localhost" >> mpi_exec_shell |
---|
2826 | echo "return_addres=$return_addres" >> mpi_exec_shell |
---|
2827 | echo "return_username=$return_username" >> mpi_exec_shell |
---|
2828 | echo "tasks_per_node=$tasks_per_node" >> mpi_exec_shell |
---|
2829 | echo "write_binary=$write_binary" >> mpi_exec_shell |
---|
2830 | echo "use_seperate_pe_for_dvrp_output=$use_seperate_pe_for_dvrp_output" >> mpi_exec_shell |
---|
2831 | echo " " >> mpi_exec_shell |
---|
2832 | echo "export F_ERRCNT" >> mpi_exec_shell |
---|
2833 | echo "export MPIPROGINV" >> mpi_exec_shell |
---|
2834 | echo "export OMP_NUM_THREADS" >> mpi_exec_shell |
---|
2835 | echo "export cpurest" >> mpi_exec_shell |
---|
2836 | echo "export fname" >> mpi_exec_shell |
---|
2837 | echo "export localhost" >> mpi_exec_shell |
---|
2838 | echo "export return_addres" >> mpi_exec_shell |
---|
2839 | echo "export return_username" >> mpi_exec_shell |
---|
2840 | echo "export tasks_per_node" >> mpi_exec_shell |
---|
2841 | echo "export write_binary" >> mpi_exec_shell |
---|
2842 | echo "export use_seperate_pe_for_dvrp_output" >> mpi_exec_shell |
---|
2843 | echo " " >> mpi_exec_shell |
---|
2844 | echo "exec ./a.out > aout_output 2>&1" >> mpi_exec_shell |
---|
2845 | |
---|
2846 | chmod u+x mpi_exec_shell |
---|
2847 | export MPIPROGINF=YES |
---|
2848 | mpirun -f multinode_config & |
---|
2849 | wait |
---|
2850 | |
---|
2851 | fi |
---|
2852 | elif [[ $host = lcmuk ]] |
---|
2853 | then |
---|
2854 | |
---|
2855 | # COPY HOSTFILE FROM SOURCE DIRECTORY OR CREATE IT, IF IT |
---|
2856 | # DOES NOT EXIST |
---|
2857 | if [[ -f $hostfile ]] |
---|
2858 | then |
---|
2859 | cp $hostfile hostfile |
---|
2860 | else |
---|
2861 | (( ii = 1 )) |
---|
2862 | while (( ii <= $numprocs / $threads_per_task )) |
---|
2863 | do |
---|
2864 | echo $localhost_realname >> hostfile |
---|
2865 | (( ii = ii + 1 )) |
---|
2866 | done |
---|
2867 | fi |
---|
2868 | (( ii = $numprocs / $threads_per_task )) |
---|
2869 | eval zeile=\"`head -n $ii hostfile`\" |
---|
2870 | printf "\n *** running on: $zeile" |
---|
2871 | export OMP_NUM_THREADS=$threads_per_task |
---|
2872 | if [[ $threads_per_task != 1 ]] |
---|
2873 | then |
---|
2874 | printf "\n threads per task: $threads_per_task" |
---|
2875 | fi |
---|
2876 | printf "\n\n" |
---|
2877 | if [[ $scirocco = true ]] |
---|
2878 | then |
---|
2879 | mpiexec -machinefile hostfile -n $ii a.out $ROPTS > aout_output 2>&1 |
---|
2880 | else |
---|
2881 | mpirun -machinefile hostfile -np $ii a.out $ROPTS > aout_output 2>&1 |
---|
2882 | fi |
---|
2883 | elif [[ $host = decalpha ]] |
---|
2884 | then |
---|
2885 | dmpirun -np $numprocs a.out $ROPTS > aout_output 2>&1 |
---|
2886 | elif [[ $host = lctit ]] |
---|
2887 | then |
---|
2888 | export runfile=runfile.$kennung |
---|
2889 | |
---|
2890 | echo "cd $PWD" > $runfile |
---|
2891 | echo "export OMP_NUM_THREADS=$OMP_NUM_THREADS" >> $runfile |
---|
2892 | echo "export cpurest=$cpurest" >> $runfile |
---|
2893 | echo "export fname=$fname" >> $runfile |
---|
2894 | echo "export localhost=$localhost" >> $runfile |
---|
2895 | echo "export return_addres=$return_addres" >> $runfile |
---|
2896 | echo "export return_username=$return_username" >> $runfile |
---|
2897 | echo "export tasks_per_node=$tasks_per_node" >> $runfile |
---|
2898 | echo "export write_binary=$write_binary" >> $runfile |
---|
2899 | echo "export use_seperate_pe_for_dvrp_output=$use_seperate_pe_for_dvrp_output" >> $runfile |
---|
2900 | echo "./a.out" >> $runfile |
---|
2901 | chmod u+x $runfile |
---|
2902 | |
---|
2903 | if [[ "$QUEUE" = interactive ]] |
---|
2904 | then |
---|
2905 | mpirun -np $numprocs $runfile $ROPTS > aout_output 2>&1 |
---|
2906 | else |
---|
2907 | n1ge -fore -mpi $numprocs -q $queue $runfile $ROPTS > aout_output 2>&1 |
---|
2908 | fi |
---|
2909 | |
---|
2910 | rm $runfile |
---|
2911 | else |
---|
2912 | mpprun -n $numprocs a.out $ROPTS > aout_output 2>&1 |
---|
2913 | fi |
---|
2914 | [[ $? != 0 ]] && execution_error=true |
---|
2915 | |
---|
2916 | |
---|
2917 | # PERFORMANCE-AUSWERTUNG MIT APPRENTICE |
---|
2918 | if [[ "$cond1" = apprentice || "$cond2" = apprentice ]] |
---|
2919 | then |
---|
2920 | apprentice |
---|
2921 | fi |
---|
2922 | else |
---|
2923 | a.out $ROPTS > aout_output 2>&1 |
---|
2924 | fi |
---|
2925 | fi |
---|
2926 | if [[ $? != 0 || $execution_error = true ]] |
---|
2927 | then |
---|
2928 | |
---|
2929 | # ABBRUCH BEI LAUFZEITFEHLER |
---|
2930 | [[ ! ( "$cond1" = debug || "$cond2" = debug ) ]] && cat aout_output |
---|
2931 | printf "\n +++ runtime error occured" |
---|
2932 | locat=execution |
---|
2933 | exit |
---|
2934 | else |
---|
2935 | [[ ! ( "$cond1" = debug || "$cond2" = debug ) ]] && cat aout_output |
---|
2936 | printf "\n$striche\n *** execution finished \n" |
---|
2937 | fi |
---|
2938 | |
---|
2939 | |
---|
2940 | |
---|
2941 | # EVENTUELLE OUTPUT-KOMMANDOS ABARBEITEN |
---|
2942 | (( i = 0 )) |
---|
2943 | while (( i < ioc )) |
---|
2944 | do |
---|
2945 | (( i = i + 1 )) |
---|
2946 | if (( i == 1 )) |
---|
2947 | then |
---|
2948 | printf "\n\n *** execution of OUTPUT-commands:\n$striche" |
---|
2949 | fi |
---|
2950 | printf "\n >>> ${out_command[$i]}" |
---|
2951 | eval ${out_command[$i]} |
---|
2952 | if (( i == ioc )) |
---|
2953 | then |
---|
2954 | printf "\n$striche\n" |
---|
2955 | fi |
---|
2956 | done |
---|
2957 | |
---|
2958 | |
---|
2959 | # EVTL. INHALT DES AKTUELLEN VERZEICHNISSES AUSGEBEN |
---|
2960 | if [[ $do_trace = true ]] |
---|
2961 | then |
---|
2962 | printf "\n\n" |
---|
2963 | ls -al |
---|
2964 | fi |
---|
2965 | |
---|
2966 | |
---|
2967 | |
---|
2968 | # OUTPUT-DATEIEN AN IHRE ZIELORTE KOPIEREN |
---|
2969 | (( i = 0 )) |
---|
2970 | while (( i < iout )) |
---|
2971 | do |
---|
2972 | (( i = i + 1 )) |
---|
2973 | if (( i == 1 )) |
---|
2974 | then |
---|
2975 | printf "\n\n *** saving OUTPUT-files:\n$striche" |
---|
2976 | fi |
---|
2977 | |
---|
2978 | # PRUEFEN, OB EINZELDATEI ODER DATEI PRO PROZESSOR |
---|
2979 | files_for_pes=false; filetyp=file |
---|
2980 | if [[ "${actionout[$i]}" = pe && -n $numprocs ]] |
---|
2981 | then |
---|
2982 | files_for_pes=true; filetyp=directory |
---|
2983 | actionout[$i]="" |
---|
2984 | elif [[ "${actionout[$i]}" = pe && ! -n $numprocs ]] |
---|
2985 | then |
---|
2986 | actionout[$i]="" |
---|
2987 | elif [[ "${actionout[$i]}" = arpe && -n $numprocs ]] |
---|
2988 | then |
---|
2989 | files_for_pes=true; filetyp=directory |
---|
2990 | actionout[$i]="ar" |
---|
2991 | elif [[ "${actionout[$i]}" = arpe && ! -n $numprocs ]] |
---|
2992 | then |
---|
2993 | actionout[$i]="ar" |
---|
2994 | elif [[ "${actionout[$i]}" = flpe && -n $numprocs ]] |
---|
2995 | then |
---|
2996 | files_for_pes=true; filetyp=directory |
---|
2997 | actionout[$i]="fl" |
---|
2998 | elif [[ "${actionout[$i]}" = flpe && ! -n $numprocs ]] |
---|
2999 | then |
---|
3000 | actionout[$i]="fl" |
---|
3001 | elif [[ "${actionout[$i]}" = trpe && -n $numprocs ]] |
---|
3002 | then |
---|
3003 | files_for_pes=true; filetyp=directory |
---|
3004 | actionout[$i]="tr" |
---|
3005 | elif [[ "${actionout[$i]}" = trpe && ! -n $numprocs ]] |
---|
3006 | then |
---|
3007 | actionout[$i]="tr" |
---|
3008 | fi |
---|
3009 | |
---|
3010 | if [[ ! -f ${localout[$i]} && $files_for_pes = false ]] |
---|
3011 | then |
---|
3012 | printf "\n +++ temporary OUTPUT-file ${localout[$i]} does not exist\n" |
---|
3013 | elif [[ ! -f ${localout[$i]}/_0000 && $files_for_pes = true ]] |
---|
3014 | then |
---|
3015 | printf "\n +++ temporary OUTPUT-file ${localout[$i]}/.... does not exist\n" |
---|
3016 | else |
---|
3017 | |
---|
3018 | |
---|
3019 | # KOPIEREN PER FTP/SCP (IMMER IM BINAERMODUS, -M: FALLS ZIELKATALOG |
---|
3020 | # NICHT VORHANDEN, WIRD VERSUCHT, IHN ANZULEGEN), ABER NUR BEI |
---|
3021 | # REMOTE-RECHNUNGEN |
---|
3022 | if [[ "${actionout[$i]}" = tr ]] |
---|
3023 | then |
---|
3024 | if [[ $localhost != $fromhost ]] |
---|
3025 | then |
---|
3026 | if [[ $files_for_pes = false ]] |
---|
3027 | then |
---|
3028 | cps="" |
---|
3029 | cst="" |
---|
3030 | else |
---|
3031 | cps=-c |
---|
3032 | cst="/" |
---|
3033 | fi |
---|
3034 | if [[ $localhost = ibmh || $localhost = ibmb || $localhost = nech ]] |
---|
3035 | then |
---|
3036 | |
---|
3037 | # TRANSFER IN EIGENSTAENDIGEM JOB |
---|
3038 | # ZUERST KOPIE DER DATEI INS TEMPORAERE DATENVERZEICHNIS |
---|
3039 | [[ ! -d $tmp_data_catalog/TRANSFER ]] && mkdir -p $tmp_data_catalog/TRANSFER |
---|
3040 | file_to_transfer=${fname}_${localout[$i]}_to_transfer_$kennung |
---|
3041 | if [[ $files_for_pes = false ]] |
---|
3042 | then |
---|
3043 | ln -f ${localout[$i]} $tmp_data_catalog/TRANSFER/$file_to_transfer |
---|
3044 | else |
---|
3045 | mkdir $tmp_data_catalog/TRANSFER/$file_to_transfer |
---|
3046 | ln ${localout[$i]}/* $tmp_data_catalog/TRANSFER/$file_to_transfer |
---|
3047 | fi |
---|
3048 | |
---|
3049 | echo "set -x" > transfer_${localout[$i]} |
---|
3050 | echo "cd $tmp_data_catalog/TRANSFER" >> transfer_${localout[$i]} |
---|
3051 | if [[ $filetransfer_protocol = ftp ]] |
---|
3052 | then |
---|
3053 | if [[ $files_for_pes = true ]] |
---|
3054 | then |
---|
3055 | printf "\n +++ WARNING: no transfer of catalogs via ftpcopy\n" |
---|
3056 | fi |
---|
3057 | printf "\n >>> OUTPUT: ${localout[$i]} by FTP in seperate job to" |
---|
3058 | printf "\n ${pathout[$i]}/${localhost}_${fname}${endout[$i]}" |
---|
3059 | printf "\n or higher cycle\n" |
---|
3060 | echo "ftpcopy -b -m $return_addres $file_to_transfer \"${pathout[$i]}\" ${localhost}_${fname}${endout[$i]} ${extout[$i]}" >> transfer_${localout[$i]} |
---|
3061 | else |
---|
3062 | printf "\n >>> OUTPUT: ${localout[$i]}$cst by SCP in seperate job to" |
---|
3063 | printf "\n ${pathout[$i]}/${localhost}_${fname}${endout[$i]}$cst" |
---|
3064 | printf "\n or higher cycle\n" |
---|
3065 | echo "batch_scp $cps -b -m -u $return_username $return_addres $file_to_transfer \"${pathout[$i]}\" ${localhost}_${fname}${endout[$i]} ${extout[$i]}" >> transfer_${localout[$i]} |
---|
3066 | fi |
---|
3067 | echo "[[ \$? = 0 ]] && rm $file_to_transfer" >> transfer_${localout[$i]} |
---|
3068 | |
---|
3069 | if [[ $localhost = nech ]] |
---|
3070 | then |
---|
3071 | subjob -d -c /pf/b/$usern/job_queue -v -q pp -X 0 -m 1000 -t 900 -f $filetransfer_protocol transfer_${localout[$i]} |
---|
3072 | else |
---|
3073 | if [[ "$LOGNAME" = b323013 ]] |
---|
3074 | then |
---|
3075 | subjob -v -q c1 -X 0 -m 1000 -t 900 -f $filetransfer_protocol transfer_${localout[$i]} |
---|
3076 | else |
---|
3077 | subjob -d -v -q c1 -X 0 -m 1000 -t 900 -f $filetransfer_protocol transfer_${localout[$i]} |
---|
3078 | fi |
---|
3079 | fi |
---|
3080 | |
---|
3081 | else |
---|
3082 | |
---|
3083 | # TRANSFER INNERHALB DIESES JOBS |
---|
3084 | transfer_failed=false |
---|
3085 | if [[ $filetransfer_protocol = ftp ]] |
---|
3086 | then |
---|
3087 | if [[ $files_for_pes = true ]] |
---|
3088 | then |
---|
3089 | printf "\n +++ WARNING: no transfer of catalogs via ftpcopy\n" |
---|
3090 | fi |
---|
3091 | printf "\n >>> OUTPUT: ${localout[$i]} by FTP to" |
---|
3092 | printf "\n ${pathout[$i]}/${localhost}_${fname}${endout[$i]}\n" |
---|
3093 | ftpcopy -b -m $return_addres ${localout[$i]} "${pathout[$i]}" ${localhost}_${fname}${endout[$i]} ${extout[$i]} |
---|
3094 | [[ $? != 0 ]] && transfer_failed=true |
---|
3095 | else |
---|
3096 | printf "\n >>> OUTPUT: ${localout[$i]}$cst by SCP to" |
---|
3097 | printf "\n ${pathout[$i]}/${localhost}_${fname}${endout[$i]}$cst\n" |
---|
3098 | batch_scp $cps -b -m -u $return_username $return_addres ${localout[$i]} "${pathout[$i]}" ${localhost}_${fname}${endout[$i]} ${extout[$i]} |
---|
3099 | [[ $? != 0 ]] && transfer_failed=true |
---|
3100 | fi |
---|
3101 | |
---|
3102 | # BEI FEHLGESCHLAGENEM TRANSFER SICHERUNGSKOPIE AUF |
---|
3103 | # LOKALER MASCHINE ANLEGEN |
---|
3104 | if [[ $transfer_failed = true ]] |
---|
3105 | then |
---|
3106 | printf " +++ transfer failed. Trying to save a copy on the local host under:\n" |
---|
3107 | printf " ${pathout[$i]}/${localhost}_${fname}${endout[$i]}_$kennung\n" |
---|
3108 | |
---|
3109 | # ERSTMAL PRUEFEN, OB VERZEICHNIS EXISTIERT. GEGEBENENFALLS |
---|
3110 | # ANLEGEN. |
---|
3111 | eval local_catalog=${pathout[$i]} |
---|
3112 | if [[ ! -d $local_catalog ]] |
---|
3113 | then |
---|
3114 | printf " *** local directory does not exist. Trying to create:\n" |
---|
3115 | printf " $local_catalog \n" |
---|
3116 | mkdir -p $local_catalog |
---|
3117 | fi |
---|
3118 | eval cp ${localout[$i]} ${pathout[$i]}/${localhost}_${fname}${endout[$i]}_$kennung |
---|
3119 | transfer_problems=true |
---|
3120 | fi |
---|
3121 | fi |
---|
3122 | else |
---|
3123 | |
---|
3124 | # WERTZUWEISUNG, SO DASS WEITER UNTEN NUR KOPIERT WIRD |
---|
3125 | actionout[$i]="" |
---|
3126 | fi |
---|
3127 | fi |
---|
3128 | |
---|
3129 | |
---|
3130 | # APPEND PER FTP/SCP (IMMER IM BINAERMODUS, -M: FALLS ZIELKATALOG |
---|
3131 | # NICHT VORHANDEN, WIRD VERSUCHT, IHN ANZULEGEN), ABER NUR BEI |
---|
3132 | # REMOTE-RECHNUNGEN |
---|
3133 | if [[ "${actionout[$i]}" = tra ]] |
---|
3134 | then |
---|
3135 | if [[ $localhost != $fromhost ]] |
---|
3136 | then |
---|
3137 | if [[ $localhost = ibmh || $localhost = ibmb || $localhost = nech ]] |
---|
3138 | then |
---|
3139 | |
---|
3140 | # TRANSFER IN EIGENSTAENDIGEM JOB |
---|
3141 | # ZUERST KOPIE DER DATEI INS TEMPORAERE DATENVERZEICHNIS |
---|
3142 | [[ ! -d $tmp_data_catalog/TRANSFER ]] && mkdir -p $tmp_data_catalog/TRANSFER |
---|
3143 | file_to_transfer=${fname}_${localout[$i]}_to_transfer_$kennung |
---|
3144 | ln -f ${localout[$i]} $tmp_data_catalog/TRANSFER/$file_to_transfer |
---|
3145 | |
---|
3146 | echo "set -x" > transfer_${localout[$i]} |
---|
3147 | echo "cd $tmp_data_catalog/TRANSFER" >> transfer_${localout[$i]} |
---|
3148 | if [[ $filetransfer_protocol = ftp ]] |
---|
3149 | then |
---|
3150 | printf "\n >>> OUTPUT: ${localout[$i]} append by FTP in seperate job to" |
---|
3151 | printf "\n ${pathout[$i]}/${localhost}_${fname}${endout[$i]}" |
---|
3152 | printf "\n or higher cycle\n" |
---|
3153 | echo "ftpcopy -A -b -m $return_addres $file_to_transfer \"${pathout[$i]}\" ${localhost}_${fname}${endout[$i]} ${extout[$i]}" >> transfer_${localout[$i]} |
---|
3154 | else |
---|
3155 | printf "\n >>> OUTPUT: ${localout[$i]} append by SCP in seperate job to" |
---|
3156 | printf "\n ${pathout[$i]}/${localhost}_${fname}${endout[$i]}" |
---|
3157 | printf "\n or higher cycle\n" |
---|
3158 | echo "batch_scp -A -b -m -u $return_username $return_addres $file_to_transfer \"${pathout[$i]}\" ${localhost}_${fname}${endout[$i]} ${extout[$i]}" >> transfer_${localout[$i]} |
---|
3159 | fi |
---|
3160 | echo "[[ \$? = 0 ]] && rm $file_to_transfer" >> transfer_${localout[$i]} |
---|
3161 | |
---|
3162 | if [[ $localhost = nech ]] |
---|
3163 | then |
---|
3164 | subjob -d -c /pf/b/$usern/job_queue -v -q pp -X 0 -m 1000 -t 900 -f $filetransfer_protocol transfer_${localout[$i]} |
---|
3165 | else |
---|
3166 | if [[ $LOGNAME = b323013 ]] |
---|
3167 | then |
---|
3168 | subjob -v -q c1 -X 0 -m 1000 -t 900 -f $filetransfer_protocol transfer_${localout[$i]} |
---|
3169 | else |
---|
3170 | subjob -d -v -q c1 -X 0 -m 1000 -t 900 -f $filetransfer_protocol transfer_${localout[$i]} |
---|
3171 | fi |
---|
3172 | fi |
---|
3173 | |
---|
3174 | else |
---|
3175 | |
---|
3176 | # TRANSFER INNERHALB DIESES JOBS |
---|
3177 | transfer_failed=false |
---|
3178 | if [[ $filetransfer_protocol = ftp ]] |
---|
3179 | then |
---|
3180 | printf "\n >>> OUTPUT: ${localout[$i]} append by FTP to" |
---|
3181 | printf "\n ${pathout[$i]}/${localhost}_${fname}${endout[$i]}\n" |
---|
3182 | ftpcopy -A -b -m $return_addres ${localout[$i]} "${pathout[$i]}" ${localhost}_${fname}${endout[$i]} ${extout[$i]} |
---|
3183 | [[ $? != 0 ]] && transfer_failed=true |
---|
3184 | else |
---|
3185 | printf "\n >>> OUTPUT: ${localout[$i]} append by SCP to" |
---|
3186 | printf "\n ${pathout[$i]}/${localhost}_${fname}${endout[$i]}\n" |
---|
3187 | batch_scp -A -b -m -u $return_username $return_addres ${localout[$i]} "${pathout[$i]}" ${localhost}_${fname}${endout[$i]} ${extout[$i]} |
---|
3188 | [[ $? != 0 ]] && transfer_failed=true |
---|
3189 | fi |
---|
3190 | |
---|
3191 | # BEI FEHLGESCHLAGENEM TRANSFER SICHERUNGSKOPIE AUF |
---|
3192 | # LOKALER MASCHINE ANLEGEN |
---|
3193 | if [[ $transfer_failed = true ]] |
---|
3194 | then |
---|
3195 | printf " +++ transfer failed. Trying to save a copy on the local host under:\n" |
---|
3196 | printf " ${pathout[$i]}/${localhost}_${fname}${endout[$i]}_$kennung\n" |
---|
3197 | |
---|
3198 | # ERSTMAL PRUEFEN, OB VERZEICHNIS EXISTIERT. GEGEBENENFALLS |
---|
3199 | # ANLEGEN |
---|
3200 | eval local_catalog=${pathout[$i]} |
---|
3201 | if [[ ! -d $local_catalog ]] |
---|
3202 | then |
---|
3203 | printf " *** local directory does not exist. Trying to create:\n" |
---|
3204 | printf " $local_catalog \n" |
---|
3205 | mkdir -p $local_catalog |
---|
3206 | fi |
---|
3207 | |
---|
3208 | eval cp ${localout[$i]} ${pathout[$i]}/${localhost}_${fname}${endout[$i]}_$kennung |
---|
3209 | transfer_problems=true |
---|
3210 | fi |
---|
3211 | fi |
---|
3212 | else |
---|
3213 | |
---|
3214 | # WERTZUWEISUNG, SO DASS WEITER UNTEN NUR APPEND AUF |
---|
3215 | # LOKALER MASCHINE DURCHGEFUEHRT WIRD |
---|
3216 | actionout[$i]=a |
---|
3217 | fi |
---|
3218 | fi |
---|
3219 | |
---|
3220 | |
---|
3221 | # OUTPUT-DATEI FUER EINEN FORTSETZUNGSLAUF. DATEI WIRD PER |
---|
3222 | # LINK AUF DEN TEMPORAEREN DATENKATALOG GELEGT. OPTION -f WIRD |
---|
3223 | # VERWENDET, FALLS DORT NOCH EINE DATEI GLEICHEN NAMENS VORHANDEN |
---|
3224 | # SEIN SOLLTE. ANSCHLIESSEND WIRD SEINE ARCHIVIERUNG ANGESTOSSEN |
---|
3225 | if [[ "${actionout[$i]}" = fl ]] |
---|
3226 | then |
---|
3227 | [[ ! -d $tmp_data_catalog ]] && mkdir -p $tmp_data_catalog |
---|
3228 | chmod g+rx $tmp_data_catalog |
---|
3229 | if [[ $files_for_pes = false ]] |
---|
3230 | then |
---|
3231 | printf "\n >>> OUTPUT: ${localout[$i]} to" |
---|
3232 | printf "\n $tmp_data_catalog/${frelout[$i]} (temporary data catalog)\n" |
---|
3233 | ln -f ${localout[$i]} $tmp_data_catalog/${frelout[$i]} |
---|
3234 | else |
---|
3235 | printf "\n >>> OUTPUT: ${localout[$i]}/.... to" |
---|
3236 | printf "\n $tmp_data_catalog/${frelout[$i]} (temporary data catalog)\n" |
---|
3237 | mkdir $tmp_data_catalog/${frelout[$i]} |
---|
3238 | ln -f ${localout[$i]}/* $tmp_data_catalog/${frelout[$i]} |
---|
3239 | fi |
---|
3240 | |
---|
3241 | |
---|
3242 | # ARCHIVIERUNGSJOB WIRD ERZEUGT UND ABGESCHICKT |
---|
3243 | if [[ $store_on_archive_system = true ]] |
---|
3244 | then |
---|
3245 | |
---|
3246 | if [[ $archive_system = asterix ]] |
---|
3247 | then |
---|
3248 | echo "cd $tmp_data_catalog" >> archive_${frelout[$i]} |
---|
3249 | if [[ $files_for_pes = false ]] |
---|
3250 | then |
---|
3251 | echo "stageout ${frelout[$i]} > STAGE_OUTPUT${i}_$kennung" >> archive_${frelout[$i]} |
---|
3252 | else |
---|
3253 | echo "stageout -t ${frelout[$i]} > STAGE_OUTPUT${i}_$kennung" >> archive_${frelout[$i]} |
---|
3254 | fi |
---|
3255 | echo "cat STAGE_OUTPUT${i}_$kennung" >> archive_${frelout[$i]} |
---|
3256 | echo "if [[ \$(grep -c \"st.msg:150\" STAGE_OUTPUT${i}_$kennung) != 0 ]]" >> archive_${frelout[$i]} |
---|
3257 | echo "then" >> archive_${frelout[$i]} |
---|
3258 | echo " do_stageout=false" >> archive_${frelout[$i]} |
---|
3259 | echo "else" >> archive_${frelout[$i]} |
---|
3260 | echo " echo \" +++ $filetyp ${frelout[$i]} could not be stored on archive-system\" " >> archive_${frelout[$i]} |
---|
3261 | echo " cat /dev/null > ~/job_queue/ARCHIVE_ERROR_$fname" >> archive_${frelout[$i]} |
---|
3262 | echo " cat STAGE_OUTPUT${i}_$kennung > ~/job_queue/archive_${frelout[$i]}_error" >> archive_${frelout[$i]} |
---|
3263 | echo " echo \" *** $filetyp ${frelout[$i]} will be copied to \$WORK as backup\" " >> archive_${frelout[$i]} |
---|
3264 | if [[ $files_for_pes = false ]] |
---|
3265 | then |
---|
3266 | echo " cp ${frelout[$i]} \$WORK" >> archive_${frelout[$i]} |
---|
3267 | else |
---|
3268 | echo " cp -r ${frelout[$i]} \$WORK/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
3269 | fi |
---|
3270 | echo " echo \" *** $filetyp ${frelout[$i]} saved\" " >> archive_${frelout[$i]} |
---|
3271 | echo "fi" >> archive_${frelout[$i]} |
---|
3272 | echo "rm STAGE_OUTPUT${i}_$kennung" >> archive_${frelout[$i]} |
---|
3273 | elif [[ $archive_system = DMF ]] |
---|
3274 | then |
---|
3275 | echo "cd $tmp_data_catalog" >> archive_${frelout[$i]} |
---|
3276 | if [[ $files_for_pes = false ]] |
---|
3277 | then |
---|
3278 | printf "\n +++ archiving of single files impossible with $archive_system !\n" |
---|
3279 | locat=DMF |
---|
3280 | exit |
---|
3281 | else |
---|
3282 | # FUER RECHNER IN JUELICH. DORT KOENNTEN AUCH |
---|
3283 | # EINZELNE DATEIEN GESICHERT WERDEN (SPAETER KORR.) |
---|
3284 | echo "rm -rf \$ARCHIVE/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
3285 | echo "cp -r ${frelout[$i]} \$ARCHIVE" >> archive_${frelout[$i]} |
---|
3286 | fi |
---|
3287 | elif [[ $archive_system = tivoli ]] |
---|
3288 | then |
---|
3289 | echo "cd $tmp_data_catalog" >> archive_${frelout[$i]} |
---|
3290 | if [[ $files_for_pes = false ]] |
---|
3291 | then |
---|
3292 | # EVENTUELL NOCH VORHANDENE DATEI IM ARCHIV LOSCHEN |
---|
3293 | echo "set -x" >> archive_${frelout[$i]} |
---|
3294 | echo "rm -rf \$PERM/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
3295 | echo "cp ${frelout[$i]} \$PERM/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
3296 | else |
---|
3297 | |
---|
3298 | echo "set -x" >> archive_${frelout[$i]} |
---|
3299 | echo "rm -rf \$PERM/${frelout[$i]}/*" >> archive_${frelout[$i]} |
---|
3300 | echo "[[ ! -d \$PERM/${frelout[$i]} ]] && mkdir $PERM/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
3301 | cd $tmp_data_catalog |
---|
3302 | all_files=`ls -1 ${frelout[$i]}/*` |
---|
3303 | cd - > /dev/null |
---|
3304 | (( inode = 0 )) |
---|
3305 | (( tp1 = tasks_per_node + 1 )) |
---|
3306 | while (( inode < nodes )) |
---|
3307 | do |
---|
3308 | # echo "*** all_files = \"$all_files\" " |
---|
3309 | files=`echo $all_files | cut -d" " -f1-$tasks_per_node` |
---|
3310 | all_files=`echo $all_files | cut -d" " -f$tp1-` |
---|
3311 | # echo "*** tasks_per_node = \"$tasks_per_node\" " |
---|
3312 | # echo "*** files = \"$files\" " |
---|
3313 | # echo "*** all_files = \"$all_files\" " |
---|
3314 | echo "tar cvf \$PERM/${frelout[$i]}/${frelout[$i]}.node_$inode.tar $files" >> archive_${frelout[$i]} |
---|
3315 | echo "dsmc incremental \$PERM/${frelout[$i]}/${frelout[$i]}.node_$inode.tar" >> archive_${frelout[$i]} |
---|
3316 | echo "dsmmigrate \$PERM/${frelout[$i]}/${frelout[$i]}.node_$inode.tar" >> archive_${frelout[$i]} |
---|
3317 | (( inode = inode + 1 )) |
---|
3318 | done |
---|
3319 | # echo "rm -rf \$PERM/${frelout[$i]}.tar" >> archive_${frelout[$i]} |
---|
3320 | # echo "tar cvf \$PERM/${frelout[$i]}.tar ${frelout[$i]}" >> archive_${frelout[$i]} |
---|
3321 | fi |
---|
3322 | elif [[ $archive_system = ut ]] |
---|
3323 | then |
---|
3324 | echo "cd $tmp_data_catalog" >> archive_${frelout[$i]} |
---|
3325 | if [[ $files_for_pes = false ]] |
---|
3326 | then |
---|
3327 | # EVENTUELL NOCH VORHANDENE DATEI IM ARCHIV LOSCHEN |
---|
3328 | echo "set -x" >> archive_${frelout[$i]} |
---|
3329 | echo "rm -rf \$UT/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
3330 | echo "cp ${frelout[$i]} \$UT/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
3331 | else |
---|
3332 | |
---|
3333 | echo "set -x" >> archive_${frelout[$i]} |
---|
3334 | echo "rm -rf \$UT/${frelout[$i]}/*" >> archive_${frelout[$i]} |
---|
3335 | echo "[[ ! -d \$UT/${frelout[$i]} ]] && mkdir $UT/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
3336 | cd $tmp_data_catalog |
---|
3337 | all_files=`ls -1 ${frelout[$i]}/*` |
---|
3338 | cd - > /dev/null |
---|
3339 | (( inode = 0 )) |
---|
3340 | (( tp1 = tasks_per_node + 1 )) |
---|
3341 | while (( inode < nodes )) |
---|
3342 | do |
---|
3343 | files=`echo $all_files | cut -d" " -f1-$tasks_per_node` |
---|
3344 | all_files=`echo $all_files | cut -d" " -f$tp1-` |
---|
3345 | echo "tar cvf \$UT/${frelout[$i]}/${frelout[$i]}.node_$inode.tar $files" >> archive_${frelout[$i]} |
---|
3346 | (( inode = inode + 1 )) |
---|
3347 | done |
---|
3348 | fi |
---|
3349 | elif [[ $archive_system = none ]] |
---|
3350 | then |
---|
3351 | printf " +++ archiving on $localhost not available!\n" |
---|
3352 | fi |
---|
3353 | |
---|
3354 | if [[ $archive_system != none ]] |
---|
3355 | then |
---|
3356 | if [[ $localhost = ibmh || $localhost = ibmb ]] |
---|
3357 | then |
---|
3358 | subjob -d -v -q cdata -X 0 -m 1000 -t 7200 -f $filetransfer_protocol archive_${frelout[$i]} |
---|
3359 | elif [[ $localhost = nech ]] |
---|
3360 | then |
---|
3361 | subjob -d -c /pf/b/$usern/job_queue -v -q pp -X 0 -m 1000 -t 7200 -f $filetransfer_protocol archive_${frelout[$i]} |
---|
3362 | fi |
---|
3363 | printf " Archiving of $tmp_data_catalog/${frelout[$i]} initiated (batch job submitted)\n" |
---|
3364 | fi |
---|
3365 | else |
---|
3366 | printf " +++ caution: option -A is switched on. No archiving on $archive_system!\n" |
---|
3367 | fi |
---|
3368 | |
---|
3369 | |
---|
3370 | # LEERDATEI IM BENUTZERVERZEICHNIS ANLEGEN, DAMIT BEKANNT IST, |
---|
3371 | # WIE DIE HOECHSTE ZYKLUSNUMMER AUF DEM ARCHIV-SYSTEM LAUTET |
---|
3372 | if [[ $files_for_pes = false ]] |
---|
3373 | then |
---|
3374 | cat /dev/null > ${pathout[$i]} |
---|
3375 | else |
---|
3376 | mkdir -p ${pathout[$i]} |
---|
3377 | fi |
---|
3378 | |
---|
3379 | fi |
---|
3380 | |
---|
3381 | |
---|
3382 | # KOPIEREN AUF LOKALER MASCHINE ZUM ARCHIV-SYSTEM |
---|
3383 | # AUSSERDEM MUSS LEERDATEI ANGELEGT WERDEN, DAMIT BEKANNT IST, |
---|
3384 | # WIE DIE HOECHSTE ZYKLUSNUMMER AUF DEM ARCHIV-SYSTEM LAUTET |
---|
3385 | # FALLS IRGENDEINE (VON MEHREREN) ARCHIVIERUNGEN SCHIEF GEHT, |
---|
3386 | # WIRD FLAG GESETZT UND BLEIBT AUCH BEI WEITEREN ORDNUNGS- |
---|
3387 | # GEMAESSEN ARCHIVIERUNGEN GESETZT |
---|
3388 | if [[ "${actionout[$i]}" = ar ]] |
---|
3389 | then |
---|
3390 | if [[ $files_for_pes = false ]] |
---|
3391 | then |
---|
3392 | printf "\n >>> OUTPUT: ${localout[$i]} to" |
---|
3393 | printf "\n ${pathout[$i]}" |
---|
3394 | printf "\n File will be copied to archive-system ($archive_system) !\n" |
---|
3395 | else |
---|
3396 | printf "\n >>> OUTPUT: ${localout[$i]}/_.... to" |
---|
3397 | printf "\n ${pathout[$i]}" |
---|
3398 | printf "\n Directory will be copied to archive-system ($archive_system) !\n" |
---|
3399 | fi |
---|
3400 | mv ${localout[$i]} ${frelout[$i]} |
---|
3401 | |
---|
3402 | file_saved=false |
---|
3403 | |
---|
3404 | if [[ $archive_system = asterix ]] |
---|
3405 | then |
---|
3406 | do_stageout=true |
---|
3407 | (( stageout_anz = 0 )) |
---|
3408 | while [[ $do_stageout = true ]] |
---|
3409 | do |
---|
3410 | if [[ $files_for_pes = false ]] |
---|
3411 | then |
---|
3412 | stageout ${frelout[$i]} > STAGE_OUTPUT |
---|
3413 | else |
---|
3414 | stageout -t ${frelout[$i]} > STAGE_OUTPUT |
---|
3415 | fi |
---|
3416 | cat STAGE_OUTPUT |
---|
3417 | if [[ $(grep -c "st.msg:150" STAGE_OUTPUT) != 0 ]] |
---|
3418 | then |
---|
3419 | file_saved=true |
---|
3420 | do_stageout=false |
---|
3421 | else |
---|
3422 | if [[ $files_for_pes = false ]] |
---|
3423 | then |
---|
3424 | printf "\n +++ file ${frelout[$i]} could not be saved on archive-system" |
---|
3425 | else |
---|
3426 | printf "\n +++ directory ${frelout[$i]} could not be saved on archive-system" |
---|
3427 | fi |
---|
3428 | (( stageout_anz = stageout_anz + 1 )) |
---|
3429 | if (( stageout_anz == 10 )) |
---|
3430 | then |
---|
3431 | printf "\n +++ stoped after 10 unsuccessful tries!" |
---|
3432 | archive_save=false |
---|
3433 | do_stageout=false |
---|
3434 | else |
---|
3435 | printf "\n *** new try to store on archive after 15 min:" |
---|
3436 | sleep 900 |
---|
3437 | fi |
---|
3438 | fi |
---|
3439 | done |
---|
3440 | elif [[ $archive_system = DMF ]] |
---|
3441 | then |
---|
3442 | if [[ $files_for_pes = false ]] |
---|
3443 | then |
---|
3444 | printf "\n +++ archiving of single files impossible on $archive_system!\n" |
---|
3445 | locat=DMF |
---|
3446 | exit |
---|
3447 | else |
---|
3448 | rm -rf $ARCHIVE/${frelout[$i]} |
---|
3449 | cp -r ${frelout[$i]} $ARCHIVE |
---|
3450 | fi |
---|
3451 | file_saved=true |
---|
3452 | elif [[ $archive_system = tivoli ]] |
---|
3453 | then |
---|
3454 | # ARCHIVIERUNG NUR PER BATCH-JOB MOEGLICH |
---|
3455 | # DATEI MUSS ZWISCHENZEITLICH INS TEMPORAERE DATENVERZEICHNIS |
---|
3456 | # GELEGT WERDEN |
---|
3457 | [[ ! -d $tmp_data_catalog ]] && mkdir -p $tmp_data_catalog |
---|
3458 | chmod g+rx $tmp_data_catalog |
---|
3459 | if [[ $files_for_pes = false ]] |
---|
3460 | then |
---|
3461 | ln -f ${frelout[$i]} $tmp_data_catalog/${frelout[$i]} |
---|
3462 | else |
---|
3463 | mkdir $tmp_data_catalog/${frelout[$i]} |
---|
3464 | ln -f ${frelout[$i]}/* $tmp_data_catalog/${frelout[$i]} |
---|
3465 | fi |
---|
3466 | |
---|
3467 | # BATCH JOB GENERIEREN UND ABSCHICKEN; DATEI MUSS WIEDER |
---|
3468 | # AUS TEMPORAEREM DATENVERZEICHNIS ENTFERNT WERDEN |
---|
3469 | echo "cd $tmp_data_catalog" > archive_${frelout[$i]} |
---|
3470 | if [[ $files_for_pes = false ]] |
---|
3471 | then |
---|
3472 | # EVENTUELL NOCH VORHANDENE DATEI IM ARCHIV LOSCHEN |
---|
3473 | echo "rm -rf \$PERM/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
3474 | echo "cp ${frelout[$i]} \$PERM/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
3475 | echo "rm -rf ${frelout[$i]}" >> archive_${frelout[$i]} |
---|
3476 | else |
---|
3477 | echo "rm -rf \$PERM/${frelout[$i]}.tar" >> archive_${frelout[$i]} |
---|
3478 | echo "tar cvf \$PERM/${frelout[$i]}.tar ${frelout[$i]}" >> archive_${frelout[$i]} |
---|
3479 | echo "rm -rf ${frelout[$i]}" >> archive_${frelout[$i]} |
---|
3480 | fi |
---|
3481 | |
---|
3482 | subjob -v -d -q cdata -X 0 -m 1000 -t 7200 -f $filetransfer_protocol archive_${frelout[$i]} |
---|
3483 | printf " Archiving of $tmp_data_catalog/${frelout[$i]} initiated (batch job submitted)\n" |
---|
3484 | file_saved=true |
---|
3485 | |
---|
3486 | elif [[ $archive_system = ut ]] |
---|
3487 | then |
---|
3488 | # ARCHIVIERUNG NUR PER BATCH-JOB MOEGLICH |
---|
3489 | # DATEI MUSS ZWISCHENZEITLICH INS TEMPORAERE DATENVERZEICHNIS |
---|
3490 | # GELEGT WERDEN |
---|
3491 | [[ ! -d $tmp_data_catalog ]] && mkdir -p $tmp_data_catalog |
---|
3492 | chmod g+rx $tmp_data_catalog |
---|
3493 | if [[ $files_for_pes = false ]] |
---|
3494 | then |
---|
3495 | ln -f ${frelout[$i]} $tmp_data_catalog/${frelout[$i]} |
---|
3496 | else |
---|
3497 | mkdir $tmp_data_catalog/${frelout[$i]} |
---|
3498 | ln -f ${frelout[$i]}/* $tmp_data_catalog/${frelout[$i]} |
---|
3499 | fi |
---|
3500 | |
---|
3501 | # BATCH JOB GENERIEREN UND ABSCHICKEN; DATEI MUSS WIEDER |
---|
3502 | # AUS TEMPORAEREM DATENVERZEICHNIS ENTFERNT WERDEN |
---|
3503 | echo "cd $tmp_data_catalog" > archive_${frelout[$i]} |
---|
3504 | if [[ $files_for_pes = false ]] |
---|
3505 | then |
---|
3506 | # EVENTUELL NOCH VORHANDENE DATEI IM ARCHIV LOSCHEN |
---|
3507 | echo "rm -rf \$UT/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
3508 | echo "cp ${frelout[$i]} \$UT/${frelout[$i]}" >> archive_${frelout[$i]} |
---|
3509 | echo "rm -rf ${frelout[$i]}" >> archive_${frelout[$i]} |
---|
3510 | else |
---|
3511 | echo "rm -rf \$UT/${frelout[$i]}.tar" >> archive_${frelout[$i]} |
---|
3512 | echo "tar cvf \$UT/${frelout[$i]}.tar ${frelout[$i]}" >> archive_${frelout[$i]} |
---|
3513 | echo "rm -rf ${frelout[$i]}" >> archive_${frelout[$i]} |
---|
3514 | fi |
---|
3515 | |
---|
3516 | subjob -v -c /pf/b/$usern/job_queue -d -q pp -X 0 -m 1000 -t 7200 -f $filetransfer_protocol archive_${frelout[$i]} |
---|
3517 | printf " Archiving of $tmp_data_catalog/${frelout[$i]} initiated (batch job submitted)\n" |
---|
3518 | file_saved=true |
---|
3519 | |
---|
3520 | else |
---|
3521 | printf "\n +++ archive_system=\"$archive_system\" archiving impossible!" |
---|
3522 | archive_save=false |
---|
3523 | fi |
---|
3524 | if [[ $file_saved = true ]] |
---|
3525 | then |
---|
3526 | if [[ $files_for_pes = false ]] |
---|
3527 | then |
---|
3528 | cat /dev/null > ${pathout[$i]} |
---|
3529 | else |
---|
3530 | mkdir -p ${pathout[$i]} |
---|
3531 | fi |
---|
3532 | fi |
---|
3533 | fi |
---|
3534 | |
---|
3535 | # APPEND AUF LOKALER MASCHINE |
---|
3536 | if [[ "${actionout[$i]}" = "a" ]] |
---|
3537 | then |
---|
3538 | printf "\n >>> OUTPUT: ${localout[$i]} append to ${pathout[$i]}\n" |
---|
3539 | cat ${localout[$i]} >> ${pathout[$i]} |
---|
3540 | fi |
---|
3541 | |
---|
3542 | # KOPIEREN AUF LOKALER MASCHINE |
---|
3543 | # ES MUSS KOPIERT WERDEN, DA MOVE NICHT UEBER FILESYSTEM HINAUS MOEGLICH |
---|
3544 | if [[ "${actionout[$i]}" = "" && $files_for_pes = false ]] |
---|
3545 | then |
---|
3546 | |
---|
3547 | # KOPIEREN AUF EINPROZESSORMASCHINE |
---|
3548 | if [[ "${extout[$i]}" != " " ]] |
---|
3549 | then |
---|
3550 | printf "\n >>> OUTPUT: ${localout[$i]} to ${pathout[$i]}.${extout[$i]}\n" |
---|
3551 | cp ${localout[$i]} ${pathout[$i]}.${extout[$i]} |
---|
3552 | else |
---|
3553 | printf "\n >>> OUTPUT: ${localout[$i]} to ${pathout[$i]}\n" |
---|
3554 | cp ${localout[$i]} ${pathout[$i]} |
---|
3555 | fi |
---|
3556 | |
---|
3557 | elif [[ "${actionout[$i]}" = "" && $files_for_pes = true ]] |
---|
3558 | then |
---|
3559 | |
---|
3560 | # DIE DEN PROZESSOREN EINES PARALLELRECHNERS ZUGEHOERIGEN |
---|
3561 | # DATEIEN WERDEN ERST IN EINEM KATALOG GESAMMELT UND DIESER |
---|
3562 | # WIRD DANN KOPIERT |
---|
3563 | # PER MOVE UMBENANNT WERDEN |
---|
3564 | printf "\n >>> OUTPUT: ${localout[$i]}/_.... to ${pathout[$i]}\n" |
---|
3565 | cp -r ${localout[$i]} ${pathout[$i]} |
---|
3566 | |
---|
3567 | fi |
---|
3568 | fi |
---|
3569 | done |
---|
3570 | if (( i != 0 )) |
---|
3571 | then |
---|
3572 | if [[ $transfer_problems = true ]] |
---|
3573 | then |
---|
3574 | printf "\n$striche\n *** OUTPUT-files saved" |
---|
3575 | printf "\n +++ WARNING: some data transfers failed! \n" |
---|
3576 | else |
---|
3577 | printf "\n$striche\n *** all OUTPUT-files saved \n" |
---|
3578 | fi |
---|
3579 | fi |
---|
3580 | |
---|
3581 | |
---|
3582 | # EVENTUELL FOLGEJOB STARTEN |
---|
3583 | # DATEI CONTINUE_RUN MUSS VOM BENUTZERPROGRAMM AUS ERZEUGT WERDEN |
---|
3584 | if [[ -f CONTINUE_RUN ]] |
---|
3585 | then |
---|
3586 | |
---|
3587 | if [[ $archive_save = true ]] |
---|
3588 | then |
---|
3589 | |
---|
3590 | # ZUERST IN MRUN-AUFRUF OPTIONEN FUER FORTSETZUNGSLAUF, FUER |
---|
3591 | # STILLES ABARBEITEN (OHNE INTERAKTIVE RUECKFAGEN) UND FUER |
---|
3592 | # BATCH-BETRIEB (NUR WICHTIG, FALLS BATCH AUF LOKALER MASCHINE |
---|
3593 | # DURCHGEFUEHRT WERDEN SOLL) EINFUEGEN, FALLS NICHT BEREITS VOR- |
---|
3594 | # HANDEN |
---|
3595 | [[ $(echo $mc | grep -c "\-C") = 0 ]] && mc="$mc -C" |
---|
3596 | [[ $(echo $mc | grep -c "\-v") = 0 ]] && mc="$mc -v" |
---|
3597 | [[ $(echo $mc | grep -c "\-b") = 0 ]] && mc="$mc -b" |
---|
3598 | if [[ $(echo $mc | grep -c "#") != 0 ]] |
---|
3599 | then |
---|
3600 | mc=`echo $mc | sed 's/#/f/g'` |
---|
3601 | fi |
---|
3602 | |
---|
3603 | |
---|
3604 | # JOB STARTEN |
---|
3605 | printf "\n\n *** initiating restart-run on \"$return_addres\" using command:\n" |
---|
3606 | echo " $mc" |
---|
3607 | printf "\n$striche\n" |
---|
3608 | if [[ $localhost != $fromhost ]] |
---|
3609 | then |
---|
3610 | |
---|
3611 | if [[ $localhost = nech || $localhost = ibmb || $localhost = ibmh || $localhost = ibms || $localhost = lctit ]] |
---|
3612 | then |
---|
3613 | echo "*** ssh will be used to initiate restart-runs!" |
---|
3614 | echo " return_addres=\"$return_addres\" " |
---|
3615 | echo " return_username=\"$return_username\" " |
---|
3616 | if [[ $return_addres = 172.20.25.41 ]] |
---|
3617 | then |
---|
3618 | # WORKAROUND AUF SCIROCCO AM TIT |
---|
3619 | print "PATH=\$PATH:$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc " | ssh $return_addres -l $return_username |
---|
3620 | else |
---|
3621 | ssh $return_addres -l $return_username "PATH=\$PATH:$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc " |
---|
3622 | fi |
---|
3623 | else |
---|
3624 | printf "\n +++ no restart mechanism available for host \"$localhost\" " |
---|
3625 | locat=restart; exit |
---|
3626 | fi |
---|
3627 | |
---|
3628 | # WARTEN, DAMIT SICH RESTART JOB IN QUEUE EINREIHEN KANN, BEVOR |
---|
3629 | # DER AKTUELLE JOB ENDET |
---|
3630 | sleep 30 |
---|
3631 | |
---|
3632 | else |
---|
3633 | |
---|
3634 | # BEI RECHNUNGEN AUF LOKALER MASCHINE KANN MRUN DIREKT AUFGE- |
---|
3635 | # RUFEN WERDEN |
---|
3636 | cd $LOCAL_PWD |
---|
3637 | eval $mc # ' MUESSEN AUSGEWERTET WERDEN |
---|
3638 | cd - > /dev/null |
---|
3639 | fi |
---|
3640 | printf "\n$striche\n *** restart-run initiated \n" |
---|
3641 | |
---|
3642 | |
---|
3643 | # EVENTUELL INPUT-DATEIEN, DIE VON TEMPORAEREM DATENVERZEICHNIS |
---|
3644 | # GEHOLT WORDEN SIND, LOESCHEN |
---|
3645 | (( i = 0 )) |
---|
3646 | while (( i < iin )) |
---|
3647 | do |
---|
3648 | (( i = i + 1 )) |
---|
3649 | if [[ "${got_tmp[$i]}" = true && $keep_data_from_previous_run = false ]] |
---|
3650 | then |
---|
3651 | rm -r $tmp_data_catalog/${frelin[$i]} |
---|
3652 | fi |
---|
3653 | done |
---|
3654 | |
---|
3655 | else |
---|
3656 | |
---|
3657 | printf "\n +++ no restart-run possible, since errors occured" |
---|
3658 | printf "\n during the archive process" |
---|
3659 | fi |
---|
3660 | |
---|
3661 | fi |
---|
3662 | |
---|
3663 | |
---|
3664 | |
---|
3665 | # EVTL. EMAIL-BENACHRICHTIGUNG UEBER ABGESCHLOSSENEN LAUF |
---|
3666 | if [[ "$email_notification" != "" ]] |
---|
3667 | then |
---|
3668 | |
---|
3669 | if [[ $localhost != $fromhost ]] |
---|
3670 | then |
---|
3671 | if [[ -f CONTINUE_RUN ]] |
---|
3672 | then |
---|
3673 | echo "PALM restart run necessary" > email_text |
---|
3674 | echo "description header of actual run:" >> email_text |
---|
3675 | cat CONTINUE_RUN >> email_text |
---|
3676 | echo "mrun-command to restart:" >> email_text |
---|
3677 | echo "$mc" >> email_text |
---|
3678 | else |
---|
3679 | echo "PALM run with base filename \"$fname\" on host \"$localhost\" finished" > email_text |
---|
3680 | fi |
---|
3681 | mail $email_notification < email_text |
---|
3682 | printf "\n *** email notification sent to \"$email_notification\" " |
---|
3683 | fi |
---|
3684 | fi |
---|
3685 | |
---|
3686 | |
---|
3687 | |
---|
3688 | # ALLE ARBEITEN BEENDET. TEMPORAERER KATALOG KANN GELOESCHT WERDEN |
---|
3689 | cd $HOME |
---|
3690 | [[ $delete_temporary_catalog = true ]] && rm -rf $TEMPDIR |
---|
3691 | |
---|
3692 | else |
---|
3693 | |
---|
3694 | |
---|
3695 | # FALLS AUF REMOTE-MASCHINE GERECHNET WERDEN SOLL, WERDEN JETZT ENTSPRE- |
---|
3696 | # CHENDE AKTIONEN DURCHGEFUEHRT |
---|
3697 | |
---|
3698 | # MRUN-BEFEHL FUER REMOTE-MASCHINE ZUSAMMENSTELLEN |
---|
3699 | mrun_com="$mrun_script_name -a $afname -c $config_file -d $fname -f $filetransfer_protocol -h $host -H $fromhost -m $memory -t $cpumax -q $queue -R $return_addres -U $return_username -u $remote_username" |
---|
3700 | [[ "$cpp_opts" != "" ]] && mrun_com=${mrun_com}" -D \"$cpp_opts\"" |
---|
3701 | [[ $do_compile = true ]] && mrun_com=${mrun_com}" -s \"$source_list\"" |
---|
3702 | [[ "$input_list" != "" ]] && mrun_com=${mrun_com}" -i \"$input_list\"" |
---|
3703 | [[ $ignore_archive_error = true ]] && mrun_com=${mrun_com}" -I" |
---|
3704 | [[ $keep_data_from_previous_run = true ]] && mrun_com=${mrun_com}" -k" |
---|
3705 | [[ "$additional_conditions" != "" ]] && mrun_com=${mrun_com}" -K \"$additional_conditions\"" |
---|
3706 | # [[ "$makefile" != "$source_path/Makefile" ]] && mrun_com=${mrun_com}" -M \"$makefile\"" |
---|
3707 | [[ "$output_list" != "" ]] && mrun_com=${mrun_com}" -o \"$output_list\"" |
---|
3708 | [[ "$read_from_config" = false ]] && mrun_com=${mrun_com}" -S" |
---|
3709 | [[ $do_trace = true ]] && mrun_com=${mrun_com}" -x" |
---|
3710 | [[ "$numprocs" != "" ]] && mrun_com=${mrun_com}" -X $numprocs" |
---|
3711 | if [[ $use_openmp = true ]] |
---|
3712 | then |
---|
3713 | mrun_com=${mrun_com}" -O" |
---|
3714 | [[ "$tasks_per_node" != "" ]] && mrun_com=${mrun_com}" -T $threads_per_task" |
---|
3715 | else |
---|
3716 | [[ "$tasks_per_node" != "" ]] && mrun_com=${mrun_com}" -T $tasks_per_node" |
---|
3717 | fi |
---|
3718 | [[ $store_on_archive_system = false ]] && mrun_com=${mrun_com}" -A" |
---|
3719 | [[ $package_list != "" ]] && mrun_com=${mrun_com}" -p \"$package_list\"" |
---|
3720 | [[ $return_password != "" ]] && mrun_com=${mrun_com}" -P $return_password" |
---|
3721 | [[ $delete_temporary_catalog = false ]] && mrun_com=${mrun_com}" -B" |
---|
3722 | [[ $node_usage != default ]] && mrun_com=${mrun_com}" -n $node_usage" |
---|
3723 | if [[ $do_remote = true ]] |
---|
3724 | then |
---|
3725 | printf "\n>>>> MRUN-command on execution host:\n>>>> $mrun_com \n" |
---|
3726 | fi |
---|
3727 | |
---|
3728 | |
---|
3729 | # ZUSAMMENSTELLUNG DES JOBSCRIPTS AUF DATEI jobfile |
---|
3730 | jobfile=jobfile.$RANDOM |
---|
3731 | |
---|
3732 | |
---|
3733 | # TEMPORAERES VERZEICHNIS GENERIEREN UND NACH DORT WECHSELN |
---|
3734 | echo "mkdir $TEMPDIR" >> $jobfile |
---|
3735 | echo "cd $TEMPDIR" >> $jobfile |
---|
3736 | |
---|
3737 | |
---|
3738 | # EVENTUELL FEHLERVERFOLGUNG AKTIVIEREN |
---|
3739 | if [[ $do_trace = true ]] |
---|
3740 | then |
---|
3741 | echo "set -x" >> $jobfile |
---|
3742 | else |
---|
3743 | echo "set +vx" >> $jobfile |
---|
3744 | fi |
---|
3745 | |
---|
3746 | |
---|
3747 | # ABSPEICHERN DER QUELLTEXTE (NUR FALLS UEBERSETZT WERDEN SOLL) |
---|
3748 | # SOWIE GEGEBENENFALLS DES MAKEFILES |
---|
3749 | if [[ $do_compile = true ]] |
---|
3750 | then |
---|
3751 | |
---|
3752 | source_catalog=SOURCES_FOR_RUN_$fname |
---|
3753 | |
---|
3754 | # UNTERVERZEICHNIS FUER QUELLTEXTE UND MAKEFILE ANLEGEN |
---|
3755 | # MRUN WIRD DIESES VRZEICHNIS UEBER ENVIRONMENT VARIABLE |
---|
3756 | # MITGETEILT (UEBERSTEUERT ANGABE IN KONFIGURATIONSDATEI) |
---|
3757 | echo "mkdir SOURCES_FOR_RUN_$fname" >> $jobfile |
---|
3758 | echo "export SOURCES_COMPLETE=true" >> $jobfile |
---|
3759 | echo "cd SOURCES_FOR_RUN_$fname" >> $jobfile |
---|
3760 | |
---|
3761 | for filename in $source_list |
---|
3762 | do |
---|
3763 | # ABDECKZEICHEN VERHINDERN, DASS ERSETZUNGEN ERFOLGEN |
---|
3764 | echo "cat > $filename << \"%END%\"" >> $jobfile |
---|
3765 | cat $source_catalog/$filename >> $jobfile |
---|
3766 | echo " " >> $jobfile |
---|
3767 | echo "%END%" >> $jobfile |
---|
3768 | echo " " >> $jobfile |
---|
3769 | done |
---|
3770 | |
---|
3771 | if [[ "$use_makefile" = true ]] |
---|
3772 | then |
---|
3773 | # ABDECKZEICHEN VERHINDERN, DASS ERSETZUNGEN ERFOLGEN |
---|
3774 | echo "cat > Makefile << \"%END%\"" >> $jobfile |
---|
3775 | cat $source_catalog/Makefile >> $jobfile |
---|
3776 | echo " " >> $jobfile |
---|
3777 | echo "%END%" >> $jobfile |
---|
3778 | echo " " >> $jobfile |
---|
3779 | fi |
---|
3780 | |
---|
3781 | echo "cd - > /dev/null" >> $jobfile |
---|
3782 | |
---|
3783 | fi |
---|
3784 | |
---|
3785 | |
---|
3786 | # ABSPEICHERN DER KONFIGURATIONSDATEI |
---|
3787 | # ABDECKZEICHEN VERHINDERN, DASS ERSETZUNGEN ERFOLGEN |
---|
3788 | echo "cat > $config_file << \"%END%\"" >> $jobfile |
---|
3789 | cat $config_file >> $jobfile |
---|
3790 | echo "%END%" >> $jobfile |
---|
3791 | echo " " >> $jobfile |
---|
3792 | |
---|
3793 | |
---|
3794 | # ABSPEICHERN DER AKTUELLEN MRUN-VERSION |
---|
3795 | # ABDECKZEICHEN VERHINDERN, DASS ERSETZUNGEN ERFOLGEN |
---|
3796 | echo "cat > $mrun_script_name <<\"%END%\"" >> $jobfile |
---|
3797 | cat ${mrun_path}/$mrun_script_name >> $jobfile |
---|
3798 | echo "%END%" >> $jobfile |
---|
3799 | if [[ $host = lctit ]] |
---|
3800 | then |
---|
3801 | echo "sed 's/bin\/ksh/home2\/usr5\/mkanda\/pub\/ksh/' < $mrun_script_name > mrun_new" >> $jobfile |
---|
3802 | echo "mv mrun_new $mrun_script_name" >> $jobfile |
---|
3803 | fi |
---|
3804 | echo "chmod u+x $mrun_script_name" >> $jobfile |
---|
3805 | echo "execute_mrun=true" >> $jobfile |
---|
3806 | echo " " >> $jobfile |
---|
3807 | |
---|
3808 | # EVTL. BENOETIGTE INPUT-DATEIEN PER FTP HOLEN ODER DEM JOB DIREKT |
---|
3809 | # MITGEBEN UND AUF DEM REMOTE-RECHNER IM BENUTZERVERZEICHNIS ABLEGEN |
---|
3810 | # FALLS DIESES NICHT EXISTIERT, WIRD VERSUCHT, DAS JEWEILS LETZTE |
---|
3811 | # UNTERVERZEICHNIS DES PFADNAMENS ANZULEGEN |
---|
3812 | if [[ $do_remote = true ]] |
---|
3813 | then |
---|
3814 | (( i = 0 )) |
---|
3815 | while (( i < iin )) |
---|
3816 | do |
---|
3817 | (( i = i + 1 )) |
---|
3818 | echo "[[ ! -d ${pathin[$i]} ]] && mkdir -p ${pathin[$i]}" >> $jobfile |
---|
3819 | if [[ "${transin[$i]}" = job ]] |
---|
3820 | then |
---|
3821 | echo "cat > ${remotepathin[$i]} <<\"%END%\"" >> $jobfile |
---|
3822 | eval cat ${pathin[$i]}/${frelin[$i]} >> $jobfile |
---|
3823 | echo " " >> $jobfile |
---|
3824 | echo "%END%" >> $jobfile |
---|
3825 | else |
---|
3826 | if [[ $filetransfer_protocol = ftp ]] |
---|
3827 | then |
---|
3828 | echo "ftpcopy -b -o -g -s $return_addres ${remotepathin[$i]} \"${pathin[$i]}\" ${frelin[$i]}" >> $jobfile |
---|
3829 | else |
---|
3830 | echo "batch_scp -b -o -g -s -u $return_username $return_addres ${remotepathin[$i]} \"${pathin[$i]}\" ${frelin[$i]}" >> $jobfile |
---|
3831 | fi |
---|
3832 | fi |
---|
3833 | |
---|
3834 | # UEBERPRUEFEN, OB DATEI ANGELEGT WERDEN KONNTE |
---|
3835 | echo "if [[ \$? = 1 ]]" >> $jobfile |
---|
3836 | echo "then" >> $jobfile |
---|
3837 | echo " echo \" \" " >> $jobfile |
---|
3838 | echo " echo \"+++ file ${remotepathin[$i]} could not be created\" " >> $jobfile |
---|
3839 | echo " echo \" please check, if directory exists on $host!\" " >> $jobfile |
---|
3840 | echo " echo \"+++ MRUN will not be continued\" " >> $jobfile |
---|
3841 | echo " execute_mrun=false" >> $jobfile |
---|
3842 | echo "fi" >> $jobfile |
---|
3843 | done |
---|
3844 | fi |
---|
3845 | |
---|
3846 | # ARBEITSKATALOG AUF DER LOKALEN MASCHINE FUER EVENTUELLE |
---|
3847 | # FORTSETZUNGSLAUEFE PER ENV-VARIABLE UEBERGEBEN |
---|
3848 | echo "LOCAL_PWD=$working_directory" >> $jobfile |
---|
3849 | echo "export LOCAL_PWD" >> $jobfile |
---|
3850 | |
---|
3851 | # EBENSO LOKALEN MRUN-KATALOG UEBERGEBEN |
---|
3852 | echo "LOCAL_MRUN_PATH=$mrun_path" >> $jobfile |
---|
3853 | echo "export LOCAL_MRUN_PATH" >> $jobfile |
---|
3854 | |
---|
3855 | # echo "for_subjob_to_do=\"rm -rf $TEMPDIR\" " >> $jobfile |
---|
3856 | |
---|
3857 | # MRUN AUF ZIELRECHNER AUFRUFEN |
---|
3858 | echo "set -x" >> $jobfile |
---|
3859 | echo "[[ \$execute_mrun = true ]] && ./$mrun_com" >> $jobfile |
---|
3860 | |
---|
3861 | echo 'ls -al; echo `pwd`' >> $jobfile |
---|
3862 | echo "cd \$HOME" >> $jobfile |
---|
3863 | echo "rm -rf $TEMPDIR" >> $jobfile |
---|
3864 | |
---|
3865 | |
---|
3866 | |
---|
3867 | |
---|
3868 | # JOB PER SUBJOB STARTEN |
---|
3869 | if [[ $silent = false ]] |
---|
3870 | then |
---|
3871 | printf "\n " |
---|
3872 | else |
---|
3873 | printf "\n\n" |
---|
3874 | fi |
---|
3875 | |
---|
3876 | subjob $job_on_file -h $host -u $remote_username -q $queue -m $memory -N $node_usage -t $cpumax $XOPT $TOPT $OOPT -n $fname -f $filetransfer_protocol -v $jobfile |
---|
3877 | rm -rf $jobfile |
---|
3878 | |
---|
3879 | |
---|
3880 | fi # ENDE REMOTE-TEIL |
---|
3881 | |
---|
3882 | |
---|
3883 | |
---|
3884 | # ENDE DER PROZEDUR |
---|