KSPSetLagNorm — PETSc 3.25.1 documentation

Skip to main content
`Ctrl`+`K`

# KSPSetLagNorm

Lags the residual norm calculation so that it is computed as part of the `MPI_Allreduce()` used for computing the inner products needed for the next iteration.

## Synopsis

    #include "petscksp.h"
    PetscErrorCode KSPSetLagNorm(KSP ksp, PetscBool flg)

Logically Collective

## Input Parameters

- ksp - Krylov solver context

- flg - `PETSC_TRUE` or `PETSC_FALSE`

## Options Database Key

- -ksp_lag_norm - lag the calculated residual norm

## Notes

Currently only works with `KSPIBCGS`.

This can reduce communication costs at the expense of doing one additional iteration because the norm used in the convergence test of `KSPSolve()` is one iteration behind the actual current residual norm (which has not yet been computed due to the lag).

Use `KSPSetNormType`(ksp,`KSP_NORM_NONE`) to never check the norm

If you lag the norm and run with, for example, `-ksp_monitor`, the residual norm reported will be the lagged one.

`KSPSetCheckNormIteration()` is an alternative way of avoiding the expense of computing the residual norm at each iteration.

## See Also

KSP: Linear System Solvers, `KSPSetUp()`, `KSPSolve()`, `KSPDestroy()`, `KSPConvergedSkip()`, `KSPSetNormType()`, `KSPSetCheckNormIteration()`

## Level

advanced

## Location

src/ksp/ksp/interface/itcreate.c

Index of all KSP routines
Table of Contents for all manual pages
Index of all manual pages