MPI. Frequently Asked Questions.

Q: Where can I find and download a free impementation of MPI?

A: Depending on the operating system there are various free implementations. Most common are the following:

Microsoft MPI

Microsoft supports MPI in their High Performance Computing (HPC) Pack. Even if you do not have Windows HPC Server 2008 ή 2012, you can install MS-MPI in Windows XP, Windows Vista, Windows 7, Windows 8 as well as Windows Servers 2008 and 2012. Need to download and install the following packages:

MPICH

MPICH can be used in various platforms. Most recent version supports MPI 3.0 for Linux and Mac OS, but not for Windows. The last MPICH version suitable for Windows is 1.4.1.p1 for both 32-bit and 64-bit.

Open MPI

The Open MPI Project is a free implementation of MPI-2. In particular, Open MPI 1.2 supports MPI-2.0, while Open MPI 1.3 supports MPI-2.1.

Q: Which programming language can use MPI?

A: MPIS supports Fortran, C and C++. However, since MPI 2.2 the C++ language is not supported (see why).

Microsoft MPI

MS-MPI supports C.

MPICH

MPICH supports Fortran, C (recommended) and C++ (until MPICH 2.2)

Open MPI

Open MPI supports Fortran, C και C++.

Q: In which operating system(s) can I install MPI?

A:

Microsoft MPI

MS-MPI runs on MS-Windows.

MPICH

MPICH runs on Linux and Mac OS. Windows was supported until version 1.4.1p1 but it has now stopped.

Open MPI

Open MPI is mainly developed for Linux, OS X, Solaris and Windows (Windows XP, Windows HPC Server 2003/2008 and Windows 7 RC). However, support for Windows has now stopped. Last stable version for Unix is version 1.6.5.

Windows users can use Open MPI implementations for Cygwin.

Q: I have installed MPI for Windows. What else do I need?

A:

Microsoft MPI

You need Visual Studio 2008, 2010 or 2012.

MPICH

You need a programming environment for C/C++. It is recommended to use:

  • the open suite MinGW which offers a GNU compiler for C/C++ and a linker for Windows
  • the free IDE platform eclipse.

Q: How do I write a program and compile it?

A:

Microsoft MPI

The following example is based on Visual Studio 2010.

  1. Create a new Win32 Console Application Project and give it any namme (here we caled it hello_MPI).

  2. In Application Settings click on Empty Project

  3. Right clicking on Project choose Properties

  4. In the Configuration Properties > VC++ Directories menu add the folders Inc and Lib\i386 from the path where MS HPC Pack 2012 was installed. In our example the path is C:\Program Files\Microsoft HPC Pack 2012.

  5. In the Configuration Properties > Linker > Input menu and the variable Additional Dependencies add the library msmpi.lib

  6. In the Configuration Properties > Debugging menu choose Local Windows Debugger : MPI Cluster Debugger

  7. In case you do not have access to any cluster and simply want to run the program in your local computer, edit the variable Run Environment and in the window that pops up choose localhost and the number of concurrent processes (eg. 5).

  8. Then write the program adding a new C++ File in Source Files and give it the name hello_MPI.cpp.

  9. Then click on Build and the resulting executable will be placed in the foler c:\Users\<Username>\Documents\Visual Studio 2010\Projects\hello_MPI\Debug\

MPICH

The following example uses the Eclipse IDE.

  1. Create a new C project

  2. Declare the project parameters (name, path, use of MinGW compiler)

  3. After the poject appears on the left side, right click on "Properties"

  4. Add the include directory "C:\Program Files\MPICH2\include" in the Include paths (-I)

  5. Add the library directory "C:\Program Files\MPICH2\lib" in the Library search path (-L)

  6. Make a link with the MPI library C:\Program Files\MPICH2\lib\mpi.lib from "Miscellaneous" > "Other objects"

  7. Create a new .c file and give it any name, eg. myprog.c

  8. After the file myprog.c is created write the source C code in it

  9. Build the program by clicking on the "hammer" icon (or by selecting the "Project" > "Build Project" menu item)

  10. You have now created the executable file myprog.exe in C:\mpi\myprog\Debug\.

Q: I created the executable myprog.exe. How do I run it?

A: There are various ways to run it.

Note: if you just run
myprog.exe
then only one process will be vreated, ie. the program will not be executed in parallel. This is equivalent to
mpiexec -n 1 myprog.exe