-
Notifications
You must be signed in to change notification settings - Fork 110
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
Use VectorOfArray
in wrap_array
for DGMulti
solvers
#2150
base: main
Are you sure you want to change the base?
Conversation
Review checklistThis checklist is meant to assist creators of PRs (to let them know what reviewers will typically look for) and reviewers (to guide them in a structured review process). Items do not need to be checked explicitly for a PR to be eligible for merging. Purpose and scope
Code quality
Documentation
Testing
Performance
Verification
Created with ❤️ by the Trixi.jl community. |
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #2150 +/- ##
==========================================
- Coverage 96.36% 95.44% -0.92%
==========================================
Files 480 480
Lines 38028 38025 -3
==========================================
- Hits 36645 36292 -353
- Misses 1383 1733 +350
Flags with carried forward coverage won't be shown. Click here to find out more. ☔ View full report in Codecov by Sentry. |
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
@DanielDoehring if I remember correctly, you implemented I am running into some elixir_euler_weakform.jl (SBP, EC): Test Failed at /home/runner/work/Trixi.jl/Trixi.jl/test/test_threaded.jl:388
Expression: #= /home/runner/work/Trixi.jl/Trixi.jl/test/test_threaded.jl:388 =# @allocated(Trixi.rhs!(du_ode, u_ode, semi, t)) < 5000
Evaluated: 118704 < 5000 However, at least locally, this appears to only happen the first time Did you run into this issue before? |
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Update test/test_dgmulti_2d.jl Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com> Apply suggestions from code review Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…ework/Trixi.jl into jc/wrap_VectorOfArray
Hm, I have not encountered this. Can you maybe track down the allocations using the |
There doesn't seem to be a type instability. There's a weird GC call stack that |
Oh wow, that sounds strange. So the allocations are only present in the test "environment"? |
Not exactly - on my machine, the allocations disappear after running Here's the output from |
https://github.com/JuliaLang/julia/blob/3318941e585db632423366b8b703ea55a6ba8421/base/timing.jl#L479-L489 |
The text file only shows half of the information on each line. Could you provide it in a different way? |
I checked
Thanks - how is this? |
Same issue - how about telling me how to reproduce it? Use your latest commit and then run |
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
…ework/Trixi.jl into jc/wrap_VectorOfArray
Co-authored-by: github-actions[bot] <41898282+github-actions[bot]@users.noreply.github.com>
src/auxiliary/precompile.jl
Outdated
# @assert Base.precompile(Tuple{DiscreteCallback{typeof(Trixi.summary_callback), | ||
# typeof(Trixi.summary_callback), | ||
# typeof(Trixi.initialize_summary_callback), | ||
# typeof(SciMLBase.FINALIZE_DEFAULT)}}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Will the CI fail if you uncomment these lines?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Tried in fdf1ff5; lets see
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks
One thing that might be wired for me is that I tried the allocation profiling (use your MWE) for both main branch and this PR - but found that the memory allocation bytes are similar Total bytes: 199336 - from main Can you confirm this on your side @jlchan (no rush)? Or is there anything we're doing wrong... |
Thanks for checking; I can confirm tomorrow. If you run |
@huiyuxie I see something very weird. If I print out However, for the passing elixir I see EDIT: aha, it is the time-stepper. If I use |
But if you said that |
No, I think it's a weird subtlety with how OrdinaryDiffEq.jl initializes the using Trixi, OrdinaryDiffEq
dg = DGMulti(polydeg = 3, element_type = Line(),
surface_integral = SurfaceIntegralWeakForm(FluxLaxFriedrichs()),
volume_integral = VolumeIntegralWeakForm())
equations = CompressibleEulerEquations1D(1.4)
initial_condition = initial_condition_constant
mesh = DGMultiMesh(dg, (2, ), periodicity = true)
semi = SemidiscretizationHyperbolic(mesh, equations, initial_condition, dg)
ode = semidiscretize(semi, (0.0, .01))
integrator = init(ode, CarpenterKennedy2N54(williamson_condition = false), dt = 0.01) # works
integrator = init(ode, Tsit5()) # works
integrator = init(ode, RDPK3SpFSAL49()) # works
integrator = init(ode, SSPRK43(), dt = 0.01) # works
integrator = init(ode, SSPRK43()) # fails?!? The error for the last line isn't very helpful, but if I run @ranocha - you know the |
Which versions of the packages are you using? julia> using Pkg; Pkg.activate(temp = true); Pkg.add(["OrdinaryDiffEq", "StaticArrays", "StructArrays"])
[...]
⌃ [1dea7af3] + OrdinaryDiffEq v6.89.0
[90137ffa] + StaticArrays v1.9.8
⌃ [09ab397b] + StructArrays v0.6.18
[...]
julia> using OrdinaryDiffEq, StructArrays, StaticArrays
julia> u = StructArray([SVector(1.0, 1.0), SVector(2.0, 2.0)])
2-element StructArray(::Vector{Float64}, ::Vector{Float64}) with eltype SVector{2, Float64}:
[1.0, 1.0]
[2.0, 2.0]
julia> ode = ODEProblem(u, (0.0, 1.0)) do du, u, p, t
@show typeof(du)
du .= u
return nothing
end
julia> solve(ode, Tsit5())
typeof(du) = StructVector{SVector{2, Float64}, Tuple{Vector{Float64}, Vector{Float64}}, Int64}
typeof(du) = StructVector{SVector{2, Float64}, Tuple{Vector{Float64}, Vector{Float64}}, Int64}
typeof(du) = StructVector{SVector{2, Float64}, Tuple{Vector{Float64}, Vector{Float64}}, Int64}
[...]
julia> solve(ode, SSPRK43())
typeof(du) = StructVector{SVector{2, Float64}, Tuple{Vector{Float64}, Vector{Float64}}, Int64}
typeof(du) = StructVector{SVector{2, Float64}, Tuple{Vector{Float64}, Vector{Float64}}, Int64}
typeof(du) = StructVector{SVector{2, Float64}, Tuple{Vector{Float64}, Vector{Float64}}, Int64}
[...] I can't see the difference here that you describe 🤷 |
Odd! I'll check tomorrow (Thursdays are my Trixi PR day). |
@ranocha I misread your MWE; I couldn't reproduce this with a simplified MWE either. It only occurs in Trixi.jl. I'll try to isolate it into a MWE tomorrow. |
@@ -94,7 +94,7 @@ PrecompileTools = "1.1" | |||
Preferences = "1.3" | |||
Printf = "1" | |||
RecipesBase = "1.1" | |||
RecursiveArrayTools = "2.38.10" | |||
RecursiveArrayTools = "3.27.1" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
You are setting this compatibility version so high that SciMLBase
will also adopt a higher version, forcing you to use the new version of the DiscreteCallback
struct.
That's why even if you're using Julia 1.10 but it still failed here https://github.com/trixi-framework/Trixi.jl/actions/runs/11871869411/job/33084910314?pr=2150#step:7:24
Either change this to a lower version or adopt the new DiscreteCallback
struct in precompile.
@huiyuxie FYI this PR goes towards addressing #1789.