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

Precompilation triggered at each include #180

Open
bmxam opened this issue Apr 18, 2024 · 0 comments
Open

Precompilation triggered at each include #180

bmxam opened this issue Apr 18, 2024 · 0 comments

Comments

@bmxam
Copy link

bmxam commented Apr 18, 2024

Hi,

I am trying to use the TwoPointBVPProblem from BoundaryValueDiffEq. I put my code in a file and runs it by including in the REPL. The code runs great but the first call to solve always triggers a (long) "recompilation" time. The next solve calls inside the files are ok. But if I keep the same REPL and include the file again, I always have this first precompilation time. Is there a way to avoid / improve it (apart from solution like PackageCompiler)?

Here is the full code and the timings on my machine. I am using BoundaryValueDiffEq - 5.7.1.

using BoundaryValueDiffEq

function f!(du, u, p, t)
    F0 = u[1]
    F1 = u[2]
    F2 = u[3]

    du .= F1, F2, 2 * F1 * (F2 / (F0 - p.myeps) - 1 / (p.r^2))
end

bc2a!(resid_a, u_a, p) = resid_a[1] = u_a[1]
bc2b!(resid_b, u_b, p) = resid_b .= u_b[1] + 1.0, u_b[2]

tspan = (-1.0, 0.0)
u0 = [-1.0, 0.0, 0.0] # I don't know how to use the init function

myeps = 1e-10
dt = 0.01
p = (r=1.0, myeps=myeps)
bvp = TwoPointBVProblem(f!, (bc2a!, bc2b!), u0, tspan, p; bcresid_prototype=(zeros(1), zeros(2)))
@time sol = solve(bvp, MIRK4(), dt=dt)
@time sol = solve(bvp, MIRK4(), dt=dt)
9.803415 seconds (2.23 M allocations: 153.588 MiB, 0.22% gc time, 99.98% compilation time: 100% of which was recompilation)
0.002087 seconds (13.48 k allocations: 1.517 MiB)
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

No branches or pull requests

1 participant