runnp4

#!/bin/bash
###
# This little script assumes that your source code and
# bhost.def file are in the same directory.
###
# Stop lamd
echo Halting lamd
/usr/local/bin/lamhalt

export LAMRSH="ssh -x"

# Remove the old executable
if [ -f "./TestProg" ]; then
        echo "Cleaning up"
        rm ./TestProg
fi

#Start lamd
# This assumes that you have a list of hosts in the file bhost.def.
# This file is assumed to be in the same directory as the 
# executable.
/usr/local/bin/lamboot ./bhost.def 

# Make a new executable
echo " "
echo " ---------------------"
echo "Compiling TestProg"
/usr/local/bin/mpicc -lm -o TestProg ./TestProgT.c

# Run the executable
echo "Executing the code with -np 4"
time /usr/local/bin/mpirun -np 4 ./TestProg
rm ./TestProg
sleep 2

# Make a new executable
echo " "
echo " ---------------------"
echo "Compiling TestProg"
/usr/local/bin/mpicc -lm -o TestProg ./TestProgS.c

# Run the executable
echo "Executing the code with -np 4"
time /usr/local/bin/mpirun -np 4 ./TestProg 
rm ./TestProg
sleep 2


# Make a new executable
echo " "
echo " ---------------------"
echo "Compiling TestProg"
/usr/local/bin/mpicc -lm -o TestProg ./TestProg.c

# Run the executable
echo "Executing the code with -np 4"
time /usr/local/bin/mpirun -np 4 ./TestProg

# Stop lamd
/usr/local/bin/lamhalt