示例#1
0
 def test_cublasSrot(self):
     x = np.array([1, 2, 3]).astype(np.float32)
     y = np.array([4, 5, 6]).astype(np.float32)
     s = 2.0
     c = 3.0
     x_gpu = gpuarray.to_gpu(x)
     y_gpu = gpuarray.to_gpu(x)
     cublas.cublasSrot(self.cublas_handle, x_gpu.size, x_gpu.gpudata, 1,
                       y_gpu.gpudata, 1, c, s)
     assert np.allclose(x_gpu.get(), [5, 10, 15])
     assert np.allclose(y_gpu.get(), [1, 2, 3])
示例#2
0
 def test_cublasSrot(self):
     x = np.array([1, 2, 3]).astype(np.float32)
     y = np.array([4, 5, 6]).astype(np.float32)
     s = 2.0
     c = 3.0
     x_gpu = gpuarray.to_gpu(x)
     y_gpu = gpuarray.to_gpu(x)
     cublas.cublasSrot(self.cublas_handle, x_gpu.size,
                       x_gpu.gpudata, 1,
                       y_gpu.gpudata, 1,
                       c, s)
     assert np.allclose(x_gpu.get(), [5, 10, 15])
     assert np.allclose(y_gpu.get(), [1, 2, 3])