about Jed's changes to MatGetSubMatrix

Lisandro Dalcin dalcinl at gmail.com
Thu Jun 4 19:12:24 CDT 2009

On Thu, Jun 4, 2009 at 8:16 PM, Jed Brown <jed at 59a2.org> wrote:
> Lisandro Dalcin wrote:
>> I like a lot the new API, though I would like to comment on the change
>> below and previous behaviour of MatGetSubMatrix() in 3.0.:
>> Author: Jed Brown <jed at 59A2.org>  2009-05-27 15:15:56
>> Committer: Jed Brown <jed at 59A2.org>  2009-05-27 15:15:56
>> Parent: 13687:1da19bea6533 (Update ex19 output for minlambda)
>> Child:  13689:7903ebaee227 (documentation update for the
>> PetscComposedDataGet* routines)
>>     Compose gathered IS to amortize cost of ISAllGather with
>> MatGetSubMatrix (MPIAIJ,MPIBAIJ)
>> It is really required to make the call fail if MAT_REUSE_MATRIX is
>> requested, but the submat is not the same that the original one but
>> anyway have appropriate layout and nonzero pattern?
>> See this bit of Python code, it currently fails, but perhaps it should not?
>> S1 = A.getSubMatrix(isrows,iscols) # uses MAT_INITIAL_MATRIX
>> S2 = S1.duplicate()
>> A.getSubMatrix(isrows,iscols,S2) # uses MAT_REUSE_MATRIX
> Did this really work in the past (in parallel)?  The MPIXAIJ
> implementation uses a sequential matrix to extract values.  It is
> composed with the object under the name "SubMatrix", and errors if that
> doesn't exist, so I'll be very confused if it did.

No, it did not worked. I'm not saying your implementation was
sub-optimal :-) ... Just polling to figure out if it could / is worth
to improve.

> We could create a new one if it doesn't exist, even with
> MAT_REUSE_MATRIX, but that feels wrong to me.

Why do you have such feeling?

> Implementation is
> trivial, but I think it's likely to be confusing and it becomes more
> difficult to give meaningful error messages.  What do you think?

Why do you think it is confusing? As long as the reuse submat has a
proper parallel layout (after a fast look, it seems you do not even
have constraints on nonzero pattern), the call would work.

Lisandro Dalcín
Centro Internacional de Métodos Computacionales en Ingeniería (CIMEC)
Instituto de Desarrollo Tecnológico para la Industria Química (INTEC)
Consejo Nacional de Investigaciones Científicas y Técnicas (CONICET)
PTLC - Güemes 3450, (3000) Santa Fe, Argentina
Tel/Fax: +54-(0)342-451.1594

More information about the petsc-dev mailing list