Skip to content

Commit 098451b

Browse files
authored
Update benchmark code (#293)
1 parent 2b8d551 commit 098451b

File tree

4 files changed

+51
-15
lines changed

4 files changed

+51
-15
lines changed

benchmark/juliabugs.jl

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -85,6 +85,20 @@ function benchmark_JuliaBUGS_model_with_Mooncake(model::JuliaBUGS.BUGSModel)
8585
return BenchmarkResult(:juliabugs, dim, density_time, density_and_gradient_time)
8686
end
8787

88+
# function benchmark_JuliaBUGS_model_with_ReverseDiff(model::JuliaBUGS.BUGSModel)
89+
# model = JuliaBUGS.set_evaluation_mode(model, JuliaBUGS.UseGraph())
90+
# ad_model = LogDensityProblemsAD.ADgradient(:ReverseDiff, model; compile=Val(true))
91+
# dim = LogDensityProblems.dimension(model)
92+
# params_values = JuliaBUGS.getparams(model)
93+
# density_time = Chairmarks.@be LogDensityProblemsAD.logdensity($model, $params_values)
94+
# density_and_gradient_time = Chairmarks.@be LogDensityProblemsAD.logdensity_and_gradient(
95+
# $ad_model, $params_values
96+
# )
97+
# return BenchmarkResult(
98+
# :juliabugs_reverse_diff, dim, density_time, density_and_gradient_time
99+
# )
100+
# end
101+
88102
# function benchmark_JuliaBUGS_model_with_Enzyme(model::JuliaBUGS.BUGSModel)
89103
# f(params, model) = LogDensityProblems.logdensity(model, params)
90104
# backend = AutoEnzyme()

benchmark/nimble/nimble.r

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ for (example in names(benchmark_results)) {
225225
result <- benchmark_results[[example]]
226226

227227
if (!is.null(result$non_compiled_log_joint)) {
228-
cat("Non-compiled log joint time (microseconds):\n")
228+
cat("Non-compiled log joint time (milliseconds):\n")
229229
print(summary(result$non_compiled_log_joint))
230230
}
231231

@@ -252,7 +252,7 @@ for (example in names(benchmark_results_vol2)) {
252252
result <- benchmark_results_vol2[[example]]
253253

254254
if (!is.null(result$non_compiled_log_joint)) {
255-
cat("Non-compiled log joint time (microseconds):\n")
255+
cat("Non-compiled log joint time (milliseconds):\n")
256256
print(summary(result$non_compiled_log_joint))
257257
}
258258

benchmark/run_benchmarks.jl

Lines changed: 28 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,33 @@ examples_to_benchmark = [
44
:rats, :pumps, :bones, :oxford, :epil, :lsat, :schools, :beetles, :air
55
]
66

7+
examples_to_benchmark_full = [
8+
:rats,
9+
:pumps,
10+
:seeds,
11+
:surgical_realistic,
12+
:magnesium,
13+
:salm,
14+
:equiv,
15+
:dyes,
16+
:stacks,
17+
:epil,
18+
:blockers,
19+
:oxford,
20+
:lsat,
21+
:bones,
22+
:mice,
23+
:kidney,
24+
:leuk,
25+
:leukfr,
26+
:dugongs,
27+
:air,
28+
:birats,
29+
:schools,
30+
:beetles,
31+
:alligators,
32+
]
33+
734
stan_results = benchmark_Stan_models(examples_to_benchmark)
835

936
juliabugs_models = [
@@ -17,19 +44,8 @@ for (model_name, model) in zip(examples_to_benchmark, juliabugs_models)
1744
juliabugs_results[model_name] = benchmark_JuliaBUGS_model_with_Mooncake(model)
1845
end
1946

20-
# juliabugs_enzyme_results = OrderedDict{Symbol,BenchmarkResult}()
21-
# for (model_name, model) in zip(examples_to_benchmark, juliabugs_models)
22-
# @info "Benchmarking $model_name with Enzyme"
23-
# try
24-
# juliabugs_enzyme_results[model_name] = benchmark_JuliaBUGS_model_with_Enzyme(model)
25-
# catch e
26-
# @warn "Error benchmarking $model_name with Enzyme: $e"
27-
# end
28-
# end
29-
3047
println("### Stan results:")
3148
_print_results_table(stan_results; backend=Val(:markdown))
49+
3250
println("### JuliaBUGS Mooncake results:")
3351
_print_results_table(juliabugs_results; backend=Val(:markdown))
34-
# println("### JuliaBUGS Enzyme results:")
35-
# _print_results_table(juliabugs_enzyme_results; backend=Val(:markdown))

benchmark/stan.jl

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
const stan_models_path_info = (
44
rats=(1, :rats, :rats),
55
pumps=(1, :pump, :pump),
6-
# dogs=(1, :dogs, :dogs),
6+
dogs=(1, :dogs, :dogs),
77
seeds=(1, :seeds, :seeds),
88
surgical_realistic=(1, :surgical, :surgical),
99
magnesium=(1, :magnesium, :magnesium),
@@ -26,6 +26,12 @@ const stan_models_path_info = (
2626
schools=(2, :schools, :schools),
2727
beetles=(2, :beetles, :beetles_logit),
2828
alligators=(2, :alli, :alli2),
29+
endo=(2, :endo, :endo2),
30+
stagnant=(2, :stagnant, :stagnant),
31+
biopsies=(2, :biopsies, :biopsies),
32+
eyes=(2, :eyes, :eyes),
33+
hearts=(2, :hearts, :hearts),
34+
cervix=(2, :cervix, :cervix2),
2935
)
3036

3137
const stan_examples_folder = joinpath(@__DIR__, "stan/bugs_examples/")

0 commit comments

Comments
 (0)