Index: palm/trunk/SCRIPTS/mrun
===================================================================
--- palm/trunk/SCRIPTS/mrun	(revision 1759)
+++ palm/trunk/SCRIPTS/mrun	(revision 1779)
@@ -22,5 +22,8 @@
 # Current revisions:
 # ------------------
-# 
+# test: implementing an execute mechanism where the execute command is given in the
+# configuration file
+# ROPTS removed from execution commands
+# Warnings about missing optional files or user code changed to informative messages
 # 
 # Former revisions:
@@ -245,4 +248,5 @@
  exclude=""
  executable=""
+ execute_command="none"
  execution_error=false
  fftw_inc=""
@@ -671,5 +675,6 @@
     while read line
     do
-       if [[ "$line" != ""  &&  $(echo $line | cut -c1) != "#" &&  $(echo $line | cut -d" " -s -f4) = $cond1 && $(echo $line | cut -d" " -s -f4)  = $cond2 ]]
+       echo line=\"$line\"
+       if [[ "$line" != ""  &&  $(echo $line | cut -c1) != "#" &&  $(echo $line | cut -d" " -s -f4) = $cond1 && $(echo $line | cut -d" " -s -f5)  = $cond2 ]]
        then
           coupled_mode="mpi2"
@@ -1594,5 +1599,5 @@
        if [[ ! -d $add_source_path ]]
        then
-          printf "\n\n  +++ WARNING: additional source code directory"
+          printf "\n\n  *** INFORMATIVE: additional source code directory"
           printf "\n      \"$add_source_path\" "
           printf "\n      does not exist or is not a directory."
@@ -1893,14 +1898,8 @@
 
 
-
     # DETERMINE COMPILE- AND LINK-OPTIONS
  fopts="$fopts $netcdf_inc $fftw_inc $dvr_inc"
  lopts="$lopts $netcdf_lib $fftw_lib $dvr_lib"
- ROPTS="$ropts"
-# if [[ ( $(echo $host | cut -c1-3) = nec  ||  $(echo $host | cut -c1-3) = ibm  ||  $host = lckyoto  ||  $host = lctit  ||  $host = lcflow  ||  $host = lcxe6 ||  $host = lcxt5m || $host = lck || $host = lckiaps || $host = lckordi || $host = lcsb || $host )  &&  -n $numprocs ]]
-# then
-    XOPT="-X $numprocs"
-# fi
-
+ XOPT="-X $numprocs"
 
 
@@ -2875,9 +2874,9 @@
           if [[ "${extin[$i]}" = ""  ||  "${extin[$i]}" = " " ]]
           then
-             printf "\n  +++ WARNING: input file \"${pathin[$i]}/${afname}${endin[$i]}\" "
-             printf "\n               is not available!"
+             printf "\n  *** INFORMATIVE: input file \"${pathin[$i]}/${afname}${endin[$i]}\" "
+             printf "\n                   is not available!"
           else
-             printf "\n  +++ WARNING: input file \"${pathin[$i]}/${afname}${endin[$i]}.${extin[$i]}\" "
-             printf "\n               is not available!"
+             printf "\n  *** INFORMATIVE: input file \"${pathin[$i]}/${afname}${endin[$i]}.${extin[$i]}\" "
+             printf "\n                   is not available!"
           fi
           continue
@@ -3259,444 +3258,445 @@
     PATH=$PATH:$TEMPDIR
 
-       # MPI DEBUG OPTION (ARGUMENT CHECKING, SLOWS DOWN EXECUTION DUE TO INCREASED LATENCY)
-    if [[ "$mpi_debug" = true ]]
-    then
-       export MPI_CHECK_ARGS=1
-       printf "\n  +++ MPI_CHECK_ARGS=$MPI_CHECK_ARGS"
-    fi
-
-    if [[ "$totalview" = true ]]
-    then
-       printf "\n *** totalview debugger will be used"
-       tv_opt="-tv"
+
+    if [[ $execute_command != "none" ]]
+    then
+
+        printf "\n  +++ branch still not realized"
+        locat=execution
+        exit
+
     else
-       tv_opt=""
-    fi
-
-    if [[ "$cond1" = debug  ||  "$cond2" = debug ]]
-    then
-
-          #Interactive ALLINEA DEBUG seesion
-       if [[ "$ENVIRONMENT" != BATCH ]]
-       then
-          if [[ $host = lccrayb || $host = lccrayh ]]
-          then
-             if [[ "$allinea" = true ]]
-             then
-                echo "--- aprun  -n $ii  -N $tasks_per_node  a.out  $ROPTS  < runfile_atmos"
-
-                ddt  aprun  -n $ii  -N $tasks_per_node  a.out  $ROPTS  
-                wait
-             fi         
-          fi
-       fi
-
-       if [[ "$ENVIRONMENT" = BATCH ]]
-       then
-          continue
-       fi
-       if [[ $localhost = ibmh ]]
-       then
-
-             # SETUP THE IBM MPI ENVIRONMENT
-          export MP_SHARED_MEMORY=yes
-          export AIXTHREADS_SCOPE=S
-          export OMP_NUM_THREADS=$threads_per_task
-          export AUTHSTATE=files
-          export XLFRTEOPTS="nlwidth=132:err_recovery=no"    # RECORD-LENGTH OF NAMELIST-OUTPUT
-
-             # FOLLOWING OPTIONS ARE MANDATORY FOR TOTALVIEW
-          export MP_ADAPTER_USE=shared
-          export MP_CPU_USE=multiple
-          export MP_TIMEOUT=1200
-
-          unset  MP_TASK_AFFINITY
-
-             # SO FAR, TOTALVIEW NEEDS HOSTFILE MECHANISM FOR EXECUTION
-          #(( ii = 1 ))
-          #while (( ii <= $numprocs ))
-          #do
-          #   echo  $localhost_realname  >>  hostfile
-          #   (( ii = ii + 1 ))
-          #done
-          #export MP_HOSTFILE=hostfile
-
-          if [[ "$LOADLBATCH" = yes ]]
-          then
-             totalview   poe  a.out  $ROPTS
-          else
-             echo totalview   poe  -a a.out  -procs $numprocs  -rmpool 0  -nodes 1   $ROPTS
-             export TVDSVRLAUNCHCMD=ssh
-             totalview   poe  -a a.out  -procs $numprocs  -rmpool 0  -nodes 1   $ROPTS
-          fi
-
-       fi  # END DEBUG MODE
-
-    else
-
-          # NORMAL EXECUTION
-       if [[ -n $numprocs ]]
-       then
-
-             # RUNNING THE PROGRAM ON PARALLEL MACHINES
-          if [[ $(echo $host | cut -c1-3) = ibm ]]
+
+          # MPI DEBUG OPTION (ARGUMENT CHECKING, SLOWS DOWN EXECUTION DUE TO INCREASED LATENCY)
+       if [[ "$mpi_debug" = true ]]
+       then
+          export MPI_CHECK_ARGS=1
+          printf "\n  +++ MPI_CHECK_ARGS=$MPI_CHECK_ARGS"
+       fi
+
+       if [[ "$totalview" = true ]]
+       then
+          printf "\n *** totalview debugger will be used"
+          tv_opt="-tv"
+       else
+          tv_opt=""
+       fi
+
+       if [[ "$cond1" = debug  ||  "$cond2" = debug ]]
+       then
+
+             #Interactive ALLINEA DEBUG seesion
+          if [[ "$ENVIRONMENT" != BATCH ]]
+          then
+             if [[ $host = lccrayb || $host = lccrayh ]]
+             then
+                if [[ "$allinea" = true ]]
+                then
+                   echo "--- aprun  -n $ii  -N $tasks_per_node  a.out  < runfile_atmos"
+
+                   ddt  aprun  -n $ii  -N $tasks_per_node  a.out
+                   wait
+                fi         
+             fi
+          fi
+
+          if [[ $localhost = ibmh ]]
           then
 
                 # SETUP THE IBM MPI ENVIRONMENT
-             if [[ $host != ibmh  &&  $host != ibmkisti ]]
-             then
-                export MP_SHARED_MEMORY=yes
-                export AIXTHREAD_SCOPE=S
-                export OMP_NUM_THREADS=$threads_per_task
-                export XLSMPOPTS="spins=0:yields=0:stack=20000000"
-                export AUTHSTATE=files
-                export XLFRTEOPTS="nlwidth=132:err_recovery=no"    # RECORD-LENGTH OF NAMELIST-OUTPUT
-                #  export MP_PRINTENV=yes
-
-                   # TUNING-VARIABLES TO IMPROVE COMMUNICATION SPEED
-                   # DO NOT SHOW SIGNIFICANT EFFECTS (SEP 04, FEDERATION-SWITCH)
-                export MP_WAIT_MODE=poll
-                [[ $node_usage = not_shared ]]  &&  export MP_SINGLE_THREAD=yes
+             export MP_SHARED_MEMORY=yes
+             export AIXTHREADS_SCOPE=S
+             export OMP_NUM_THREADS=$threads_per_task
+             export AUTHSTATE=files
+             export XLFRTEOPTS="nlwidth=132:err_recovery=no"    # RECORD-LENGTH OF NAMELIST-OUTPUT
+
+                # FOLLOWING OPTIONS ARE MANDATORY FOR TOTALVIEW
+             export MP_ADAPTER_USE=shared
+             export MP_CPU_USE=multiple
+             export MP_TIMEOUT=1200
+
+             unset  MP_TASK_AFFINITY
+
+             if [[ "$LOADLBATCH" = yes ]]
+             then
+                totalview   poe  a.out
+             else
+                echo totalview   poe  -a a.out  -procs $numprocs  -rmpool 0  -nodes 1
+                export TVDSVRLAUNCHCMD=ssh
+                totalview   poe  -a a.out  -procs $numprocs  -rmpool 0  -nodes 1
              fi
 
-             if [[ $host = ibmkisti ]]
-             then
-                export LANG=en_US
-                export MP_SHARED_MEMORY=yes
-                if [[ $threads_per_task = 1 ]]
+          fi  # END DEBUG MODE
+
+       else
+
+             # NORMAL EXECUTION
+          if [[ -n $numprocs ]]
+          then
+
+                # RUNNING THE PROGRAM ON PARALLEL MACHINES
+             if [[ $(echo $host | cut -c1-3) = ibm ]]
+             then
+
+                   # SETUP THE IBM MPI ENVIRONMENT
+                if [[ $host != ibmh  &&  $host != ibmkisti ]]
                 then
-                   export MP_SINGLE_THREAD=yes
-                   export MEMORY_AFFINITY=MCM
+                   export MP_SHARED_MEMORY=yes
+                   export AIXTHREAD_SCOPE=S
+                   export OMP_NUM_THREADS=$threads_per_task
+                   export XLSMPOPTS="spins=0:yields=0:stack=20000000"
+                   export AUTHSTATE=files
+                   export XLFRTEOPTS="nlwidth=132:err_recovery=no"    # RECORD-LENGTH OF NAMELIST-OUTPUT
+                   #  export MP_PRINTENV=yes
+
+                      # TUNING-VARIABLES TO IMPROVE COMMUNICATION SPEED
+                      # DO NOT SHOW SIGNIFICANT EFFECTS (SEP 04, FEDERATION-SWITCH)
+                   export MP_WAIT_MODE=poll
+                   [[ $node_usage = not_shared ]]  &&  export MP_SINGLE_THREAD=yes
+                fi
+
+                if [[ $host = ibmkisti ]]
+                then
+                   export LANG=en_US
+                   export MP_SHARED_MEMORY=yes
+                   if [[ $threads_per_task = 1 ]]
+                   then
+                      export MP_SINGLE_THREAD=yes
+                      export MEMORY_AFFINITY=MCM
+                   else
+                      export OMP_NUM_THREADS=$threads_per_task
+                   fi
+                fi
+
+                if [[ "$LOADLBATCH" = yes ]]
+                then
+                   printf "\n--- Control: OMP_NUM_THREADS = \"$OMP_NUM_THREADS\" \n"
+                   if [[ "$cond1" = hpmcount  ||  "$cond2" = hpmcount ]]
+                   then
+                      /opt/optibm/HPM_2_4_1/bin/hpmcount  a.out
+                   else
+                      if [[ $run_coupled_model = false ]]
+                      then
+                         if [[ "$ocean_file_appendix" = true ]]
+                         then
+                            echo "precursor_ocean"  >  runfile_atmos
+                         else
+                            echo "precursor_atmos"  >  runfile_atmos
+                         fi
+                      else
+                         (( iia = $numprocs_atmos / $threads_per_task ))
+                         (( iio = $numprocs_ocean / $threads_per_task ))
+                         printf "\n      coupled run ($iia atmosphere, $iio ocean)"
+                         printf "\n      using $coupled_mode coupling"
+                         printf "\n\n"
+                         echo "coupled_run $iia $iio"  >  runfile_atmos
+                      fi
+                      poe ./a.out  <  runfile_atmos
+                   fi
                 else
-                   export OMP_NUM_THREADS=$threads_per_task
+                   if [[ $localhost = ibmh  ||  $localhost = ibms ]]
+                   then
+                      poe  a.out  -procs $numprocs  -nodes 1  -rmpool 0
+                   elif [[ $localhost = ibmkisti  ||  $localhost = ibmku ]]
+                   then
+                      if [[ -f $hostfile ]]
+                      then
+                         cp  $hostfile  hostfile
+                      else
+                         (( ii = 1 ))
+                         while (( ii <= $numprocs ))
+                         do
+                            echo  $localhost_realname  >>  hostfile
+                            (( ii = ii + 1 ))
+                         done
+                      fi
+                      export MP_HOSTFILE=hostfile
+                      if [[ $run_coupled_model = false ]]
+                      then
+                         if [[ "$ocean_file_appendix" = true ]]
+                         then
+                            echo "precursor_ocean"  >  runfile_atmos
+                         else
+                            echo "precursor_atmos"  >  runfile_atmos
+                         fi
+                      else
+                         (( iia = $numprocs_atmos / $threads_per_task ))
+                         (( iio = $numprocs_ocean / $threads_per_task ))
+                         printf "\n      coupled run ($iia atmosphere, $iio ocean)"
+                         printf "\n      using $coupled_mode coupling"
+                         printf "\n\n"
+                         echo "coupled_run $iia $iio"  >  runfile_atmos
+                      fi
+
+                      poe  ./a.out  -procs $numprocs  <  runfile_atmos 
+
+                   else
+                      if [[ "$host_file" = "" ]]
+                      then
+                         printf "\n  +++ no hostfile given in configuration file"
+                         locat=config_file
+                         exit
+                      else
+                         eval host_file=$host_file
+                      fi
+                      export MP_HOSTFILE=$host_file
+                      poe  a.out  -procs $numprocs  -tasks_per_node $numprocs
+                   fi
                 fi
-             fi
-
-             if [[ "$LOADLBATCH" = yes ]]
-             then
-                printf "\n--- Control: OMP_NUM_THREADS = \"$OMP_NUM_THREADS\" \n"
-                if [[ "$cond1" = hpmcount  ||  "$cond2" = hpmcount ]]
+
+             elif [[ $host = nech ]]  # running on NEC machines
+             then
+
+                (( ii = nodes ))
+                if [[ $ii = 1 ]]
                 then
-                   /opt/optibm/HPM_2_4_1/bin/hpmcount  a.out  $ROPTS
+                   export F_ERRCNT=0        # acceptable number of errors before program is stopped
+                   export MPIPROGINF=YES
+                   #  export F_TRACE=YES|FMT1|FMT2  # output of ftrace informations to job protocol
+                   echo "*** execution on single node with mpirun"
+                   mpirun  -np $numprocs  ./a.out
                 else
-                   if [[ $run_coupled_model = false ]]
-                   then
-                      if [[ "$ocean_file_appendix" = true ]]
-                      then
-                         echo "precursor_ocean"  >  runfile_atmos
-                      else
-                         echo "precursor_atmos"  >  runfile_atmos
-                      fi
-                   else
-                      (( iia = $numprocs_atmos / $threads_per_task ))
-                      (( iio = $numprocs_ocean / $threads_per_task ))
-                      printf "\n      coupled run ($iia atmosphere, $iio ocean)"
-                      printf "\n      using $coupled_mode coupling"
-                      printf "\n\n"
-                      echo "coupled_run $iia $iio"  >  runfile_atmos
-                   fi
-                   poe ./a.out  $ROPTS  <  runfile_atmos
+                   (( i = 0 ))
+                   while (( i < ii ))
+                   do
+                      echo "-h $i  -p $tasks_per_node  -e ./mpi_exec_shell"  >>  multinode_config
+                      (( i = i + 1 ))
+                   done
+
+                   echo "#!/bin/sh"                         >   mpi_exec_shell
+                   echo " "                                 >>  mpi_exec_shell
+                   echo "set -u"                            >>  mpi_exec_shell
+                   echo "F_ERRCNT=0"                        >>  mpi_exec_shell
+                   echo "MPIPROGINV=YES"                    >>  mpi_exec_shell
+                   echo "OMP_NUM_THREADS=$threads_per_task" >>  mpi_exec_shell 
+                   echo "cpurest=$cpurest"                  >>  mpi_exec_shell
+                   echo "fname=$fname"                      >>  mpi_exec_shell
+                   echo "localhost=$localhost"              >>  mpi_exec_shell
+                   echo "return_address=$return_address"    >>  mpi_exec_shell
+                   echo "return_username=$return_username"  >>  mpi_exec_shell
+                   echo "tasks_per_node=$tasks_per_node"    >>  mpi_exec_shell
+                   echo "write_binary=$write_binary"        >>  mpi_exec_shell
+                   echo "use_seperate_pe_for_dvrp_output=$use_seperate_pe_for_dvrp_output"  >>  mpi_exec_shell
+                   echo "  "                                >>  mpi_exec_shell
+                   echo "export F_ERRCNT"                   >>  mpi_exec_shell
+                   echo "export MPIPROGINV"                 >>  mpi_exec_shell
+                   echo "export OMP_NUM_THREADS"            >>  mpi_exec_shell
+                   echo "export cpurest"                    >>  mpi_exec_shell
+                   echo "export fname"                      >>  mpi_exec_shell
+                   echo "export localhost"                  >>  mpi_exec_shell
+                   echo "export return_address"             >>  mpi_exec_shell
+                   echo "export return_username"            >>  mpi_exec_shell
+                   echo "export tasks_per_node"             >>  mpi_exec_shell
+                   echo "export write_binary"               >>  mpi_exec_shell
+                   echo "export use_seperate_pe_for_dvrp_output"  >>  mpi_exec_shell
+                   echo " "                                 >>  mpi_exec_shell
+                   echo "exec  ./a.out"                     >>  mpi_exec_shell
+
+                   chmod u+x  mpi_exec_shell
+                   export MPIPROGINF=YES
+                   mpirun  -f multinode_config  &
+                   wait
+
                 fi
-             else
-                if [[ $localhost = ibmh  ||  $localhost = ibms ]]
-                then
-                   poe  a.out  -procs $numprocs  -nodes 1  -rmpool 0  $ROPTS
-                elif [[ $localhost = ibmkisti  ||  $localhost = ibmku ]]
+
+             elif [[ $(echo $host | cut -c1-2) = lc  &&  $host != lckyoto &&  $host != lctit ]]
+             then
+
+                   # COPY HOSTFILE FROM SOURCE DIRECTORY OR CREATE IT, IF IT
+                   # DOES NOT EXIST
+                if [[  $host != lcbullhh  && $host != lccrayb  &&  $host != lccrayf  && $host != lccrayh  &&  $host != lckyuh  &&  $host != lckyut ]]
                 then
                    if [[ -f $hostfile ]]
                    then
                       cp  $hostfile  hostfile
+                      (( ii = $numprocs / $threads_per_task ))
+                      [[ $ii = 0 ]]  &&  (( ii = 1 ))
                    else
                       (( ii = 1 ))
-                      while (( ii <= $numprocs ))
+                      while (( ii <= $numprocs / $threads_per_task ))
                       do
                          echo  $localhost_realname  >>  hostfile
                          (( ii = ii + 1 ))
                       done
+                      if (( $numprocs / $threads_per_task == 0 ))
+                      then
+                         echo  $localhost_realname  >>  hostfile
+                      fi
                    fi
-                   export MP_HOSTFILE=hostfile
-                   if [[ $run_coupled_model = false ]]
+                   eval zeile=\"`head -n $ii  hostfile`\"
+                   printf "\n  *** running on: $zeile"
+                fi
+
+                (( ii = $numprocs / $threads_per_task ))
+                [[ $ii = 0 ]]  &&  (( ii = 1 ))
+                export OMP_NUM_THREADS=$threads_per_task
+
+                if [[ $threads_per_task != 1 ]]
+                then
+                      # INCREASE STACK SIZE TO UNLIMITED, BECAUSE OTHERWISE LARGE RUNS
+                      # MAY ABORT
+                   ulimit -s unlimited
+                   printf "\n      threads per task: $threads_per_task  stacksize: unlimited"
+                fi
+                if [[ $run_coupled_model = false ]]
+                then
+                   if [[ "$ocean_file_appendix" = true ]]
                    then
-                      if [[ "$ocean_file_appendix" = true ]]
+                      echo "precursor_ocean"  >  runfile_atmos
+                   else
+                      echo "precursor_atmos"  >  runfile_atmos
+                   fi
+                   printf "\n\n"
+
+                   if [[ $host = lccrayb || $host = lccrayh ]]
+                   then
+                       echo "--- aprun  -n $ii  -N $tasks_per_node  a.out  <  runfile_atmos"
+                       aprun  -n $ii  -N $tasks_per_node  a.out  <  runfile_atmos
+                   elif [[ $host = lcbullhh ]]
+                   then
+                      export OMPI_MCA_pml=cm
+                      export OMPI_MCA_mtl=mxm
+                      export OMPI_MCA_coll=^ghc
+                      export OMPI_MCA_mtl_mxm_np=0
+                      export MXM_RDMA_PORTS=mlx5_0:1
+                      export MXM_LOG_LEVEL=ERROR 
+                      export OMP_NUM_THREADS=$threads_per_task
+                      export KMP_AFFINITY=verbose,granularity=core,compact,1
+                      export KMP_STACKSIZE=64m
+
+                      srun  --nodes=$nodes --ntasks-per-node=$tasks_per_node ./a.out  <  runfile_atmos
+
+                   elif [[ $host = lccrayf ]]
+                   then
+                       aprun  -j1  -n $ii  -N $tasks_per_node  -m ${memory}M  a.out  <  runfile_atmos
+                   elif [[ $host = lcxe6  ||  $host = lcxt5m ]]
+                   then
+                       aprun  -n $ii  -N $tasks_per_node  a.out  <  runfile_atmos
+                   elif [[ $host = lcflow ]]
+                   then
+                      mpirun -np $ii a.out  < runfile_atmos
+                   elif [[ $host = lcsb ]]
+                   then
+                      mpirun_rsh -hostfile $PBS_NODEFILE -np `cat $PBS_NODEFILE | wc -l` a.out  < runfile_atmos
+                   elif [[ $host = lckiaps ]]
+                   then
+                      mpirun -np $ii  -f $PBS_NODEFILE  a.out  <  runfile_atmos
+                   elif [[ $host = lckyu* ]]
+                   then
+                      mpiexec -n $ii --stdin runfile_atmos  ./a.out
+                   else
+                      mpiexec  -machinefile hostfile  -n $ii  a.out  <  runfile_atmos
+                   fi
+
+                else
+
+                       # CURRENTLY THERE IS NO FULL MPI-2 SUPPORT ON ICE AND XT4
+                   (( iia = $numprocs_atmos / $threads_per_task ))
+                   (( iio = $numprocs_ocean / $threads_per_task ))
+                   printf "\n      coupled run ($iia atmosphere, $iio ocean)"
+                   printf "\n      using $coupled_mode coupling"
+                   printf "\n\n"
+
+                   if [[ $coupled_mode = "mpi2" ]]
+                   then
+                      echo "atmosphere_to_ocean $iia $iio"  >  runfile_atmos
+                      echo "ocean_to_atmosphere $iia $iio"  >  runfile_ocean
+
+                      if [[ $host = lccrayf  ||  $host = lcxe6  ||  $host = lcxt5m ]]
                       then
-                         echo "precursor_ocean"  >  runfile_atmos
+
+                         aprun  -n $iia  -N $tasks_per_node  a.out < runfile_atmos  &
+                         aprun  -n $iio  -N $tasks_per_node  a.out < runfile_ocean  &
+
                       else
-                         echo "precursor_atmos"  >  runfile_atmos
+                             # WORKAROUND BECAUSE mpiexec WITH -env option IS NOT AVAILABLE ON SOME SYSTEMS
+                          mpiexec  -machinefile hostfile  -n $iia  a.out  <  runfile_atmos &
+                          mpiexec  -machinefile hostfile  -n $iio  a.out  <  runfile_ocean &
+#                          mpiexec  -machinefile hostfile  -n $iia  -env coupling_mode atmosphere_to_ocean  a.out  &
+#                          mpiexec  -machinefile hostfile  -n $iio  -env coupling_mode ocean_to_atmosphere  a.out  &
                       fi
+                      wait
+
                    else
-                      (( iia = $numprocs_atmos / $threads_per_task ))
-                      (( iio = $numprocs_ocean / $threads_per_task ))
-                      printf "\n      coupled run ($iia atmosphere, $iio ocean)"
-                      printf "\n      using $coupled_mode coupling"
-                      printf "\n\n"
+
                       echo "coupled_run $iia $iio"  >  runfile_atmos
+
+                      if [[ $host = lccrayf  ||  $host = lcxe6  ||  $host = lcxt5m ]]
+                      then
+
+                         aprun  -n $ii  -N $tasks_per_node  a.out < runfile_atmos
+
+                      elif [[ $host = lck || $host = lckordi ]]
+                      then
+
+                         mpiexec -n $ii  ./a.out  <  runfile_atmos  &
+
+                      elif [[ $host = lckyu* ]]
+                      then
+
+                         mpiexec -n $ii --stdin runfile_atmos  ./a.out
+
+                      elif [[ $host = lcmuk ]] 
+                      then
+
+                         mpiexec  -machinefile hostfile  -n $ii  a.out  <  runfile_atmos
+
+                      fi
+                      wait
                    fi
 
-                   poe  ./a.out  -procs $numprocs $ROPTS  <  runfile_atmos 
-
+                fi
+
+             elif [[ $host = lckyoto ]]
+             then
+                set -xv
+                export P4_RSHCOMMAND=plesh
+                echo "     P4_RSHCOMMAND = $P4_RSHCOMMAND"
+                if [[ "$ENVIRONMENT" = BATCH ]]
+                then
+                   if [[ "$cond2" = fujitsu ]]
+                   then
+                      mpiexec  -n $numprocs  ./a.out  # for fujitsu-compiler
+                   elif [[ "cond2" = pgi ]]
+                   then
+                      mpirun  -np $numprocs  -machinefile ${QSUB_NODEINF}  ./a.out
+                   else
+                      mpirun_rsh -np $numprocs -hostfile ${QSUB_NODEINF} MV2_USE_SRQ=0 ./a.out  ||  /bin/true
+                   fi
                 else
-                   if [[ "$host_file" = "" ]]
+                   if [[ "$cond2" = "" ]]
                    then
-                      printf "\n  +++ no hostfile given in configuration file"
-                      locat=config_file
-                      exit
+                      mpiruni_rsh -np $numprocs ./a.out  # for intel
                    else
-                      eval host_file=$host_file
-                   fi
-                   export MP_HOSTFILE=$host_file
-                   poe  a.out  -procs $numprocs  -tasks_per_node $numprocs  $ROPTS
-                fi
-             fi
-          elif [[ $host = nech ]]
-          then
-             (( ii = nodes ))
-             if [[ $ii = 1 ]]
-             then
-                export F_ERRCNT=0        # acceptable number of errors before program is stopped
-                export MPIPROGINF=YES
-                #  export F_TRACE=YES|FMT1|FMT2  # output of ftrace informations to job protocol
-                echo "*** execution on single node with mpirun"
-                mpirun  -np $numprocs  ./a.out  $ROPTS
-             else
-                (( i = 0 ))
-                while (( i < ii ))
-                do
-                   echo "-h $i  -p $tasks_per_node  -e ./mpi_exec_shell"  >>  multinode_config
-                   (( i = i + 1 ))
-                done
-
-                echo "#!/bin/sh"                         >   mpi_exec_shell
-                echo " "                                 >>  mpi_exec_shell
-                echo "set -u"                            >>  mpi_exec_shell
-                echo "F_ERRCNT=0"                        >>  mpi_exec_shell
-                echo "MPIPROGINV=YES"                    >>  mpi_exec_shell
-                echo "OMP_NUM_THREADS=$threads_per_task" >>  mpi_exec_shell 
-                echo "cpurest=$cpurest"                  >>  mpi_exec_shell
-                echo "fname=$fname"                      >>  mpi_exec_shell
-                echo "localhost=$localhost"              >>  mpi_exec_shell
-                echo "return_address=$return_address"    >>  mpi_exec_shell
-                echo "return_username=$return_username"  >>  mpi_exec_shell
-                echo "tasks_per_node=$tasks_per_node"    >>  mpi_exec_shell
-                echo "write_binary=$write_binary"        >>  mpi_exec_shell
-                echo "use_seperate_pe_for_dvrp_output=$use_seperate_pe_for_dvrp_output"  >>  mpi_exec_shell
-                echo "  "                                >>  mpi_exec_shell
-                echo "export F_ERRCNT"                   >>  mpi_exec_shell
-                echo "export MPIPROGINV"                 >>  mpi_exec_shell
-                echo "export OMP_NUM_THREADS"            >>  mpi_exec_shell
-                echo "export cpurest"                    >>  mpi_exec_shell
-                echo "export fname"                      >>  mpi_exec_shell
-                echo "export localhost"                  >>  mpi_exec_shell
-                echo "export return_address"             >>  mpi_exec_shell
-                echo "export return_username"            >>  mpi_exec_shell
-                echo "export tasks_per_node"             >>  mpi_exec_shell
-                echo "export write_binary"               >>  mpi_exec_shell
-                echo "export use_seperate_pe_for_dvrp_output"  >>  mpi_exec_shell
-                echo " "                                 >>  mpi_exec_shell
-                echo "exec  ./a.out"                     >>  mpi_exec_shell
-
-                chmod u+x  mpi_exec_shell
-                export MPIPROGINF=YES
-                mpirun  -f multinode_config  &
-                wait
-
-             fi
-          elif [[ $(echo $host | cut -c1-2) = lc  &&  $host != lckyoto &&  $host != lctit ]]
-          then
-
-                # COPY HOSTFILE FROM SOURCE DIRECTORY OR CREATE IT, IF IT
-                # DOES NOT EXIST
-             if [[  $host != lcbullhh  && $host != lccrayb  &&  $host != lccrayf  && $host != lccrayh  &&  $host != lckyuh  &&  $host != lckyut ]]
-
-             then
-                if [[ -f $hostfile ]]
-                then
-                   cp  $hostfile  hostfile
-                   (( ii = $numprocs / $threads_per_task ))
-                   [[ $ii = 0 ]]  &&  (( ii = 1 ))
-                else
-                   (( ii = 1 ))
-                   while (( ii <= $numprocs / $threads_per_task ))
-                   do
-                      echo  $localhost_realname  >>  hostfile
-                      (( ii = ii + 1 ))
-                   done
-                   if (( $numprocs / $threads_per_task == 0 ))
-                   then
-                      echo  $localhost_realname  >>  hostfile
+                      mpirun  -np $numprocs  ./a.out
                    fi
                 fi
-                eval zeile=\"`head -n $ii  hostfile`\"
-                printf "\n  *** running on: $zeile"
+                set +xv
+
+             elif [[ $host = lctit ]]
+             then
+                export OMP_NUM_THREADS=$threads_per_task
+                echo "OMP_NUM_THREADS=$OMP_NUM_THREADS"
+                if [[ "$threads_per_task" != 1 ]]
+                then
+                   export MV2_ENABLE_AFFINITY=0
+                fi
+                echo "----- PBS_NODEFILE content:"
+                cat $PBS_NODEFILE
+                echo "-----"
+                (( ii = $numprocs / $threads_per_task ))
+                echo "mpirun  -np $ii  -hostfile $PBS_NODEFILE ./a.out"
+                mpirun  -np $ii  -hostfile $PBS_NODEFILE  ./a.out
+
+             else
+                mpprun  -n $numprocs  a.out
              fi
-
-             (( ii = $numprocs / $threads_per_task ))
-             [[ $ii = 0 ]]  &&  (( ii = 1 ))
-             export OMP_NUM_THREADS=$threads_per_task
-
-             if [[ $threads_per_task != 1 ]]
-             then
-                   # INCREASE STACK SIZE TO UNLIMITED, BECAUSE OTHERWISE LARGE RUNS
-                   # MAY ABORT
-                ulimit -s unlimited
-                printf "\n      threads per task: $threads_per_task  stacksize: unlimited"
-             fi
-             if [[ $run_coupled_model = false ]]
-             then
-                if [[ "$ocean_file_appendix" = true ]]
-                then
-                   echo "precursor_ocean"  >  runfile_atmos
-                else
-                   echo "precursor_atmos"  >  runfile_atmos
-                fi
-                printf "\n\n"
-
-                if [[ $host = lccrayb || $host = lccrayh ]]
-                then
-                    echo "--- aprun  -n $ii  -N $tasks_per_node  a.out  $ROPTS  < runfile_atmos"
-                    aprun  -n $ii  -N $tasks_per_node  a.out  $ROPTS  < runfile_atmos
-#                    aprun  -n $ii  -ss  -r2  -j1  a.out  $ROPTS  < runfile_atmos
-
-                elif [[ $host = lcbullhh ]]
-                then
-                   export OMPI_MCA_pml=cm
-                   export OMPI_MCA_mtl=mxm
-                   export OMPI_MCA_coll=^ghc
-                   export OMPI_MCA_mtl_mxm_np=0
-                   export MXM_RDMA_PORTS=mlx5_0:1
-                   export MXM_LOG_LEVEL=ERROR 
-                   export OMP_NUM_THREADS=$threads_per_task
-                   export KMP_AFFINITY=verbose,granularity=core,compact,1
-                   export KMP_STACKSIZE=64m
-
-                   srun  --nodes=$nodes --ntasks-per-node=$tasks_per_node ./a.out  
-
-                elif [[ $host = lccrayf ]]
-                then
-                    aprun  -j1  -n $ii  -N $tasks_per_node  -m ${memory}M  a.out  $ROPTS  < runfile_atmos
-                elif [[ $host = lcxe6  ||  $host = lcxt5m ]]
-                then
-                    aprun  -n $ii  -N $tasks_per_node  a.out  $ROPTS  < runfile_atmos
-                elif [[ $host = lcflow ]]
-                then
-                   mpirun -np $ii a.out  < runfile_atmos  $ROPTS
-                elif [[ $host = lcsb ]]
-                then
-                   mpirun_rsh -hostfile $PBS_NODEFILE -np `cat $PBS_NODEFILE | wc -l` a.out  < runfile_atmos  $ROPTS
-                elif [[ $host = lckiaps ]]
-                then
-                   mpirun -np $ii  -f $PBS_NODEFILE  a.out  <  runfile_atmos  $ROPTS
-                elif [[ $host = lckyu* ]]
-                then
-                   mpiexec -n $ii --stdin runfile_atmos  ./a.out  $ROPTS
-                else
-                   mpiexec  -machinefile hostfile  -n $ii  a.out  <  runfile_atmos  $ROPTS
-                fi
-             else
-
-                    # CURRENTLY THERE IS NO FULL MPI-2 SUPPORT ON ICE AND XT4
-                (( iia = $numprocs_atmos / $threads_per_task ))
-                (( iio = $numprocs_ocean / $threads_per_task ))
-                printf "\n      coupled run ($iia atmosphere, $iio ocean)"
-                printf "\n      using $coupled_mode coupling"
-                printf "\n\n"
-
-                if [[ $coupled_mode = "mpi2" ]]
-                then
-                   echo "atmosphere_to_ocean $iia $iio"  >  runfile_atmos
-                   echo "ocean_to_atmosphere $iia $iio"  >  runfile_ocean
-
-                   if [[ $host = lccrayf  ||  $host = lcxe6  ||  $host = lcxt5m ]]
-                   then
-
-                      aprun  -n $iia  -N $tasks_per_node  a.out < runfile_atmos  $ROPTS  &
-                      aprun  -n $iio  -N $tasks_per_node  a.out < runfile_ocean  $ROPTS  &
-
-                   else
-                          # WORKAROUND BECAUSE mpiexec WITH -env option IS NOT AVAILABLE ON SOME SYSTEMS
-                       mpiexec  -machinefile hostfile  -n $iia  a.out  $ROPTS  <  runfile_atmos &
-                       mpiexec  -machinefile hostfile  -n $iio  a.out  $ROPTS  <  runfile_ocean &
-#                       mpiexec  -machinefile hostfile  -n $iia  -env coupling_mode atmosphere_to_ocean  a.out  $ROPTS  &
-#                       mpiexec  -machinefile hostfile  -n $iio  -env coupling_mode ocean_to_atmosphere  a.out  $ROPTS  &
-                   fi
-                   wait
-
-                else
-
-                   echo "coupled_run $iia $iio"  >  runfile_atmos
-
-                   if [[ $host = lccrayf  ||  $host = lcxe6  ||  $host = lcxt5m ]]
-                   then
-
-                      aprun  -n $ii  -N $tasks_per_node  a.out < runfile_atmos  $ROPTS
-
-                   elif [[ $host = lck || $host = lckordi ]]
-                   then
-
-                      mpiexec -n $ii  ./a.out  $ROPTS < runfile_atmos &
-
-                   elif [[ $host = lckyu* ]]
-                   then
-
-                      mpiexec -n $ii --stdin runfile_atmos  ./a.out  $ROPTS
-
-                   elif [[ $host = lcmuk ]] 
-                   then
-
-                      mpiexec  -machinefile hostfile  -n $ii  a.out  <  runfile_atmos  $ROPTS
-
-                   fi
-                   wait
-                fi
-
-             fi
-
-          elif [[ $host = lckyoto ]]
-          then
-             set -xv
-             export P4_RSHCOMMAND=plesh
-             echo "     P4_RSHCOMMAND = $P4_RSHCOMMAND"
-             if [[ "$ENVIRONMENT" = BATCH ]]
-             then
-                if [[ "$cond2" = fujitsu ]]
-                then
-                   mpiexec  -n $numprocs  ./a.out  $ROPTS  # for fujitsu-compiler
-                elif [[ "cond2" = pgi ]]
-                then
-                   mpirun  -np $numprocs  -machinefile ${QSUB_NODEINF}  ./a.out  $ROPTS
-                else
-                   mpirun_rsh -np $numprocs -hostfile ${QSUB_NODEINF} MV2_USE_SRQ=0 ./a.out ${ROPTS} || /bin/true
-                fi
-             else
-                if [[ "$cond2" = "" ]]
-                then
-                   mpiruni_rsh -np $numprocs ./a.out  $ROPTS  # for intel
-                else
-                   mpirun  -np $numprocs  ./a.out  $ROPTS
-                fi
-             fi
-             set +xv
-
-          elif [[ $host = lctit ]]
-          then
-             export OMP_NUM_THREADS=$threads_per_task
-             echo "OMP_NUM_THREADS=$OMP_NUM_THREADS"
-             if [[ "$threads_per_task" != 1 ]]
-             then
-                export MV2_ENABLE_AFFINITY=0
-             fi
-             echo "----- PBS_NODEFILE content:"
-             cat $PBS_NODEFILE
-             echo "-----"
-             (( ii = $numprocs / $threads_per_task ))
-             echo "mpirun  -np $ii  -hostfile $PBS_NODEFILE ./a.out  $ROPTS"
-             mpirun  -np $ii  -hostfile $PBS_NODEFILE ./a.out  $ROPTS
-
           else
-             mpprun  -n $numprocs  a.out  $ROPTS
-          fi
-      else
-          a.out  $ROPTS
-       fi
-    fi
+             a.out
+          fi
+
+       fi  # end normal (non-debug) execution
+
+    fi  # end explicit execute_command or host-specific execute actions
 
     if [[ $? != 0 ]]
@@ -3762,5 +3762,5 @@
       then
          printf "\n\n\n *** post-processing: now executing \"aprun  -n 1  -N 1 combine_plot_fields${block}.x\" ..."
-         aprun  -n 1  -N 1 combine_plot_fields${block}.x #$ROPTS < runfile_atmos 
+         aprun  -n 1  -N 1 combine_plot_fields${block}.x
       else
          printf "\n\n\n *** post-processing: now executing \"combine_plot_fields${block}.x\" ..."
Index: palm/trunk/SCRIPTS/subjob
===================================================================
--- palm/trunk/SCRIPTS/subjob	(revision 1759)
+++ palm/trunk/SCRIPTS/subjob	(revision 1779)
@@ -152,5 +152,5 @@
 
  typeset  -i   cputime=0  memory=0  Memory=0  minuten  resttime  sekunden  stunden
- typeset  -i   inumprocs  mpi_tasks=0  nodes=0  processes_per_node=0 tasks_per_node=0  threads_per_task=1
+ typeset  -i   numprocs  mpi_tasks=0  nodes=0  processes_per_node=0 tasks_per_node=0  threads_per_task=1
 
 
