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