Pascal's Weblog
The Grid...



Archives
« November 2009
SunMonTueWedThuFriSat
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
     
       
Today
Click me to subscribe
Search

Links
 

Today's Page Hits: 6

« Learning the hard... | Main | Solaris 10 / Open... »
Friday Aug 18, 2006
Distributed Mersenne Primes on Sun Grid
Just finished up running the distributed version of my test program. Only took 15 minutes using 5 processors of the Grid. An almost perfect acceleration!


What I think I need to get used to when using the Grid are the couple of scripts using the Grid engine commands to initiate all the processes on the nodes of the Grid. They are basically the same as the ones used by the RMI examples listed on the community but I will still list these scripts as I found them useful:

cat Mersenne.ksh
#!/bin/ksh
#$ -N Mersenne
#$ -cwd

# Set the environment variables
if [ -f $HOME/.profile ]; then
   . $HOME/.profile
fi

numClients=5

echo "Starting the server..."
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



 cat startServers.ksh
#!/bin/ksh
#$ -N startServers
#$ -cwd

echo "Starting the registry in the background..."
rmiregistry &

# Wait until the registry is started
proc=0
while [ "$proc" == 0 ]
do
  proc=$( ps -ef | grep "[r]miregistry" )
  echo $proc is running
  sleep 10
done

# Place the name of this host in a file, so that clients can read it
hostname > $HOME/serverhost
echo "The servers location is" $(hostname)

echo "Starting the server..."
java MersenneServerImpl



 cat startClient.ksh
#!/bin/ksh
#$ -N startClient
#$ -cwd

servernode=$1

echo "Starting a client on $(hostname) to talk to server running on" $servernode
java MersenneClient $servernode



cat cleanup.ksh
#!/bin/ksh
#$ -N cleanup
#$ -cwd

# Set the environment variables
if [ -f $HOME/.profile ]; then
   . $HOME/.profile
fi

echo Killing the server, job number $1 ...
qdel $1

Posted at 03:10PM Aug 18, 2006 by Pascal Ledru in Grid Computing  |  Comments[0]

Comments:

Post a Comment:
  • HTML Syntax: NOT allowed