comparison benchmark/benchmarks.jl @ 1672:3714a391545a refactor/grids/boundary_identifiers_1d

Make the boundary identifiers for EquidistantGrid subtype BoundaryIdentifer
author Vidar Stiernström <vidar.stiernstrom@gmail.com>
date Sun, 07 Jul 2024 15:15:12 -0700
parents b62770cec7d0
children 471a948cd2b2
comparison
equal deleted inserted replaced
1671:791d0f3f289a 1672:3714a391545a
1 using BenchmarkTools 1 using BenchmarkTools
2 2
3 using Sbplib 3 using Sbplib
4 using Sbplib.Grids 4 using Sbplib.Grids
5 using Sbplib.SbpOperators 5 using Sbplib.SbpOperators
6 using Sbplib.RegionIndices
7 using Sbplib.LazyTensors 6 using Sbplib.LazyTensors
8 7
9 using LinearAlgebra 8 using LinearAlgebra
10 9
11 const SUITE = BenchmarkGroup() 10 const SUITE = BenchmarkGroup()
166 H = inner_product(g2, stencil_set) 165 H = inner_product(g2, stencil_set)
167 H⁻¹ = inverse_inner_product(g2, stencil_set) 166 H⁻¹ = inverse_inner_product(g2, stencil_set)
168 Dxx = second_derivative(g2, stencil_set, 1) 167 Dxx = second_derivative(g2, stencil_set, 1)
169 Dyy = second_derivative(g2, stencil_set, 2) 168 Dyy = second_derivative(g2, stencil_set, 2)
170 169
171 e₁ₗ = boundary_restriction(g2, stencil_set, CartesianBoundary{1,Lower}()) 170 e₁ₗ = boundary_restriction(g2, stencil_set, CartesianBoundary{1,LowerBoundary}())
172 e₁ᵤ = boundary_restriction(g2, stencil_set, CartesianBoundary{1,Upper}()) 171 e₁ᵤ = boundary_restriction(g2, stencil_set, CartesianBoundary{1,UpperBoundary}())
173 e₂ₗ = boundary_restriction(g2, stencil_set, CartesianBoundary{2,Lower}()) 172 e₂ₗ = boundary_restriction(g2, stencil_set, CartesianBoundary{2,LowerBoundary}())
174 e₂ᵤ = boundary_restriction(g2, stencil_set, CartesianBoundary{2,Upper}()) 173 e₂ᵤ = boundary_restriction(g2, stencil_set, CartesianBoundary{2,UpperBoundary}())
175 174
176 d₁ₗ = normal_derivative(g2, stencil_set, CartesianBoundary{1,Lower}()) 175 d₁ₗ = normal_derivative(g2, stencil_set, CartesianBoundary{1,LowerBoundary}())
177 d₁ᵤ = normal_derivative(g2, stencil_set, CartesianBoundary{1,Upper}()) 176 d₁ᵤ = normal_derivative(g2, stencil_set, CartesianBoundary{1,UpperBoundary}())
178 d₂ₗ = normal_derivative(g2, stencil_set, CartesianBoundary{2,Lower}()) 177 d₂ₗ = normal_derivative(g2, stencil_set, CartesianBoundary{2,LowerBoundary}())
179 d₂ᵤ = normal_derivative(g2, stencil_set, CartesianBoundary{2,Upper}()) 178 d₂ᵤ = normal_derivative(g2, stencil_set, CartesianBoundary{2,UpperBoundary}())
180 179
181 H₁ₗ = inner_product(boundary_grid(g2, CartesianBoundary{1,Lower}()), stencil_set) 180 H₁ₗ = inner_product(boundary_grid(g2, CartesianBoundary{1,LowerBoundary}()), stencil_set)
182 H₁ᵤ = inner_product(boundary_grid(g2, CartesianBoundary{1,Upper}()), stencil_set) 181 H₁ᵤ = inner_product(boundary_grid(g2, CartesianBoundary{1,UpperBoundary}()), stencil_set)
183 H₂ₗ = inner_product(boundary_grid(g2, CartesianBoundary{2,Lower}()), stencil_set) 182 H₂ₗ = inner_product(boundary_grid(g2, CartesianBoundary{2,LowerBoundary}()), stencil_set)
184 H₂ᵤ = inner_product(boundary_grid(g2, CartesianBoundary{2,Upper}()), stencil_set) 183 H₂ᵤ = inner_product(boundary_grid(g2, CartesianBoundary{2,UpperBoundary}()), stencil_set)
185 184
186 SUITE["boundary_terms"]["pre_composition"] = @benchmarkable $u2 .= $(H⁻¹∘e₁ₗ'∘H₁ₗ∘d₁ₗ)*$v2 185 SUITE["boundary_terms"]["pre_composition"] = @benchmarkable $u2 .= $(H⁻¹∘e₁ₗ'∘H₁ₗ∘d₁ₗ)*$v2
187 SUITE["boundary_terms"]["composition"] = @benchmarkable $u2 .= ($H⁻¹∘$e₁ₗ'∘$H₁ₗ∘$d₁ₗ)*$v2 186 SUITE["boundary_terms"]["composition"] = @benchmarkable $u2 .= ($H⁻¹∘$e₁ₗ'∘$H₁ₗ∘$d₁ₗ)*$v2
188 SUITE["boundary_terms"]["application"] = @benchmarkable $u2 .= $H⁻¹*$e₁ₗ'*$H₁ₗ* $d₁ₗ*$v2 187 SUITE["boundary_terms"]["application"] = @benchmarkable $u2 .= $H⁻¹*$e₁ₗ'*$H₁ₗ* $d₁ₗ*$v2
189 # An investigation of these allocations can be found in the branch `allocation_test` 188 # An investigation of these allocations can be found in the branch `allocation_test`