Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
45 commits
Select commit Hold shift + click to select a range
a7c8d31
Add sparse.linalg iterative solvers
abagusetty Apr 2, 2026
e3e9052
Add sparse.linalg iterative solvers
abagusetty Apr 2, 2026
c0e9fb5
Add sparse.linalg iterative solvers
abagusetty Apr 2, 2026
943c52f
Add sparse.linalg iterative solvers
abagusetty Apr 2, 2026
1191f7e
Add sparse.linalg iterative solvers
abagusetty Apr 2, 2026
2384185
Fix deprecated tol kwarg in SciPy host fallback
abagusetty Apr 3, 2026
4720291
sparse/linalg: complete LinearOperator algebra, CG/GMRES/MINRES with …
abagusetty Apr 3, 2026
58cc44b
Add tests for scipy.sparse.linalg: LinearOperator, cg, gmres, minres
abagusetty Apr 6, 2026
3a50062
Fix implicit numpy conversion; use .asnumpy() for dpnp arrays
abagusetty Apr 6, 2026
62cf7a4
tests: add comprehensive sparse linalg tests for LinearOperator, cg, …
abagusetty Apr 6, 2026
d924816
tests: rewrite sparse linalg tests to match dpnp test_linalg.py style
abagusetty Apr 6, 2026
f295bc1
Fix dtype inference: use int8 trial vector so matvec preserves operat…
abagusetty Apr 6, 2026
8c68d98
add onemkl sparse gemv pybind logic
abagusetty Apr 6, 2026
0c4a888
sparse: add pybind11 module, CMakeLists, and hook _sparse_impl into _…
abagusetty Apr 6, 2026
4993120
Remove redundant sparse_gemv.hpp passthrough header
abagusetty Apr 6, 2026
a7ddc1c
sparse: gemv.cpp includes gemv.hpp directly
abagusetty Apr 6, 2026
14cb5c4
sparse: capture exec_q from CSR data at closure construction
abagusetty Apr 6, 2026
890238c
sparse/gemv: add missing headers, input validation, and MKL/SYCL exce…
abagusetty Apr 6, 2026
838dfd8
sparse/gemv: replace explicit if/else type dispatch with 2-D dispatch…
abagusetty Apr 6, 2026
7bc86c9
sparse/gemv.hpp: rename init_sparse_gemv_dispatch_vector -> init_spar…
abagusetty Apr 7, 2026
6136da2
sparse/gemv: fix deprecated set_csr_data and unused nnz warning
abagusetty Apr 7, 2026
ed58333
minor cleanup for sparse extensions
abagusetty Apr 7, 2026
0a32b57
Fix SyntaxError: remove stray backslash in aslinearoperator hasattr s…
abagusetty Apr 7, 2026
6910332
Fix tests: replace numpy.asarray(dpnp_arr) with dpnp_arr.asnumpy()
abagusetty Apr 7, 2026
2a4566f
Fix test failures: dtype guards and preconditioner/callback_type vali…
abagusetty Apr 7, 2026
4292518
sparse/linalg: pure-GPU CG/GMRES/MINRES, drop all CPU fallback paths,…
abagusetty Apr 7, 2026
125dab5
Fix dtype.char AttributeError on dpnp dtype objects in CG/GMRES/MINRES
abagusetty Apr 7, 2026
2d753cf
Fix M guard, MINRES betacheck decay and gbar init in Paige-Saunders r…
abagusetty Apr 7, 2026
cb2a5b8
fix: correct 6 runtime bugs in sparse linalg iterative solvers
abagusetty Apr 7, 2026
b70ecfd
Fix MINRES Paige-Saunders QR recurrence (fixes TestSolverConsistency …
abagusetty Apr 7, 2026
969b1e9
Fix MINRES stagnation false-positive on float32: reorder convergence/…
abagusetty Apr 7, 2026
18bd2c3
fix: 3 bugs in _iterative.py (asnumpy, GMRES V alloc, MINRES atol)
abagusetty Apr 7, 2026
cd4907a
Fix deprecated tol kwarg in SciPy host fallback (cg, gmres use rtol=)
abagusetty Apr 7, 2026
c6d109d
sparse/linalg: fix cg/gmres/minres -- rtol alias, M support, dead SPD…
abagusetty Apr 7, 2026
ea4989b
sparse/linalg: fix SpMV handle lifecycle, complex dtypes, tol→rtol, M…
abagusetty Apr 7, 2026
c223ce2
update WIP
abagusetty Apr 7, 2026
e1a41b3
minor fixes
abagusetty Apr 8, 2026
4442530
Add testing
abagusetty Apr 9, 2026
ac3bed5
black formatting
abagusetty Apr 9, 2026
3e47f4a
Merge branch 'IntelPython:master' into feature-sparse-linalg-solvers
abagusetty Apr 9, 2026
a4ee24f
Update CHANGELOG.md
abagusetty Apr 9, 2026
7e81346
Merge branch 'feature-sparse-linalg-solvers' of https://github.com/ab…
abagusetty Apr 9, 2026
c330a04
remove stale testing
abagusetty Apr 9, 2026
0badee4
Add the missing onemkl-sycl-sparse dep to conda-recipe
abagusetty Apr 9, 2026
4be3d9a
fix pre-commit issues
abagusetty Apr 9, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@ Also, that release drops support for Python 3.9, making Python 3.10 the minimum
* Added implementation of `dpnp.isin` function [#2595](https://github.com/IntelPython/dpnp/pull/2595)
* Added implementation of `dpnp.scipy.linalg.lu` (SciPy-compatible) [#2787](https://github.com/IntelPython/dpnp/pull/2787)
* Added support for ndarray subclassing via `dpnp.ndarray.view` method with `type` parameter [#2815](https://github.com/IntelPython/dpnp/issues/2815)
* Added implementation of `dpnp.scipy.sparse.linalg import LinearOperator, cg, gmres, minres` [#2841](https://github.com/IntelPython/dpnp/pull/2841)

### Changed

Expand Down
1 change: 1 addition & 0 deletions conda-recipe/meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@ requirements:
- {{ pin_compatible('onemkl-sycl-lapack', min_pin='x.x', max_pin='x') }}
- {{ pin_compatible('onemkl-sycl-rng', min_pin='x.x', max_pin='x') }}
- {{ pin_compatible('onemkl-sycl-vm', min_pin='x.x', max_pin='x') }}
- {{ pin_compatible('onemkl-sycl-sparse', min_pin='x.x', max_pin='x') }}
- numpy
- intel-gpu-ocl-icd-system

Expand Down
1 change: 1 addition & 0 deletions dpnp/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ add_subdirectory(backend/extensions/statistics)
add_subdirectory(backend/extensions/ufunc)
add_subdirectory(backend/extensions/vm)
add_subdirectory(backend/extensions/window)
add_subdirectory(backend/extensions/sparse)

add_subdirectory(dpnp_algo)
add_subdirectory(dpnp_utils)
Expand Down
113 changes: 113 additions & 0 deletions dpnp/backend/extensions/sparse/CMakeLists.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
# -*- coding: utf-8 -*-
# *****************************************************************************
# Copyright (c) 2025, Intel Corporation
# All rights reserved.
#
# Redistribution and use in source and binary forms, with or without
# modification, are permitted provided that the following conditions are met:
# - Redistributions of source code must retain the above copyright notice,
# this list of conditions and the following disclaimer.
# - Redistributions in binary form must reproduce the above copyright notice,
# this list of conditions and the following disclaimer in the documentation
# and/or other materials provided with the distribution.
# - Neither the name of the copyright holder nor the names of its contributors
# may be used to endorse or promote products derived from this software
# without specific prior written permission.
#
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF
# THE POSSIBILITY OF SUCH DAMAGE.
# *****************************************************************************

set(python_module_name _sparse_impl)
set(_module_src
${CMAKE_CURRENT_SOURCE_DIR}/sparse_py.cpp
${CMAKE_CURRENT_SOURCE_DIR}/gemv.cpp
)

pybind11_add_module(${python_module_name} MODULE ${_module_src})
add_sycl_to_target(TARGET ${python_module_name} SOURCES ${_module_src})

if(_dpnp_sycl_targets)
# make fat binary
target_compile_options(
${python_module_name}
PRIVATE ${_dpnp_sycl_target_compile_options}
)
target_link_options(${python_module_name} PRIVATE ${_dpnp_sycl_target_link_options})
endif()

if(WIN32)
if(${CMAKE_VERSION} VERSION_LESS "3.27")
# this is a work-around for target_link_options inserting option after -link option, cause
# linker to ignore it.
set(CMAKE_CXX_LINK_FLAGS
"${CMAKE_CXX_LINK_FLAGS} -fsycl-device-code-split=per_kernel"
)
endif()
endif()

set_target_properties(
${python_module_name}
PROPERTIES CMAKE_POSITION_INDEPENDENT_CODE ON
)

target_include_directories(
${python_module_name}
PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/../common
)

# treat below headers as system to suppress the warnings there during the build
target_include_directories(
${python_module_name}
SYSTEM
PRIVATE ${SYCL_INCLUDE_DIR} ${Dpctl_INCLUDE_DIRS} ${Dpctl_TENSOR_INCLUDE_DIR}
)

if(WIN32)
target_compile_options(
${python_module_name}
PRIVATE /clang:-fno-approx-func /clang:-fno-finite-math-only
)
else()
target_compile_options(
${python_module_name}
PRIVATE -fno-approx-func -fno-finite-math-only
)
endif()

target_link_options(${python_module_name} PUBLIC -fsycl-device-code-split=per_kernel)

if(DPNP_GENERATE_COVERAGE)
target_link_options(
${python_module_name}
PRIVATE -fprofile-instr-generate -fcoverage-mapping
)
endif()

if(_ues_onemath)
target_link_libraries(${python_module_name} PRIVATE ${ONEMATH_LIB})
target_compile_options(${python_module_name} PRIVATE -DUSE_ONEMATH)
if(_ues_onemath_cuda)
target_compile_options(${python_module_name} PRIVATE -DUSE_ONEMATH_CUSPARSE)
endif()
else()
target_link_libraries(${python_module_name} PUBLIC MKL::MKL_SYCL::SPARSE)
endif()

if(DPNP_WITH_REDIST)
set_target_properties(
${python_module_name}
PROPERTIES INSTALL_RPATH "$ORIGIN/../../../../../../"
)
endif()

install(TARGETS ${python_module_name} DESTINATION "dpnp/backend/extensions/sparse")
Loading