Minicluster:Mpich

De WikiLICC
Revisão de 06h51min de 17 de junho de 2010 por Dago (Discussão | contribs) (Running on One Machine)
Ir para: navegação, pesquisa

Parece que na distribuição padrão não está presente.

Instalação=

Máquina mestre

Como possui acesso a internet via segunda placa de rede, basta usar

yum install mpich2

Máquina escravo

Não possui acesso a internet. Existem várias possibilidades, porém estou tentando o seguinte:

  • Baixar os pacotes .rpm necessários na máquina mestre e copiá-los para a máquina escravo. [ok]
tcl-8.5.7-5.fc13.x86_64.rpm
environment-modules-3.2.7b-7.fc13.x86_64.rpm
mpich2-1.2.1p1-2.fc13.x86_64.rpm 
mpich2-devel-1.2.1p1-2.fc13.x86_64.rpm
  • Importar as keys necessárias para instalar os pacotes (não instalou direito usando apenas rpm):
rpm --import /etc/pki/rpm-gpg/RPM-GPG-KEY-fedora-x86_64

ou melhor ainda, editar /etc/yum.conf para não reclamar sobre signature files

vi /etc/yum.conf
..
gpgcheck=0
..
  • Instalar usando yum
yum localinstall tcl-8.5.7-5.fc13.x86_64.rpm --disablerepo=fedora --disablerepo=updates

Configuração

This is part three of a multi-part tutorial on installing and configuring MPICH2. The full tutorial includes

MPICH without Torque Functionality

In this paradigm, users (and sysadmins) are responsible for much more overhead, and many more possibilities for misconfiguration occur. Unless you are planning not to have a scheduler and queue, I highly recommend setting up MPICH with Torque Functionality instead.

Creating Mpd.conf Files

Mpd stands for "multi-purpose daemon." MPICH2 separates process communication from process management by having an mpd process manage any MPI processes. The mpd's need a little extra customization that wasn't necessary in MPICH1. To begin with, each user that will (potentially) use MPICH needs to have a mpd.conf file.

User Accounts

Each user needs a .mpd.conf file in his/her home directory, and must only be readable and writable by that user. The file should look like this:

MPD_SECRET_WORD=yours3cr3tw0rd
MPD_USE_ROOT_MPD=yes
  • MPD_SECRET_WORD can be unique to each user, but doesn't have to be
  • MPD_USE_ROOT_MPD specifies that users will not start up their own mpd daemons, but will rely upon attaching to one already running under the root account

You can run a simple script to create this file for all of your users. First, create the file as shown above in root's home directory (/root). Make it only readable/writable by it's owner, root, by running chmod 600 /root/.mpd.conf. Then to make a copy for each of the user accounts, run

for x in `ls /shared/home/`; do rsync -plarv /root/.mpd.conf /shared/home/$x/; chown $x:users /shared/home/$x/.mpd.conf; done

Of course, replace all instances of /shared/home/ with the location where your users' home directories are stored, and replace users with whatever group your users are in.

Future Users

In order to make sure new users automatically have this file created for them, create a .mpd.conf file in /etc/skel/ on the machine you create user accounts from. Make sure it has a secret word and root mpd flag as shown above. Then, run

chmod 600 /etc/skel/.mpd.conf

This will make sure the file is created with only the user having read/write permissions.

Root's .mpd.conf

Similar to the users, root needs to have a mpd.conf file on each one of the worker nodes. For root, rather than being stored in a home directory, this file is located at /etc/mpd.conf. This file only needs one line:

MPD_SECRETWORD=yours3cr3tw0rd

You can replace yours3cr3tw0rd with whatever you'd like. Then, make sure it's only readable/writable by root:

chmod 600 /etc/mpd.conf

Once you've created this file on one of your nodes, you can manually create it on each of the other nodes, or see the Cluster Time-saving Tricks page for tips on how to script this process. Make sure that the secret word matches on all of the worker nodes.

Rodando em uma máquina

Para rodar um programa MPI em uma máquina.

Inicie um Daemon

Escolha uma da máquinas escravo. SSH nesta máquina, como root, inicie mpd (multi-purpose daemon) para rodar em background com

mpd --daemon

Verifique que o mpd foi iniciado nesta máquina:

mpdtrace -l

Deveria aparecer algo como o Nome.da.maquina_PID (endereco.ip)

cell100.matrix_54419 (192.168.0.100)

Rodando um programa MPI

Conecte-se a uma máquina escravo usando ssh

ssh usuario@cell100

Abra o editor de texto e digite o programa "hello world" Creating and Compiling an MPI Program.

vi hellompi.f90

Rode o programa com um processo

mpiexec ./hellompi

Rode novamente usando mais processos (e um processador - talvez 2 se for dual-core ?)

mpiexec -np 5 ./hellompi

Deveria aparecer

[dago@cell100]$ mpiexec -np 4 ./hellompi
Sou o processo            0  de um total de            4  rodando em cell100.matrix
Sou o processo            2  de um total de            4  rodando em cell100.matrix
Sou o processo            1  de um total de            4  rodando em cell100.matrix
Sou o processo            3  de um total de            4  rodando em cell100.matrix

onde cell100.matrix é o nome da máquina (todas no mesmo nó ainda). Para rodar em mais máquinas, primeiro desligue o mpd

[usuario]$ mpdallexit

Configuring Worker Nodes to use Root's MPD Daemon

Starting up an mpd daemon for each user each time they log in is doable, but that requires an extra step of complexity for your users to understand. Plus, they'll need to remember to start up daemons on multiple machines when they run programs that require multiple processors (not just multiple processes).

An easier paradigm to follow is to start a single mpd daemon on each of the worker nodes and have users' programs attach to that daemon. Continue on to MPICH: Starting a Global MPD Ring to implement this.