source: palm/trunk/SCRIPTS/mrun @ 122

Last change on this file since 122 was 122, checked in by letzel, 17 years ago

Adjustments to mrun and subjob for lctit

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