Personal tools
You are here: Home / openCMISS / Wiki / setting up and using MPICH2
Log in

Forgot your password?

setting up and using MPICH2

"MPICH2": is an implementation of the Message-Passing Interface (MPI). The goals of MPICH2 are to provide an MPI implementation for important platforms, including clusters, SMPs, and massively parallel processors. It also provides a vehicle for MPI implementation research and for developing new and better parallel programming environments.

I (andre) thought I'd start this page off by documenting the steps I'm going through getting this MPI implementation up and running on my laptop. I'm guessing we'll be using IBM's MPI implementation on their machines, but other platforms/machines may get added if we use MPICH2 on them.

Building from source

A good "description": is available at the MPICH2 website. Simply downloading the source and doing a configure and make got everything kinda working using the gcc 3.4.1-4mdk I have installed on my laptop (Mandrake 10.1). A problem was there is no Fortran 90/95 support since I had no Fortran 90/95 compiler installed on my system...

Fortran 90/95

It seems we're going with "g95": for the openCMISS project, at least for Linux Fortran 95 compilers. MPICH seems to provide a Fortran 90 interface, which I assume works fine with Fortran 95 but will have to wait and see how this goes.

Essentially, if the MPICH configure script can find a known Fortran 90/95 compiler it will add Fortran 90 support when you build the MPICH libraries and helper scripts. If it doesn't find one that it knows about you don't get the Fortran 90 support.

I initially simply downloaded a binary build of the latest version of g95 (2005-12-20) and made sure it was in my path when I ran the configure script. This worked fine for building MPICH but wouldn't let me build any Fortran 90 applications. Further investigation turned up that g95 is built for and with gcc 4.0.1 - so the binary that I had is incompatible with the gcc 3.4.1 installation on my laptop.

So for a laugh I thought I'd build all the compilers from source to ensure that they're all compatible. Luckily there are good "instructions on how to do this": The only difference I had as that I built all languages rather than just c - but the fortran and java probably aren't all that useful...

Having now built gcc, g++, and g95 from source, I simply made sure they were first in my path when I ran the MPICH configure script. A slight hiccup was that the configure script looks first for the 'cc' and 'f77' compilers, which are still found in my system directories. I fixed this with a bunch of symbolic links so that my compilers bin directory looks like:

g++ -> i686-pc-linux-gnu-g++-4.0.1*
c++ -> i686-pc-linux-gnu-c++-4.0.1*
gcc -> i686-pc-linux-gnu-gcc-4.0.1*
g95 -> i686-pc-linux-gnu-g95*
g77 -> g95*
cc -> gcc*
f77 -> g77*

Having this bin directory first in my path ensures that all the right compilers are picked up by the MPICH2 configure script. With this set of compilers everything now works and I can build the example f90 application.

Summary of build

This is the process that worked for me (not sure yet if I have C++ support):

  1. "Download, build, and install": gcc 4.0.1 and g95.
  2. "Download": MPICH2 source (I used version 1.0.3).
  3. Configure MPICH2 (having made sure the gcc 4.0.1 and g95 compilers are first in your path): './configure --prefix=install-path'.
  4. Make and install MPICH2: 'make; make install'.
  5. If the right set of compilers are first in your path, simply add MPICH2 'install-dir/bin' to your path. Or if you'd rather keep the system default compilers as your defaults you need to somehow wrap the MPICH2 helper scripts and applications ('mpicc','mpicxx','mpif77','mpif90','mpirun','mpiexec','mpd','mpdtrace', etc...). I did this with the following script in my '$HOME/bin' directory and a bunch of symbolic links to the appropriate names:
~/bin> cat #!/bin/bash MPICH2_BIN=/home/nickerso/hpc/mpich2/1.0.3/bin COMPILERS_BIN=/home/nickerso/compilers/bin export PATH=$MPICH2_BIN:$COMPILERS_BIN:/usr/bin:/bin:/usr/local/bin:/usr/X11R6/bin # What program do we want to run? prog=`basename $0` exec $prog $@ ~/bin> ls -l mpd ->* mpdallexit ->* mpdtrace ->* mpicc ->* mpicxx ->* mpiexec ->* mpif77 ->* mpif90 ->* mpirun ->*
  1. Follow the instructions from the "README": to set up the process manager (step 8).

If you just want to run multiple jobs on a single machine just do this:

echo 'secretword=topsecretword' > ~/.mpd.conf
chmod 600 ~/.mpd.conf

and then you can start up mpd with the command 'mpdboot'. This gives you a process manager running on your local machine to which you can submit multiple jobs.

Using MPICH2

Seems all you need to do is get the process manager up and running and then use 'mpiexec -n # program' to run stuff.


  1. Fortran 95 ??
  2. C++ ??
  3. Multiple different machines.