rocsparse_spmm Interface Reference#
hipfort_rocsparse::rocsparse_spmm Interface Reference
! More...
Public Member Functions | |
integer(kind(rocsparse_status_success)) function | rocsparse_spmm_ (handle, trans_A, trans_B, alpha, mat_A, mat_B, beta, mat_C, compute_type, alg, buffer_size, temp_buffer) |
Detailed Description
!
Sparse matrix dense matrix multiplication
rocsparse_spmm
multiplies the scalar \(\alpha\) with a sparse \(m \times k\) matrix \(A\), defined in CSR, COO or Blocked ELL storage format, and the dense \(k \times n\) matrix \(B\) and adds the result to the 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 \end{array} \right. \f] and \end{array} \right. \f]
- Note
- This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.
-
Currently, only
trans_A
== rocsparse_operation_none is supported. - Currently, only CSR, COO and Blocked ELL sparse formats are supported.
- Different algorithms are available which can provide better performance for different matrices. Currently, the available algorithms are rocsparse_spmm_alg_csr, rocsparse_spmm_alg_csr_row_split or rocsparse_spmm_alg_csr_merge for CSR matrices, rocsparse_spmm_alg_bell for Blocked ELL matrices and rocsparse_spmm_alg_coo_segmented or rocsparse_spmm_alg_coo_atomic for COO matrices. Additionally, one can specify the algorithm to be rocsparse_spmm_alg_default. In the case of CSR matrices this will set the algorithm to be rocsparse_spmm_alg_csr, in the case of Blocked ELL matrices this will set the algorithm to be rocsparse_spmm_alg_bell and for COO matrices it will set the algorithm to be rocsparse_spmm_alg_coo_atomic.
-
This function writes the required allocation size (in bytes) to
buffer_size
and returns without performing the SpMM operation, when a nullptr is passed fortemp_buffer
. - This function is non blocking and executed asynchronously with respect to the host. It may return before the actual computation has finished.
- Parameters
-
[in] handle handle to the rocsparse library context queue. [in] trans_A matrix operation type. [in] trans_B matrix operation type. [in] alpha scalar \(\alpha\). [in] mat_A matrix descriptor. [in] mat_B matrix descriptor. [in] beta scalar \(\beta\). [in] mat_C matrix descriptor. [in] compute_type floating point precision for the SpMM computation. [in] alg SpMM algorithm for the SpMM computation. [out] buffer_size number of bytes of the temporary storage buffer. When buffer_size
is not nullptr andtemp_buffer
is nullptr,buffer_size
will be set and the function returns without performing the SpMM operation. Currently only rocsparse_spmm_alg_csr_merge requires a user allocated buffer. Attempting to get the buffer size with any other algorithm will return a buffer size of 4 bytes and is not required.[in] temp_buffer temporary storage buffer allocated by the user. When temp_buffer
is not nullptr andbuffer_size
is nullptr,temp_buffer
will be filled with any analysis data and the function returns without performing the SpMM operation. Currently only rocsparse_spmm_alg_csr_merge requires analysis data. Attempting to perform analysis with any other algorithm does nothing and is not necessary.
- 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_A
,mat_B
,mat_C
,beta
, orbuffer_size
pointer is invalid.rocsparse_status_not_implemented trans_A
,trans_B
,compute_type
oralg
is currently not supported.
Member Function/Subroutine Documentation
◆ rocsparse_spmm_()
integer(kind(rocsparse_status_success)) function hipfort_rocsparse::rocsparse_spmm::rocsparse_spmm_ | ( | type(c_ptr), value | handle, |
integer(kind(rocsparse_operation_none)), value | trans_A, | ||
integer(kind(rocsparse_operation_none)), value | trans_B, | ||
type(c_ptr), value | alpha, | ||
type(c_ptr), value | mat_A, | ||
type(c_ptr), value | mat_B, | ||
type(c_ptr), value | beta, | ||
type(c_ptr), value | mat_C, | ||
integer(kind(rocsparse_datatype_f32_r)), value | compute_type, | ||
integer(kind(rocsparse_spmm_alg_default)), value | alg, | ||
integer(c_size_t) | buffer_size, | ||
type(c_ptr), value | temp_buffer | ||
) |
The documentation for this interface was generated from the following file: