[petsc-users] Reducing cost of MatSetValues

John Fettig john.fettig at gmail.com
Wed Jun 1 15:43:28 CDT 2011

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.

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


More information about the petsc-users mailing list