[petsc-users] Error to TaoSolve() call

Khai Hong Pham khaipham at utexas.edu
Mon Aug 11 10:28:12 CDT 2014


Hi Jason,

Thank you for your help. I corrected ,recompiled the code and the error has
gone.

Khai


On Mon, Aug 11, 2014 at 10:17 AM, Jason Sarich <jason.sarich at gmail.com>
wrote:

> Hello Khai
>
> The likely culprit is in petsc/src/vec/vec/utils/projection.c, at the
> end of the VecMedian() there are three calls to VecRestore(), the last
> of which is wrong and needs to be corrected and recompiled:
>
> @@ -852,7 +852,7 @@ PetscErrorCode VecMedian(Vec Vec1, Vec Vec2, Vec
> Vec3, Vec VMedian)
>
>    ierr = VecRestoreArray(Vec1,&v1);CHKERRQ(ierr);
>    ierr = VecRestoreArray(Vec2,&v2);CHKERRQ(ierr);
> -  ierr = VecRestoreArray(Vec3,&v2);CHKERRQ(ierr);
> +  ierr = VecRestoreArray(Vec3,&v3);CHKERRQ(ierr);
>
>    if (VMedian!=Vec1 && VMedian != Vec2 && VMedian != Vec3){
>      ierr = VecRestoreArray(VMedian,&vmed);CHKERRQ(ierr);
>
> Jason Sarich
>
>
> On Mon, Aug 11, 2014 at 9:23 AM, Khai Hong Pham <khaipham at utexas.edu>
> wrote:
> > Hello,
> >
> > I call TaosSolve() in my code. The solution vector is a nested and
> Jacobian
> > matrix is nested too. It shows me the error:
> >
> > [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/documentation/faq.html#valgrind[0]PETSC
> ERROR:
> > or try http://valgrind.org on GNU/linux and Apple Mac OS X to find
> memory
> > corruption errors
> > [1]PETSC ERROR: [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] VecRestoreArray_Nest line 731
> > /home/khp/bin/petsc-3.5.1/src/vec/vec/impls/nest/vecnest.c
> > [0]PETSC ERROR: [0] VecRestoreArray line 1656
> > /home/khp/bin/petsc-3.5.1/src/vec/vec/interface/rvector.c
> > [0]PETSC ERROR: [0] VecMedian line 806
> > /home/khp/bin/petsc-3.5.1/src/vec/vec/utils/projection.c
> > [0]PETSC ERROR: [0] TaoSolve_SSILS line 52
> > /home/khp/bin/petsc-3.5.1/src/tao/complementarity/impls/ssls/ssils.c
> > [0]PETSC ERROR: [0] TaoSolve line 171
> > /home/khp/bin/petsc-3.5.1/src/tao/interface/taosolver.c
> >
> > I debugged with valgrind and received the following message:
> >
> > ==19424== Invalid read of size 8
> > ==19424==    at 0x54089E4: VecRestoreArray_Nest (vecnest.c:746)
> > ==19424==    by 0x53F5F6F: VecRestoreArray (rvector.c:1666)
> > ==19424==    by 0x54BE874: VecMedian (projection.c:855)
> > ==19424==    by 0x6247B74: TaoSolve_SSILS (ssils.c:59)
> > ==19424==    by 0x620739E: TaoSolve (taosolver.c:188)
> > ==19424==    by 0x40491C: main (main.cpp:265)
> > ==19424==  Address 0x0 is not stack'd, malloc'd or (recently) free'd
> >
> > It looks like the bug relates to the nested vector. Could you please
> give me
> > a hint to locate the bug? Thanks.
> >
> > Khai
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20140811/14b5f328/attachment.html>


More information about the petsc-users mailing list