hipsparsescsrgemm Interface Reference#
Sparse matrix and sparse matrix multiplication using the CSR storage format. More...
Public Member Functions | |
| integer(kind(hipsparse_status_success)) function | hipsparsescsrgemm_ (handle, transa, transb, m, n, k, descra, nnza, csrvala, csrrowptra, csrcolinda, descrb, nnzb, csrvalb, csrrowptrb, csrcolindb, descrc, csrvalc, csrrowptrc, csrcolindc) |
| integer(kind(hipsparse_status_success)) function | hipsparsescsrgemm_rank_0 (handle, transa, transb, m, n, k, descra, nnza, csrvala, csrrowptra, csrcolinda, descrb, nnzb, csrvalb, csrrowptrb, csrcolindb, descrc, csrvalc, csrrowptrc, csrcolindc) |
| integer(kind(hipsparse_status_success)) function | hipsparsescsrgemm_rank_1 (handle, transa, transb, m, n, k, descra, nnza, csrvala, csrrowptra, csrcolinda, descrb, nnzb, csrvalb, csrrowptrb, csrcolindb, descrc, csrvalc, csrrowptrc, csrcolindc) |
Detailed Description
Sparse matrix and sparse matrix multiplication using the CSR storage format.
hipsparseXcsrgemm multiplies the sparse \(m \times k\) matrix \(op(A)\), defined in CSR storage format, with the sparse \(k \times n\) matrix \(op(B)\), defined in CSR storage format, and stores the result in the sparse \(m \times n\) matrix \(C\), defined in CSR storage format, such that
\[ C := op(A) \cdot op(B), \]
with
\[ op(A) = \left\{ \begin{array}{ll} A, & \text{if transA == HIPSPARSE_OPERATION_NON_TRANSPOSE} \\% A^T, & \text{if transA == HIPSPARSE_OPERATION_TRANSPOSE} \\% A^H, & \text{if transA == HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE} \end{array} \right. \]
and
\[ op(B) = \left\{ \begin{array}{ll} B, & \text{if transB == HIPSPARSE_OPERATION_NON_TRANSPOSE} \\% B^T, & \text{if transB == HIPSPARSE_OPERATION_TRANSPOSE} \\% B^H, & \text{if transB == HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE} \end{array} \right. \]
This computation involves a multi-step process. First, the user must allocate csrRowPtrC to have size m+1. The user then calls hipsparseXcsrgemmNnz, which fills in the csrRowPtrC array and computes the total number of non-zeros in C, nnzC. The user then allocates both arrays csrColIndC and csrValC to have size nnzC and calls hipsparseXcsrgemm to complete the computation. The desired index base in the output CSR matrix C is set in the hipsparseMatDescr_t descrC. See hipsparseSetMatIndexBase().
- Note
- Currently, only
transA==HIPSPARSE_OPERATION_NON_TRANSPOSEis supported. -
Currently, only
transB==HIPSPARSE_OPERATION_NON_TRANSPOSEis supported. -
Currently, only
HIPSPARSE_MATRIX_TYPE_GENERALis 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] transA - matrix \(A\) operation type. [in] transB - matrix \(B\) operation type. [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] descrA - descriptor of the sparse CSR matrix \(A\). Currently, only HIPSPARSE_MATRIX_TYPE_GENERALis supported.[in] nnzA - number of non-zero entries of the sparse CSR matrix \(A\). [in] csrValA - array of nnzAelements of the sparse CSR matrix \(A\).[in] csrRowPtrA - array of m+1elements ( \(op(A) == A\),k+1otherwise) that point to the start of every row of the sparse CSR matrix \(op(A)\).[in] csrColIndA - array of nnzAelements containing the column indices of the sparse CSR matrix \(A\).[in] descrB - descriptor of the sparse CSR matrix \(B\). Currently, only HIPSPARSE_MATRIX_TYPE_GENERALis supported.[in] nnzB - number of non-zero entries of the sparse CSR matrix \(B\). [in] csrValB - array of nnzBelements of the sparse CSR matrix \(B\).[in] csrRowPtrB - array of k+1elements ( \(op(B) == B\),m+1otherwise) that point to the start of every row of the sparse CSR matrix \(op(B)\).[in] csrColIndB - array of nnzBelements containing the column indices of the sparse CSR matrix \(B\).[in] descrC - descriptor of the sparse CSR matrix \(C\). Currently, only HIPSPARSE_MATRIX_TYPE_GENERALis supported.[out] csrValC - array of nnzCelements of the sparse CSR matrix \(C\).[in] csrRowPtrC - array of m+1elements that point to the start of every row of the sparse CSR matrix \(C\).[out] csrColIndC - array of nnzCelements containing the column indices of the sparse CSR matrix \(C\).
- Return values
-
HIPSPARSE_STATUS_SUCCESS the operation completed successfully. HIPSPARSE_STATUS_INVALID_VALUE handle,m,n,k,nnzA,nnzB,descrA,csrValA,csrRowPtrA,csrColIndA,descrB,csrValB,csrRowPtrB,csrColIndB,descrC,csrValC,csrRowPtrC, orcsrColIndCis invalid.HIPSPARSE_STATUS_ALLOC_FAILED additional buffer for long rows could not be allocated. HIPSPARSE_STATUS_NOT_SUPPORTED transA!=HIPSPARSE_OPERATION_NON_TRANSPOSE,transB!=HIPSPARSE_OPERATION_NON_TRANSPOSE, orhipsparseMatrixType_t!=HIPSPARSE_MATRIX_TYPE_GENERAL.
Member Function/Subroutine Documentation
◆ hipsparsescsrgemm_()
| integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsescsrgemm::hipsparsescsrgemm_ | ( | type(c_ptr), value | handle, |
| integer(kind(hipsparse_operation_non_transpose)), value | transa, | ||
| integer(kind(hipsparse_operation_non_transpose)), value | transb, | ||
| integer(c_int), value | m, | ||
| integer(c_int), value | n, | ||
| integer(c_int), value | k, | ||
| 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, | ||
| type(c_ptr), value | descrc, | ||
| type(c_ptr), value | csrvalc, | ||
| type(c_ptr), value | csrrowptrc, | ||
| type(c_ptr), value | csrcolindc | ||
| ) |
◆ hipsparsescsrgemm_rank_0()
| integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsescsrgemm::hipsparsescsrgemm_rank_0 | ( | type(c_ptr) | handle, |
| integer(kind(hipsparse_operation_non_transpose)) | transa, | ||
| integer(kind(hipsparse_operation_non_transpose)) | transb, | ||
| integer(c_int) | m, | ||
| integer(c_int) | n, | ||
| integer(c_int) | k, | ||
| 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, | ||
| type(c_ptr) | descrc, | ||
| real(c_float), target | csrvalc, | ||
| integer(c_int), target | csrrowptrc, | ||
| integer(c_int), target | csrcolindc | ||
| ) |
◆ hipsparsescsrgemm_rank_1()
| integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsescsrgemm::hipsparsescsrgemm_rank_1 | ( | type(c_ptr) | handle, |
| integer(kind(hipsparse_operation_non_transpose)) | transa, | ||
| integer(kind(hipsparse_operation_non_transpose)) | transb, | ||
| integer(c_int) | m, | ||
| integer(c_int) | n, | ||
| integer(c_int) | k, | ||
| 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, | ||
| type(c_ptr) | descrc, | ||
| real(c_float), dimension(:), target | csrvalc, | ||
| integer(c_int), dimension(:), target | csrrowptrc, | ||
| integer(c_int), dimension(:), target | csrcolindc | ||
| ) |
The documentation for this interface was generated from the following file: