Skip to content

Commit 0ed707e

Browse files
committed
add verbosity documentation
1 parent d9cc537 commit 0ed707e

File tree

1 file changed

+89
-0
lines changed

1 file changed

+89
-0
lines changed

docs/src/basics/common_solver_opts.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,3 +26,92 @@ solve completely. Error controls only apply to iterative solvers.
2626
- `maxiters`: The number of iterations allowed. Defaults to `length(prob.b)`
2727
- `Pl,Pr`: The left and right preconditioners, respectively. For more information,
2828
see [the Preconditioners page](@ref prec).
29+
30+
## Verbosity Controls
31+
32+
The verbosity system in LinearSolve.jl provides fine-grained control over the diagnostic messages, warnings, and errors that are displayed during the solution of linear systems.
33+
34+
The verbosity system is organized hierarchically into three main categories:
35+
36+
1. Error Control - Messages related to fallbacks and error handling
37+
2. Performance - Messages related to performance considerations
38+
3. Numerical - Messages related to numerical solvers and iterations
39+
40+
Each category can be configured independently, and individual settings can be adjusted to suit your needs.
41+
42+
### Verbosity Levels
43+
The following verbosity levels are available:
44+
45+
#### Individual Settings
46+
These settings are meant for individual settings within a category. These can also be used to set all of the individual settings in a group to the same value.
47+
- Verbosity.None() - Suppress all messages
48+
- Verbosity.Info() - Show message as log message at info level
49+
- Verbosity.Warn() - Show warnings (default for most settings)
50+
- Verbosity.Error() - Throw errors instead of warnings
51+
- Verbosity.Level(n) - Show messages with a log level setting of n
52+
53+
#### Group Settings
54+
These settings are meant for controlling a group of settings.
55+
- Verbosity.Default() - Use the default settings
56+
- Verbosity.All() - Show all possible messages
57+
58+
### Basic Usage
59+
60+
#### Global Verbosity Control
61+
62+
```julia
63+
using LinearSolve
64+
65+
# Suppress all messages
66+
verbose = LinearVerbosity(Verbosity.None())
67+
prob = LinearProblem(A, b)
68+
sol = solve(prob; verbose=verbose)
69+
70+
# Show all messages
71+
verbose = LinearVerbosity(Verbosity.All())
72+
sol = solve(prob; verbose=verbose)
73+
74+
# Use default settings
75+
verbose = LinearVerbosity(Verbosity.Default())
76+
sol = solve(prob; verbose=verbose)
77+
```
78+
79+
#### Group Level Control
80+
81+
```julia
82+
# Customize by category
83+
verbose = LinearVerbosity(
84+
error_control = Verbosity.Warn(), # Show warnings for error control related issues
85+
performance = Verbosity.None(), # Suppress performance messages
86+
numerical = Verbosity.Info() # Show all numerical related log messages at info level
87+
)
88+
89+
sol = solve(prob; verbose=verbose)
90+
```
91+
92+
#### Fine-grained Control
93+
The constructor for `LinearVerbosity` allows you to set verbosity for each specific message toggle, giving you fine-grained control.
94+
The verbosity settings for the toggles are automatically passed to the group objects.
95+
```julia
96+
# Set specific message types
97+
verbose = LinearVerbosity(
98+
default_lu_fallback = Verbosity.Info(), # Show info when LU fallback is used
99+
KrylovJL_verbosity = Verbosity.Warn(), # Show warnings from KrylovJL
100+
no_right_preconditioning = Verbosity.None(), # Suppress right preconditioning messages
101+
KrylovKit_verbosity = Verbosity.Level(KrylovKit.WARN_LEVEL) # Set KrylovKit verbosity level using KrylovKit's own verbosity levels
102+
)
103+
104+
sol = solve(prob; verbose=verbose)
105+
106+
```
107+
108+
#### Verbosity Levels
109+
##### Error Control Settings
110+
- default_lu_fallback: Controls messages when falling back to LU factorization (default: Warn)
111+
##### Performance Settings
112+
- no_right_preconditioning: Controls messages when right preconditioning is not used (default: Warn)
113+
##### Numerical Settings
114+
- using_IterativeSolvers: Controls messages when using the IterativeSolvers.jl package (default: Warn)
115+
- IterativeSolvers_iterations: Controls messages about iteration counts from IterativeSolvers.jl (default: Warn)
116+
- KrylovKit_verbosity: Controls messages from the KrylovKit.jl package (default: Warn)
117+
- KrylovJL_verbosity: Controls verbosity of the KrylovJL.jl package (default: None)

0 commit comments

Comments
 (0)