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