Skip to content

[gpu-3] Share polar spline factorizations across solvers - #760

Merged
max-models merged 1 commit into
gpu-2-vlasov-benchmarkfrom
gpu-3-polar-factorization-cache
Oct 13, 2026
Merged

max-models merged 1 commit into
gpu-2-vlasov-benchmarkfrom
gpu-3-polar-factorization-cache

Conversation

@max-models

Copy link
Copy Markdown
Member

Building multiple polar projector and mass-preconditioner instances repeatedly factorizes identical matrices and creates duplicate device copies. This change shares live 1D and poloidal factors across the polar spaces of one Derham object.

Stack: based on gpu-2-vlasov-benchmark (#735), as the next PR in the GPU stack.

The cache matches exact canonical sparse matrix contents and dtype, solver kind and ILU settings, Schur pole masks/outer factors, and backend/device. It reuses both host factorizations and their cached GPU solves. Boundary-condition and transposed variants share only when their matrices and configurations actually match. Updated mass weights obtain new poloidal factors while retaining unchanged 1D factors.

Entries use weak references: live solvers keep their factors, while obsolete factors and their keys are released when no solver uses them. Different Derham objects have separate caches.

In the small-cylinder fixture, constructing all four solve variants for P0–P3 reduces sparse LU calls from 88 to 9, and dense Schur LU calls from 24 to 8.

Validation:

  • Cache tests cover sparse storage normalization, exact value/dtype matching, solver settings, Schur structure, transpose separation, mass-weight updates, lifetime cleanup and isolation between Derham objects/backends.
  • Serial polar/cache/backend regression suite: 57 passed, 19 skipped.
  • Two MPI ranks, polar and cache tests: 50 passed, 1 skipped per rank.
  • NVIDIA T1000, CuPy 14.2.0: 7 GPU cases passed, including both mappings and all three solvers; shared-device-factor reuse also passes after the final ownership change.
  • Reusing warmed GPU factors introduces no cunumpy host/device transfers.
  • Ruff lint/formatting, git diff --check, and commit hooks passed. Assembly kernels compiled with GNU/Fortran for local verification.

@max-models
max-models added this pull request to stack #729 October 12, 2026 12:34
spossann
spossann previously approved these changes Oct 13, 2026
@max-models
max-models force-pushed the gpu-3-polar-factorization-cache branch 2 times, most recently from f119ad9 to ea49db6 Compare October 13, 2026 09:41
@max-models
max-models force-pushed the gpu-3-polar-factorization-cache branch from ea49db6 to 5ae9dba Compare October 13, 2026 11:56
@max-models
max-models merged commit 43df4ff into devel Oct 13, 2026
28 checks passed
@max-models
max-models deleted the gpu-3-polar-factorization-cache branch October 13, 2026 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants