Repository navigation
kernels: SumP on several cores again, bit-identical to floats.SumPairwise - #99
Merged
Merged
Conversation
…mPairwise v0.37.0 made SumP serial so that the result would not depend on the core count. It can keep both: NumPy's pairwise sum is a fixed binary tree, so SumP descends the top levels of that tree exactly as DOUBLE_pairwise_sum cuts it (n/2 rounded down to a multiple of 8, leaves of at most 128), sums about four subtrees per worker with floats.SumPairwise, and adds the results back up the same tree. Tested bit for bit against floats.SumPairwise for 6 core counts and 7 lengths up to 3 Mi, wide dynamic range, and all -0. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
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.
Fixes the regression of #97 (v0.37.0):
SumPbecame serial. It runs on several cores again with the same bits asfloats.SumPairwise(NumPy's order) whatever the core count: it cuts NumPy's pairwise tree whereDOUBLE_pairwise_sumcuts it, sums about four subtrees per worker, and adds the results back up the same tree. The only difference from the serial recursion is the sign of a subtree of only -0 values, which NumPy's final+0 + resulterases.TestSumPParallelIsBitIdentical: 6 core counts x 7 lengths (64 to 3 Mi) with wide dynamic range, and all -0, bit for bit; the race detector run is green. README states the parallel behaviour. No timing (host load).🤖 Generated with Claude Code