PETSc is getting slower in C++?

Barry Smith bsmith at
Tue Sep 1 20:40:22 CDT 2009

   What is the stopping criteria for the KSPSolve? Are you providing a  
nonzero initial guess (and calling KSPSetInitialGuessNonzero()).? Is  
the number of iterations of BiCG increasing with the step? Is the  
matrix changing or remains the same? If it changes are you calling  
KSPSetOperators() with the new matrix?


On Sep 1, 2009, at 6:25 PM, xiaoyin ji wrote:

> Hi,
> I'm embedding a PETSc solver inside a molecular dynamics program. I
> used MATMPIAIJ matrix format and set ksp solver with KSPBICG and
> preconditioer as PCBJACOBI. Now the problem is ksp solver is getting
> slower and slower for each MD step, at the very beginning it takes
> about 1sec, and after 5000 steps the solving part takes up to
> 10sec.(increasing gradually) However, I've also have an identical
> program in Fortran version, which did exactly the same thing and did
> not have such problem for over 1000000 steps, th Fortran version
> always solve within 1sec. The MPI_Wtime() shows that ksp solver is
> exactly the slowing down part. Thanks for any hints.
> Best,
> Xiaoyin Ji
> Department of Material Science and Engineering
> North Carolina State University

More information about the petsc-users mailing list