Installation¶
- PyPI:
pip install torch-sla— simplest installation - GitHub: Clone and install for development
- Optional backends: cuDSS, STRUMPACK, PyAMG, AmgX for enhanced performance
Using pip¶
To install the latest release:
pip install torch-sla
Or install from GitHub for the latest development version:
pip install git+https://github.com/walkerchi/torch-sla.git
Optional Dependencies¶
The core install pulls in torch, numpy, scipy, and ninja — enough to
run CPU solvers out of the box. GPU users can pick the backend(s) they need:
# NVIDIA GPU users (CUDA 12+, Linux/Windows):
pip install torch-sla[cudss] # + cuDSS direct solver (fastest for ~10K-2M DOF, NVIDIA-only)
# CPU users (all platforms, including macOS):
pip install torch-sla[pyamg] # + PyAMG (CPU AMG setup + on-device V-cycle)
# STRUMPACK direct solver (CPU/CUDA/ROCm) and AmgX (NVIDIA GPU AMG/Krylov)
# are NOT pip extras — they are prebuilt wheels on GitHub Releases (see below):
# https://github.com/sparsexlab/torch-strumpack/releases
# https://github.com/sparsexlab/torch-amgx/releases
# Full installation with all *PyPI-installable* runtime backends
# (does not include dev/docs; the native torch-amgx / torch-strumpack
# backends are GitHub-Release wheels — see "Prebuilt wheels" below)
pip install torch-sla[all]
# For development tools (pytest, black, isort, mypy)
pip install torch-sla[dev]
# For documentation tools (sphinx, furo)
pip install torch-sla[docs]
Note
The two native (compiled) backends — torch-amgx (NVIDIA AmgX)
and torch-strumpack (STRUMPACK) — are not on PyPI and are not
pip extras. In particular, torch-sla[all] does not pull them in.
They are PyTorch C++/CUDA extensions published as prebuilt wheels on
GitHub Releases. Pick the wheel that matches both your CUDA
version and your installed PyTorch version — see
Prebuilt wheels: torch-amgx & torch-strumpack below.
Prebuilt wheels: torch-amgx & torch-strumpack¶
torch-amgx and torch-strumpack are compiled PyTorch extensions, so
no PyPI package exists. Download the matching wheel from GitHub Releases:
torch-amgx — https://github.com/sparsexlab/torch-amgx/releases — Linux + Windows, Python 3.10-3.13, CUDA 12.4 / 12.6 / 12.8. Each wheel carries a per-CUDA build tag in its filename:
0_cu124/0_cu126/0_cu128. The cu12.8 wheels include NVIDIA Blackwell (sm_100/sm_120).torch-strumpack — https://github.com/sparsexlab/torch-strumpack/releases — Linux (cpu / cuda / rocm) + macOS arm64, Python 3.10-3.13. Windows (CPU) is supported — STRUMPACK builds on Windows with
clang-cl(C/C++) +flang(Fortran) from conda-forge, linked against MSVC-built PyTorch (a clean-env solve gives relative residual ~1.7e-16). A prebuilt Windows wheel via CI is being added.
Warning
ABI compatibility — read before downloading. These wheels are torch C++ extensions, so each one is ABI-tied to both (a) the CUDA version it was built against and (b) the specific PyTorch version. You must:
Pick the wheel whose
0_cuXXXtag matchestorch.version.cuda(check withpython -c "import torch; print(torch.version.cuda)").Have a PyTorch version matching the one the wheel was built against (shown in the release notes).
A mismatch fails at import, not at install — with
DLL load failed ... procedure not found on Windows or an
undefined symbol error on Linux.
Install a release wheel directly by URL with --no-deps (so pip does not
try to resolve a non-existent PyPI package):
# Example: torch-amgx for CUDA 12.6 + CPython 3.13 (replace with the
# exact asset URL from the Releases page for your torch / CUDA / Python)
pip install --no-deps \
https://github.com/sparsexlab/torch-amgx/releases/download/<tag>/torch_amgx-<ver>-0_cu126-cp313-cp313-linux_x86_64.whl
# torch-strumpack (cuda / rocm / cpu / macos-arm64 variants on the page)
pip install --no-deps \
https://github.com/sparsexlab/torch-strumpack/releases/download/<tag>/torch_strumpack-<ver>-cp313-cp313-linux_x86_64.whl
After install, confirm the backend loaded with torch_sla.show_backends().
Verify your environment
After installation, you can inspect which backends are available on your machine:
import torch_sla
torch_sla.show_backends()
Backend Requirements¶
Backend |
Installation |
Notes |
|---|---|---|
|
|
Default, always available |
|
Included with PyTorch |
Native CG/BiCGStab solvers. Device-agnostic — runs on CPU / CUDA / ROCm. |
|
prebuilt wheel from torch-strumpack Releases (see Prebuilt wheels: torch-amgx & torch-strumpack) |
Portable multifrontal sparse direct solver (multifrontal LU,
real + complex, full autograd). Runs on CPU / CUDA / ROCm
(Linux) + macOS arm64 — the direct-solver path on AMD ROCm where
cuDSS is unavailable. Not on PyPI. Windows (CPU) is supported —
STRUMPACK builds with |
|
|
Best for medium-scale GPU problems (10K-2M DOF). NVIDIA CUDA only. |
|
prebuilt wheel from torch-amgx Releases (see Prebuilt wheels: torch-amgx & torch-strumpack) |
GPU AMG + Krylov (PCG / PBiCGStab / FGMRES). Linux / Windows +
NVIDIA CUDA only (incl. Blackwell |
|
|
CPU AMG setup + cross-device V-cycle. Works on all platforms
(including macOS); GPU V-cycle uses |
Recommended Setup by Environment¶
Use this table to pick the “best-bang-for-buck” backend mix for your machine.
torch_sla.solve(..., backend="auto") will already pick a reasonable
default for whatever’s installed, but installing the extras below unlocks
the fastest path for each environment.
Environment |
Install command |
What you get |
|---|---|---|
Linux + NVIDIA GPU |
|
Direct GPU LU (cuDSS), GPU AMG / Krylov (AmgX), portable direct solve
(STRUMPACK). The full GPU stack — use |
Windows + NVIDIA GPU |
|
cuDSS + AmgX ship Windows wheels. STRUMPACK now builds on Windows
(CPU) via |
Linux + AMD / Intel GPU |
|
cuDSS is NVIDIA-only and does not run here. The PyTorch-native
Krylov solvers (CG / BiCGStab / GMRES / MINRES / LSQR / LSMR) are
device-agnostic and run on ROCm. STRUMPACK gives a GPU direct
solve on ROCm (multifrontal LU). PyAMG-hybrid does CPU setup
+ on-device V-cycle via |
Linux / Windows CPU-only |
|
PyAMG for AMG, SciPy for direct + Krylov, |
macOS (Intel / Apple Silicon) |
|
CUDA is unavailable on macOS — |
Tip
torch_sla.show_backends() prints which backends actually loaded on
your machine — handy after install to confirm the GPU paths picked up
the right libraries.