def test_cublasXtCgemm(self):
     a = (np.random.rand(4, 4)+1j*np.random.rand(4, 4)).astype(np.complex128)
     b = (np.random.rand(4, 4)+1j*np.random.rand(4, 4)).astype(np.complex128)
     c = np.zeros((4, 4), np.complex128)
     
     cublasxt.cublasXtCgemm(self.handle, cublasxt._CUBLAS_OP['N'],
                            cublasxt._CUBLAS_OP['N'], 4, 4, 4, np.complex128(1.0),
                            a.ctypes.data, 4, b.ctypes.data, 4, np.complex128(0.0),
                            c.ctypes.data, 4)
     np.allclose(np.dot(b.T, a.T).T, c)
Beispiel #2
0
 def test_cublasXtCgemm(self):
     a = (np.random.rand(4, 4)+1j*np.random.rand(4, 4)).astype(np.complex128)
     b = (np.random.rand(4, 4)+1j*np.random.rand(4, 4)).astype(np.complex128)
     c = np.zeros((4, 4), np.complex128)
     
     cublasxt.cublasXtCgemm(self.handle,
                            'N', 'N', 4, 4, 4,           
                            np.complex128(1.0),
                            a.ctypes.data, 4, b.ctypes.data, 4, np.complex128(0.0),
                            c.ctypes.data, 4)
     np.allclose(np.dot(b.T, a.T).T, c)
 def test_cublasXtCgemm(self):
     a = (np.random.rand(4, 4)+1j*np.random.rand(4, 4)).astype(np.complex128)
     b = (np.random.rand(4, 4)+1j*np.random.rand(4, 4)).astype(np.complex128)
     c = np.zeros((4, 4), np.complex128)
     
     cublasxt.cublasXtDeviceSelect(handle, 2, np.array([0, 1], np.int32).ctypes.data)
     cublasxt.cublasXtCgemm(self.handle, cublasxt._CUBLAS_OP['N'],
                            cublasxt._CUBLAS_OP['N'], 4, 4, 4, np.complex128(1.0),
                            a.ctypes.data, 4, b.ctypes.data, 4, np.complex128(0.0),
                            c.ctypes.data, 4)
     np.allclose(np.dot(b.T, a.T).T, c)