当前位置:网站首页>12. cuBLAS Development Guide Chinese version--Level-1 functions asum() and axpy() in cuBLAS
12. cuBLAS Development Guide Chinese version--Level-1 functions asum() and axpy() in cuBLAS
2022-08-09 14:19:00 【Little He Shang who sweeps the floor】
cuBLAS中的Level-1函数asum()和axpy()
2.5.3. cublas<t>asum()
cublasStatus_t cublasSasum(cublasHandle_t handle, int n,
const float *x, int incx, float *result)
cublasStatus_t cublasDasum(cublasHandle_t handle, int n,
const double *x, int incx, double *result)
cublasStatus_t cublasScasum(cublasHandle_t handle, int n,
const cuComplex *x, int incx, float *result)
cublasStatus_t cublasDzasum(cublasHandle_t handle, int n,
const cuDoubleComplex *x, int incx, double *result)
This function computes a vector x The sum of the absolute values of the elements of . 因此,结果是 ∑ i = 1 n | I m ( x [ j ] ) | + | R e ( x [ j ] ) | 其中 j = 1 + ( i - 1 ) * incx . 请注意,最后一个等式反映了用于与 Fortran 兼容的基于 1 的索引.
Param. | Memory | In/out | Meaning |
---|---|---|---|
handle | input | handle to the cuBLAS library context. | |
n | input | number of elements in the vector x. | |
x | device | input | <type> vector with elements. |
incx | input | stride between consecutive elements of x. | |
result | host or device | output | the resulting index, which is 0.0 if n,incx<=0 |
该函数可能返回的错误值及其含义如下所列.
Error Value | Meaning |
---|---|
CUBLAS_STATUS_SUCCESS | 操作成功完成 |
CUBLAS_STATUS_NOT_INITIALIZED | 库未初始化 |
CUBLAS_STATUS_ALLOC_FAILED | 无法分配缩减缓冲区 |
CUBLAS_STATUS_EXECUTION_FAILED | 该功能无法在 GPU 上启动 |
请参考:
2.5.4. cublas<t>axpy()
cublasStatus_t cublasSaxpy(cublasHandle_t handle, int n,
const float *alpha,
const float *x, int incx,
float *y, int incy)
cublasStatus_t cublasDaxpy(cublasHandle_t handle, int n,
const double *alpha,
const double *x, int incx,
double *y, int incy)
cublasStatus_t cublasCaxpy(cublasHandle_t handle, int n,
const cuComplex *alpha,
const cuComplex *x, int incx,
cuComplex *y, int incy)
cublasStatus_t cublasZaxpy(cublasHandle_t handle, int n,
const cuDoubleComplex *alpha,
const cuDoubleComplex *x, int incx,
cuDoubleComplex *y, int incy)
This function converts the vector x Multiply a scalar and add it to a vector y 中,and overwrite the latest vector with the result. 因此,对 i = 1 , … , n 、 k = 1 + ( i - 1 ) * incx 和 j = 1 + ( i - 1 ) * incy 执行的操作是 y [ j ] = α × x [ k ] + y [ j ]. 请注意,The last two equations reflect that for AND Fortran 兼容的基于 1 的索引.
Param. | Memory | In/out | Meaning |
---|---|---|---|
handle | input | handle to the cuBLAS library context. | |
alpha | host or device | input | <type> scalar used for multiplication. |
n | input | number of elements in the vector x. | |
x | device | input | <type> vector with n elements. |
incx | input | stride between consecutive elements of x. | |
y | device | in/out | <type> vector with n elements. |
incy | input | stride between consecutive elements of y. |
Error Value | Meaning |
---|---|
CUBLAS_STATUS_SUCCESS | 操作成功完成 |
CUBLAS_STATUS_NOT_INITIALIZED | 库未初始化 |
CUBLAS_STATUS_ALLOC_FAILED | 无法分配缩减缓冲区 |
CUBLAS_STATUS_EXECUTION_FAILED | 该功能无法在 GPU 上启动 |
请参考:
边栏推荐
猜你喜欢
随机推荐
RobotFramework 之 条件判断
关于做2D游戏时,Canvas边界显示在Game窗口的问题
华为ensp静态路由、DHCP
IDEA Gradle 常遇问题(二)(持续更新)
openharmony容器组件之Row
VNet
JS本地存储 sessionStorage和localStorage
FFmpeg长时间无响应的解决方法
技嘉显卡 RGBFusion 不能调光解决方法
WPF 系统托盘 图标闪烁
NC84 完全二叉树结点数
海康设备获取YV12图像-不用rtsp
用asp.net基于C#编写简单登录注册界面(访问数据库)
一篇ngork直接使用
客户端连接rtsp的步骤
Q_06_02 类型模型
C#使用cersharp
二叉树的遍历(py)
开源一夏│别逗,作为程序员你竟还没参与过开源项目?
Counter of openharmony container components