[petsc-users] Fortran: PetscDSRestoreTabulation + PetscDSGetTabulation
Martin Diehl
martin.diehl at kuleuven.be
Fri Aug 30 02:10:57 CDT 2024
Dear Matt and Barry:
thanks for the quick reply.
Please forget about the segmentation fault, that was a mistake in my
code.
Regarding the necessity of PetscDSRestoreTabulation:
It cleans up "b" and "bDer". Those are defined as "PetscReal, pointer".
If they are defined in a function or subroutine, they go out of scope
automatically. So I believed (backed up by measuring the memory
consumption with and without PetscDSRestoreTabulation) that the
PetscDSRestoreTabulation does not add anything important.
Martin
On Thu, 2024-08-29 at 17:21 -0400, Barry Smith wrote:
>
> The interface definition and Fortran stub look ok to my eyeballs.
> However, eyeballs cannot compile code, so using the debugger to
> determine the cause of the crash is best.
>
> Barry
>
>
>
> > On Aug 29, 2024, at 5:18 PM, Matthew Knepley <knepley at gmail.com>
> > wrote:
> >
> > On Thu, Aug 29, 2024 at 9:57 AM Martin Diehl
> > <martin.diehl at kuleuven.be> wrote:
> > > Dear PETSc team,
> > >
> > > I have a question regarding the use of PetscDSGetTabulation from
> > > Fortran.
> > > PetscDSGetTabulation has a slightly different function signature
> > > between Fortran and C. In addition, there is an (undocumented)
> > > PetscDSRestoreTabulation in Fortran which cleans up the arrays.
> > > Calling
> > > it results in a segmentation fault.
> > >
> > > I believe that PetscDSRestoreTabulation is not needed. At least
> > > our
> > > Fortran FEM code compiles and runs without it. However, we have
> > > convergence issues that we don't understand so any suspicious
> > > code is
> > > currently under investigation.
> > >
> >
> >
> > This may be due to my weak Fortran knowledge. Here is the code
> >
> >
> > https://gitlab.com/petsc/petsc/-/blob/main/src/dm/dt/interface/f90-
> > custom/zdtdsf90.c?ref_type=heads
> >
> > I call F90Array1dCreate() in the GetTabulation and
> > F90Array1dDestroy() in the RestoreTabulation(), which I thought
> > was right. However, I remember something about interface
> > declarations, which have now moved somewhere I cannot find.
> >
> > Barry, is the interface declaration for this function correct?
> >
> > Thanks,
> >
> > Matt
> >
> > > best regards,
> > > Martin
> > >
--
KU Leuven
Department of Computer Science
Department of Materials Engineering
Celestijnenlaan 200a
3001 Leuven, Belgium
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 659 bytes
Desc: This is a digitally signed message part
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20240830/91ba3400/attachment-0001.sig>
More information about the petsc-users
mailing list