#NEWLINE# def test_cublasZgemmBatched( self ) : #NEWLINE# #INDENT# ( l , m , k , n ) = ( 11 , 7 , 5 , 3 ) #NEWLINE# A = ( np . random . rand ( l , m , k ) + ( 1j * np . random . rand ( l , m , k ) ) ) . astype ( np . complex128 ) #NEWLINE# B = ( np . random . rand ( l , k , n ) + ( 1j * np . random . rand ( l , k , n ) ) ) . astype ( np . complex128 ) #NEWLINE# C_res = np . einsum ( 'nij,njk->nik' , A , B ) #NEWLINE# a_gpu = gpuarray . to_gpu ( A ) #NEWLINE# b_gpu = gpuarray . to_gpu ( B ) #NEWLINE# c_gpu = gpuarray . empty ( ( l , m , n ) , np . complex128 ) #NEWLINE# alpha = np . complex128 ( 1.0 ) #NEWLINE# beta = np . complex128 ( 0.0 ) #NEWLINE# a_arr = bptrs ( a_gpu ) #NEWLINE# b_arr = bptrs ( b_gpu ) #NEWLINE# c_arr = bptrs ( c_gpu ) #NEWLINE# cublas . cublasZgemmBatched ( self . cublas_handle , 'n' , 'n' , n , m , k , alpha , b_arr . gpudata , n , a_arr . gpudata , k , beta , c_arr . gpudata , n , l ) #NEWLINE# assert np . allclose ( C_res , c_gpu . get ( ) )