[petsc-users] Error message of nnz cannot be greater than block row length from MatSetValues()
Jed Brown
jed at jedbrown.org
Thu Nov 6 18:48:59 CST 2014
Evan Um <evanum at gmail.com> writes:
> Dear Jed,
>
> Thanks for your help many times. These numbers mean the total number of
> elements to be added using MatSetValues(). For example, at process 0,
> 148767+5821 elements are added to matrix B. In other words, the length of
> arrays (i.e. mat_b_i_partitioned, mat_b_j_partitioned and
> mat_b_val_partitioned)
> is 148767+5821. I used "ADD_VALUES" but "INSERT_VALUES" should be the same
> for my work.
>
> As you suggested, I explicitly passed the number of local rows to
> MatSetSizes as shown below. The number of local rows agrees with a range of
> continuous row indices stored at array mat_b_i_partitioned. I also
> explicitly set up the number of local column=the matrix size. In this case,
> I get error message: "Sum of local lengths 156315 does not equal global
> length 52105, my local length 52105". I used 3 processes. I guess
> that number 156315 seems to be related with 3*size of my global column
> size. In my problem, the matrix is partitioned by rows but not by columns.
Column ownership there refers to the distributiov of a vector that your
matrix can be multiplied with, not with the ownership of entries (that
is row-based for all of these formats, though others like MATELEMENTAL
use totally different distributions for the entries). Since you have a
square matrix, you probably want
MatSetSizes(B, partitioned_row_size, partitioned_row_size, ngedges_internal, ngedges_internal);
-------------- 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/20141107/1bed4186/attachment.pgp>
More information about the petsc-users
mailing list