def test_cublasDgeam(self): a = np.random.rand(2, 3).astype(np.float64) b = np.random.rand(2, 3).astype(np.float64) a_gpu = gpuarray.to_gpu(a.copy()) b_gpu = gpuarray.to_gpu(b.copy()) c_gpu = gpuarray.zeros_like(a_gpu) alpha = np.float64(np.random.rand()) beta = np.float64(np.random.rand()) cublas.cublasDgeam(self.cublas_handle, 'n', 'n', 2, 3, alpha, a_gpu.gpudata, 2, beta, b_gpu.gpudata, 2, c_gpu.gpudata, 2) assert np.allclose(c_gpu.get(), alpha * a + beta * b)
def test_cublasDgeam(self): a = np.random.rand(2, 3).astype(np.float64) b = np.random.rand(2, 3).astype(np.float64) a_gpu = gpuarray.to_gpu(a.copy()) b_gpu = gpuarray.to_gpu(b.copy()) c_gpu = gpuarray.zeros_like(a_gpu) alpha = np.float64(np.random.rand()) beta = np.float64(np.random.rand()) cublas.cublasDgeam(self.cublas_handle, 'n', 'n', 2, 3, alpha, a_gpu.gpudata, 2, beta, b_gpu.gpudata, 2, c_gpu.gpudata, 2) assert np.allclose(c_gpu.get(), alpha*a+beta*b)