当前位置:网站首页>11.cuBLAS开发指南中文版--cuBLAS中的Level-1函数amax()和amin()
11.cuBLAS开发指南中文版--cuBLAS中的Level-1函数amax()和amin()
2022-08-09 13:14:00 【扫地的小何尚】
2.5. cuBLAS Level-1 Function Reference
在本章中,我们描述了执行基于标量和向量的运算的 Level-1 基本线性代数子程序 (BLAS1) 函数。 我们将使用缩写 <type>
表示类型,使用 <t>
表示相应的短类型,以更简洁明了地表示实现的功能。 除非另有说明,<type>
和 <t>
的含义如下:
<type> | <t> | Meaning |
---|---|---|
float | ‘s’ or ‘S’ | real single-precision |
double | ‘d’ or ‘D’ | real double-precision |
cuComplex | ‘c’ or ‘C’ | complex single-precision |
cuDoubleComplex | ‘z’ or ‘Z’ | complex double-precision |
当函数的参数和返回值不同时,有时会出现复杂的输入,<t>
也可以有以下含义“Sc”、“Cs”、“Dz”和“Zd”。
缩写 Re(.) 和 Im(.) 将分别代表数字的实部和虚部。 由于实数的虚部不存在,我们将其视为零,通常可以简单地将其从使用它的方程中丢弃。 此外,α ̄ 将表示 α的复共轭。
一般来说,在整个文档中,小写希腊符号α 和 β 将表示标量,以粗体表示的小写英文字母 x 和 y,将表示向量和大写英文字母A, B和C,并将表示矩阵。
2.5.1. cublasI<t>amax()
此函数查找最大元素的(最小)索引。 因此,| I m ( x [ j ] ) | + | R e ( x [ j ] ) | 结果是第一个对于 i = 1 , … , n 和 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 if n,incx<=0 |
该函数可能返回的错误值及其含义如下所列。
Error Value | Meaning |
---|---|
CUBLAS_STATUS_SUCCESS | 操作成功完成 |
CUBLAS_STATUS_NOT_INITIALIZED | 库未初始化 |
CUBLAS_STATUS_ALLOC_FAILED | 无法分配缩减缓冲区 |
CUBLAS_STATUS_EXECUTION_FAILED | 该功能无法在 GPU 上启动 |
请参考:
isamax, idamax, icamax, izamax
2.5.2. cublasI<t>amin()
cublasStatus_t cublasIsamin(cublasHandle_t handle, int n,
const float *x, int incx, int *result)
cublasStatus_t cublasIdamin(cublasHandle_t handle, int n,
const double *x, int incx, int *result)
cublasStatus_t cublasIcamin(cublasHandle_t handle, int n,
const cuComplex *x, int incx, int *result)
cublasStatus_t cublasIzamin(cublasHandle_t handle, int n,
const cuDoubleComplex *x, int incx, int *result)
此函数查找最小元素的(最小)索引。 因此,| I m ( x [ j ] ) | + | R e ( x [ j ] ) | 结果是第一个对于 i = 1 , … , n 和 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 if n,incx<=0 |
该函数可能返回的错误值及其含义如下所列。
Error Value | Meaning |
---|---|
CUBLAS_STATUS_SUCCESS | 操作成功完成 |
CUBLAS_STATUS_NOT_INITIALIZED | 库未初始化 |
CUBLAS_STATUS_ALLOC_FAILED | 无法分配缩减缓冲区 |
CUBLAS_STATUS_EXECUTION_FAILED | 该功能无法在 GPU 上启动 |
请参考:
边栏推荐
猜你喜欢
随机推荐
pytest 与 unittest 的区别
机器学习web服务化实战:一次吐血的服务化之路 (转载非原创)
自己做了个nodejs+epxress+mysql的小项目,怎么才能让别人通过互联网访问呢?
现在40系显卡都快出来了,为何1060型号的显卡还有这么多人用?
TCP三次握手和四次挥手及拥塞控制
RobotFramework 之 用户关键字
opencv-matchTemplate 之使用场景为大图里面找小图
pytest 之 fixture参数化
【瑞吉外卖】day05:增、删、改、查分类以及公共字段自动填充
JS轮播图实现
学习opencv-基础应用
GIN Bind mode to get parameters and form validation
tkiner组件之滚动文本框(scrolledtext )相关操作
处理XML,dom4j的简单使用
分布式系统关注点(8)——99%的人都能看懂的「熔断」以及最佳实践 (转载非原创)
激光器如何养护才能远离结露没烦恼
FFmpeg相机花屏花图问题解决方法
Deep Learning Based on R Language - Simple Regression Case
Q_06_04 语句和其他构造
Q_04_05 使用Qubits