rocsparse_sbsrgemm Interface Reference#
Sparse matrix sparse matrix multiplication using the BSR storage format. More...
Public Member Functions | |
| integer(kind(rocsparse_status_success)) function | rocsparse_sbsrgemm_ (handle, dir, trans_a, trans_b, mb, nb, kb, block_dim, alpha, descr_a, nnzb_a, bsr_val_a, bsr_row_ptr_a, bsr_col_ind_a, descr_b, nnzb_b, bsr_val_b, bsr_row_ptr_b, bsr_col_ind_b, beta, descr_d, nnzb_d, bsr_val_d, bsr_row_ptr_d, bsr_col_ind_d, descr_c, bsr_val_c, bsr_row_ptr_c, bsr_col_ind_c, info_c, temp_buffer) |
Detailed Description
Sparse matrix sparse matrix multiplication using the BSR storage format.
rocsparse_bsrgemm multiplies the scalar \(\alpha\) with the sparse \(mb \times kb\) matrix \(A\), defined in BSR storage format, and the sparse \(kb \times nb\) matrix \(B\), defined in BSR storage format, and adds the result to the sparse \(mb \times nb\) matrix \(D\) that is multiplied by \(\beta\). The final result is stored in the sparse \(mb \times nb\) matrix \(C\), defined in BSR storage format, such that
\[ C := \alpha \cdot op(A) \cdot op(B) + \beta \cdot D, \]
with
\[ op(A) = \left\{ \begin{array}{ll} A, & \text{if trans_A == rocsparse_operation_none} \\% A^T, & \text{if trans_A == rocsparse_operation_transpose} \\% A^H, & \text{if trans_A == rocsparse_operation_conjugate_transpose} \end{array} \right. \]
and
\[ op(B) = \left\{ \begin{array}{ll} B, & \text{if trans_B == rocsparse_operation_none} \\% B^T, & \text{if trans_B == rocsparse_operation_transpose} \\% B^H, & \text{if trans_B == rocsparse_operation_conjugate_transpose} \end{array} \right. \]
- Note
- This function does not produce deterministic results.
It is assumed that bsr_row_ptr_C has already been filled and that bsr_val_C and bsr_col_ind_C are allocated by the user. bsr_row_ptr_C and the allocation size of bsr_col_ind_C and bsr_val_C is defined by the number of non-zero elements of the sparse BSR matrix C. Both can be obtained by rocsparse_bsrgemm_nnzb(). The required buffer size for the computation can be obtained by rocsparse_Xbsrgemm_buffer_size().
- Note
- If \(\alpha == 0\), then \(C = \beta \cdot D\) will be computed.
- If \(\beta == 0\), then \(C = \alpha \cdot op(A) \cdot op(B)\) will be computed.
- \(\alpha == beta == 0\) is invalid.
-
Currently, only
trans_A==rocsparse_operation_noneis supported. -
Currently, only
trans_B==rocsparse_operation_noneis supported. -
Currently, only
rocsparse_matrix_type_generalis supported. - This function is blocking with respect to the host.
- This routine does not support execution in a hipGraph context.
- Parameters
-
[in] handle - handle to the rocSPARSE library context queue. [in] dir - direction that specifies whether to count non-zero elements by rocsparse_direction_rowor byrocsparse_direction_columnin the BSR matrices \(A\), \(B\), \(C\), and \(D\).[in] trans_A - matrix \(A\) operation type. [in] trans_B - matrix \(B\) operation type. [in] mb - number of block rows of the sparse BSR matrix \(op(A)\) and \(C\). [in] nb - number of block columns of the sparse BSR matrix \(op(B)\) and \(C\). [in] kb - number of block columns of the sparse BSR matrix \(op(A)\) and number of block rows of the sparse BSR matrix \(op(B)\). [in] block_dim - the block dimension of the BSR matrix \(A\), \(B\), \(C\), and \(D\). [in] alpha - scalar \(\alpha\). [in] descr_A - descriptor of the sparse BSR matrix \(A\). Currently, only rocsparse_matrix_type_generalis supported.[in] nnzb_A - number of non-zero block entries of the sparse BSR matrix \(A\). [in] bsr_val_A - array of nnzb_Ablock elements of the sparse BSR matrix \(A\).[in] bsr_row_ptr_A - array of mb+1block elements ( \(op(A) == A\),kb+1otherwise) that point to the start of every block row of the sparse BSR matrix \(op(A)\).[in] bsr_col_ind_A - array of nnzb_Ablock elements containing the block column indices of the sparse BSR matrix \(A\).[in] descr_B - descriptor of the sparse BSR matrix \(B\). Currently, only rocsparse_matrix_type_generalis supported.[in] nnzb_B - number of non-zero block entries of the sparse BSR matrix \(B\). [in] bsr_val_B - array of nnzb_Bblock elements of the sparse BSR matrix \(B\).[in] bsr_row_ptr_B - array of kb+1block elements ( \(op(B) == B\),mb+1otherwise) that point to the start of every block row of the sparse BSR matrix \(op(B)\).[in] bsr_col_ind_B - array of nnzb_Bblock elements containing the block column indices of the sparse BSR matrix \(B\).[in] beta - scalar \(\beta\). [in] descr_D - descriptor of the sparse BSR matrix \(D\). Currently, only rocsparse_matrix_type_generalis supported.[in] nnzb_D - number of non-zero block entries of the sparse BSR matrix \(D\). [in] bsr_val_D - array of nnzb_Dblock elements of the sparse BSR matrix \(D\).[in] bsr_row_ptr_D - array of mb+1block elements that point to the start of every block row of the sparse BSR matrix \(D\).[in] bsr_col_ind_D - array of nnzb_Dblock elements containing the block column indices of the sparse BSR matrix \(D\).[in] descr_C - descriptor of the sparse BSR matrix \(C\). Currently, only rocsparse_matrix_type_generalis supported.[out] bsr_val_C - array of nnzb_Celements of the sparse BSR matrix \(C\).[in] bsr_row_ptr_C - array of mb+1block elements that point to the start of every block row of the sparse BSR matrix \(C\).[out] bsr_col_ind_C - array of nnzb_Cblock elements containing the block column indices of the sparse BSR matrix \(C\).[in] info_C - structure that holds metadata for the sparse BSR matrix \(C\). [in] temp_buffer - temporary storage buffer allocated by the user. The size is returned by rocsparse_sbsrgemm_buffer_size(), rocsparse_dbsrgemm_buffer_size(), rocsparse_cbsrgemm_buffer_size(), or rocsparse_zbsrgemm_buffer_size().
- Return values
-
rocsparse_status_success the operation completed successfully. rocsparse_status_invalid_handle the library context was not initialized. rocsparse_status_invalid_size mb,nb,kb,block_dim,nnzb_A,nnzb_B, ornnzb_Dis invalid.rocsparse_status_invalid_pointer alphaandbetaare invalid,descr_A,bsr_val_A,bsr_row_ptr_A,bsr_col_ind_A,descr_B,bsr_val_B,bsr_row_ptr_B, orbsr_col_ind_Bare invalid ifalphais valid,descr_D,bsr_val_D,bsr_row_ptr_D, orbsr_col_ind_Dis invalid ifbetais valid, orbsr_val_C,bsr_row_ptr_C,bsr_col_ind_C, orinfo_Cortemp_bufferare invalid.rocsparse_status_memory_error additional buffer for long rows could not be allocated. rocsparse_status_not_implemented trans_A!=rocsparse_operation_none,trans_B!=rocsparse_operation_none, orrocsparse_matrix_type!=rocsparse_matrix_type_general.
- Example
- This example multiplies two BSR matrices with a scalar alpha and adds the result to another BSR matrix.
Member Function/Subroutine Documentation
◆ rocsparse_sbsrgemm_()
| integer(kind(rocsparse_status_success)) function hipfort_rocsparse::rocsparse_sbsrgemm::rocsparse_sbsrgemm_ | ( | type(c_ptr), value | handle, |
| integer(kind(rocsparse_direction_row)), value | dir, | ||
| integer(kind(rocsparse_operation_none)), value | trans_a, | ||
| integer(kind(rocsparse_operation_none)), value | trans_b, | ||
| integer(c_int), value | mb, | ||
| integer(c_int), value | nb, | ||
| integer(c_int), value | kb, | ||
| integer(c_int), value | block_dim, | ||
| real(c_float) | alpha, | ||
| type(c_ptr), value | descr_a, | ||
| integer(c_int), value | nnzb_a, | ||
| type(c_ptr), value | bsr_val_a, | ||
| type(c_ptr), value | bsr_row_ptr_a, | ||
| type(c_ptr), value | bsr_col_ind_a, | ||
| type(c_ptr), value | descr_b, | ||
| integer(c_int), value | nnzb_b, | ||
| type(c_ptr), value | bsr_val_b, | ||
| type(c_ptr), value | bsr_row_ptr_b, | ||
| type(c_ptr), value | bsr_col_ind_b, | ||
| real(c_float) | beta, | ||
| type(c_ptr), value | descr_d, | ||
| integer(c_int), value | nnzb_d, | ||
| type(c_ptr), value | bsr_val_d, | ||
| type(c_ptr), value | bsr_row_ptr_d, | ||
| type(c_ptr), value | bsr_col_ind_d, | ||
| type(c_ptr), value | descr_c, | ||
| type(c_ptr), value | bsr_val_c, | ||
| type(c_ptr), value | bsr_row_ptr_c, | ||
| type(c_ptr), value | bsr_col_ind_c, | ||
| type(c_ptr), value | info_c, | ||
| type(c_ptr), value | temp_buffer | ||
| ) |
The documentation for this interface was generated from the following file: