Some subroutine in PETSc is a little slow

Matthew Knepley knepley at
Sun Sep 21 13:41:18 CDT 2008

It is very likely that you have not preallocated the matrix. There is a section
on this in the manual.


On Sun, Sep 21, 2008 at 1:22 PM, Chen, Changjun <cjchen at> wrote:
> Dear Sir,
>      I have be using PETSc for many days. Recently I find one subroutine in PETSc is a little slow, It is an initialization subroutine to fill in the matrix elements:
>     call MatSetValues(A,ione,II,ione,JJ,v,INSERT_VALUES,ierr)
>      I find that the total time to fill in the matrix data is even much longer than the iteration time to solve the system
>               call KSPSolve(ksp,b,x,ierr)
>      How could this happen?  Could I accelerate the time for filling in the data?
> Sincerely,
> Changjun Chen
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

More information about the petsc-users mailing list