Issue 2281 - #5507
Open
jurb33 wants to merge 5 commits into
Open
Conversation
…iew integration with CI or remove. Contributes to issue yt-project#2281.
… get_near). Follow up with team. Closes yt-project#2281.
|
Hi! Welcome, and thanks for opening this pull request. We have some guidelines for new pull requests, and soon you'll hear back about the results of our tests and continuous integration checks. Thank you for your contribution! |
jurb33
marked this pull request as draft
August 12, 2026 10:17
jurb33
marked this pull request as ready for review
August 12, 2026 10:19
jurb33
marked this pull request as draft
August 12, 2026 10:24
jurb33
marked this pull request as ready for review
August 13, 2026 02:00
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.
Address slow particle deposition. Currently, a deposit invokes a full octree walk no matter the previous result. By caching the last oct used for the starting traversal path of a octree walk, we can get shorter walk times. Benefits datasets where spatial locality of particles are near/same octant (RAMSES)
Updated
fake_octree_dsAPI for usage in local timing tests. These can be kept or removed alongside existing. (Not sure about future use).PR Summary
ParticleDepositOperation.process_octree()Previously called
OctreeContainer.get()for every particle, which always starts from the root oct.This adds a cache of last oct a particle landed in
(OctreeContainer.get_near())that, given a starting oct,climbs towards root, doubling it's step until the new particle is contained, then descends identically to
get().This cost scales with how many levels the new particle is from the cached, hence spatial locality wins big here.
For the implementation,
OctreeContainer.get_near()needs to walk upwards, so adding a parent pointer andupdating it everywhere an Oct is allocated is nessecary.
When writing tests to build a deep octree, I uncovered the outdated fake_octree API. The fixes were as follows:
Adding
root_nodestoallocate_domains([max_noct])to align with updated SparseOctreeContainer.allocate_domainsThe
subdivide()method referencedparent.children[ii]without checking ifparent.children != NULL.Use
oct_handler.noctsfor a global oct count rather than then the allocation of a single domain.Implementation was tested with an AI assisted testbench. 4 cases of clustered, spatially ordered, random and domain boundary were ran locally. For the sole purpose of verifying the speedup, these can be kept or deleted.
Checks for correct particle counts is implemented to assert correctness on some level.
At around 50M particles, I saw ~2x speedup.
Closes #2281
PR Checklist
Consult with team on keeping this test
Review implementation documentation with team
Verify speedup with team