skcuda.cublas.cublasDscal¶
-
skcuda.cublas.
cublasDscal
(handle, n, alpha, x, incx)[source]¶ Scale a double precision real vector by a double precision real scalar.
Replaces a double precision real vector x with alpha * x.
Parameters: - handle (int) – CUBLAS context.
- n (int) – Number of elements in input vectors.
- alpha (numpy.float64) – Scalar multiplier.
- x (ctypes.c_void_p) – Pointer to double precision real input/output vector.
- incx (int) – Storage spacing between elements of x.
Examples
>>> import pycuda.autoinit >>> import pycuda.gpuarray as gpuarray >>> import numpy as np >>> x = np.random.rand(5).astype(np.float64) >>> x_gpu = gpuarray.to_gpu(x) >>> alpha = np.float64(np.random.rand()) >>> h = cublasCreate() >>> cublasDscal(h, x.size, alpha, x_gpu.gpudata, 1) >>> cublasDestroy(h) >>> np.allclose(x_gpu.get(), alpha*x) True
References