Skip to content

Commit

Permalink
alloc tests
Browse files Browse the repository at this point in the history
  • Loading branch information
DanielDoehring committed Mar 19, 2024
1 parent 92c2f68 commit 9fcbb04
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 1 deletion.
19 changes: 18 additions & 1 deletion test/test_p4est_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -546,7 +546,15 @@ end
0.09772818519679008,
0.4311796171737692,
], tspan=(0.0, 0.001))

# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
let
t = sol.t[end]
u_ode = sol.u[end]
du_ode = similar(u_ode)
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
end

u_ode = copy(sol.u[end])
du_ode = zero(u_ode) # Just a placeholder in this case

Expand Down Expand Up @@ -578,6 +586,15 @@ end
adapt_initial_condition=false,
adapt_initial_condition_only_refine=false)

# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
let
t = sol.t[end]
u_ode = sol.u[end]
du_ode = similar(u_ode)
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
end

u_ode = copy(sol.u[end])
du_ode = zero(u_ode) # Just a placeholder in this case

Expand Down
8 changes: 8 additions & 0 deletions test/test_parabolic_2d.jl
Original file line number Diff line number Diff line change
Expand Up @@ -702,6 +702,14 @@ end
0.9077214424040279,
5.666071182328691], tspan=(0.0, 0.001),
initial_refinement_level=0)
# Ensure that we do not have excessive memory allocations
# (e.g., from type instabilities)
let
t = sol.t[end]
u_ode = sol.u[end]
du_ode = similar(u_ode)
@test (@allocated Trixi.rhs!(du_ode, u_ode, semi, t)) < 1000
end
end
end

Expand Down

0 comments on commit 9fcbb04

Please sign in to comment.