[petsc-users] pesc4py setValue of dense matrix segfaults

Jed Brown jed at jedbrown.org
Mon Mar 9 10:37:05 CDT 2015


Miroslav Kuchta <mirok at math.uio.no> writes:

> Hi everyone,
>
> I have a problem when setting values of a dense matrix with petsc4py. The minimal example is
>
> import petsc4py 
> petsc4py.init() 
> from petsc4py import PETSc 
>  
> mat = PETSc.Mat() 
> mat.createAIJ(size=(2, 2)) 

Add mat.setUp() here if you are not going to preallocate.  Of course we
should be able to produce a better error message in this case.

> mat.setValue(0, 0, 1)  # Crash here 
> mat.assemble() 
> print mat.getValues([0, 1], [0, 1]) 
>
> This works nicely with version 3.4 but using version 3.5 I get 
>
> [mirok at nefele src]$ python petsc4py_bug.py 
> [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: configure using --with-debugging=yes, recompile, link, and run 
> [0]PETSC ERROR: to get more information on the crash.
> application called MPI_Abort(MPI_COMM_WORLD, 59) - process 0
>
> Can you point out what is going wrong? Thanks for your help.
>
> Regards, Miro
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 818 bytes
Desc: not available
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20150309/0789ee36/attachment.pgp>


More information about the petsc-users mailing list