source: palm/tags/release-3.2b/SCRIPTS/mrun @ 2007

Last change on this file since 2007 was 83, checked in by raasch, 17 years ago

New:
---

Changed:


PALM can be generally installed on any kind of Linux-, IBM-AIX-, or NEC-SX-system by adding appropriate settings to the configuration file.

Scripts are also running under the public domain ksh.

All system relevant compile and link options as well as the host identifier (local_host) are specified in the configuration file.

Filetransfer by ftp removed (options -f removed from mrun and mbuild).

Call of (system-)FLUSH routine moved to new routine local_flush.

return_addres and return_username are read from ENVPAR-NAMELIST-file instead of using local_getenv.

Preprocessor strings for different linux clusters changed to "lc", some preprocessor directives renamed (new: intel_openmp_bug), preprocessor directives for old systems removed

advec_particles, check_open, cpu_log, cpu_statistics, data_output_dvrp, flow_statistics, header, init_dvrp, init_particles, init_1d_model, init_dvrp, init_pegrid, local_getenv, local_system, local_tremain, local_tremain_ini, modules, palm, parin, run_control

new:
local_flush

mbuild, mrun

Errors:


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