#! /bin/sh

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

# Some 64 bit machines need this:
# export PATH="$PATH:/usr/lib64/openmpi/1.2.7-gcc/bin/"
# export # LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib64/openmpi/1.2.7-gcc/lib/"

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_1.2 >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;
~
