comparison benchmark/benchmarks.jl @ 1211:58a7aa15ce68 tooling/benchmarks

Add boundary term benchmarks
author Jonatan Werpers <jonatan@werpers.com>
date Tue, 07 Feb 2023 15:52:57 +0100
parents f095c02081eb
children 37d615522c2f
comparison
equal deleted inserted replaced
1199:f095c02081eb 1211:58a7aa15ce68
1 using BenchmarkTools 1 using BenchmarkTools
2 using Sbplib 2 using Sbplib
3 using Sbplib.Grids 3 using Sbplib.Grids
4 using Sbplib.SbpOperators 4 using Sbplib.SbpOperators
5 using Sbplib.RegionIndices
5 6
6 const SUITE = BenchmarkGroup() 7 const SUITE = BenchmarkGroup()
7 8
8 9
9 sz(d) = ntuple(i->100, d) 10 sz(d) = ntuple(i->100, d)
129 130
130 SUITE["derivatives"]["composition"]["3D"]["zz"] = BenchmarkGroup() 131 SUITE["derivatives"]["composition"]["3D"]["zz"] = BenchmarkGroup()
131 SUITE["derivatives"]["composition"]["3D"]["zz"]["apply,apply"] = @benchmarkable $u3 .= $Dz*($Dz*$v3) 132 SUITE["derivatives"]["composition"]["3D"]["zz"]["apply,apply"] = @benchmarkable $u3 .= $Dz*($Dz*$v3)
132 SUITE["derivatives"]["composition"]["3D"]["zz"]["compose,apply"] = @benchmarkable $u3 .= ($Dz∘$Dz)*$v3 133 SUITE["derivatives"]["composition"]["3D"]["zz"]["compose,apply"] = @benchmarkable $u3 .= ($Dz∘$Dz)*$v3
133 134
135
136 SUITE["boundary_terms"] = BenchmarkGroup()
137
138 H = inner_product(g2, stencil_set)
139 H⁻¹ = inverse_inner_product(g2, stencil_set)
140 Dxx = second_derivative(g2, stencil_set, 1)
141 Dyy = second_derivative(g2, stencil_set, 2)
142
143 e₁ₗ = boundary_restriction(g2, stencil_set, CartesianBoundary{1,Lower}())
144 e₁ᵤ = boundary_restriction(g2, stencil_set, CartesianBoundary{1,Upper}())
145 e₂ₗ = boundary_restriction(g2, stencil_set, CartesianBoundary{2,Lower}())
146 e₂ᵤ = boundary_restriction(g2, stencil_set, CartesianBoundary{2,Upper}())
147
148 d₁ₗ = normal_derivative(g2, stencil_set, CartesianBoundary{1,Lower}())
149 d₁ᵤ = normal_derivative(g2, stencil_set, CartesianBoundary{1,Upper}())
150 d₂ₗ = normal_derivative(g2, stencil_set, CartesianBoundary{2,Lower}())
151 d₂ᵤ = normal_derivative(g2, stencil_set, CartesianBoundary{2,Upper}())
152
153 H₁ₗ = inner_product(boundary_grid(g2, CartesianBoundary{1,Lower}()), stencil_set)
154 H₁ᵤ = inner_product(boundary_grid(g2, CartesianBoundary{1,Upper}()), stencil_set)
155 H₂ₗ = inner_product(boundary_grid(g2, CartesianBoundary{2,Lower}()), stencil_set)
156 H₂ᵤ = inner_product(boundary_grid(g2, CartesianBoundary{2,Upper}()), stencil_set)
157
158 SUITE["boundary_terms"]["pre_composition"] = @benchmarkable $u2 .= $(H⁻¹∘e₁ₗ'∘H₁ₗ∘d₁ₗ)*$v2
159 SUITE["boundary_terms"]["composition"] = @benchmarkable $u2 .= ($H⁻¹∘$e₁ₗ'∘$H₁ₗ∘$d₁ₗ)*$v2
160 SUITE["boundary_terms"]["application"] = @benchmarkable $u2 .= $H⁻¹*$e₁ₗ'*$H₁ₗ* $d₁ₗ*$v2
161 # An investigation of these allocations can be found in the branch `allocation_test`
162
134 #TODO: Reorg with dimension as first level? To reduce operator creation? 163 #TODO: Reorg with dimension as first level? To reduce operator creation?
135 164
136 SUITE 165 SUITE