#! /bin/sh
if [ "$MPIR_HOME" = "" ] ; then 
    MPIR_HOME=#MPIR_HOME#
fi
if [ "$MPIR_HOME" = "#""MPIR_HOME""#" ] ; then
    MPIR_HOME=`pwd`/..
fi
if [ "#MPIRUN_BIN#" = "#""MPIRUN_BIN""#" ] ; then 
    MPIRUN_HOME=$MPIR_HOME/bin
else
    MPIRUN_HOME=$MPIR_HOME/#MPIRUN_BIN#
fi
if [ "$argsset" = "" ] ; then
   . $MPIRUN_HOME/mpirun.args
   argsset=1
fi
# This only works on SPx running release 2 software and with
# the high-performance switch.  Note that we need to parameterize
# the hostlist somehow.
# use 
#   MP_EUILIB ip 
# for ip over the switch
# Other variables to consider:
# MP_PMDLOG yes
# PWD $PWD_TRIAL
# MP_INFOLEVEL 1 
# MP_INFOLEVEL 20
# MP_CSS_INTERRUPT ?
# MP_PULSE must be 0 to get performance (some problem with defaults
# in GA code)
# setenv MP_PULSE 0
# The retry/retrycount tries every 15 seconds for 10 minutes to get some
# nodes.
# Note that if the executable is not on a file system mounted 
# on a node, you may get a strange error message.
if [ -z "$MP_RETRY" ] ; then
    MP_RETRY=15
fi
if [ -z "$MP_RETRYCOUNT" ] ; then
    MP_RETRYCOUNT=40
fi
if [ $just_testing = 1 ] ; then
    echo "(sh/ksh style:)"
    echo MP_EUILIB=us
    echo export MP_EUILIB
    echo MP_RMPOOL=0
    echo export MP_RMPOOL
    echo MP_HOSTFILE=$machineFile
    echo export MP_HOSTFILE
    echo MP_PROCS=$np
    echo export MP_PROCS
    echo MP_INFOLEVEL=0
    echo export MP_INFOLEVEL
    echo MP_PULSE=0
    echo export MP_PULSE
    echo MP_RETRY=$MP_RETRY
    echo export MP_RETRY
    echo MP_RETRYCOUNT=$MP_RETRYCOUNT
    echo export MP_RETRYCOUNT
    if [ $polling_mode = 0 ] ; then
        echo MP_CSS_INTERRUPT=yes
	echo export MP_CSS_INTERRUPT
    fi
    echo poe $progname $cmdLineArgs
else
    MP_EUILIB=us
    export MP_EUILIB
    MP_RMPOOL=0
    export MP_RMPOOL
    MP_HOSTFILE=$machineFile
    export MP_HOSTFILE
    MP_PROCS=$np
    export MP_PROCS
    MP_INFOLEVEL=0
    export MP_INFOLEVEL
    MP_PULSE=0
    export MP_PULSE
    MP_RETRY=$MP_RETRY
    export MP_RETRY
    MP_RETRYCOUNT=$MP_RETRYCOUNT
    export MP_RETRYCOUNT
    if [ $polling_mode = 0 ] ; then
        MP_CSS_INTERRUPT=yes
	export MP_CSS_INTERRUPT
    fi
    poe $progname $cmdLineArgs
fi
