-
Notifications
You must be signed in to change notification settings - Fork 35
Improvements to DynamicPPLBenchmarks #346
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
Merged
Merged
Changes from 12 commits
Commits
Show all changes
49 commits
Select commit
Hold shift + click to select a range
57b5d47
bigboy update to benchmarks
torfjelde e7c0a76
Merge branch 'master' into tor/benchmark-update
torfjelde 60ec2c8
Merge branch 'master' into tor/benchmark-update
torfjelde eb1b83c
Merge branch 'master' into tor/benchmark-update
torfjelde d8afa71
Merge branch 'master' into tor/benchmark-update
torfjelde 5bb48d2
make models return random variables as NamedTuple as it can be useful…
torfjelde 02484cf
add benchmarking of evaluation with SimpleVarInfo with NamedTuple
torfjelde 5c59769
added some information about the execution environment
torfjelde f1f1381
added judgementtable_single
torfjelde a48553a
added benchmarking of SimpleVarInfo, if present
torfjelde f2dc062
Merge branch 'master' into tor/benchmark-update
torfjelde fa675de
added ComponentArrays benchmarking for SimpleVarInfo
torfjelde 3962da2
Merge branch 'master' into tor/benchmark-update
yebai 53dc571
Merge branch 'master' into tor/benchmark-update
yebai f5705d5
Merge branch 'master' into tor/benchmark-update
torfjelde 7f569f7
formatting
torfjelde 4a06150
Merge branch 'master' into tor/benchmark-update
yebai a1cc6bf
Apply suggestions from code review
yebai 3e7e200
Update benchmarks/benchmarks.jmd
yebai c867ae8
Merge branch 'master' into tor/benchmark-update
yebai 96f120b
merged main into this one
shravanngoswamii 0460b64
Benchmarking CI
shravanngoswamii a8541b5
Julia script for benchmarking on top of current setup
shravanngoswamii 0291c2f
keep old results for reference
shravanngoswamii 6f255d1
Merge branch 'master' of https://github.com/TuringLang/DynamicPPL.jl …
shravanngoswamii 3b5e448
updated benchmarking setup
shravanngoswamii 1e61025
Merge branch 'master' of https://github.com/TuringLang/DynamicPPL.jl …
shravanngoswamii 640aa45
applied suggested changes
shravanngoswamii 3bdbe40
Merge branch 'master' of https://github.com/TuringLang/DynamicPPL.jl …
shravanngoswamii d8fd05c
updated benchmarks/README.md
shravanngoswamii c34e489
setup benchmarking CI
shravanngoswamii 1d1b11e
Merge remote-tracking branch 'origin/main' into tor/benchmark-update
mhauru ad4175a
Update benchmark models (#826)
mhauru d39a9d6
Merge branch 'main' into tor/benchmark-update
mhauru f765b40
Make benchmarks not depend on TuringBenchmarking.jl, and run `]dev ..…
mhauru 00296bd
Benchmarking.yml: now comments raw markdown table enclosed in triple …
shravanngoswamii 9a64f32
Benchmarking.yml: now includes the SHA of the DynamicPPL commit in Be…
shravanngoswamii 5c35238
Benchmark more with Mooncake
mhauru 923105e
Add model dimension to benchmark table
mhauru 2f15b72
Add info print
mhauru ee39e26
Fix type instability in benchmark model
mhauru 6ce0a4f
Remove done TODO note
mhauru c95d298
Merge branch 'main' into tor/benchmark-update
mhauru 2161352
Apply suggestions from code review
mhauru 70ff1a9
Fix table formatting bug
mhauru b847542
Simplify benchmark suite code
mhauru 4a15940
Use StableRNG
mhauru 5e6cab0
Merge branch 'main' into tor/benchmark-update
shravanngoswamii dae1be7
Merge branch 'main' of https://github.com/TuringLang/DynamicPPL.jl in…
shravanngoswamii 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 hidden or 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 hidden or 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 hidden or 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 hidden or 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 | ||||
---|---|---|---|---|---|---|
|
@@ -2,6 +2,9 @@ module DynamicPPLBenchmarks | |||||
|
||||||
using DynamicPPL | ||||||
using BenchmarkTools | ||||||
shravanngoswamii marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
using InteractiveUtils | ||||||
|
||||||
using ComponentArrays: ComponentArrays | ||||||
|
||||||
using Weave: Weave | ||||||
using Markdown: Markdown | ||||||
|
@@ -32,6 +35,40 @@ function benchmark_typed_varinfo!(suite, m) | |||||
return suite | ||||||
end | ||||||
|
||||||
function benchmark_simple_varinfo_namedtuple!(suite, m) | ||||||
# We expect the model to return the random variables as a `NamedTuple`. | ||||||
retvals = m() | ||||||
|
||||||
# Populate. | ||||||
vi = SimpleVarInfo{Float64}(retvals) | ||||||
vi_ca = SimpleVarInfo{Float64}(ComponentArrays.ComponentArray(retvals)) | ||||||
|
||||||
# Evaluate. | ||||||
suite["evaluation_simple_varinfo_nt"] = @benchmarkable $m($vi, $(DefaultContext())) | ||||||
suite["evaluation_simple_varinfo_componentarrays"] = @benchmarkable $m($vi_ca, $(DefaultContext())) | ||||||
torfjelde marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
return suite | ||||||
end | ||||||
|
||||||
function benchmark_simple_varinfo_dict!(suite, m) | ||||||
# Populate. | ||||||
vi = SimpleVarInfo{Float64}(Dict()) | ||||||
retvals = m(vi) | ||||||
|
||||||
# Evaluate. | ||||||
suite["evaluation_simple_varinfo_dict"] = @benchmarkable $m($vi, $(DefaultContext())) | ||||||
|
||||||
# We expect the model to return the random variables as a `NamedTuple`. | ||||||
vns = map(keys(retvals)) do k | ||||||
VarName{k}() | ||||||
end | ||||||
vi = SimpleVarInfo{Float64}(Dict(zip(vns, values(retvals)))) | ||||||
|
||||||
# Evaluate. | ||||||
suite["evaluation_simple_varinfo_dict_from_nt"] = @benchmarkable $m($vi, $(DefaultContext())) | ||||||
torfjelde marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
return suite | ||||||
end | ||||||
|
||||||
function typed_code(m, vi=VarInfo(m)) | ||||||
rng = DynamicPPL.Random.MersenneTwister(42) | ||||||
spl = DynamicPPL.SampleFromPrior() | ||||||
|
@@ -51,6 +88,11 @@ function make_suite(model) | |||||
benchmark_untyped_varinfo!(suite, model) | ||||||
benchmark_typed_varinfo!(suite, model) | ||||||
|
||||||
if isdefined(DynamicPPL, :SimpleVarInfo) | ||||||
benchmark_simple_varinfo_namedtuple!(suite, model) | ||||||
benchmark_simple_varinfo_dict!(suite, model) | ||||||
end | ||||||
|
||||||
return suite | ||||||
end | ||||||
|
||||||
|
@@ -151,6 +193,7 @@ function weave_benchmarks( | |||||
name=default_name(; include_commit_id=include_commit_id), | ||||||
name_old=nothing, | ||||||
include_typed_code=false, | ||||||
seconds=10, | ||||||
doctype="github", | ||||||
outpath="results/$(name)/", | ||||||
kwargs..., | ||||||
|
@@ -159,6 +202,7 @@ function weave_benchmarks( | |||||
:benchmarkbody => benchmarkbody, | ||||||
:name => name, | ||||||
:include_typed_code => include_typed_code, | ||||||
:seconds => seconds | ||||||
torfjelde marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
) | ||||||
if !isnothing(name_old) | ||||||
args[:name_old] = name_old | ||||||
|
@@ -168,4 +212,30 @@ function weave_benchmarks( | |||||
return Weave.weave(input, doctype; out_path=outpath, args=args, kwargs...) | ||||||
end | ||||||
|
||||||
function display_environment() | ||||||
display("text/markdown", "Computer Information:") | ||||||
vinfo = sprint(InteractiveUtils.versioninfo) | ||||||
display("text/markdown", """ | ||||||
``` | ||||||
$(vinfo) | ||||||
``` | ||||||
""") | ||||||
torfjelde marked this conversation as resolved.
Show resolved
Hide resolved
torfjelde marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
ctx = Pkg.API.Context() | ||||||
|
||||||
pkg_status = let io = IOBuffer() | ||||||
Pkg.status(Pkg.API.Context(); io = io) | ||||||
torfjelde marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
String(take!(io)) | ||||||
end | ||||||
|
||||||
display("text/markdown",""" | ||||||
Package Information: | ||||||
""") | ||||||
torfjelde marked this conversation as resolved.
Show resolved
Hide resolved
|
||||||
|
||||||
md = "```\n$(pkg_status)\n```" | ||||||
display("text/markdown", md) | ||||||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. [JuliaFormatter] reported by reviewdog 🐶
Suggested change
|
||||||
end | ||||||
|
||||||
include("tables.jl") | ||||||
|
||||||
end # module |
Oops, something went wrong.
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.
Uh oh!
There was an error while loading. Please reload this page.