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