{"id":27201,"library":"onemkl-sycl-sparse","title":"oneMKL SYCL Sparse","description":"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.","status":"active","version":"2026.0.0","language":"python","source_language":"en","source_url":"https://github.com/oneapi-src/oneMKL","tags":["sparse","blas","math","intel","sycl","gpu"],"install":[{"cmd":"pip install onemkl-sycl-sparse","lang":"bash","label":"PyPI"},{"cmd":"conda install -c intel onemkl-sycl-sparse","lang":"bash","label":"Conda"}],"dependencies":[{"reason":"Array compatibility and data type conversions","package":"numpy","optional":true},{"reason":"SYCL device management and USM allocation","package":"dpctl","optional":false},{"reason":"NumPy-like API on SYCL devices (optional, but recommended for ease of use)","package":"dpnp","optional":true}],"imports":[{"wrong":"from onemkl_sycl_sparse import sparse","symbol":"sparse","correct":"import onemkl_sycl_sparse"}],"quickstart":{"code":"import dpctl\nimport numpy as np\nfrom onemkl_sycl_sparse import sparse\n\n# Create a SYCL queue (device selector: 0 for gpu, 1 for cpu)\nqueue = dpctl.SyclQueue(\"gpu\")\n\n# Create a simple CSR matrix\nrow = np.array([0, 0, 1, 2], dtype=np.int64)\ncol = np.array([0, 1, 1, 2], dtype=np.int64)\nval = np.array([1.0, 2.0, 3.0, 4.0], dtype=np.float64)\nnrows, ncols = 3, 3\n\n# Allocate USM memory\nd_row = dpctl.tensor.usm_ndarray(row, dtype=row.dtype, queue=queue)\nd_col = dpctl.tensor.usm_ndarray(col, dtype=col.dtype, queue=queue)\nd_val = dpctl.tensor.usm_ndarray(val, dtype=val.dtype, queue=queue)\n\n# Create handle and perform operation\nhandle = sparse.create_handle(queue)\nsparse_matrix = sparse.init_csr_matrix(handle, nrows, ncols, d_row, d_col, d_val)\n\n# Sparse matrix-vector multiply\nx = np.array([1.0, 2.0, 3.0], dtype=np.float64)\nd_x = dpctl.tensor.usm_ndarray(x, dtype=x.dtype, queue=queue)\nd_y = dpctl.tensor.empty(3, dtype=np.float64, queue=queue)\nsparse.omatadd(handle, sparse_matrix, sparse_matrix, 1.0, 1.0, d_x, d_y)\ny = d_y.asnumpy()\nprint(y)\n\nsparse.destroy_handle(handle)","lang":"python","description":"Performs a sparse matrix-vector multiply using CSR format on a SYCL GPU device."},"warnings":[{"fix":"Use dpctl.tensor.usm_ndarray to allocate device memory and copy data.","message":"All 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.","severity":"gotcha","affected_versions":"all"},{"fix":"Always pair sparse.create_handle with sparse.destroy_handle, ideally in a try-finally block or context manager (if available).","message":"Matrix handles must be explicitly created and destroyed. Forgetting sparse.destroy_handle leads to memory leaks.","severity":"gotcha","affected_versions":"all"},{"fix":"Pre-process CSR arrays to be in sorted column order per row (e.g., using scipy sparse CSR construction).","message":"The 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.","severity":"gotcha","affected_versions":"all"},{"fix":"Use 'from onemkl_sycl_sparse import sparse'.","message":"The old import path from 'oneapi.mkl' is deprecated and removed in 2026.0.0.","severity":"deprecated","affected_versions":"<2026.0.0"}],"env_vars":null,"search_vec":"'2026.0.0':42 'algebra':22 'blas':11,53 'cpus':37 'current':40 'devic':15 'e.g':24 'gpu':57 'gpus':35 'intel':4,34,48,55 'kernel':7 'librari':8 'linear':21 'math':6,54 'matrix':27 'matrix-vector':26 'multipli':29 'oneapi':5,50 'onemkl':1,9 'oper':23 'optim':19 'packag':17 'part':46 'provid':18 'quarter':44 'releas':43 'routin':12 'solver':32 'spars':3,10,20,25,30,52 'sycl':2,14,39,56 'toolkit':51 'triangular':31 'use':38 'vector':28 'version':41","created_at":"2026-05-01T17:45:02.242971+00:00","updated_at":"2026-05-01T17:45:02.242971+00:00","problems":{"verify_error":"Traceback (most recent call last):\n  File \"<string>\", line 1, in <module>\nModuleNotFoundError: No module named 'onemkl_sycl_sparse'"},"ecosystem":"pypi","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":"","cli_version":null,"type":"library","homepage":"https://www.intel.com/content/www/us/en/developer/tools/oneapi/onemkl.html","github":null,"docs":null,"changelog":null,"pypi":"https://pypi.org/project/onemkl-sycl-sparse/","npm":null,"openapi_spec":null,"status_page":null,"smithery":null,"categories":["ai-ml","data"],"base_url":null,"auth_type":null,"provenance":{"verified_status":"import_fail","verified_at":"2026-07-03","last_verified":"2026-07-03","next_check":"2026-07-10","install_tag":null}}