From b4726911772e3608ca5416fce097387250ee18a4 Mon Sep 17 00:00:00 2001 From: KDr2 Date: Thu, 27 Jun 2019 11:27:34 +0800 Subject: [PATCH] add Dummy benchmarks --- benchmarks/Dummy.run.jl | 19 +++++++++++++++++++ benchmarks/benchmark_list.jl | 5 +++++ benchmarks/runbenchmarks.jl | 5 ++++- 3 files changed, 28 insertions(+), 1 deletion(-) create mode 100644 benchmarks/Dummy.run.jl create mode 100644 benchmarks/benchmark_list.jl diff --git a/benchmarks/Dummy.run.jl b/benchmarks/Dummy.run.jl new file mode 100644 index 0000000000..6b3ea84bb0 --- /dev/null +++ b/benchmarks/Dummy.run.jl @@ -0,0 +1,19 @@ +using Turing, TuringBenchmarks + +data = [0, 1, 0, 1, 1, 1, 1, 1, 1, 1] + +@model constrained_test(obs) = begin + p ~ Beta(2,2) + for i = 1:length(obs) + obs[i] ~ Bernoulli(p) + end + p +end + +bench_res = @tbenchmark(HMC(1000, 1.5, 3), constrained_test, data) + +# bench_res[4].names = ["phi[1]", "phi[2]", "phi[3]", "phi[4]"] +logd = build_logd("Dummy-Benchmark", bench_res...) + +print_log(logd) +send_log(logd) diff --git a/benchmarks/benchmark_list.jl b/benchmarks/benchmark_list.jl new file mode 100644 index 0000000000..cfd1bb7e1f --- /dev/null +++ b/benchmarks/benchmark_list.jl @@ -0,0 +1,5 @@ +BENCHMARK_FILES = [ + "Dummy.run.jl", +] + +BENCHMARK_FILES = map(BENCHMARK_FILES) do x joinpath(@__DIR__, x) end diff --git a/benchmarks/runbenchmarks.jl b/benchmarks/runbenchmarks.jl index 0febe413e3..f5ce4215ca 100644 --- a/benchmarks/runbenchmarks.jl +++ b/benchmarks/runbenchmarks.jl @@ -22,6 +22,7 @@ run(`git config remote.origin.fetch '+refs/heads/*:refs/remotes/origin/*'`) run(`git fetch --all --unshallow`) run(`git clone https://github.com/TuringLang/TuringBenchmarks.git ../TuringBenchmarks`) +run(`git -c ../TuringBenchmarks checkout -b external-bm origin/external-bm`) # remove this! delete!(ENV, "JULIA_PROJECT") @@ -37,7 +38,9 @@ pkg"add SpecialFunctions" using TuringBenchmarks """ -code_run = """using TuringBenchmarks.Runner +code_run = """using TuringBenchmarks +using TuringBenchmarks.Runner +TuringBenchmarks.set_benchmark_files("./benchmarks/benchmark_list.jl") Runner.run_bm_on_travis("$BM_JOB_NAME", ("master", "$CURRENT_BRANCH"), "$COMMIT_SHA") """