Skip to content

Commit 4e4a83e

Browse files
committed
add verbose for iterative solvers
1 parent 12f686a commit 4e4a83e

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

src/iterative_wrappers.jl

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -268,7 +268,7 @@ function SciMLBase.solve!(cache::LinearCache, alg::KrylovJL; kwargs...)
268268
atol = float(cache.abstol)
269269
rtol = float(cache.reltol)
270270
itmax = cache.maxiters
271-
verbose = cache.verbose ? 1 : 0
271+
verbose = cache.verbose
272272

273273
cacheval = if cache.alg isa DefaultLinearSolver
274274
if alg.KrylovAlg === Krylov.gmres!
@@ -284,21 +284,25 @@ function SciMLBase.solve!(cache::LinearCache, alg::KrylovJL; kwargs...)
284284
cache.cacheval
285285
end
286286

287+
krylovJL_verbose = verbosity_to_int(verbose.numerical.KrylovJL_verbosity)
288+
287289
args = (cacheval, cache.A, cache.b)
288-
kwargs = (atol = atol, rtol, itmax, verbose,
290+
kwargs = (atol = atol, rtol, itmax, verbose = krylovJL_verbose,
289291
ldiv = true, history = true, alg.kwargs...)
290292

291293
if cache.cacheval isa Krylov.CgWorkspace
292294
N !== I &&
293-
@warn "$(alg.KrylovAlg) doesn't support right preconditioning."
295+
@SciMLMessage("$(alg.KrylovAlg) doesn't support right preconditioning.",
296+
verbose, :no_right_preconditioning, :performance)
294297
Krylov.krylov_solve!(args...; M, kwargs...)
295298
elseif cache.cacheval isa Krylov.GmresWorkspace
296299
Krylov.krylov_solve!(args...; M, N, restart = alg.gmres_restart > 0, kwargs...)
297300
elseif cache.cacheval isa Krylov.BicgstabWorkspace
298301
Krylov.krylov_solve!(args...; M, N, kwargs...)
299302
elseif cache.cacheval isa Krylov.MinresWorkspace
300303
N !== I &&
301-
@warn "$(alg.KrylovAlg) doesn't support right preconditioning."
304+
@SciMLMessage("$(alg.KrylovAlg) doesn't support right preconditioning.",
305+
verbose, :no_right_preconditioning, :performance)
302306
Krylov.krylov_solve!(args...; M, kwargs...)
303307
else
304308
Krylov.krylov_solve!(args...; kwargs...)

0 commit comments

Comments
 (0)