[petsc-users] Reducing cost of MatSetValues

Matthew Knepley knepley at gmail.com
Wed Jun 1 15:53:26 CDT 2011


On Wed, Jun 1, 2011 at 3:43 PM, John Fettig <john.fettig at gmail.com> wrote:

> Hi Matt,
>
> On Wed, Jun 1, 2011 at 4:06 PM, Matthew Knepley <knepley at gmail.com> wrote:
> > It looks like the calls are taking 0.5 microseconds, but there are 89G
> > insertions
> > against only 13K MatMults that take about 1s apiece.
> > This seems like an awful lot of insertions into a matrix that can be
> applied
> > in 1s.
>
> Unless I'm reading it wrong, there are 89M insertions.  This is from
> 10 timesteps with nonlinear iteration on each timestep, with ~1.5M
> elements.  The matrices are reconstructed at virtually every substep.
> I don't quite understand what you mean by "can be applied in 1s",
> doesn't it take ~1ms per call?  Anyways, I agree that this is a poor
> ratio of work to assemble/use of the matrices.
>

Yes, both units were wrong.


> We had thought about constructing the matrix outside of PETSc and then
> passing PETSc pointers to the matrix, but maybe matrix-free would be
> better for some of the equations where jacobi preconditioning is
> sufficient.
>

I think it would be hard to speedup the insertion.

Why are you reassembling? Just for Newton? You could use a lagged version
of the matrix as a preconditioner, and run matrix-free for the matvecs.

   Matt


> Thanks,
> John
>



-- 
What most experimenters take for granted before they begin their experiments
is infinitely more interesting than any results to which their experiments
lead.
-- Norbert Wiener
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.mcs.anl.gov/pipermail/petsc-users/attachments/20110601/260ea9f9/attachment.htm>


More information about the petsc-users mailing list