rocsparse_scsrmm Interface Reference

rocsparse_scsrmm Interface Reference#

HIPFORT API Reference: hipfort_rocsparse::rocsparse_scsrmm Interface Reference
hipfort_rocsparse::rocsparse_scsrmm Interface Reference

Sparse matrix dense matrix multiplication using the CSR storage format. More...

Public Member Functions

integer(kind(rocsparse_status_success)) function rocsparse_scsrmm_ (handle, trans_a, trans_b, m, n, k, nnz, alpha, descr, csr_val, csr_row_ptr, csr_col_ind, b, ldb, beta, c, ldc)
 
integer(kind(rocsparse_status_success)) function rocsparse_scsrmm_rank_0 (handle, trans_a, trans_b, m, n, k, nnz, alpha, descr, csr_val, csr_row_ptr, csr_col_ind, b, ldb, beta, c, ldc)
 
integer(kind(rocsparse_status_success)) function rocsparse_scsrmm_rank_1 (handle, trans_a, trans_b, m, n, k, nnz, alpha, descr, csr_val, csr_row_ptr, csr_col_ind, b, ldb, beta, c, ldc)
 
integer(kind(rocsparse_status_success)) function rocsparse_scsrmm_full_rank (handle, trans_a, trans_b, m, n, k, nnz, alpha, descr, csr_val, csr_row_ptr, csr_col_ind, b, ldb, beta, c, ldc)
 

Detailed Description

Sparse matrix dense matrix multiplication using the CSR storage format.

rocsparse_csrmm multiplies the scalar \(\alpha\) with a sparse \(m \times k\) matrix \(A\), defined in CSR storage format, and the column-oriented dense \(k \times n\) matrix \(B\) and adds the result to the column-oriented dense \(m \times n\) matrix \(C\) that is multiplied by the scalar \(\beta\), such that

\[ C := \alpha \cdot op(A) \cdot op(B) + \beta \cdot C, \]

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

for(i = 0; i < ldc; ++i)
{
for(j = 0; j < n; ++j)
{
C[i][j] = beta * C[i][j];
for(k = csr_row_ptr[i]; k < csr_row_ptr[i + 1]; ++k)
{
C[i][j] += alpha * csr_val[k] * B[csr_col_ind[k]][j];
}
}
}
Note
This function does not produce deterministic results when A is transposed.
This function is non-blocking and executed asynchronously with respect to the host. It can return before the actual computation has finished.
This routine supports execution in a hipGraph context.
Parameters
[in]handle- handle to the rocSPARSE library context queue.
[in]trans_A- matrix \(A\) operation type.
[in]trans_B- matrix \(B\) operation type.
[in]m- number of rows of the sparse CSR matrix \(A\).
[in]n- number of columns of the column-oriented dense matrix \(op(B)\) and \(C\).
[in]k- number of columns of the sparse CSR matrix \(A\).
[in]nnz- number of non-zero entries of the sparse CSR matrix \(A\).
[in]alpha- scalar \(\alpha\).
[in]descr- descriptor of the sparse CSR matrix \(A\). Currently, only rocsparse_matrix_type_general is supported.
[in]csr_val- array of nnz elements of the sparse CSR matrix \(A\).
[in]csr_row_ptr- array of m+1 elements that point to the start of every row of the sparse CSR matrix \(A\).
[in]csr_col_ind- array of nnz elements containing the column indices of the sparse CSR matrix \(A\).
[in]B- column-oriented dense matrix of dimension \(ldb \times n\) ( \(op(B) == B\)), \(ldb \times k\) otherwise.
[in]ldb- leading dimension of \(B\), must be at least \(\max{(1, k)}\) ( \(op(B) == B\)), \(\max{(1, n)}\) otherwise.
[in]beta- scalar \(\beta\).
[in,out]C- column-oriented dense matrix of dimension \(ldc \times n\).
[in]ldc- leading dimension of \(C\), must be at least \(\max{(1, m)}\) ( \(op(A) == A\)), \(\max{(1, k)}\) otherwise.
Return values
rocsparse_status_successthe operation completed successfully.
rocsparse_status_invalid_handlethe library context was not initialized.
rocsparse_status_invalid_sizem, n, k, nnz, ldb, or ldc is invalid.
rocsparse_status_invalid_pointerdescr, alpha, csr_val, csr_row_ptr, csr_col_ind, B, beta, or C pointer is invalid.
rocsparse_status_arch_mismatchthe device is not supported.
rocsparse_status_not_implementedrocsparse_matrix_type != rocsparse_matrix_type_general.
Example
This example multiplies a CSR matrix with a column-oriented dense matrix.

Member Function/Subroutine Documentation

◆ rocsparse_scsrmm_()

integer(kind(rocsparse_status_success)) function hipfort_rocsparse::rocsparse_scsrmm::rocsparse_scsrmm_ ( type(c_ptr), value  handle,
integer(kind(rocsparse_operation_none)), value  trans_a,
integer(kind(rocsparse_operation_none)), value  trans_b,
integer(c_int), value  m,
integer(c_int), value  n,
integer(c_int), value  k,
integer(c_int), value  nnz,
real(c_float)  alpha,
type(c_ptr), value  descr,
type(c_ptr), value  csr_val,
type(c_ptr), value  csr_row_ptr,
type(c_ptr), value  csr_col_ind,
type(c_ptr), value  b,
integer(c_int), value  ldb,
real(c_float)  beta,
type(c_ptr), value  c,
integer(c_int), value  ldc 
)

◆ rocsparse_scsrmm_full_rank()

integer(kind(rocsparse_status_success)) function hipfort_rocsparse::rocsparse_scsrmm::rocsparse_scsrmm_full_rank ( type(c_ptr)  handle,
integer(kind(rocsparse_operation_none))  trans_a,
integer(kind(rocsparse_operation_none))  trans_b,
integer(c_int)  m,
integer(c_int)  n,
integer(c_int)  k,
integer(c_int)  nnz,
real(c_float)  alpha,
type(c_ptr)  descr,
real(c_float), dimension(:), target  csr_val,
integer(c_int), dimension(:), target  csr_row_ptr,
integer(c_int), dimension(:), target  csr_col_ind,
real(c_float), dimension(:,:), target  b,
integer(c_int)  ldb,
real(c_float)  beta,
real(c_float), dimension(:,:), target  c,
integer(c_int)  ldc 
)

◆ rocsparse_scsrmm_rank_0()

integer(kind(rocsparse_status_success)) function hipfort_rocsparse::rocsparse_scsrmm::rocsparse_scsrmm_rank_0 ( type(c_ptr)  handle,
integer(kind(rocsparse_operation_none))  trans_a,
integer(kind(rocsparse_operation_none))  trans_b,
integer(c_int)  m,
integer(c_int)  n,
integer(c_int)  k,
integer(c_int)  nnz,
real(c_float)  alpha,
type(c_ptr)  descr,
real(c_float), target  csr_val,
integer(c_int), target  csr_row_ptr,
integer(c_int), target  csr_col_ind,
real(c_float), target  b,
integer(c_int)  ldb,
real(c_float)  beta,
real(c_float), target  c,
integer(c_int)  ldc 
)

◆ rocsparse_scsrmm_rank_1()

integer(kind(rocsparse_status_success)) function hipfort_rocsparse::rocsparse_scsrmm::rocsparse_scsrmm_rank_1 ( type(c_ptr)  handle,
integer(kind(rocsparse_operation_none))  trans_a,
integer(kind(rocsparse_operation_none))  trans_b,
integer(c_int)  m,
integer(c_int)  n,
integer(c_int)  k,
integer(c_int)  nnz,
real(c_float)  alpha,
type(c_ptr)  descr,
real(c_float), dimension(:), target  csr_val,
integer(c_int), dimension(:), target  csr_row_ptr,
integer(c_int), dimension(:), target  csr_col_ind,
real(c_float), dimension(:), target  b,
integer(c_int)  ldb,
real(c_float)  beta,
real(c_float), dimension(:), target  c,
integer(c_int)  ldc 
)

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