[petsc-dev] circular dependencies SLEPc

Matthew Knepley knepley at gmail.com
Tue Jul 9 08:48:16 CDT 2019


On Tue, Jul 9, 2019 at 8:42 AM Jed Brown <jed at jedbrown.org> wrote:

> Matthew Knepley <knepley at gmail.com> writes:
>
> > On Mon, Jul 8, 2019 at 10:37 PM Jed Brown via petsc-dev <
> > petsc-dev at mcs.anl.gov> wrote:
> >
> >> "Smith, Barry F. via petsc-dev" <petsc-dev at mcs.anl.gov> writes:
> >>
> >> >> On Jul 8, 2019, at 9:53 PM, Jakub Kruzik via petsc-dev <
> >> petsc-dev at mcs.anl.gov> wrote:
> >> >>
> >> >> Just to clarify, the suggested solution is a plug-in sitting anywhere
> >> in the PETSc source tree with postponed compilation and using
> >> __attribute__((constructor)) to register (as in libCEED) for static
> >> libraries?
> >> >
> >> >   Yes, this is my understanding. Good luck.
> >>
> >> There is some nontrivial infrastructure that would be needed for this
> >> model.
> >>
> >> 1. This new component needs to be built into a new library such as
> >>    libpetsc-plugin.a (when static).
> >>
> >> 2. Users need to know when they should link this module.  They'll need a
> >>    link line something like -lpetsc-plugin -lslepc -lpetsc in this case.
> >>    It would need to be specified correctly in makefiles and pkg-config.
> >>
> >> 3. Anything with __attribute__((constructor)) runs *before* main, thus
> >>    before PetscInitialize.  There would need to be a new mechanism to
> >>    register a callback to be run at the end of PetscInitialize.
> >>
> >
> > I think the simpler course it just to declare that this does not work
> > outside of dynamic linking.
> > The number of platforms that do not have dynamic linking is small, and we
> > are not putting
> > anything critical here. This decision can be reevaluated, but for now it
> > makes everything much
> > much simpler.
>
> For the library to be loaded automatically, you would define a runpath,
> perhaps defaulting to
>
>   $(dirname /path/to/lib/libpetsc.so)/petsc/plugins
>
> that would be scanned and each shared library in that directory would be
> PetscDLLibraryOpen'd?
>

Exactly. And its very easy to override with existing options, so no lockin.

   Matt

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

https://www.cse.buffalo.edu/~knepley/ <http://www.cse.buffalo.edu/~knepley/>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20190709/15fe5d97/attachment-0001.html>


More information about the petsc-dev mailing list