|
2 | 2 | from scipy.sparse import random
|
3 | 3 | import pytest
|
4 | 4 |
|
5 |
| -def test_add_window(benchmark): |
| 5 | +def test_add_window(tacoBench): |
6 | 6 | dim = 10000
|
7 | 7 | matrix = random(dim, dim, format="csr").todense()
|
8 | 8 | def bench():
|
9 | 9 | x = matrix[1:(dim-1), 1:(dim-1)]
|
10 | 10 | res = x + x
|
11 |
| - benchmark.pedantic(bench, iterations=10) |
| 11 | + tacoBench(bench) |
12 | 12 |
|
13 | 13 | @pytest.mark.parametrize("dim", [5000, 10000, 20000])
|
14 |
| -def test_add_sparse_window(benchmark, dim): |
| 14 | +def test_add_sparse_window(tacoBench, dim): |
15 | 15 | matrix = random(dim, dim, format="csr")
|
16 | 16 | def bench():
|
17 | 17 | x = matrix[1:(dim-1), 1:(dim-1)]
|
18 | 18 | res = x + x
|
19 | 19 | # Sanity check that this has a similar runtime as taco.
|
20 | 20 | # res = matrix + matrix
|
21 |
| - benchmark.pedantic(bench, iterations=10) |
| 21 | + tacoBench(bench) |
22 | 22 |
|
23 | 23 | @pytest.mark.parametrize("dim", [5000, 10000, 20000])
|
24 |
| -def test_add_multiple_sparse_windows(benchmark, dim): |
| 24 | +def test_add_multiple_sparse_windows(tacoBench, dim): |
25 | 25 | matrix1 = random(dim, dim, format="csr")
|
26 | 26 | matrix2 = random(dim, dim, format="csr")
|
27 | 27 | def bench():
|
28 | 28 | res = matrix1[1:(dim-1), 1:(dim-1)] + matrix2[1:(dim-1), 1:(dim-1)] + matrix1[0:(dim-2), 0:(dim-2)]
|
29 |
| - benchmark.pedantic(bench, iterations=10) |
| 29 | + tacoBench(bench) |
30 | 30 |
|
31 | 31 | @pytest.mark.parametrize("dim", [5000, 10000, 20000])
|
32 |
| -def test_add_sparse_strided_window(benchmark, dim): |
| 32 | +def test_add_sparse_strided_window(tacoBench, dim): |
33 | 33 | matrix = random(dim, dim, format="csr")
|
34 | 34 | def bench():
|
35 | 35 | x = matrix[1:(dim-1):2, 1:(dim-1):2]
|
36 | 36 | res = x + x
|
37 |
| - benchmark.pedantic(bench, iterations=10) |
| 37 | + tacoBench(bench) |
38 | 38 |
|
39 | 39 | @pytest.mark.parametrize("dim", [5000, 10000, 20000])
|
40 |
| -def test_add_sparse_index_set(benchmark, dim): |
| 40 | +def test_add_sparse_index_set(tacoBench, dim): |
41 | 41 | indexes = [i * 2 for i in range(0, dim//2)]
|
42 | 42 | matrix = random(dim, dim, format="csr")
|
43 | 43 | def bench():
|
44 | 44 | x = matrix[:, indexes]
|
45 | 45 | res = x + x
|
46 |
| - benchmark.pedantic(bench, iterations=10) |
47 |
| - |
| 46 | + tacoBench(bench) |
0 commit comments