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