trixi-framework / trixi-framework/Trixi.jl
Allocations for `SummaryCallback` with custom integrators
- Dominant language
- Julia
- Stars
- 731
- Forks
- 167
- Avg merge
- 2d 18h
- Merged PRs (30d)
- 25
Description
We observe allocations for the custom integrators, see
https://github.com/trixi-framework/Trixi.jl/blob/2dfde7faf3cc74f066d86148ae6c99ed9e58fa79/test/test_structured_2d.jl#L762-L774
https://github.com/trixi-framework/Trixi.jl/blob/2dfde7faf3cc74f066d86148ae6c99ed9e58fa79/test/test_tree_2d_advection.jl#L204-L215
and in the current PR #1871
https://github.com/trixi-framework/Trixi.jl/pull/1871/files#diff-4e3f4096536ca3da518b2f02b6f9197bc83ed9a7aec477b329951667dc1f830c
I observe that the allocations seem to be caused by the `SummaryCallback`.
For instance, for the example [tree_1d_dgsem/elixir_hypdiff_nonperiodic.jl](https://github.com/trixi-framework/Trixi.jl/blob/main/examples/tree_1d_dgsem/elixir_hypdiff_nonperiodic.jl)
the alloc check
```julia
t = sol.t[end]
u_ode = sol.u[end]
du_ode = similar(u_ode)
@allocated Trixi.rhs!(du_ode, u_ode, semi, t) # 7520
```
gives `7520` (as for the PERK2 test).
If one supplies the callbacks
```julia
callbacks = CallbackSet(#summary_callback,
steady_state_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
```
instead of
```julia
callbacks = CallbackSet(summary_callback,
steady_state_callback,
analysis_callback, alive_callback,
save_solution,
stepsize_callback)
```
one obtains `0`.
Contributor guide
Research direction
Start with the allocation checks in test/test_structured_2d.jl and test/test_tree_2d_advection.jl, then reproduce the example using examples/tree_1d_dgsem/elixir_hypdiff_nonperiodic.jl and compare CallbackSet configurations with and without SummaryCallback. Done means the callback remains enabled without the reported allocations in the Trixi.rhs! check.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- julia
- Domain
- performance
- Issue type
- Bug
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100