forked from inaos/iron-array-python
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathtest_btune.py
More file actions
106 lines (100 loc) · 2.51 KB
/
Copy pathtest_btune.py
File metadata and controls
106 lines (100 loc) · 2.51 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
import pytest
import numpy as np
import iarray as ia
# linspace
@pytest.mark.parametrize(
"start, stop, shape, chunks, blocks, dtype, contiguous, urlpath",
[
(0, 1000, [131, 120], [53, 21], [32, 13], np.float64, False, None),
pytest.param(
0,
1000,
[231, 120, 500],
[53, 21, 340],
[32, 13, 70],
np.float64,
False,
None,
marks=pytest.mark.heavy,
),
pytest.param(
0,
1000,
[231, 120, 500],
[53, 21, 340],
[32, 13, 70],
np.float64,
True,
"test_btune_64.iarr",
marks=pytest.mark.heavy,
),
pytest.param(
-1,
-2000,
[40, 39, 52, 120],
[40, 17, 6, 50],
[13, 4, 6, 50],
np.float32,
False,
"test_btune_32.iarr",
marks=pytest.mark.heavy,
),
(
-1,
-2000,
[
40,
39,
],
[40, 17],
[13, 4],
np.float32,
True,
None,
),
pytest.param(
-1,
-2000,
[40, 39, 52, 120],
[40, 17, 6, 50],
[13, 4, 6, 50],
np.float32,
True,
None,
marks=pytest.mark.heavy,
),
],
)
def test_btune(start, stop, shape, chunks, blocks, dtype, contiguous, urlpath):
ia.remove_urlpath(urlpath)
with ia.config(favor=ia.Favor.SPEED, btune=True):
a = ia.linspace(
start,
stop,
np.prod(shape),
shape=shape,
dtype=dtype,
chunks=chunks,
blocks=blocks,
contiguous=contiguous,
urlpath=urlpath,
)
c1 = a.cratio
ia.remove_urlpath(urlpath)
with ia.config(favor=ia.Favor.CRATIO, btune=True):
a = ia.linspace(
start,
stop,
np.prod(shape),
shape=shape,
dtype=dtype,
chunks=chunks,
blocks=blocks,
contiguous=contiguous,
urlpath=urlpath,
)
c2 = a.cratio
# Sometimes, depending on the machine and its state, SPEED can get better cratios :-/
# Hopefully the 2x factor would avoid a failure in most of the cases...
assert c1 < 2 * c2
ia.remove_urlpath(urlpath)