Monday Sep 18, 2006
Monday Sep 18, 2006
1 node: Average: 3.1411545250056307 with 1 nodes. 2 nodes: Average: 3.141313165330142 with 2 nodes. 20 nodes: Average: 3.1416765781116878 with 20 nodes. 200 nodes: Average: 3.141568127864779 with 200 nodes.Actually 3.1415 is a fairly good approximation: π to one MILLION decimal places
#!/bin/ksh
#$ -N Buffon
#$ -cwd
# Set the environment variables
if [ -f $HOME/.profile ]; then
. $HOME/.profile
fi
numClients=$1
echo "Starting the server..."
echo "Number of clients: "$numClients
svrResp=$(qsub -N server startServers.ksh)
echo svrResp is $svrResp
svrJobId=$(echo "$svrResp" | awk '{print $3}')
echo svrJobId is $svrJobId
# Wait until the server is started
status="not running"
until [ "$status" == "r" ]
do
status=$( qstat | nawk '/'$svrJobId'/ {print $5}' )
echo Server job status is $status
sleep 10
done
#Wait until the serverhost file is created
filename="$HOME/serverhost"
until test -f $filename
do
sleep 10
done
# then pull the server node name from the file
servernode=$(cat $filename)
rm $filename
echo "Server is running on" $servernode "Submitting a set of clients to the grid for remote execution..."
qsub -N clients -t 1-$numClients startClient.ksh $servernode
echo "Submitting a cleanup job that will wait until the clients are complete"
qsub -hold_jid clients cleanup.ksh $svrJobId