source: palm/trunk/SCRIPTS/mrun @ 120

Last change on this file since 120 was 118, checked in by raasch, 17 years ago

preliminary adjustments for mrun and mbuild to tsubame

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