You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Support for binning and culling when max bin size is bounded #31
When the maximum bin size is bounded (excluding inf padding), a speedup will be attainable by pre-binning the data to reduce the number of pairs swept that would be rejected. Essential for speed-of-light performance data covering massive domains, or SFs over small ones.
How to best bin data remains TBD, the cost of binning data into unstructured collections will be high, but at least should grow as N not N^2, so at some point is a winning strategy even given constant factor reductions in the O(N^2) SF calcs.
CellGrid + CullingPolicy (AutoCulling default / AlwaysCulling / NoCulling), exposed as a culling keyword on the public entries. Culling is exact by construction: it changes which pairs are enumerated, never which pairs count, and the tests assert pair counts identical to the uncalled sweep at every cutoff.
CPU, N = 100 000, D = 2, 32 threads on dedicated cores:
r_max/L
speedup
0.20
2.1×
0.10
4.6×
0.03
29.5×
0.01
66.4×
Spherical is the largest win in the package — the curved kernel is scalar and expensive per pair, and a 2-D shell in ambient 3-space is squarely the many-cells regime. Six-invariant single pass, N = 20 000, R = 6371 km:
r_max
NoCulling
AutoCulling
speedup
2000 km
7907 ms
423 ms
18.7×
500 km
7797 ms
55.6 ms
140×
100 km
7681 ms
33.5 ms
230×
GPU, A100, memoised across calls on the workspace:
N
r/L
full
culled
speedup
20 000
0.03
4.23 ms
0.69 ms
6.1×
65 536
0.03
48.1 ms
2.00 ms
24.1×
Design notes worth recording:
Cells are stored sparsely (occupied cells only). A dense array indexed by cell id was a latent multi-GB blowup — at N = 50 000, D = 3, r/L = 0.003 the id space is 3.0e8 and the dense offsets would have been 2.3 GB, reachable by default since AutoCulling is on. The sparse form is 1.1 MB at the same configuration.
InfPaddedBinEdges blocks culling, and the reason is not inexactness: the overflow bin is a reported output bin whose sum needs every far pair's value, so no pair may be skipped. AlwaysCulling errors naming that; AutoCulling declines silently.
Culling is opt-in per geometry via cull_cutoff, with a generic default meaning "declares no bound", so a user-defined geometry stays correct without implementing anything.
Activity
jbphyswx commentedon Sep 6, 2026
Implemented.
CellGrid+CullingPolicy(AutoCullingdefault /AlwaysCulling/NoCulling), exposed as acullingkeyword on the public entries. Culling is exact by construction: it changes which pairs are enumerated, never which pairs count, and the tests assert pair counts identical to the uncalled sweep at every cutoff.CPU, N = 100 000, D = 2, 32 threads on dedicated cores:
r_max/LSpherical is the largest win in the package — the curved kernel is scalar and expensive per pair, and a 2-D shell in ambient 3-space is squarely the many-cells regime. Six-invariant single pass, N = 20 000, R = 6371 km:
r_maxGPU, A100, memoised across calls on the workspace:
r/LDesign notes worth recording:
r/L = 0.003the id space is 3.0e8 and the dense offsets would have been 2.3 GB, reachable by default sinceAutoCullingis on. The sparse form is 1.1 MB at the same configuration.InfPaddedBinEdgesblocks culling, and the reason is not inexactness: the overflow bin is a reported output bin whose sum needs every far pair's value, so no pair may be skipped.AlwaysCullingerrors naming that;AutoCullingdeclines silently.cull_cutoff, with a generic default meaning "declares no bound", so a user-defined geometry stays correct without implementing anything.