Skip to content

Commit

Permalink
Disable automatic benchmarking
Browse files Browse the repository at this point in the history
  • Loading branch information
pedromxavier committed Oct 16, 2023
1 parent 1328ab5 commit 1458a60
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 24 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/benchmark.yml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Benchmark
on:
pull_request:
types: [opened, synchronize, reopened]
workflow_dispatch:

jobs:
test:
name: Julia ${{ matrix.version }} - ${{ matrix.os }} - ${{ matrix.arch }} - ${{ github.event_name }}
Expand Down
2 changes: 2 additions & 0 deletions benchmark/benchmark.jl
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ const PBO = PseudoBooleanOptimization

Random.seed!(0)

erste(f) = f isa Tuple ? first(f) : f

const SUITE = BenchmarkGroup()

include("suites/constructors.jl")
Expand Down
40 changes: 20 additions & 20 deletions benchmark/suites/operators.jl
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,15 @@ function benchmark_add!(suite, ::Type{F}) where {V,T,F<:PBO.AbstractFunction{V,T
suite["operators"]["+"]["small"] = @benchmarkable(
f + g;
setup = begin
f = PBO.sherrington_kirkpatrick(Random.GLOBAL_RNG, $F, 10)
g = PBO.sherrington_kirkpatrick(Random.GLOBAL_RNG, $F, 10)
f = erste(PBO.sherrington_kirkpatrick(Random.GLOBAL_RNG, $F, 10))
g = erste(PBO.sherrington_kirkpatrick(Random.GLOBAL_RNG, $F, 10))
end
)
suite["operators"]["+"]["large"] = @benchmarkable(
f + g;
setup = begin
f = PBO.sherrington_kirkpatrick(Random.GLOBAL_RNG, $F, 100)
g = PBO.sherrington_kirkpatrick(Random.GLOBAL_RNG, $F, 100)
f = erste(PBO.sherrington_kirkpatrick(Random.GLOBAL_RNG, $F, 100))
g = erste(PBO.sherrington_kirkpatrick(Random.GLOBAL_RNG, $F, 100))
end
)

Expand All @@ -36,15 +36,15 @@ function benchmark_sub!(suite, ::Type{F}) where {V,T,F<:PBO.AbstractFunction{V,T
suite["operators"]["-"]["small"] = @benchmarkable(
f - g;
setup = begin
f = PBO.sherrington_kirkpatrick(Random.GLOBAL_RNG, $F, 10)
g = PBO.sherrington_kirkpatrick(Random.GLOBAL_RNG, $F, 10)
f = erste(PBO.sherrington_kirkpatrick(Random.GLOBAL_RNG, $F, 10))
g = erste(PBO.sherrington_kirkpatrick(Random.GLOBAL_RNG, $F, 10))
end
)
suite["operators"]["-"]["large"] = @benchmarkable(
f - g;
setup = begin
f = PBO.sherrington_kirkpatrick(Random.GLOBAL_RNG, $F, 100)
g = PBO.sherrington_kirkpatrick(Random.GLOBAL_RNG, $F, 100)
f = erste(PBO.sherrington_kirkpatrick(Random.GLOBAL_RNG, $F, 100))
g = erste(PBO.sherrington_kirkpatrick(Random.GLOBAL_RNG, $F, 100))
end
)

Expand All @@ -56,15 +56,15 @@ function benchmark_mul!(suite, ::Type{F}) where {V,T,F<:PBO.AbstractFunction{V,T
suite["operators"]["*"]["small"] = @benchmarkable(
f * g;
setup = begin
f = PBO.sherrington_kirkpatrick(Random.GLOBAL_RNG, $F, 10)
g = PBO.sherrington_kirkpatrick(Random.GLOBAL_RNG, $F, 10)
f = erste(PBO.sherrington_kirkpatrick(Random.GLOBAL_RNG, $F, 10))
g = erste(PBO.sherrington_kirkpatrick(Random.GLOBAL_RNG, $F, 10))
end
)
suite["operators"]["*"]["large"] = @benchmarkable(
f * g;
setup = begin
f = PBO.sherrington_kirkpatrick(Random.GLOBAL_RNG, $F, 32)
g = PBO.sherrington_kirkpatrick(Random.GLOBAL_RNG, $F, 32)
f = erste(PBO.sherrington_kirkpatrick(Random.GLOBAL_RNG, $F, 32))
g = erste(PBO.sherrington_kirkpatrick(Random.GLOBAL_RNG, $F, 32))
end
)

Expand All @@ -76,15 +76,15 @@ function benchmark_dict_evaluation!(suite, ::Type{F}) where {V,T,F<:PBO.Abstract
suite["operators"]["dict-evaluation"]["small"] = @benchmarkable(
f(x);
setup = begin
f = PBO.sherrington_kirkpatrick(Random.GLOBAL_RNG, $F, 10)
x = Dict{Int,Int}(i => rand((0, 1)) for i = 1:10)
f = erste(PBO.sherrington_kirkpatrick(Random.GLOBAL_RNG, $F, 10))
x = erste(Dict{Int,Int}(i => rand((0, 1)) for i = 1:10))
end
)
suite["operators"]["dict-evaluation"]["large"] = @benchmarkable(
f(x);
setup = begin
f = PBO.sherrington_kirkpatrick(Random.GLOBAL_RNG, $F, 100)
x = Dict{Int,Int}(i => rand((0, 1)) for i = 1:100)
f = erste(PBO.sherrington_kirkpatrick(Random.GLOBAL_RNG, $F, 100))
x = erste(Dict{Int,Int}(i => rand((0, 1)) for i = 1:100))
end
)

Expand All @@ -96,15 +96,15 @@ function benchmark_set_evaluation!(suite, ::Type{F}) where {V,T,F<:PBO.AbstractF
suite["operators"]["set-evaluation"]["small"] = @benchmarkable(
f(x);
setup = begin
f = PBO.sherrington_kirkpatrick(Random.GLOBAL_RNG, $F, 10)
x = Set{Int}(i for i = 1:10 if rand(Bool))
f = erste(PBO.sherrington_kirkpatrick(Random.GLOBAL_RNG, $F, 10))
x = erste(Set{Int}(i for i = 1:10 if rand(Bool)))
end
)
suite["operators"]["set-evaluation"]["large"] = @benchmarkable(
f(x);
setup = begin
f = PBO.sherrington_kirkpatrick(Random.GLOBAL_RNG, $F, 100)
x = Set{Int}(i for i = 1:100 if rand(Bool))
f = erste(PBO.sherrington_kirkpatrick(Random.GLOBAL_RNG, $F, 100))
x = erste(Set{Int}(i for i = 1:100 if rand(Bool)))
end
)

Expand Down
4 changes: 2 additions & 2 deletions benchmark/suites/quadratization.jl
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ function benchmark_quadratization!(suite, ::Type{F}) where {V,T,F<:PBO.AbstractF
suite["quadratization"]["automatic"]["small"] = @benchmarkable(
PBO.quadratize(f, PBO.Quadratization{PBO.INFER}());
setup = begin
f = PBO.k_regular_k_xorsat(Random.GLOBAL_RNG, $F, 10, 3; quad = nothing)
f = erste(PBO.k_regular_k_xorsat(Random.GLOBAL_RNG, $F, 10, 3; quad = nothing))
end
)
suite["quadratization"]["automatic"]["large"] = @benchmarkable(
PBO.quadratize(f, PBO.Quadratization{PBO.INFER}());
setup = begin
f = PBO.k_regular_k_xorsat(Random.GLOBAL_RNG, $F, 100, 3; quad = nothing)
f = erste(PBO.k_regular_k_xorsat(Random.GLOBAL_RNG, $F, 100, 3; quad = nothing))
end
)

Expand Down

0 comments on commit 1458a60

Please sign in to comment.