> On Apr 21, 2016, at 12:08 PM, Matthew Knepley <[email protected]> wrote:
> 
> On Wed, Apr 20, 2016 at 2:09 PM, Barry Smith <[email protected]> wrote:
> 
>    When running with --batch one must provide the flag 
> --known-mpi-shared-library this is annoying since no one will know this
> 
>    I am trying to understand the purpose of this flag. It is used in MPI.py 
> in the code
> 
>   def checkSharedLibrary(self):
>     '''Sets flag indicating if MPI libraries are shared or not and
>     determines if MPI libraries CANNOT be used by shared libraries'''
>     self.executeTest(self.configureMPIEXEC)
>     try:
>       self.shared = self.libraries.checkShared('#include 
> <mpi.h>\n','MPI_Init','MPI_Initialized','MPI_Finalize',checkLink = 
> self.checkPackageLink,libraries = self.lib, defaultArg = 
> 'known-mpi-shared-libraries', executor = self.mpiexec)
>     except RuntimeError, e:
>       if self.argDB['with-shared-libraries']:
>         raise RuntimeError('Shared libraries cannot be built using MPI 
> provided.\nEither rebuild with --with-shared-libraries=0 or rebuild MPI with 
> shared library support')
>       self.logPrint('MPI libraries cannot be used with shared libraries')
>       self.shared = 0
>     return
> 
>    It looks to me like the code says that if MPI is not a shared library then 
> you cannot build PETSc with a shared library.
> 
> 1) Is this true? What if MPI was built with PIC but static, won't it still be 
> possible to use it with a PETSc shared library? i.e. is this even the right 
> test?
> 
> PETSc used to have multiple shared libraries, and its still possible. If you 
> link MPI statically into multiple shared libraries,
> you duplicate symbols like isInitialized. This messes up tons of things in 
> MPI.

   Matt,

     We generate (or should if we don't) our shared PETSc libraries by 

       sharedlink   petscsys.so  -lmpi

       sharedlink   petscvec.so -lpetscsys 

       etc.

    If it is done this way then will the problem with duplicate symbols be an 
issue?

     What if we make them with 

       sharedlink   petscsys.so  -lmpi

       sharedlink   petscvec.so -lpetscsys -lmpi

       etc.

   Maybe it is impossible to do the first case since we cannot remove from the 
link libraries "just" the MPI libraries whatever they happen to be?

   Barry


>  
> 2) Is there any way to get rid of this flag or will there be cases were 
> configure goes through with success and accepts using shared libraries but 
> then the build fails with unable to make the PETSc shared library?
> 
> If we allow --single-library=0, I do not see how we can avoid this.

   Could we not require --known-mpi-shared-libraries when --single-library=1 
(which is the usual case most users will see?)

> 
>   Matt
>  
>    Thanks for any input
> 
>   Barry
> 
> 
> 
> 
> 
> 
> -- 
> What most experimenters take for granted before they begin their experiments 
> is infinitely more interesting than any results to which their experiments 
> lead.
> -- Norbert Wiener

Reply via email to