Closed xzackli closed 1 year ago
A little follow up:
using Bolt
𝕡 = CosmoParams()
bg = Background(𝕡; x_grid=-20.0:0.01:0.0 nq=15)
𝕣 = Bolt.RECFAST(bg=bg, Yp=𝕡.Y_p, OmegaB=𝕡.Ω_b)
ih = IonizationHistory(𝕣, 𝕡, bg)
# 42.092 μs (245 allocations: 13.47 KiB)
@btime Bolt.RECFAST(bg=bg, Yp=𝕡.Y_p, OmegaB=𝕡.Ω_b)
# 6.547 s (67790063 allocations: 6.93 GiB)
@btime IonizationHistory(𝕣, 𝕡, bg)
and the flamegraph:
It looks like most of the solver time in the ionization ODEs is not actually in the stepping - it is in some dual-related stuff (first big block in the flamegraph). Also, that is a lot of allocations - next step is probably to look at profiler applied to ion_recfast!
.
Yeah, I suspected as much. I actually have a more optimized version prototyped -- I was trying to do the integration the right way using events in OrdinaryDiffEq.jl (gist).
Closing this since you merged the recfaster branch
The RECFAST implementation currently in Bolt should be on the order of milliseconds. What's happening?