Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
trixi-framework
GitHub Repository: trixi-framework/Trixi.jl
Path: blob/main/benchmark/benchmarks.jl
2055 views
1
# Disable formatting this file since it contains highly unusual formatting for better
2
# readability
3
#! format: off
4
5
using Pkg
6
Pkg.activate(@__DIR__)
7
8
using BenchmarkTools
9
using Trixi
10
11
const SUITE = BenchmarkGroup()
12
13
for elixir in [# 1D
14
joinpath(examples_dir(), "structured_1d_dgsem", "elixir_euler_sedov.jl"),
15
joinpath(examples_dir(), "tree_1d_dgsem", "elixir_mhd_ec.jl"),
16
joinpath(examples_dir(), "tree_1d_dgsem", "elixir_navierstokes_convergence_walls_amr.jl"),
17
joinpath(examples_dir(), "tree_1d_dgsem", "elixir_euler_quasi_1d_source_terms_dirichlet.jl"),
18
# 2D
19
joinpath(examples_dir(), "tree_2d_dgsem", "elixir_advection_extended.jl"),
20
joinpath(examples_dir(), "tree_2d_dgsem", "elixir_advection_amr_nonperiodic.jl"),
21
joinpath(examples_dir(), "tree_2d_dgsem", "elixir_euler_ec.jl"),
22
joinpath(examples_dir(), "tree_2d_dgsem", "elixir_euler_vortex_mortar.jl"),
23
joinpath(examples_dir(), "tree_2d_dgsem", "elixir_euler_vortex_mortar_shockcapturing.jl"),
24
joinpath(examples_dir(), "tree_2d_dgsem", "elixir_mhd_ec.jl"),
25
joinpath(examples_dir(), "structured_2d_dgsem", "elixir_advection_extended.jl"),
26
joinpath(examples_dir(), "structured_2d_dgsem", "elixir_advection_nonperiodic.jl"),
27
joinpath(examples_dir(), "structured_2d_dgsem", "elixir_euler_ec.jl"),
28
joinpath(examples_dir(), "structured_2d_dgsem", "elixir_euler_source_terms_nonperiodic.jl"),
29
joinpath(examples_dir(), "structured_2d_dgsem", "elixir_mhd_ec.jl"),
30
joinpath(examples_dir(), "unstructured_2d_dgsem", "elixir_euler_wall_bc.jl"), # this is the only elixir working for polydeg=3
31
joinpath(examples_dir(), "p4est_2d_dgsem", "elixir_advection_extended.jl"),
32
joinpath(@__DIR__, "elixir_2d_euler_vortex_tree.jl"),
33
joinpath(@__DIR__, "elixir_2d_euler_vortex_structured.jl"),
34
joinpath(@__DIR__, "elixir_2d_euler_vortex_unstructured.jl"),
35
joinpath(@__DIR__, "elixir_2d_euler_vortex_p4est.jl"),
36
# 3D
37
joinpath(examples_dir(), "tree_3d_dgsem", "elixir_advection_extended.jl"),
38
joinpath(examples_dir(), "tree_3d_dgsem", "elixir_euler_ec.jl"),
39
joinpath(examples_dir(), "tree_3d_dgsem", "elixir_euler_mortar.jl"),
40
joinpath(examples_dir(), "tree_3d_dgsem", "elixir_euler_shockcapturing.jl"),
41
joinpath(examples_dir(), "tree_3d_dgsem", "elixir_mhd_ec.jl"),
42
joinpath(examples_dir(), "structured_3d_dgsem", "elixir_advection_nonperiodic_curved.jl"),
43
joinpath(examples_dir(), "structured_3d_dgsem", "elixir_euler_ec.jl"),
44
joinpath(examples_dir(), "structured_3d_dgsem", "elixir_euler_source_terms_nonperiodic_curved.jl"),
45
joinpath(examples_dir(), "structured_3d_dgsem", "elixir_mhd_ec.jl"),
46
joinpath(examples_dir(), "p4est_3d_dgsem", "elixir_advection_basic.jl"),]
47
benchname = basename(dirname(elixir)) * "/" * basename(elixir)
48
SUITE[benchname] = BenchmarkGroup()
49
for polydeg in [3, 7]
50
trixi_include(elixir, tspan=(0.0, 1.0e-10); polydeg)
51
SUITE[benchname]["p$(polydeg)_rhs!"] = @benchmarkable Trixi.rhs!(
52
$(similar(sol.u[end])), $(copy(sol.u[end])), $(semi), $(first(tspan)))
53
SUITE[benchname]["p$(polydeg)_analysis"] = @benchmarkable ($analysis_callback)($sol)
54
end
55
end
56
57
let
58
SUITE["latency"] = BenchmarkGroup()
59
SUITE["latency"]["default_example"] = @benchmarkable run(
60
`$(Base.julia_cmd()) --project=$(@__DIR__) -e 'using Trixi; trixi_include(default_example())'`) seconds=60
61
for polydeg in [3, 7]
62
command = "using Trixi; trixi_include(joinpath(examples_dir(), \"tree_2d_dgsem\", \"elixir_advection_extended.jl\"), tspan=(0.0, 1.0e-10), polydeg=$(polydeg), save_restart=TrivialCallback(), save_solution=TrivialCallback())"
63
SUITE["latency"]["polydeg_$polydeg"] = @benchmarkable run(
64
$`$(Base.julia_cmd()) --project=$(@__DIR__) -e $command`) seconds=60
65
end
66
SUITE["latency"]["euler_2d"] = @benchmarkable run(
67
`$(Base.julia_cmd()) --project=$(@__DIR__) -e 'using Trixi; trixi_include(joinpath(examples_dir(), "tree_2d_dgsem", "elixir_euler_kelvin_helmholtz_instability.jl"), tspan=(0.0, 1.0e-10), save_solution=TrivialCallback())'`) seconds=60
68
SUITE["latency"]["mhd_2d"] = @benchmarkable run(
69
`$(Base.julia_cmd()) --project=$(@__DIR__) -e 'using Trixi; trixi_include(joinpath(examples_dir(), "tree_2d_dgsem", "elixir_mhd_blast_wave.jl"), tspan=(0.0, 1.0e-10), save_solution=TrivialCallback())'`) seconds=60
70
end
71
72