skcuda.cublas.cublasScopy¶
-
skcuda.cublas.
cublasScopy
(handle, n, x, incx, y, incy)[source]¶ Vector copy (single precision real)
Copies a single precision real vector to another single precision real vector.
Parameters: - handle (int) – CUBLAS context.
- n (int) – Number of elements in input vectors.
- x (ctypes.c_void_p) – Pointer to single precision real input vector.
- incx (int) – Storage spacing between elements of x.
- y (ctypes.c_void_p) – Pointer to single precision real output vector.
- incy (int) – Storage spacing between elements of y.
Examples
>>> import pycuda.autoinit >>> import pycuda.gpuarray as gpuarray >>> import numpy as np >>> x = np.random.rand(5).astype(np.float32) >>> x_gpu = gpuarray.to_gpu(x) >>> y_gpu = gpuarray.zeros_like(x_gpu) >>> h = cublasCreate() >>> cublasScopy(h, x_gpu.size, x_gpu.gpudata, 1, y_gpu.gpudata, 1) >>> cublasDestroy(h) >>> np.allclose(y_gpu.get(), x_gpu.get()) True
Notes
Both x and y must contain n elements.
References