Mercurial > repos > public > sbplib_julia
comparison benchmark/benchmarks.jl @ 1375:127d2558926e feature/variable_derivatives
Add some benchmarks
author | Jonatan Werpers <jonatan@werpers.com> |
---|---|
date | Tue, 30 May 2023 15:55:18 +0200 |
parents | f59228534d3a |
children | 43aaf710463e |
comparison
equal
deleted
inserted
replaced
1374:4f3dd84891f6 | 1375:127d2558926e |
---|---|
1 using BenchmarkTools | 1 using BenchmarkTools |
2 | |
2 using Sbplib | 3 using Sbplib |
3 using Sbplib.Grids | 4 using Sbplib.Grids |
4 using Sbplib.SbpOperators | 5 using Sbplib.SbpOperators |
5 using Sbplib.RegionIndices | 6 using Sbplib.RegionIndices |
6 using Sbplib.LazyTensors | 7 using Sbplib.LazyTensors |
8 | |
9 using LinearAlgebra | |
7 | 10 |
8 const SUITE = BenchmarkGroup() | 11 const SUITE = BenchmarkGroup() |
9 | 12 |
10 | 13 |
11 sz(d) = ntuple(i->100, d) | 14 sz(d) = ntuple(i->100, d) |
65 Dz = second_derivative(g3,stencil_set,3) | 68 Dz = second_derivative(g3,stencil_set,3) |
66 SUITE["derivatives"]["second_derivative"]["3D"] = BenchmarkGroup() | 69 SUITE["derivatives"]["second_derivative"]["3D"] = BenchmarkGroup() |
67 SUITE["derivatives"]["second_derivative"]["3D"]["x"] = @benchmarkable $u3 .= $Dx*$v3 | 70 SUITE["derivatives"]["second_derivative"]["3D"]["x"] = @benchmarkable $u3 .= $Dx*$v3 |
68 SUITE["derivatives"]["second_derivative"]["3D"]["y"] = @benchmarkable $u3 .= $Dy*$v3 | 71 SUITE["derivatives"]["second_derivative"]["3D"]["y"] = @benchmarkable $u3 .= $Dy*$v3 |
69 SUITE["derivatives"]["second_derivative"]["3D"]["z"] = @benchmarkable $u3 .= $Dz*$v3 | 72 SUITE["derivatives"]["second_derivative"]["3D"]["z"] = @benchmarkable $u3 .= $Dz*$v3 |
73 | |
74 | |
75 SUITE["derivatives"]["second_derivative_variable"] = BenchmarkGroup() | |
76 | |
77 c1 = map(x->sin(x)+2, g1) | |
78 D₂ = second_derivative_variable(g1, c1, stencil_set) | |
79 SUITE["derivatives"]["second_derivative_variable"]["1D"] = @benchmarkable $u1 .= $D₂*$v1 | |
80 | |
81 c2 = map(x->sin(x[1] + x[2])+2, g2) | |
82 Dx = second_derivative_variable(g2, c2, stencil_set, 1) | |
83 Dy = second_derivative_variable(g2, c2, stencil_set, 2) | |
84 SUITE["derivatives"]["second_derivative_variable"]["2D"] = BenchmarkGroup() | |
85 SUITE["derivatives"]["second_derivative_variable"]["2D"]["x"] = @benchmarkable $u2 .= $Dx*$v2 | |
86 SUITE["derivatives"]["second_derivative_variable"]["2D"]["y"] = @benchmarkable $u2 .= $Dy*$v2 | |
87 | |
88 c3 = map(x->sin(norm(x))+2, g3) | |
89 Dx = second_derivative_variable(g3, c3, stencil_set, 1) | |
90 Dy = second_derivative_variable(g3, c3, stencil_set, 2) | |
91 Dz = second_derivative_variable(g3, c3, stencil_set, 3) | |
92 SUITE["derivatives"]["second_derivative_variable"]["3D"] = BenchmarkGroup() | |
93 SUITE["derivatives"]["second_derivative_variable"]["3D"]["x"] = @benchmarkable $u3 .= $Dx*$v3 | |
94 SUITE["derivatives"]["second_derivative_variable"]["3D"]["y"] = @benchmarkable $u3 .= $Dy*$v3 | |
95 SUITE["derivatives"]["second_derivative_variable"]["3D"]["z"] = @benchmarkable $u3 .= $Dz*$v3 | |
96 | |
70 | 97 |
71 | 98 |
72 | 99 |
73 SUITE["derivatives"]["addition"] = BenchmarkGroup() | 100 SUITE["derivatives"]["addition"] = BenchmarkGroup() |
74 | 101 |