few questions

Satish Balay balay at mcs.anl.gov
Wed Feb 27 14:40:41 CST 2008

Just a note on terminology. The difference between shared & dynamic is
a bit confusing [esp across windows/linux/mac etc..]. I like to use
'shared-libraries' name instead of 'dynamic-libraries', as thats the
primary feature of .so/.dylib/.dll etc.

PETSc configure supports the following options

--with-shared=0/1 --with-dynamic=0/1

The dynamic option refers to the using dlopen() to look for function
in a sharedlibrary [instead of resolving these functions at link-time]

If petsc is built with dynamic usage- then PETSC_USE_DYNAMIC_LIBRARIES
flag is set in petscconf.h. Shared libs can be identified by looking
at the library names.


On Wed, 27 Feb 2008, Aron Ahmadia wrote:

> On Wed, Feb 27, 2008 at 2:11 AM, amjad ali <amjad11 at gmail.com> wrote:
> > Hello all,
> >
> > Please answer the following,
> >
> > 1) What is the difference between static and dynamic versions of petsc?
> >
> Start here: http://en.wikipedia.org/wiki/Library_(computer_science)#Static_libraries
> In PETSc the primary differences end up being the size and link-time.
> Statically-linked executables need all the possible code that they
> could contain in the actual file, so they can be up to several MB in
> size.  Dynamically-linked executables are much leaner for the small
> price of a little extra load time.
> Now if you're talking about Dynamically-Loaded code, that's a bit hairier...
> > 2) How to check that which version (static or dynamic) is installed on a
> > system?
> >
> The fastest way is probably to look in $PETSC_DIR/$PETSC_ARCH/
> If you see .a files, you've got static libraries, if you see .so or
> .dylib files you've got dynamic libraries.
> > 3) Plz comment on if there is any effect of static/dynamic version while
> > using/calling petsc from some external package?
> >
> I'm not sure what you're asking here.  If you mean "Is there a
> difference between calling dynamically compiled PETSc from statically
> compiled PETSc" the answer is no.  There are differences in how you
> compile and link the two version but your actual code would look the
> same.
> Again, if we're talking about dynamically loaded code (using something
> like dl_open), then your code will look different.
> > 4) how to update an already installed petsc version with newerer/latest
> > version of petsc?
> >
> Doing this in place is more trouble than it's worth if you're not
> using a development copy .  I just grab the latest copy of PETSc from
> their webpage, then re-build and re-install.
> ~A

More information about the petsc-users mailing list