55
66
77class Eindot (Benchmark ):
8- params = [[dpnp , numpy ],
9- [16 , 32 , 64 , 128 , 256 , 512 , 1024 ],
10- ['float64' , 'float32' , 'int64' , 'int32' ]]
11- param_names = ['executor' , 'size' , 'dtype' ]
8+ params = [
9+ [dpnp , numpy ],
10+ [16 , 32 , 64 , 128 , 256 , 512 , 1024 ],
11+ ["float64" , "float32" , "int64" , "int32" ],
12+ ]
13+ param_names = ["executor" , "size" , "dtype" ]
1214
1315 def setup (self , np , size , dtype ):
1416 dt = getattr (np , dtype )
@@ -45,13 +47,13 @@ def time_dot_trans_atc_a(self, np, *args):
4547 np .dot (self .atc , self .a )
4648
4749 def time_einsum_i_ij_j (self , np , * args ):
48- np .einsum (' i,ij,j' , self .d , self .b , self .c )
50+ np .einsum (" i,ij,j" , self .d , self .b , self .c )
4951
5052 def time_einsum_ij_jk_a_b (self , np , * args ):
51- np .einsum (' ij,jk' , self .a , self .b )
53+ np .einsum (" ij,jk" , self .a , self .b )
5254
5355 def time_einsum_ijk_jil_kl (self , np , * args ):
54- np .einsum (' ijk,jil->kl' , self .a3 , self .b3 )
56+ np .einsum (" ijk,jil->kl" , self .a3 , self .b3 )
5557
5658 def time_inner_trans_a_a (self , np , * args ):
5759 np .inner (self .a , self .a )
@@ -82,20 +84,19 @@ def time_tensordot_a_b_axes_1_0_0_1(self, np, *args):
8284
8385
8486class Linalg (Benchmark ):
85- params = [[dpnp , numpy ],
86- ['svd' , 'pinv' , 'det' , 'norm' ],
87- TYPES1 ]
88- param_names = ['executor' , 'op' , 'type' ]
87+ params = [[dpnp , numpy ], ["svd" , "pinv" , "det" , "norm" ], TYPES1 ]
88+ param_names = ["executor" , "op" , "type" ]
8989
9090 def setup (self , np , op , typename ):
91- np .seterr (all = ' ignore' )
91+ np .seterr (all = " ignore" )
9292
9393 self .func = getattr (np .linalg , op )
9494
95- if op == ' cholesky' :
95+ if op == " cholesky" :
9696 # we need a positive definite
97- self .a = np .dot (get_squares_ ()[typename ],
98- get_squares_ ()[typename ].T )
97+ self .a = np .dot (
98+ get_squares_ ()[typename ], get_squares_ ()[typename ].T
99+ )
99100 else :
100101 self .a = get_squares_ ()[typename ]
101102
@@ -111,37 +112,38 @@ def time_op(self, np, op, typename):
111112
112113class Lstsq (Benchmark ):
113114 params = [dpnp , numpy ]
114- param_names = [' executor' ]
115+ param_names = [" executor" ]
115116
116117 def setup (self , np ):
117- self .a = get_squares_ ()[' float64' ]
118+ self .a = get_squares_ ()[" float64" ]
118119 self .b = get_indexes_rand ()[:100 ].astype (np .float64 )
119120
120121 def time_numpy_linalg_lstsq_a__b_float64 (self , np ):
121122 np .linalg .lstsq (self .a , self .b , rcond = - 1 )
122123
124+
123125# class Einsum(Benchmark):
124- # param_names = ['dtype']
125- # params = [[np.float64]]
126- # def setup(self, dtype):
127- # self.a = np.arange(2900, dtype=dtype)
128- # self.b = np.arange(3000, dtype=dtype)
129- # self.c = np.arange(24000, dtype=dtype).reshape(20, 30, 40)
130- # self.c1 = np.arange(1200, dtype=dtype).reshape(30, 40)
131- # self.d = np.arange(10000, dtype=dtype).reshape(10,100,10)
132-
133- # #outer(a,b): trigger sum_of_products_contig_stride0_outcontig_two
134- # def time_einsum_outer(self, dtype):
135- # np.einsum("i,j", self.a, self.b, optimize=True)
136-
137- # # multiply(a, b):trigger sum_of_products_contig_two
138- # def time_einsum_multiply(self, dtype):
139- # np.einsum("..., ...", self.c1, self.c , optimize=True)
140-
141- # # sum and multiply:trigger sum_of_products_contig_stride0_outstride0_two
142- # def time_einsum_sum_mul(self, dtype):
143- # np.einsum(",i...->", 300, self.d, optimize=True)
144-
145- # # sum and multiply:trigger sum_of_products_stride0_contig_outstride0_two
146- # def time_einsum_sum_mul2(self, dtype):
147- # np.einsum("i...,->", self.d, 300, optimize=True)
126+ # param_names = ['dtype']
127+ # params = [[np.float64]]
128+ # def setup(self, dtype):
129+ # self.a = np.arange(2900, dtype=dtype)
130+ # self.b = np.arange(3000, dtype=dtype)
131+ # self.c = np.arange(24000, dtype=dtype).reshape(20, 30, 40)
132+ # self.c1 = np.arange(1200, dtype=dtype).reshape(30, 40)
133+ # self.d = np.arange(10000, dtype=dtype).reshape(10,100,10)
134+
135+ # #outer(a,b): trigger sum_of_products_contig_stride0_outcontig_two
136+ # def time_einsum_outer(self, dtype):
137+ # np.einsum("i,j", self.a, self.b, optimize=True)
138+
139+ # # multiply(a, b):trigger sum_of_products_contig_two
140+ # def time_einsum_multiply(self, dtype):
141+ # np.einsum("..., ...", self.c1, self.c , optimize=True)
142+
143+ # # sum and multiply:trigger sum_of_products_contig_stride0_outstride0_two
144+ # def time_einsum_sum_mul(self, dtype):
145+ # np.einsum(",i...->", 300, self.d, optimize=True)
146+
147+ # # sum and multiply:trigger sum_of_products_stride0_contig_outstride0_two
148+ # def time_einsum_sum_mul2(self, dtype):
149+ # np.einsum("i...,->", self.d, 300, optimize=True)
0 commit comments