Beispiel #1
0
 def test_cublasDcopy(self):
     x = np.random.rand(5).astype(np.float64)
     x_gpu = gpuarray.to_gpu(x)
     y_gpu = gpuarray.zeros_like(x_gpu)
     cublas.cublasDcopy(self.cublas_handle, x_gpu.size, x_gpu.gpudata, 1,
                        y_gpu.gpudata, 1)
     assert np.allclose(y_gpu.get(), x_gpu.get())
Beispiel #2
0
 def fun_b_k(self, b_k_gpu, k):
     cublas.cublasDcopy(self.h, self.b_gpu.size, self.b_gpu.gpudata, 1,
                        b_k_gpu.gpudata, 1)
     for i in range(len(self.Ax_gpu)):
         if i != k:
             cublas.cublasDaxpy(self.h, b_k_gpu.size, np.float64(-1),
                                self.Ax_gpu[i].gpudata, 1, b_k_gpu.gpudata,
                                1)
Beispiel #3
0
 def _zaxpy(self, handle, z_gpu, alpha, x_gpu, y_gpu):
     # copy y to z
     cublas.cublasDcopy(handle, y_gpu.size, y_gpu.gpudata, 1, z_gpu.gpudata,
                        1)
     cublas.cublasDaxpy(handle, x_gpu.size, alpha, x_gpu.gpudata, 1,
                        z_gpu.gpudata, 1)