Pentrc statictyping preallocation#322
Merged
Merged
Conversation
…rams to reduce multithreading overhead and add a pre-allocated quadgk buffer
…memory allocation in QuadGK inner loop and update Energy Integration to support QuadGK buffer pre-allocation
…-surface scratch buffers to reduce memory allocation during bounce-averaging computations
Collaborator
|
@claude review this PR |
Review: Pentrc static typing / preallocationSolid, well-documented allocation-reduction pass on the KineticForces hot loops (bounce averaging, energy integration, pitch integration). This will be useful for scaling the multithreaded pentrc solve past 2 threads. Potential bugs / correctness
Style / minor
Performance
Test coverage
|
logan-nc
requested changes
Jul 8, 2026
logan-nc
left a comment
Collaborator
There was a problem hiding this comment.
Looks good and great speedup results 🥇
Only minor suggestions from me
… into gpec.toml and remove deprecated sol.toml
…tialized entries in bounce integration
Collaborator
Author
|
@logan-nc added the NaN fill. Ready for merge pending your thumbs up. |
…buffer, BounceScratch field docs fvals stays ComplexF64: the kinetic-matrix (wt) path builds fbnce from complex op_wmats data, so a real buffer throws InexactError in the pitch kernel. Co-Authored-By: Claude Fable 5 <noreply@anthropic.com> Claude-Session: https://claude.ai/code/session_01TTu6sczod1Qtjy9e9pB6jP
Collaborator
Review feedback addressed (38b5f42)All review items are in:
Regression harness vs develop
Full diiid_n1 regression table🤖 Generated with Claude Code |
logan-nc
approved these changes
Jul 9, 2026
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
There are a number of locations in pentrc that have poorly optimized dynamic typing and allocations happening close to operations. This means that when trying to multithread, we are needlessly multiplying our allocations by the number of threads we use, which is why the multithreading speedup for pentrc peaks at 2 threads. At time of making the PR the static typing and preallocations completed have taken the kinetic portion of the forcefreestates solve down from 619 s to 68.1 s in the d3d-like example case running with 8 threads on omega. Also made preallocations for the bounce averaging computations. This work is presently complete and ready for review.
Here is the final speedup table, running on omega:
*develop's 16- and 32-thread runs were run on a different cluster, but showed a plateau at ~520 s starting at ~8 threads.
Parallel efficiency (speedup vs. that version's own 1-thread):