Index: palm/trunk/SCRIPTS/mrun
===================================================================
--- palm/trunk/SCRIPTS/mrun	(revision 757)
+++ palm/trunk/SCRIPTS/mrun	(revision 759)
@@ -215,6 +215,6 @@
      # 14/12/10 - Siggi  - adjustments for new Tsubame system at Tokyo
      #                     institute of technology (lctit)
-     # 23/12/10 - Micha  - different number of processors in ocean and atmosphere
-     #                     is now allowed 
+     # 23/12/10 - Micha  - different number of processors in ocean and
+     #                     atmosphere is now allowed 
      # 02/02/10 - Siggi  - further adjustments on Tsubame and concerning openMP
      #                     usage
@@ -225,9 +225,13 @@
      # 06/04/11 - BjornM - bugfix for runs with mpt on lcsgi
      # 17/08/11 - Siggi  - extensions for impi library
-     # 18/08/11 - Siggi  - bugfix for local append of output files with suffix (.nc)
+     # 18/08/11 - Siggi  - bugfix for local append of output files with suffix
+     #                     (.nc)
      # 18/08/11 - Marcus - support for Linux OS with German locale
-     #                   - properly report hosts on general Linux clusters 
+     #                   - properly report hosts on general Linux clusters
      # 29/08/11 - BjornW - adapted for lcflow (ForWind cluster in Oldenburg)
-     # 29/08/11 - Carolin- initiating restart-run: adjustment of the path at IMUK
+     # 29/08/11 - Carolin- initiating restart-run: adjustment of the path at
+     #                     IMUK
+     # 15/09/11 - Siggi  - new option -w tp set the maximum number of parallel
+     #                     io streams, option -T is obligatory from now on
 
  
@@ -287,4 +291,5 @@
  mainprog=""
  makefile=""
+ max_par_io_str=""
  mc=$0
  while [[ $(echo $mc | grep -c "/") != 0 ]]
@@ -474,5 +479,5 @@
     # SHELLSCRIPT-OPTIONEN EINLESEN UND KOMMANDO NEU ZUSAMMENSETZEN, FALLS ES
     # FUER FOLGEJOBS BENOETIGT WIRD
- while  getopts  :a:AbBc:Cd:D:Fg:G:h:H:i:IkK:m:M:n:o:O:p:P:q:r:R:s:St:T:u:U:vxX:yY: option
+ while  getopts  :a:AbBc:Cd:D:Fg:G:h:H:i:IkK:m:M:n:o:O:p:P:q:r:R:s:St:T:u:U:vw:xX:yY: option
  do
    case  $option  in
@@ -507,8 +512,9 @@
        (S)   read_from_config=false; mc="$mc -S";;
        (t)   cpumax=$OPTARG; mc="$mc -t$OPTARG";;
-       (T)   tasks_per_node=$OPTARG; mc="$mc -T$OPTARG";;
+       (T)   mrun_tasks_per_node=$OPTARG; mc="$mc -T$OPTARG";;
        (u)   remote_username=$OPTARG; mc="$mc -u$OPTARG";;
        (U)   return_username=$OPTARG; mc="$mc -U$OPTARG";;
        (v)   silent=true; mc="$mc -v";;
+       (w)   max_par_io_str=$OPTARG; mc="$mc -w$OPTARG";;
        (x)   do_trace=true;set -x; mc="$mc -x";;
        (X)   numprocs=$OPTARG; mc="$mc -X$OPTARG";;
@@ -567,4 +573,5 @@
     printf "\n        -u    username on remote machine               \"\" "
     printf "\n        -v    no prompt for confirmation               ---"
+    printf "\n        -w    maximum parallel io streams              as given by -X"
     printf "\n        -x    tracing of mrun for debug purposes       ---"
     printf "\n        -X    # of processors (on parallel machines)   1"
@@ -1036,8 +1043,10 @@
 
        # OPTIONSWERTE UEBERSTEUERN KONFIGURATIONSDATEI
-    [[ $mrun_memory     != 0  ]]  &&  memory=$mrun_memory
+    [[ $mrun_memory     != 0   ]]  &&  memory=$mrun_memory
     [[ "$mrun_group_number" != "none" ]]  &&  group_number=$mrun_group_number
-    [[ $mrun_cpumax     != 0  ]]  &&  cpumax=$mrun_cpumax
-    [[ "$mrun_numprocs" != "" ]]  &&  numprocs=$mrun_numprocs
+    [[ $mrun_cpumax     != 0   ]]  &&  cpumax=$mrun_cpumax
+    [[ "$mrun_numprocs" != ""  ]]  &&  numprocs=$mrun_numprocs
+    [[ "$max_par_io_str" != "" ]]  &&  maximum_parallel_io_streams=$max_par_io_str
+    [[ "$mrun_tasks_per_node" != "" ]]  &&  tasks_per_node=$mrun_tasks_per_node
 
  fi
@@ -1157,23 +1166,27 @@
        # DEFAULT-WERT SETZEN) UND OB SIE EIN GANZZAHLIGER TEILER DER
        # GESAMTPROZESSORANZAHL IST
-    if [[ $host = nech  ||  $host = necriam  ||  $host = ibmh  ||  $host = ibmkisti  ||  $host = ibms ]]
-    then
-       [[ "$tasks_per_node" = "" ]]  &&  tasks_per_node=6
-       (( ival = $tasks_per_node ))
-       (( pes = numprocs ))
+    if [[ "$tasks_per_node" = ""  ]]
+    then
+       printf "\n"
+       printf "\n  +++ option \"-T\" (tasks per node) is missing"
+       printf "\n      set -T option or define tasks_per_node in the config file"
+       locat=tasks_per_node; (( iec = 0 )); exit 
+    fi
+    (( ival = $tasks_per_node ))
+    (( pes = numprocs ))
 #       if [[ $(echo $package_list | grep -c dvrp_graphics+1PE) = 1 ]]
 #       then
 #          (( pes = pes - 1 ))
 #       fi
-       (( ii = pes / ival ))
-       if (( pes - ii * ival > 0 ))
-       then
-          printf "\n"
-          printf "\n  +++ tasks per node (option \"-T\") must be an integral"
-          printf "\n      divisor of the total number of processors (option \"-X\")"
-          printf "\n      values of this mrun-call: \"-T $tasks_per_node\" \"-X $numprocs\""
-          locat=tasks_per_node; (( iec = 0 )); exit 
-       fi
-    fi
+    (( ii = pes / ival ))
+    if (( pes - ii * ival > 0 ))
+    then
+       printf "\n"
+       printf "\n  +++ tasks per node (option \"-T\") must be an integral"
+       printf "\n      divisor of the total number of processors (option \"-X\")"
+       printf "\n      values of this mrun-call: \"-T $tasks_per_node\" \"-X $numprocs\""
+       locat=tasks_per_node; (( iec = 0 )); exit 
+    fi
+
 
        # IBMY HAT NUR EINEN KNOTEN
@@ -1190,11 +1203,4 @@
     fi
 
-       # FALLS OPENMP PARALLELISIERUNG VERWENDET WERDEN SOLL, ANZAHL VON THREADS
-       # SETZEN UND ZAHL DER TASKS PRO KNOTEN AUF 1 SETZEN
-#    if [[ $use_openmp = true ]]
-#    then
-#       threads_per_task=$tasks_per_node
-#       tasks_per_node=1
-#    fi
 
        # SETTINGS FOR SUBJOB-COMMAND
@@ -1263,4 +1269,10 @@
  fi
 
+
+    # Set default value for the maximum number of parallel io streams
+ if [[ "$maximum_parallel_io_streams" = "" ]]
+ then
+    maximum_parallel_io_streams=$numprocs
+ fi
 
 
@@ -2194,4 +2206,9 @@
  then
     spalte1="tasks per node:"; spalte2="$tasks_per_node (number of nodes: $nodes)"
+    printf "| $spalte1$spalte2 | \n"
+ fi
+ if [[ $maximum_parallel_io_streams != $numprocs ]]
+ then
+    spalte1="max par io streams:"; spalte2="$maximum_parallel_io_streams"
     printf "| $spalte1$spalte2 | \n"
  fi
@@ -2996,4 +3013,5 @@
  &envpar  run_identifier = '$fname', host = '$localhost',
           write_binary = '$write_binary', tasks_per_node = $tasks_per_node,
+          maximum_parallel_io_streams = $maximum_parallel_io_streams,
           maximum_cpu_time_allowed = ${cpumax}.,
           revision = '$global_revision',
@@ -4422,5 +4440,5 @@
        mrun_com=${mrun_com}" -O $threads_per_task"
     fi
-    [[ "$tasks_per_node" != "" ]] &&  mrun_com=${mrun_com}" -T $tasks_per_node"
+    [[ "$tasks_per_node" != "" ]]  &&  mrun_com=${mrun_com}" -T $tasks_per_node"
     [[ $store_on_archive_system = true ]]  &&  mrun_com=${mrun_com}" -A"
     [[ $package_list != "" ]]     &&  mrun_com=${mrun_com}" -p \"$package_list\""
@@ -4430,4 +4448,5 @@
     [[ "$ocean_file_appendix" = true ]]  &&  mrun_com=${mrun_com}" -y"
     [[ $run_coupled_model = true ]]  &&  mrun_com=${mrun_com}" -Y \"$coupled_dist\""
+    [[ "$max_par_io_str" != "" ]]  &&  mrun_com=${mrun_com}" -w $max_par_io_str"
     if [[ $do_remote = true ]]
     then
