gemm¶
Computes a sparse matrix times dense matrix product.
Description and Assumptions
Refer to Supported Types for a list of supported <fp>
and <intType>
types. The oneapi::mkl::sparse::gemm routine computes a sparse matrix-dense
matrix product defined as
where \(\alpha\) and \(\beta\) are scalars, \(B\) and \(C\) are dense matrices and \(A\) is a sparse matrix. Dense matrix storage is in row-major format. Sparse matrix formats are compressed sparse row (CSR) formats.
gemm (Buffer version)¶
Syntax
namespace oneapi::mkl::sparse {
void gemm (sycl::queue &queue,
oneapi::mkl::transpose transpose_val,
const fp alpha,
oneapi::mkl::sparse::matrix_handle_t A_handle,
sycl::buffer<fp, 1> &B,
const std::int64_t columns,
const std::int64_t ldb,
const fp beta,
sycl::buffer<fp, 1> &C,
const std::int64_t ldc);
}
Input parameters
- queue
Specifies the SYCL command queue which will be used for SYCL kernels execution.
- transpose_val
Specifies operation
op()
on input matrix. The possible options are described in transpose enum class.- alpha
Specifies the scalar \(\alpha\).
- A_handle
Handle to object containing sparse matrix, \(A\). Created using the oneapi::mkl::sparse::set_csr_data routine.
- B
The dense matrix in the sparse-dense matrix product. A one dimensional SYCL memory object containing an array of size at least
cols*ldb
, wherecols
= the number of columns of matrix \(op(A)\).- columns
Number of columns of matrix, \(C\).
- ldb
Specifies the leading dimension of matrix, \(B\). Should be greater than or equal to the number of columns of \(B\) which is
columns
.- beta
Specifies the scalar
beta
.- C
The dense matrix input/output array. A one-dimensional SYCL memory object containing an array of size at least
rows*ldc
, whererows
= the number of rows of matrix \(op(A)\).- ldc
Specifies the leading dimension of matrix \(C\) . Must be greater than or equal to the number of columns of \(C\) which is
columns
.
Output Parameters
- C
Dense matrix output is overwritten by the updated matrix, \(C\).
Throws
This routine shall throw the following exceptions if the associated condition is detected. An implementation may throw additional implementation-specific exception(s) in case of error conditions not covered here.
gemm (USM version)¶
Syntax
namespace oneapi::mkl::sparse {
sycl::event gemm (sycl::queue &queue,
oneapi::mkl::transpose transpose_val,
const fp alpha,
oneapi::mkl::sparse::matrix_handle_t A_handle,
const fp *B,
const std::int64_t columns,
const std::int64_t ldb,
const fp beta,
const fp *C,
const std::int64_t ldc,
const sycl::vector_class<sycl::event> &dependencies = {});
}
Input parameters
- queue
Specifies the SYCL command queue which will be used for SYCL kernels execution.
- transpose_val
Specifies operation
op()
on input matrix. The possible options are described in transpose enum class.- alpha
Specifies the scalar \(\alpha\).
- A_handle
Handle to object containing sparse matrix, \(A\). Created using the oneapi::mkl::sparse::set_csr_data routine.
- B
The dense matrix in the sparse-dense matrix product. A device accessible USM object containing an array of size at least
cols*ldb
, wherecols
= the number of columns of matrix \(op(A)\).- columns
Number of columns of matrix \(C\).
- ldb
Specifies the leading dimension of matrix \(B\). Should be greater than or equal to the number of columns of \(B\).
- beta
Specifies the scalar
beta
.- C
The dense matrix input/output array. A device accessible USM object containing an array of size at least
rows*ldc
, whererows
= the number of rows of matrix \(op(A)\).- ldc
Specifies the leading dimension of matrix \(C\) . Must be greater than or equal to
columns
.- dependencies
List of events that oneapi::mkl::sparse::gemm routine depends on. If omitted, defaults to no dependencies.
Output Parameters
- C
Dense matrix output is overwritten by the updated matrix \(C\).
Throws
This routine shall throw the following exceptions if the associated condition is detected. An implementation may throw additional implementation-specific exception(s) in case of error conditions not covered here.
Return Values
Output event that can be waited upon or added as a dependency for the completion of gemm routine.
Parent topic: Sparse BLAS