[petsc-dev] dynamic loading
Barry Smith
bsmith at mcs.anl.gov
Wed Jul 28 19:33:21 CDT 2010
On Jul 28, 2010, at 6:03 PM, Lisandro Dalcin wrote:
> Could any of you tell me exactly the intention of
> "--with-dynamic-loading" in the context of PETSc?
>
> I tend to think that dynamic loading of user-defined stuff should
> always be supported if dlopen() or equivalent calls are available. For
> example, I'm able to build Python from sources with static libraries,
> but I can still use Python .so extension modules loaded via dlopen().
> So usage of dynamic loading is somewhat orthogonal to static/shared
> libraries.
>
> If PETSc-builtin Vec/Mat/KSP/etc subtypes implementations could be
> built on separate .so files intended to be loaded at runtime,
This is "in theory" possible but requires changes to the "buildsystem" that compiles code and sticks it into libraries.
> then
> --with-dynamic-loading would ask for such kind of build. And then a
> normal build would be just like now (let say, single petsc.so library
> with everything bundled). However, regardless of the way PETSc would
> be built, users should still be able to dlopen() modules and register
> custom subtypes at runtime, even if PETSc was built with static
> libraries!!
We should be able to support this with a small number of changes. Currently the flag PETSC_USE_DYNAMIC_LIBRARIES is used for two purposes:
1) that KSPRegisterDynamic() eliminates the function pointer so PETSc registers the library and string name and not directly the function pointer. Then the functions are accessed via sym()
2) the function registration stuff that keeps the registered function pointers and libraries (if PETSC_USE_DYNAMIC_LIBRARIES is off then managing the library access is turned off.
If we introduce PETSC_HAVE_DLOPEN_OR_WINDOWS_VERSION that we use in the underlying code then I think we will get the effect you want.
Barry
>
>
> --
> Lisandro Dalcin
> ---------------
> CIMEC (INTEC/CONICET-UNL)
> Predio CONICET-Santa Fe
> Colectora RN 168 Km 472, Paraje El Pozo
> Tel: +54-342-4511594 (ext 1011)
> Tel/Fax: +54-342-4511169
More information about the petsc-dev
mailing list