-
Notifications
You must be signed in to change notification settings - Fork 26
Feature sparse linalg solvers #2841
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Open
abagusetty
wants to merge
66
commits into
IntelPython:master
Choose a base branch
from
abagusetty:feature-sparse-linalg-solvers
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
66 commits
Select commit
Hold shift + click to select a range
a7c8d31
Add sparse.linalg iterative solvers
abagusetty e3e9052
Add sparse.linalg iterative solvers
abagusetty c0e9fb5
Add sparse.linalg iterative solvers
abagusetty 943c52f
Add sparse.linalg iterative solvers
abagusetty 1191f7e
Add sparse.linalg iterative solvers
abagusetty 2384185
Fix deprecated tol kwarg in SciPy host fallback
abagusetty 4720291
sparse/linalg: complete LinearOperator algebra, CG/GMRES/MINRES with …
abagusetty 58cc44b
Add tests for scipy.sparse.linalg: LinearOperator, cg, gmres, minres
abagusetty 3a50062
Fix implicit numpy conversion; use .asnumpy() for dpnp arrays
abagusetty 62cf7a4
tests: add comprehensive sparse linalg tests for LinearOperator, cg, …
abagusetty d924816
tests: rewrite sparse linalg tests to match dpnp test_linalg.py style
abagusetty f295bc1
Fix dtype inference: use int8 trial vector so matvec preserves operat…
abagusetty 8c68d98
add onemkl sparse gemv pybind logic
abagusetty 0c4a888
sparse: add pybind11 module, CMakeLists, and hook _sparse_impl into _…
abagusetty 4993120
Remove redundant sparse_gemv.hpp passthrough header
abagusetty a7ddc1c
sparse: gemv.cpp includes gemv.hpp directly
abagusetty 14cb5c4
sparse: capture exec_q from CSR data at closure construction
abagusetty 890238c
sparse/gemv: add missing headers, input validation, and MKL/SYCL exce…
abagusetty 838dfd8
sparse/gemv: replace explicit if/else type dispatch with 2-D dispatch…
abagusetty 7bc86c9
sparse/gemv.hpp: rename init_sparse_gemv_dispatch_vector -> init_spar…
abagusetty 6136da2
sparse/gemv: fix deprecated set_csr_data and unused nnz warning
abagusetty ed58333
minor cleanup for sparse extensions
abagusetty 0a32b57
Fix SyntaxError: remove stray backslash in aslinearoperator hasattr s…
abagusetty 6910332
Fix tests: replace numpy.asarray(dpnp_arr) with dpnp_arr.asnumpy()
abagusetty 2a4566f
Fix test failures: dtype guards and preconditioner/callback_type vali…
abagusetty 4292518
sparse/linalg: pure-GPU CG/GMRES/MINRES, drop all CPU fallback paths,…
abagusetty 125dab5
Fix dtype.char AttributeError on dpnp dtype objects in CG/GMRES/MINRES
abagusetty 2d753cf
Fix M guard, MINRES betacheck decay and gbar init in Paige-Saunders r…
abagusetty cb2a5b8
fix: correct 6 runtime bugs in sparse linalg iterative solvers
abagusetty b70ecfd
Fix MINRES Paige-Saunders QR recurrence (fixes TestSolverConsistency …
abagusetty 969b1e9
Fix MINRES stagnation false-positive on float32: reorder convergence/…
abagusetty 18bd2c3
fix: 3 bugs in _iterative.py (asnumpy, GMRES V alloc, MINRES atol)
abagusetty cd4907a
Fix deprecated tol kwarg in SciPy host fallback (cg, gmres use rtol=)
abagusetty c6d109d
sparse/linalg: fix cg/gmres/minres -- rtol alias, M support, dead SPD…
abagusetty ea4989b
sparse/linalg: fix SpMV handle lifecycle, complex dtypes, tol→rtol, M…
abagusetty c223ce2
update WIP
abagusetty e1a41b3
minor fixes
abagusetty 4442530
Add testing
abagusetty ac3bed5
black formatting
abagusetty 3e47f4a
Merge branch 'IntelPython:master' into feature-sparse-linalg-solvers
abagusetty a4ee24f
Update CHANGELOG.md
abagusetty 7e81346
Merge branch 'feature-sparse-linalg-solvers' of https://github.com/ab…
abagusetty c330a04
remove stale testing
abagusetty 0badee4
Add the missing onemkl-sycl-sparse dep to conda-recipe
abagusetty 4be3d9a
fix pre-commit issues
abagusetty 651aaeb
Try again with formatting fix
abagusetty eecf9d6
Merge branch 'master' into feature-sparse-linalg-solvers
abagusetty 555e547
Merge remote-tracking branch 'origin/master' into feature-sparse-lina…
abagusetty 8d0149e
Remove __bool__ fallback from _is_boolean in _slicing.pxi
vlad-perevezentsev 672a45c
Support range/list as advanced index keys in dpnp_array
vlad-perevezentsev 7ef44b7
Add tests for range/list advanced indexing
vlad-perevezentsev 5f5b0b1
Update changelog
vlad-perevezentsev 830ef88
Handle list/empty list advanced indexing correctly
vlad-perevezentsev 18bb358
Apply remark
vlad-perevezentsev e64845c
Merge master into fix_inplace_indexind_4d
vlad-perevezentsev 87388b4
Merge master into fix_inplace_indexind_4d
vlad-perevezentsev 9605678
Merge remote-tracking branch 'upstream/fix_inplace_indexind_4d' into …
abagusetty f66f7eb
Merge branch 'master' into feature-sparse-linalg-solvers
abagusetty d04ca68
Merge branch 'feature-sparse-linalg-solvers' of https://github.com/ab…
abagusetty 3ab930c
fix clang-formagt
abagusetty 181eb59
fix the cyclic importing issue
abagusetty f38ae7b
Merge branch 'master' into feature-sparse-linalg-solvers
abagusetty a524637
One more try to fix the git actions
abagusetty 83f6a3d
Merge branch 'feature-sparse-linalg-solvers' of https://github.com/ab…
abagusetty a375760
Fix pylint failures
abagusetty 36042c6
Merge branch 'master' into feature-sparse-linalg-solvers
abagusetty File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change | ||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| @@ -0,0 +1,119 @@ | ||||||||||||
| # -*- coding: utf-8 -*- | ||||||||||||
| # ***************************************************************************** | ||||||||||||
| # Copyright (c) 2025, Intel Corporation | ||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. need to bump copyright year for new added file, should be the current year
Suggested change
|
||||||||||||
| # 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}) | ||||||||||||
|
|
||||||||||||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||||||||
| 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 | ||||||||||||
| ${CMAKE_SOURCE_DIR}/dpnp/backend/include | ||||||||||||
| ${CMAKE_SOURCE_DIR}/dpnp/tensor/libtensor/include | ||||||||||||
| ) | ||||||||||||
|
|
||||||||||||
| # 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} | ||||||||||||
| ${CMAKE_BINARY_DIR} # For generated Cython headers | ||||||||||||
| ) | ||||||||||||
|
|
||||||||||||
| 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") | ||||||||||||
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
need to move to 0.21.0 release