• 18.cuBLAS开发指南中文版--cuBLAS中的Level-2函数gbmv()


    2.6. cuBLAS Level-2 函数参考

    在本章中,我们将描述执行矩阵向量运算的 Level-2 基本线性代数子程序 (BLAS2) 函数。
    在这里插入图片描述

    2.6.1. cublasgbmv()

    cublasStatus_t cublasSgbmv(cublasHandle_t handle, cublasOperation_t trans,
                               int m, int n, int kl, int ku,
                               const float           *alpha,
                               const float           *A, int lda,
                               const float           *x, int incx,
                               const float           *beta,
                               float           *y, int incy)
    cublasStatus_t cublasDgbmv(cublasHandle_t handle, cublasOperation_t trans,
                               int m, int n, int kl, int ku,
                               const double          *alpha,
                               const double          *A, int lda,
                               const double          *x, int incx,
                               const double          *beta,
                               double          *y, int incy)
    cublasStatus_t cublasCgbmv(cublasHandle_t handle, cublasOperation_t trans,
                               int m, int n, int kl, int ku,
                               const cuComplex       *alpha,
                               const cuComplex       *A, int lda,
                               const cuComplex       *x, int incx,
                               const cuComplex       *beta,
                               cuComplex       *y, int incy)
    cublasStatus_t cublasZgbmv(cublasHandle_t handle, cublasOperation_t trans,
                               int m, int n, int kl, int ku,
                               const cuDoubleComplex *alpha,
                               const cuDoubleComplex *A, int lda,
                               const cuDoubleComplex *x, int incx,
                               const cuDoubleComplex *beta,
                               cuDoubleComplex *y, int incy)
    
    • 1
    • 2
    • 3
    • 4
    • 5
    • 6
    • 7
    • 8
    • 9
    • 10
    • 11
    • 12
    • 13
    • 14
    • 15
    • 16
    • 17
    • 18
    • 19
    • 20
    • 21
    • 22
    • 23
    • 24
    • 25
    • 26
    • 27
    • 28

    此函数执行带状矩阵向量乘法

    y = α o p ( A ) x + β y y=\alpha op(A)x + \beta y y=αop(A)x+βy

    其中 A 是具有 kl 次对角线和 ku 超对角线的带状矩阵,x 和 y 是向量, α \alpha α β \beta β 是标量。 此外,对于矩阵 A:

    o p ( A ) = { A     如果 t r a n s a = = C U B L A S O P N , A T   如果 t r a n s a = = C U B L A S O P T , A H   如果 t r a n s a = = C U B L A S O P H op(A)=

    A    transa==CUBLASOPN,AT  transa==CUBLASOPT,AH  transa==CUBLASOPH
    op(A)= A    如果transa==CUBLASOPN,AT  如果transa==CUBLASOPT,AH  如果transa==CUBLASOPH

    带状矩阵 A 逐列存储,主对角线存储在 ku+1 行(从第一个位置开始),第一个上对角线存储在 ku 行(从第二个位置开始),第一个子对角线存储在 ku+2 行 (从第一个位置开始)等等。所以一般来说,元素 A(i,j) 存储在内存位置 A(ku+1+i-j,j) 中,因为 j=1,…,n 和 i ∈ [ m a x ( 1 , j − k u ) , m i n ( m , j + k l ) ] i\in[max(1,j-ku), min(m, j+kl)] i[max(1,jku),min(m,j+kl)] . 此外,数组 A 中的元素在概念上不对应于带状矩阵中的元素(左上角 ku * ku 和右下角 kl *kl 三角形)不被引用。

    Param.MemoryIn/outMeaning
    handleinputhandle to the cuBLAS library context.
    transinputoperation op(A) that is non- or (conj.) transpose.
    minputnumber of rows of matrix A.
    ninputnumber of columns of matrix A.
    klinputnumber of subdiagonals of matrix A.
    kuinputnumber of superdiagonals of matrix A.
    alphahost or deviceinput scalar used for multiplication.
    Adeviceinput array of dimension lda x n with lda>=kl+ku+1.
    ldainputleading dimension of two-dimensional array used to store matrix A.
    xdeviceinput vector with n elements if transa == CUBLAS_OP_N and m elements otherwise.
    incxinputstride between consecutive elements of x.
    betahost or deviceinput scalar used for multiplication, if beta == 0 then y does not have to be a valid input.
    ydevicein/out vector with m elements if transa == CUBLAS_OP_N and n elements otherwise.
    incyinputstride between consecutive elements of y.

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

    Error Value Meaning

    CUBLAS_STATUS_SUCCESS

    操作成功完成

    CUBLAS_STATUS_NOT_INITIALIZED

    库未初始化

    CUBLAS_STATUS_INVALID_VALUE

    • If m, n, kl, ku < 0 or

    • if lda < (kl+ku+1) or

    • if incx, incy == 0 or

    • if trans != CUBLAS_OP_N, CUBLAS_OP_T, CUBLAS_OP_C or

    • alpha, beta == NULL

    CUBLAS_STATUS_EXECUTION_FAILED

    该功能无法在 GPU 上启动

    请参考:
    sgbmv, dgbmv, cgbmv, zgbmv

  • 相关阅读:
    快速拿下 AI Prompt 工程师证书攻略!
    mysql8.0从安装部署到使用
    docker网络和模式
    (附源码)springboot小型仪器公司生产管理系统 毕业设计 031853
    黑马程序员Docker快速入门到项目部署(学习笔记)
    ceph报错总结
    固定VMware中Linux系统的ip地址
    使用大卫的k8s监控面板(k8s+prometheus+grafana)
    java计算机毕业设计springboot+vue青少年编程在线考试系统
    oppo r11 升级8.1系统 图文教程
  • 原文地址:https://blog.csdn.net/kunhe0512/article/details/126324820