[petsc-dev] handling any order of MatSetType() and MatSetSizes()

Lisandro Dalcin dalcinl at gmail.com
Thu Jul 1 13:23:51 CDT 2010

On 30 June 2010 22:56, Barry Smith <bsmith at mcs.anl.gov> wrote:
>   Shri has finished work on providing better support for setting the Mat type before setting the sizes. It no longer stores the MatCreate_XXX() pointer in the function table. It actually allocates the basic data structure and table of functions. Mat preallocate then completes the process using the size information provided.
>   If you have any problems with this, please send email to petsc-dev

Despite the latest fix (BTW, DO NOT USE C++ style comments!!!) for
SeqDense, things are still broken... I think that the code
MatSetSizes_SeqDense should be moved to the preallocation routine and
then removed from the _MatOpts table.

[dalcinl at trantor petsc4py-dev]$ cat dense-mat.py
from petsc4py import PETSc
A = PETSc.Mat().create()

[dalcinl at trantor petsc4py-dev]$ python dense-mat.py
[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
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: [0] MatSetValues_SeqDense line 638
[0]PETSC ERROR: [0] MatSetValues line 1110 src/mat/interface/matrix.c
application called MPI_Abort(MPI_COMM_WORLD, 59) - process 0

Lisandro Dalcin
Predio CONICET-Santa Fe
Colectora RN 168 Km 472, Paraje El Pozo
Tel: +54-342-4511594 (ext 1011)
Tel/Fax: +54-342-4511169

More information about the petsc-dev mailing list