#! /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

if [ $just_testing = 1 ] ; then
  echo "getcube -t $np"
  echo "load $progname $cmdLineArgs"
  echo "waitcube"
  echo "relcube"
else
  getcube -t $np
  if [ $? != 0 ] ; then
	 echo "Requested number of nodes not available"
  else
     load $progname $cmdLineArgs
     waitcube
     relcube
  fi
fi
