Open MPI logo

Open MPI User's Mailing List Archives

  |   Home   |   Support   |   FAQ   |   all Open MPI User's mailing list

From: Thompson, Aidan P. (athomps_at_[hidden])
Date: 2007-09-06 13:46:19

Jeff and Sven,

Thank you for your helpful responses to my grumpy, uninformed, inquiry. I
like option 3 best, because while I currently do not require OMPI's C++
bindings, I might in the future, in which case I would probably spend ours
trying to figure out why I can't find the C++ headers.

I added -DOMPI_SKIP_MPICXX to my LAMMPS Makefile, and it dropped the compile
time by 4x, so it now compiles just as fast as the serial version.

Very nice.


> ------------------------------
> Message: 3
> Date: Thu, 6 Sep 2007 10:56:54 +0200
> From: Sven Stork <stork_at_[hidden]>
> Subject: Re: [OMPI users] Open MPI compiler is slowed down by
> including unnecessary header files
> To: users_at_[hidden]
> Message-ID: <200709061056.55017.stork_at_[hidden]>
> Content-Type: text/plain; charset="iso-8859-1"
> On Thursday 06 September 2007 02:29, Jeff Squyres wrote:
>> Unfortunately, <iostream> is there for a specific reason. The
>> MPI::SEEK_* names are problematic because they clash with the
>> equivalent C constants. With the tricks that we have to play to make
>> those constants [at least mostly] work in the MPI C++ namespace, we
>> *must* include them. The comment in mpicxx.h explains:
>> // We need to include the header files that define SEEK_* or use them
>> // in ways that require them to be #defines so that if the user
>> // includes them later, the double inclusion logic in the headers will
>> // prevent trouble from occuring.
>> // include so that we can smash SEEK_* properly
>> #include <stdio.h>
>> // include because on Linux, there is one place that assumes SEEK_* is
>> // a #define (it's used in an enum).
>> #include <iostream>
>> Additionally, much of the C++ MPI bindings are implemented as inline
>> functions, meaning that, yes, it does add lots of extra code to be
>> compiled. Sadly, that's the price we pay for optimization (the fact
>> that they're inlined allows the cost to be zero -- we used to have a
>> paper on the LAM/MPI web site showing specific performance numbers to
>> back up this claim, but I can't find it anymore :-\ [the OMPI C++
>> bindings were derived from the LAM/MPI C++ bindings]).
>> You have two options for speeding up C++ builds:
>> 1. Disable OMPI's MPI C++ bindings altogether with the --disable-mpi-
>> cxx configure flag. This means that <mpi.h> won't include any of
>> those extra C++ header files at all.
>> 2. If you're not using the MPI-2 C++ bindings for the IO
>> functionality, you can disable the SEEK_* macros (and therefore
>> <stdio.h> and <iostream>) with the --disable-mpi-cxx-seek configure
>> flag.
> maybe this could be a third option:
> 3. just add -DOMPI_SKIP_MPICXX to you compilation flags to skip the inclusion
> of the mpicxx.h.
> -- Sven
>> See "./configure --help" for a full list of configure flags that are
>> available.