Skip to content

Commit

Permalink
use new benchmark interface (#851)
Browse files Browse the repository at this point in the history
  • Loading branch information
KDr2 authored and yebai committed Aug 3, 2019
1 parent 6fa6878 commit 27a4132
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 15 deletions.
12 changes: 7 additions & 5 deletions benchmarks/benchmark_config.jl
Original file line number Diff line number Diff line change
@@ -1,3 +1,8 @@
CONFIG = Dict(
"target.project_dir" => (@__DIR__) |> dirname |> abspath,
"reporter.use_dataframe" => true,
)

ON_TRAVIS = get(ENV, "TRAVIS", "false") == "true"

if ON_TRAVIS
Expand All @@ -14,11 +19,8 @@ else
]
end

BENCHMARK_FILES = map(BENCHMARK_FILES) do x joinpath(@__DIR__, x) end


COMMENT_TEMPLATES = Dict{Symbol, String}()
COMMENT_TEMPLATES[:CI_BM_COMPLETE_FOR_COMMIT] = """
CONFIG["benchmark_files"] = map(BENCHMARK_FILES) do x joinpath(@__DIR__, x) end
CONFIG["comment_templates.ci_bm_complete_for_commit"] = """
The benchmark job for this commit has completed.
Here is the benchmark [report]( {{{ :report_url }}}) and commit ({{{ :report_repo }}}@{{{ :commit_id }}}).
Expand Down
6 changes: 2 additions & 4 deletions benchmarks/dummy.jl
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,10 @@ end

log_report("Dummy model constructed!")

bench_res = @tbenchmark(HMC(1000, 1.5, 3), constrained_test, data)
LOG_DATA = @tbenchmark(HMC(1000, 1.5, 3), constrained_test, data)

log_report("Dummy benchmark finished!")

# bench_res[4].names = ["phi[1]", "phi[2]", "phi[3]", "phi[4]"]
LOG_DATA = build_log_data("Dummy-Benchmark", bench_res...)
print_log(LOG_DATA)

log_report("Dummy benchmark reported!")
log_report("Dummy benchmark printed!")
3 changes: 1 addition & 2 deletions benchmarks/gdemo.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ end
data = (1.5, 2.0)

# sample(gdemo(1.5, 2.0), Turing.NUTS(2000000, 0.65));
bench_res = @tbenchmark(Turing.NUTS(2000000, 0.65), gdemo, data...)
LOG_DATA = @tbenchmark(Turing.NUTS(2000000, 0.65), gdemo, data...)

LOG_DATA = build_log_data("GDemo-Benchmark", bench_res...)
print_log(LOG_DATA)
3 changes: 1 addition & 2 deletions benchmarks/mvnormal.jl
Original file line number Diff line number Diff line change
Expand Up @@ -17,10 +17,9 @@ n_samples = 100_000
n_adapts = 2_000

# Sampling
bench_res = @tbenchmark_expr("NUTS(Leapfrog(...))",
LOG_DATA = @tbenchmark_expr("NUTS(Leapfrog(...))",
sample(target(D), HMC(n_samples, 0.1, 5)));

LOG_DATA = build_log_data("MvNormal-Benchmark", bench_res...)
print_log(LOG_DATA)

##
Expand Down
3 changes: 1 addition & 2 deletions benchmarks/runbenchmarks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ Pkg.add(PackageSpec(
Pkg.build("ContinuousBenchmarks")
Pkg.resolve()

# prepare BenchMark information
# prepare benchmark information
BASE_BRANCH = "master"
CURRENT_BRANCH = strip(read(`git rev-parse --abbrev-ref HEAD`, String))

Expand All @@ -40,7 +40,6 @@ end
# run
code_run = """using ContinuousBenchmarks
using ContinuousBenchmarks.Runner
ContinuousBenchmarks.set_project_path("$PROJECT_DIR")
ContinuousBenchmarks.set_benchmark_config_file(
joinpath("$PROJECT_DIR", "benchmarks/benchmark_config.jl"))
Runner.run_bm_on_travis("$BM_JOB_NAME", ("$BASE_BRANCH", "$CURRENT_BRANCH"), "$COMMIT_SHA")
Expand Down

0 comments on commit 27a4132

Please sign in to comment.