Open MPI logo

Docs Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Docs mailing list

Subject: Re: [OMPI docs] How to compile OpenMPI applications?
From: Jeff Squyres (jsquyres) (jsquyres_at_[hidden])
Date: 2013-08-26 10:05:50

Sorry for the student-brush-off -- you'd be surprised at how many requests for "do my homework for me" we get, both on and off the Open MPI public lists. Plus, this "docs" list is fairly abandoned, and your emails had markings typical of a student looking to get a quick answer. Sorry we mis-categorized it.

A few final notes to this thread:

0. Background: The reason we provide wrapper compilers is because the specific libraries and compile flags that OMPI uses can tend to change depending on how you configure / install Open MPI, and can also change between releases. Hence, we hide all that gunk under the covers and reserve the right to change it from release to release. As such, --showme, or some variant of it (see below), is really your safest bet to remain functional between multiple OMPI releases.

1. You can actually give a full and complete compile/link command line and add --showme to it and see how mpicc will assemble the final command. This may be a little more complete / topical than "mpicc --showme" by itself.

  # Full compile and link
  $ mpicc my_mpi_app.c -o my_mpi_app --showme
  # Just compile
  $ mpicc my_mpi_app.c -c --showme

You'll see the difference in the two outputs.

2. See mpicc(1) for modifiers to the --showme CLI option. I don't remember offhand if these are included in the 1.6 series, but they definitively exist in the 1.7 series. For example:

              Output the compiler flags that would have been supplied to
              the C compiler.

              Output the linker flags that would have been supplied to
              the C compiler.

There's others; see mpicc(1) for details.

3. OMPI also provides a pkg-config .pc file, if that's helpful to you. I don't remember if we introduced that in the 1.6 or 1.7 series, but it's definitely in the 1.7 releases. For example:

$ cd $my_ompi_install_tree
$ find . | fgrep .pc
$ export PKG_CONFIG_PATH=$my_ompi_install_tree/lib/pkgconfig
$ pkg-config ompi-c --cflags
-pthread -I/home/jsquyres/bogus/include -I/home/jsquyres/bogus/include/

4. mpicc and friends actually draw their values from text files. Feel free to read these yourself. While the key=value format is internal to OMPI and may change at any time, it hasn't actually changed in years:

$ find . | fgrep mpicc-wrapper
$ head share/openmpi/mpicc-wrapper-data.txt
# There can be multiple blocks of configuration data, chosen by
# compiler flags (using the compiler_args key to chose which block
# should be activated. This can be useful for multilib builds. See the
# multilib page at:
# for more information.

project=Open MPI

5. The FAQ describes what the wrapper compilers do, and how to override the build options. This isn't exactly what you're asking, but it's related, and might be helpful to you. See for more details. You'll notice, for example, that mpicc (and friends)

Hope that helps.

On Aug 24, 2013, at 4:38 PM, <manday_at_[hidden]> wrote:

> Thank you, that about answers the question as far as my interest is
> concerned.
> On Sat, Aug 24, 2013 at 02:59:11PM -0500, Jed Brown wrote:
>> manday_at_[hidden] writes:
>>> Can we simply conclude that there is no such documentation without
>>> further questioning the question itsself?
>> There is no stand-alone documentation. You can equate 'mpicc -showme'
>> to a less structured pkg-config. Some would say that the MPI standard
>> was negligent in not providing a structured way to determine how to
>> compile and link. (Some would go further and say the binary interface
>> should have been standardized.)
> _______________________________________________
> docs mailing list
> docs_at_[hidden]

Jeff Squyres
For corporate legal information go to: