Saturday, September 19, 2009

Installing MPI (Sep 20 09)


My daughter (Karen) and I are studying parallel programming in MPI. We have these beautiful books, "Parallel Programming in C with MPI and OpenMP" by Michael Quinn and "Parallel Programming with MPI" by Peter Pacheco to serve as guides. All we need are the actual MPI support libraries and include files. Karen intends to run parallel programs on her four-node Rockscluster at the UP-NIMBB. For test-programming at home, we need to try out our ideas on our personal laptops, before trying on the cluster.

We decided to standardize on the MPI implementation MPICH from Argonne National Laboratories, since our friend Allan Espinosa works there, and should we get into problems, we can always email him. On Karen's Ubuntu Jaunty laptop, all she needed to do start Synaptic Package Manager, select mpich2 and mpich2-dev, and everything is installed for her. Ubuntu is truly friendly to human beings (specially the parallel computing kind).

On my Fedora Leonidas laptop, typing the command "yum install mpich2 mpich2-devel" does not work. I had to do a manual rpmfind to locate the rpms that I need. If you use Leonidas, you will need to get the following:

ftp://fr2.rpmfind.net/linux/fedora/updates/11/i386/mpich2-1.1.1p1-1.fc11.i586.rpm
ftp://fr2.rpmfind.net/linux/fedora/updates/11/i386/mpich2-devel-1.1.1p1-1.fc11.i586.rpm
ftp://fr2.rpmfind.net/linux/fedora/releases/11/Everything/i386/os/Packages/environment-modules-3.2.6-7.fc11.i586.rpm

Use the "rpm -i" command to install these rpms. The MPI header file will be installed in /usr/include/mpich2/mpi.h, and the libraries will be installed in /usr/lib/mpich2/", which are fairly standard places. Thus our C source code should have the include directive

#include

and our gcc command line should look like

gcc myprog.c ... -L/usr/lib/mpich2 -lmpich -o myprog

Thus we need to add -L and -l among other compiler directives.

Since building a compute cluster is fairly cheap at current Gilmore prices, and since the necessary development tools are freely downloadable, every scientist can now experiment with parallel computing, and pretend that you were using a Cray computer, while sipping Philippine Barako coffee. Enjoy!

1 comment:

Allan Espinosa said...

using "mpicc prog.c" us much simpler though :)