[petsc-users] segmentation error

Dave May dave.mayhem23 at gmail.com
Sun Jan 25 04:21:26 CST 2015


This type of bizarre unexplainable behaviour usually indicates memory
corruption.
For example: an illegal read of write from an array.
I suggest you run your code through valgrind to rule this out.

Also, I would recommend you modify and annotate your functions to enable
petsc to generate a stack trace when segv's occur, i.e., declare them like
this

#undef __FUNCT__
#define __FUNCT__ "MyFunction"
PetscErrorCode MyFunction(void)
{
    PetscFunctionReturn(0);
}

and call it like this

ierr = MyFunction();CHKERRQ(ierr);

The CHKERRQ() macro will tell you in which of your functions the segv
occurs.
It is an additional useful debugging technique to complement using gdb and
valgrind.
All the error checking macros (CHKERRQ) are compiled out when you configure
petsc with --with-debugging=no so there is no performance loss from adding
the petsc error checking into your code


Cheers
  Dave


On 25 January 2015 at 09:25, siddhesh godbole <siddhesh4godbole at gmail.com>
wrote:

> Hello;
>
> i received the following 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
> [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: --------------------- Error Message
> --------------------------------------------------------------
> [0]PETSC ERROR: Signal received
> [0]PETSC ERROR: See http://www.mcs.anl.gov/petsc/documentation/faq.html
> for trouble shooting.
> [0]PETSC ERROR: Petsc Release Version 3.5.2, Sep, 08, 2014
> [0]PETSC ERROR: ./10D on a arch-linux2-c-debug named iitm by iitm Sun Jan
> 25 13:50:10 2015
> [0]PETSC ERROR: Configure options --download-mpich
> --download-f2cblaslapack=1
> [0]PETSC ERROR: #1 User provided function() line 0 in  unknown file
> application called MPI_Abort(MPI_COMM_WORLD, 59) - process 0
> [unset]: aborting job:
> application called MPI_Abort(MPI_COMM_WORLD, 59) - process 0
>
>
>
> i dont get it, and this happens just by declaring two extra arrays! when i
> delete them code runs just fine!  where arrays are with 10 elements and all
> them are zero.
>
>
> *Siddhesh M Godbole*
>
> 5th year Dual Degree,
> Civil Eng & Applied Mech.
> IIT Madras
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150125/d68e46c6/attachment.html>


More information about the petsc-users mailing list