#!/bin/sh

if test $# != 0; then
   while test $# != 0
   do
     case $1 in
     -help | -h | --help | --h | --he | --hel)
      echo "Removes the files from the load directory"
      echo "run '`basename $0` -v' for version information"
      echo "Usage: `basename $0`"
      exit 0
      ;;
     -v | -version | --v | --version)
      $HMPI_HOME/scripts/hmpi_version_info
      exit 0
      ;;
     esac 
     shift
   done

   echo "Usage: `basename $0`"
   echo "run '`basename $0` -h' for more information"
   exit 0
fi

#
# For MPICH MPI, mpcrun needs the executable to
# be present in $MPCLOAD, which creates a problem
#
#Obtain MPI information
if test -f $MPIDIR/bin/lamd; then
	CURRENTMPI=LAM
fi

if test -f $MPIDIR/lib/liblam.a; then
	CURRENTMPI=LAM
fi

if test -f $MPIDIR/bin/mpichversion; then
	CURRENTMPI=MPICH
fi

if test -f $MPIDIR/bin/ompi_info; then
	CURRENTMPI=OPENMPI
fi

if test -f $MPIDIR/lib/libmpich.a; then
	CURRENTMPI=MPICH
fi

case $CURRENTMPI in
  LAM*)
	mpcrun hmpiclean_mpcload -- -d
  ;;
  MPICH*)
  ;;
  OPENMPI*)
  ;;
esac

exit 0
