Skip to content
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

Handle Slow Precompilation + Reduce Runtime Dispatches #150

Closed
wants to merge 11 commits into from

Conversation

avik-pal
Copy link
Member

@avik-pal avik-pal commented Dec 18, 2023

Fixes #148

@avik-pal avik-pal force-pushed the ap/patch branch 2 times, most recently from 51a2183 to 872056c Compare December 19, 2023 18:05
Copy link
Contributor

github-actions bot commented Dec 19, 2023

Benchmark Results

master eeddc71... t[master]/t[eeddc71...]
Simple Pendulum/IIP/MultipleShooting(10, Tsit5; grid_coarsening = false) 1.82 ± 0.042 ms 1.83 ± 0.057 ms 0.994
Simple Pendulum/IIP/MultipleShooting(10, Tsit5; grid_coarsening = true) 3.33 ± 0.056 ms 3.4 ± 0.1 ms 0.98
Simple Pendulum/IIP/MultipleShooting(100, Tsit5; grid_coarsening = false) 0.0521 ± 0.0034 s 0.054 ± 0.0043 s 0.964
Simple Pendulum/IIP/MultipleShooting(100, Tsit5; grid_coarsening = true) 1.12 ± 0.0017 s 1.14 ± 0.015 s 0.981
Simple Pendulum/IIP/Shooting(Tsit5()) 0.177 ± 0.0052 ms 0.233 ± 0.0053 ms 0.761
Simple Pendulum/OOP/MultipleShooting(10, Tsit5; grid_coarsening = false) 4.19 ± 0.2 ms 4.44 ± 0.31 ms 0.944
Simple Pendulum/OOP/MultipleShooting(10, Tsit5; grid_coarsening = true) 7.39 ± 4.1 ms 7.87 ± 5.3 ms 0.938
Simple Pendulum/OOP/MultipleShooting(100, Tsit5; grid_coarsening = false) 0.125 ± 0.0014 s 0.145 ± 0.0026 s 0.864
Simple Pendulum/OOP/MultipleShooting(100, Tsit5; grid_coarsening = true) 4.78 ± 0.02 s 4.87 ± 0.003 s 0.98
Simple Pendulum/OOP/Shooting(Tsit5()) 0.701 ± 0.024 ms 0.838 ± 0.055 ms 0.836
time_to_load 8.04 ± 0.034 s 8.08 ± 0.06 s 0.996

Benchmark Plots

A plot of the benchmark results have been uploaded as an artifact to the workflow run for this PR.
Go to "Actions"->"Benchmark a pull request"->[the most recent run]->"Artifacts" (at the bottom).

@avik-pal avik-pal changed the title Fixes invalid bandind Handle Slow Precompilation + Reduce Runtime Dispatches Dec 21, 2023
@avik-pal
Copy link
Member Author

I might end up splitting this PR into multiple smaller ones for easier review but for now I am aggregating all the fixes that need to go in

@avik-pal
Copy link
Member Author

using SnoopCompile, JET
using BoundaryValueDiffEq, LinearAlgebra, LinearSolve, OrdinaryDiffEq, Test

tspan = (0.0, 100.0)
u0 = [0.0, 1.0]

# Inplace
function f1!(du, u, p, t)
    du[1] = u[2]
    du[2] = -u[1]
    return nothing
end

function bc1!(resid, sol, p, t)
    t₀, t₁ = first(t), last(t)
    resid[1] = sol(t₀)[1]
    resid[2] = sol(t₁)[1] - 1
    return nothing
end

bvp1 = BVProblem(BVPFunction{true}(f1!, bc1!), u0, tspan)

sol = solve(bvp1, Shooting(Tsit5()); abstol = 1e-13, reltol = 1e-13,
    odesolve_kwargs = (; abstol = 1e-6, reltol = 1e-3))

tinf = let bvp = bvp1
    solve(bvp, Shooting(Tsit5()); abstol = 1e-13, reltol = 1e-13,
        odesolve_kwargs = (; abstol = 1e-6, reltol = 1e-3))
    @snoopi_deep solve(bvp, Shooting(Tsit5()); abstol = 1e-13, reltol = 1e-13,
        odesolve_kwargs = (; abstol = 1e-6, reltol = 1e-3))
end

# InferenceTimingNode: 0.065630/0.065630 on Core.Compiler.Timings.ROOT() with 0 direct children <-- This PR
# InferenceTimingNode: 0.126995/0.126995 on Core.Compiler.Timings.ROOT() with 0 direct children <-- Current Release

avik-pal added a commit that referenced this pull request Dec 25, 2023
avik-pal added a commit that referenced this pull request Feb 1, 2024
avik-pal added a commit that referenced this pull request Mar 20, 2024
@avik-pal avik-pal closed this Mar 21, 2024
@ChrisRackauckas ChrisRackauckas deleted the ap/patch branch April 23, 2024 19:44
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.

Invalid Bandind error / Manifolds.jl
1 participant