Skip to content

Commit 7253982

Browse files
authored
Revert "Improve benchmarks, add bicoloring (#187)" (#188)
This reverts commit d6fab77.
1 parent d6fab77 commit 7253982

2 files changed

Lines changed: 17 additions & 32 deletions

File tree

.github/workflows/Benchmark.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ jobs:
3535
echo $PATH
3636
ls -l ~/.julia/bin
3737
mkdir results
38-
benchpkg ${{ steps.extract-package-name.outputs.package_name }} --rev="${{github.event.repository.default_branch}},${{github.event.pull_request.head.sha}}" --url=${{ github.event.repository.clone_url }} --bench-on="${{github.event.repository.default_branch}}" --output-dir=results/ --tune --add StableRNGs
38+
benchpkg ${{ steps.extract-package-name.outputs.package_name }} --rev="${{github.event.repository.default_branch}},${{github.event.pull_request.head.sha}}" --url=${{ github.event.repository.clone_url }} --bench-on="${{github.event.repository.default_branch}}" --output-dir=results/ --tune
3939
- name: Create markdown table from benchmarks
4040
run: |
4141
benchpkgtable ${{ steps.extract-package-name.outputs.package_name }} --mode="time,memory" --rev="${{github.event.repository.default_branch}},${{github.event.pull_request.head.sha}}" --input-dir=results/ --ratio > table.md

benchmark/benchmarks.jl

Lines changed: 16 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -2,44 +2,29 @@ using BenchmarkTools
22
using LinearAlgebra
33
using SparseMatrixColorings
44
using SparseArrays
5-
using StableRNGs
65

76
SUITE = BenchmarkGroup()
87

98
for structure in [:nonsymmetric, :symmetric],
10-
partition in (structure == :nonsymmetric ? [:column, :row, :bidirectional] : [:column]),
11-
decompression in (
12-
if (structure == :nonsymmetric && partition in [:column, :row])
13-
[:direct]
14-
else
15-
[:direct, :substitution]
16-
end
17-
),
9+
partition in (structure == :nonsymmetric ? [:column, :row] : [:column]),
10+
decompression in (structure == :nonsymmetric ? [:direct] : [:direct, :substitution]),
1811
n in [10^3, 10^5],
19-
p in [2 / n, 5 / n, 10 / n, 50 / n]
12+
p in [2 / n, 5 / n, 10 / n]
2013

2114
problem = ColoringProblem(; structure, partition)
22-
algo = GreedyColoringAlgorithm(; decompression, postprocessing=true)
15+
algo = GreedyColoringAlgorithm(; decompression)
2316

24-
# use several random matrices to reduce variance
25-
nb_samples = 10
26-
As = [sparse(Symmetric(sprand(StableRNG(i), n, n, p))) for i in 1:nb_samples]
27-
results = [coloring(A, problem, algo) for A in As]
28-
Bs = [compress(A, result) for (A, result) in zip(As, results)]
17+
SUITE[:coloring][structure][partition][decompression]["n=$n"]["p=$p"] = @benchmarkable coloring(
18+
A, $problem, $algo
19+
) setup = ( #
20+
A = sparse(Symmetric(sprand($n, $n, $p)))
21+
)
2922

30-
SUITE[:coloring][structure][partition][decompression]["n=$n"]["p=$p"] = @benchmarkable begin
31-
for A in $As
32-
coloring(A, $problem, $algo)
33-
end
34-
end
35-
36-
SUITE[:decompress][structure][partition][decompression]["n=$n"]["p=$p"] = @benchmarkable begin
37-
for (B, result) in zip($Bs, $results)
38-
if B isa AbstractMatrix
39-
decompress(B, result)
40-
elseif B isa Tuple
41-
decompress(B[1], B[2], result)
42-
end
43-
end
44-
end
23+
SUITE[:decompress][structure][partition][decompression]["n=$n"]["p=$p"] = @benchmarkable decompress(
24+
B, result
25+
) setup = ( #
26+
A = sparse(Symmetric(sprand($n, $n, $p)));
27+
result = coloring(A, $problem, $algo);
28+
B = compress(A, result)
29+
)
4530
end

0 commit comments

Comments
 (0)