Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add benchmarks script #28

Open
wants to merge 2 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
48 changes: 48 additions & 0 deletions benchmark/benchmarks.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
#=
This file defines a benchmark suite with the tools provided by
`PkgBenchmark` and `BenchmarkTools`.

To run the benchmarks, execute:

```julia
julia> using PkgBenchmark
julia> results = benchmarkpkg("Expokit")
```

To compare current version to another tagged version, commit or branch:

```julia
julia> results = judge("Expokit", <tagged-version-or-branch>)
```

To export the benchmark results to a Markdown file:

```julia
julia> export_markdown("results.md", results)
```

To export the benchmark results to a JSON file:

```julia
julia> writeresults("results.json", results)
```
=#
using BenchmarkTools, Expokit

SUITE = BenchmarkGroup() # parent BenchmarkGroup to contain our suite

include("slicot/slicot.jl")

# From BenchmarkTools.jl
# ----------------------
# If a cache of tuned parameters already exists, use it, otherwise, tune and cache
# the benchmark parameters. Reusing cached parameters is faster and more reliable
# than re-tuning `suite` every time the file is included.
paramspath = joinpath(dirname(@__FILE__), "params.json")

if isfile(paramspath)
loadparams!(SUITE, BenchmarkTools.load(paramspath)[1], :evals);
else
tune!(SUITE)
BenchmarkTools.save(paramspath, params(SUITE));
end
19 changes: 19 additions & 0 deletions benchmark/slicot/slicot.jl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
using JLD

S = SUITE["SLICOT"] = BenchmarkGroup(["expmv"])

begin
slicot_models = load("benchmark/slicot/slicot.jld")
for si in keys(slicot_models)
A = slicot_models[si]["A"]
N = eltype(A)
n = size(A, 1)

c = zeros(N, n) # concentrated weight
c[1] = one(N)
S[si, n, "c"] = @benchmarkable expmv(-1e-3, $A, $c)

u = fill(one(N)/sqrt(n), n)
S[si, n, "u"] = @benchmarkable expmv(-1e-3, $A, $u) # uniform weight
end
end
Binary file added benchmark/slicot/slicot.jld
Binary file not shown.