1
1
import dpctl
2
2
import dpctl .tensor as dpt
3
3
4
- SHARED_QUEUE = dpctl .SyclQueue (property = 'enable_profiling' )
4
+ SHARED_QUEUE = dpctl .SyclQueue (property = "enable_profiling" )
5
+
5
6
6
7
class Binary :
7
8
"""Benchmark class for binary operations on SYCL devices."""
9
+
8
10
timeout = 300.0
9
11
10
12
def setup (self ):
@@ -13,9 +15,9 @@ def setup(self):
13
15
self .iterations = 1
14
16
self .n_values = 10 ** 8
15
17
16
-
17
18
def run_bench (self , q , reps , n_max , dtype1 , dtype2 , op ):
18
19
"""Run the benchmark for a specific function and dtype combination."""
20
+
19
21
def get_sizes (n ):
20
22
s = []
21
23
m = 8192
@@ -25,7 +27,6 @@ def get_sizes(n):
25
27
s .append (n )
26
28
return s
27
29
28
-
29
30
x1 = dpt .ones (n_max , dtype = dtype1 , sycl_queue = q )
30
31
x2 = dpt .ones (n_max , dtype = dtype2 , sycl_queue = q )
31
32
r = op (x1 , x2 )
@@ -42,7 +43,9 @@ def get_sizes(n):
42
43
n_iters = int ((max_bytes / n_bytes ) * reps )
43
44
44
45
while True :
45
- timer = dpctl .SyclTimer (device_timer = "order_manager" , time_scale = 1e9 )
46
+ timer = dpctl .SyclTimer (
47
+ device_timer = "order_manager" , time_scale = 1e9
48
+ )
46
49
with timer (q ):
47
50
for _ in range (n_iters ):
48
51
op (x1_n , x2_n , out = r_n )
@@ -99,7 +102,9 @@ def get_sizes(n):
99
102
100
103
# Dynamically create benchmark methods at the module level
101
104
def generate_benchmark_functions ():
102
- """Dynamically create benchmark functions for each function and dtype combination."""
105
+ """Dynamically create benchmark functions for each
106
+ function and dtype combination.
107
+ """
103
108
for fn in function_list :
104
109
fn_name = fn .name_
105
110
for dtype1 , dtype2 in dtypes [fn ]:
@@ -122,4 +127,4 @@ def benchmark_method(self, fn=fn, dtype1=dtype1, dtype2=dtype2):
122
127
123
128
124
129
# Generate the benchmark functions
125
- generate_benchmark_functions ()
130
+ generate_benchmark_functions ()
0 commit comments