ginkgo icon indicating copy to clipboard operation
ginkgo copied to clipboard

Enable changing the residual tolerance after a batch solver is created

Open Slaedr opened this issue 2 years ago • 2 comments

This adds an interface to change the residual tolerance for subsequent runs of a solver, so that a new factory does not have to be created just for changing the tolerance. In cases where batch scaling is needed, this removes the need for redoing the setup task of scaling just for changing the tolerance, among potentially other things in the future.

A new, non-templated base class BatchSolver is added. This contains all functionality that is agnostic of the concrete type - preconditioner, generated preconditioner, scaling operators, residual tolerance, maximum iteration count. Thus, the user only needs a pointer to BatchLinOp for applying the solver, and a dynamic cast to BatchSolver to get and set/get solver-agnostic parameters like the residual tolerance.

The factory parameter is now renamed to default_residual_tol, and this is used to initialize the residual_tol_ values of generated solvers. The set_residual_tolerance(double) member function directly sets the residual_tol_ on the solver object.

Drawback:

  • Casts are needed to the corresponding real_types of the solvers. This was done so that the residual tolerance can be updated independent of the concrete batched solver type - the application does not always need to know the concrete type.

Slaedr avatar Jul 22 '22 21:07 Slaedr

format!

Slaedr avatar Sep 08 '22 15:09 Slaedr

Note: This PR changes the Ginkgo ABI:

Functions changes summary: 80 Removed, 60 Changed (1440 filtered out), 520 Added functions
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable

For details check the full ABI diff under Artifacts here

ginkgo-bot avatar Sep 15 '22 04:09 ginkgo-bot

Note: This PR changes the Ginkgo ABI:

Functions changes summary: 80 Removed, 60 Changed (1440 filtered out), 520 Added functions
Variables changes summary: 0 Removed, 0 Changed, 0 Added variable

For details check the full ABI diff under Artifacts here

ginkgo-bot avatar Oct 11 '22 21:10 ginkgo-bot

Kudos, SonarCloud Quality Gate passed!    Quality Gate passed

Bug A 0 Bugs
Vulnerability A 0 Vulnerabilities
Security Hotspot A 0 Security Hotspots
Code Smell A 0 Code Smells

No Coverage information No Coverage information
No Duplication information No Duplication information

sonarqubecloud[bot] avatar Oct 12 '22 09:10 sonarqubecloud[bot]