Registry / ai-ml / onemkl-sycl-sparse

onemkl-sycl-sparse

JSON →
library2026.0.0pypypiunverified

Intel oneAPI Math Kernel Library (oneMKL) Sparse BLAS routines for SYCL devices. This package provides optimized sparse linear algebra operations (e.g., sparse matrix-vector multiply, sparse triangular solvers) on Intel GPUs and CPUs using SYCL. Current version: 2026.0.0. Released quarterly as part of Intel's oneAPI toolkit.

pip install onemkl-sycl-sparse
INSTALL
IMPORT
SIG · ONEMKL-SYCL-SPARSE
O
onemkl-sycl-sparse
ai-mlpythonv2026.0.0
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

sparse
import onemkl_sycl_sparse
from onemkl_sycl_sparse import sparse

Performs a sparse matrix-vector multiply using CSR format on a SYCL GPU device.

import dpctl import numpy as np from onemkl_sycl_sparse import sparse # Create a SYCL queue (device selector: 0 for gpu, 1 for cpu) queue = dpctl.SyclQueue("gpu") # Create a simple CSR matrix row = np.array([0, 0, 1, 2], dtype=np.int64) col = np.array([0, 1, 1, 2], dtype=np.int64) val = np.array([1.0, 2.0, 3.0, 4.0], dtype=np.float64) nrows, ncols = 3, 3 # Allocate USM memory d_row = dpctl.tensor.usm_ndarray(row, dtype=row.dtype, queue=queue) d_col = dpctl.tensor.usm_ndarray(col, dtype=col.dtype, queue=queue) d_val = dpctl.tensor.usm_ndarray(val, dtype=val.dtype, queue=queue) # Create handle and perform operation handle = sparse.create_handle(queue) sparse_matrix = sparse.init_csr_matrix(handle, nrows, ncols, d_row, d_col, d_val) # Sparse matrix-vector multiply x = np.array([1.0, 2.0, 3.0], dtype=np.float64) d_x = dpctl.tensor.usm_ndarray(x, dtype=x.dtype, queue=queue) d_y = dpctl.tensor.empty(3, dtype=np.float64, queue=queue) sparse.omatadd(handle, sparse_matrix, sparse_matrix, 1.0, 1.0, d_x, d_y) y = d_y.asnumpy() print(y) sparse.destroy_handle(handle)
Debug
Known issues
gotchaAll input arrays (row, col, val) must be on the same SYCL device as the queue. Do not mix host memory (numpy) directly without copying to USM.
fix
Use dpctl.tensor.usm_ndarray to allocate device memory and copy data.
affects: all
gotchaMatrix handles must be explicitly created and destroyed. Forgetting sparse.destroy_handle leads to memory leaks.
fix
Always pair sparse.create_handle with sparse.destroy_handle, ideally in a try-finally block or context manager (if available).
affects: all
gotchaThe sparse module expects Fortran-style (column-major) ordering for some internal operations, but CSR arrays are typically row-major. Ensure row-index array is sorted and unique per row.
fix
Pre-process CSR arrays to be in sorted column order per row (e.g., using scipy sparse CSR construction).
affects: all
deprecatedThe old import path from 'oneapi.mkl' is deprecated and removed in 2026.0.0.
fix
Use 'from onemkl_sycl_sparse import sparse'.
affects: <2026.0.0
Upgrade
Version history
2026.0.0latest on PyPI · released Apr 24, 2026
Audit
Dependencies
numpyoptionalArray compatibility and data type conversions
dpctlrequiredSYCL device management and USM allocation
dpnpoptionalNumPy-like API on SYCL devices (optional, but recommended for ease of use)
Agent activity
2 hits · last 30 days
node
2
Resources
onemkl-sycl-sparse — pip install onemkl-sycl-sparse · libregistry