11import dpctl
22import dpctl .tensor as dpt
33
4- SHARED_QUEUE = dpctl .SyclQueue (property = 'enable_profiling' )
4+ SHARED_QUEUE = dpctl .SyclQueue (property = "enable_profiling" )
5+
56
67class Binary :
78 """Benchmark class for binary operations on SYCL devices."""
9+
810 timeout = 300.0
911
1012 def setup (self ):
@@ -13,9 +15,9 @@ def setup(self):
1315 self .iterations = 1
1416 self .n_values = 10 ** 8
1517
16-
1718 def run_bench (self , q , reps , n_max , dtype1 , dtype2 , op ):
1819 """Run the benchmark for a specific function and dtype combination."""
20+
1921 def get_sizes (n ):
2022 s = []
2123 m = 8192
@@ -25,7 +27,6 @@ def get_sizes(n):
2527 s .append (n )
2628 return s
2729
28-
2930 x1 = dpt .ones (n_max , dtype = dtype1 , sycl_queue = q )
3031 x2 = dpt .ones (n_max , dtype = dtype2 , sycl_queue = q )
3132 r = op (x1 , x2 )
@@ -42,7 +43,9 @@ def get_sizes(n):
4243 n_iters = int ((max_bytes / n_bytes ) * reps )
4344
4445 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+ )
4649 with timer (q ):
4750 for _ in range (n_iters ):
4851 op (x1_n , x2_n , out = r_n )
@@ -99,7 +102,9 @@ def get_sizes(n):
99102
100103# Dynamically create benchmark methods at the module level
101104def 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+ """
103108 for fn in function_list :
104109 fn_name = fn .name_
105110 for dtype1 , dtype2 in dtypes [fn ]:
@@ -122,4 +127,4 @@ def benchmark_method(self, fn=fn, dtype1=dtype1, dtype2=dtype2):
122127
123128
124129# Generate the benchmark functions
125- generate_benchmark_functions ()
130+ generate_benchmark_functions ()
0 commit comments