#! /bin/sh

# This shell script works for a quad board machine with AMD Opteron
# sixteen core processors running CentOS 6 and OpenMPI Version 1.4.3.

export PATH="$PATH:/usr/lib64/compat-openmpi/bin"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib64/compat-openmpi/lib"
export
C_INCLUDE_PATH="$C_INCLUDE_PATH:/usr/include/compat-openmpi-x86_64"

echo "localhost cpu=64" > 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 
test -f pathname.h   && mv -f pathname.h   pathname.h.bak

rm -f core core.*

make -f makefile.mpi.OpenMPI_1.4.3 >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;
~
