#! /bin/sh

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

# Some 64 bit machines need this or something similar:
export PATH="$PATH:/usr/lib64/openmpi/1.4-gcc/bin/"
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/lib64/openmpi/1.4-gcc/lib"
export C_INCLUDE_PATH="$C_INCLUDE_PATH:/usr/lib64/openmpi/1.4-gcc/include"

echo "localhost cpu=16" > OpenMPIhosts

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

rm -f core core.*

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

RC=$?

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