-
-
Notifications
You must be signed in to change notification settings - Fork 73
Fixed Verbosity System #756
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Conversation
0484d56
to
6dfa0a1
Compare
I rewrote SciMLLogging to get rid of the Moshi.jl dependency, and to make it easier to implement Verbosity "presets". I also rewrote the stuff in LinearVerbosity. This way has fewer dependencies, and is still able to compile out the logging code. Better yet, even if logging is enabled, if the code goes through an With this PR: n = 4
A = rand(n, n)
b1 = rand(n);
b2 = rand(n);
prob = LinearProblem(A, b1)
@b solve(prob, verbose = false)
373.308 ns (12 allocs: 1008 bytes)
@b solve(prob, verbose = true )
364.000 ns (12 allocs: 1008 bytes)
@b solve(prob, verbose = LinearVerbosity())
378.214 ns (13 allocs: 1.000 KiB)
@b solve(prob)
378.121 ns (12 allocs: 1008 bytes)
verb = LinearVerbosity()
@b solve(prob, verbose = verb)
527.854 ns (13 allocs: 960 bytes)
opt = @report_opt solve(prob, LUFactorization(), verbose = LinearVerbosity())
No errors detected
opt = @report_opt solve(prob, LUFactorization(), verbose = LinearVerbosity(Verbosity.None()))
No errors detected
opt = @report_opt solve(prob, LUFactorization(), verbose = false)
No errors detected
cache = init(prob, LUFactorization())
@b solve!(cache)
101.288 ns (1 allocs: 48 bytes)
A = [1.0 0 0 0
0 1 0 0
0 0 1 0
0 0 0 0]
b = rand(4)
prob = LinearProblem(A, b)
verb = LinearVerbosity(default_lu_fallback = Verbosity.Silent())
cache = init(prob, verbose = verb)
@b solve!(cache)
104.880 ns (1 allocs: 48 bytes)
cache = init(prob, verbose=false)
@b solve!(cache)
104.812 ns (1 allocs: 48 bytes) LinearSolve v3.40.1: n = 4
A = rand(n, n)
b1 = rand(n);
b2 = rand(n);
prob = LinearProblem(A, b1)
@b solve(prob, verbose = false)
252.902 ns (11 allocs: 928 bytes)
@b solve(prob, verbose = true )
250.919 ns (11 allocs: 928 bytes)
A = [1.0 0 0 0
0 1 0 0
0 0 1 0
0 0 0 0]
b = rand(4)
prob = LinearProblem(A, b)
cache = init(prob, verbose = false)
104.171 ns (1 allocs: 48 bytes) So the creation of the LinearVerbosity adds a little bit of overhead to |
Checklist
contributor guidelines, in particular the SciML Style Guide and
COLPRAC.
Additional context
With this PR:
From the profile we can see that the constructor for LinearVerbosity doesn't even get called from
__init
, which should indicate that it got compiled out.With current main (Bool verbosity system)