Open MPI logo

Open MPI User's Mailing List Archives

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

From: Julian Cummings (cummings_at_[hidden])
Date: 2007-06-13 23:14:51


On Wed, 2007-06-13 at 20:54 -0400, Jeff Squyres wrote:
> On Jun 13, 2007, at 8:47 PM, Julian Cummings wrote:
>
> > I would recommend
> > that the OpenMPI configuration be modified to insert this flag (or
> > some
> > equivalent) as an LCXXFLAGS or even an LDFLAGS component in the
> > compiler
> > driver scripts whenever PGI is used.
>
> We've had debates about this internally. There was pushabck from
> some of the developers that we don't want to handle every single
> compiler bug that's out there (there are many). It can be a never-
> ending battle. This is a big enough compiler bug, however (it spans
> the 6.2 and 7.0 PGI series) that if someone contributes a patch, we
> might be able to make a big enough case to fix it.

Clearly this is debatable, but if you examine the PGI compiler user
guide, I think you will see that this is a "feature" rather than a bug.
It does not flatly state this, but it strongly implies that any code
compiled with -fpic must be linked with -fpic in order to use the right
set of libraries because they are stored in separate directories. This
is done on 64-bit Linux platforms in order to provide a separate memory
model for applications with data areas larger than 2 GB. Since the
OpenMPI library code is built with -fpic, any code that links with it
should link with -fpic under the PGI compiler.

By the way, I did some more testing and discovered that the critical PGI
compiler library is libstd.{so,a}. If your application contains any C++
code compiled with -fpic, then you need to link with libstd.so in the
"libso" directory.

> The functionality
> I'd like to see in such a patch is:
>
> - in the C++ section of configure, try to compile and run a simple C+
> + (non-MPI) program
> - if it works, fine
> - if it doesn't work, try again but link it with -fpic
> - if that works, then add -fpic to the C++ compiler wrapper flags

Such a patch would not detect the problem we are discussing because it
is related to some static objects that are declared and used in the code
for libmpi_cxx.so. I was able to trigger the error by compiling a
simple hello function that uses <iostream> into a shared object,
compiling a main program that calls the function by linking against the
shared object, and then running to run the trivial program. So the test
program would have to take the form of linking against a small C++
library compiled with -fpic in order to catch this.

> All with appropriate comments describing why this check is there (so
> that someone doesn't look at it in 6 months and wonder why the heck
> we're checking for that).
>
> FWIW, you can easily modify the wrapper scripts to automatically put
> this flag in after Open MPI is installed (see http://www.open-mpi.org/
> faq/?category=mpi-apps#override-wrappers-after-v1.0).
>

Thanks, Julian C.