[Petsc-trilinos-discussion] Scope and requirements

Jed Brown jedbrown at mcs.anl.gov
Fri Nov 22 17:38:51 CST 2013


"Bartlett, Roscoe A." <bartlettra at ornl.gov> writes:

> This does not sound like dependency inversion and dependency injection
> which work just fine with static libraries or shared libraries.  For
> example, you can you can take a 5 year old pre-built and pre-installed
> version of Trilinos with Stratimikos and a downstream customer code
> (or library, APP, or whatever) can create subclasses of the necessary
> types (i.e. Thyra::LinearOpWtihSolveBase,
> Thyra::LinearOpWithSolveFactoryBase, Thyra::PrecondtionerFactoryBase,
> etc.) and can insert them into a
> Stratimikos::DefaultLinearSolverBuilder object (which is a upper-level
> factory for preconditioners and linear solvers) and then support for
> these automatically shows up along with their parameter lists.  

Similar in PETSc, with every major object from vectors, matrices, and
viewers up to time integrators and adaptive controllers.

Anyone can call PCRegister in PETSc, but _someone_ has to call it.  When
you configure PETSc with ML, PCRegisterAll (a function in PETSc) calls
PCRegister("ml",PCCreate_ML).  If you want to pull this out, someone has
to call it.  Shared libraries and constructors are ways to get that done
without explicit action by the user.

> This is how Teko and MeuLu preconditioners are added to
> Stratimikos::DefaultLinearSolverBuilder objects which are used in
> downstream apps like Derkar, Denovo, Albany, etc.  A grad student
> created a new preconditioner for use in Denovo and added it to the
> Stratimikos::DefaultLinearSolverBuilder object used by Denovo with
> just a few lines of code (just a #include and a call to
> setPreconditioningStrategyFactory()).

Requiring the user to register anything that they are not _implementing_
is a terrible interface.  So if the preconditioner is not _part of_
Denovo, Denovo should not be responsible for including a header and
registering it.  Shared library plugins (dlopen'ed) or constructors in
static libraries can do this registration.  Shared libraries make a
better interface because the user's build system need not be aware of
the plugin.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 835 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-trilinos-discussion/attachments/20131122/355f78ed/attachment.pgp>


More information about the Petsc-trilinos-discussion mailing list