-
-
Notifications
You must be signed in to change notification settings - Fork 204
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
introduce cache array to make discrete-time state update atomic #2702
base: master
Are you sure you want to change the base?
Conversation
@AayushSabharwal the test failure indicates that the indices used to index into |
src/systems/clock_inference.jl
Outdated
@@ -326,6 +326,7 @@ function generate_discrete_affect( | |||
# @show disc_range | |||
affect! = :(function (integrator, saved_values) | |||
@unpack u, p, t = integrator | |||
cache = p[$disc_range] # Cache needed for atomic state update |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nope this is all in MTK. ParameterIndex
is an index into MTKParameters
. disc_range isa Vector{<:ParameterIndex}
. I didn't notice the error, but we don't have getindex(::MTKParameters, ::Vector{<:ParameterIndex})
defined, so this call is invalid. I'm not sure how it passes locally.
I guess we either need a method for the above, which just broadcasts the getindex
or do it manually here
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What's the difference between these two then? The view version is used in a lot of places
cache = p[$disc_range]
disc_unknowns = view(p, $disc_range)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
That's interesting. I'll look into why view
works, but I suspect it is because view internally just relies on getindex
working for scalar indices.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ah, I see the difference now, I'll push a fix
So |
There are likely additional compiler-related problems, outlined in #2701 |
e7f7127
to
a70c51b
Compare
fix disc args
a70c51b
to
fa9a81e
Compare
One step towards solving #2701
system in issue above now produces the correct answer