Skip to content

start trying to precompile and reduce compile times #471

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

Closed
wants to merge 1 commit into from

Conversation

ChrisRackauckas
Copy link
Member

using OrdinaryDiffEq, DiffEqSensitivity, Zygote

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)
  sum(abs2, sol.-1)
end

using SnoopCompile
tinf = @snoopi_deep Zygote.gradient(loss,p)

Before Any Precompile Work:
OrdinaryDiffEq#before_precompile
DiffEqBase#before_precompile
StochasticDiffEq@6.36
RecursiveFactorization@0.2
TriangularSolve@0.1.2

InferenceTimingNode: 12.563108/55.700412 on Core.Compiler.Timings.ROOT() with 928 direct children

Current:
InferenceTimingNode: 11.626459/45.016643 on Core.Compiler.Timings.ROOT() with 925 direct children

This PR:
InferenceTimingNode: 11.704070/43.656520 on Core.Compiler.Timings.ROOT() with 927 direct children

Currently it's not doing all that much.

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.

1 participant