Skip to content

Conversation

@ChrisRackauckas
Copy link
Member

using OrdinaryDiffEq, DiffEqFlux

function lotka_volterra!(du, u, p, t)
  x, y = u
  α, β, δ, γ = p
  du[1] = dx = α*x - β*x*y
  du[2] = dy = -δ*y + γ*x*y
end

# Initial condition
u0 = [1.0, 1.0]

# Simulation interval and intermediary points
tspan = (0.0, 10.0)
tsteps = 0.0:0.1:10.0

# LV equation parameter. p = [α, β, δ, γ]
p = [1.5, 1.0, 3.0, 1.0]

# Setup the ODE problem, then solve
prob = ODEProblem(lotka_volterra!, u0, tspan, p)
sol = solve(prob, Tsit5())

function loss(p)
  sol = solve(prob, Tsit5(), p=p, saveat = tsteps)
  loss = sum(abs2, sol.-1)
  return loss, sol
end

callback = function (p, l, pred)
  display(l)
  # Tell sciml_train to not halt the optimization. If return true, then
  # optimization stops.
  return false
end


using SnoopCompile
tinf = @snoopi_deep DiffEqFlux.sciml_train(loss, p,
                                            cb = callback,
                                            maxiters = 100)
Before Any Precompile Work:
OrdinaryDiffEq#before_precompile
DiffEqBase#before_precompile
RecursiveFactorization@0.2
TriangularSolve@0.1.2

InferenceTimingNode: 14.156328/83.574437 on Core.Compiler.Timings.ROOT() with 586 direct children

Current:
InferenceTimingNode: 12.960856/73.177001 on Core.Compiler.Timings.ROOT() with 582 direct children

More Broadcast Reductions:
InferenceTimingNode: 12.908784/69.381704 on Core.Compiler.Timings.ROOT() with 599 direct children

but this PR causes:

Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x7ffff2440ee8 -- RtlVirtualUnwind at C:\Windows\SYSTEM32\ntdll.dll (unknown line)
in expression starting at C:\Users\accou\OneDrive\Computer\Desktop\test.jl:252

Need to isolate.

```julia
using OrdinaryDiffEq, DiffEqFlux

function lotka_volterra!(du, u, p, t)
  x, y = u
  α, β, δ, γ = p
  du[1] = dx = α*x - β*x*y
  du[2] = dy = -δ*y + γ*x*y
end

# Initial condition
u0 = [1.0, 1.0]

# Simulation interval and intermediary points
tspan = (0.0, 10.0)
tsteps = 0.0:0.1:10.0

# LV equation parameter. p = [α, β, δ, γ]
p = [1.5, 1.0, 3.0, 1.0]

# Setup the ODE problem, then solve
prob = ODEProblem(lotka_volterra!, u0, tspan, p)
sol = solve(prob, Tsit5())

function loss(p)
  sol = solve(prob, Tsit5(), p=p, saveat = tsteps)
  loss = sum(abs2, sol.-1)
  return loss, sol
end

callback = function (p, l, pred)
  display(l)
  # Tell sciml_train to not halt the optimization. If return true, then
  # optimization stops.
  return false
end


using SnoopCompile
tinf = @snoopi_deep DiffEqFlux.sciml_train(loss, p,
                                            cb = callback,
                                            maxiters = 100)
```

```julia
Before Any Precompile Work:
OrdinaryDiffEq#before_precompile
DiffEqBase#before_precompile
[email protected]
[email protected]

InferenceTimingNode: 14.156328/83.574437 on Core.Compiler.Timings.ROOT() with 586 direct children

Current:
InferenceTimingNode: 12.960856/73.177001 on Core.Compiler.Timings.ROOT() with 582 direct children

More Broadcast Reductions:
InferenceTimingNode: 12.908784/69.381704 on Core.Compiler.Timings.ROOT() with 599 direct children
```

but this PR causes:

Please submit a bug report with steps to reproduce this fault, and any error messages that follow (in their entirety). Thanks.
Exception: EXCEPTION_ACCESS_VIOLATION at 0x7ffff2440ee8 -- RtlVirtualUnwind at C:\Windows\SYSTEM32\ntdll.dll (unknown line)
in expression starting at C:\Users\accou\OneDrive\Computer\Desktop\test.jl:252

Need to isolate.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants