Mercurial > repos > public > sbplib_julia
comparison benchmarkTest.jl @ 86:34fd86e9d0b9 patch_based_test
Change benchmarkTest from function to script since @benchmark does not work within functions
author | Vidar Stiernström <vidar.stiernstrom@it.uu.se> |
---|---|
date | Fri, 25 Jan 2019 10:10:30 +0100 |
parents | 7f72e7e14659 |
children |
comparison
equal
deleted
inserted
replaced
81:7f72e7e14659 | 86:34fd86e9d0b9 |
---|---|
1 include("sbp.jl") | |
2 using BenchmarkTools | 1 using BenchmarkTools |
3 using Profile | 2 using Profile |
4 using ProfileView | 3 using ProfileView |
4 m = 1000; | |
5 n = 450; | |
6 g = sbp.Grid.EquidistantGrid((m,n), (0.0, 0.0), (2pi, 3/2*pi)) | |
7 op = sbp.readOperator("d2_4th.txt","h_4th.txt") | |
8 Laplace = sbp.Laplace(g, 1.0, op) | |
5 | 9 |
6 function benchmarkTest(m,n) | 10 init(x,y) = sin(x) + cos(y) |
7 g = sbp.Grid.EquidistantGrid((m,n), (0.0, 0.0), (2pi, 3/2*pi)) | 11 v = sbp.Grid.evalOn(g,init) |
8 op = sbp.readOperator("d2_4th.txt","h_4th.txt") | |
9 Laplace = sbp.Laplace(g, 1.0, op) | |
10 | 12 |
11 init(x,y) = sin(x) + cos(y) | 13 u = zeros(eltype(v),length(v)) |
12 v = sbp.Grid.evalOn(g,init) | |
13 | 14 |
14 u = zeros(eltype(v),length(v)) | 15 sbp.apply!(Laplace,u,v) |
15 | 16 |
16 sbp.apply!(Laplace,u,v) | 17 #@time sbp.apply!(Laplace,u,v) |
17 | 18 |
18 @time sbp.apply!(Laplace,u,v) | 19 @benchmark sbp.apply!(Laplace,u,v) |
19 | |
20 #@benchmark sbp.apply!(Laplace,u,v) | |
21 end |