Posted by & filed under Beginner MPI.

MPI is simply a standard which others follow in their implementation. Because of this, there are a wide variety of MPI implementations out there. One of the most popular implementations, MPICH2, will be used for all of the examples provided through this site. Users are free to use any implementation they wish, but only instructions for installing MPICH2 will be provided. Furthermore, the scripts and code provided for the lessons are only guaranteed to execute and run with the lastest version of MPICH2.

MPICH2 is a widely-used implementation of MPI that is developed primarily by Argonne National Laboratory in the United States. The main reason for choosing MPICH2 over other implementations is simply because of my familiarity with the interface and because of my close relationship with Argonne National Laboratory. I also encourage others to check out OpenMPI, which is also a widely-used implementation.

Installing MPICH2

The latest version of MPICH2 is available here. The version that I will be using for all of the examples on the site is 1.4, which was released June 16, 2011. Go ahead and download the source code, uncompress the folder, and change into the MPICH2 directory.

>>> tar -xzf mpich2-1.4.tar.gz
>>> cd mpich2-1.4

Once doing this, you should be able to configure your installation by performing ./configure. I added a couple of parameters to my configuration to avoid building the MPI Fortran library. If you need to install MPICH2 to a local directory (for example, if you don’t have root access to your machine), type ./configure --prefix=/installation/directory/path For more information about possible configuration parameters, type ./configure --help

>>> ./configure --disable-f77 --disable-fc
Configuring MPICH2 version 1.4 with '--disable-f77' '--disable-fc'
Running on system: Darwin Wes-Kendalls-Macbook-Pro.local 10.7.0 Darwin Kernel Version 10.7.0: Sat Jan 29 15:17:16 PST 2011; root:xnu1504.9.37~1/RELEASE_I386 i386
checking for gcc... gcc

When configuration is done, it should say “Configuration completed.” Once this is through, it is time to build and install MPICH2 with make; sudo make install.

>>> make; sudo make install
Beginning make
Using variables CC='gcc' CFLAGS='   -O2' LDFLAGS=' ' F77='' FFLAGS=' ' FC='' FCFLAGS=' ' CXX='c++' CXXFLAGS='  -O2' AR='ar' CPP='gcc-E' CPP

If your build was successful, you should be able to type mpich2version and see something similar to this.

>>> mpich2version
MPICH2 Version:        1.4
MPICH2 Release date:  Thu Jun 16 16:41:08 CDT 2011
MPICH2 Device:        ch3:nemesis
MPICH2 configure:     --disable-f77 --disable-fc
MPICH2 CC:         gcc   -O2
MPICH2 CXX:        c++   -O2

Hopefully your build finished successfully. If not, you may have issues with missing dependencies. For any issue, I highly recommend copying and pasting the error message directly into Google.

Up next

Now that you have built MPICH2 locally, you have a couple options of where you can proceed on this site. If you don’t have access to a cluster or want to learn more about building a virtual MPI cluster, check out the lesson about building and running your own cluster on Amazon EC2. If you already have your own cluster or simply want to run the rest of the lessons from your machine, proceed to the MPI hello world lesson, which provides an overview of the basics of programming and running your first MPI program.

Recommended books

View all recommended books here.

10 Responses to “Installing MPICH2 on a Single Machine”

  1. vairavan

    Seems this installation is just for one CPU or one machine, what do i do if i want to install MPI on a cluster with many nodes?

    • Wes

      Have you tried running the hello world application? This installation process should work for many different types of clusters. You will just have to make sure that you can successfully SSH into other nodes without a password prompt. In the hello world tutorial, I show how to run it on a set of Linux boxes connected through ethernet.

  2. ananya raval

    I tried ./configure command specifying teh directory but it shows an error –
    Permission denied
    how can I solve this??

    • Wes

      Hello Ananya, do you have the permissions to the install directory? Did you use the “–prefix” tag when specifying the directory?

  3. amila


    I have tried to install mpi4py on python v3.2 consedering as system Windows Vista, so the build and install commands were correctly performed, but i had every once the following message:

    error: Unable to find vcvarsall.bat

    Thank you in advance.

    • Wes

      Unfortunately I have never used win7. Have you ever used Cygwin? If I can get hold of a windows machine, I’ll try to install it and post how to on here.

  4. Shahid


    I want to know about the installation and running of MPICH2 on the windows operated system.

    • Wes

      Hello, I have never installed MPICH2 on a windows machine. I assume that you will have to use Cygwin and then install MPICH2 using that. Have you used Cygwin before?


Leave a Reply

  • (will not be published)