-
-
Notifications
You must be signed in to change notification settings - Fork 220
fix: allow specifying type of buffers inside MTKParameters
#3585
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
5abdb20
to
b1de305
Compare
src/systems/parameter_buffer.jl
Outdated
t0 = nothing, substitution_limit = 1000, floatT = nothing, | ||
container_type = Vector) | ||
if !(container_type <: AbstractArray) | ||
container_type = Array |
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.
error?
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.
Resolved
b1de305
to
458f944
Compare
Fixes #330. Currently the MWE works: ```julia using DiffEqGPU using OrdinaryDiffEqTsit5, ModelingToolkit, StaticArrays using ModelingToolkit: t_nounits as t, D_nounits as D @parameters σ ρ β @variables x(t) y(t) z(t) eqs = [D(D(x)) ~ σ * (y - x), D(y) ~ x * (ρ - z) - y, D(z) ~ x * y - β * z] @mtkbuild sys = ODESystem(eqs, t) split=false u0 = SA[D(x) => 2f0, x => 1f0, y => 0f0, z => 0f0] p = SA[σ => 28f0, ρ => 10f0, β => 8f0 / 3f0] tspan = (0f0, 100f0) prob = ODEProblem{false}(sys, u0, tspan, p, split=true) prob = remake(prob, p = p = SVector{10, Float32}(prob.p...)) sol = solve(prob, Tsit5()) using SymbolicIndexingInterface p_setter = setp_oop(sys, [σ, ρ, β]) using DiffEqGPU, CUDA function prob_func2(prob, i, repeat) remake(prob, p = p_setter(prob,@svector(rand(Float32,3)))) end monteprob = EnsembleProblem(prob, prob_func = prob_func2, safetycopy = false) sol = solve(monteprob, GPUTsit5(), EnsembleGPUKernel(CUDA.CUDABackend()), trajectories = 10_000) ``` But you need to `#prob = get_updated_symbolic_problem(_get_root_indp(prob), prob; kwargs...)` in DiffEqBase. What's in here drops the `split=false` part. We need to fix `get_updated_symbolic_problem` to not promote to `Float64` and fix static array outputs in `split=true`, i.e. SciML/ModelingToolkit.jl#3585, in order to finish this tutorial.
458f944
to
2361883
Compare
Needs SciML/DiffEqBase.jl#1151 for CI to run |
d8f1e0c
to
97a1618
Compare
1926968
to
604d838
Compare
Zygote error. Love to see those. |
This says Zygote has a problem with https://github.com/SciML/SciMLBase.jl/blob/master/src/initialization.jl#L298 Which is weird because |
Are you sure this PR did this? Looks like something the stuff @DhairyaLGandhi has been working on could do, since it's now a NamedTuple instead of a solution object. |
I don't yet see how this PR could have done it, just assuming it did because this is the first time I'm seeing the failure. |
I guess it is passing here: https://github.com/SciML/ModelingToolkit.jl/actions/runs/14977709554/job/42074112061?pr=3626 |
CI is not loading SciMLSensitivity.jl, right? It is clearly the problem type adjoint in the stacktrace. |
I'm not sure what you mean by "problem type adjoint" |
+(::@NamedTuple{f::Nothing, u0::Nothing, p::@NamedTuple{tunable::Vector{Float64}, initials::Nothing, discrete::Nothing, constant::Nothing, nonnumeric::Nothing, caches::Nothing}, problem_type::Nothing, kwargs::Nothing}, ::Base.RefValue{Any}) The named Tuple has the structure that of an |
Right, but what does the error itself mean? |
It can come from a couple places, but most likely is a buffer for a mutable struct |
It is https://github.com/SciML/ModelingToolkitNeuralNets.jl/blob/main/test/lotka_volterra.jl#L15 Could this be something your SciML/SciMLSensitivity.jl#1196 PR handles? |
No, that is specifically for the adjoint of |
cd63ae5
to
2c0976e
Compare
a71f3ee
to
5189598
Compare
Checklist
contributor guidelines, in particular the SciML Style Guide and
COLPRAC.
Additional context
Add any other context about the problem here.