hipsparsescsrgemm2 Interface Reference

hipsparsescsrgemm2 Interface Reference#

HIPFORT API Reference: hipfort_hipsparse::hipsparsescsrgemm2 Interface Reference
hipfort_hipsparse::hipsparsescsrgemm2 Interface Reference

Sparse matrix and sparse matrix multiplication using CSR storage format. More...

Public Member Functions

integer(kind(hipsparse_status_success)) function hipsparsescsrgemm2_ (handle, m, n, k, alpha, descra, nnza, csrvala, csrrowptra, csrcolinda, descrb, nnzb, csrvalb, csrrowptrb, csrcolindb, beta, descrd, nnzd, csrvald, csrrowptrd, csrcolindd, descrc, csrvalc, csrrowptrc, csrcolindc, myinfo, pbuffer)
 
integer(kind(hipsparse_status_success)) function hipsparsescsrgemm2_rank_0 (handle, m, n, k, alpha, descra, nnza, csrvala, csrrowptra, csrcolinda, descrb, nnzb, csrvalb, csrrowptrb, csrcolindb, beta, descrd, nnzd, csrvald, csrrowptrd, csrcolindd, descrc, csrvalc, csrrowptrc, csrcolindc, myinfo, pbuffer)
 
integer(kind(hipsparse_status_success)) function hipsparsescsrgemm2_rank_1 (handle, m, n, k, alpha, descra, nnza, csrvala, csrrowptra, csrcolinda, descrb, nnzb, csrvalb, csrrowptrb, csrcolindb, beta, descrd, nnzd, csrvald, csrrowptrd, csrcolindd, descrc, csrvalc, csrrowptrc, csrcolindc, myinfo, pbuffer)
 

Detailed Description

Sparse matrix and sparse matrix multiplication using CSR storage format.

hipsparseXcsrgemm2 multiplies the scalar \(\alpha\) with the sparse \(m \times k\) matrix \(A\), defined in CSR storage format, and the sparse \(k \times n\) matrix \(B\), defined in CSR storage format, and adds the result to the sparse \(m \times n\) matrix \(D\) that is multiplied by \(\beta\). The final result is stored in the sparse \(m \times n\) matrix \(C\), defined in CSR storage format, such that

\[ C := \alpha \cdot A \cdot B + \beta \cdot D \]

This computation involves a multi-step process. First, the user must call hipsparseScsrgemm2_bufferSizeExt "hipsparseXcsrgemm2_bufferSizeExt()" to determine the required user-allocated temporary buffer size. The user then allocates this buffer and also allocates csrRowPtrC to have size m+1. Both the temporary storage buffer and csrRowPtrC array are then passed to hipsparseXcsrgemm2Nnz, which fills in the csrRowPtrC array and computes the total number of nonzeros in \(C\), nnzC. The user then allocates both arrays csrColIndC and csrValC to have size nnzC and calls hipsparseXcsrgemm2 to complete the computation. The desired index base in the output CSR matrix \(C\) is set in the hipsparseMatDescr_t descrC. See hipsparseSetMatIndexBase ().

Note
If \(\alpha == 0\), then \(C = \beta \cdot D\) will be computed.
If \(\beta == 0\), then \(C = \alpha \cdot A \cdot B\) will be computed.
\(\alpha == beta == 0\) is invalid.
Currently, only HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
This function is non-blocking and executed asynchronously with respect to the host. It can return before the actual computation has finished.
For matrix products with more than 4096 non-zero entries per row, an additional temporary storage buffer is allocated by the algorithm.
Parameters
[in]handle- handle to the hipSPARSE library context queue.
[in]m- number of rows of the sparse CSR matrix \(op(A)\) and \(C\).
[in]n- number of columns of the sparse CSR matrix \(op(B)\) and \(C\).
[in]k- number of columns of the sparse CSR matrix \(op(A)\) and number of rows of the sparse CSR matrix \(op(B)\).
[in]alpha- scalar \(\alpha\).
[in]descrA- descriptor of the sparse CSR matrix \(A\). Currently, only HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
[in]nnzA- number of non-zero entries of the sparse CSR matrix \(A\).
[in]csrValA- array of nnzA elements of the sparse CSR matrix \(A\).
[in]csrRowPtrA- array of m+1 elements ( \(op(A) == A\), k+1 otherwise) that point to the start of every row of the sparse CSR matrix \(op(A)\).
[in]csrColIndA- array of nnzA elements containing the column indices of the sparse CSR matrix \(A\).
[in]descrB- descriptor of the sparse CSR matrix \(B\). Currently, only HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
[in]nnzB- number of non-zero entries of the sparse CSR matrix \(B\).
[in]csrValB- array of nnzB elements of the sparse CSR matrix \(B\).
[in]csrRowPtrB- array of k+1 elements ( \(op(B) == B\), m+1 otherwise) that point to the start of every row of the sparse CSR matrix \(op(B)\).
[in]csrColIndB- array of nnzB elements containing the column indices of the sparse CSR matrix \(B\).
[in]beta- scalar \(\beta\).
[in]descrD- descriptor of the sparse CSR matrix \(D\). Currently, only HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
[in]nnzD- number of non-zero entries of the sparse CSR matrix \(D\).
[in]csrValD- array of nnzD elements of the sparse CSR matrix \(D\).
[in]csrRowPtrD- array of m+1 elements that point to the start of every row of the sparse CSR matrix \(D\).
[in]csrColIndD- array of nnzD elements containing the column indices of the sparse CSR matrix \(D\).
[in]descrC- descriptor of the sparse CSR matrix \(C\). Currently, only HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
[out]csrValC- array of nnzC elements of the sparse CSR matrix \(C\).
[in]csrRowPtrC- array of m+1 elements that point to the start of every row of the sparse CSR matrix \(C\).
[out]csrColIndC- array of nnzC elements containing the column indices of the sparse CSR matrix \(C\).
[in]myInfo- structure that holds meta data for the sparse CSR matrix \(C\).
[in]pBuffer- temporary storage buffer allocated by the user. The size is returned by hipsparseScsrgemm2_bufferSizeExt(), hipsparseDcsrgemm2_bufferSizeExt(), hipsparseCcsrgemm2_bufferSizeExt(), or hipsparseZcsrgemm2_bufferSizeExt().
Return values
HIPSPARSE_STATUS_SUCCESSthe operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUEhandle, m, n, k, nnzA, nnzB, nnzD, alpha, beta, descrA, csrValA, csrRowPtrA, csrColIndA, descrB, csrValB, csrRowPtrB, csrColIndB, descrD, csrValD, csrRowPtrD, csrColIndD, csrValC, csrRowPtrC, csrColIndC, info, or pBuffer is invalid.
HIPSPARSE_STATUS_ALLOC_FAILEDadditional buffer for long rows could not be allocated.
HIPSPARSE_STATUS_NOT_SUPPORTEDhipsparseMatrixType_t != HIPSPARSE_MATRIX_TYPE_GENERAL.

Member Function/Subroutine Documentation

◆ hipsparsescsrgemm2_()

integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsescsrgemm2::hipsparsescsrgemm2_ ( type(c_ptr), value  handle,
integer(c_int), value  m,
integer(c_int), value  n,
integer(c_int), value  k,
real(c_float)  alpha,
type(c_ptr), value  descra,
integer(c_int), value  nnza,
type(c_ptr), value  csrvala,
type(c_ptr), value  csrrowptra,
type(c_ptr), value  csrcolinda,
type(c_ptr), value  descrb,
integer(c_int), value  nnzb,
type(c_ptr), value  csrvalb,
type(c_ptr), value  csrrowptrb,
type(c_ptr), value  csrcolindb,
real(c_float)  beta,
type(c_ptr), value  descrd,
integer(c_int), value  nnzd,
type(c_ptr), value  csrvald,
type(c_ptr), value  csrrowptrd,
type(c_ptr), value  csrcolindd,
type(c_ptr), value  descrc,
type(c_ptr), value  csrvalc,
type(c_ptr), value  csrrowptrc,
type(c_ptr), value  csrcolindc,
type(c_ptr), value  myinfo,
type(c_ptr), value  pbuffer 
)

◆ hipsparsescsrgemm2_rank_0()

integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsescsrgemm2::hipsparsescsrgemm2_rank_0 ( type(c_ptr)  handle,
integer(c_int)  m,
integer(c_int)  n,
integer(c_int)  k,
real(c_float)  alpha,
type(c_ptr)  descra,
integer(c_int)  nnza,
real(c_float), target  csrvala,
integer(c_int), target  csrrowptra,
integer(c_int), target  csrcolinda,
type(c_ptr)  descrb,
integer(c_int)  nnzb,
real(c_float), target  csrvalb,
integer(c_int), target  csrrowptrb,
integer(c_int), target  csrcolindb,
real(c_float)  beta,
type(c_ptr)  descrd,
integer(c_int)  nnzd,
real(c_float), target  csrvald,
integer(c_int), target  csrrowptrd,
integer(c_int), target  csrcolindd,
type(c_ptr)  descrc,
real(c_float), target  csrvalc,
integer(c_int), target  csrrowptrc,
integer(c_int), target  csrcolindc,
type(c_ptr)  myinfo,
type(c_ptr)  pbuffer 
)

◆ hipsparsescsrgemm2_rank_1()

integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsescsrgemm2::hipsparsescsrgemm2_rank_1 ( type(c_ptr)  handle,
integer(c_int)  m,
integer(c_int)  n,
integer(c_int)  k,
real(c_float)  alpha,
type(c_ptr)  descra,
integer(c_int)  nnza,
real(c_float), dimension(:), target  csrvala,
integer(c_int), dimension(:), target  csrrowptra,
integer(c_int), dimension(:), target  csrcolinda,
type(c_ptr)  descrb,
integer(c_int)  nnzb,
real(c_float), dimension(:), target  csrvalb,
integer(c_int), dimension(:), target  csrrowptrb,
integer(c_int), dimension(:), target  csrcolindb,
real(c_float)  beta,
type(c_ptr)  descrd,
integer(c_int)  nnzd,
real(c_float), dimension(:), target  csrvald,
integer(c_int), dimension(:), target  csrrowptrd,
integer(c_int), dimension(:), target  csrcolindd,
type(c_ptr)  descrc,
real(c_float), dimension(:), target  csrvalc,
integer(c_int), dimension(:), target  csrrowptrc,
integer(c_int), dimension(:), target  csrcolindc,
type(c_ptr)  myinfo,
type(c_ptr)  pbuffer 
)

The documentation for this interface was generated from the following file: