Skip to content

Commit 517e18f

Browse files
committed
add docstring for LinearVerbosity, spruce up docs page
1 parent b754d3c commit 517e18f

File tree

2 files changed

+91
-45
lines changed

2 files changed

+91
-45
lines changed

docs/src/basics/common_solver_opts.md

Lines changed: 22 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -29,50 +29,38 @@ solve completely. Error controls only apply to iterative solvers.
2929

3030
## Verbosity Controls
3131

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.
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. To use this system, a keyword argument `verbose` is provided to `solve`.
3333

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-
- SciMLLogging.None() - Suppress all messages
48-
- SciMLLogging.Info() - Show message as log message at info level
49-
- SciMLLogging.Warn() - Show warnings (default for most settings)
50-
- SciMLLogging.Error() - Throw errors instead of warnings
51-
- SciMLLogging.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-
- SciMLLogging.Default() - Use the default settings
56-
- SciMLLogging.All() - Show all possible messages
34+
```@docs
35+
LinearVerbosity
36+
```
5737

5838
### Basic Usage
5939

6040
#### Global Verbosity Control
6141

62-
```julia
42+
```julia
6343
using LinearSolve
6444

6545
# Suppress all messages
6646
verbose = LinearVerbosity(SciMLLogging.None())
6747
prob = LinearProblem(A, b)
6848
sol = solve(prob; verbose=verbose)
6949

70-
# Show all messages
71-
verbose = LinearVerbosity(SciMLLogging.All())
50+
# Show only essential messages (critical errors and fatal issues)
51+
verbose = LinearVerbosity(SciMLLogging.Minimal())
52+
sol = solve(prob; verbose=verbose)
53+
54+
# Use default settings (balanced verbosity for typical usage)
55+
verbose = LinearVerbosity(SciMLLogging.Standard())
56+
sol = solve(prob; verbose=verbose)
57+
58+
# Show comprehensive debugging information
59+
verbose = LinearVerbosity(SciMLLogging.Detailed())
7260
sol = solve(prob; verbose=verbose)
7361

74-
# Use default settings
75-
verbose = LinearVerbosity(SciMLLogging.Default())
62+
# Show all messages (maximum verbosity)
63+
verbose = LinearVerbosity(SciMLLogging.All())
7664
sol = solve(prob; verbose=verbose)
7765
```
7866

@@ -82,7 +70,7 @@ sol = solve(prob; verbose=verbose)
8270
# Customize by category
8371
verbose = LinearVerbosity(
8472
error_control = SciMLLogging.Warn(), # Show warnings for error control related issues
85-
performance = SciMLLogging.None(), # Suppress performance messages
73+
performance = SciMLLogging.Silent(), # Suppress performance messages
8674
numerical = SciMLLogging.Info() # Show all numerical related log messages at info level
8775
)
8876

@@ -95,23 +83,12 @@ The verbosity settings for the toggles are automatically passed to the group obj
9583
```julia
9684
# Set specific message types
9785
verbose = LinearVerbosity(
98-
default_lu_fallback = SciMLLogging.Info(), # Show info when LU fallback is used
99-
KrylovJL_verbosity = SciMLLogging.Warn(), # Show warnings from KrylovJL
100-
no_right_preconditioning = SciMLLogging.None(), # Suppress right preconditioning messages
86+
default_lu_fallback = SciMLLogging.InfoLevel(), # Show info when LU fallback is used
87+
KrylovJL_verbosity = SciMLLogging.WarnLevel(), # Show warnings from KrylovJL
88+
no_right_preconditioning = SciMLLogging.Silent(), # Suppress right preconditioning messages
10189
KrylovKit_verbosity = SciMLLogging.Level(KrylovKit.WARN_LEVEL) # Set KrylovKit verbosity level using KrylovKit's own verbosity levels
10290
)
10391

10492
sol = solve(prob; verbose=verbose)
10593

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)
94+
```

src/verbosity.jl

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,72 @@
1+
"""
2+
LinearVerbosity <: AbstractVerbositySpecifier
3+
4+
Verbosity configuration for LinearSolve.jl solvers, providing fine-grained control over
5+
diagnostic messages, warnings, and errors during linear system solution.
6+
7+
# Fields
8+
9+
## Error Control Group
10+
- `default_lu_fallback`: Messages when falling back to LU factorization from other methods
11+
- `blas_errors`: Critical BLAS errors that stop computation
12+
- `blas_invalid_args`: BLAS errors due to invalid arguments
13+
14+
## Performance Group
15+
- `no_right_preconditioning`: Messages when right preconditioning is not used
16+
17+
## Numerical Group
18+
- `using_IterativeSolvers`: Messages when using the IterativeSolvers.jl package
19+
- `IterativeSolvers_iterations`: Iteration count messages from IterativeSolvers.jl
20+
- `KrylovKit_verbosity`: Verbosity level passed to KrylovKit.jl solvers
21+
- `KrylovJL_verbosity`: Verbosity level passed to Krylov.jl solvers
22+
- `HYPRE_verbosity`: Verbosity level passed to HYPRE solvers
23+
- `pardiso_verbosity`: Verbosity level passed to Pardiso solvers
24+
- `blas_info`: Informational messages from BLAS operations
25+
- `blas_success`: Success messages from BLAS operations
26+
- `condition_number`: Messages related to condition number calculations
27+
- `convergence_failure`: Messages when iterative solvers fail to converge
28+
29+
# Constructors
30+
31+
LinearVerbosity(preset::AbstractVerbosityPreset)
32+
33+
Create a `LinearVerbosity` using a preset configuration:
34+
- `SciMLLogging.None()`: All messages disabled
35+
- `SciMLLogging.Minimal()`: Only critical errors and fatal issues
36+
- `SciMLLogging.Standard()`: Balanced verbosity (default)
37+
- `SciMLLogging.Detailed()`: Comprehensive debugging information
38+
- `SciMLLogging.All()`: Maximum verbosity
39+
40+
LinearVerbosity(; error_control=nothing, performance=nothing, numerical=nothing, kwargs...)
41+
42+
Create a `LinearVerbosity` with group-level or individual field control.
43+
44+
# Examples
45+
46+
```julia
47+
# Use a preset
48+
verbose = LinearVerbosity(SciMLLogging.Standard())
49+
50+
# Set entire groups
51+
verbose = LinearVerbosity(
52+
error_control = SciMLLogging.WarnLevel(),
53+
numerical = SciMLLogging.InfoLevel()
54+
)
55+
56+
# Set individual fields
57+
verbose = LinearVerbosity(
58+
default_lu_fallback = SciMLLogging.InfoLevel(),
59+
KrylovJL_verbosity = SciMLLogging.CustomLevel(1),
60+
blas_errors = SciMLLogging.ErrorLevel()
61+
)
62+
63+
# Mix group and individual settings
64+
verbose = LinearVerbosity(
65+
numerical = SciMLLogging.InfoLevel(), # Set all numerical to InfoLevel
66+
blas_errors = SciMLLogging.ErrorLevel() # Override specific field
67+
)
68+
```
69+
"""
170
LinearSolve.@concrete struct LinearVerbosity <:
271
AbstractVerbositySpecifier
372
# Error control

0 commit comments

Comments
 (0)