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