source: palm/trunk/SCRIPTS/palmrun @ 2821

Last change on this file since 2821 was 2799, checked in by raasch, 7 years ago

parameters are allowed in output commands (OC:)

  • Property svn:executable set to *
  • Property svn:keywords set to Rev
File size: 95.5 KB
RevLine 
[2380]1#!/bin/bash
2
3# palmrun - script for running PALM jobs
4
5#--------------------------------------------------------------------------------#
[2696]6# This file is part of the PALM model system.
[2380]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#
[2718]19# Copyright 2017-2018  Leibniz Universitaet Hannover
[2380]20#--------------------------------------------------------------------------------#
21#
22# Current revisions:
23# ------------------
24#
[2410]25#
[2380]26# Former revisions:
27# -----------------
[2732]28# $Id: palmrun 2718 2018-01-02 08:49:38Z maronga $
[2799]29# parameters are allowed in output commands (OC:)
30#
31# 2718 2018-01-02 08:49:38Z maronga
[2789]32# bugfix: exit if no queue has been given neither with option -q nor in the
33# configuration file
34#
35# 2718 2018-01-02 08:49:38Z maronga
[2762]36# file connection file from trunk/SCRIPTS is taken by default
37#
38# 2718 2018-01-02 08:49:38Z maronga
[2716]39# Corrected "Former revisions" section
40#
41# 2696 2017-12-14 17:12:51Z kanani
42# Change in file header (GPL part)
43#
44# 2693 2017-12-13 12:33:49Z raasch
[2693]45# replacement of variables given by {{<variable>}} in configuration file is now
46# done in a more general way, variable names are written in small letters
47#
48# 2670 2017-12-06 16:32:19Z raasch
[2670]49# test printouts removed
50#
51# 2669 2017-12-06 16:03:27Z raasch
[2669]52# file attributes in .palm.iofiles restructured, "loc" attribute completely
53# removed,
54# wildcard (*) allowed in .palm.iofiles as file activation string for output
55# files,
56# informative messages in case of missing optional input files shortened
57# bugfix: variable cycle explicitly interpreted with 10 as the number base
58#
59# 2638 2017-11-23 12:44:23Z raasch
[2610]60# use of wildcards in file connection statements enabled
61#
62# 2605 2017-11-09 15:31:46Z raasch
[2605]63# in case of remote jobs, input files with "job" or "jobopt" (new) attribute
64# will not be sent with the job file any more, but copied into the
[2610]65# SOURCES_FOR_RUN... folder on the remote host, before the job is submitted
[2605]66#
67# 2600 2017-11-01 14:11:20Z raasch
[2600]68# cycle numbers are made three digits wide
69#
70# 2566 2017-10-20 08:50:47Z raasch
[2566]71# execute command for combine_plot_fields added
72# "TEMPDIR" renamed "tempdir"
73# temporary working directory for local batch jobs is created immediately within
74# the user's palmrun call, due to a requirement of the "grid engine" batch
75# system, where the working directory is given with batch directive -wd and must
76# already exist when the job is submitted,
77# informative messages in non-trace mode reduced and partly reformatted
78#
79# 2551 2017-10-18 07:25:11Z raasch
[2551]80# TEMPDIR added as replacement string to be used in batch directives
81#
82# 2512 2017-10-04 08:26:59Z raasch
[2507]83# bugfix for determining cycle numbers of NetCDF input files
84#
85# 2506 2017-09-29 08:30:37Z raasch
[2506]86# option -V added to check for an existing SOURCES_FOR_RUN_... folder
87# host configuration added to SOURCES_FOR_RUN_... folder name
88# host_identifier renamed host_configuration
89# option -W added to allow for job dependencies
90#
91# 2501 2017-09-26 11:41:55Z raasch
[2501]92# default value for number of cores (option -X) set to 1
93# bugfix for mechanism which overwrites configuration file settings with values
94# provided by palmrun options
95#
96# 2499 2017-09-22 16:47:58Z kanani
[2499]97# option -h named configuration identifier
98#
99# 2480 2017-09-19 06:24:14Z maronga
[2480]100# bugfix for last revision
101#
102# 2479 2017-09-19 06:12:16Z raasch
[2479]103# option -A (project account number) added
104#
105# 2422 2017-09-08 08:25:41Z raasch
[2410]106# initial revision
[2380]107#
108#--------------------------------------------------------------------------------#
109# palmrun - script for running PALM jobs on local and remote hosts
110#--------------------------------------------------------------------------------#
111
112
113 
114    # DECLARATION OF VARIABLES AND THEIR DEFAULT VALUES
115
116 set +o allexport    # SUPPRESS EXPORT OF ALL VARIABLES, SINCE IN THE PAST THIS
117                     # LEAD TO PROBLEMS IN ROUTINES CALLED BY PALMRUN
118                     # (TOO MANY ARGUMENTS - PROBLEM)
119 set +o noclobber    # EXISTING FILES ARE ALLOWED TO BE OVERWRITTEN
120
[2610]121 typeset -i  ibd=0 ibdt=0 iec=0 iic=0 iin=0 ioc=0 iout=0 nr_of_input_files=0
122 typeset -i  nr_of_output_files=0
[2380]123 typeset -x -i  memory=0   # HAS TO BE EXPORTED HERE, OTHERWISE AN UNKNOWN SIDE
124                           # SIDE EFFECT MAY CAUSE DATA LOSS WHEN GETOPTS IS READING THE
125                           # SCRIPT-OPTION ARGUMENTS
126 typeset -i  cores cputime cpu_hours cpu_minutes cpu_seconds i ii iia iii iio
127 typeset -i  icycle inode ival maxcycle mpi_tasks
128 typeset -i  nodes remaining_cores run_number tasks_per_node threads_per_task
129
130 activation_string_list=""
131 AddFilenames=""
132 combine_plot_fields=true
133 compiler_name=""
134 compiler_name_ser=""
135 compiler_options=""
[2501]136 cores=1
[2380]137 cores_atmos=0
138 cores_ocean=0
139 coupled_dist=""
140 cpp_options=""
141 cpumax=0
[2506]142 create_batch_job=false
[2380]143 create_jobfile_only=false
144 create_remote_batch_job=false
145 dashes="  ----------------------------------------------------------------------------"
146 defaultqueue=""
[2506]147 delete_temporary_catalog=true
[2380]148 do_compile=true
149 do_trace=false
150 executable=""
151 execute_command=""
152 execution_error=false
[2762]153 fileconnection_file=trunk/SCRIPTS/.palm.iofiles
[2380]154 fname=test
155 global_revision=""
[2506]156 host_configuration="default"
[2380]157 hostfile=""
158 hp=""
159 keep_data_from_previous_run=false
160 link_local_input=false
161 link_local_output=false
[2388]162 linker_options=""
[2385]163 local_jobcatalog=""
[2380]164 locat=normal
165 makefile=""
166 max_par_io_str=""
167 prc=$0
168 while [[ $(echo $prc | grep -c "/") != 0 ]]
169 do
170    prc=`echo $prc | cut -f2- -d"/"`
171 done
172 module_calls=""
[2506]173 palmrun_memory=""
[2380]174 palmrun_script_name=$prc
175 openmp=false
[2506]176 previous_job=""
[2479]177 project_account=""
[2380]178 queue=none
179 restart_run=false
180 return_address=""
[2385]181 remote_jobcatalog=""
[2380]182 remote_username=""
183 running_in_batch_mode=false
184 run_coupled_model=false
185 run_id=""
186 silent=false
187 source_list=""
188 source_path=""
[2501]189 tasks_per_node=0
[2380]190 threads_per_task=1
191 transfer_problems=false
[2384]192 user_source_path=""
[2506]193 use_existing_sources_folder=""
[2380]194 use_openmp=false
[2732]195 version="palmrun  1.0 Rev$Rev: 2799 $"
[2380]196 working_directory=`pwd`
197 write_binary=""
198 TOPT=""
199
200
201    # ERROR HANDLING IN CASE OF EXIT
[2404]202 trap 'if [[ $locat != normal  &&  $locat != control_c ]]
[2380]203       then
204
205              # CARRY OUT ERROR-COMMANDS GIVEN IN THE CONFIGURATION FILE (EC:)
206          (( i = 0 ))
207          while (( i < iec ))
208          do
209             (( i = i + 1 ))
210             printf "\n  *** Execution of ERROR-command:\n"
211             printf "  >>> ${err_command[$i]}\n"
212             eval  ${err_command[$i]}
213          done
[2566]214          [[ $delete_temporary_catalog = true ]]  &&  (cd; rm -rf $tempdir)
[2380]215          printf "\n\n+++ palmrun killed \n\n"
216       elif [[ $locat != control_c ]]
217       then
[2566]218          printf "\n --> palmrun finished\n\n"
[2380]219       fi' exit
220
221
222    # ACTIONS IN CASE OF TERMINAL-BREAK (CONTROL-C):
[2566]223 trap 'cd; rm -rf $tempdir
[2380]224       printf "\n+++ palmrun killed by \"^C\" \n\n"
225       locat=control_c
226       exit
227      ' 2
228
229
230    # READ SHELLSCRIPT-OPTIONS AND REBUILD THE PALMRUN-COMMAND STRING (prc),
231    # WHICH WILL BE USED TO START RESTART-JOBS
[2506]232 while  getopts  :a:A:bBCd:FG:h:jkm:M:O:q:r:R:s:t:T:u:U:vVw:W:xX:yY:Z option
[2380]233 do
234   case  $option  in
235       (a)   activation_string_list=$OPTARG; prc="$prc -a'$OPTARG'";;
[2479]236       (A)   project_account=$OPTARG; prc="$prc -A'$OPTARG'";;
[2380]237       (b)   create_batch_job=true; prc="$prc -b";;
238       (B)   delete_temporary_catalog=false; prc="$prc -B";;
239       (C)   restart_run=true; prc="$prc -C";;
240       (d)   fname=$OPTARG; prc="$prc -d$OPTARG";;
241       (F)   create_jobfile_only=true;;
242       (G)   global_revision=$OPTARG; prc="$prc -G'$OPTARG'";;
[2506]243       (h)   host_configuration=$OPTARG; prc="$prc -h$OPTARG";;
[2380]244       (j)   running_in_batch_mode=true;;
245       (k)   keep_data_from_previous_run=true; prc="$prc -k";;
[2501]246       (m)   palmrun_memory=$OPTARG; prc="$prc -m$OPTARG";;
[2380]247       (M)   makefile=$OPTARG; prc="$prc -M$OPTARG";;
248       (O)   use_openmp=true; threads_per_task=$OPTARG; prc="$prc -O$OPTARG";;
249       (q)   queue=$OPTARG; prc="$prc -q$OPTARG";;
250       (r)   run_id=$OPTARG;;
251       (R)   return_address=$OPTARG;;
252       (s)   source_list=$OPTARG;;
[2501]253       (t)   palmrun_cpumax=$OPTARG; prc="$prc -t$OPTARG";;
[2380]254       (T)   palmrun_tasks_per_node=$OPTARG; prc="$prc -T$OPTARG";;
255       (u)   remote_username=$OPTARG; prc="$prc -u$OPTARG";;
256       (U)   return_username=$OPTARG; prc="$prc -U$OPTARG";;
257       (v)   silent=true; prc="$prc -v";;
[2506]258       (V)   use_existing_sources_folder="-V";;
[2380]259       (w)   max_par_io_str=$OPTARG; prc="$prc -w$OPTARG";;
[2506]260       (W)   previous_job=$OPTARG;;
[2380]261       (x)   do_trace=true;set -x; prc="$prc -x";;
[2501]262       (X)   palmrun_cores=$OPTARG; prc="$prc -X$OPTARG";;
[2380]263       (y)   ocean_file_appendix=true; prc="$prc -y";;
264       (Y)   run_coupled_model=true; coupled_dist=$OPTARG; prc="$prc -Y'$OPTARG'";;
265       (Z)   combine_plot_fields=false; prc="$prc -Z";;
266       (\?)  printf "\n  +++ unknown option $OPTARG \n"
267             printf "\n  --> type \"$0 ?\" for available options \n"
268             locat=parameter;exit;;
269   esac
270 done
271
272
273    # SKIP GIVEN OPTIONS TO READ POSITIONAL PARAMETER, IF GIVEN
274    # CURRENTLY ONLY PARAMETER ? (TO OUTPUT A SHORT COMMAND INFO) IS ALLOWED
275 (( to_shift = $OPTIND - 1 ))
276 shift $to_shift
277
278    # PRINT SHORT DESCRIPTION OF PALMRUN OPTIONS
279 if [[ "$1" = "?" ]]
280 then
281   (printf "\n  *** Description of available palmrun options:\n"
282    printf "\n      Option  Description                              Default-Value"
283    printf "\n        -a    activation string list                   \"\" "
[2479]284    printf "\n        -A    project account number                   ---"
[2380]285    printf "\n        -b    batch-job on local machine               ---"
286    printf "\n        -B    do not delete temporary directory at end ---"
287    printf "\n        -d    base name of files attached to program   test"
288    printf "\n        -F    create batch job file only               ---"
[2506]289    printf "\n        -h    host configuration                       \"default\" "
[2380]290    printf "\n        -k    keep data from previous run"
291    printf "\n        -m    memory demand in MB (batch-jobs)         0 MB"
292    printf "\n        -M    Makefile name                            Makefile"
293    printf "\n        -O    threads per openMP task                  ---"
294    printf "\n        -q    queue                                    \"$queue\" "
295    printf "\n        -s    filenames of routines to be compiled     \"\" "
296    printf "\n              must end with .f, .f90, .F, or .c !"
297    printf "\n              use \"..\" for more than one file and wildcards"
298    printf "\n              -s LM compiles all locally modified files"
299    printf "\n        -t    allowed cpu-time in seconds (batch)      0"
[2384]300    printf "\n        -T    tasks per node                           ---"
[2380]301    printf "\n        -u    username on remote machine               \"\" "
302    printf "\n        -v    no prompt for confirmation               ---"
[2506]303    printf "\n        -V    check if SOURCES_FOR_RUN_... exists      ---"
[2380]304    printf "\n        -w    maximum parallel io streams              as given by -X"
[2506]305    printf "\n        -W    name of job to wait for                  ---"
[2380]306    printf "\n        -x    tracing of palmrun for debug purposes    ---"
307    printf "\n        -X    # of processors (on parallel machines)   1"
308    printf "\n        -y    add appendix \"_O\" to all local output"
309    printf "\n              files (ocean precursor runs followed by"
310    printf "\n              coupled atmosphere-ocean runs)           ---"
311    printf "\n        -Y    run coupled model, \"#1 #2\" with" 
312    printf "\n              #1 atmosphere and #2 ocean processors    \"#/2 #/2\" depending on -X"
313    printf "\n        -Z    skip combine_plot_fields at the end of      "
314    printf "\n              the simulation                           ---"
315    printf "\n "
316    printf "\n      Possible values of positional parameter <modus>:"
317    printf "\n        \"?\"       -  this outline \n\n") | more
318    exit
319 elif [[ "$1" != "" ]]
320 then
321    printf "\n  +++ positional parameter $1 unknown \n"
322    locat=parameter; exit
323 fi
324
325
326
327    # SHORT STARTING MESSAGE
328 printf "\n*** $version "
329 printf "\n    will be executed.     Please wait ..."
330
331
[2506]332    # BUILD THE CONFIGURATION-FILE NAME AND THE SOURCES_FOR_RUN-FOLDER NAME
333 config_file=.palm.config.$host_configuration
334 sources_for_run_catalog=SOURCES_FOR_RUN_${host_configuration}_$fname
[2380]335
336
337    # CHECK, IF CONFIGURATION FILE EXISTS
338 if [[ ! -f $config_file ]]
339 then
340    printf "\n\n  +++ configuration file: "
341    printf "\n           $config_file"
342    printf "\n      does not exist"
343    locat=connect; exit 
344 fi
345
346
[2762]347    # CHECK, IF USER PROVIDES OWN FILE CONNECTION FILE
348 if [[ -f .palm.iofiles ]]
349 then
350    fileconnection_file=.palm.iofiles
351 fi
352
353
[2380]354    # CHECK, IF FILE CONNECTION FILE EXISTS
355 if [[ ! -f $fileconnection_file ]]
356 then
357    printf "\n\n  +++ file connection file: "
358    printf "\n           $fileconnection_file"
359    printf "\n      does not exist"
360    locat=connect; exit 
361 fi
362
363
[2404]364    # CHECK, IF THE ACTIVATION_STRING_LIST HAS BEEN GIVEN
365 if [[ "$activation_string_list" = "" ]]
366 then
367    printf "\n\n  +++ no activation string list given: "
368    printf "\n        please set palmrun option \"-a\" "
369    locat=palmrun_option; exit 
370 fi
371
372
373    # SET VARIABLE TO ACTIVATE PALM BINARY OUTPUT FOR RESTARTS
374 if [[ $(echo $activation_string_list | grep -c "restart") != 0 ]]
375 then
376    write_binary=true
377 else
378    write_binary=false
379 fi
380
381
[2380]382    # READ AND EVALUATE THE CONFIGURATION-FILE
383 [[ $silent = false ]]  &&  printf "\n\n    Reading the configuration file... "
384
385    # READ VARIABLE SETTINGS FROM CONFIG FILE LINE BY LINE
386 while  read line
387 do
388
389       # FIRST REPLACE ENVIRONMENT-VARIABLES BY THEIR RESPECTIVE VALUES
390    eval  line=\"$line\"
391
392
393       # INTERPRET THE LINE
394    if [[ "$(echo $line)" = "" ]]
395    then
396
397          # EMPTY LINE, NO ACTION
398       continue
399
400    elif [[ "$(echo $line | cut -c1)"  =  "#" ]]
401    then
402
403          # LINE IS A COMMENT LINE
404       continue
405
406    elif [[ "$(echo $line | cut -c1)"  =  "%" ]]
407    then
408
409          # LINE DEFINES AN ENVIRONMENT-VARIABLE
410       var=`echo $line | cut -d" " -s -f1 | cut -c2-`
411       value=`echo $line | cut -d" " -s -f2-`
412
413
414          # VALUE FROM THE CONFIGURATION-FILE IS ASSIGNED TO THE
415          # ENVIRONMENT-VARIABLE, BUT ONLY IF NO VALUE HAS BEEN ALREADY
416          # ASSIGNED WITHIN THIS SCRIPT (E.G. BY SCRIPT-OPTIONS).
417          # NON-ASSIGNED VARIABLES HAVE VALUE "" OR 0 (IN CASE OF INTEGER).
418          # HENCE THE GENERAL RULE IS: SCRIPT-OPTION OVERWRITES THE
419          # CONFIGURATION-FILE.
420       if [[ "$(eval echo \$$var)" = ""  ||  "$(eval echo \$$var)" = "0" ]]
421       then
422          eval  export  $var="\$value"
423
424             # TERMINAL OUTPUT OF ENVIRONMENT-VARIABLES, IF TRACEBACK IS SWITCHED on
425          if [[ $do_trace = true ]]
426          then
427             printf "\n*** ENVIRONMENT-VARIABLE $var = $value"
428          fi
429       fi
430
431    elif [[ "$(echo $line | cut -c1-3)" = "BD:" ]]
432    then
433
434          # LINE DEFINES BATCH-DIRECTIVE
435       (( ibd = ibd + 1 ))
436       line=$(echo $line | cut -c4-)
437       batch_directive[$ibd]="$line"
438
439    elif [[ "$(echo $line | cut -c1-4)" = "BDT:" ]]
440    then
441
442          # LINE DEFINES BATCH-DIRECTIVE FOR SENDING BACK THE JOBFILE FROM A
443          # REMOTE TO A LOCAL HOST
444       (( ibdt = ibdt + 1 ))
445       line=$(echo $line | cut -c5-)
446       batch_directive_transfer[$ibdt]="$line"
447
448    elif [[ "$(echo $line | cut -c1-3)" = "EC:" ]]
449    then
450
451          # LINE DEFINES ERROR-COMMAND
452       (( iec = iec + 1 ))
453       line=$(echo $line | cut -c4-)
454       err_command[$iec]="$line"
455
456    elif [[ "$(echo $line | cut -c1-3)" = "IC:" ]]
457    then
458
459          # LINE DEFINES INPUT-COMMAND
460       (( iic = iic + 1 ))
461       line=$(echo $line | cut -c4-)
462       in_command[$iic]="$line"
463
464    elif [[ "$(echo $line | cut -c1-3)" = "OC:" ]]
465    then
466
467          # LINE DEFINES OUTPUT-COMMAND
468       (( ioc = ioc + 1 ))
469       line=$(echo $line | cut -c4-)
470       out_command[$ioc]="$line"
471
472    else
473
474          # SKIP ALL OTHER LINES
475       continue
476
477    fi
478
479 done < $config_file
480
481
482    # CHECK SETTING OF REQUIRED PARAMETERS
483 if [[ "$compiler_name" = "" ]]
484 then
485    printf "\n  +++ no compiler name found in $config_file"
486    printf "\n      Please add line \"compiler_name ...\" to that file."
487    locat=config_file; exit
488 fi
489 if [[ "$compiler_name_ser" = "" ]]
490 then
491    printf "\n  +++ no compiler name for non-paralle compilation found in $config_file"
492    printf "\n      Please add line \"compiler_name_ser ...\" to that file."
493    locat=config_file; exit
494 fi
495 if [[ "$compiler_options" = "" ]]
496 then
497    printf "\n  +++ no compiler options found in $config_file"
498    printf "\n      Please add line \"compiler_options ...\" to that file."
499    locat=config_file; exit
500 fi
[2388]501 if [[ "$linker_options" = "" ]]
[2380]502 then
[2388]503    printf "\n  +++ no linker options found in $config_file"
504    printf "\n      Please add line \"linker_options ...\" to that file."
[2380]505    locat=config_file; exit
506 fi
507 if [[ "$execute_command" = "" ]]
508 then
509    printf "\n  +++ no execute command found in $config_file"
510    printf "\n      Please add line \"execute_command ...\" to that file."
511    locat=config_file; exit
512 fi
513
514 if [[ "$hostfile" != "" ]]
515 then
516    if [[ $hostfile != auto  &&  ! -f $hostfile ]]
517    then
518       printf "\n  +++ no hostfile \"$hostfile\" found"
519       printf "\n      Please check line \"hostfile ...\" in $config_file"
520       locat=config_file; exit   
521    fi
522 fi
523
524
525    # DETERMINE THE CALL STATUS
526 if [[ "$return_address" != "" ]]
527 then
528 
529       # I AM RUNNING ON A REMOTE HOST, WHICH ALSO MEANS THAT I AM RUNNING IN
530       # BATCH MODE AND ...
531    running_on_remote=true
532 
533 else
534
535       # I HAVE BEEN CALLED INTERACTIVELY ON THIS HOST
536     if [[ "$remote_ip" != "" ]]
537     then
538
539           # I HAVE TO CREATE A BATCH JOB TO RUN PALM ON THE REMOTE HOST
540        create_remote_batch_job=true
541
542     fi
543     running_on_remote=false
544 fi
545
546
547
548    # READ AND EVALUATE THE I/O-FILE LIST
549 [[ $silent = false ]]  &&  printf "\n    Reading the I/O files... "
550
551    # READ THE FILE CONNECTION FILE LINE BY LINE
552 while  read line
553 do
554
[2669]555       # REPLACE REPEATING SPACES BETWEEN THE COLUMNS BY A SINGLE SPACE
556    line=`echo "$line" | sed -e "s/\s\{1,\}/ /g"`
[2380]557
558       # INTERPRET THE LINE
559    if [[ "$(echo $line)" = "" ]]
560    then
561          # EMPTY LINE, NO ACTION
562       continue
563
564    elif [[ "$(echo $line | cut -c1)"  =  "#" ]]
565    then
566
567          # LINE IS A COMMENT LINE
568       true
569
570    else
571
572          # LINE DEFINES FILE CONNECTION. READ THE FILE ATTRIBUTES.
573          # s2a: in/out - field
[2669]574          # s2b: action - field (optional)
575       s1=`echo "$line" | cut -d" " -f1`
576       s2=`echo "$line" | cut -d" " -s -f2`
[2380]577       if [[ $(echo $s2 | grep -c ":") = 0 ]]
578       then
[2669]579          s2a=$s2
[2380]580          s2b=""
581       else
[2669]582          s2a=`echo $s2 | cut -d":" -f1`
583          s2b=`echo $s2 | cut -d":" -f2`
[2380]584       fi
[2669]585       s3=`echo "$line" | cut -d" " -f3 | sed 's/*/wildcard /g'`
586       s4=`echo "$line" | cut -d" " -s -f4`
587       eval s4=\"$s4\"    # REPLACE ENVIRONMENT-VARIABLES IN PATH BY THEIR RESPECTIVE VALUES
588       s5=`echo "$line" | cut -d" " -s -f5`
589       s6=`echo "$line" | cut -d" " -s -f6`
[2380]590
591       
592          # STORE FILE CONNECTION, IF ACTIVATED BY ACTIVATION-STRING FROM
593          # INPUT- OR OUTPUT-LIST.
594          # VARIABLE S3 MAY CONTAIN A LIST OF ACTIVATION STRINGS (FIELD-SEPERATOR ":").
595          # IF EXECUTION IS SCHEDULED FOR A REMOTE-MACHINE AND THE FILE IS ONLY
[2669]596          # LOCALLY REQUIRED ON THAT MACHINE (I.E. s2b != tr), THE FILE CONNECTION
[2380]597          # IS NOT CHECKED AND STORED.
[2610]598       IFSALT="$IFS"; IFS="$IFS:"      # ADD ":" AS FIELD SEPARATOR
[2669]599       if [[ ( "$s2a" = in  || "$s2a" = inopt )  &&  ! ( $create_remote_batch_job = true  &&  "$s2b" != tr ) ]]
[2380]600       then
601          found=false
602          for  actual  in  $activation_string_list
603          do
604             for  formal  in  $s3
605             do
606                [[ $actual = $formal  ||  "$formal" = "-" ]]  &&  found=true
607             done
608          done
609          if [[ $found = true ]]
610          then
611             (( iin = iin + 1 ))
[2669]612             localin_pre[$iin]=$s1; actionin_pre[$iin]=$s2b;
[2610]613             pathin_pre[$iin]=$s4; endin_pre[$iin]=$s5; extin_pre[$iin]=$s6
[2669]614             if [[ "$s2a" = inopt ]]
615             then
616                optin_pre[$iin]=yes
617             else
618                optin_pre[$iin]=no
619             fi 
[2605]620
621                # FILES WITH JOB-ATTRIBUTE ARE STORED IN THE SOURCES_FOR_RUN
622                # FOLDER IF THE JOB IS RUNNING ON A REMOTE HOST
[2669]623             if [[ $running_on_remote = true  &&  "$s2b" = tr ]]
[2605]624             then
[2610]625                pathin_pre[$iin]=${fast_io_catalog}/${sources_for_run_catalog}
[2605]626             fi
627
[2610]628                # CHECK FOR MULTIPLE FILES, SET A RESPECTIVE FLAG AND REMOVE
629                # THE WILDCARD FROM THE ENDING
630             if [[ "${s5: -1}" = "*" ]]
631             then
[2669]632                if [[ "$s2b" = "di" ]]
[2610]633                then
634                   printf "\n    +++ wildcards (*) not allowed with \"di\" file attribute."
635                   printf "\n        see file \"$fileconnection_file\", line"
636                   printf "\n$line"
637                   locat=iofiles_file; exit
638                fi
639                multin[$iin]=true
640                string=${endin_pre[$iin]}
641                endin_pre[$iin]="${string%?}"
642             else
643                multin[$iin]=false
644             fi
[2380]645          fi
[2669]646       elif [[ "$s2a" = out  &&  ! ( $create_remote_batch_job = true ) ]]
[2380]647       then
648          found=false
649          for  actual  in  $activation_string_list
650          do
651             for  formal  in  $s3 
652             do
[2670]653                [[ $actual = $formal  ||  $formal = wildcard  ]]  &&  found=true
[2380]654             done
655          done
656          if [[ $found = true ]]
657          then
658             (( iout = iout + 1 ))
[2669]659             localout_pre[$iout]=$s1; actionout_pre[$iout]=$s2b
[2610]660             pathout_pre[$iout]=$s4; endout_pre[$iout]=$s5; extout_pre[$iout]=$s6
661
[2669]662                # CHECK IF WILDCARD IS USED AS ACTIVATION STRING
663                # IN SUCH CASES, NO WARNING WILL LATER BE OUTPUT IF LOCAL FILES DO NOT EXIST
664             if [[ $formal = wildcard  ]]
665             then
666                warnout_pre[$iout]=false
667             else
668                warnout_pre[$iout]=true
669             fi
670
[2610]671                # CHECK FOR MULTIPLE FILES, SET A RESPECTIVE FLAG AND REMOVE
672                # THE WILDCARD FROM THE LOCAL FILENAME
673             if [[ "${s1: -1}" = "*" ]]
674             then
[2669]675                if [[ "$s2b" = "di" ]]
[2610]676                then
677                   printf "\n    +++ wildcards (*) not allowed with \"di\" file attribute."
678                   printf "\n        see file \"$fileconnection_file\", line"
679                   printf "\n$line"
680                   locat=iofiles_file; exit
681                fi
682                multout[$iout]=true
683                string=${localout_pre[$iout]}
684                localout_pre[$iout]="${string%?}"
685             else
686                multout[$iout]=false
687             fi
[2380]688          fi
[2669]689       elif [[ "$s2a" != in  &&  "$s2a" != inopt  &&  "$s2a" != out ]]
[2380]690       then
[2669]691          printf "\n  +++ I/O-attribute in file $fileconnection_file has invalid"
692          printf "\n      value \"$s2\". Only \"in\", \"inopt\", and \"out\" are allowed!"
[2380]693          locat=connect; exit
694       fi
695       IFS="$IFSALT"
696    fi
697
698 done < $fileconnection_file
699
700
701
[2501]702    # VALUES OF PALMRUN-OPTIONS OVERWRITE THOSE FROM THE CONFIGURATION-FILE
[2506]703 [[ $palmrun_memory     != ""   ]]  &&  memory=$palmrun_memory
[2501]704 [[ $palmrun_cpumax     != ""   ]]  &&  cpumax=$palmrun_cpumax
705 [[ "$palmrun_cores" != ""  ]]  &&  cores=$palmrun_cores
706 [[ "$max_par_io_str" != "" ]]  &&  maximum_parallel_io_streams=$max_par_io_str
707 [[ "$palmrun_tasks_per_node" != "" ]]  &&  tasks_per_node=$palmrun_tasks_per_node
708
709
710
[2380]711      # EVALUATE MODEL COUPLING FEATURES (OPTION -Y)
712 if [[ $run_coupled_model = true ]] 
713 then
714
715    cores_atmos=`echo $coupled_dist | cut -d" " -s -f1`
716    cores_ocean=`echo $coupled_dist | cut -d" " -s -f2`
717
718    if (( $cores_ocean + $cores_atmos != $cores ))
719    then
720
721       printf "\n  +++ number of processors does not fit to specification by \"-Y\"."
722       printf "\n      PEs (total)     : $cores"
723       printf "\n      PEs (atmosphere): $cores_atmos"
724       printf "\n      PEs (ocean)     : $cores_ocean"
725       locat=coupling; exit
726
727    fi
728
729 fi
730
731
732    # IF I AM IN BATCH MODE, CHECK IF EXECUTABLE AND OTHER REQUIRED FILES
733    # HAVE BEEN GENERATED BY PALMBUILD AND STORED IN THE SOURCES_FOR_RUN_...
734    # FOLDER
735 if [[ $running_in_batch_mode = true ]]
736 then
737 
[2506]738    if [[ ! -d ${fast_io_catalog}/${sources_for_run_catalog} ]]
[2380]739    then
[2506]740       printf "\n  +++ directory ${fast_io_catalog}/${sources_for_run_catalog} is missing"
[2380]741       printf "\n      Please check the output of the palmrun-call"
742       printf "\n      that you did on your local host."
743       locat=SOURCES_FOR_RUN; exit
744    fi
745
746 else
747
748       # CREATE THE SOURCES_FOR_RUN_... FOLDER, BUT NOT IF I AM PART OF AN
749       # AUTOMATIC RESTART RUN
750       # AUTOMATIC RESTART RUNS JUST ACCESS THE DIRECTORY CREATED BY THE INITIAL RUN
751    if [[ $restart_run = false ]]
752    then
753
754          # COLLECT FILES TO BE COMPILED IN THE SOURCES_FOR_RUN_... FOLDER ON
755          # THE LOCAL HOST
756       if [[ ! -d $source_path ]]
757       then
758          printf "\n\n  +++ source path \"$source_path\" on local host"
759          printf "\n      \"$(hostname)\" does not exist"
760          locat=source_path; exit
761       fi
762
[2506]763       rm -rf   $sources_for_run_catalog
764       mkdir -p $sources_for_run_catalog
[2380]765
766       if [[ "$source_list" = LM ]]
767       then
768
769             # DETERMINE MODIFIED FILES OF THE SVN WORKING COPY
770          source_list=""
771          cd  $source_path
772
773
[2512]774             # CHECK, IF TRUNK-DIRECTORY IS UNDER SVN CONTROL
775          if [[ ! -d ../.svn ]]
[2380]776          then
777             printf "\n\n  +++ source directory"
778             printf "\n         \"$source_path\" "
779             printf "\n         is not under control of \"subversion\"."
[2512]780             printf "\n         Please do not use palmrun-option \"-s LM\"\n"
[2380]781          fi
782
783
784             # LIST ALL MODIFIED SOURCE CODE FILES
785          Filenames=""
[2404]786          svn status  >  tmp_svnstatus
[2380]787          while  read line
788          do
789             firstc=`echo $line | cut -c1`
790             if [[ $firstc = M  ||  $firstc = "?" ]]
791             then
792                Name=`echo "$line" | cut -c8-`
793                extension=`echo $Name | cut -d. -f2`
794                if [[ "$extension" = f90 || "$extension" = F90 || "$extension" = f || "$extension" = F || "$extension" = c ]]
795                then
796                   Filenames="$Filenames "$Name
797                fi
798             fi
[2404]799          done < tmp_svnstatus
800          rm -rf  tmp_svnstatus
[2380]801
802
803             # COPY FILES TO SOURCES_FOR_RUN_...
804          for  filename  in  $Filenames
805          do
[2506]806             cp  $filename  ${working_directory}/${sources_for_run_catalog}
[2380]807             source_list=$source_list"$filename "
808          done
809
810          cd -  > /dev/null
811
812
813          # COPY FILES GIVEN BY OPTION -s TO DIRECTORY SOURCES_FOR_RUN_...
814       elif [[ "$source_list" != "" ]]
815       then
816
817          cd  $source_path
818
819          for  filename  in  $source_list
820          do
821
822                # SOURCE CODE FILE IS NOT ALLOWED TO INCLUDE PATH
823             if [[ $(echo $filename | grep -c "/") != 0 ]]
824             then
825                printf "\n  +++ source code file:  $filename"
826                printf "\n      must not contain (\"/\") "
827                locat=source; exit
828             fi
829
830             if [[ ! -f $filename ]]
831             then
832                printf "\n  +++ source code file:  $filename"
833                printf "\n      does not exist"
834                locat=source; exit
835             else
[2506]836                cp  $filename  ${working_directory}/${sources_for_run_catalog}
[2380]837             fi
838
839          done
840
841          cd -  > /dev/null
842
843       fi
844
845          # CHECK, IF MAKEFILE EXISTS AND COPY IT TO THE SOURCES_FOR_RUN... DIRECTORY
846       [[ "$makefile" = "" ]]  &&  makefile=$source_path/Makefile
847       if [[ ! -f $makefile ]]
848       then
849          printf "\n  +++ file \"$makefile\" does not exist"
850          locat=make; exit
851       else
[2506]852          cp  $makefile  ${sources_for_run_catalog}/Makefile
[2380]853       fi
854
855
856          # COPY FILES FROM OPTIONAL SOURCE PATH GIVEN IN THE CONFIGURATION FILE
[2384]857       if [[ "$user_source_path" != "" ]]
[2380]858       then
859
860             # DOES THE DIRECTORY EXIST?
[2384]861          if [[ ! -d $user_source_path ]]
[2380]862          then
863
864             printf "\n\n  *** INFORMATIVE: additional source code directory"
[2384]865             printf "\n      \"$user_source_path\" "
[2380]866             printf "\n      does not exist or is not a directory."
867             printf "\n      No source code will be used from this directory!\n"
[2384]868             user_source_path=""
[2380]869             if [[ $silent == false ]]
870             then
871                sleep 2
872             fi
873
874          else
875
[2384]876             cd $user_source_path
[2380]877             found=false
878
879             Names=$(ls -1 *.f90 2>&1)
880             [[ $(echo $Names | grep -c '*.f90') = 0 ]]  &&  AddFilenames="$Names"
881             Names=$(ls -1 *.F90 2>&1)
882             [[ $(echo $Names | grep -c '*.F90') = 0 ]]  &&  AddFilenames="$AddFilenames $Names"
883             Names=$(ls -1 *.F 2>&1)
884             [[ $(echo $Names | grep -c '*.F') = 0   ]]  &&  AddFilenames="$AddFilenames $Names"
885             Names=$(ls -1 *.f 2>&1)
886             [[ $(echo $Names | grep -c '*.f') = 0   ]]  &&  AddFilenames="$AddFilenames $Names"
887             Names=$(ls -1 *.c 2>&1)
888             [[ $(echo $Names | grep -c '*.c') = 0   ]]  &&  AddFilenames="$AddFilenames $Names"
889
890             cd -  > /dev/null
[2506]891             cd  $sources_for_run_catalog
[2380]892
893                # COPY MAKEFILE IF EXISTING
[2384]894             if [[ -f $user_source_path/Makefile ]]
[2380]895             then
896                printf "\n\n  *** user Makefile from directory"
[2384]897                printf "\n      \"$user_source_path\" is used \n"
[2380]898                if [[ $silent == false ]]
899                then
900                   sleep 1
901                fi
[2384]902                cp  $user_source_path/Makefile  .
[2380]903             fi
904
905             for  filename  in  $AddFilenames
906             do
907                if [[ -f $filename ]]
908                then
909                   printf "\n  +++ source code file \"$filename\" found in additional"
[2384]910                   printf "\n      source code directory \"$user_source_path\" "
[2380]911                   printf "\n      but was also given with option \"-s\" which means that it should be taken"
912                   printf "\n      from directory \"$source_path\"."
913                   locat=source; exit
914                fi
915
[2384]916                cp  $user_source_path/$filename  .
[2380]917                source_list="$source_list $filename"
918
919                   # CHECK IF FILE IS CONTAINED IN MAKEFILE
920                if [[ $(grep -c $filename Makefile) = 0 ]]
921                then
922                   printf "\n\n  +++ user file \"$filename\" "
923                   printf "\n      is not listed in Makefile \n"
924                   locat=source; exit
925                else
926
927                   if [[ $found = false ]]
928                   then
929                      found=true
930                      printf "\n\n  *** following user file(s) added to the"
931                      printf " files to be translated:\n      "
932                   fi
933                   printf "$filename  "
934                   if [[ $silent == false ]]
935                   then
936                      sleep 0.5
937                   fi
938
939                fi
940             done
941             [[ $found = true ]]  &&  printf "\n"
942             cd -  > /dev/null
943          fi
944       fi
945
946          # COPY CONFIGURATION FILES
[2506]947       cp  $config_file  $sources_for_run_catalog
948       cp  $fileconnection_file  $sources_for_run_catalog
[2380]949
950          # COPY SHELLSCRIPTS
[2506]951       cp  ${source_path}/../SCRIPTS/palmrun    $sources_for_run_catalog
952       cp  ${source_path}/../SCRIPTS/batch_scp  $sources_for_run_catalog
[2380]953
954    fi
955
956 fi
957
[2605]958
[2380]959    # GET THE GLOBAL REVISION-NUMBER OF THE SVN-REPOSITORY
960    # (HANDED OVER TO RESTART-RUNS USING OPTION -G)
961 if [[ "$global_revision" = "" ]]
962 then
963    global_revision=`svnversion $source_path  2>/dev/null`
964    global_revision="Rev: $global_revision"
965 fi
966
967
968    # IN CASE OF PARALLEL EXECUTION, CHECK SOME SPECIFICATIONS CONCERNING PROCESSOR NUMBERS
969 if [[ -n $cores ]]
970 then
971
972       # CHECK, IF THE NUMBER OF CORES PER NODE HAS BEEN GIVEN UND IF IT IS AN
973       # INTEGRAL DIVISOR OF THE TOTAL NUMBER OF CORES GIVEN BY OPTION -X
[2501]974    if [[ $tasks_per_node = 0 ]]
[2380]975    then
976       printf "\n"
977       printf "\n  +++ option \"-T\" (tasks per node) is missing"
978       printf "\n      set -T option or define tasks_per_node in the config file"
979       locat=tasks_per_node; (( iec = 0 )); exit
980    fi
981
982    if (( cores < tasks_per_node ))
983    then
984       printf "\n"
985       printf "\n  +++ tasks per node (-T) cannot exceed total number of cores (-X)"
986       printf "\n      given values: -T $tasks_per_node  -X $cores"
987       locat=tasks_per_node; (( iec = 0 )); exit
988    fi
989
990    (( nodes = cores / ( tasks_per_node * threads_per_task ) ))
991    (( mpi_tasks = cores / threads_per_task ))
992    [[ $mpi_tasks = 0 ]]  &&  (( mpi_tasks = 1 ))
993    (( ii = cores / tasks_per_node ))
994    (( remaining_cores =  cores - ii * tasks_per_node ))
995    if (( remaining_cores > 0 ))
996    then
997       printf "\n"
998       printf "\n  +++ WARNING: tasks per node (option \"-T\") is not an integral"
999       printf "\n      divisor of the total number of cores (option \"-X\")"
1000       printf "\n      values of this palmrun-call: \"-T $tasks_per_node\" \"-X $cores\""
1001       printf "\n      One of the nodes is filled with $remaining_cores instead of $tasks_per_node tasks"
1002       (( nodes = nodes + 1 ))
1003    fi
1004
1005       # SET THE TOTAL NUMBER OF NODES, REQUIRED FOR THE SUBJOB-COMMAND (SEE FURTHER BELOW)
1006    if [[ "$tasks_per_node" != "" ]]
1007    then
1008       TOPT="-T $tasks_per_node"
1009    fi
1010
1011 fi
1012
1013
1014    # SET DEFAULT VALUE FOR THE MAXIMUM NUMBER OF PARALLEL IO STREAMS
1015 if [[ "$maximum_parallel_io_streams" = "" ]]
1016 then
1017    maximum_parallel_io_streams=$cores
1018 fi
1019
1020
1021    # SET PORT NUMBER OPTION FOR CALLS OF SSH/SCP AND batch_scp SCRIPT
1022 if [[ "$scp_port" != "" ]]
1023 then
1024    PORTOPT="-P $scp_port"
1025    SSH_PORTOPT="-p $scp_port"
1026 fi
1027
1028
1029    # DETERMINE THE SSH-OPTION IN CASE THAT AN SSH-KEY IS EXPLICITLY GIVEN IN THE
1030    # CONFIG-FILE
1031 if [[ "$ssh_key" != "" ]]
1032 then
1033    ssh_key="-i $HOME/.ssh/$ssh_key"
1034 fi
1035
1036
1037    # SET QUEUE, IF NOT GIVEN
1038 if [[ $create_batch_job = true  ||  $create_remote_batch_job = true ]]
1039 then
1040
1041    if [[ $queue = none  &&  "$defaultqueue" = "" ]]
1042    then
1043       printf "\n"
1044       printf "\n  +++ no default queue given in configuration file and no queue"
1045       printf "\n      given with option -q"
[2789]1046       locat=queue; exit
[2380]1047    fi
1048    if [[ $queue = none ]]
1049    then
1050       queue=$defaultqueue
1051    fi
1052
1053 fi
1054
1055
1056    # GENERATE FULL FILENAMES OF INPUT-FILES, INCLUDING THEIR PATH
1057    # CHECK, IF INPUT-FILES EXIST, AND DETERMINE HIGHEST CYCLE NUMBER (IF CYCLES EXIST)
1058 (( i = 0 ))
[2610]1059 (( nr_of_input_files = 0 ))
[2380]1060 while (( i < iin ))
1061 do
1062    (( i = i + 1 ))
1063
1064       # GENERATE PATH AND FULL FILE NAME (then-BRANCH: FIXED FULL NAME IS GIVEN, I.E. THE
1065       # FILE IDENTIFIER IS NOT PART OF THE FILENAME))
[2610]1066    if [[ "${actionin_pre[$i]}" = di ]]
[2380]1067    then
[2610]1068       eval filename=${pathin_pre[$i]}/${endin_pre[$i]}
[2380]1069    else
[2610]1070       eval filename=${pathin_pre[$i]}/${fname}${endin_pre[$i]}
[2380]1071    fi
1072
[2610]1073
[2380]1074       # CHECK IF FILE EXISTS
1075    if ! ls $filename* 1>/dev/null 2>&1
1076    then
1077
[2669]1078          # FILES WITH ATTRIBUTE opt ARE OPTIONAL. NO ABORT, IF THEY DO NOT EXIST.
1079       if [[ "${optin_pre[$i]}" != "yes" ]]
[2380]1080       then
1081          printf "\n\n  +++ INPUT-file: "
[2610]1082          if [[ "${extin_pre[$i]}" = ""  ||  "${extin_pre[$i]}" = " " ]]
[2380]1083          then
1084             printf "\n           $filename"
1085          else
[2610]1086             printf "\n           $filename.${extin_pre[$i]}"
[2380]1087          fi
1088          printf "\n      does not exist\n"
1089          locat=input; exit
1090       else
[2610]1091          (( nr_of_input_files = nr_of_input_files + 1 ))
1092          localin[$nr_of_input_files]="${localin_pre[$i]}"
[2669]1093          optin[$nr_of_input_files]="${optin_pre[$i]}"
1094          actionin[$nr_of_input_files]="unavailable"
[2610]1095          pathin[$nr_of_input_files]="${pathin_pre[$i]}"
1096          endin[$nr_of_input_files]="${endin_pre[$i]}"
1097          extin[$nr_of_input_files]="${extin_pre[$i]}"
[2380]1098       fi
[2605]1099
[2380]1100    else
1101
[2610]1102          # FIRST CHECK FOR MULTIPLE NAMES WITH THE SAME BASENAME ($fname) AND
1103          # CREATE A LIST FOR THE DETECTED BASENAME ENDINGS
1104       if [[ "${multin[$i]}" = true ]]
1105       then
1106             # DETERMINE THE EXISTING EXTENSIONS FROM THE LIST OF FILES
1107          ls -1 -d ${filename}    >   filelist  2>/dev/null
1108          ls -1 -d ${filename}.*  >>  filelist  2>/dev/null
1109          ls -1 -d ${filename}_*  >>  filelist  2>/dev/null
[2380]1110
[2610]1111          endings=""
1112          while  read line
1113          do
1114                 # filename without path (i.e. after the last "/")
1115              basefilename=$(basename ${line})
[2380]1116
[2610]1117                 # check if there is an extension and remove it
1118              ext=${basefilename##*.}
1119              if [[ "$ext" = "${extin_pre[$i]}" ]]
1120              then
1121                 basefilename=${basefilename%.*}
1122              fi
[2380]1123
[2610]1124                 # check for an existing cycle number and remove it
1125              cycle=${basefilename##*.}
1126              if [[ $cycle =~ ^-?[0-9]+$ ]]
1127              then
1128                 basefilename=${basefilename%.*}
1129              fi
[2600]1130
[2610]1131                 # remove the fname from the beginning
1132              length_fname=${#fname}
1133              ending=${basefilename:${length_fname}}
1134
1135                 # remove the ending given in the .iofiles from the beginning
1136              endingstring="${endin_pre[$i]}"
1137              length_ending=${#endingstring}
1138              ending=${ending:${length_ending}}
1139
1140              if [[ "$ending" = "" ]]
[2600]1141              then
[2610]1142                    # standard ending as given in the .iofiles
1143                 if [[ $(echo $endings | grep -c DEFAULT) = 0 ]]
1144                 then
1145                    endings="$endings DEFAULT"
1146                 fi
[2600]1147              else
[2610]1148                    # ending must start with "_", otherwise its a different file
1149                 if [[ "${ending:0:1}" = "_" ]]
1150                 then
1151                    if [[ $(echo $endings | grep -c "$ending") = 0 ]]
1152                    then
1153                       endings="$endings $ending"
1154                    fi
1155                 fi
[2600]1156              fi
[2610]1157 
1158          done <filelist
[2380]1159
[2610]1160          rm filelist
[2380]1161
[2600]1162       else
[2610]1163
1164             # SINGLE NAME
1165          endings=DEFAULT
1166
[2600]1167       fi
1168
[2610]1169          # FOR EACH BASENAME ENDING CREATE AN ENTRY IN THE FINAL INPUT FILE LIST
1170       for  ending  in  $endings
1171       do
1172
1173             # DEFAULT MEANS THAT THE ENDING GIVEN IN .iofiles SHALL BE USED
1174          if [[ $ending = DEFAULT ]]
[2380]1175          then
[2610]1176             ending=""
1177          fi
1178
1179             # NEW ENTRY (ENDING IS ALSO ADDED TO LOCAL FILENAME READ BY PALM!)
1180          (( nr_of_input_files = nr_of_input_files + 1 ))
1181          localin[$nr_of_input_files]="${localin_pre[$i]}"$ending
[2669]1182          optin[$nr_of_input_files]="${optin_pre[$i]}"
[2610]1183          actionin[$nr_of_input_files]="${actionin_pre[$i]}"
1184          pathin[$nr_of_input_files]="${pathin_pre[$i]}"
1185          endin[$nr_of_input_files]="${endin_pre[$i]}"$ending
1186          extin[$nr_of_input_files]="${extin_pre[$i]}"
1187
1188
1189             # GENERATE PATH AND FULL FILE NAME (then-BRANCH: FIXED FULL NAME IS GIVEN, I.E. THE
1190             # FILE IDENTIFIER IS NOT PART OF THE FILENAME))
1191          if [[ "${actionin[$nr_of_input_files]}" = di ]]
1192          then
1193             eval filename=${pathin[$nr_of_input_files]}/${endin[$nr_of_input_files]}
[2380]1194          else
[2610]1195             eval filename=${pathin[$nr_of_input_files]}/${fname}${endin[$nr_of_input_files]}
[2380]1196          fi
[2610]1197
1198             # DETERMINE THE FILE'S CYCLE NUMBER
1199          (( maxcycle = 0 ))
1200          ls -1 -d $filename    >   filelist  2>/dev/null
1201          ls -1 -d $filename.*  >>  filelist  2>/dev/null
1202          while  read line
1203          do
1204                 # filename without path (i.e. after the last "/")
1205              basefilename=$(basename ${line})
1206   
1207                 # check if there is an extension
1208              extension=${basefilename##*.}
1209              if [[ "$extension" = "${extin[$nr_of_input_files]}" ]]
1210              then
1211                 basefilename=${basefilename%.*}
1212              fi
1213   
1214                 # check for an existing cycle number
1215              cycle=${basefilename##*.}
1216              if [[ $cycle =~ ^-?[0-9]+$ ]]
1217              then
[2669]1218                    # NUMBERS WITH LEADING ZEROS ARE INTERPRETED AS OCTAL NUMBERS
1219                    # 10# EXPLICITLY SPECIFIES THE NUMBER BASE AS 10
1220                 (( icycle = $((10#$cycle)) ))
[2610]1221              else
1222                 (( icycle = 0 ))
1223              fi
1224   
1225              if (( icycle > maxcycle ))
1226              then
1227                 (( maxcycle = icycle ))
1228   
1229                    # FOR COMPATIBILITY REASONS WITH OLDER VERSIONS
1230                    # CHECK IF CYCLE NUMBER CONTAINS LEADING ZEROS
1231                 if [[ $(echo $cycle | cut -c1) = 0 ]]
1232                 then
1233                    leading_zero=true
1234                 else
1235                    leading_zero=false
1236                 fi
1237              fi
1238   
1239          done <filelist
1240          rm filelist
1241   
1242             # MAKE CYCLE NUMBER THREE DIGITS WIDE
1243          if [[ $leading_zero = true ]]
[2380]1244          then
[2610]1245             cyclestring=`printf "%03d" $maxcycle`
1246          else
1247             cyclestring=$maxcycle
[2380]1248          fi
[2610]1249   
1250             # APPEND CYCLE NUMBER TO FILENAME
1251          if (( maxcycle > 0 ))
[2380]1252          then
[2610]1253             if [[ "${extin[$nr_of_input_files]}" != " "  &&   "${extin[$nr_of_input_files]}" != "" ]]
1254             then
1255                filename=${filename}.$cyclestring.${extin[$nr_of_input_files]}
1256             else
1257                filename=${filename}.$cyclestring
1258             fi
[2380]1259          else
[2610]1260             if [[ "${extin[$nr_of_input_files]}" != " "  &&   "${extin[$nr_of_input_files]}" != "" ]]
1261             then
1262                filename=${filename}.${extin[$nr_of_input_files]}
1263             fi
[2380]1264          fi
[2610]1265         
1266             # STORE FILENAME WITHOUT PATH BUT WITH CYCLE NUMBER,
1267             # IS LATER USED FOR TRANSFERRING FILES WIHIN THE JOB (SEE END OF FILE)
1268          absnamein[$nr_of_input_files]=$filename
1269          if (( maxcycle > 0 ))
[2380]1270          then
[2610]1271             if [[ "${actionin[$nr_of_input_files]}" = di ]]
1272             then
1273                frelin[$nr_of_input_files]=${endin[$nr_of_input_files]}.$cyclestring
1274             else
1275                frelin[$nr_of_input_files]=${fname}${endin[$nr_of_input_files]}.$cyclestring
1276             fi
[2380]1277          else
[2610]1278             if [[ "${actionin[$nr_of_input_files]}" = di ]]
1279             then
1280                frelin[$nr_of_input_files]=${endin[$nr_of_input_files]}
1281             else
1282                frelin[$nr_of_input_files]=${fname}${endin[$nr_of_input_files]}
1283             fi
[2380]1284          fi
1285
[2610]1286       done
1287
[2380]1288    fi
[2610]1289
[2380]1290 done
1291
[2610]1292
[2380]1293    # GENERATE FULL FILENAMES OF OUTPUT-FILES (WITHOUT $ OR ~),
1294    # CHECK, IF OUTPUT-FILES EXIST, AND DETERMINE HIGHEST CYCLE NUMBER (IF CYCLES EXIST),
1295    # OR, IN CASE THAT FILE DOES NOT EXIST, CHECK, IF IT CAN BE CREATED 
[2610]1296    # THESE ACTIONS ARE NOT CARRIED OUT, IF FILES SHALL BE TRANSFERRED FROM THE REMOTE TO
[2380]1297    # THE LOCAL HOST (BECAUSE THEIR IS NO DIRECT ACCESS TO THE LOCAL DIRECTORIES FROM THE
1298    # REMOTE HOST)
1299 (( i = 0 ))
1300 while (( i < iout ))
1301 do
1302    (( i = i + 1 ))
[2610]1303    if [[ ! ( $running_on_remote = true  &&  ( "${actionout_pre[$i]}" = tr || "${actionout_pre[$i]}" = tra || "${actionout_pre[$i]}" = trpe ) ) ]]
[2380]1304    then
[2610]1305       if [[ "${actionout_pre[$i]}" = tr ]]
[2380]1306       then
[2610]1307          actionout_pre[$i]=""
1308       elif [[ "${actionout_pre[$i]}" = trpe ]]
[2380]1309       then
[2610]1310          actionout_pre[$i]=pe
1311       elif [[ "${actionout_pre[$i]}" = tra ]]
[2380]1312       then
[2610]1313          actionout_pre[$i]=a
[2380]1314       fi
1315       (( maxcycle = 0 ))
[2610]1316       eval filename=${pathout_pre[$i]}/${fname}${endout_pre[$i]}
1317       eval catalogname=${pathout_pre[$i]}
[2380]1318       if ! ls $filename* 1>/dev/null 2>&1
1319       then
1320     
1321             # IF OUTPUT-FILE DOES NOT EXIST CHECK, IF IT CAN BE CREATED
1322          if  cat /dev/null > $filename 
1323          then
1324             rm  $filename
1325          else
1326
1327                # CHECK, IF THE DIRECTORY WHERE FILE SHALL BE COPIED TO EXISTS
1328                # IF IT DOES NOT EXIST, TRY TO CREATE IT
1329             if [[ ! -d $catalogname ]]
1330             then
1331                if  mkdir -p  $catalogname
1332                then
1333                   printf "\n\n  *** directory:"
1334                   printf "\n           $catalogname"
1335                   printf "\n      was created\n"
1336                else
1337                   printf "\n\n  +++ OUTPUT-file:"
1338                   printf "\n           $filename"
1339                   printf "\n      cannot be created, because directory does not exist"
1340                   printf "\n      and cannot be created either"
1341                   printf "\n"
1342                   locat=output  ; exit
1343                fi 2>/dev/null
1344             else
1345                printf "\n\n  +++ OUTPUT-file:"
1346                printf "\n           $filename"
1347                printf "\n      cannot be created, although directory exists"
1348                printf "\n"
1349                locat=output  ; exit
1350             fi
1351          fi 2>/dev/null
1352
1353       fi
1354
1355    fi
1356 done
1357
1358
1359    # DETERMINE THE NAME OF PALMRUN'S TEMPORARY WORKING DIRECTORY
1360 if [[ $running_in_batch_mode = false ]]
1361 then
1362    run_id=$RANDOM
1363    job_id=${fname}.$run_id
1364
[2566]1365    tempdir=$fast_io_catalog/$job_id
[2380]1366 fi
1367
1368
1369    # CHECK SETTINGS REQUIRED FOR BATCH JOBS
1370 if [[ $create_batch_job = true  ||  $create_remote_batch_job = true ]]
1371 then
1372
1373       # CHECK, IF JOB DIRECTIVES HAVE BEEN GIVEN IN CONFIGURATION FILE
1374    if [[ $ibd = 0 ]]
1375    then
1376       printf "\n"
1377       printf "\n  +++ no batch directives found in configuration file"
1378       locat=config_file_batch_directives; (( iec = 0 )); exit
1379    fi
1380
1381       # CHECK IF CPUTIME IS GIVEN FOR JOB
1382    done=false
[2384]1383    cputime=$cpumax
[2380]1384    while [[ $done = false ]]
1385    do
[2384]1386       if (( cputime == 0 ))
[2380]1387       then
1388          printf "\n  +++ cpu-time is undefined"
1389          printf "\n  >>> Please type CPU-time in seconds as INTEGER:"
1390          printf "\n  >>> "
[2384]1391          read  cputime   1>/dev/null  2>&1
[2380]1392       else
1393          done=true
1394       fi
1395    done
[2420]1396    cpumax=$cputime
[2380]1397
1398       # CHECK THE MEMORY DEMAND
1399    done=false
1400    while [[ $done = false ]]
1401    do
1402       if (( memory == 0 ))
1403       then
1404          printf "\n  +++ memory demand is undefined"
1405          printf "\n  >>> Please type memory in  MByte per process  as INTEGER:"
1406          printf "\n  >>> "
1407          read  memory  1>/dev/null  2>&1
1408       else
1409          done=true
1410       fi
1411    done
1412
1413       # IN CASE OF REMOTE-JOBS CHECK, IF A USERNAME FOR THE REMOTE HOST IS GIVEN
1414    if [[ $create_remote_batch_job = true  &&  -z $remote_username ]]
1415    then
1416       while [[ -z $remote_username ]]
1417       do
[2420]1418          printf "\n  +++ username on remote host with IP \"$remote_ip\" is undefined"
[2380]1419          printf "\n  >>> Please type username:"
1420          printf "\n  >>> "
1421          read  remote_username
1422       done
1423    fi
1424
1425 else
1426
[2420]1427    if [[ $running_in_batch_mode = false ]]
1428    then
1429       cputime=10000000  # NO LIMT FOR INTERACTIVE RUNS
1430       cpumax=$cputime
1431    else
1432       cputime=$cpumax
1433    fi
[2380]1434
1435 fi
1436
1437
1438    # CALCULATE HOURS/MINUTES/SECONDS, E.G. FOR BATCH-DIRECTIVES
1439 (( cpu_hours  = cputime / 3600 ))
1440 (( resttime = cputime - cpu_hours * 3600 ))
1441 (( cpu_minutes  = resttime / 60 ))
1442 (( cpu_seconds = resttime - cpu_minutes * 60 ))
1443 timestring=${cpu_hours}:${cpu_minutes}:${cpu_seconds}
1444
1445
1446    # OUTPUT OF THE PALMRUN-HEADER
1447 calltime=$(date)
1448 printf "\n"
1449 printf "#------------------------------------------------------------------------# \n"
1450 printf "| %-35s%35s | \n" "$version" "$calltime"
1451 printf "|                                                                        | \n"
1452 column1="called on:"; column2=$(hostname)
1453 printf "| %-25s%-45s | \n" "$column1" "$column2"
1454 if [[ $create_remote_batch_job = true ]]
1455 then
[2506]1456    column1="execution on:"; column2="$host_configuration (username: $remote_username)"
[2380]1457 else
1458    if [[ $running_on_remote = true ]]
1459    then
[2506]1460       column1="execution on:"; column2="$host_configuration (IP:$remote_ip)"
[2380]1461    else
[2506]1462       column1="execution on:"; column2="$host_configuration (IP:$local_ip)"
[2380]1463    fi
1464 fi
1465 printf "| %-25s%-45s | \n" "$column1" "$column2"
1466
1467 column1="running in:"
1468 if [[ $running_in_batch_mode = true ]]
1469 then
1470    column2="batch job mode"
1471 else
1472    if [[ $create_batch_job = true  ||  $create_remote_batch_job = true ]]
1473    then
1474       column2="job creation mode"
1475    else
1476       column2="interactive run mode"
1477    fi
1478 fi
1479 printf "| %-25s%-45s | \n" "$column1" "$column2"
1480
[2479]1481 if  [[ $running_in_batch_mode = true  ||  $create_batch_job = true  ||  $create_remote_batch_job = true ]]
1482 then
[2480]1483    if [[ "$project_account" != "" ]]
[2479]1484    then
1485       column1="project account number:"
1486       column2="$project_account"
1487       printf "| %-25s%-45s | \n" "$column1" "$column2"
1488    fi
1489 fi
1490
[2380]1491 if [[ -n $cores ]]
1492 then
1493    if [[ $run_coupled_model = false ]]
1494    then
1495       column1="number of cores:"; column2=$cores
1496    else
1497       column1="number of cores:"; column2="$cores  (atmosphere: $cores_atmos, ocean: $cores_ocean)"
1498    fi
1499    printf "| %-25s%-45s | \n" "$column1" "$column2"
1500 fi
1501 if [[ -n $tasks_per_node ]]
1502 then
1503    column1="tasks per node:"; column2="$tasks_per_node (number of nodes: $nodes)"
1504    printf "| %-25s%-45s | \n" "$column1" "$column2"
1505    if (( remaining_cores > 0 ))
1506    then
1507       column1=" "; column2="one of the nodes only filled with $remaining_cores tasks"
1508       printf "| %-25s%-45s | \n" "$column1" "$column2"
1509    fi
1510 fi
1511 if [[ $maximum_parallel_io_streams != $cores ]]
1512 then
1513    column1="max par io streams:"; column2="$maximum_parallel_io_streams"
1514    printf "| %-25s%-45s | \n" "$column1" "$column2"
1515 fi
1516 if [[ $use_openmp = true ]]
1517 then
1518    column1="threads per task:"; column2="$threads_per_task"
1519    printf "| %-25s%-45s | \n" "$column1" "$column2"
1520 fi
[2384]1521 if [[ $create_batch_job = true  ||  $create_remote_batch_job = true  ||  $running_in_batch_mode = true ]]
1522 then
[2506]1523    column1="memory demand / PE":; column2="$memory MB"
1524    printf "| %-25s%-45s | \n" "$column1" "$column2"
[2384]1525    column1="job cpu time (h:m:s):"; column2="$timestring"
1526    printf "| %-25s%-45s | \n" "$column1" "$column2"
1527 fi
[2380]1528 printf "|                                                                        | \n"
1529 if [[ "$source_list" != "" ]]
1530 then
1531    if [[ "$make_options" != "" ]]
1532    then
1533       column1="make options:"; column2=$(echo "$make_options" | cut -c-45)
1534       printf "| %-25s%-45s | \n" "$column1" "$column2"
1535       line=$(echo "$make_options" | cut -c46-)
1536       while [[ "$line" != "" ]]
1537       do
1538          column1=""
1539          column2=$(echo "$line" | cut -c-45)
1540          printf "| %-25s%-45s | \n" "$column1" "$column2"
1541          line=$(echo "$line" | cut -c46-)
1542       done
1543    fi
1544 fi
1545
1546 column1="cpp directives:"; column2=$(echo "$cpp_options" | cut -c-45)
1547 printf "| %-25s%-45s | \n" "$column1" "$column2"
1548 line=$(echo "$cpp_options" | cut -c46-)
1549 while [[ "$line" != "" ]]
1550 do
1551    column1=""
1552    column2=$(echo "$line" | cut -c-45)
1553    printf "| %-25s%-45s | \n" "$column1" "$column2"
1554    line=$(echo "$line" | cut -c46-)
1555 done
1556
1557 column1="compiler options:"; column2=$(echo "$compiler_options" | cut -c-45)
1558 printf "| %-25s%-45s | \n" "$column1" "$column2"
1559 line=$(echo "$compiler_options" | cut -c46-)
1560 while [[ "$line" != "" ]]
1561 do
1562    column1=""
1563    column2=$(echo "$line" | cut -c-45)
1564    printf "| %-25s%-45s | \n" "$column1" "$column2"
1565    line=$(echo "$line" | cut -c46-)
1566 done
1567
[2388]1568 column1="linker options:"; column2=$(echo "$linker_options" | cut -c-45)
[2380]1569 printf "| %-25s%-45s | \n" "$column1" "$column2"
[2388]1570 line=$(echo "$linker_options" | cut -c46-)
[2380]1571 while [[ "$line" != "" ]]
1572 do
1573    column1=""
1574    column2=$(echo "$line" | cut -c-45)
1575    printf "| %-25s%-45s | \n" "$column1" "$column2"
1576    line=$(echo "$line" | cut -c46-)
1577 done
1578
1579 if [[ "$login_init_cmd" != "" ]]
1580 then
1581    column1="login init commands:"; column2=$(echo "$login_init_cmd" | cut -c-45)
1582    printf "| %-25s%-45s | \n" "$column1" "$column2"
1583    line=$(echo "$login_init_cmd" | cut -c46-)
1584    while [[ "$line" != "" ]]
1585    do
1586       column1=""
1587       column2=$(echo "$line" | cut -c-45)
1588       printf "| %-25s%-45s | \n" "$column1" "$column2"
1589       line=$(echo "$line" | cut -c46-)
1590    done
1591 fi
1592
1593 if [[ "$module_commands" != "" ]]
1594 then
1595    column1="module commands:"; column2=$(echo "$module_commands" | cut -c-45)
1596    printf "| %-25s%-45s | \n" "$column1" "$column2"
1597    line=$(echo "$module_commands" | cut -c46-)
1598    while [[ "$line" != "" ]]
1599    do
1600       column1=""
1601       column2=$(echo "$line" | cut -c-45)
1602       printf "| %-25s%-45s | \n" "$column1" "$column2"
1603       line=$(echo "$line" | cut -c46-)
1604    done
1605 fi
1606 printf "|                                                                        | \n"
1607 column1="base name of files:"; column2=$fname
1608 printf "| %-25s%-45s | \n" "$column1" "$column2"
1609 column1="activation string list:"; column2=$(echo $activation_string_list)
1610 printf "| %-25s%-45s | \n" "$column1" "$column2"
1611
1612 if [[ "$ocean_file_appendix" = true ]]
1613 then
1614    printf "| %-35s%-35s | \n" "suffix \"_O\" is added to local files" " "
1615 fi
1616
1617 if [[ "$source_list" != "" ]]
1618 then
1619    printf "|                                                                        | \n"
1620    printf "| Files to be compiled:                                                  | \n"
1621    line=$source_list
1622    while [[ "$line" != "" ]]
1623    do
1624       linestart=$(echo $line | cut -c-70)
1625       printf "| %-70s | \n" "$linestart"
1626       line=$(echo "$line" | cut -c71-)
1627    done
1628 fi
1629 printf "#------------------------------------------------------------------------#"
1630
1631
1632
1633    # OUTPUT OF FILE CONNECTIONS IN CASE OF TRACEBACK
1634 if [[ $do_trace = true ]]
1635 then
1636    (( i = 0 ))
[2610]1637    while (( i < nr_of_input_files ))
[2380]1638    do
1639       (( i = i + 1 ))
1640       if (( i == 1 ))
1641       then
1642          printf "\n\n >>> INPUT-file assignments:\n"
1643       fi
1644       printf "\n     ${localin[$i]} :  ${absnamein[$i]}"
1645    done
1646    (( i = 0 ))
1647    while (( i < iout ))
1648    do
1649       (( i = i + 1 ))
1650       if (( i == 1 ))
1651       then
1652          printf "\n\n >>> OUTPUT-file assignments:\n"
1653       fi
1654       printf "\n     ${localout[$i]} :  ${pathout[$i]}"
1655    done
1656    (( i = 0 ))
1657    while (( i < iic ))
1658    do
1659       (( i = i + 1 ))
1660       if (( i == 1 ))
1661       then
1662          printf "\n\n >>> INPUT-commands:\n"
1663       fi
1664       printf "\n     ${in_command[$i]}" 
1665    done
1666    (( i = 0 ))
1667    while (( i < ioc ))
1668    do
1669       (( i = i + 1 ))
1670       if (( i == 1 ))
1671       then
1672          printf "\n\n >>> OUTPUT-commands:\n"
1673       fi
1674       printf "\n     ${out_command[$i]}" 
1675    done
1676 fi
1677
1678    # QUERY FOR CONTINUE
1679 if [[ $silent = false  &&  $running_in_batch_mode = false ]]
1680 then
1681    antwort=dummy
1682    printf "\n\n"
1683    printf " >>> everything o.k. (y/n) ?  "
1684    while  read antwort
1685    do
1686       if [[ "$antwort" != y  &&  "$antwort" != Y  &&  "$antwort" != n  &&  "$antwort" != N ]]
1687       then
1688          printf " >>> everything o.k. (y/n) ?  "
1689       else
1690          break
1691       fi
1692    done
1693    if [[ $antwort = n  ||  $antwort = N ]]
1694    then
1695       locat=user_abort; (( iec = 0 )); exit
1696    fi
1697    if [[ $create_batch_job = true  ||  $create_remote_batch_job = true ]]
1698    then
[2566]1699       printf "\n ***  batch-job will be created and submitted"
[2380]1700    else
[2566]1701       printf "\n ***  PALMRUN will now continue to execute on this machine"
[2380]1702    fi
1703 fi
1704
1705 
1706
1707    # PROVIDE FILES TO EXECUTE PALM AND CREATE THE EXECUTABLE
1708 if [[ $restart_run = false  &&  $running_in_batch_mode = false ]]
1709 then
1710
1711    if [[ $create_batch_job = true  ||  $create_remote_batch_job  = true ]]
1712    then
[2566]1713       printf "\n\n  *** creating executable and other sources for the remote host\n"
[2380]1714    else
[2566]1715       printf "\n\n  *** creating executable and other sources for the local host\n"
[2380]1716    fi
1717
[2422]1718       # FIRST CHECK, IF A MAKE DEPOSITORY EXISTS, AND IF NOT, ASK THE USER IF
1719       # IT SHALL BE CREATED
1720    ask_for_make_depository=false
1721    if [[ $create_remote_batch_job = true ]]
1722    then
1723
1724       line=`grep %base_directory $config_file`
[2506]1725       make_depository=`echo $line | cut -d" " -s -f2`/MAKE_DEPOSITORY_${host_configuration}
1726       echo  "[[ ! -d ${make_depository} ]]  &&  echo depository not found" | ssh  -q  $ssh_key  ${remote_username}@${remote_ip} 2>&1  | tee ${host_configuration}_last_make_protokoll
[2422]1727
[2506]1728       if [[ $(grep -c "depository not found" ${host_configuration}_last_make_protokoll) != 0 ]]
[2422]1729       then
1730          printf "\n\n  +++ make depository \"${make_depository}\""
1731          printf "\n      on remote host not found!"
1732          ask_for_make_depository=true
1733       fi
[2506]1734       rm ${host_configuration}_last_make_protokoll
[2422]1735
1736    else
1737
1738          # CHECK FOR MAKE_DEPOSITORY ON THE LOCAL HOST
[2506]1739       make_depository=${base_directory}/MAKE_DEPOSITORY_${host_configuration}
[2422]1740       if [[ ! -d ${make_depository} ]]
1741       then
1742          printf "\n\n  +++ make depository \"${make_depository}\""
1743          printf "\n      on local host not found!"
1744          ask_for_make_depository=true
1745       fi
1746
1747    fi
1748
1749    if [[ $ask_for_make_depository = true ]]
1750    then
1751
1752       antwort=dummy
1753       printf "\n\n"
1754       printf "  >>> Create a new one (y/n) ?  "
1755       while  read antwort
1756       do
1757          if [[ "$antwort" != y  &&  "$antwort" != Y  &&  "$antwort" != n  &&  "$antwort" != N ]]
1758          then
1759             printf "  >>> Create a new one (y/n) ?  "
1760          else
1761             break
1762          fi
1763       done
1764       if [[ $antwort = n  ||  $antwort = N ]]
1765       then
1766          locat=user_abort; (( iec = 0 )); exit
1767       fi
1768
[2566]1769       if [[ $do_trace = true ]]
1770       then
1771          palmbuild  -h $host_configuration
1772       else
1773          palmbuild  -v  -h $host_configuration
1774       fi
[2422]1775
1776       if [[ $? != 0 ]]
1777       then
1778   
1779              # ABORT IN CASE OF COMPILATION PROBLEMS
1780          printf "\n  +++ error while compiling for the MAKE_DEPOSITORY"
1781          locat=make_depository
1782          exit
1783       else
1784          echo "  *** now continue with creating executable and other sources"
1785       fi
1786
1787    fi
1788
[2566]1789       # NOW CREATE THE SOURCES_FOR_RUN FOLDER
[2506]1790    palmbuild  -v  $use_existing_sources_folder  -h $host_configuration  -d $fname
[2380]1791
1792    if [[ $? != 0 ]]
1793    then
1794
1795           # ABORT IN CASE OF COMPILATION PROBLEMS
1796       printf "\n  +++ error while creating executable and/or other sources"
1797       locat=execution
[2506]1798       rm -rf  $sources_for_run_catalog
[2380]1799       exit
1800
1801    else
1802
[2566]1803       printf "  *** executable and other sources created\n"
[2506]1804       rm -rf  $sources_for_run_catalog
[2380]1805
1806    fi
1807
1808 fi
1809
1810
[2669]1811    # WHEN CREATING A REMOTE BATCH JOB, THOSE INPUT FILES WITH TRANSFER-ATTRIBUT
1812    # WILL BE COPIED TO THE REMOTE HOST
[2605]1813 if [[ $create_remote_batch_job = true ]]
1814 then
1815    (( i = 0 ))
[2610]1816    while (( i < nr_of_input_files ))
[2605]1817    do
1818       (( i = i + 1 ))
[2669]1819       if [[ "${actionin[$i]}" = tr ]]
[2605]1820       then
1821          eval inputfile=${pathin[$i]}/${frelin[$i]}
1822          scp  -q $ssh_key  $PORTOPT  $inputfile  ${remote_username}@${remote_ip}:${fast_io_catalog}/${sources_for_run_catalog}/${frelin[$i]}
1823       fi
1824    done
1825    if (( i > 0 ))
1826    then
1827       printf "  *** input files have been copied to the remote host\n"
1828    fi
1829 fi
1830 
1831
[2380]1832    # NOW PERFORM THOSE ACTIONS REQUIRED TO EXECUTE THE PROGRAM (PALM) ON THIS MACHINE
1833    # (COMPILING/LINKING, EXECUTING, COPYING I/O FILES)
1834 if [[ $create_batch_job = false  &&  $create_remote_batch_job = false ]]
1835 then
1836
1837       # CHANGE TO THE TEMPORARY WORKING DIRECTORY
1838    if [[ $running_in_batch_mode = false ]]
1839    then
1840          # CREATE THE DIRECTORY AND COPY FILES FROM SOURCES_FOR_RUN_... TO THAT
1841          # FOLDER
[2566]1842       mkdir -p  $tempdir
1843       chmod  go+rx  $tempdir
1844       cd  $tempdir
1845       cp  ${fast_io_catalog}/${sources_for_run_catalog}/{*,.[!.]*}  $tempdir
1846       printf "\n  *** changed to temporary directory: $tempdir"
[2380]1847
1848    else
1849
1850          # IN BATCH MODE PALMRUN IS CALLED FROM TEMPDIR
[2566]1851       printf "\n  *** running in temporary directory: $tempdir"
[2380]1852
1853    fi
1854
1855
1856       # PROVIDE THE INPUT FILES
1857       # LOOP OVER ALL ACTIVATED FILES (LISTED IN THE CONFIGURATION FILE)
[2669]1858    optional_files_missing=false
[2380]1859    (( i = 0 ))
[2610]1860    while (( i < nr_of_input_files ))
[2380]1861    do
1862       (( i = i + 1 ))
1863       if (( i == 1 ))
1864       then
1865          printf "\n\n  *** providing INPUT-files:\n$dashes"
1866       fi
1867
1868
1869          # SKIP OPTIONAL FILES, IF THEY DO NOT EXIST
[2669]1870       if [[ "${actionin[$i]}" = unavailable ]]
[2380]1871       then
[2669]1872          optional_files_missing=true
[2380]1873          continue
1874       fi
1875
1876          # CHECK FOR SINGLE FILE (SERIAL RUN) OR DIRECTORY (ONE FILE PER CORE FOR PARELLEL EXECUTION)
1877       files_for_cores=false; filetype=file
1878       if [[ "${actionin[$i]}" = pe  &&  -n $cores ]]
1879       then
1880          files_for_cores=true; filetype=files
1881          actionin[$i]=""
1882       elif [[ "${actionin[$i]}" = pe  &&  ! -n $cores ]]
1883       then
1884          actionin[$i]=""
1885       elif [[ "${actionin[$i]}" = lnpe  &&  -n $cores ]]
1886       then
1887          files_for_cores=true; filetype=files
1888          actionin[$i]="ln"
1889       elif [[ "${actionin[$i]}" = lnpe  &&  ! -n $cores ]]
1890       then
1891          actionin[$i]="ln"
1892       fi
1893
1894       if [[ $files_for_cores = true ]]
1895       then
1896          printf "\n  >>> INPUT: ${absnamein[$i]}/....  to  ${localin[$i]}"
1897       else
1898          printf "\n  >>> INPUT: ${absnamein[$i]}  to  ${localin[$i]}"
1899       fi
1900
1901          # INPUT-FILES TO BE LINKED
1902       if [[ "${actionin[$i]}" = ln ]]
1903       then
1904
1905          printf "\n      $filetype will be linked"
1906          if [[ $files_for_cores = false ]]
1907          then
1908             if [[ -f "${absnamein[$i]}" ]]
1909             then
1910                ln  ${absnamein[$i]}  ${localin[$i]}
1911                got_tmp[$i]=true
1912             fi
1913          else
1914             if [[ -d "${absnamein[$i]}" ]]
1915             then
[2396]1916                mkdir -p ${localin[$i]}
[2380]1917                cd ${absnamein[$i]}
1918                for file in $(ls *)
1919                do
[2566]1920                   ln $file $tempdir/${localin[$i]}
[2380]1921                done >|/dev/null 2>&1
[2566]1922                cd $tempdir
[2380]1923             fi
1924
1925                # IF "ln -f" HAS FAILED DO A NORMAL COPY "cp -r"
1926             if [[ ! -f "${localin[$i]}/_000000" ]]
1927             then
1928                printf "\n  --- WARNING: ln failed, using cp instead (might be time consuming...)"
1929                cp -r  ${absnamein[$i]}/*  ${localin[$i]}
1930             fi
1931
1932             got_tmp[$i]=true
1933          fi
1934       fi
1935
1936          # FILE IS STORED IN THE RESPECTIVE DIRECTORY GIVEN IN THE CONFIGURATION FILE
[2669]1937       if [[ "${actionin[$i]}" = ""  ||  "${actionin[$i]}" = "di"  ||  "${actionin[$i]}" = "tr"  ||  "${actionin[$i]}" = "npe" ]]
[2380]1938       then
1939
1940          if [[ "${actionin[$i]}" = "npe"  &&  -n $cores ]]
1941          then
1942
1943                # FILE COPIES ARE PROVIDED FOR ALL CORES
1944                # EACH FILE GETS A UNIQUE FILENAME WITH A FOUR DIGIT NUMBER
1945             printf "\n      file will be provided for $cores processors"
[2396]1946             mkdir -p ${localin[$i]}
[2380]1947             ival=$cores
1948             (( ii = 0 ))
1949             while (( ii <= ival-1 ))
1950             do
1951                if (( ii < 10 ))
1952                then
1953                   cp  ${absnamein[$i]}  ${localin[$i]}/_000$ii
1954                elif (( ii < 100 ))
1955                then
1956                   cp  ${absnamein[$i]}  ${localin[$i]}/_00$ii
1957                elif (( ii < 1000 ))
1958                then
1959                   cp  ${absnamein[$i]}  ${localin[$i]}/_0$ii
1960                else
1961                   cp  ${absnamein[$i]}  ${localin[$i]}/_$ii
1962                fi
1963                (( ii = ii + 1 ))
1964             done
1965
1966          else
1967
1968             if [[ $files_for_cores = true ]]
1969             then
1970
1971                   # PROVIDE FILES FOR EACH CORE
1972                   # FIRST CREATE THE LOCAL DIRECTORY, THEN COPY FILES
1973                   # FROM THE PERMANENT DIRECTORY BY LINKING THEM TO THE LOCAL ONE
1974                printf "\n      providing $cores files for the respective cores"
[2396]1975                mkdir -p ${localin[$i]}
[2380]1976                        if [[ $link_local_input = true ]]
1977                              then
1978                                 printf "      files will be linked\n"
1979                                 cd ${absnamein[$i]}
1980                                 for file in $(ls *)
1981                                 do
1982                                    ln -f $file  ${localin[$i]}
1983                                 done
[2566]1984                                 cd $tempdir
[2380]1985                              fi
1986
1987                   # IF "ln -f" FAILED OR IF "$link_local_input = false" DO A NORMAL "cp -r"
1988                              if [[ ! -f "${localin[$i]}/_000000" ]]
1989                              then
1990                                 if [[ $link_local_input = true ]]
1991                                        then
1992                                        printf "\n  --- WARNING: ln failed, using cp instead (might be time consuming...)"
1993                                 fi
1994                                 cp -r  ${absnamein[$i]}/*  ${localin[$i]}
1995                              fi
1996
1997             else
1998
1999                   # PROVIDE FILE FOR RUNS ON A SINGLE CORE
2000                        if [[ $link_local_input = true ]]
2001                        then
2002                                 printf "      file will be linked\n"
2003                                 ln -f  ${absnamein[$i]}  ${localin[$i]}
2004                        fi
[2605]2005                                # If "ln -f" fails or if "$link_local_input = false" do a normal "cp"
[2380]2006                        if [[ ! -f "${localin[$i]}" ]]
2007                then
2008                                 if [[ $link_local_input = true ]]
2009                          then
2010                      printf "\n  --- WARNING: ln failed, using cp instead (might be time consuming...)"
2011                                 fi
[2669]2012                   if [[ $running_on_remote = true  &&  "${actionin[$i]}" = tr ]]
[2605]2013                   then
2014                      mv  ${absnamein[$i]}  ${localin[$i]}
2015                   else
2016                                 cp  ${absnamein[$i]}  ${localin[$i]}
2017                   fi
[2380]2018                fi
2019             fi
2020          fi
2021       fi
2022
2023    done
2024    if (( i != 0 ))
2025    then
[2669]2026       if [[ $optional_files_missing = true ]]
2027       then
2028          printf "\n  *** INFORMATIVE: some optional INPUT-files are not present"
2029       fi
[2380]2030       printf "\n$dashes\n  *** all INPUT-files provided \n"
2031    fi
2032
2033
2034       # EXECUTE INPUT-COMMANDS GIVEN IN THE CONFIGURATION FILE
2035    (( i = 0 ))
2036    while (( i < iic ))
2037    do
2038       (( i = i + 1 ))
2039       if (( i == 1 ))
2040       then
2041          printf "\n\n  *** execution of INPUT-commands:\n$dashes"
2042       fi
2043       printf "\n  >>> ${in_command[$i]}"
2044       eval  ${in_command[$i]}
2045       if (( i == iic ))
2046       then
2047          printf "\n$dashes\n"
2048       fi
2049    done
2050
2051
2052       # CREATE THE NAMELIST-FILE WITH VALUES OF ENVIRONMENT-VARIABLES REQUIRED BY PALM
2053       # (FILE ENVPAR WILL BE READ BY PALM)
2054    cat  >  ENVPAR  <<  EOF
[2506]2055 &envpar  run_identifier = '$fname', host = '$host_configuration',
[2380]2056          write_binary = .${write_binary}., tasks_per_node = $tasks_per_node,
2057          maximum_parallel_io_streams = $maximum_parallel_io_streams,
2058          maximum_cpu_time_allowed = ${cpumax}.,
2059          revision = '$global_revision',
2060          batch_job = .${running_in_batch_mode}. /
2061
2062EOF
2063
2064
2065       # STARTING THE EXECUTABLE
2066    printf "\n\n  *** execution starts in directory\n      \"`pwd`\"\n$dashes\n"
[2566]2067    PATH=$PATH:$tempdir
[2380]2068
2069
2070       # REPLACE PARAMETERS IN THE EXECUTION COMMAND WITH REAL VALUES
[2693]2071    line=`echo  "${execute_command}" | sed 's/{{/$/g' | sed 's/}}//g'`
2072    line2=`echo  "${execute_command}" | sed 's/{{mpi_tasks}}/1/g' | sed 's/{{tasks_per_node}}/1/g' | sed 's/palm/combine_plot_fields.x/g'`
[2380]2073    eval line=\"$line\"
2074    execute_command="$line"
2075
2076
2077       # EXECUTION COMMAND FOR COMBINE_PLOT_FIELDS
[2566]2078    if [[ "$execute_command_for_combine" = "" ]]
2079    then
2080       eval line2=\"$line2\"
2081       execute_command_for_combine="$line2"
2082    fi
2083   
[2380]2084
2085
2086       # PROVIDE A HOSTFILE, IF REQUIRED
2087    if [[ "$hostfile" != "" ]]
2088    then
2089
2090       if [[ $hostfile = auto ]]
2091       then
2092             # CREATE A NEW HOSTFILE
2093          (( ii = 1 ))
2094          while (( ii <= cores / threads_per_task ))
2095          do
2096             echo  $(hostname)  >>  hostfile
2097             (( ii = ii + 1 ))
2098          done
2099          if (( cores / threads_per_task == 0 ))
2100          then
2101             echo  $(hostname)  >>  hostfile
2102          fi
2103       
2104       else
2105          cp  $hostfile  hostfile
2106       fi
2107       eval line=\"`head -n $ii  hostfile`\"
2108       printf "\n  *** running on: $line"
2109    fi
2110
2111
2112
2113       # SET THE NUMBER OF OPENMP-THREADS
2114    if [[ $use_openmp = true ]]
2115    then
2116       export OMP_NUM_THREADS=$threads_per_task
2117       printf "\n  *** number of OpenMP threads per MPI-task: $OMP_NUM_THREADS"
2118    else
2119       export OMP_NUM_THREADS=1
2120    fi
2121
2122
[2610]2123       # PROVIDE DATA FOR ATMOSPHERE OCEAN COUPLING
[2380]2124    if [[ $run_coupled_model = false ]]
2125    then
2126       if [[ "$ocean_file_appendix" = true ]]
2127       then
2128          echo "precursor_ocean"  >  coupling_steering
2129       else
2130          echo "precursor_atmos"  >  coupling_steering
2131      fi
2132    else
2133       (( iia = $cores_atmos / $threads_per_task ))
2134       (( iio = $cores_ocean / $threads_per_task ))
2135       printf "\n      coupled run ($iia atmosphere, $iio ocean)"
2136       printf "\n\n"
2137       echo "coupled_run $iia $iio"  >  coupling_steering
2138    fi
2139
2140    printf "\n  *** execute command:"
2141    printf "\n      \"$execute_command\" \n\n"
2142
2143    $execute_command  <  coupling_steering
2144
2145    if [[ $? != 0 ]]
2146    then
2147
2148           # ABORT IN CASE OF RUNTIME ERRORS
2149       printf "\n  +++ runtime error occured"
2150       locat=execution
2151       exit
2152
2153    else
2154
2155       printf "\n$dashes\n  *** execution finished \n"
2156
2157    fi
2158
2159
2160       # CALL OF combine_plot_fields IN ORDER TO MERGE SINGLE FILES WRITTEN
2161       # BY EACH CORE INTO ONE FILE
2162   if [[ ! -f combine_plot_fields.x ]]
2163   then
2164
2165      printf "\n\n\n  +++ WARNING: no combine_plot_fields found"
2166      printf "\n      2d- and/or 3d-data may be incomplete!"
2167      printf "\n      Your previous palmbuild may have failed. Please check.\n"
2168
2169   elif [[ "$combine_plot_fields" == true ]]
2170   then
2171
2172      printf "\n\n\n *** post-processing: now executing \"$execute_command_for_combine\" ..."
2173      $execute_command_for_combine
2174
2175   else
2176
2177         # TEMPORARY SOLUTION TO SKIP combine_plot_fields. THIS IS REQUIRED IN CASE OF HUGE AMOUNT OF
[2605]2178         # DATA OUTPUT
[2380]2179      printf "\n\n\n *** post-processing: skipping combine_plot_fields (-Z option set) ..."
2180   fi
2181
2182
2183
2184       # EXECUTE OUTPUT-COMMANDS GIVEN IN THE CONFIGURATION FILE
2185    (( i = 0 ))
2186    while (( i < ioc ))
2187    do
2188       (( i = i + 1 ))
2189       if (( i == 1 ))
2190       then
2191          printf "\n\n  *** execution of OUTPUT-commands:\n$dashes"
2192       fi
[2799]2193
2194          # REPLACE PARAMETERS IN THE OUTPUT COMMAND WITH REAL VALUES
2195       out_command[$i]=`echo  "${out_command[$i]}" | sed 's/{{/$/g' | sed 's/}}//g'`
2196
[2380]2197       printf "\n  >>> ${out_command[$i]}"
2198       eval  ${out_command[$i]}
2199       if (( i == ioc ))
2200       then
2201          printf "\n$dashes\n"
2202       fi
2203    done
2204
2205
[2610]2206       # IN A FIRST PASS, ADD ADDITIONAL OUTPUT FILE CONNECTIONS IN CASE OF
2207       # WILDCARDS
[2380]2208    (( i = 0 ))
[2610]2209    (( nr_of_output_files = 0 ))
2210
[2380]2211    while (( i < iout ))
2212    do
[2610]2213
[2380]2214       (( i = i + 1 ))
[2610]2215
2216          # FIRST CHECK FOR MULTIPLE NAMES WITH THE SAME LOCAL NAME AND
2217          # CREATE A LIST FOR THE DETECTED ENDINGS
2218       if [[ "${multout[$i]}" = true ]]
2219       then
2220             # DETERMINE THE EXISTING EXTENSIONS FROM THE LIST OF FILES
2221          ls -1 -d ${localout_pre[$i]}    >   filelist  2>/dev/null
2222          ls -1 -d ${localout_pre[$i]}_*  >>  filelist  2>/dev/null
2223
2224          endings="DEFAULT"
2225          while  read line
2226          do
2227                 # remove the local name from the beginning
2228              localnamestring="${localout_pre[$i]}"
2229              length_localname=${#localnamestring}
2230              ending=${line:${length_localname}}
2231
2232              if [[ "$ending" != "" ]]
2233              then
2234                 endings="$endings $ending"
2235              fi
2236 
2237          done <filelist
2238
2239          rm filelist
2240
2241       else
2242
2243             # SINGLE NAME
2244          endings=DEFAULT
2245
2246       fi
2247
2248          # FOR EACH BASENAME ENDING CREATE AN ENTRY IN THE FINAL OUTPUT FILE LIST
2249       for  ending  in  $endings
2250       do
2251
2252             # DEFAULT MEANS THAT THE ENDING GIVEN IN .iofiles SHALL BE USED
2253          if [[ $ending = DEFAULT ]]
2254          then
2255             ending=""
2256          fi
2257
2258             # NEW ENTRY (ENDING IS ALSO ADDED TO LOCAL FILENAME READ BY PALM!)
2259          (( nr_of_output_files = nr_of_output_files + 1 ))
2260          localout[$nr_of_output_files]="${localout_pre[$i]}"$ending
2261          transout[$nr_of_output_files]="${transout_pre[$i]}"
2262          actionout[$nr_of_output_files]="${actionout_pre[$i]}"
2263          pathout[$nr_of_output_files]="${pathout_pre[$i]}"
2264          endout[$nr_of_output_files]="${endout_pre[$i]}"$ending
2265          extout[$nr_of_output_files]="${extout_pre[$i]}"
[2669]2266          warnout[$nr_of_output_files]="${warnout_pre[$i]}"
[2610]2267
2268       done
2269
2270    done
2271
2272
2273
2274
2275       # COPY LOCAL OUTPUT-FILES TO THEIR PERMANENT DESTINATIONS
2276    (( i = 0 ))
2277    while (( i < nr_of_output_files ))
2278    do
2279       (( i = i + 1 ))
[2380]2280       if (( i == 1 ))
2281       then
2282          printf "\n\n  *** saving OUTPUT-files:"
2283
2284             # GET RUN NUMBER ASSIGNED BY PALM
2285          if [[ -f RUN_NUMBER ]]
2286          then
2287              read  run_number  <  RUN_NUMBER
2288              printf "\n  *** PALM generated run_number = "$run_number" will be used as unified cycle number for all output files"
2289              usecycle_option="-U $run_number"
2290          else
2291              run_number=0
2292              usecycle_option=""
2293          fi
2294          if [[ $running_on_remote = true  &&  "$remote_loginnode" != "" ]]
2295          then
[2404]2296             printf "\n  *** in case of SCP transfers to local host"
2297             printf "\n      they will be done via remote login-node \"$remote_loginnode\" "
[2380]2298          fi
2299          printf "\n$dashes"
2300       fi
2301
2302       if [[ ! ( $running_on_remote = true  &&  ( "${actionout[$i]}" = tr || "${actionout[$i]}" = tra || "${actionout[$i]}" = trpe ) ) ]]
2303       then
2304
[2610]2305          eval filename=${pathout[$i]}/${fname}${endout[$i]}
2306
2307             # DETERMINE THE CYCLE NUMBER
2308          ls -1 -d $filename    >   filelist  2>/dev/null
2309          ls -1 -d $filename.*  >>  filelist  2>/dev/null
2310          while  read line
2311          do
2312   
2313                # filename without path (i.e. after the last "/")
2314             basefilename=$(basename ${line})
2315   
2316                # check if there is an extension
2317             extension=${basefilename##*.}
2318             if [[ "$extension" = "${extout[$i]}" ]]
2319             then
2320                basefilename=${basefilename%.*}
2321             fi
2322   
2323                # check for an existing cycle number
2324             cycle=${basefilename##*.}
2325             if [[ $cycle =~ ^-?[0-9]+$ ]]
2326             then
[2669]2327                   # NUMBERS WITH LEADING ZEROS ARE INTERPRETED AS OCTAL NUMBERS
2328                   # 10# EXPLICITLY SPECIFIES THE NUMBER BASE AS 10
2329                (( icycle = $((10#$cycle)) + 1 ))
[2610]2330             else
2331                (( icycle = 1 ))
2332             fi
2333   
2334             if (( icycle > maxcycle ))
2335             then
2336                (( maxcycle = icycle ))
2337             fi
2338   
2339          done <filelist
2340          rm filelist
2341
2342   
2343             # SET THE CYCLE NUMBER
2344             # IN CASE OF FILE-APPEND, IT MUST BE THE HIGHEST EXISTING CYCLE NUMBER
2345          if [[ "${actionout[$i]}" = a ]]
2346          then
2347             (( maxcycle = maxcycle - 1 ))
2348          fi
2349         
2350          (( cycnum[$i] = maxcycle ))
2351          pathout[$i]=$filename
2352
2353
2354             # ADD CYCLE NUMBER TO FILENAME
2355             # IN APPEND MODE, FILES KEEP THEIR CURRENT CYCLE NUMBER
[2380]2356          if [[ "${actionout[$i]}" != "a" ]]
2357          then
2358                # SET RUN NUMBER AS CYCLE NUMBER, IF THERE IS NOT A CONFLICT
2359                # WITH AN EXISTING CYCLE NUMBER
2360             if (( run_number >= cycnum[$i] ))
2361             then
2362                (( cycnum[$i] = run_number ))
2363             else
2364                if (( run_number > 0 ))
2365                then
2366                   printf "\n  --- INFORMATIVE: The following file cannot get a unified cycle number"
2367                fi
2368             fi
2369          fi
2370          if (( cycnum[$i] > 0 ))
2371          then
[2600]2372             cyclestring=`printf "%03d" ${cycnum[$i]}`
2373             pathout[$i]=${pathout[$i]}.$cyclestring
[2380]2374          fi
2375       fi           
2376
2377          # CHECK FOR SINGLE FILE (SERIAL RUN) OR DIRECTORY (ONE FILE PER CORE FOR PARELLEL EXECUTION)
2378       files_for_cores=false; filetype=file
2379       link_local_output=false
2380       if [[ "${actionout[$i]}" = pe  &&  -n $cores ]]
2381       then
2382          files_for_cores=true; filetype=directory
2383          actionout[$i]=""
2384       elif [[ "${actionout[$i]}" = pe  &&  ! -n $cores ]]
2385       then
2386          actionout[$i]=""
2387       elif [[ "${actionout[$i]}" = lnpe  &&  -n $cores ]]
2388       then
2389          files_for_cores=true; filetype=directory
2390          link_local_output=true
2391          actionout[$i]=""
2392       elif [[ "${actionout[$i]}" = lnpe  &&  ! -n $cores ]]
2393       then
2394          link_local_output
2395          actionout[$i]=""
2396       elif [[ "${actionout[$i]}" = trpe  &&  -n $cores ]]
2397       then
2398          files_for_cores=true; filetype=directory
2399          actionout[$i]="tr"
2400       elif [[ "${actionout[$i]}" = trpe  &&  ! -n $cores ]]
2401       then
2402          actionout[$i]="tr"
2403       fi
2404
2405       if [[ ! -f ${localout[$i]}  &&  $files_for_cores = false ]]
2406       then
[2669]2407          if [[ ${warnout[$i]} = true ]]
2408          then
2409             printf "\n  +++ temporary OUTPUT-file  ${localout[$i]}  does not exist\n"
2410          fi
[2380]2411       elif [[ ! -d ${localout[$i]}  &&  $files_for_cores = true ]]
2412       then
[2669]2413          if [[ ${warnout[$i]} = true ]]
2414          then
2415             printf "\n  +++ temporary OUTPUT-file  ${localout[$i]}/....  does not exist\n"
2416          fi
[2380]2417       else
2418
2419
2420             # COPY VIA SCP TO LOCAL HOST (ALWAYS IN BINARY MODE USING batch_scp option -m)
2421             # IF TARGET DIRECTORY DOES NOT EXISTS, TRY TO CREATE IT
2422          if [[ "${actionout[$i]}" = tr  ||  "${actionout[$i]}" = tra ]]
2423          then
2424             if [[ $running_on_remote = true ]]
2425             then
2426
2427                   # SET OPTIONS FOR TRANSFER
2428                if [[ "${actionout[$i]}" = tr ]]
2429                then
2430                   if [[ $files_for_cores = false ]]
2431                   then
2432                      catalog_option=""
2433                      catalog_string=""
2434                   else
2435                      catalog_option="-c"
2436                      catalog_string="/"
2437                   fi
2438                   append_option=""
2439                   append_string=""
2440                else
2441                   append_option="-A"
2442                   append_string="append"
2443                fi
2444
2445                transfer_failed=false
2446                printf "\n  >>> OUTPUT: ${localout[$i]}$catalog_string  $append_string by SCP to"
[2506]2447                printf "\n              ${pathout[$i]}/${host_configuration}_${fname}${endout[$i]}$catalog_string\n"
[2380]2448
2449                   # TRANSFER VIA SCP
2450                if [[ "$remote_loginnode" != "" ]]
2451                then
[2566]2452                   echo "cd $tempdir; ${fast_io_catalog}/${sources_for_run_catalog}/batch_scp $PORTOPT $catalog_option $append_option -b -m $usecycle_option -u $local_username $return_address  ${localout[$i]} \"${pathout[$i]}\" ${host_configuration}_${fname}${endout[$i]}  ${extout[$i]}"  |  ssh -q $remote_username@$remote_loginnode
[2380]2453                else
[2506]2454                   batch_scp $PORTOPT $catalog_option $append_option -b -m $usecycle_option -u $local_username $return_address  ${localout[$i]} "${pathout[$i]}" ${host_configuration}_${fname}${endout[$i]}  ${extout[$i]}
[2380]2455                fi
2456                [[ $? != 0 ]]  &&  transfer_failed=true
2457
2458
2459                   # IF TRANSFER FAILED, CREATE BACKUP COPY ON THIS MACHINE
2460                if [[ $transfer_failed = true ]]
2461                then
2462                   printf "  +++ transfer failed. Trying to save a copy on this host under:\n"
[2506]2463                   printf "      ${pathout[$i]}/${host_configuration}_${fname}${endout[$i]}_$run_id\n"
[2380]2464
2465                      # FIRST CHECK, IF DIRECTORY EXISTS, AND CREATE IT, IF NECESSARY
2466                   eval  local_catalog=${pathout[$i]}
2467                   if [[ ! -d $local_catalog ]]
2468                   then
2469                      printf "  *** local directory does not exist. Trying to create:\n"
2470                      printf "      $local_catalog \n"
2471                      mkdir -p  $local_catalog
2472                   fi
[2506]2473                   eval  cp  ${localout[$i]}  ${pathout[$i]}/${host_configuration}_${fname}${endout[$i]}_$run_id
[2380]2474                   transfer_problems=true
2475                fi
2476
2477             else
2478
2479                   # UNSET actionout. DUE TO THIS SETTING, FILE WILL LATER JUST
2480                   # BE COPIED OR APPENDED ON THIS MACHINE
2481                if [[ "${actionout[$i]}" = tr ]]
2482                then
2483                   actionout[$i]=""
2484                else
2485                   actionout[$i]="a"
2486                fi
2487             fi
2488          fi
2489
2490
2491             # APPEND ON THIS MACHINE
2492          if [[ "${actionout[$i]}" = "a" ]]
2493          then
2494             if [[ "${extout[$i]}" != " "  &&  "${extout[$i]}" != "" ]]
2495             then
2496                printf "\n  >>> OUTPUT: ${localout[$i]}  append to"
2497                printf "\n              ${pathout[$i]}.${extout[$i]}\n"
2498                cat  ${localout[$i]}  >>  ${pathout[$i]}.${extout[$i]}
2499             else
2500                printf "\n  >>> OUTPUT: ${localout[$i]}  append to"
2501                printf "\n              ${pathout[$i]}\n"
2502                cat  ${localout[$i]}  >>  ${pathout[$i]}
2503             fi
2504          fi
2505
2506             # COPY ON THIS MACHINE
2507             # COPY HAS TO BE USED, BECAUSE MOVE DOES NOT WORK IF FILE-ORIGIN AND TARGET ARE
2508             # ON DIFFERENT FILE-SYSTEMS
2509          if [[ "${actionout[$i]}" = ""  &&  $files_for_cores = false ]]
2510          then
2511
2512                # COPY IN CASE OF RUNS ON SINGLE CORES
2513             if [[ "${extout[$i]}" != " "  &&  "${extout[$i]}" != "" ]]
2514             then
2515                printf "\n  >>> OUTPUT: ${localout[$i]}  to"
2516                printf "\n              ${pathout[$i]}.${extout[$i]}\n"
2517                              if [[ $link_local_output = true ]]
2518                              then
2519                                 printf "      file will be linked\n"
2520                                 ln -f  ${localout[$i]}  ${pathout[$i]}.${extout[$i]}
2521                              fi
2522                                 # If "ln -f" fails of if "$link_local_output = false" do a normal "cp"
2523                              if [[ ! -f "${pathout[$i]}.${extout[$i]}" ]]
2524                then
2525                                 if [[ $link_local_output = true ]]
2526                          then
2527                      printf "  --- WARNING: ln failed, using cp instead (might be time consuming...)\n"
2528                                 fi
2529                                 cp  ${localout[$i]}  ${pathout[$i]}.${extout[$i]}
2530                              else
2531                   printf "+++ no copy because file ${pathout[$i]}.${extout[$i]} exists\n"
2532                fi
2533             else
2534                printf "\n  >>> OUTPUT: ${localout[$i]}  to"
2535                printf "\n              ${pathout[$i]}\n"
2536                              if [[ $link_local_output = true ]]
2537                              then
2538                                 printf "      file will be linked\n"
2539                                 ln -f  ${localout[$i]}  ${pathout[$i]}
2540                              fi
2541                                 # If "ln -f" fails of if "$link_local_output = false" do a normal "cp"
2542                        if [[ ! -f "${pathout[$i]}" ]]
2543                then
2544                                 if [[ $link_local_output = true ]]
2545                          then
2546                      printf "  --- WARNING: ln failed, using cp instead (might be time consuming...)\n"
2547                                 fi
2548                                 cp  ${localout[$i]}  ${pathout[$i]}
2549                              else
2550                                 printf "+++ no copy because file ${pathout[$i]} exists\n"
2551                fi
2552             fi
2553
2554          elif [[ "${actionout[$i]}" = ""  &&  $files_for_cores = true ]]
2555          then
2556
2557                # FILES FROM THE DIFFERENT CORES ARE MOVED WITH ln-COMMAND TO THE PERMANENT DIRECTORY
2558                # AS A FIRST STEP, THE PERMANENT DIRECTORY IS CREATED
2559             printf "\n  >>> OUTPUT: ${localout[$i]}/_....  to"
2560             printf "\n              ${pathout[$i]}\n"
2561                    if [[ $link_local_output = true ]]
2562                    then
2563                              printf "      files will be linked\n"
[2396]2564                              mkdir -p ${pathout[$i]}
[2380]2565                              cd ${localout[$i]}
2566                              for file in $(ls *)
2567                              do
2568                                 ln -f $file  ${pathout[$i]}
2569                              done >|/dev/null 2>&1
[2566]2570                              cd $tempdir
[2380]2571                    fi
2572
2573                # IF "ln -f" HAS FAILED OR IF "$link_local_output = false" DO A NORMAL COPY "cp -r"
2574                    if [[ ! -f "${pathout[$i]}/_000000" ]]
2575             then
2576                              if [[ $link_local_output = true ]]
2577                              then
2578                   printf "  --- WARNING: ln failed, using cp instead (might be time consuming...)\n"
2579                              fi
2580                              cp -r  ${localout[$i]}/*  ${pathout[$i]}
2581             fi
2582
2583          fi
2584       fi
2585    done
2586
2587    if (( i != 0 ))
2588    then
2589       if [[ $transfer_problems = true ]]
2590       then
2591          printf "\n$dashes\n  *** OUTPUT-files saved"
2592          printf "\n  +++ WARNING: some data transfers failed! \n"
2593       else
2594          printf "\n$dashes\n  *** all OUTPUT-files saved \n"
2595       fi
2596    fi
2597
2598
2599       # IF REQUIRED, START A RESTART-JOB
2600       # FILE CONTINUE_RUN MUST HAVE BEEN CREATED BY THE EXECUTABLE (PALM)
2601    if [[ -f CONTINUE_RUN ]]
2602    then
2603
2604          # ADD RESTART-OPTIONS TO THE PALMRUN-CALL (IF THEY ARE NOT USED ALREADY):
2605          # -C TELLS PALMRUN THAT IT IS A RESTART-RUN
2606          # -v SILENT MODE WITHOUT INTERACTIVE QUERIES
2607          # -b START A BATCH JOB
2608       [[ $(echo $prc | grep -c "\-C") = 0 ]]  &&  prc="$prc -C"
2609       [[ $(echo $prc | grep -c "\-v") = 0 ]]  &&  prc="$prc -v"
2610       [[ $(echo $prc | grep -c "\-b") = 0 ]]  &&  prc="$prc -b"
2611
2612
2613          # REPLACE THE HASH IN THE ACTIVATION STRINGS (GIVEN WITH OPTION -a)
2614          # SO THAT RESTARTS ACCESS DIFFERENT FILES THAN THE INITIAL RUN
2615       if [[ $(echo $prc | grep -c "#") != 0 ]]
2616       then
[2381]2617          prc=`echo $prc | sed 's/#/r/g'`
[2380]2618       fi
2619
2620
2621          # START THE RESTART-JOB
2622       printf "\n\n  *** initiating restart-run on \"$local_ip\" using command:\n"
2623       echo "      $prc"
2624       printf "\n$dashes\n"
2625       if [[ $running_on_remote = true ]]
2626       then
2627
2628          echo "*** ssh will be used to initiate restart-runs!"
2629          echo "    return_address=\"$return_address\" "
2630          echo "    return_username=\"$local_username\" "
2631
2632          if [[ "$remote_loginnode" != "" ]]
2633          then
[2420]2634             echo "echo \" PATH=\\\$PATH:$LOCAL_PALMRUN_PATH; cd $LOCAL_PWD; $prc\" |  ssh -q $SSH_PORTOPT  $local_username@$return_address  " |  ssh -q $remote_username@$remote_loginnode
[2380]2635          else
[2420]2636             echo \" PATH=\\\$PATH:$LOCAL_PALMRUN_PATH; cd $LOCAL_PWD; $prc\" |  ssh -q $SSH_PORTOPT  $local_username@$return_address
[2380]2637          fi
2638
2639             # WAIT TO ALLOW THE RESTART-JOB TO BE QUEUED, BEFORE THE CURRENT JOB IS FINISHED
2640          sleep 30
2641
2642       else
2643
2644             # START THE RESTART JOB ON THE LOCAL HOST
2645          eval  $prc                # THE ' MUST BE EVALUATED
2646          cd -  > /dev/null
2647
2648       fi
2649       printf "\n$dashes\n  *** restart-run initiated \n"
2650
2651
2652          # DELETE INPUT-(RESTART)FILES, WHICH HAVE BEEN FETCHED FROM THE TEMPORARY DATA
2653          # DIRECTORY, BACAUSE THEY ARE NOT REQUIRED BY THE RESTART-JOB.
2654          # THIS IS DONE IN ORDER TO AVOID EXCEEDING DISC QUOTAS OR DISC SPACE (RESTART-FILES
2655          # MAY BE VERY HUGE)
2656       (( i = 0 ))
[2610]2657       while (( i < nr_of_input_files ))
[2380]2658       do
2659          (( i = i + 1 ))
2660          if [[ "${got_tmp[$i]}" = true   &&  $keep_data_from_previous_run = false ]]
2661          then
2662             rm -r  ${absnamein[$i]}
2663          fi
2664       done
2665
2666    fi
2667
2668
2669       # ALL ACTIONS FINISHED, TEMPORARY WORKING-DIRECTORY CAN BE DELETED
2670    cd  $HOME
[2566]2671    [[ $delete_temporary_catalog = true ]]  &&  rm -rf $tempdir
[2380]2672
2673
2674 else
2675
2676
2677       # PREPARING ACTIONS,
2678       # IF A BATCH-JOB IS TO BE GENERATED AND TO BE STARTED ON A LOCAL OR REMOTE-MACHINE
2679
2680       # BUILD THE PALMRUN-COMMAND TO BE CALLED IN THE BATCH-JOB
[2506]2681    palmrun_com="$palmrun_script_name -d $fname -h $host_configuration -m $memory -t $cpumax -q $queue -r $run_id -U $local_username"
[2380]2682    [[ "$activation_string_list" != "" ]]  &&  palmrun_com=${palmrun_com}" -a \"$activation_string_list\""
2683    [[ "$global_revision" != "" ]]  &&  palmrun_com=${palmrun_com}" -G \"$global_revision\""
2684    [[ $keep_data_from_previous_run = true ]]  &&  palmrun_com=${palmrun_com}" -k"
2685    [[ $do_trace = true ]]        &&  palmrun_com=${palmrun_com}" -x"
2686    [[ "$cores" != "" ]]       &&  palmrun_com=${palmrun_com}" -X $cores"
2687    [[ $use_openmp = true ]]  &&  palmrun_com=${palmrun_com}" -O $threads_per_task"
[2501]2688    [[ $tasks_per_node != 0 ]]  &&  palmrun_com=${palmrun_com}" -T $tasks_per_node"
[2380]2689    [[ $delete_temporary_catalog = false ]]  &&  palmrun_com=${palmrun_com}" -B"
2690    [[ "$ocean_file_appendix" = true ]]  &&  palmrun_com=${palmrun_com}" -y"
2691    [[ $run_coupled_model = true ]]  &&  palmrun_com=${palmrun_com}" -Y \"$coupled_dist\""
2692    [[ "$combine_plot_fields" = false ]]  &&  palmrun_com=${palmrun_com}" -Z"
2693    [[ "$max_par_io_str" != "" ]]  &&  palmrun_com=${palmrun_com}" -w $max_par_io_str"
[2479]2694    [[ "$project_account" != "" ]]  &&  palmrun_com=${palmrun_com}" -A $project_account"
[2380]2695    if [[ $create_remote_batch_job = true ]]
2696    then
2697       palmrun_com=${palmrun_com}" -j -u $remote_username -R $local_ip"
[2420]2698       if [[ $do_trace = true ]]
2699       then
2700          printf "\n *** PALMRUN-command on remote host:\n     $palmrun_com \n"
2701       fi
[2380]2702    elif [[ $create_batch_job = true ]]
2703    then
2704       palmrun_com=${palmrun_com}" -j"
[2420]2705       if [[ $do_trace = true ]]
2706       then
2707          printf "\n *** PALMRUN-command on local host:\n     $palmrun_com \n"
2708       fi
[2380]2709    fi
2710
2711
2712       # DETERMINE THE FULL PATHS FOR THE JOB PROTOCOL FILES ON THE LOCAL AND
2713       # REMOTE HOST
[2506]2714    job_protocol_file_local=${local_jobcatalog}/${host_configuration}_${job_id}
[2380]2715    job_protocol_file=$job_protocol_file_local
2716    if [[ $create_remote_batch_job = true ]]
2717    then
[2506]2718       job_protocol_file_remote=${remote_jobcatalog}/${host_configuration}_${job_id}
[2380]2719       job_protocol_file=$job_protocol_file_remote
2720       job_transfer_protocol_file=${remote_jobcatalog}/last_job_transfer_protocol
2721       scpjob_file=${remote_jobcatalog}/scpjob.$run_id
2722    fi
2723
2724
2725       # BUILD THE JOB-SCRIPTS ON FILE jobfile
2726    jobfile=jobfile.$run_id
2727
2728
2729       # FIRST CREATE THE BATCH DIRECTIVES
2730    (( i = 0 ))
2731    while (( i < ibd ))
2732    do
2733       (( i = i + 1 ))
[2693]2734       line=`echo  "${batch_directive[$i]}" | sed 's/{{/$/g' | sed 's/}}//g'`
[2380]2735       eval line=\"$line\"
2736       echo  "$line"                               >>  $jobfile
2737    done
2738    echo " "                                       >>  $jobfile
2739
2740
2741       # FOR BATCH JOBS ON REMOTE HOSTS, ADD THE JOBFILE TO SEND BACK THE JOB
2742       # PROTOCOL
2743    if [[ $create_remote_batch_job = true ]]
2744    then
2745       echo "set +vx"                              >>  $jobfile
2746       echo "trap '"                               >>  $jobfile
2747       echo "set +vx"                              >>  $jobfile
2748       echo "cd ${remote_jobcatalog}"              >>  $jobfile
2749       echo "cat >  scpjob.$run_id << %%END%%"     >>  $jobfile
2750
2751          # ADD THE BATCH DIRECTIVES
2752       (( i = 0 ))
2753       while (( i < ibdt ))
2754       do
2755          (( i = i + 1 ))
[2693]2756          line=`echo  "${batch_directive_transfer[$i]}" | sed 's/{{/$/g' | sed 's/}}//g'`
[2380]2757          eval line=\"$line\"
2758          echo  "$line"                            >>  $jobfile
2759       done
2760       echo " "                                    >>  $jobfile
2761
2762       echo "set -x"                               >>  $jobfile
[2506]2763       echo "${fast_io_catalog}/${sources_for_run_catalog}/batch_scp  $PORTOPT  -d  -w 10  -u $local_username $local_ip  $job_protocol_file_remote  \"$local_jobcatalog\"  ${host_configuration}_${fname}"  >>  $jobfile
[2380]2764       echo "%%END%%"                              >>  $jobfile
2765       echo "echo \" *** submitting job for transfering the job protocol file to $local_ip\" "  >>  $jobfile
2766       echo "$submit_command  $scpjob_file"        >>  $jobfile
2767       echo "rm $scpjob_file"                      >>  $jobfile
[2404]2768       echo "rm -rf $job_transfer_protocol_file"   >>  $jobfile
[2380]2769       echo "set -x"                               >>  $jobfile
2770       echo "     ' exit"                          >>  $jobfile
2771    fi
2772
2773
2774       # ACTIVATE ERROR-TRACEBACK
2775    if [[ $do_trace = true ]]
2776    then
2777       echo  "set -x"                                    >>  $jobfile
2778    else
2779       echo  "set +vx"                                   >>  $jobfile
2780    fi
2781
2782
2783       # INITIALIZE THE ENVIRONMENT AND LOAD MODULES
2784    if [[ "$login_init_cmd" != "" ]]
2785    then
2786       echo  "$login_init_cmd"        >>  $jobfile
2787    fi
2788    if [[ "$module_commands" != "" ]]
2789    then
2790       echo  "$module_commands"     >>  $jobfile
2791    fi
2792
2793
2794       # CREATE TEMPORARY DIRECTORY AND SWITCH TO IT
[2566]2795    if [[ $create_remote_batch_job = true ]]
2796    then
2797       echo  "mkdir  $tempdir"           >>  $jobfile
2798       echo  "chmod  go+rx  $tempdir"    >>  $jobfile
2799    else
2800          # DIRECTORY FOR LOCAL BATCH JOBS IS CREATED NOW, DUE TO A
2801          # REQUIREMENT OF THE GRID ENGINE BATCH SYSTEM (WORKING DIR IS GIVEN IN
2802          # BATCH DIRECTIVE -wd AND MUST ALREADY EXIST WHEN THE JOB IS SUBMITTED)
2803       mkdir  $tempdir
2804       chmod  go+rx  $tempdir
2805    fi
2806    echo  "cd  $tempdir"                 >>  $jobfile
2807    echo  "export tempdir=$tempdir"      >>  $jobfile
[2506]2808    echo  "cp  ${fast_io_catalog}/${sources_for_run_catalog}/{*,.[!.]*}  ."  >>  $jobfile
[2380]2809    echo  "export PATH=.:\$PATH"         >>  $jobfile
2810    echo  "export execute_palmrun=true"  >>  $jobfile
2811
2812
2813       # PROVIDE NAME OF THE CURRENT WORKING-DIRECTORY ON THE LOCAL MACHINE (FROM WHERE THE JOB IS
2814       # STARTED) BY SETTING AN ENVIRONMENT-VARIABLE. THIS INFORMATION IS USED IN THE JOB BY PALMRUN
2815       # IN CASE THAT RESTART-RUNS HAVE TO BE GENERATED
2816    echo  "LOCAL_PWD=$working_directory"                >>  $jobfile
2817    echo  "export LOCAL_PWD"                            >>  $jobfile
2818
2819
2820       # PROVIDE THE PATH OF THE LOCAL PALMRUN-SCRIPT FOR THE SAME REASON
[2420]2821    echo  "LOCAL_PALMRUN_PATH=${source_path}/../SCRIPTS"   >>  $jobfile
[2380]2822    echo  "export LOCAL_PALMRUN_PATH"                      >>  $jobfile
2823
2824
2825       # CALL PALMRUN WITHIN THE JOB
2826       # AS FINAL ACTION, REMOVE THE TEMPORARY DIRECTORY CREATED AT THE BEGINNING OF THE JOB
2827    echo  "set -x"                                              >>  $jobfile
2828    echo  "[[ \$execute_palmrun = true ]]  &&  $palmrun_com"    >>  $jobfile
2829
2830
2831       # TRANSFER JOBFILE TO THE TARGET HOST
2832    if [[ $create_jobfile_only = false ]]
2833    then
2834
2835       if [[ $create_remote_batch_job = true ]]
2836       then
2837
[2420]2838          echo " "
[2566]2839          echo " *** transfer of job to remote host via scp"
[2420]2840          if [[ $do_trace = true ]]
2841          then
[2506]2842             echo "     scp $ssh_key $PORTOPT $jobfile ${remote_username}@${remote_ip}:${remote_jobcatalog}/${host_configuration}_${job_id}"
[2420]2843          fi
[2566]2844          scp $ssh_key $PORTOPT $jobfile ${remote_username}@${remote_ip}:${remote_jobcatalog}/${host_configuration}_${job_id}  >  /dev/null
[2380]2845
[2566]2846          printf " *** submit the job (output of submit command, e.g. the job-id, may follow)"
[2420]2847          if [[ $do_trace = true ]]
2848          then
[2506]2849             echo "     cd $remote_jobcatalog; $submit_command ${host_configuration}_${job_id}; rm ${host_configuration}_${job_id}  |  ssh  -q  $ssh_key $SSH_PORTOPT  ${remote_username}@${remote_ip}  2>&1"
[2420]2850          fi
[2506]2851          echo "cd $remote_jobcatalog; $submit_command ${host_configuration}_${job_id}; rm ${host_configuration}_${job_id}"  |  ssh  -q  $ssh_key $SSH_PORTOPT  ${remote_username}@${remote_ip}  2>&1
[2380]2852
2853       elif [[ $create_batch_job = true ]]
2854       then
2855
[2385]2856          eval  local_jobcatalog=$local_jobcatalog
[2506]2857          cp  $jobfile  ${local_jobcatalog}/${host_configuration}_${job_id}
[2385]2858          cd $local_jobcatalog
[2380]2859          echo " "
[2420]2860          echo " *** submit the job"
2861          if [[ $do_trace = true ]]
2862          then
[2506]2863             echo "$submit_command ${host_configuration}_${job_id}"
[2420]2864          fi
[2506]2865          $submit_command ${host_configuration}_${job_id}
2866          rm ${host_configuration}_${job_id}
[2380]2867          cd -  > /dev/null
2868
2869       fi
2870
2871       rm -rf  $jobfile
2872
2873    else
2874
2875       printf "\n *** jobfile created under name \"$jobfile\" "
2876       printf "\n     no batch-job has been sent!"
2877
2878    fi
2879
2880 fi  # END OF REMOTE-PART
Note: See TracBrowser for help on using the repository browser.