Skip to content

Reduce Sauter-Schwab assembly allocations#207

Open
djukic14 wants to merge 1 commit into
krcools:masterfrom
djukic14:reduce-sauter-schwab-allocations
Open

Reduce Sauter-Schwab assembly allocations#207
djukic14 wants to merge 1 commit into
krcools:masterfrom
djukic14:reduce-sauter-schwab-allocations

Conversation

@djukic14

Copy link
Copy Markdown
Contributor

This PR reduces allocations in BEAST’s Sauter-Schwab assembly code.

The main idea is to reuse small temporary arrays instead of allocating them again and again during assembly. It also changes the quadrature dispatch so that quadrule can directly call momintegrals!, instead of first returning a quadrature rule that is passed on later.

This PR depends on the accompanying SauterSchwabQuadrature.jl PR krcools/SauterSchwabQuadrature.jl#10, which adds the in-place reorder! function.

Changes

  • Add quadraturebuffer(quadstrat) for reusable temporary arrays.
  • Use these buffers for the I, J, K, and L arrays needed by reorder!.
  • Add callback-based quadrature dispatch with QuadruleCallback, ApplyMomintegrals, and ApplyLocalMomintegrals.
  • Let quadrule directly apply momintegrals! in the assembly hot path.
  • Pass qbuffer explicitly through momintegrals!.
  • Use SauterSchwabQuadrature.reorder! instead of allocating in reorder.
  • Update tests for the explicit qbuffer argument.
  • Bump BEAST to 2.11.0.
  • Require SauterSchwabQuadrature = "2.5.0".

Motivation

Profiling showed many small allocations during singular and near-singular assembly. A large part of these came from Sauter-Schwab reordering and from passing many different quadrature rule types through the assembly code.

Reusing buffers and calling momintegrals! directly from quadrule reduces these allocations in the assembly.

Introduce reusable quadrature buffers for Sauter-Schwab reorder
work arrays and thread them through moment-integral assembly. Replace
the quadrule -> momintegrals! hot path with a callback-based dispatch
path so quadrature selection can directly apply the moment integral
without returning unstable rule unions through the caller.

Update Sauter-Schwab quadrature call sites to use reorder! and explicit
qbuffer arguments, and make wrapper quadrature strategies delegate to
the callback implementation to avoid duplicated rule-selection logic.

Require SauterSchwabQuadrature v2.5.0 for the new in-place reorder API.
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.

1 participant