Skip to content

Commit

Permalink
Include only certain problems for benchmarking
Browse files Browse the repository at this point in the history
  • Loading branch information
ericphanson committed Sep 10, 2019
1 parent 533e6cb commit 6af1837
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 5 deletions.
7 changes: 3 additions & 4 deletions benchmark/benchmarks.jl
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ using BenchmarkTools

const SUITE = BenchmarkGroup()

# SUITE["SCS"] = ProblemDepot.benchmark_suite(p -> Convex.solve!(p, SCSSolver(verbose=0)))
# SUITE["ECOS"] = ProblemDepot.benchmark_suite(p -> Convex.solve!(p, ECOSSolver(verbose=0));
# exclude = [r"sdp", r"exp"])
SUITE["formulation"] = ProblemDepot.benchmark_suite(Convex.conic_problem)
problems = Regex[r"constant_fix!_with_complex_numbers", r"affine_dot_multiply_atom", r"affine_hcat_atom", r"affine_trace_atom", r"exp_entropy_atom", r"exp_log_perspective_atom", r"socp_norm_2_atom", r"socp_quad_form_atom", r"socp_sum_squares_atom", r"lp_norm_inf_atom", r"lp_maximum_atom", r"sdp_and_exp_log_det_atom", r"sdp_norm2_atom", r"sdp_lambda_min_atom", r"sdp_sum_largest_eigs", r"mip_integer_variables"]

SUITE["formulation"] = ProblemDepot.benchmark_suite(Convex.conic_problem; include=problems)
10 changes: 9 additions & 1 deletion src/problem_depot/problem_depot.jl
Original file line number Diff line number Diff line change
Expand Up @@ -131,13 +131,21 @@ benchmark_suite(exclude=[r"mip"]) do p
end
```
"""
function benchmark_suite(handle_problem!::Function; exclude::Vector{Regex} = Regex[], T=Float64, atol=1e-3, rtol=0.0, test = Val(false))
function benchmark_suite(handle_problem!::Function; exclude::Vector{Regex} = Regex[], include::Vector{Regex} = Regex[], T=Float64, atol=1e-3, rtol=0.0, test = Val(false))
group = BenchmarkGroup()
for (class, dict) in ProblemDepot.PROBLEMS
included = false
any(occursin.(exclude, Ref(class))) && continue
if !isempty(include)
any(occursin.(include, Ref(class))) && (included = true)
end
group[class] = BenchmarkGroup()
for (name, func) in dict
any(occursin.(exclude, Ref(name))) && continue
if !isempty(include)
any(occursin.(include, Ref(name))) && (included = true)
included || continue
end
group[class][name] = @benchmarkable $func($handle_problem!, $test, $atol, $rtol, $T)
end
end
Expand Down

0 comments on commit 6af1837

Please sign in to comment.