Closed nealde closed 6 years ago
The first run includes compilation which is what the time increase is. I think this is hitting a Julia bug similar to https://github.com/JuliaLang/julia/issues/22255 which is due to an inference recursion limit in v0.6 https://github.com/JuliaLang/julia/issues/26092 . Or it may be due to ForwardDiff.jl compilation time issues like https://github.com/JuliaDiff/ForwardDiff.jl/issues/278 .
To check if it's a ForwardDiff thing, try using Rodas4P(autodiff=false)
as the algorithm to instead use numerical differentiation instead of autodifferentiation. If that doesn't help (or maybe even if it does), this might be worth pinging the compiler folks as a real-world example of where compilation time needs some debugging.
Wow, thanks for the super quick response!
Trying it with autodiff=false results in much faster compilation, around 8 seconds, so it definitely seems to be related to that.
I isolated the issue and reported it upstream. Hopefully this gets fixed there.
Hello,
I'm solving some stiff DAEs with a mass-matrix solver in the following code:
and for smaller systems (even a similar system with fewer equations, ~26), compilation takes just a few seconds, around 10 seconds with .01 seconds of execution time. However, for systems which are slightly larger, I get extremely long first-run times relative to subsequent execution times:
519.003612 seconds (664.19 M allocations: 18.791 GiB, 0.98% gc time) 2.769820 seconds (1.96 M allocations: 170.898 MiB, 8.22% gc time)
This doesn't seem like normal behavior. The calculations are all in-place, and the functions are in the attached file. This happens both in Linux and Windows with the following package status:
model.jl can be found below:
Sorry for all the huge code snippets!