Using The Cluster | |
Parallel Programming |
atlanta
, chicago
, nashville
,
seattle
and stlouis
. The /home
partition is shared,
so files you save on one will be saved on all. (The disk actually
resides on chicago
.)
You should do the following to set up your account.
ssh-keygen
program
and simply press return when it asks for a password:
test@stlouis:~$ ssh-keygen -t dsa Generating public/private dsa key pair. Enter file in which to save the key (/home/test/.ssh/id_dsa): Enter passphrase (empty for no passphrase): Enter same passphrase again: Your identification has been saved in /home/test/.ssh/id_dsa. Your public key has been saved in /home/test/.ssh/id_dsa.pub. The key fingerprint is: 61:58:af:01:f6:29:80:01:f2:5b:10:4d:51:51:c1:07 test@stlouis test@stlouis:~$ |
test@stlouis:~$ cd .ssh test@stlouis:~/.ssh$ ls id_dsa id_dsa.pub known_hosts test@stlouis:~/.ssh$ cp id_dsa.pub authorized_keys test@stlouis:~/.ssh$ ls authorized_keys id_dsa id_dsa.pub known_hosts test@stlouis:~/.ssh$ |
authorized_keys
file immediately exists on all hosts. Therefore, you will be
able to run commands elsewhere on the cluster without a commaond.
test@stlouis:~$ ssh seattle hostname seattle test@stlouis:~$ |
test@stlouis:~$ allhosts hostname atlanta chicago nashville seattle stlouis test@stlouis:~$ |
id_dsa.pub
on perile as above (only you
should probably use a passphrase), then append a copy to
the authorized_keys
file on one of the cluster nodes.
This will give you access to any node from perlie with the
passphrase you created.
To run a parallel program:
fred.c
, with your favorite editor.
include <stdio.h> #include <mpi.h> int main(int argc, char **argv) { int nproc, myid; MPI_Init(&argc,&argv); MPI_Comm_size(MPI_COMM_WORLD,&nproc); MPI_Comm_rank(MPI_COMM_WORLD,&myid); printf("Process %d of %d.\n", myid, nproc); MPI_Finalize(); } |
mpicc -o fred fred.c
. There's also
mpicxx
for C++ code.
.mpd.conf
in your home directory which
contains just the line secretword=
whatever. You get the
choose the secret word.
chmod 0600 .mpd.conf
mpd.hosts
which is a list of the machines
to use, one per line. Like this:
atlanta chicago nashville seattle stlouis |
mpdboot -n 5
. The five is the
number of hosts to use, and it cannot be more than what's in mpd.hosts
,
but can be less.
You can use a different file for you host list with the -f
switch.
test@stlouis:~$ mpiexec -n 8 fred Process 0 of 8. Process 2 of 8. Process 1 of 8. Process 3 of 8. Process 4 of 8. Process 5 of 8. Process 6 of 8. Process 7 of 8. test@stlouis:~$ |
mpdboot
.
mpdallexit