Index: palm/trunk/SCRIPTS/mrun
===================================================================
--- palm/trunk/SCRIPTS/mrun	(revision 683)
+++ palm/trunk/SCRIPTS/mrun	(revision 693)
@@ -219,5 +219,6 @@
      # 02/02/10 - Siggi  - further adjustments on Tsubame and concerning openMP
      #                     usage
-     # 09/02/10 - Siggi  - mpt bugfix for netCDF4 usage
+     # 09/02/10 - Siggi  - adjustments for ibmkisti, mpt bugfix for netCDF4
+     #                     usage, totalview usage extended
 
 
@@ -304,5 +305,9 @@
  then
    return_addres=133.5.185.60
-   echo "+++ WARNING: return_addres changed to $return_addres !!!!!"
+   echo "+++ WARNING: fixed return_addres = $return_addres is used !!!!!"
+ elif [[ `hostname` = climate0 ]]
+ then
+   return_addres=165.132.26.68
+   echo "+++ WARNING: fixed return_addres = $return_addres is used !!!!!"
  else
     return_addres=$(nslookup `hostname` 2>&1 | grep "Address:" | tail -1 | awk '{print $2}')
@@ -670,5 +675,5 @@
     do_remote=true
     case  $host  in
-        (ibm|ibmh|ibmku|ibms|ibmy|nech|necriam|lckyoto|lcsgib|lcsgih|unics|lcxt4|lcxt5m|lck)  true;;
+        (ibm|ibmh|ibmkisti|ibmku|ibms|ibmy|nech|necriam|lckyoto|lcsgib|lcsgih|unics|lcxt4|lcxt5m|lck)  true;;
         (*)  printf "\n"
              printf "\n  +++ sorry: execution of batch jobs on remote host \"$host\""
@@ -834,5 +839,5 @@
                    do_remote=true
                    case  $host  in
-                       (ibm|ibmh|ibmku|ibms|ibmy|lckyoto|lcsgib|lcsgih|nech|necriam|unics|lcxt4|lcxt5m|lck)  true;;
+                       (ibm|ibmh|ibmkisti|ibmku|ibms|ibmy|lckyoto|lcsgib|lcsgih|nech|necriam|unics|lcxt4|lcxt5m|lck)  true;;
                        (*)  printf "\n  +++ sorry: execution of batch jobs on remote host \"$host\""
                             printf "\n      is not available"
@@ -1099,5 +1104,5 @@
     # GLOBALE REVISIONSNUMMER ERMITTELN (FORTSETZUNGSLAEUFEN WIRD DIESE
     # DURCH OPTION -G MITGETEILT)
- if [[ "$global_revision" = "" ]]
+ if [[ "$global_revision" = ""   &&  $host != "ibmkisti" ]]
  then
     global_revision=`svnversion $source_path  2>/dev/null`
@@ -1116,5 +1121,5 @@
     do_remote=true
     case  $host  in
-        (ibm|ibmh|ibmku|ibms|ibmy|lckyoto|lcsgib|lcsgih|nech|necriam|unics|lcxt4|lcxt5m|lck)  true;;
+        (ibm|ibmh|ibmkisti|ibmku|ibms|ibmy|lckyoto|lcsgib|lcsgih|nech|necriam|unics|lcxt4|lcxt5m|lck)  true;;
         (*)  printf "\n"
              printf "\n  +++ sorry: execution of batch jobs on remote host \"$host\""
@@ -1145,5 +1150,5 @@
        # DEFAULT-WERT SETZEN) UND OB SIE EIN GANZZAHLIGER TEILER DER
        # GESAMTPROZESSORANZAHL IST
-    if [[ $host = nech  ||  $host = necriam  ||  $host = ibmh  ||  $host = ibms ]]
+    if [[ $host = nech  ||  $host = necriam  ||  $host = ibmh  ||  $host = ibmkisti  ||  $host = ibms ]]
     then
        [[ "$tasks_per_node" = "" ]]  &&  tasks_per_node=6
@@ -1258,4 +1263,5 @@
     case  $host  in
         (ibmh)       queue=no_class;;
+        (ibmkisti)   queue=class.32plus;;
         (ibmy)       queue=parallel;;
         (lckyoto)    queue=ph;;
@@ -2990,4 +2996,12 @@
     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
@@ -3063,5 +3077,5 @@
              then
                 printf "\n     running totalview debugger"
-                mpiexec_mpt -tv -n $ii   ./a.out  $ROPTS  < runfile_atmos
+                mpiexec_mpt $tv_opt -n $ii   ./a.out  $ROPTS  < runfile_atmos
              else
                 mpiexec_mpt -np $ii   ./a.out  $ROPTS  < runfile_atmos
@@ -3075,5 +3089,5 @@
              then
                 printf "\n     running totalview debugger"
-                mpiexec -tv ./a.out  $ROPTS  < runfile_atmos
+                mpiexec $tv_opt ./a.out  $ROPTS  < runfile_atmos
              else
                 mpiexec    ./a.out  $ROPTS  < runfile_atmos
@@ -3097,5 +3111,5 @@
           then
                 # SETUP THE IBM MPI ENVIRONMENT
-             if [[ $host != ibmh ]]
+             if [[ $host != ibmh  &&  $host != ibmkisti ]]
              then
                 export MP_SHARED_MEMORY=yes
@@ -3112,4 +3126,13 @@
                 [[ $node_usage = not_shared ]]  &&  export MP_SINGLE_THREAD=yes
              fi
+
+             if [[ $host = ibmkisti ]]
+             then
+                export LANG=en_US
+                export MP_SHARED_MEMORY=yes
+                export MP_SINGLE_THREAD=yes
+                export MEMORY_AFFINITY=MCM
+             fi
+
              if [[ "$LOADLBATCH" = yes ]]
              then
@@ -3141,5 +3164,5 @@
                 then
                    poe  a.out  -procs $numprocs  -nodes 1  -rmpool 0  $ROPTS
-                elif [[ $localhost = ibmku  ||  $localhost = ibmy ]]
+                elif [[ $localhost = ibmkisti  ||  $localhost = ibmku  ||  $localhost = ibmy ]]
                 then
                    if [[ -f $hostfile ]]
@@ -3313,5 +3336,11 @@
                       export MPI_GROUP_MAX=64
                       echo "*** MPI_GROUP_MAX=$MPI_GROUP_MAX"
-                      mpiexec_mpt -np $ii   ./a.out  $ROPTS  < runfile_atmos
+                      if [[ $use_openmp = true ]]
+                      then
+                         echo " mpiexec -npernode $tasks_per_node  ./a.out  $ROPTS  <  runfile_atmos"
+                         mpiexec -npernode $tasks_per_node $tv_opt ./a.out  $ROPTS  <  runfile_atmos
+                      else
+                         mpiexec_mpt -np $ii $tv_opt  ./a.out  $ROPTS  < runfile_atmos
+                      fi
 
                           # next is test for openmp usage
@@ -3340,7 +3369,7 @@
                       then
                          echo " mpiexec -npernode $tasks_per_node  ./a.out  $ROPTS  <  runfile_atmos"
-                         mpiexec -npernode $tasks_per_node  ./a.out  $ROPTS  <  runfile_atmos
+                         mpiexec -npernode $tasks_per_node $tv_opt ./a.out  $ROPTS  <  runfile_atmos
                       else
-                         mpiexec -np $ii  ./a.out  $ROPTS  < runfile_atmos
+                         mpiexec -np $ii $tv_opt ./a.out  $ROPTS  < runfile_atmos
                       fi
                    fi
@@ -4236,5 +4265,5 @@
           then
 
-             if [[ $localhost = lcsgih  ||  $localhost = lcsgib  ||  $localhost = nech  ||  $localhost = ibmh  ||  $localhost = ibmku  ||  $localhost = ibms ]]
+             if [[ $localhost = lcsgih  ||  $localhost = lcsgib  ||  $localhost = nech  ||  $localhost = ibmh  ||  $localhost = ibmkisti  ||  $localhost = ibmku  ||  $localhost = ibms ]]
              then
                 echo "*** ssh will be used to initiate restart-runs!"
@@ -4245,5 +4274,10 @@
                    ssh $return_addres -l $return_username "PATH=\$PATH:$LOCAL_MRUN_PATH;export LD_LIBRARY_PATH=\$LD_LIBRARY_PATH:/muksoft/packages/intel/Compiler/11.0/083/lib/intel64/;export PALM_BIN=$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc "
                 else
-                   ssh $return_addres -l $return_username "PATH=\$PATH:$LOCAL_MRUN_PATH;export PALM_BIN=$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc "
+                   if [[ $localhost = ibmkisti ]]
+                   then
+                      ssh $usern@gaiad "ssh $return_addres -l $return_username \"PATH=\\\$PATH:$LOCAL_MRUN_PATH;export PALM_BIN=$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc\" "
+                   else
+                      ssh $return_addres -l $return_username "PATH=\$PATH:$LOCAL_MRUN_PATH;export PALM_BIN=$LOCAL_MRUN_PATH;cd $LOCAL_PWD; $mc "
+                   fi
                 fi
              else
@@ -4333,5 +4367,5 @@
 
        # MRUN-BEFEHL FUER REMOTE-MASCHINE ZUSAMMENSTELLEN
-    mrun_com="$mrun_script_name -a $afname -c $config_file -d $fname -h $host -H $fromhost -m $memory -t $cpumax -q $queue -R $return_addres -U $return_username -u $remote_username"
+    mrun_com="$mrun_script_name -a $afname -c $config_file -d $fname -h $host -H $fromhost -m $memory -t $cpumax -q \$queue -R $return_addres -U $return_username -u $remote_username"
     [[ "$cpp_opts" != "" ]]       &&  mrun_com=${mrun_com}" -D \"$cpp_opts\""
     [[ "$global_revision" != "" ]]  &&  mrun_com=${mrun_com}" -G \"$global_revision\""
@@ -4385,5 +4419,5 @@
        # BEREITSTELLUNG VON QUELLTEXTEN, MRUN-SCRIPTS UND KONFIGURATIONS-
        # DATEI FUER DEN JOB
-    if [[ $( echo $host | cut -c1-5 ) = lcsgi ]]
+    if [[ $( echo $host | cut -c1-5 ) = lcsgi  ||  $host = ibmkisti ]]
     then
 
@@ -4397,6 +4431,19 @@
 
           # SOURCE-VERZEICHNIS VOM LOKALEN RECHNER PER SCP TRANSFERIEREN
+          # (BEI JOBS AUF LOKALEM RECHNER REICHT CP)
        echo  "set -x"  >>  $jobfile
-       echo  "scp  -r  $return_username@$return_addres:$working_directory/SOURCES_FOR_RUN_$fname ."  >>  $jobfile
+       if [[ $host = $localhost ]]
+       then
+          echo  "cp  -r  $working_directory/SOURCES_FOR_RUN_$fname ."  >>  $jobfile
+       else
+          if [[ $host != ibmkisti ]]
+          then
+             echo  "scp  -r  $return_username@$return_addres:$working_directory/SOURCES_FOR_RUN_$fname ."  >>  $jobfile
+          else
+                # on KISTI's IBM firewall is only opened on interactive node
+             echo  "localdir=\`pwd\`"                            >>  $jobfile
+             echo  "ssh $remote_username@gaiad \"cd \$localdir; scp  -r  $return_username@$return_addres:$working_directory/SOURCES_FOR_RUN_$fname .\" "  >>  $jobfile
+          fi
+       fi
        echo  "export SOURCES_COMPLETE=true"                      >>  $jobfile
 
@@ -4456,7 +4503,7 @@
           # ABSPEICHERN DER AKTUELLEN MRUN-VERSION
           # ABDECKZEICHEN VERHINDERN, DASS ERSETZUNGEN ERFOLGEN
-       echo  "cat > $mrun_script_name <<\"%END%\""  >>  $jobfile
-       cat   ${PALM_BIN}/$mrun_script_name          >>  $jobfile
-       echo  "%END%"                                >>  $jobfile
+       echo  "cat > $mrun_script_name <<\"%END%\""    >>  $jobfile
+       cat   ${PALM_BIN}/$mrun_script_name            >>  $jobfile
+       echo  "%END%"                                  >>  $jobfile
        echo  "chmod u+x $mrun_script_name"          >>  $jobfile
        echo  "execute_mrun=true"                    >>  $jobfile
@@ -4514,6 +4561,7 @@
     fi
 
-       # MRUN AUF ZIELRECHNER AUFRUFEN
+       # MRUN AUF ZIELRECHNER AUFRUFEN (queue is workaround for ibmkisti)
     echo  "set -x"                                      >>  $jobfile
+    echo  "queue=$queue"                                >>  $jobfile
     echo  "[[ \$execute_mrun = true ]]  &&  ./$mrun_com"  >>  $jobfile
 
