当前位置:网站首页>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 上启动 |
请参考:
边栏推荐
猜你喜欢
随机推荐
tianchi过往方法
音频基础学习——声音的本质、术语与特性
激光器如何养护才能远离结露没烦恼
处理XML,dom4j的简单使用
NC84 完全二叉树结点数
pytest 之 重运行机制与测试报告
问题系列-如何修改或更新localhost里的值
FFmpeg av_interleaved_write_frame错误
Q_04_07 进一步探索
Sql之各种Join
pytest 之 fixture参数化
蓝桥历届真题-跑步锻炼
2个有序数组排序
【面试高频题】可逐步优化的链表高频题
The sword refers to Offer 56 - II. Number of occurrences of a number in an array II (bit operation)
RobotFramework 之 库与关键字
Oracle Recovery Tools修复空闲坏块
FFmpeg multimedia file processing (ffmpeg prints audio and video Meta information)
Q_04_04 Q#类型模型
客户端连接rtsp的步骤









