hipsparsescsrsm2_solve Interface Reference

hipsparsescsrsm2_solve Interface Reference#

HIPFORT API Reference: hipfort_hipsparse::hipsparsescsrsm2_solve Interface Reference
hipfort_hipsparse::hipsparsescsrsm2_solve Interface Reference

Sparse triangular system solve using the CSR storage format. More...

Public Member Functions

integer(kind(hipsparse_status_success)) function hipsparsescsrsm2_solve_ (handle, algo, transa, transb, m, nrhs, nnz, alpha, descra, csrsortedvala, csrsortedrowptra, csrsortedcolinda, b, ldb, myinfo, policy, pbuffer)
 
integer(kind(hipsparse_status_success)) function hipsparsescsrsm2_solve_rank_0 (handle, algo, transa, transb, m, nrhs, nnz, alpha, descra, csrsortedvala, csrsortedrowptra, csrsortedcolinda, b, ldb, myinfo, policy, pbuffer)
 
integer(kind(hipsparse_status_success)) function hipsparsescsrsm2_solve_rank_1 (handle, algo, transa, transb, m, nrhs, nnz, alpha, descra, csrsortedvala, csrsortedrowptra, csrsortedcolinda, b, ldb, myinfo, policy, pbuffer)
 
integer(kind(hipsparse_status_success)) function hipsparsescsrsm2_solve_full_rank (handle, algo, transa, transb, m, nrhs, nnz, alpha, descra, csrsortedvala, csrsortedrowptra, csrsortedcolinda, b, ldb, myinfo, policy, pbuffer)
 

Detailed Description

Sparse triangular system solve using the CSR storage format.

hipsparseXcsrsm2_solve solves a sparse triangular linear system of a sparse \(m \times m\) matrix, defined in CSR storage format, a column-oriented dense solution matrix \(X\), and the column-oriented dense right-hand side matrix \(B\) that is multiplied by \(\alpha\), such that

\[ op(A) \cdot op(X) = \alpha \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. \]

,

\[ 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. \]

and

\[ op(X) = \left\{ \begin{array}{ll} X, & \text{if transB == HIPSPARSE_OPERATION_NON_TRANSPOSE} \\% X^T, & \text{if transB == HIPSPARSE_OPERATION_TRANSPOSE} \\% X^H, & \text{if transB == HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE} \end{array} \right. \]

The solution is performed in-place, meaning that the matrix \(B\) is overwritten with the solution \(X\) after calling hipsparseXcsrsm2_solve. Given that the sparse matrix \(A\) is a square matrix, its size is \(m \times m\) regardless of whether \(A\) is transposed or not. The size of the column-oriented dense matrices \(B\) and \(X\) depend on the value of transB

\[ op(B)/op(X) = \left\{ \begin{array}{ll} ldb \times nrhs, \text{ } ldb ≥ m, & \text{if transB == HIPSPARSE_OPERATION_NON_TRANSPOSE} \\% ldb \times m, \text{ } ldb ≥ nrhs, & \text{if transB == HIPSPARSE_OPERATION_TRANSPOSE} \\% ldb \times m, \text{ } ldb ≥ nrhs, & \text{if transB == HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE} \end{array} \right. \]

hipsparseXcsrsm2_solve requires a user-allocated temporary buffer. Its size is returned by hipsparseScsrsm2_bufferSizeExt "hipsparseXcsrsm2_bufferSizeExt()". The size of the required buffer is larger when transA equals HIPSPARSE_OPERATION_TRANSPOSE or HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE and when transB is HIPSPARSE_OPERATION_NON_TRANSPOSE. The subsequent solve will also be faster when \(A\) is non-transposed and \(B\) is transposed (or conjugate transposed). For example, instead of solving:

\[ \begin{bmatrix} a_{00} & 0 & 0 \\% a_{10} & a_{11} & 0 \\% a_{20} & a_{21} & a_{22} \\% \end{bmatrix} \cdot \begin{bmatrix} x_{00} & x_{01} \\% x_{10} & x_{11} \\% x_{20} & x_{21} \\% \end{bmatrix} = \begin{bmatrix} b_{00} & b_{01} \\% b_{10} & b_{11} \\% b_{20} & b_{21} \\% \end{bmatrix} \]

Consider solving:

\[ \begin{bmatrix} a_{00} & 0 & 0 \\% a_{10} & a_{11} & 0 \\% a_{20} & a_{21} & a_{22} \end{bmatrix} \cdot \begin{bmatrix} x_{00} & x_{10} & x_{20} \\% x_{01} & x_{11} & x_{21} \end{bmatrix}^{T} = \begin{bmatrix} b_{00} & b_{10} & b_{20} \\% b_{01} & b_{11} & b_{21} \end{bmatrix}^{T} \]

After the temporary storage buffer has been allocated, analysis meta data is required. It can be obtained by hipsparseScsrsm2_analysis "hipsparseXcsrsm2_analysis()". The triangular solve is completed by calling hipsparseXcsrsm2_solve. After all solves are performed, the temporary storage buffer allocated by the user can be freed.

Solving a triangular system involves division by the diagonal elements. This means that if the sparse matrix is missing the diagonal entry (referred to as a structural zero) or the diagonal entry is zero (referred to as a numerical zero), then a division by zero would occur. hipsparseXcsrsm2_solve tracks the location of the first zero pivot (either numerical or structural zero). The zero pivot status can be checked by calling hipsparseXcsrsm2_zeroPivot (). If hipsparseXcsrsm2_zeroPivot () returns HIPSPARSE_STATUS_SUCCESS, then no zero pivot was found and therefore the matrix does not have a structural or numerical zero.

The user can specify that the sparse matrix should be interpreted as having ones on the diagonal by setting the diagonal type on the descriptor descrA to HIPSPARSE_DIAG_TYPE_UNIT using hipsparseSetMatDiagType. If hipsparseDiagType_t == HIPSPARSE_DIAG_TYPE_UNIT, no zero pivot will be reported, even if \(A_{j,j} = 0\) for some \(j\).

The sparse CSR matrix passed to hipsparseXcsrsm2_solve does not actually have to be a triangular matrix. Instead, the triangular upper or lower part of the sparse matrix is solved based on the hipsparseFillMode_t setting on the descriptor descrA. If the fill mode is set to HIPSPARSE_FILL_MODE_LOWER, then the lower triangular matrix is solved. If the fill mode is set to HIPSPARSE_FILL_MODE_UPPER, then the upper triangular matrix is solved.

Note
The sparse CSR matrix has to be sorted. This can be achieved by calling hipsparseXcsrsort().
This function is non-blocking and executed asynchronously with respect to the host. It can return before the actual computation has finished.
Currently, only transA != HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE and transB != HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE is supported.
Parameters
[in]handle- handle to the hipSPARSE library context queue.
[in]algo- algorithm to use.
[in]transA- matrix \(A\) operation type.
[in]transB- matrix \(B\) operation type.
[in]m- number of rows of the sparse CSR matrix \(A\).
[in]nrhs- number of columns of the dense matrix \(op(B)\).
[in]nnz- number of non-zero entries of the sparse CSR matrix \(A\).
[in]alpha- scalar \(\alpha\).
[in]descrA- descriptor of the sparse CSR matrix \(A\).
[in]csrSortedValA- array of nnz 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 nnz elements containing the column indices of the sparse CSR matrix \(A\).
[in,out]B- array of m \(\times\) nrhs elements of the rhs matrix \(B\).
[in]ldb- leading dimension of rhs matrix \(B\).
[in]myInfo- structure that holds the information collected during the analysis step.
[in]policy- HIPSPARSE_SOLVE_POLICY_NO_LEVEL or HIPSPARSE_SOLVE_POLICY_USE_LEVEL.
[in]pBuffer- temporary storage buffer allocated by the user.
Return values
HIPSPARSE_STATUS_SUCCESSthe operation completed successfully.
HIPSPARSE_STATUS_INVALID_VALUEhandle, m, nrhs, nnz, alpha, descrA, csrSortedValA, csrSortedRowPtrA, csrSortedColIndA, B, info, or pBuffer is invalid.
HIPSPARSE_STATUS_INTERNAL_ERRORan internal error occurred.
HIPSPARSE_STATUS_NOT_SUPPORTEDtransA == HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE, transB == HIPSPARSE_OPERATION_CONJUGATE_TRANSPOSE, or hipsparseMatrixType_t != HIPSPARSE_MATRIX_TYPE_GENERAL.

Member Function/Subroutine Documentation

◆ hipsparsescsrsm2_solve_()

integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsescsrsm2_solve::hipsparsescsrsm2_solve_ ( type(c_ptr), value  handle,
integer(c_int), value  algo,
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  nrhs,
integer(c_int), value  nnz,
real(c_float)  alpha,
type(c_ptr), value  descra,
type(c_ptr), value  csrsortedvala,
type(c_ptr), value  csrsortedrowptra,
type(c_ptr), value  csrsortedcolinda,
type(c_ptr), value  b,
integer(c_int), value  ldb,
type(c_ptr), value  myinfo,
integer(kind(hipsparse_solve_policy_no_level)), value  policy,
type(c_ptr), value  pbuffer 
)

◆ hipsparsescsrsm2_solve_full_rank()

integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsescsrsm2_solve::hipsparsescsrsm2_solve_full_rank ( type(c_ptr)  handle,
integer(c_int)  algo,
integer(kind(hipsparse_operation_non_transpose))  transa,
integer(kind(hipsparse_operation_non_transpose))  transb,
integer(c_int)  m,
integer(c_int)  nrhs,
integer(c_int)  nnz,
real(c_float)  alpha,
type(c_ptr)  descra,
real(c_float), dimension(:), target  csrsortedvala,
integer(c_int), dimension(:), target  csrsortedrowptra,
integer(c_int), dimension(:), target  csrsortedcolinda,
real(c_float), dimension(:,:), target  b,
integer(c_int)  ldb,
type(c_ptr)  myinfo,
integer(kind(hipsparse_solve_policy_no_level))  policy,
type(c_ptr)  pbuffer 
)

◆ hipsparsescsrsm2_solve_rank_0()

integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsescsrsm2_solve::hipsparsescsrsm2_solve_rank_0 ( type(c_ptr)  handle,
integer(c_int)  algo,
integer(kind(hipsparse_operation_non_transpose))  transa,
integer(kind(hipsparse_operation_non_transpose))  transb,
integer(c_int)  m,
integer(c_int)  nrhs,
integer(c_int)  nnz,
real(c_float)  alpha,
type(c_ptr)  descra,
real(c_float), target  csrsortedvala,
integer(c_int), target  csrsortedrowptra,
integer(c_int), target  csrsortedcolinda,
real(c_float), target  b,
integer(c_int)  ldb,
type(c_ptr)  myinfo,
integer(kind(hipsparse_solve_policy_no_level))  policy,
type(c_ptr)  pbuffer 
)

◆ hipsparsescsrsm2_solve_rank_1()

integer(kind(hipsparse_status_success)) function hipfort_hipsparse::hipsparsescsrsm2_solve::hipsparsescsrsm2_solve_rank_1 ( type(c_ptr)  handle,
integer(c_int)  algo,
integer(kind(hipsparse_operation_non_transpose))  transa,
integer(kind(hipsparse_operation_non_transpose))  transb,
integer(c_int)  m,
integer(c_int)  nrhs,
integer(c_int)  nnz,
real(c_float)  alpha,
type(c_ptr)  descra,
real(c_float), dimension(:), target  csrsortedvala,
integer(c_int), dimension(:), target  csrsortedrowptra,
integer(c_int), dimension(:), target  csrsortedcolinda,
real(c_float), dimension(:), target  b,
integer(c_int)  ldb,
type(c_ptr)  myinfo,
integer(kind(hipsparse_solve_policy_no_level))  policy,
type(c_ptr)  pbuffer 
)

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