[petsc-users] C++ wrapper for petsc vector

Dave May dave.mayhem23 at gmail.com
Wed Aug 5 03:37:41 CDT 2015


>
> OK, I was not aware of PCShell (I'm new to PETSc). I don't know Trilinos
> well
> enough to judge whether it's good from software engineering point of view
> or
> not, but allow me one last question. What would happen if I wrap all
> 'other'
> solvers in PCShell and then for some reason, PETSc is not available.


This is a fair comment. However, in my experience PETSc builds everywhere.
If PETSc isn't provided as a module on the resource you have access to, it
is relatively
straight forward to built the entire library yourself. The --download-XXX
feature of
PETSc's configure is pretty damn good and also will on most (if not all)
machines.

If configure does fail on your machine of choice, send the configure.log
file to
petsc-maint at mcs.anl.gov. The PETSc guys will sort out the problem.
In 12 years, I haven't found a single machine which I couldn't get petsc
compiled on.

I think you are safe if you wrap everything within PETSc. :D

Cheers
  Dave



> None of
> the other solvers would be accessible (unless I modify the source code), so
> wrapping everything using PCShell creates a strong dependency on one
> particular library (PETSc), doesn't it?
>
> Martin
>
>
> >
> > > Best regards,
> > >
> > >  Martin Vymazal
> > >
> > > On Tuesday, August 04, 2015 12:24:14 PM Matthew Knepley wrote:
> > > > On Tue, Aug 4, 2015 at 12:15 PM, Martin Vymazal <
> > >
> > > martin.vymazal at vki.ac.be>
> > >
> > > > wrote:
> > > > > Hello,
> > > > >
> > > > >  I'm trying to create a small C++ class to wrap the 'Vec' object.
> This
> > > > >
> > > > > class
> > > > > has an internal pointer to a member variable of type Vec, and in
> its
> > > > > destructor, it calls VecDestroy. Unfortunately, my test program
> > >
> > > segfaults
> > >
> > > > > and
> > > > > this seems to be due to the fact that the destructor of the wrapper
> > >
> > > class
> > >
> > > > > is
> > > > > called after main() calls PetscFinalize(). Apparently VecDestroy
> > >
> > > performs
> > >
> > > > > some
> > > > > collective communication, so calling it after PetscFinalize() is
> too
> > >
> > > late.
> > >
> > > > > How
> > > > > can I fix this?
> > > >
> > > > 1) Declare your C++ in a scope, so that it goes out of scope before
> > > > PetscFinalize()
> > > >
> > > > 2) Is there any utility to this wrapper since everything can be
> called
> > > > directly from C++?
> > > >
> > > >   Thanks,
> > > >
> > > >      Matt
> > > > >
> > > > > Thank you,
> > > > >
> > > > >  Martin Vymazal
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150805/21f7df41/attachment.html>


More information about the petsc-users mailing list