Hi Jeff,

On Wed, 2007-06-13 at 14:39 -0400, Jeff Squyres wrote:
> On Jun 13, 2007, at 2:29 PM, Julian Cummings wrote:
> 
> > Thanks, I will give that a try and repost to the list if problems
> > remain.  I am kind of surprised that compiling with -fpic is not  
> > done by
> > default on a Linux system, since OpenMPI builds as a set of shared
> > library .so files.  Normally you want position-independent code in  
> > such
> > libraries so that, among other reasons, static objects are handled
> > properly.
> 
> It's actually more subtle than that.  Open MPI itself is compiled  
> with -fpic if necessary, of course.
> 
> It's *your* code that has to be compiled with -fpic, which is odd /  
> unusual / a bug in pgCC.

Thank you for pointing this out.  I thought that the OpenMPI .so files
must be built with -fpic already.

I did some quick tests with my little hello example that indicate that
the application code only needs to be *linked* with -fpic, not compiled
with it.  The -fpic flag on the mpicxx link line points the linker to a
PGI "libso" subdirectory that contains dynamic versions of the compiler
libraries.  In this case, probably libC.so is most important.  Anyway,
at least you do not have to potentially degrade the performance of the
application code by compiling all of it with -fpic.  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.

Regards, Julian C.

-- 
Dr. Julian C. Cummings                       E-mail: cummi...@cacr.caltech.edu
California Institute of Technology           Phone:  626-395-2543
1200 E. California Blvd., Mail Code 158-79   Fax:    626-584-5917
Pasadena, CA 91125                           Office: 125 Powell-Booth

Reply via email to