view benchmarkTest.jl @ 81:7f72e7e14659 patch_based_test

Add benchmarktest and mark all apply functions with @inline and @inbounds
author Vidar Stiernström <vidar.stiernstrom@it.uu.se>
date Thu, 24 Jan 2019 14:58:22 +0100
parents
children 34fd86e9d0b9
line wrap: on
line source

include("sbp.jl")
using BenchmarkTools
using Profile
using ProfileView

function benchmarkTest(m,n)
  g = sbp.Grid.EquidistantGrid((m,n), (0.0, 0.0), (2pi, 3/2*pi))
  op = sbp.readOperator("d2_4th.txt","h_4th.txt")
  Laplace = sbp.Laplace(g, 1.0, op)

  init(x,y) = sin(x) + cos(y)
  v = sbp.Grid.evalOn(g,init)

  u = zeros(eltype(v),length(v))

  sbp.apply!(Laplace,u,v)

  @time sbp.apply!(Laplace,u,v)

  #@benchmark sbp.apply!(Laplace,u,v)
end