[petsc-dev] mat nest is done

Jed Brown jed at 59A2.org
Fri Nov 26 12:29:27 CST 2010

On Fri, Nov 26, 2010 at 01:29, Barry Smith <bsmith at mcs.anl.gov> wrote:

> The easiest fix would be to put MatPreallocated()  at the beginning of
> MatGetSizes() and whatever else doesn't have it.  I don't know if there
> would be any bad side affects to making this change.

The problem is that MatGetSize() is not collective.

Is it really necessary to have preallocation be the same as knowing the
sizes?  What I didn't notice is that, while there is still ops->setsizes,
none of the implementations use it any more.  I thought the idea was that
MatCreate_X would set up the layout if the sizes had been set, otherwise it
would drop its callback into ops->setsizes, and set up the layout when the
user subsequently called MatSetSizes (where this dispatch logic still is).
 I didn't realize/remember that it was actually MatCreate_X that was
registered in the callback.  That of course causes trouble because you
MatSetType(A,MATAIJ) and then calls to MATSeqAIJXXX are ignored.

I know it is some added implementation complexity, but how about calling
MatCreate_X directly in MatSetType, and have an independent ops->setsizes
which will set up the layout?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-dev/attachments/20101126/7bb69014/attachment.html>

More information about the petsc-dev mailing list