Developer Reference for Intel® oneAPI Math Kernel Library for C
Sparse BLAS Functionality
Sparse BLAS Level 1
In the following table for functionality, \(sm\) = \(\text{sparse matrix}\), \(dm\) = \(\text{dense matrix}\), \(sv\) = \(\text{sparse vector}\), \(dv\) = \(\text{dense vector}\), \(sc\) = \(\text{scalar}\).
In the following table for operations, \(\text{dense vectors}\) = \(x\), \(y\), \(\text{sparse vectors}\) = \(w\), \(v\), \(\text{dense matrices}\) = \(X\), \(Y\), \(\text{sparse matrices}\) = \(A\), \(B\), \(C\), and \(\text{scalars}\) = \(\alpha\), \(\beta\), \(d\).
Functionality |
Operations |
CPU |
OpenMP Offload Intel GPU |
|---|---|---|---|
Sparse Vector - Dense Vector addition (AXPY) |
\(y \leftarrow \alpha \cdot w + y\) |
Yes |
No |
Sparse Vector - Sparse Vector Dot product (SPDOT) (sv.sv -> sc) |
\(d \leftarrow dot(w,v)\) |
N/A |
N/A |
with \(dot(w,v) = \sum_{i}(w_{i} \cdot v_{i})\) |
No |
No |
|
with \(dot(w,v) = \sum_{i}(conj(w_{i}) \cdot v_{i})\) |
No |
No |
|
Sparse Vector - Dense Vector Dot product (SPDOT) (sv.dv -> sc) |
\(d \leftarrow dot(w,x)\) |
N/A |
N/A |
with \(dot(w,v) = \sum_{i}(w_{i} \cdot v_{i})\) |
Yes |
No |
|
with \(dot(w,v) = \sum(conj(w_{i}) \cdot v_{i} )\) |
Yes |
No |
|
Dense Vector - Sparse Vector Conversion (sv <-> dv) |
— |
N/A |
N/A |
\(x = scatter(w)\) |
Yes |
No |
|
\(w = gather(x,windx)\) |
Yes |
No |
Sparse BLAS Level 2
In the following table for functionality, \(sm\) = \(\text{sparse matrix}\), \(dm\) = \(\text{dense matrix}\), \(sv\) = \(\text{sparse vector}\), \(dv\) = \(\text{dense vector}\), \(sc\) = \(\text{scalar}\).
In the following table for operations, \(\text{dense vectors}\) = \(x\), \(y\), \(\text{sparse vectors}\) = \(w\), \(v\), \(\text{dense matrices}\) = \(X\), \(Y\), \(\text{sparse matrices}\) = \(A\), \(B\), \(C\), and \(\text{scalars}\) = \(\alpha\), \(\beta\), \(d\).
Functionality |
Operations |
CPU |
OpenMP Offload Intel GPU |
|---|---|---|---|
General Matrix-Vector multiplication (GEMV) (sm*dv->dv) |
\(y \leftarrow \beta\cdot y + \alpha \cdot op(A)\cdot x\) |
N/A |
N/A |
with \(op(A) = A\) |
Yes |
No |
|
with \(op(A) = A^{T}\) |
Yes |
No |
|
with \(op(A) = A^{H}\) |
Yes |
No |
|
Symmetric Matrix-Vector multiplication (SYMV) (sm*dv->dv) |
\(y \leftarrow \beta\cdot y + \alpha \cdot op(A)\cdot x\) |
N/A |
N/A |
with \(op(A) = A\) |
Yes |
No |
|
with \(op(A) = A^{T}\) |
Yes |
No |
|
with \(op(A) = A^{H}\) |
Yes |
No |
|
Triangular Matrix-Vector multiplication (TRMV) (sm*dv->dv) |
\(y \leftarrow \beta\cdot y + \alpha \cdot op(A)\cdot x\) |
N/A |
N/A |
with \(op(A) = A\) |
Yes |
No |
|
with \(op(A) = A^{T}\) |
Yes |
No |
|
with \(op(A) = A^{H}\) |
Yes |
No |
|
General Matrix-Vector mult with dot product (GEMVDOT) (sm*dv -> dv, dv.dv->sc) |
\(y \leftarrow \beta\cdot y + \alpha\cdot op(A)\cdot x\), \(d = dot(x,y)\) |
N/A |
N/A |
with \(op(A) = A\) |
Yes |
No |
|
with \(op(A) = A^{T}\) |
Yes |
No |
|
with \(op(A) = A^{H}\) |
Yes |
No |
|
Triangular Solve (TRSV) (inv(sm)*dv -> dv) |
solve for \(y\): \(op(A)\cdot y = \alpha\cdot x\) |
N/A |
N/A |
with \(op(A) = A\) |
Yes |
No |
|
with \(op(A) = A^{T}\) |
Yes |
No |
|
with \(op(A) = A^{H}\) |
Yes |
No |
Sparse BLAS Level 3
In the following table for functionality, \(sm\) = \(\text{sparse matrix}\), \(dm\) = \(\text{dense matrix}\), \(sv\) = \(\text{sparse vector}\), \(dv\) = \(\text{dense vector}\), \(sc\) = \(\text{scalar}\).
In the following table for operations, \(\text{dense vectors}\) = \(x\), \(y\), \(\text{sparse vectors}\) = \(w\), \(v\), \(\text{dense matrices}\) = \(X\), \(Y\), \(\text{sparse matrices}\) = \(A\), \(B\), \(C\), and \(\text{scalars}\) = \(\alpha\), \(\beta\), \(d\).
Functionality |
Operations |
CPU |
OpenMP Offload Intel GPU |
|---|---|---|---|
General Sparse Matrix - Dense Matrix Multiplication (GEMM) (sm*dm->dm) |
\(Y \leftarrow \alpha\cdot op(A)\cdot op(X) + \beta\cdot Y\) |
N/A |
N/A |
with \(op(A) = A\), \(op(X) = X\) |
Yes |
No |
|
with \(op(A) = A^{T}\) , \(op(X) = X\) |
Yes |
No |
|
with \(op(A) = A^{H}\) , \(op(X) = X\) |
Yes |
No |
|
with \(op(A) = A\), \(op(X) = X^{T}\) |
No |
No |
|
with \(op(A) = A^{T}\) , \(op(X) = X^{T}\) |
No |
No |
|
with \(op(A) = A^{H}\), \(op(X) = X^{T}\) |
No |
No |
|
with \(op(A) = A\), \(op(X) = X^{H}\) |
No |
No |
|
with \(op(A) = A^{T}\) , \(op(X) = X^{H}\) |
No |
No |
|
with \(op(A) = A^{H}\) , \(op(X) = X^{H}\) |
No |
No |
|
General Dense Matrix - Sparse Matrix Multiplication (GEMM) (dm*sm->dm) |
\(Y \leftarrow \alpha\cdot op(X)\cdot op(A) + \beta\cdot Y\) |
N/A |
N/A |
with \(op(A) = A\), \(op(X) = X\) |
No |
No |
|
with \(op(A) = A^{T}\) , \(op(X) = X\) |
No |
No |
|
with \(op(A) = A^{H}\) , \(op(X) = X\) |
No |
No |
|
with \(op(A) = A\), \(op(X) = X^{T}\) |
No |
No |
|
with \(op(A) = A^{T}\) , \(op(X) = X^{T}\) |
No |
No |
|
with \(op(A) = A^{H}\), \(op(X) = X^{T}\) |
No |
No |
|
with \(op(A) = A\), \(op(X) = X^{H}\) |
No |
No |
|
with \(op(A) = A^{T}\), \(op(X) = X^{H}\) |
No |
No |
|
with \(op(A) = A^{H}\), \(op(X) = X^{H}\) |
No |
No |
|
General Sparse Matrix - Sparse Matrix Multiplication (GEMM) (sm*sm->sm) |
\(C \leftarrow \alpha\cdot op(A)\cdot op(B) + \beta\cdot C\) |
N/A |
N/A |
with \(op(A)=A\), \(op(B)=B\) |
Yes |
No |
|
with \(op(A)=A^{T}\), \(op(B)=B\) |
Yes |
No |
|
with \(op(A)=A^{H}\), \(op(B)=B\) |
Yes |
No |
|
with \(op(A)=A\), \(op(B)=B^{T}\) |
Yes |
No |
|
with \(op(A)=A^{T}\), \(op(B)=B^{T}\) |
Yes |
No |
|
with \(op(A)=A^{H}\), \(op(B)=B^{T}\) |
Yes |
No |
|
with \(op(A)=A\), \(op(B)=B^{H}\) |
Yes |
No |
|
with \(op(A)=A^{T}\), \(op(B)=B^{H}\) |
Yes |
No |
|
with \(op(A)=A^{H}\), \(op(B)=B^{H}\) |
Yes |
No |
|
General Sparse Matrix - Sparse Matrix Multiplication (GEMM) (sm*sm->dm) |
\(Y \leftarrow \alpha\cdot op(A)\cdot op(B) + \beta\cdot Y\) |
N/A |
N/A |
with \(op(A)=A\), \(op(B)=B\) |
Yes |
No |
|
with \(op(A)=A^{T}\), \(op(B)=B\) |
Yes |
No |
|
with \(op(A)=A^{H}\), \(op(B)=B\) |
Yes |
No |
|
with \(op(A)=A\), \(op(B)=B^{T}\) |
No |
No |
|
with \(op(A)=A^{T}\), \(op(B)=B^{T}\) |
No |
No |
|
with \(op(A)=A^{H}\), \(op(B)=B^{T}\) |
No |
No |
|
with \(op(A)=A\), \(op(B)=B^{H}\) |
No |
No |
|
with \(op(A)=A^{T}\), \(op(B)=B^{H}\) |
No |
No |
|
with \(op(A)=A^{H}\), \(op(B)=B^{H}\) |
No |
No |
|
Symmetric Rank-K update (SYRK) (sm*sm->sm) |
\(C \leftarrow op(A)\cdot op(A)^{H}\) |
N/A |
N/A |
with \(op(A)=A\) |
Yes |
No |
|
with \(op(A)=A^{T}\) |
Yes |
No |
|
with \(op(A)=A^{H}\) |
Yes |
No |
|
Symmetric Rank-K update (SYRK) (sm*sm->dm) |
\(Y \leftarrow op(A)\cdot op(A)^H\) |
N/A |
N/A |
with \(op(A)=A\) |
Yes |
No |
|
with \(op(A)=A^{T}\) |
Yes |
No |
|
with \(op(A)=A^{H}\) |
Yes |
No |
|
Symmetric Triple Product (SYPR) (op(sm)*sm*sm -> sm) |
\(C \leftarrow op(A)\cdot B\cdot op(A)^{H}\) |
N/A |
N/A |
with \(op(A)=A\) |
Yes |
No |
|
with \(op(A)=A^{T}\) |
Yes |
No |
|
with \(op(A)=A^{H}\) |
Yes |
No |
|
Triangular Solve (TRSM) (inv(sm)*dm -> dm) |
solve for \(Y\): \(op(A)\cdot Y = \alpha\cdot X\) |
N/A |
N/A |
with \(op(A)=A\) |
Yes |
No |
|
with \(op(A)=A^{T}\) |
Yes |
No |
|
with \(op(A)=A^{H}\) |
Yes |
No |
Other Sparse BLAS Operations
In the following table for functionality, \(sm\) = \(\text{sparse matrix}\), \(dm\) = \(\text{dense matrix}\), \(sv\) = \(\text{sparse vector}\), \(dv\) = \(\text{dense vector}\), \(sc\) = \(\text{scalar}\).
In the following table for operations, \(\text{dense vectors}\) = \(x\), \(y\), \(\text{sparse vectors}\) = \(w\), \(v\), \(\text{dense matrices}\) = \(X\), \(Y\), \(\text{sparse matrices}\) = \(A\), \(B\), \(C\), and \(\text{scalars}\) = \(\alpha\), \(\beta\), \(d\).
Functionality |
Operations |
CPU |
OpenMP Offload Intel GPU |
|---|---|---|---|
Symmetric Gauss-Seidel Preconditioner (SYMGS) (update \(A\cdot x=b\), \(A=L+D+U\)) |
\(x^{0} \leftarrow \alpha\cdot x\); \((L+D)\cdot x^{1}=b-U\cdot x^{0}\); \((U+D)\cdot x=b-L\cdot x^{1}\) |
Yes |
No |
Symmetric Gauss-Seidel Preconditioner with Matrix-Vector product (SYMGS_MV) (update \(A\cdot x=b\), \(A=L+D+U\)) |
\(x^{0} \leftarrow \alpha\cdot x\); \((L+D)\cdot x^{1}=b-U\cdot x^{0}\); \((U+D)\cdot x=b-L\cdot x^{1}\); \(y=A\cdot x\) |
Yes |
No |
LU Smoother (LU_SMOOTHER) (update \(A\cdot x=b\), where \(A=L+D+U\) and \(E\approx \text{inv}(D)\) ) |
\(r=b-A\cdot x\); \((L+D)\cdot E\cdot(U+D)\cdot dx=r\); \(y=x+dr\) |
Yes |
No |
Sparse Matrix Add (ADD) (sm+sm->sm) |
\(C \leftarrow \alpha\cdot op(A) + B\) |
N/A |
N/A |
with \(op(A) = A\) |
Yes |
No |
|
with \(op(A) = A^{T}\) |
Yes |
No |
|
with \(op(A) = A^{H}\) |
Yes |
No |
Sparse BLAS Helper Functions
In the following table for functionality, \(sm\) = \(\text{sparse matrix}\), \(dm\) = \(\text{dense matrix}\), \(sv\) = \(\text{sparse vector}\), \(dv\) = \(\text{dense vector}\), \(sc\) = \(\text{scalar}\).
In the following table for operations, \(\text{dense vectors}\) = \(x\), \(y\), \(\text{sparse vectors}\) = \(w\), \(v\), \(\text{dense matrices}\) = \(X\), \(Y\), \(\text{sparse matrices}\) = \(A\), \(B\), \(C\), and \(\text{scalars}\) = \(\alpha\), \(\beta\), \(d\).
Functionality |
Operations |
CPU |
OpenMP Offload Intel GPU |
|---|---|---|---|
Sort Indices of Matrix (ORDER) |
N/A |
Yes |
No |
Transpose of Sparse Matrix (TRANSPOSE) |
\(A \leftarrow op(A)\) with op=trans or conjtrans |
N/A |
N/A |
transpose CSR/CSC matrix |
Yes |
No |
|
transpose BSR matrix |
Yes |
No |
|
Sparse Matrix Format Converter (CONVERT) |
N/A |
Yes |
No |
Dense to Sparse Matrix Format Converter (CONVERT) |
N/A |
Yes |
No |
Copy Matrix Handle (COPY) |
N/A |
Yes |
No |
Create CSR Matrix Handle |
N/A |
Yes |
No |
Create CSC Matrix Handle |
N/A |
Yes |
No |
Create COO Matrix Handle |
N/A |
Yes |
No |
Create BSR Matrix Handle |
N/A |
Yes |
No |
Export CSR Matrix |
Allows access to internal data in the CSR Matrix handle |
Yes |
No |
Export CSC Matrix |
Allows access to internal data in the CSC Matrix handle |
Yes |
No |
Export COO Matrix |
Allows access to internal data in the COO Matrix handle |
Yes |
No |
Export BSR Matrix |
Allows access to internal data in the BSR Matrix handle |
Yes |
No |
Set Value in Matrix |
N/A |
Yes |
No |
Sparse BLAS Optimizization Stages
In the following table for functionality, \(sm\) = \(\text{sparse matrix}\), \(dm\) = \(\text{dense matrix}\), \(sv\) = \(\text{sparse vector}\), \(dv\) = \(\text{dense vector}\), \(sc\) = \(\text{scalar}\).
In the following table for operations, \(\text{dense vectors}\) = \(x\), \(y\), \(\text{sparse vectors}\) = \(w\), \(v\), \(\text{dense matrices}\) = \(X\), \(Y\), \(\text{sparse matrices}\) = \(A\), \(B\), \(C\), and \(\text{scalars}\) = \(\alpha\), \(\beta\), \(d\).
Functionality |
Operations |
CPU |
OpenMP Offload Intel GPU |
|---|---|---|---|
add MEMORY hint and optimize |
Chooses to allow larger memory requiring optimizations or not. |
Yes |
No |
Add GEMV hint and optimize |
N/A |
Yes |
No |
Add SYMV hint and optimize |
N/A |
Yes |
No |
Add TRMV hint and optimize |
N/A |
Yes |
No |
add TRSV hint and optimize |
N/A |
Yes |
No |
add GEMM hint and optimize |
N/A |
Yes |
No |
add TRSM hint and optimize |
N/A |
Yes |
No |
add DOTMV hint and optimize |
N/A |
Yes |
No |
add SYMGS hint and optimize |
N/A |
Yes |
No |
add SYMGS_MV hint and optimize |
N/A |
Yes |
No |
add LU_SMOOTHER hint and optimize |
N/A |
Yes |
No |