[petsc-users] Doubt in MPIPreallocation

Jed Brown jed at jedbrown.org
Fri Feb 19 08:13:17 CST 2016


John Albequerque <johncfdcfd at gmail.com> writes:

> I am really sorry Matthew but I am not able to get your point. It would be
> very kind of you if you could show me the changes in the code.

MatSetValues sets a logically dense block.  It's not a list of values in
COO format.  So this is setting a (high-low)*nc dense block (which
includes explicit zeros):

  MatSetValues(A,(high-low),idxm,nc,idxn,values,INSERT_VALUES);

You can see those stored zeros here:

>>> *Mat Object: 1 MPI processes  type: mpiaijrow 0: (0, 1)  (1, 1)  (2, 1)
>>> (3, 1)  (4, 0)  (5, 0)  (6, 0)  (7, 0) row 1: (0, 0)  (1, 1)  (2, 1)  (3,
>>> 1)  (4, 1)  (5, 0)  (6, 0)  (7, 0) row 2: (0, 0)  (1, 0)  (2, 1)  (3, 1)
>>> (4, 1)  (5, 1)  (6, 0)  (7, 0) row 3: (0, 0)  (1, 0)  (2, 0)  (3, 1)  (4,
>>> 1)  (5, 1)  (6, 1)  (7, 0) row 4: (0, 0)  (1, 0)  (2, 0)  (3, 0)  (4, 1)
>>> (5, 1)  (6, 1)  (7, 1)*

You need to allocate for all entries that you set explicitly.
-------------- 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/20160219/f5217de8/attachment.pgp>


More information about the petsc-users mailing list