source: palm/tags/release-4.0/SCRIPTS/mrun @ 4106

Last change on this file since 4106 was 1492, checked in by heinze, 9 years ago

last commit documented

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