hipsparsescsrgeam2 Interface Reference

hipsparsescsrgeam2 Interface Reference#

HIPFORT API Reference: hipfort_hipsparse::hipsparsescsrgeam2 Interface Reference
hipfort_hipsparse::hipsparsescsrgeam2 Interface Reference

Sparse matrix sparse matrix addition using the CSR storage format. More...

Public Member Functions

integer(kind(hipsparse_status_success)) function hipsparsescsrgeam2_ (handle, m, n, alpha, descra, nnza, csrsortedvala, csrsortedrowptra, csrsortedcolinda, beta, descrb, nnzb, csrsortedvalb, csrsortedrowptrb, csrsortedcolindb, descrc, csrsortedvalc, csrsortedrowptrc, csrsortedcolindc, pbuffer)
 
integer(kind(hipsparse_status_success)) function hipsparsescsrgeam2_rank_0 (handle, m, n, alpha, descra, nnza, csrsortedvala, csrsortedrowptra, csrsortedcolinda, beta, descrb, nnzb, csrsortedvalb, csrsortedrowptrb, csrsortedcolindb, descrc, csrsortedvalc, csrsortedrowptrc, csrsortedcolindc, pbuffer)
 
integer(kind(hipsparse_status_success)) function hipsparsescsrgeam2_rank_1 (handle, m, n, alpha, descra, nnza, csrsortedvala, csrsortedrowptra, csrsortedcolinda, beta, descrb, nnzb, csrsortedvalb, csrsortedrowptrb, csrsortedcolindb, descrc, csrsortedvalc, csrsortedrowptrc, csrsortedcolindc, pbuffer)
 

Detailed Description

Sparse matrix sparse matrix addition using the CSR storage format.

hipsparseXcsrgeam2 multiplies the scalar \(\alpha\) with the sparse \(m \times n\) matrix \(A\), defined in CSR storage format, multiplies the scalar \(\beta\) with the sparse \(m \times n\) matrix \(B\), defined in CSR storage format, and adds both resulting matrices to obtain the sparse \(m \times n\) matrix \(C\), defined in CSR storage format, such that

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

This computation involves a multi-step process. First, the user must call hipsparseScsrgeam2_bufferSizeExt "hipsparseXcsrgeam2_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 hipsparseXcsrgeam2Nnz, 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 hipsparseXcsrgeam2 to complete the computation. The desired index base in the output CSR matrix \(C\) is set in the hipsparseMatDescr_t descrC. See hipsparseSetMatIndexBase ().

Note
Both scalars \(\alpha\) and \(beta\) have to be valid.
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.
Parameters
[in]handle- handle to the hipSPARSE library context queue.
[in]m- number of rows of the sparse CSR matrices \(A\), \(B\), and \(C\).
[in]n- number of columns of the sparse CSR matrices \(A\), \(B\), and \(C\).
[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]csrSortedValA- array of nnzA elements of the sparse CSR matrix \(A\).
[in]csrSortedRowPtrA- array of m+1 elements that point to the start of every row of the sparse CSR matrix \(A\).
[in]csrSortedColIndA- array of nnzA elements containing the column indices of the sparse CSR matrix \(A\).
[in]beta- scalar \(\beta\).
[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]csrSortedValB- array of nnzB elements of the sparse CSR matrix \(B\).
[in]csrSortedRowPtrB- array of m+1 elements that point to the start of every row of the sparse CSR matrix \(B\).
[in]csrSortedColIndB- array of nnzB elements containing the column indices of the sparse CSR matrix \(B\).
[in]descrC- descriptor of the sparse CSR matrix \(C\). Currently, only HIPSPARSE_MATRIX_TYPE_GENERAL is supported.
[out]csrSortedValC- array of elements of the sparse CSR matrix \(C\).
[in]csrSortedRowPtrC- array of m+1 elements that point to the start of every row of the sparse CSR matrix \(C\).
[out]csrSortedColIndC- array of elements containing the column indices of the sparse CSR matrix \(C\).
[in]pBuffer- temporary storage buffer allocated by the user.
Return values
HIPSPARSE_STATUS_SUCCESSthe operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUEhandle, m, n, nnzA, nnzB, alpha, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, beta, descrB, csrSortedValB, csrSortedRowPtrB, csrSortedColIndB, descrC, csrSortedValC, csrSortedRowPtrC, csrSortedColIndC, or pBuffer is invalid.
HIPSPARSE_STATUS_NOT_SUPPORTEDhipsparseMatrixType_t != HIPSPARSE_MATRIX_TYPE_GENERAL.

Member Function/Subroutine Documentation

◆ hipsparsescsrgeam2_()

integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsescsrgeam2::hipsparsescsrgeam2_ ( type(c_ptr), value  handle,
integer(c_int), value  m,
integer(c_int), value  n,
real(c_float)  alpha,
type(c_ptr), value  descra,
integer(c_int), value  nnza,
type(c_ptr), value  csrsortedvala,
type(c_ptr), value  csrsortedrowptra,
type(c_ptr), value  csrsortedcolinda,
real(c_float)  beta,
type(c_ptr), value  descrb,
integer(c_int), value  nnzb,
type(c_ptr), value  csrsortedvalb,
type(c_ptr), value  csrsortedrowptrb,
type(c_ptr), value  csrsortedcolindb,
type(c_ptr), value  descrc,
type(c_ptr), value  csrsortedvalc,
type(c_ptr), value  csrsortedrowptrc,
type(c_ptr), value  csrsortedcolindc,
type(c_ptr), value  pbuffer 
)

◆ hipsparsescsrgeam2_rank_0()

integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsescsrgeam2::hipsparsescsrgeam2_rank_0 ( type(c_ptr)  handle,
integer(c_int)  m,
integer(c_int)  n,
real(c_float)  alpha,
type(c_ptr)  descra,
integer(c_int)  nnza,
real(c_float), target  csrsortedvala,
integer(c_int), target  csrsortedrowptra,
integer(c_int), target  csrsortedcolinda,
real(c_float)  beta,
type(c_ptr)  descrb,
integer(c_int)  nnzb,
real(c_float), target  csrsortedvalb,
integer(c_int), target  csrsortedrowptrb,
integer(c_int), target  csrsortedcolindb,
type(c_ptr)  descrc,
real(c_float), target  csrsortedvalc,
integer(c_int), target  csrsortedrowptrc,
integer(c_int), target  csrsortedcolindc,
type(c_ptr)  pbuffer 
)

◆ hipsparsescsrgeam2_rank_1()

integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsescsrgeam2::hipsparsescsrgeam2_rank_1 ( type(c_ptr)  handle,
integer(c_int)  m,
integer(c_int)  n,
real(c_float)  alpha,
type(c_ptr)  descra,
integer(c_int)  nnza,
real(c_float), dimension(:), target  csrsortedvala,
integer(c_int), dimension(:), target  csrsortedrowptra,
integer(c_int), dimension(:), target  csrsortedcolinda,
real(c_float)  beta,
type(c_ptr)  descrb,
integer(c_int)  nnzb,
real(c_float), dimension(:), target  csrsortedvalb,
integer(c_int), dimension(:), target  csrsortedrowptrb,
integer(c_int), dimension(:), target  csrsortedcolindb,
type(c_ptr)  descrc,
real(c_float), dimension(:), target  csrsortedvalc,
integer(c_int), dimension(:), target  csrsortedrowptrc,
integer(c_int), dimension(:), target  csrsortedcolindc,
type(c_ptr)  pbuffer 
)

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