Summary
The FD solver currently uses UMFpack via scipy.sparse.linalg.spsolve(..., use_umfpack=True), which is single-threaded. For large grids the sparse LU factorization dominates runtime (e.g., ~5 s at 400×400). Parallel sparse direct solvers — PARDISO (Intel MKL) or MUMPS — can factorize in near-linear time with core count.
Options
PARDISO (via pypardiso):
- Wraps Intel MKL PARDISO; drop-in replacement (
from pypardiso import spsolve)
- Multithreaded factorization and solve; typically 4–8× faster than UMFpack on 8+ cores
- Intel hardware only: optimized for Intel silicon and may underperform or behave unpredictably on AMD CPUs due to MKL's CPU dispatch. Not recommended for AMD-based machines.
- Requires Intel MKL at runtime (available in most conda environments; less reliable on pure pip installs)
CHOLMOD (via scikit-sparse, SuiteSparse):
- Hardware-agnostic — works correctly on AMD, ARM, and any other CPU
- Cholesky factorization: faster than LU but requires the coefficient matrix to be symmetric positive definite (SPD)
- The gFlex biharmonic FD matrix (∇²(D∇²·)) should be SPD for most standard BCs, but this needs verification across all BC combinations before relying on it
conda install -c conda-forge scikit-sparse
MUMPS (via python-mumps):
- Open-source, MPI-parallel, hardware-agnostic
- Handles non-symmetric matrices — no SPD requirement
- More complex installation; better suited to HPC/cluster scenarios than single-node use
conda install -c conda-forge python-mumps
Suggested approach
- Keep UMFpack as the default (no new required dependencies)
- Check for an available solver at runtime and use it, or expose
flex.sparse_solver = "pardiso" / "cholmod" / "mumps" as an opt-in
- Document in configuration reference
Expected benefit
Near-linear speedup in core count for the factorization step on large grids. Most impactful for 200×200 and above where factorization takes >0.5 s.
Cost
- Optional dependency only — no change for users without it
- CHOLMOD requires verifying SPD property across all gFlex BC combinations before use
- pypardiso is Intel-specific; MUMPS adds MPI complexity
- All options need benchmarking and correctness testing across BC combinations before shipping
Summary
The FD solver currently uses UMFpack via
scipy.sparse.linalg.spsolve(..., use_umfpack=True), which is single-threaded. For large grids the sparse LU factorization dominates runtime (e.g., ~5 s at 400×400). Parallel sparse direct solvers — PARDISO (Intel MKL) or MUMPS — can factorize in near-linear time with core count.Options
PARDISO (via
pypardiso):from pypardiso import spsolve)CHOLMOD (via
scikit-sparse, SuiteSparse):conda install -c conda-forge scikit-sparseMUMPS (via
python-mumps):conda install -c conda-forge python-mumpsSuggested approach
flex.sparse_solver = "pardiso"/"cholmod"/"mumps"as an opt-inExpected benefit
Near-linear speedup in core count for the factorization step on large grids. Most impactful for 200×200 and above where factorization takes >0.5 s.
Cost