Skip to content

Commit c225bd8

Browse files
committed
Update documentation and naming
1 parent 9b2d052 commit c225bd8

File tree

3 files changed

+33
-20
lines changed

3 files changed

+33
-20
lines changed

xobjects/sparse/_sparse.py

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -109,7 +109,7 @@ def factorized_sparse_solver(A: Union[scipy.sparse.csr_matrix,
109109
* `"scipySLU"` : Use `scipy.sparse.linalg.splu` (CPU).
110110
* `"PyKLU"` : Use the `PyKLU.Klu` solver (CPU).
111111
* `"cuDSS"` : Use CUDA/cuDSS-based `DirectSolverSuperLU` (GPU).
112-
* `"CachedSLU"`: Use CUDA cached SuperLU (`luLU`) (GPU).
112+
* `"CachedSLU"`: Use CUDA cached spsm SuperLU (`luLU`) (GPU).
113113
* `"cupySLU"` : Use `cupyx.scipy.sparse.linalg.splu` (GPU).
114114
115115
Using a solver that does not match the current `context` will result
@@ -153,8 +153,20 @@ def factorized_sparse_solver(A: Union[scipy.sparse.csr_matrix,
153153
- `PyKLU.Klu` (for `"PyKLU"`).
154154
* CUDA/CuPy:
155155
- `DirectSolverSuperLU` (cuDSS),
156-
- `luLU` (cached SuperLU),
156+
- `luLU` (cached spsm SuperLU),
157157
- `cupyx.scipy.sparse.linalg.SuperLU` (for `"cupySLU"`).
158+
159+
All returned solver objects implement a `solve(b)` method.
160+
For **optimal performance across all backends**, the right-hand
161+
side `b` should be passed as a **Fortran-contiguous (column-major)**
162+
array:
163+
164+
* For a single RHS: shape ``(n,)`` or ``(n, 1)`` (Fortran contiguous).
165+
* For multiple RHSs: shape ``(n, nrhs)`` with **Fortran layout**.
166+
167+
If `b` is not Fortran-contiguous, the solver will internally copy or
168+
transform it, which can incur extra overhead—especially on CUDA/GPU
169+
backends and in batched-solve scenarios.
158170
159171
Raises
160172
------
Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,11 @@
1-
from scipy.sparse.linalg import splu as scipySuperLU
2-
from ....context import ModuleNotAvailableError
3-
1+
from scipy.sparse.linalg import splu as scipysplu
42
try:
5-
from PyKLU import Klu as KLUSuperLU
3+
from PyKLU import Klu as KLU
64
except (ModuleNotFoundError,ImportError) as e:
7-
def KLUSuperLU(*args, _import_err=e, **kwargs):
5+
def KLU(*args, _import_err=e, **kwargs):
6+
from ....context import ModuleNotAvailableError
87
raise ModuleNotAvailableError(
9-
"KLUSuperLU is not available. Could not import required backend."
8+
"KLU is not available. Could not import required backend."
109
) from _import_err
1110

12-
__all__ = ["scipySuperLU", "KLUSuperLU"]
11+
__all__ = ["scipysplu", "KLU"]
Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,24 +1,26 @@
1-
from ....context import ModuleNotAvailableError
21
try:
3-
from ._cuDSSLU import DirectSolverSuperLU as cuDSSSuperLU
2+
from ._cuDSSLU import DirectSolverSuperLU as cuDSS
43
except (ModuleNotFoundError,ImportError) as e:
5-
def cuDSSSuperLU(*args, _import_err=e, **kwargs):
4+
def cuDSS(*args, _import_err=e, **kwargs):
5+
from ....context import ModuleNotAvailableError
66
raise ModuleNotAvailableError(
7-
"cuDSSSuperLU is not available. Could not import required backend."
7+
"cuDSS is not available. Could not import required backend."
88
) from _import_err
99
try:
10-
from ._luLU import luLU as CachedSuperLU
10+
from ._luLU import luLU as cachedSpSM
1111
except (ModuleNotFoundError,ImportError) as e:
12-
def CachedSuperLU(*args, _import_err=e, **kwargs):
12+
def cachedSpSM(*args, _import_err=e, **kwargs):
13+
from ....context import ModuleNotAvailableError
1314
raise ModuleNotAvailableError(
14-
"CachedSuperLU is not available. Could not import required backend."
15+
"cachedSpSM is not available. Could not import required backend."
1516
) from _import_err
1617
try:
17-
from cupyx.scipy.sparse.linalg import splu as CupySuperLU
18+
from cupyx.scipy.sparse.linalg import splu as cupysplu
1819
except (ModuleNotFoundError,ImportError) as e:
19-
def CupySuperLU(*args, _import_err=e, **kwargs):
20+
def cupysplu(*args, _import_err=e, **kwargs):
21+
from ....context import ModuleNotAvailableError
2022
raise ModuleNotAvailableError(
21-
"CupySuperLU is not available. Could not import required backend."
23+
"cupysplu is not available. Could not import required backend."
2224
) from _import_err
2325

24-
__all__ = ["cuDSSSuperLU", "CachedSuperLU", "CupySuperLU"]
26+
__all__ = ["cuDSS", "cachedSpSM", "cupysplu"]

0 commit comments

Comments
 (0)