[petsc-users] Error message of nnz cannot be greater than block row length from MatSetValues()

Jed Brown jed at jedbrown.org
Thu Nov 6 14:23:42 CST 2014


Evan Um <evanum at gmail.com> writes:

> Dear PETSC users,
>
> I hope that I can have a comment about errors I got during sparse symmetric
> matrix construction. In this example, I used three processes. The size of a
> test matrix is 52105-by-52105. The length of array d_nnz and o_nnz is 17461
> at rank 0, 17111 at rank 1 and 17535 at rank 2. The two arrays exactly
> describe nnz of the diagonal and off-diagonal part. At rank 0, I tried
> to add 148767 element for the diagonal part and 5821 for the off-diagonal
> part. At rank 1, I tried to add 135826 and 19541 for the diagonal and
> off-diagonal parts, respectively. 

Do these numbers mean that the sum of all the entries in the the arrays
are 148767, 135826, etc?

> At rank 2, I tried to add 138155 and 0 for the diagonal and
> off-diagonal parts. Rank 0 has matrix rows from 0 to 17460; rank 1
> from 17460 to 34570 and rank 2 from 34570 to 52104.  During the run, I
> got an error message: nnz cannot be greater than block row length:
> local row 17124 value 38762560 rowlength 17368. My d_nnz and o_nnz
> arrays never have a value such as 38762560. 

Use MatGetOwnershipRange() and/or pass the local sizes to MatSetSizes.
Your arrays are the wrong length, which is why the error refers to local
row 17124 or rank 1 (which is larger than the array length of 17111).
Valgrind would have told you this.
-------------- 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/20141106/8a18a687/attachment.pgp>


More information about the petsc-users mailing list