[petsc-dev] --known-mpi-shared-library and --with-batch annoyance

Matthew Knepley knepley at gmail.com
Thu Apr 21 12:08:51 CDT 2016

On Wed, Apr 20, 2016 at 2:09 PM, Barry Smith <bsmith at mcs.anl.gov> 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

> 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.


>    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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20160421/9b9ee1a7/attachment.html>

More information about the petsc-dev mailing list