[petsc-users] Question on KSPSetReusePreconditioner
Smith, Barry F.
bsmith at mcs.anl.gov
Thu Apr 18 17:51:27 CDT 2019
> On Apr 18, 2019, at 10:44 AM, Yuyun Yang via petsc-users <petsc-users at mcs.anl.gov> wrote:
> Hello team,
> I have a question on when I should be setting KSPSetReusePreconditioner to PETSC_TRUE or PETSC_FALSE. It made a pretty big difference in the solutions I get when I ran my code testing both settings, so is recalculating the preconditioner better since it will make the convergence faster and the solution more accurate?
Reusing the preconditioner should have no significant impact on the accuracy of the solution to the linear system. The answers will be different but that should only be up to the tolerance you provided with -ksp_rtol But after many time-steps the final "answer" to the time dependent problem may be very different with different preconditioning approaches due to accumulation of different round-offs. But if both preconditioner approaches solve the linear system to the same accuracy then neither answer is more correct than the other.
> On the other hand, if the operator is updated every time step (but same nonzero pattern), will reconstructing the pc become time-consuming?
Whether to reuse the preconditioner depends completely on the problem. Reuse means more linear iterations but less setup time (for the preconditioner). So the relative cost of iterations to setup time dictates the optimal use of KSPSetReusePreconditioner() and can only be determined by making some timing runs with different choices and picking the one that seems fastest for your problem.
> Thank you!
More information about the petsc-users