#! /bin/sh

# This shell script works for a quad board machine with quad core CPUs
# running LAM Version 7.1.  

# Some 64 bit machines need this:
# export PATH="$PATH:/usr/lib64/lam/bin/"
# export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib64/lam/"

echo "localhost cpu=16" > lamhosts

test -f emm_mpi.err  && mv -f emm_mpi.err  emm_mpi.err.bak
test -f emm_mpi.out  && mv -f emm_mpi.out  emm_mpi.out.bak 

rm -f core core.*

lamboot -v lamhosts

RC=$?

case $RC in 
  0) ;;
  1) exit 1;;
  esac  

make -f makefile.mpi.lam_7.1 >emm_mpi.out 2>&1 && \
  mpirun -v -D C \
  ${PWD}/emm_mpi >>emm_mpi.out 2>emm_mpi.err

RC=$?

case $RC in
  0) lamhalt ;;
  1) lamwipe -v lamhosts
     exit 1;;
  esac

RC=$?

case $RC in
  0) exit 0 ;;
  esac
exit 1;
~
