about Jed's changes to MatGetSubMatrix

Lisandro Dalcin dalcinl at gmail.com
Fri Jun 5 09:02:49 CDT 2009

On Fri, Jun 5, 2009 at 7:18 AM, Jed Brown<jed at 59a2.org> wrote:
> Lisandro Dalcin wrote:
>> On Thu, Jun 4, 2009 at 8:16 PM, Jed Brown <jed at 59a2.org> wrote:
>>> 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?
> Suppose I run with -log_summary and see that most of my memory usage is
> for matrices (typical).  I want to know how many "big" matrices are
> around and I don't expect MAT_REUSE_MATRIX to be allocating memory of
> the same size as the matrices I can see.  So I'd rather see an error
> than confusing space usage, but I could be convinced otherwise
> particularly if you have a use case where it is important/useful.

Your rationale is good enough for me.

> I see two meanings for MAT_REUSE_MATRIX:
> 1. Everything "big" is preallocated, use these data structures.  Total
> memory use will not change much in this call.
> 2. All manner of allocation is okay, but references to the original
> matrix remain valid.
> The distinction is purely a matter of operational semantics.  In HLLs,
> it is natural to only consider denotational semantics (until forced
> otherwise).  I think there is value in having the stronger (1) but I
> understand that this could be surprising from a HLL.  Should MatReuse
> have purely denotational meaning?

Well, I'm not sure. Though I believe PETSc should not be a library for
dummies, were everithing works, even at the cost of horrible
performance. I bet you have the same feeling.

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