Performance Tools for Software Developers - Building Open MPI* with the Intel® compilers


This guide is intended to help Intel® compiler customers build and use Open MPI* library. Open MPI is a standards-compliant, open-source implementation of the Message Passing Interface, a library specification for parallel processes or threads to exchange data in a parallel application.


Version information
The version of the Open MPI: 1.8.3
The version of Intel C++ and Fortran Compilers for Linux* or Mac OS* X: 15.0

Application notes
Open MPI is a standards-compliant, open-source implementation of the Message Passing Interface, a library specification for parallel processes or threads to exchange data in a parallel application. The target environment for Open MPI can vary dramatically based on interconnect, adapters, node types, batch subsystem, etc. Please read all relevant documentation for your target system.

This application note demonstrates the framework for building Open MPI with the Intel compilers but does NOT claim to represent all possible configurations and variations of the build for all possible target environments.

Obtaining the source code
Open MPI is obtained from the Open MPI website,† . Please review their licensing and download instructions for access to this code.

Obtaining the latest version of Intel C++ Compiler and Intel Fortran Compiler
Licensed users of the Intel compilers may download the most recent versions of the compiler from the Download Center: Registration Center.
Others can download the evaulation copy from

Hardware: This note applies to users with stand-alone computers with two or more cores or distributed-memory clusters.

Software: This note applies to Open MPI built on Linux (32 and 64 bit) and Mac OS* X using the 15.0 version of the Intel compilers. Please consult the Open MPI†  website for a complete list of supported platforms and operating systems.

Configuration and set-up information
Open MPI uses an Autoconf "configure" script to determine the build environment and tools and create the necessary build configuration. The method to build Open MPI, open a Mac OS* Terminal window or a Linux* shell:

gunzip -c openmpi-1.8.3.tar.gz | tar xf -
cd openmpi-1.8.3
./configure --prefix=/usr/local CC=icc CXX=icpc FC=ifort
... output of configure ...
make all install
... output of build and installation ...

As shown above, the configure options CC, CXX, and FC are used to specify which compilers are used to build Open MPI. The example shown above uses both the Intel C++ Compiler ( CC=icc CXX=icpc ) and the Intel Fortran Compiler ( FC=ifort ). Note that the Intel C++ compiler driver is named ' icpc'. Do NOT use ' icc' as the C++ compiler. The Intel compilers are GNU compatible, thus you may mix and match the Intel compilers with GNU compilers for C++ and Fortran. However, the mixing of GNU compilers with Intel compilers has not been tested with this application.

The configure script has a lot of possible options. To learn all of the possible configuration options, see the help provided in the output of "./configure --help" or read the contents of the file README provided in the OpenMPI tar archive file.

Specifying Intel compiler options in the configuration and build
To pass options to the compilers, the following command options to configure are supported:

CFLAGS= arguments to pass to the C compiler ( icc)
CXXFLAGS= arguments to pass to the C++ compiler ( icpc)
FCFLAGS= arguments to pass to the Fortran 90 compiler ( ifort)

Please see the Intel Compiler Documentation for appropriate options. In general, MPI performance is dominated by interconnect fabric latency and to a less extent on bandwidth. A general rule of thumb is to use the default compiler optimizations and avoid overly aggressive optimizations.

The default optimization with the Intel Compilers, that is if NO compiler option for -O is specified, is -O2. The -O2 optimizations provide a good level of optimization and safety for both the Intel C++ compiler and the Intel Fortran Compiler. The Open MPI build defaults have a reasonable optimization level.

Building MPI applications
Once Open MPI is installed, set your PATH environment variable to point to the <installation directory>/bin directory. Remember, from above, the <installation directory> is set by the --prefix argument you passed to configure. Typically this is /usr/local. Thus, for bash shell on Linux* and Mac* OS, one would:

export PATH=/usr/local/bin:${PATH}
export LD_LIBRARY_PATH=/usr/local/lib:${LD_LIBRARY_PATH}

and on Mac OS X you also should set:

You should consider making this part of your default user environment by adding this export statement to your ~/.profile startup file.

Once that is done, to compile MPI application you use the Open MPI compiler wrappers.
The C wrapper is named mpicc.
The C++ wrapper has 3 equivalent wrappers, mpicxx, mpiCC, or mpic++. Use any one of these.
The Fortran 77 wrapper is name mpif77.
The Fortran 90 wrapper is named mpif90.
These compiler wrappers will invoke the Intel compilers and link all necessary Open MPI libraries.


mpicc -o mpi_pong mpi_pong.c

See the Open MPI FAQ information on building applications for more extensive details and information.

Running an application under Open MPI
Open MPI provides command mpirun and mpiexec to launch parallel applications. Below is a simple example to run a 2 process MPI application:

mpirun -np 2 ./mpi_pong

There are many possible options to mpirun and mpiexec, as well as interactions with batch scheduling systems such as PBS. Please see the Open MPI FAQ for all the specifics for your system or cluster.

This aritcle shows the steps on how to build Open MPI* using the Intel Compilers.

Known issues and limitations
At this time, there are no known issues with using the Intel Compilers to build Open MPI. Please see the Open MPI†  website for all known issues and limitations.

This link will take you off of the Intel Web site. Intel does not control the content of the destination Web Site.


Optimization Notice

Intel's compilers may or may not optimize to the same degree for non-Intel microprocessors for optimizations that are not unique to Intel microprocessors. These optimizations include SSE2, SSE3, and SSSE3 instruction sets and other optimizations. Intel does not guarantee the availability, functionality, or effectiveness of any optimization on microprocessors not manufactured by Intel. Microprocessor-dependent optimizations in this product are intended for use with Intel microprocessors. Certain optimizations not specific to Intel microarchitecture are reserved for Intel microprocessors. Please refer to the applicable product User and Reference Guides for more information regarding the specific instruction sets covered by this notice.

Notice revision #20110804

For more complete information about compiler optimizations, see our Optimization Notice.


Zhang X.'s picture

This note is very clear, however there are still errors, probably the same with #9.

*** C++ compiler and preprocessor

checking whether we are using the GNU C++ compiler... no

checking whether icpc accepts -g... no

checking dependency style of icpc... none

checking how to run the C++ preprocessor... /lib/cpp

configure: error: in `/Users/xiaotianzhang/Documents/openmpi-1.8':

configure: error: C++ preprocessor "/lib/cpp" fails sanity check

See `config.log' for more details


OS: Mac OS X 10.9.2

Compiler: Intel Fortran Compiler 2013.0.088 & Intel C++ Compiler 2013.0.088 




woshiwuxin's picture


However, there is a typo.

/* quotation */
Running an application under Open MPI
Open MP provides command mpirun and mpiexec to launch parallel applications.
/* quotation */

It should be "Open MPI" in the second line.

anonymous's picture


I got following error. How can i fix this issue?

*** C compiler and preprocessor
checking for style of include used by make... GNU
checking for gcc... icc
checking for C compiler default output file name...
configure: error: in `/nfs/openmpi-1.4.3':
configure: error: C compiler cannot create executables
See `config.log' for more details

bredsj's picture

Further to my earlier comment:

I have opened the configure file and saved it again in the linux format so the configure script works now BUT, the following error message is received:

: command not found4:
'/configure: line 25: syntax error near unexpected token `in
'/configure: line 25: ` case `(set -o) 2>/dev/null` in

The error apparently refers to:

# Be more Bourne compatible
DUALCASE=1; export DUALCASE # for MKS sh
if test -n "${ZSH_VERSION+set}" && (emulate sh) >/dev/null 2>&1; then
emulate sh
# Pre-4.2 versions of Zsh do word splitting on ${1+"$@"}, which
# is contrary to our usage. Disable this feature.
alias -g '${1+"$@"}'='"$@"'
case `(set -o) 2>/dev/null` in
*posix*) set -o posix ;;

My knowledge is very limited, so I'll appreciate some help here!!

Thanks again.

bredsj's picture

After entering the command:

./configure --prefix=/usr/local CC=icc CXX=icpc F77=ifort FC=ifort

I get the following response:

bash: ./configure: /bin/sh^M: bad interpreter: No such file or directory

Is there anything specific that I do wrong?

I run Ubuntu 10.10 x64

I'll appreciate some help!

Thanks in advance

anonymous's picture

I couldn't use MPI properly without this post.

Thank you so much!

anonymous's picture


anonymous's picture

This posting was very clear and understandable, thx!

Elizabeth S (Intel)'s picture

Hi Mallikarjuna,

Please post this question in the user forums,, for the compiler product you are using. The community will be glad to help you with this request.


anonymous's picture

i would like to use open mpi to execute my programs parallaly and i want to checkpoint the applications
please help me in this regard

with regards

Add a Comment

Have a technical question? Visit our forums. Have site or software product issues? Contact support.