[petsc-users] pesc4py setValue of dense matrix segfaults

Miroslav Kuchta mirok at math.uio.no
Mon Mar 9 10:16:02 CDT 2015


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)) 
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




More information about the petsc-users mailing list