Run MPI On Grid'5000: Difference between revisions
Nniclausse (talk | contribs) |
Nniclausse (talk | contribs) |
||
Line 150: | Line 150: | ||
{{Term|location=node|cmd=<code class="command">cd</code> NetPIPE-3.7.1}} | {{Term|location=node|cmd=<code class="command">cd</code> NetPIPE-3.7.1}} | ||
Change your PATH | Change your PATH | ||
{{Term|location=node|cmd=export PATH=~/openmpi | {{Term|location=node|cmd=export PATH=~/openmpi/bin:$PATH}} | ||
Compile | Compile | ||
{{Term|location=node|cmd=<code class="command">make</code> mpi}} | {{Term|location=node|cmd=<code class="command">make</code> mpi}} |
Revision as of 16:06, 3 February 2010
Running MPI on Grid'5000
When attempting to run MPI on Grid'5000 you'll be faced with a number of challenges, ranging from classical setup problems for MPI software to problems specific to Grid'5000. This practical session aims at driving you through the most common uses cases, which are
- setting up and starting openMPI on a default environment using allow_classic_ssh
- setting up and starting openMPI on a default environment using oarsh
- setting up and starting openMPI on a kadeploy image
- setting up and starting openMPI to use high performance interconnect
Pre-requisite
- Basic knowledge of MPI; if you don't know MPI, you can read: Grid_computation
- Get OpenMPI here : http://www.open-mpi.org/software/ompi/v1.4/
Overwiew
Currently, the default environment is not the same on every sites, therefore, you don't have the same version of OpenMPI on every site. If you want to use OpenMPI for a grid experiment, you will have to install your own MPI version; You have two options:
- install OpenMPI on your home dir (but you should recompile it and install it on all the sites you want to use! it may work by simply copying the compiled file, but it's not guaranteed)
- use the same kadeploy image and deploy it on the the sites you want to use
If you are only interested on a single site experiment, you may use the version provided by the default environment.
Using OpenMPI on a default environment
Compilation
- Make an interactive reservation and compile openmpi on a node :
Unarchive openmpi
configure and compile:
- Install it on your home directory (in $HOME/openmpi/ )
Create a sample MPI program
- We will use a vary basic MPI program to test OAR/MPI; create a file
$HOME/src/mpi/tp.c
and copy the following source:
the code source:
#include <stdio.h> #include <mpi.h> #include <time.h> /* for the work function only */ int main (int argc, char *argv []) { char hostname[257]; int size, rank; int i, pid; int bcast_value = 1; gethostname (hostname, sizeof hostname); MPI_Init (&argc, &argv); MPI_Comm_rank (MPI_COMM_WORLD, &rank); MPI_Comm_size (MPI_COMM_WORLD, &size); if (!rank) { bcast_value = 42; } MPI_Bcast (&bcast_value,1 ,MPI_INT, 0, MPI_COMM_WORLD ); printf("%s\t- %d - %d - %d\n", hostname, rank, size, bcast_value); fflush(stdout); MPI_Barrier (MPI_COMM_WORLD); MPI_Finalize (); return 0; }
Setting up and starting OpenMPI on a default environment using allow_classic_ssh
Submit a job with the allow_classic_ssh
type
- Compile your code
- Use this script to launch
Setting up and starting OpenMPI on a default environment using oarsh
oarsh
is the default connector used when you reserve a node. To be able to use this connector, you need to add the option --mca plm_rsh_agent "oarsh"
to mpirun.
![]() |
node :
|
$HOME/openmpi/bin/mpirun --mca plm_rsh_agent "oarsh" -machinefile $OAR_NODEFILE $HOME/src/mpi/tp |
multi sites
Is this practical sessions, we will do multiples sites MPI with kadeploy. If you want to do this with the default environment, the following steps are required:
- recompile openmpi on all the sites you want to use, in the same directory ($HOME/openmpi)
- recompile your mpi application on all the sites using your openmpi.
- use oargridsub to reserve nodes on several sites
- build a node file using
oargridstat -l
- launch mpirun from the first node of your nodefile, using this nodefile instead of $OAR_NODEFILE.
Setting up and starting OpenMPI on a kadeploy image
Building a kadeploy image
![]() |
Note |
---|---|
You can skip this section and use directly the environment lenny-x64-openmpi available at sophia |
The default openmpi version available in debian based distributions are not compiled with high performances libraries like myrinet/MX, therefore we must recompile OpenMPI from sources. Fortunately, the default images (lenny-x64-XXX) includes all the libraries for high performance interconnect, and OpenMPI will find them at compile time.
We will create a kadeploy image based on an existing one.
Then connect on the deployed node as root, and install openmpi:
Unarchive openmpi
Configure and compile
Add blas library
Create the image using tgz-g5k
Copy the image on the frontend:
Copy the description file of lenny-x64-nfs
Change the image name in the description file:
![]() |
frontend :
|
perl -i -pe "s@/grid5000/images/lenny-x64-nfs-2.0.tgz@$HOME/lenny-openmpi.tgz@" $HOME/lenny-openmpi.dsc |
Using a kadeploy image
single site
multiple sites
Choose three clusters from 3 different sites.
![]() |
frontend :
|
oargridsub -t deploy cluster1 :rdef="nodes=2",cluster2 :rdef="nodes=2",cluster3 :rdef="nodes=2" |
Setting up and starting OpenMPI to use high performance interconnect
By default, openMPI tries to use any high performance interconnect he can find. This is true only if he has found the libraries at compile time (compilation of openmpi, not your application). This should be true if you have built OpenMPI on a lenny-x64 environment.
We will using the Netpipe tool to check if the high performance interconnect is really used: download it from this URL: http://www.scl.ameslab.gov/netpipe/code/NetPIPE-3.7.1.tar.gz
Unarchive Netpipe
Change your PATH
Compile
Myrinet hardware :
Myrinet hardware is available on severals sites (see Hardware page):
- sophia (2G)
- rennes
- orsay (10G)
- lille (10G)
- bordeaux (2G and 10G)
- lyon (2G and 10G)
To reserve one core on two nodes with a myrinet interconnect: Myrinet 2G
or Myrinet 10G
you should have something like that:
0: 1 bytes 4080 times --> 0.31 Mbps in 24.40 usec 1: 2 bytes 4097 times --> 0.63 Mbps in 24.36 usec ... 122: 8388608 bytes 3 times --> 896.14 Mbps in 71417.13 usec 123: 8388611 bytes 3 times --> 896.17 Mbps in 71414.83 usec
the minimum latency is given by the last column for a 1 byte message the maximum throughput is given by the last line, 896.17 Mbps in this case
To reserve one core on two nodes with an infiniband interconnect:
Infiniband hardware :
Infiniband hardware is available on severals sites (see Hardware page):
- rennes (10G)
- nancy (10G or 20G ??? FIXME)
- bordeaux (10G)
- grenoble (20G)
To reserve one core on two nodes with a 10G infiniband interconnect:
or for 20G