openseespy_solvers.nvmath¶
NVIDIA nvmath.sparse direct solver constructor.
This module provides a CUDA direct solver for OpenSeesPy PythonSparse linear systems.
It wraps nvmath.sparse.advanced.DirectSolver and returns a solver object that can be
registered with ops.system("PythonSparse", ...).
Solving Linear Problems¶
| Constructor | nvmath analogue | Description |
|---|---|---|
direct_solver |
nvmath.sparse.advanced.DirectSolver |
Sparse direct solver on CUDA |
Installation¶
Install the CUDA extra matching your driver:
OpenSeesPy Usage¶
from openseespy_solvers.nvmath import direct_solver
solver = direct_solver()
ops.system("PythonSparse", solver.to_openseespy())
API compatibility with nvmath¶
direct_solver() mirrors
nvmath.sparse.advanced.DirectSolver
where it can: pass execution= through to the underlying constructor, map
multithreading_lib= to DirectSolverOptions, and apply plan_algorithm= on
solver.plan_config before planning. OpenSees supplies a and b; the wrapper
calls plan(), factorize(), and solve() and reuses the factorization when
OpenSees reports matrix_status='UNCHANGED'.
Not exposed: stream, a full options= object, and other plan_config /
factorization_config settings. Use nvmath directly if you need those.
Notes¶
direct_solver() runs on the GPU by default. OpenSeesPy supplies CPU buffers; the solver
copies them to the device, factors the sparse matrix with nvmath.sparse/cuDSS, and writes the
solution back through the OpenSeesPy callback.
Function Reference¶
Sparse direct solvers for OpenSeesPy (NVIDIA nvmath.sparse backend, GPU).
This module wraps :class:nvmath.sparse.advanced.DirectSolver for OpenSeesPy's
PythonSparse linear system command on the GPU (cupyx.scipy.sparse matrices).
Requires cupy and a CUDA-capable GPU; use scipy solvers on CPU instead.
Importing this module does not require nvmath-python; the dependency is
loaded when direct_solver() is called. Install a CUDA-matched extra, for example
python -m pip install "openseespy-solvers[cuda13]".
See Also
nvmath.sparse.advanced.DirectSolver openseespy_solvers.cupy.spsolve
direct_solver
¶
direct_solver(*, sp_module: Any | None = None, device: str = 'gpu', execution: Any | None = None, plan_algorithm: Any | None = None, multithreading_lib: str | None = None, scheme: str | None = None, writable: str | list[str] = 'none', debug: bool = False, dtype: Any = float64) -> _DirectSolver
Source code in src/openseespy_solvers/nvmath/__init__.py
160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 | |