source: palm/tags/release-3.3/SCRIPTS/mrun @ 336

Last change on this file since 336 was 97, checked in by raasch, 17 years ago

New:
---
ocean version including prognostic equation for salinity and equation of state for seawater. Routine buoyancy can be used with both temperature and density.
+ inipar-parameters bc_sa_t, bottom_salinityflux, ocean, sa_surface, sa_vertical_gradient, sa_vertical_gradient_level, top_salinityflux

advec_s_bc, average_3d_data, boundary_conds, buoyancy, check_parameters, data_output_2d, data_output_3d, diffusion_e, flow_statistics, header, init_grid, init_3d_model, modules, netcdf, parin, production_e, prognostic_equations, read_var_list, sum_up_3d_data, swap_timelevel, time_integration, user_interface, write_var_list, write_3d_binary

New:
eqn_state_seawater, init_ocean

Changed:


inipar-parameter use_pt_reference renamed use_reference

hydro_press renamed hyp, routine calc_mean_pt_profile renamed calc_mean_profile

format adjustments for the ocean version (run_control)

advec_particles, buoyancy, calc_liquid_water_content, check_parameters, diffusion_e, diffusivities, header, init_cloud_physics, modules, production_e, prognostic_equations, run_control

Errors:


Bugfix: height above topography instead of height above level k=0 is used for calculating the mixing length (diffusion_e and diffusivities).

Bugfix: error in boundary condition for TKE removed (advec_s_bc)

advec_s_bc, diffusion_e, prognostic_equations

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