#! /bin/sh

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

echo "localhost cpu=16" > OpenMPIhosts

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.*

make -f makefile.mpi.OpenMPI_2.1 >emm_mpi.out 2>&1 && \
  mpirun --hostfile OpenMPIhosts ${PWD}/emm_mpi >>emm_mpi.out 2>emm_mpi.err

RC=$?

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