1. petsc
  2. PETSc
  3. petsc
  4. Issues
Issue #41 new

Optimize KSPCG to perform only two reductions

Jed Brown
created an issue

KSPCG does three reductions by default, in either PRECONDITIONED or UNPRECONDITIONED norm (though only two in NATURAL norm). The norm could be made to piggy-back on one of the dot products. Before doing this, it may be useful to split the -ksp_cg_single_reduction code path out into a separate function in order to make the code less messy.

Comments (2)

  1. Patrick Sanan

    Some things to consider here (only considering the standard code path, not the "single reduction" option yet):

    1. In the UNPRECONDITIONED case, the use of the third reduction allows the convergence check to occur before the preconditioner application. In the limit of a very expensive (relative to a reduction) preconditioner and a small number of iterations, this might make the existing implementation preferable.
    2. The additional reductions are norms, so any MPI reductions performed are always with real numbers, not (possibly complex) scalars as with the dot product calls. This adds some (probably unimportant) overhead to the "piggybacking" even in the PRECONDITIONED case.
  2. Log in to comment