dummy in MyKSPConverged

Matthew Knepley knepley at gmail.com
Tue Sep 8 07:11:37 CDT 2009


On Tue, Sep 8, 2009 at 1:55 AM, Klaij, Christiaan <C.Klaij at marin.nl> wrote:

> Matt,
>
> Thanks for your explanation. I guess we are using different compilers (I'm
> using the intel 10.1) which may explain why I get a SEGV and you don't. I
> didn't change anything else in src/ksp/ksp/examples/tutorials/ex2f.F. To
> help me understand, could you please tell me where exactly the dummy is
> passed in?
>

        call KSPSetConvergenceTest(ksp,MyKSPConverged,                  &
     &          PETSC_NULL_OBJECT,PETSC_NULL_FUNCTION,ierr)

The PETSC_NULL_OBJECT is "dummy" in the callback.

   Matt


> Chris
>
> ----------------------------------------------------------------------
>
> Message: 1
> Date: Mon, 7 Sep 2009 07:03:01 -0500
> From: Matthew Knepley <knepley at gmail.com>
> Subject: Re: dummy in MyKSPConverged
> To: PETSc users list <petsc-users at mcs.anl.gov>
> Message-ID:
>         <a9f269830909070503g684e2197yc43a7232aa9b88da at mail.gmail.com>
> Content-Type: text/plain; charset="iso-8859-1"
>
> On Mon, Sep 7, 2009 at 2:01 AM, Klaij, Christiaan <C.Klaij at marin.nl>
> wrote:
>
> > Matt,
> >
> > Thanks for your answer!
> >
> > dummy is defined as a PETSc integer inside MyKSPConverged, so why can't I
> > set it to 0? I know it's not useful because it's just a dummy and nothing
> > happens with it, but setting it shouldn't crash the code, right? Also, if
> > setting it changes the basic definition of PETSC_NULL_OBJECT shouldn't
> you
> > get a SEGV as well, or at least some kind of trouble?
> >
>
> dummy is something *you passed in* earlier in the code, and you passed in
> something that should not change. I
> do not know why you are getting an SEGV (I do not get one), but I do know
> you should not change this for the
> code to function correctly.
>
>  Matt
>
>
> > Chris
> >
> >
> >
> > Message: 5
> > Date: Fri, 4 Sep 2009 10:49:25 -0500
> > From: Matthew Knepley <knepley at gmail.com>
> > Subject: Re: dummy in MyKSPConverged
> > To: PETSc users list <petsc-users at mcs.anl.gov>
> > Message-ID:
> >        <a9f269830909040849t7a8dd52dwc7fa33c6a0d313f7 at mail.gmail.com>
> > Content-Type: text/plain; charset="iso-8859-1"
> >
> > On Fri, Sep 4, 2009 at 10:35 AM, Klaij, Christiaan <C.Klaij at marin.nl>
> > wrote:
> >
> > >   Hello,
> > >
> > > With the new version 3.0.0-p8, if I assign a value to the dummy in
> > > MyKSPConverged at the end of src/ksp/ksp/examples/tutorials/ex2f.F, I
> get
> > a
> > > segmentation fault (this didn't happen with version 2.3.3-p13). Any
> idea
> > > why?
> > >
> >
> > 1) I do not get a SEGV
> >
> > 2) You should not be setting this at all. You pass in PETSC_NULL_OBJECT,
> > which means you are changing the definition of that
> >    basic thing in PETSc. This can produce undefined results.
> >
> >  Matt
> >
> >
> > > $ tail ex2f.F
> > >       else
> > >         flag = 0
> > >       endif
> > >       ierr = 0
> > >       dummy = 0
> > >
> > >       end
> > > $ ./ex2f -my_ksp_convergence
> > > [0]PETSC ERROR:
> > >
> ------------------------------------------------------------------------
> > > [0]PETSC ERROR: Caught signal number 11 SEGV: Segmentation Violation,
> > > probably memory access out of range
> > > [0]PETSC ERROR: Try option -start_in_debugger or
> > -on_error_attach_debugger
> > > [0]PETSC ERROR: or see
> > >
> >
> http://www.mcs.anl.gov/petsc/petsc-as/documentation/troubleshooting.html#Signal[0]PETSC<http://www.mcs.anl.gov/petsc/petsc-as/documentation/troubleshooting.html#Signal%5B0%5DPETSC>
> <
> http://www.mcs.anl.gov/petsc/petsc-as/documentation/troubleshooting.html#Signal%5B0%5DPETSC
> >
> > > ERROR: or try http://valgrind.org on linux or man libgmalloc on Apple
> to
> > > find memory corruption errors
> > > [0]PETSC ERROR: likely location of problem given in stack below
> > > [0]PETSC ERROR: ---------------------  Stack Frames
> > > ------------------------------------
> > > [0]PETSC ERROR: Note: The EXACT line numbers in the stack are not
> > > available,
> > > [0]PETSC ERROR:       INSTEAD the line number of the start of the
> > function
> > > [0]PETSC ERROR:       is given.
> > > [0]PETSC ERROR: [0] GMREScycle line 133 src/ksp/ksp/impls/gmres/gmres.c
> > > [0]PETSC ERROR: [0] KSPSolve_GMRES line 228
> > src/ksp/ksp/impls/gmres/gmres.c
> > > [0]PETSC ERROR: [0] KSPSolve line 308 src/ksp/ksp/interface/itfunc.c
> > > [0]PETSC ERROR: --------------------- Error Message
> > > ------------------------------------
> > > [0]PETSC ERROR: Signal received!
> > > [0]PETSC ERROR:
> > >
> ------------------------------------------------------------------------
> > > [0]PETSC ERROR: Petsc Release Version 3.0.0, Patch 8, Fri Aug 21
> 14:02:12
> > > CDT 2009
> > > [0]PETSC ERROR: See docs/changes/index.html for recent updates.
> > > [0]PETSC ERROR: See docs/faq.html for hints about trouble shooting.
> > > [0]PETSC ERROR: See docs/index.html for manual pages.
> > > [0]PETSC ERROR:
> > >
> ------------------------------------------------------------------------
> >
> > dr. ir. Christiaan Klaij
> > CFD Researcher
> > Research & Development
> > mailto:C.Klaij at marin.nl
> > T +31 317 49 33 44
> >
> > MARIN
> > 2, Haagsteeg, P.O. Box 28, 6700 AA Wageningen, The Netherlands
> > T +31 317 49 39 11, F +31 317 49 32 45, I http://www.marin.nl/
> >
> >
> http://www.marin.nl/web/News/News-items/RD-seminar-on-September-22-few-places-left.htmR&Dseminar on September 22: few places left
> >
> > This e-mail may be confidential, privileged and/or protected by
> copyright.
> > If you are not the intended recipient, you should return it to the sender
> > immediately and delete your copy from your system.
> >
> >
>
>
>


-- 
What most experimenters take for granted before they begin their experiments
is infinitely more interesting than any results to which their experiments
lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20090908/f145f2f1/attachment.htm>


More information about the petsc-users mailing list