Beowulf howto

A computer cluster is a group of linked computers, working together closely and runs paralell programs using the power of all the nodes and produces the result.Beowulf clusters need distributed application programming environments such as PVM (Parallel Virtual Machine) or MPI (Message Passing Interface).There isn't a software package called "Beowulf". There are, however, several pieces of software many people have found useful for building Beowulf clusters: MPI, LAM, PVM....

Secure Shell or SSH is a network protocol that allows data to be exchanged using a secure channel between two networked devices.

Here two methods are discussed:

[1] Using MPICH

[2] Using PVM


1. Make sure you have mpich1 installed in the computers you wish to connect. In the example two computers running Debian based OS(Debian Lenny and Ubuntu Jaunty) are connected and running MPICH1. The IP address are assigned statically.

2. Edit the /etc/hosts file in the two systems and add the details of hosts taking part in the cluster. Here only two computers are used, therefore the /etc/hosts file is edited as follows:

jestinjoy@debian:~$ cat /etc/hosts localhost debian node1 node0

# The following lines are desirable for IPv6 capable hosts

::1 localhost ip6-localhost ip6-loopback

fe00::0 ip6-localnet

ff00::0 ip6-mcastprefix

ff02::1 ip6-allnodes

ff02::2 ip6-allrouters

ff02::3 ip6-allhosts

IP address of node0 here given as and node1 as You could give whatever you like.

Note: Make sure that the hostnames and IP address are given correctly in all the nodes. If not configure it with the following commands:

jestinjoy@debian:~$ hostname <new_hostname>

jestinjoy@debian:~$ ifconfig eth0 <new_ip_address>

3. Create a new user in all the nodes(here two nodes) with the name "cluster" by going to System->Administration->Users and Groups and clicking on "Add User".

4. Make sure you have openssh running in all the nodes. If not try install it with the following command:

jestinjoy@debian:~$ sudo apt­-get install openssh­server

Then start ssh using the following command:

jestinjoy@debian:~$ /etc/init.d/ssh start

5. Login as "cluster" user and create keys for connection by executing the following commands:

cluster@debian:ssh-keygen -t dsa

This command will generate a new ssh key. On executing this command, it'll ask for a passphrase. Leave it blank as we want to create a passwordless ssh

A folder called .ssh will be created in your home directory. Its a hidden folder. This folder will contain a file that contains your public key. Now copy this key to another file called authorized_keys in the same directory.

cluster@debian:~$cd /home/cluster/.ssh; cat >> authorized_keys

Copy the file "authorized_keys" to the host where you want to have passwordless access.

jestinjoy@debian:~$scp /home/cluster/.ssh/authorized_keys cluster@

6. Edit the file /etc/mpich/machines.LINUX to add the hostnames of all nodes except the home node ie. If you're editing the machines.LINUX file of node0, then that file will contain host names of all nodes except node0.The machines.LINUX file for the machine node0 is as follows

node1 : 2

The number after : indicates number of cores available in each of the nodes.

CLUSTER IS READY NOW!!!!!!!!!!!!!!!!!!!!!

7. Copy the folder /usr/share/doc/libmpich1.0-dev/examples/ which contains mpi examples. Create a folder called example an the home folder of each node and paste the file there. Run make to compile the source files.To execute the code type the following in the terminal

cluster@node0:~$ mpirun -np 2 <executable_name>

"-np 2" flag indicates the number of processes to be spawned. Change it accordingly for your cluster.

Note: Try creating the same user and same example folder in each of the nodes. Otheriwse install nfs and mount a folder so that all the machines can access it.

Cluster using PVM

For cluster using PVM, the steps upto 5 are same.

6. Edit the .rhosts file in the home folder of the "cluster" user to add the hostnames of the participating hosts. If .rhosts file is not there create one and add the contents as given.

clutser@node0:~$ cat /home/cluster/.rhosts

node1 cluster

node0 cluster

7. open a terminal a type pvm to get pvm start working.

cluster@debian:~$ pvm

cluster@node0:/home/jestinjoy$ pvm

pvm> conf


1 host, 1 data format


node0 40000 LINUX 1000 0x00408841

pvm> add node1

add node1

1 successful


node1 80000

pvm> conf


2 hosts, 1 data format


node0 40000 LINUX 1000 0x00408841

node1 80000 LINUX 1000 0x00408841

pvm> quit


Console: exit handler called

pvmd still running.

conf will display the current configuration. add <hostname> will add the host to the pvm list. delete <hostname> will delete the host from pvm list. Quit will get out of the pvm console but with pvm still running in background. Use halt to stop pvm completely.

CLUSTER IS READY NOW!!!!!!!!!!!!!!!!!!!!!

8. Example programs are available in repository. They can be installed by typing as root in terminal.

debian:/home/jestinjoy# apt-get install pvm-examples

These are compiled ones. Move these to the /usr/lib/pvm3/bin/LINUX folder. LINUX folder is not created by default. You have to create it. The examples are located at /bin

To run the programs from the pvm prompt run "spawn -> <program name>"

pvm> spawn -> hello

spawn -> hello


1 successful


pvm> [5:t4000c] i'm t4000c

[5:t4000c] from t80008: hello, world from node1

[5:t4000c] EOF

[5:t80008] EOF

[5] finished