• 11.cuBLAS开发指南中文版--cuBLAS中的Level-1函数amax()和amin()


    2.5. cuBLAS Level-1 Function Reference

    在本章中,我们描述了执行基于标量和向量的运算的 Level-1 基本线性代数子程序 (BLAS1) 函数。 我们将使用缩写 表示类型,使用 表示相应的短类型,以更简洁明了地表示实现的功能。 除非另有说明, 的含义如下:

    在这里插入图片描述

    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

    当函数的参数和返回值不同时,有时会出现复杂的输入,也可以有以下含义“Sc”、“Cs”、“Dz”和“Zd”。

    缩写 Re(.) 和 Im(.) 将分别代表数字的实部和虚部。 由于实数的虚部不存在,我们将其视为零,通常可以简单地将其从使用它的方程中丢弃。 此外,α ̄ 将表示 α的复共轭。

    一般来说,在整个文档中,小写希腊符号α 和 β 将表示标量,以粗体表示的小写英文字母 x 和 y,将表示向量和大写英文字母A, B和C,并将表示矩阵。

    2.5.1. cublasIamax()

    此函数查找最大元素的(最小)索引。 因此,| I m ( x [ j ] ) | + | R e ( x [ j ] ) | 结果是第一个对于 i = 1 , … , n 和 j = 1 + ( i - 1 ) * incx 最大的结果。 请注意,最后一个等式反映了用于与 Fortran 兼容的基于 1 的索引。

    Param.MemoryIn/outMeaning
    handleinputhandle to the cuBLAS library context.
    ninputnumber of elements in the vector x.
    xdeviceinput vector with elements.
    incxinputstride between consecutive elements of x.
    resulthost or deviceoutputthe resulting index, which is 0 if n,incx<=0

    该函数可能返回的错误值及其含义如下所列。

    Error ValueMeaning
    CUBLAS_STATUS_SUCCESS操作成功完成
    CUBLAS_STATUS_NOT_INITIALIZED库未初始化
    CUBLAS_STATUS_ALLOC_FAILED无法分配缩减缓冲区
    CUBLAS_STATUS_EXECUTION_FAILED该功能无法在 GPU 上启动

    请参考:

    isamax, idamax, icamax, izamax

    2.5.2. cublasIamin()

    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)
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8

    此函数查找最小元素的(最小)索引。 因此,| I m ( x [ j ] ) | + | R e ( x [ j ] ) | 结果是第一个对于 i = 1 , … , n 和 j = 1 + ( i - 1 ) * incx 最小的结果。 请注意,最后一个等式反映了用于与 Fortran 兼容的基于 1 的索引。

    Param.MemoryIn/outMeaning
    handleinputhandle to the cuBLAS library context.
    ninputnumber of elements in the vector x.
    xdeviceinput vector with elements.
    incxinputstride between consecutive elements of x.
    resulthost or deviceoutputthe resulting index, which is 0 if n,incx<=0

    该函数可能返回的错误值及其含义如下所列。

    Error ValueMeaning
    CUBLAS_STATUS_SUCCESS操作成功完成
    CUBLAS_STATUS_NOT_INITIALIZED库未初始化
    CUBLAS_STATUS_ALLOC_FAILED无法分配缩减缓冲区
    CUBLAS_STATUS_EXECUTION_FAILED该功能无法在 GPU 上启动

    请参考:

    isamin

  • 相关阅读:
    Unreal Engine游戏引擎的优势
    工作经验总结:单片机中简易时间片轮询的结构设计
    2024.4.19作业
    JVM参数优化
    浮点数计算精度问题decimal.js
    Java单链表
    顺序表和链表
    提升手机拍摄能力以满足用户社交需求,是个伪命题?
    CSS accent-color + 自己封装 radio
    Linux 文件操作接口
  • 原文地址:https://blog.csdn.net/kunhe0512/article/details/126243285