rocsparse_spsv Interface Reference#
Sparse triangular system solve. More...
Public Member Functions | |
| integer(kind(rocsparse_status_success)) function | rocsparse_spsv_ (handle, trans, alpha, mat, x, y, compute_type, alg, stage, buffer_size, temp_buffer) |
Detailed Description
Sparse triangular system solve.
rocsparse_spsv solves a triangular linear system of equations defined by a sparse \(m
\times m\) square matrix \(op(A)\), given in CSR or COO storage format, such that
\[ op(A) \cdot y = \alpha \cdot x, \]
with
\[ op(A) = \left\{ \begin{array}{ll} A, & \text{if trans == rocsparse_operation_none} \\% A^T, & \text{if trans == rocsparse_operation_transpose} \end{array} \right. \]
and where \(y\) is the dense solution vector and \(x\) is the dense right-hand side vector.
Performing the above operation requires three stages. First, rocsparse_spsv must be called with the stage rocsparse_spsv_stage_buffer_size, which will determine the size of the required temporary storage buffer. The user then allocates this buffer and calls rocsparse_spsv with the stage rocsparse_spsv_stage_preprocess, which will perform analysis on the sparse matrix \(op(A)\). Finally, complete the computation by calling rocsparse_spsv with the stage rocsparse_spsv_stage_compute. The buffer size, buffer allocation, and preprocess stages only need to be called once for a given sparse matrix \(op(A)\), while the computation stage can be repeatedly used with different \(x\) and \(y\) vectors.
rocsparse_spsv supports rocsparse_indextype_i32 and rocsparse_indextype_i64 index types for storing the row pointer and column indices arrays of the sparse matrices. rocsparse_spsv supports the following data types for \(op(A)\), \(x\), \(y\) and compute types for \(\alpha\):
- Uniform Precisions:
-
Uniform Precisions A / X / Y / compute_type rocsparse_datatype_f32_r rocsparse_datatype_f64_r rocsparse_datatype_f32_c rocsparse_datatype_f64_c
- Note
- The sparse matrix formats currently supported are:
rocsparse_format_coo,rocsparse_format_csr, androcsparse_format_csc. -
Only the
rocsparse_spsv_stage_buffer_sizestage and therocsparse_spsv_stage_computestage are non-blocking and executed asynchronously with respect to the host. They can return before the actual computation has finished. Therocsparse_spsv_stage_preprocessstage is blocking with respect to the host. -
Currently, only
trans==rocsparse_operation_noneandtrans==rocsparse_operation_transposeis supported. -
Only the
rocsparse_spsv_stage_buffer_sizestage and therocsparse_spsv_stage_computestage support execution in a hipGraph context. Therocsparse_spsv_stage_preprocessstage does not support hipGraph. - This routine does not support batched computation.
- Parameters
-
[in] handle - handle to the rocSPARSE library context queue. [in] trans - matrix operation type. [in] alpha - scalar \(\alpha\). [in] mat - matrix descriptor. [in] x - vector descriptor. [in,out] y - vector descriptor. [in] compute_type - floating point precision for the SpSV computation. [in] alg - SpSV algorithm for the SpSV computation. [in] stage - SpSV stage for the SpSV computation. [out] buffer_size - number of bytes of the temporary storage buffer. [in] temp_buffer - temporary storage buffer allocated by the user. When the rocsparse_spsv_stage_buffer_sizestage is passed, the required allocation size (in bytes) is written tobuffer_sizeand the function returns without performing the SpSV operation. This buffer is non-persistent, and no data is stored in it. Therefore, this memory can be freed or reused for other tasks between the analysis phase and the compute phase.
- Return values
-
rocsparse_status_success the operation completed successfully. rocsparse_status_invalid_handle the library context was not initialized. rocsparse_status_invalid_pointer alpha,mat,x,y, orbuffer_sizepointer is invalid.rocsparse_status_not_implemented trans,compute_type,stage, oralgis currently not supported.
- Example
Member Function/Subroutine Documentation
◆ rocsparse_spsv_()
| integer(kind(rocsparse_status_success)) function hipfort_rocsparse::rocsparse_spsv::rocsparse_spsv_ | ( | type(c_ptr), value | handle, |
| integer(kind(rocsparse_operation_none)), value | trans, | ||
| type(c_ptr), value | alpha, | ||
| type(c_ptr), value | mat, | ||
| type(c_ptr), value | x, | ||
| type(c_ptr), value | y, | ||
| integer(kind(rocsparse_datatype_f16_r)), value | compute_type, | ||
| integer(kind(rocsparse_spsv_alg_default)), value | alg, | ||
| integer(kind(rocsparse_spsv_stage_buffer_size)), value | stage, | ||
| integer(c_size_t) | buffer_size, | ||
| type(c_ptr), value | temp_buffer | ||
| ) |
The documentation for this interface was generated from the following file: