MatGetSubMatrix question

Jed Brown jed at
Wed May 27 13:18:30 CDT 2009

Jed Brown wrote:
> Barry Smith wrote:
>> On May 26, 2009, at 6:30 PM, Lisandro Dalcin wrote:
>>> On Tue, May 26, 2009 at 7:03 PM, Barry Smith <bsmith at> wrote:
>>>>   I think this change may make sense. The switch would be done by
>>>> putting
>>>> the ISAllGather() inside each current implementation. (The current
>>>> implementations are already not scalable, so this will not change that).
>>>>   Anybody want to try this change?
>>> But then you are forcibly introducing a non-scalable ISAllGather() on
>>> every call to MatGetSubMatrix(). No chance to factor-out this
>>> operation if you need to get submatrices many times in the case
>>> nonzero-patterns and submat-indices never changing.
>>    Hmm, we could stash the isallgathered version inside the submatrix
>> and then use a "state" value in the IS passed in to
>> determine if the is was changed and if not simply reuse the stashed
>> isallgathered version.
> It seems to me that with MAT_REUSE_MATRIX, the user is asserting that
> they are the same.  In debug mode (at least) we should confirm that this
> is indeed so, but that's a local operation.  Checking 'state' would be a
> way to skip this check, but I'm not convinced it's a necessary
> optimization.

Okay, I pushed the API change.  PCFieldSplit is working correctly (and
the code is simpler).  In the MPIAIJ and MPIBAIJ implementations, the
gathered IS is composed with the returned matrix so that ISAllGather is
only done the first time.

> While figuring out that precise meaning, I noticed that the min and
> max fields of IS can be removed, they are only used here:

Never mind, that query is important and hard to replace.


-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 260 bytes
Desc: OpenPGP digital signature
URL: <>

More information about the petsc-dev mailing list