source: palm/trunk/SCRIPTS/mrun @ 1099

Last change on this file since 1099 was 1099, checked in by raasch, 11 years ago

adjustments for Forwind cluster (lcflow) and Kuyshu University computing center (hayaka -lckyuh); further small adjustments for lckyut

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