-
-
Notifications
You must be signed in to change notification settings - Fork 56
SciMLLogging Integration #647
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: master
Are you sure you want to change the base?
Conversation
|
That's a lot more expensive than I would expect. Might be worth filing a bug. |
c97f8f0 to
dec345e
Compare
fd6bc30 to
33d5caa
Compare
33d5caa to
28c9683
Compare
|
do we have a new profile of this to confirm it's cheap? |
|
Which part? I abandoned the ScopedValues idea because of the performance and am just putting the verbosity inside of the caches for now. I'm working on profiling a couple of examples of the system working right now. |
|
SciMLLogging just needs a couple of changes to make it more type stable (SciML/SciMLLogging.jl#33) but with that when the relevant message toggle is set to Silent no code from SciMLLogging is run. @profview for i in 1:10000000
solve(
int_prob,
ITP(), verbose=NonlinearVerbosity(non_enclosing_interval=SciMLLogging.Silent()))
end
|
e48e777 to
a1b3f79
Compare
|
This is at a point where if I use SciML/LinearSolve.jl#756 all tests pass, and we can pass in a LinearVerbosity to the NonlinearVerbosity, and it will use that LinearVerbosity. I made it so that the Standard preset for NonlinearVerbosity sets LinearVerbosity to Minimal. Also there are a couple of other verbosity settings, all described by the docstring for NonlinearVerbosity. There are a couple of warnings left that are not under a |


Checklist
contributor guidelines, in particular the SciML Style Guide and
COLPRAC.
Additional context
I'm experimenting with using a ScopedValue to hold the NonlinearVerbosity object. There are a couple of reasons for this. Unlike LinearSolve, presently none of the caches have a
verbosefield that can hold the verbosity specifier. We could add these fields, but then only functions that explicitly depend on the cache can use the verbosity settings. Alternatively, we could thread the verbosity through every function that should be able to use it. Currently, many of the utility functions in NonlinearSolve don't explicitly depend on the cache, but do include warning messages, and we need to use the verbosity system in these functions if we want to be able to turn the warnings off while still having them available if needed. It seems unreasonable to have every function that might be used have to have the verbosity or the cache as one of it's arguments.From what I can tell it seems like ScopedValues might be good for this, apparently avoiding some of the performance issues of normal globals. For now I have a global ScopedValue
const nonlinear_verbose = ScopedValue{Union{NonlinearVerbosity{true}, NonlinearVerbosity{false}}}(). Then__initandsolve!are called in the context of the@withmacro, wherenonlinear_verboseis set to the value of theverbosekeyword. This allows any function that's called by__initorsolve!to use the verbosity settings from theverbosekeyword, without having to explicitly depend on either the verbosity object or the nonlinear cache.I think my biggest concern here would be the performance of accessing the ScopedValue with
nonlinear_verbose[], since that will need to be done in any place the@SciMLMessagemacro would be used, which could be in parts of the code that is run very often.I've been doing some profiling and some benchmarking and I do see a slowdown in some cases, but it's hard to tell if it's related to using ScopedValues or if it's other changes related to the verbosity system.
@oscardssmith do you have a sense of whether this is a good idea or not? If there are going to be really obvious performance issues then it's probably not worth it to do this