domingo, agosto 20, 2006

Installation and configuration of MPICH2 for a Beowulf Cluster, version 0.2.1
For kanibalv (kanibalv@gmailNOSPAM.com)

(Supercomputing with Ubuntu o Kubuntu.)



This is how I configure the MPICH2 packages in Kubuntu Dapper LTS whit 2 PC's. Also works for 1 PC's.


I have:
-2 PC's pentium III with ethernet card, connected to a five port switch (this have a port connected to a "router" for adsl of timofonica).
-The master PC, have the name kubuntu and the node have the name of nodo01
-the addresses are 192.168.1.2 for kubuntu and 192.168.1.3 for nodo01. (my /etc/network/interfaces in the end of the guide)

-Ok, first install ssh service, this could be rsh, but i don't try it yet, (for now so much head-ache jajaja)
$ sudo apt-get install ssh

- then for password less connection, (this is how i did it, post a better way)
$ssh-keygen -t dsa
#here ask for save place and pass, i just hit enter.

-then copy the key
$ssh-copy-id usuarioremoto@nodo01
$ssh-add

- the same whit RSA
$ssh-keygen -t rsa
#here ask for save place and pass, i just hit enter.

-then copy the key
$ssh-copy-id usuarioremoto@nodo01
$ssh-add

(you can test this whit the command "ssh nodo01", put "exit" for log out)

-So, install MPICH2 packages,this must be in the master and nodes:

$ sudo apt-get install mpich2
$ sudo apt-get install mpich2-mpd
$ sudo apt-get install mpich2-mpe
$ sudo apt-get install libmpich2-1.0
$ sudo apt-get install libmpich2-1.0-dev

the repositories for MPICH2 packages are in (put it in /etc/apt/sources.list):
#MPICH2.deb Packages
deb http://torvalds.cs.mtsu.edu/~zach/debian/current/ /

- the /etc/hosts file must be like this, with other don't work:
$sudo vim /etc/hosts

127.0.0.1 localhost localhost.localdomain
192.168.1.2 ubuntu master
192.168.1.3 nodo01
# IPv6, etc

-after this, must be a file called ".mpd.conf" in /home/"usuario" whit the follow line:
MPD_SECRETWORD="secret"

# the word "secret" is for your choice

-Also a file called ".mpd.hosts" with:
#
kubuntu
nodo01
#

(the same in nodes)

-repeat the steps in all PC's


-then in the master, run the MPD daemon

For run it on 1 PC only:
usuario@kubuntu:~$mpdboot

For 2 o more PC's is:
usuario@kubuntu:~$mpdboot -n 2 -f .mpd.hosts
# the 2 number is for 2 PC's, but could be any number lower than all PC's number

- for test
usuario@kubuntu:~$mpdtrace
kubuntu
nodo01
-this messages means that MPD daemon is running on the PC's

-another way
usuario@kubuntu:~$mpiexec -n 2 hostname
kubuntu
nodo01

-or:
usuario@kubuntu:~$mpiexec -l -n 3 hostname
1: nodo2
0: kubuntu
2: kubuntu

-and finally the cpi program
usuario@kubuntu:~$mpiexec -l -n 5 /usr/share/mpich2/examples/cpi
0: Process 0 of 5 is on kubuntu
1: Process 1 of 5 is on nodo2
3: Process 3 of 5 is on nodo2
2: Process 2 of 5 is on kubuntu
4: Process 4 of 5 is on kubuntu
0: pi is approximately 3.1415926544231230, Error is 0.0000000008333298
0: wall clock time = 0.026098



I hope this works for you, i spend a lot of time to get here, write about yours experiences....
-o-

Note: My /etc/network/interfaces file (with my ADSL conf):

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback
address 127.0.0.1
netmask 255.0.0.0

# The primary network interface
#auto eth0
#iface eth0 inet dhcp

auto dsl-provider
iface dsl-provider inet ppp
provider dsl-provider

pre-up /sbin/ifconfig eth0 up # line maintained by pppoeconf

# added by pppoeconf
auto eth0
iface eth0 inet static
address 192.168.1.2
netmask 255.255.255.0
gateway 192.168.1.1

-o-

miércoles, agosto 16, 2006

Instalación y configuración MPICH2, para Cluster Beowulf. versión 0.2
Por kanibalv

(Supercomputación con su Ubuntu o Kubuntu.)

Aquí dejo como configure el MPICH2 para un cluster con 2 nodos, los cuales corren Kubuntu Dapper LTS.
También esta la opción para un solo PC, que describo más abajo.

Supuestos:
- Tengo dos PC's pentium III, con sus respectivas tarjetas de red conectadas a un switch de 5 bocas, de las cuales una esta al "router" adsl k me dio timofonica.
- El PC master en donde se ejecutara el código tiene por nombre "Kubuntu" y el PC que se usara como nodo se llamara "nodo01" (usuario@kubuntu y usuario@nodo01).
- las tarjetas de Red (eth0) de cada una son 192.168.1.2 y 192.168.1.3 respectivamente. (yo los asigne manualmente en Kcontrol->Parámetros de Red)(al final les dejo el archivo /etc/network/interfaces que uso yo)(comprobar con "ifconfig -a").

- Lo primero es instalar ssh para la comunicación, puede ser rsh (sería + rapido) pero no he probado el como, ya me dio harto calor en la cabeza de esta forma(jajajaja):

$ sudo apt-get install ssh

-luego para que no pida contraseñas (no se si esta parte esta del todo bien, postear una correcta):
$ssh-keygen -t dsa
#pregunta en donde guardarla y passwords, yo deje el archivo por defecto y sin passwords.

-Luego copiarla
$ssh-copy-id usuarioremoto@nodo01
$ssh-add

-Luego lo mismo con la llave rsa
$ssh-keygen -t rsa
#pregunta en donde guardarla y passwords, yo deje el archivo por defecto y sin passwords.

-Luego copiarla
$ssh-copy-id usuarioremoto@nodo01
$ssh-add

(se pueden comunicar con el nodo con ssh nodo01, a mi no me pide password luego de esto, se salen con "exit")
- ent. instalemos los .deb de MPICH2:
Ent. en el master y nodo(s) instalar (yo lo hice con el adept):
$ sudo apt-get install mpich2
$ sudo apt-get install mpich2-mpd
$ sudo apt-get install mpich2-mpe
$ sudo apt-get install libmpich2-1.0
$ sudo apt-get install libmpich2-1.0-dev

Si no están, el repositorio es (agregar en /etc/apt/sources.list) (grande Zach):

#MPICH2.deb Packages
deb http://torvalds.cs.mtsu.edu/~zach/debian/current/ /

-Luego hay que editar /etc/hosts en todos los PC's conteniendo este tipo de configuración, (no funca con otra):
$sudo vim /etc/hosts
#tiene que verse asi
127.0.0.1 localhost localhost.localdomain
192.168.1.2 ubuntu master
192.168.1.3 nodo01
#luego tiene lo de las IPv6 y demases por defecto

-Luego crear o editar un archivo .mpd.conf en /home/"ususario" (va con el punto al inicio) en todos los PC's que contenga la linea:

MPD_SECRETWORD="secret"

#la palabra "secret" es a tu elección pero en todos la misma (sin comillas)

-Luego en el master crear un archivo llamado .mpd.hosts con:
#
ubuntu
nodo01
#
(igual lo tenia en el nodo)

-Repetir los pasos en todos los PC's, yo lo hice sólo con 2.

-Entonces podemos hacer correr el demonio MPD en el cluster
Para un solo PC (el master) es:
usuario@kubuntu:~$mpdboot
#Los programas funcionan de la misma forma un uno o 10 nodos, lo que importa son el numero de procesos.

Para 2 o más PC's es:
usuario@kubuntu:~$mpdboot -n 2 -f .mpd.hosts
#el 2 es porque tengo solo 2 PC's, puede ser cualquier numero menor al numero de PC's en .mpd.hots

-Para probar se ejecuta mpdtrace y debe arrojar el nombre de los PC's, ejemplo:
usuario@kubuntu:~$mpdtrace
kubuntu
nodo01
- si les salio ese mensaje significa que el demonio esta corriendo en el master y el nodo.
-Otra forma de probarlo es ejecutar hostname en los PC's
usuario@kubuntu:~$mpiexec -n 2 hostname
kubuntu
nodo01
-o tambien:
usuario@kubuntu:~$mpiexec -l -n 3 hostname
1: nodo2
0: kubuntu
2: kubuntu
#la opcion -l es para mostrar el rank de cada proceso.

- probar el ejemplo, cpi (calculo de pi en paralelo):
usuario@kubuntu:~$mpiexec -l -n 5 /usr/share/mpich2/examples/cpi
0: Process 0 of 5 is on kubuntu
1: Process 1 of 5 is on nodo2
3: Process 3 of 5 is on nodo2
2: Process 2 of 5 is on kubuntu
4: Process 4 of 5 is on kubuntu
0: pi is approximately 3.1415926544231230, Error is 0.0000000008333298
0: wall clock time = 0.026098

Si les ha servido posteen por favor, dado que he perdido una enormidad de tiempo para llegar a esto dado que un tutorial para ubuntu no existe. Seria bueno que alguien k tenga más de 2 PC's diga como le funciona...

-o-

Nota: mi archivo /etc/network/interfaces (con mi conf de ADSL):

# This file describes the network interfaces available on your system
# and how to activate them. For more information, see interfaces(5).

# The loopback network interface
auto lo
iface lo inet loopback
address 127.0.0.1
netmask 255.0.0.0

# The primary network interface
#cambiado por mi
#auto eth0
#iface eth0 inet dhcp

auto dsl-provider
iface dsl-provider inet ppp
provider dsl-provider

pre-up /sbin/ifconfig eth0 up # line maintained by pppoeconf

# added by pppoeconf
auto eth0
iface eth0 inet static
address 192.168.1.2
netmask 255.255.255.0
gateway 192.168.1.1

-o-