rocsparse_spmm_ex Interface Reference#
hipfort_rocsparse::rocsparse_spmm_ex Interface Reference
! More...
Public Member Functions | |
integer(kind(rocsparse_status_success)) function | rocsparse_spmm_ex_ (handle, trans_A, trans_B, alpha, mat_A, mat_B, beta, mat_C, compute_type, alg, stage, buffer_size, temp_buffer) |
Detailed Description
!
Sparse matrix dense matrix multiplication, extension routine.
rocsparse_spmm_ex
multiplies the scalar \(\alpha\) with a sparse \(m \times k\) matrix \(A\), defined in CSR or COO 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 and COO 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 for CSR 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 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.
- SpMM requires three stages to complete. The first stage rocsparse_spmm_stage_buffer_size will return the size of the temporary storage buffer that is required for subsequent calls to rocsparse_spmm_ex. The second stage rocsparse_spmm_stage_preprocess will preprocess data that would be saved in the temporary storage buffer. In the final stage rocsparse_spmm_stage_compute, the actual computation is performed.
-
If rocsparse_spgemm_stage_auto is selected, rocSPARSE will automatically detect which stage is required based on the following indicators: If
temp_buffer
is equal tonullptr
, the required buffer size will be returned. Else, the SpMM preprocess and the SpMM algorithm will be executed.
- 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. [in] stage SpMM stage for the SpMM computation. [out] buffer_size number of bytes of the temporary storage buffer. buffer_size is set when temp_buffer
is nullptr.[in] temp_buffer temporary storage buffer allocated by the user. When a nullptr is passed, the required allocation size (in bytes) is written to buffer_size
and function returns without performing the SpMM operation.
- 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_ex_()
integer(kind(rocsparse_status_success)) function hipfort_rocsparse::rocsparse_spmm_ex::rocsparse_spmm_ex_ | ( | 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(kind(rocsparse_spmm_stage_auto)), 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: