当前位置:网站首页>12.cuBLAS开发指南中文版--cuBLAS中的Level-1函数asum()和axpy()
12.cuBLAS开发指南中文版--cuBLAS中的Level-1函数asum()和axpy()
2022-08-09 13:14:00 【扫地的小何尚】
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)
此函数计算向量 x 的元素的绝对值之和。 因此,结果是 ∑ 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)
此函数将向量 x 乘以标量并将其添加到向量 y 中,并用结果覆盖最新的向量。 因此,对 i = 1 , … , n 、 k = 1 + ( i - 1 ) * incx 和 j = 1 + ( i - 1 ) * incy 执行的操作是 y [ j ] = α × x [ k ] + y [ j ]。 请注意,最后两个等式反映了用于与 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 上启动 |
请参考:
边栏推荐
- 自己做了个nodejs+epxress+mysql的小项目,怎么才能让别人通过互联网访问呢?
- pytest 基础认知
- 面试攻略系列(四)-- 你不知道的大厂面试
- FFmpeg multimedia file processing (ffmpeg prints audio and video Meta information)
- JS轮播图实现
- pyautogui的简单操作(1)
- Oracle Recovery Tools修复空闲坏块
- Professor Chen Qiang the machine learning and R application course chapter 18 assignments
- Realization of RTSP Protocol
- Professor Chen Qiang "application in machine learning and R" course chapter 17
猜你喜欢
随机推荐
NC40 链表相加(二)
CutefishOS系统默认自动桌面壁纸
群组行动控制--自动队列化实现策略
Q_04_05 使用Qubits
蓝桥历届真题-门牌制作
group by的工作原理和优化思路
NC96 判断一个链表是否为回文结构
常用函数
tensorflow图片编码处理基础
FFmpeg multimedia file processing (implementation of ffmpeg operation directory and list)
Final assignment of R language data analysis in a university
自己做了个nodejs+epxress+mysql的小项目,怎么才能让别人通过互联网访问呢?
LeetCode 37. Solve Sudoku
蓝桥历届真题-蛇形填数
Q_06_03 表达式
RobotFramework 之 数据驱动
mmdetction
render解析
【NVIDIA】Tesla V100安装NVIDIA-Driver驱动程序适配CUDA-Toolkit-11.6
问题系列-如何修改或更新localhost里的值