SPARTA · GPU sparse direct solver Metal: availableVulkan: available

The sparse direct solver for finite-element problems

SPARSE ACCELERATED RAPID TRIANGULAR ANALYSER

Specialised for the systems finite-element simulations produce, and tuned in many small, measured ways to keep every core busy, so the factorization runs close to the machine's limits on memory bandwidth and arithmetic, on the GPU or CPU. Self-contained, with no external maths libraries, and callable from Python, C/C++, Rust, MATLAB and Julia.

LDLᵀ and LUsupernodal multifrontal, GPU-resident
complex64 + complex128mixed-precision refinement
Built for FEMplanned once, every core kept busy
90% of peakown dense kernels, per processor

Direct solver capabilities

Every part of the solve is designed and measured for mesh problems: the analysis plans the whole factorization once, and the schedule keeps every core doing useful arithmetic, on the GPU or on the CPU.

GPU factorization

  • Supernodal multifrontal method, level-scheduled over the assembly tree
  • Blocked panel factorization with deferred Schur-complement updates
  • Bunch–Kaufman 1×1 and 2×2 pivoting for LDLᵀ; partial pivoting for LU
  • GPU-resident factor store; workspace recycled between tree levels
  • Batched solves, eight right-hand sides per pass

Ordering and analysis

  • Nested-dissection ordering: the fewest operations a mesh allows (n1.5 in 2D, n2 in 3D)
  • Own parallel, deterministic implementation
  • Wide supernodes, so the work runs as large dense products
  • Pattern reuse: refactor new values on the same analysis and GPU memory, for frequency sweeps and time stepping

CPU factorization

  • Same analysis and factorization as the GPU, in double precision
  • SpartaBLAS: SPARTA's own dense kernels, one set per processor family
  • Hand-written kernels for the Arm SME2 matrix unit (Apple M4 and later): 82–91% of peak on one core
  • NEON, AVX2 and AVX-512 kernel sets; Apple's Accelerate on Macs before M4; no BLAS or LAPACK to install
  • Small fronts one per core, large fronts across all cores, from one thread pool that never oversubscribes
  • Real arithmetic for the real parts of complex FEM systems

Accuracy and diagnostics

  • complex64 factorization with complex128 iterative refinement
  • complex128 CPU backend for ill-conditioned systems, selected explicitly
  • Pivot perturbation, counted per factorization
  • Factor-quality verdict per factorization; refinement report per solve

Integration and configuration

  • Python: SciPy sparse matrices in, NumPy arrays out
  • Rust native API; C ABI with a single header and a C++ wrapper
  • MATLAB and Julia bindings over the C library
  • One Config for ordering, supernodes, front geometry and dispatch widths
  • Presets for one-off solves, frequency sweeps and difficult systems
  • Backend selection and pivot failures always reported to the caller

Example integration

The same four steps in each interface: analyze the sparsity pattern, factor, solve and release the GPU memory.

  • Python — takes a SciPy sparse matrix; refinement is on by default.
  • Rust — the native API, with every setting in one Config.
  • C and C++ — one header and one shared library.
  • MATLAB — a SpartaSolver class used like decomposition, built as a MEX file. Not yet tested in MATLAB.
  • Julia — a Solver type with \ and factorize!, calling the library directly.
  • Installation — pip install sparta-solver installs a prebuilt wheel on macOS, Linux and Windows, with no compiler needed.
import numpy as np
from scipy.sparse import csc_matrix
import sparta

A = csc_matrix([[4.0, 1.0], [1.0, 3.0]])
b = np.array([1.0, 2.0])

F = sparta.analyze(A)   # 1. analyze the pattern (CPU)
F.factorize()           # 2. build the factors   (GPU)
x = F.solve(b)          # 3. find x              (GPU)
F.destroy()             # 4. hand back the GPU memory
use sparta::{Analysis, Complex32, Config, Solver};

// The lower triangle of [[4, 1], [1, 3]], in CSC form.
let analysis = Analysis::ldlt(2, &[0, 2, 3], &[0, 1, 1], &Config::default())?;
let mut solver = Solver::new(analysis)?;
solver.factor(&[4.0, 1.0, 3.0].map(|v| Complex32::new(v, 0.0)))?;
let x = solver.solve(&[1.0, 2.0].map(|v| Complex32::new(v, 0.0)))?;
solver.destroy();
#include "sparta.h"

sparta_analysis *plan;
sparta_solver *solver;
sparta_analyze(n, col_ptr, row_index, SPARTA_SYMMETRIC, &config, &plan);
sparta_solver_create(&plan, &solver);
sparta_factor(solver, values);
sparta_solve(solver, b, x);
sparta_solver_free(solver);
A = sparse([4 1; 1 3]);
b = [1; 2];

S = SpartaSolver(A);    % 1-2. analyze and factor
x = S \ b;              % 3. solve

% A sweep: same pattern, new values
factorize(S, A2);
x2 = S \ b;
clear S                 % 4. free the GPU memory
using SPARTA, SparseArrays

A = sparse([4.0 1; 1 3])
b = [1.0, 2]

F = SPARTA.Solver(A)    # 1-2. analyze and factor
x = F \ b               # 3. solve

# A sweep: same pattern, new values
factorize!(F, A2)
x2 = F \ b
close(F)                # 4. free the GPU memory

Performance

Three EMerge models, each swept over frequency with SPARTA as the solver, once on its GPU path and once on its CPU path on the same machine. Times are the solve times EMerge itself reports, summed over the sweep: per frequency, the solver call that factors the system and solves it for every port or excitation. Meshing and assembly are not included.

Apple M4 Pro · 14-core CPU (10 performance + 4 efficiency) · 20-core GPU · 24 GB unified memory · macOS 26.6.2

SPARTA GPU solver: Metal on 20 GPU cores, complex64, no refinement SPARTA CPU solver: complex128 on all 14 cores, SpartaBLAS

Patch antenna

Inset-fed microstrip patch on a 1.524 mm substrate inside an air sphere with an absorbing boundary, lumped-port feed · 423,436 unknowns · 18.4 M nonzeros · 7 frequencies

All 7 frequencies1.6× faster on GPU
5.45 s
8.68 s
First frequency, with analysis1.3× faster on GPU
1.90 s
2.45 s
Each further frequency (median)1.8× faster on GPU
581 ms
1.04 s

Peak memory of the whole EMerge process: GPU 9.2 GB · CPU 12.1 GB

Radar cross-section

PEC sphere of 0.5 m radius in a scattered-field formulation, absorbing outer boundary · 317,866 unknowns · 12.8 M nonzeros · 8 frequencies

All 8 frequencies2.3× faster on GPU
14.1 s
32.5 s
First frequency, with analysis1.9× faster on GPU
2.73 s
5.16 s
Each further frequency (median)2.4× faster on GPU
1.63 s
3.91 s

Peak memory of the whole EMerge process: GPU 7.1 GB · CPU 11.7 GB

Coupled-line filter

Six-section coupled-line bandpass filter on a 20 mil substrate in a closed air box, two modal ports · 1,245,102 unknowns · 44.0 M nonzeros · 30 frequencies

All 30 frequencies1.1× faster on GPU
42.8 s
46.3 s
First frequency, with analysisabout equal
5.22 s
5.47 s
Each further frequency (median)1.1× faster on GPU
1.24 s
1.34 s

Peak memory of the whole EMerge process: GPU 13.2 GB · CPU 10.8 GB

Median of three runs, each a fresh process, on the machine above. EMerge solves one frequency at a time and analyzes the sparsity pattern once, at the first frequency; every later frequency only refactors. The GPU factors in single precision (complex64), the CPU in double precision (complex128). On the coupled-line filter the two are within about 10%, most likely because in a closed box most of its matrix is real, which the CPU factors in cheaper real arithmetic, and because its thin planar geometry gives many small fronts.

Platform support

One device-independent core; each build targets one GPU backend.

macOS

Available
GPU
Apple Silicon, M1 or later
Backend
Metal
Operating system
macOS 13 or later

Windows

Available
GPU
NVIDIA or AMD, Vulkan 1.3 driver
Backend
Vulkan
Tested on
NVIDIA RTX 3080 and AMD Radeon integrated GPU

Linux

Available
GPU
NVIDIA or AMD, Vulkan 1.3 driver
Backend
Vulkan
Tested on
NVIDIA RTX A5000
Note
Server and headless NVIDIA drivers often leave out Vulkan: install libvulkan1 and libnvidia-gl for your driver version.

Interfaces: Python 3.9 or later with NumPy and SciPy, a Rust toolchain, a C11 or C++17 compiler, MATLAB R2018a or later with a C compiler, or Julia 1.9 or later.

Get SPARTA

SPARTA is open source under the GNU Affero General Public License (AGPL). Closed-source software needs a commercial licence.

Open source

Free, on GitHub

The source code, the Python package, the C/C++, MATLAB and Julia bindings and the user guide are all in the repository.

pip install sparta-solver
  • For open-source software under the AGPL
  • Prebuilt for Metal and Vulkan, or build from source
  • Issues and contributions through GitHub
Go to the repository ›

Closed-source software

Contact us

Including SPARTA in closed-source software, distributed or run as a service, needs a commercial licence from us. For official inquiries, email robertfennis@emerge-numerics.com.

Send an email ›

Additional information

Licence

SPARTA is released under the GNU Affero General Public License, version 3 or later. Software that includes SPARTA and is distributed, or offered to users over a network, must make its own source available under the AGPL too. The full terms are in the repository.

Using SPARTA in closed-source software

Closed-source software needs a commercial licence. Email robertfennis@emerge-numerics.com for official inquiries.

Offline operation

SPARTA needs no internet connection and sends no data anywhere. No matrices, results or usage data leave the machine.

Accuracy of a single-precision GPU solve

On its own, a relative residual around 1e-5. With iterative refinement, the default in Python, it reaches double-precision accuracy on all but the most badly conditioned systems, and every solve reports how far it got.

Supported GPUs

Apple Silicon GPUs through Metal are supported. AMD and NVIDIA GPUs on Windows and Linux run through the Vulkan backend, built on the same device-independent core. On Linux, the NVIDIA driver needs its Vulkan part, which server and headless installs often leave out.