-
Notifications
You must be signed in to change notification settings - Fork 0
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 benchmark suite #8
Merged
Merged
Changes from all commits
Commits
Show all changes
14 commits
Select commit
Hold shift + click to select a range
67e61f7
update gitignore
bartvanerp 592e907
update gitignore
bartvanerp 1ecb20a
add speed benchmarks
bartvanerp 30f9719
rm ugly tuning file
bartvanerp cf97ec8
extend methods
bartvanerp 40a2460
add benchmarks
bartvanerp bd9656b
update benchmarks
bartvanerp 7e8e9c0
Update fastcholesky_tests.jl
bartvanerp 2868647
Apply suggestions from code review
bartvanerp 319f166
fix first time instantiation
bvdmitri d31923a
fix some broken benchmarks and add more tests
bvdmitri 64ef9bd
create path if run for the first time
bvdmitri 1c08e12
create benchmark groups
bvdmitri df7b7d5
change the definition of fastcholesky for numbers and uniform scaling
bvdmitri File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,2 +1,3 @@ | ||
# See https://domluna.github.io/JuliaFormatter.jl/stable/ for a list of options | ||
style = "blue" | ||
margin = 140 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,10 @@ | ||
*.jl.*.cov | ||
*.jl.cov | ||
*.jl.mem | ||
/Manifest.toml | ||
Manifest.toml | ||
/docs/Manifest.toml | ||
/docs/build/ | ||
|
||
.vscode | ||
benchmark | ||
benchmarks/**/exports |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
SHELL = /bin/bash | ||
.DEFAULT_GOAL = help | ||
|
||
|
||
.PHONY: test | ||
|
||
test: ## Run tests | ||
julia -e 'import Pkg; Pkg.activate("."); Pkg.test();' | ||
|
||
.PHONY: benchmark | ||
|
||
benchmark: ## Run benchmarks | ||
julia -e '\ | ||
import Pkg; \ | ||
Pkg.activate("benchmarks/speed"); \ | ||
Pkg.develop(Pkg.PackageSpec(path=pwd())); \ | ||
Pkg.instantiate(); \ | ||
using PkgBenchmark, FastCholesky, Dates; \ | ||
Base.Filesystem.mkpath("benchmarks/speed/exports/"); \ | ||
results = benchmarkpkg("FastCholesky"; script="benchmarks/speed/benchmarks.jl"); \ | ||
export_markdown("benchmarks/speed/exports/benchmark-"*Dates.format(Dates.now(), "yyyy-mm-ddTHH-MM")*".md", results); \ | ||
Base.Filesystem.rm("benchmark"; force=true, recursive=true)' | ||
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
[deps] | ||
BenchmarkTools = "6e4b80f9-dd63-53aa-95a3-0cdb28fa8baf" | ||
FastCholesky = "2d5283b6-8564-42b6-bb00-83ed8e915756" | ||
LinearAlgebra = "37e2e46d-f89d-539d-b4ee-838fcccc9c8e" | ||
PkgBenchmark = "32113eaa-f34f-5b0d-bd6c-c81e245fc73d" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,74 @@ | ||
using BenchmarkTools, LinearAlgebra | ||
using FastCholesky | ||
|
||
const SUITE = BenchmarkGroup() | ||
const BenchmarkFloatTypes = (Float32, Float64, BigFloat) | ||
|
||
for T in BenchmarkFloatTypes | ||
SUITE[string(T)] = BenchmarkGroup() | ||
SUITE[string(T)]["Number"] = BenchmarkGroup() | ||
SUITE[string(T)]["Matrix"] = BenchmarkGroup() | ||
SUITE[string(T)]["Diagonal"] = BenchmarkGroup() | ||
end | ||
|
||
# general benchmarks | ||
for T in BenchmarkFloatTypes | ||
|
||
# number | ||
a = rand(T) | ||
|
||
SUITE[string(T)]["Number"]["fastcholesky"] = @benchmarkable fastcholesky($a) | ||
SUITE[string(T)]["Number"]["fastcholesky!"] = @benchmarkable fastcholesky!($a) | ||
SUITE[string(T)]["Number"]["cholinv"] = @benchmarkable cholinv($a) | ||
SUITE[string(T)]["Number"]["cholsqrt"] = @benchmarkable cholsqrt($a) | ||
SUITE[string(T)]["Number"]["chollogdet"] = @benchmarkable chollogdet($a) | ||
SUITE[string(T)]["Number"]["cholinv_logdet"] = @benchmarkable cholinv_logdet($a) | ||
|
||
for dim in (2, 5, 10, 20, 50, 100, 200, 500) | ||
|
||
SUITE[string(T)]["Matrix"]["dim:" * string(dim)] = BenchmarkGroup() | ||
|
||
# Skip `BigFloat` benchmarks for large dimensions because they are extremely slow | ||
if (T == BigFloat) && (dim >= 100) | ||
continue | ||
end | ||
|
||
# generate positive-definite matrix of specified dimensions | ||
A = randn(T, dim, dim) | ||
B = A * A' + dim * I(dim) | ||
C = similar(B) | ||
|
||
# The inplace version works only for `Matrix{<:BlasFloat}` | ||
if T <: LinearAlgebra.BlasFloat | ||
SUITE[string(T)]["Matrix"]["dim:" * string(dim)]["fastcholesky!"] = @benchmarkable fastcholesky!($C) | ||
end | ||
|
||
# `sqrt` does not work for `BigFloat` inputs | ||
if T != BigFloat | ||
SUITE[string(T)]["Matrix"]["dim:" * string(dim)]["cholsqrt"] = @benchmarkable cholsqrt($B) | ||
end | ||
|
||
# define benchmarks | ||
SUITE[string(T)]["Matrix"]["dim:" * string(dim)]["fastcholesky"] = @benchmarkable fastcholesky($B) | ||
SUITE[string(T)]["Matrix"]["dim:" * string(dim)]["cholinv"] = @benchmarkable cholinv($B) | ||
SUITE[string(T)]["Matrix"]["dim:" * string(dim)]["chollogdet"] = @benchmarkable chollogdet($B) | ||
SUITE[string(T)]["Matrix"]["dim:" * string(dim)]["cholinv_logdet"] = @benchmarkable cholinv_logdet($B) | ||
|
||
SUITE[string(T)]["Diagonal"]["dim:" * string(dim)] = BenchmarkGroup() | ||
|
||
# Diagonal{T} benchmarks | ||
SUITE[string(T)]["Diagonal"]["dim:" * string(dim)]["fastcholesky"]= @benchmarkable fastcholesky($(Diagonal(ones(T, dim)))) | ||
SUITE[string(T)]["Diagonal"]["dim:" * string(dim)]["cholinv"] = @benchmarkable cholinv($(Diagonal(ones(T, dim)))) | ||
SUITE[string(T)]["Diagonal"]["dim:" * string(dim)]["cholsqrt"] = @benchmarkable cholsqrt($(Diagonal(ones(T, dim)))) | ||
SUITE[string(T)]["Diagonal"]["dim:" * string(dim)]["chollogdet"] = @benchmarkable chollogdet($(Diagonal(ones(T, dim)))) | ||
SUITE[string(T)]["Diagonal"]["dim:" * string(dim)]["cholinv_logdet"] = @benchmarkable cholinv_logdet($(Diagonal(ones(T, dim)))) | ||
end | ||
end | ||
|
||
SUITE["UniformScaling"] = BenchmarkGroup() | ||
|
||
# Uniformscaling benchmarks | ||
SUITE["UniformScaling"]["fastcholesky"] = @benchmarkable fastcholesky($(3.0I)) | ||
SUITE["UniformScaling"]["fastcholesky!"] = @benchmarkable fastcholesky!($(3.0I)) | ||
SUITE["UniformScaling"]["cholinv"] = @benchmarkable cholinv($(3.0I)) | ||
SUITE["UniformScaling"]["cholsqrt"] = @benchmarkable cholsqrt($(3.0I)) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This line gave me a bit of bf
s
at the end of the folder, I though this line would just remove the entire benchmarkbenchmark
and the output is also in the different place