Skip to content

Comments

Initial particle sort by cell ID to improve locality#136

Open
AhmedSalih3d wants to merge 1 commit intocodex/optimize-neighborlist-code-performancefrom
codex/sort-by-cellid-for-performance
Open

Initial particle sort by cell ID to improve locality#136
AhmedSalih3d wants to merge 1 commit intocodex/optimize-neighborlist-code-performancefrom
codex/sort-by-cellid-for-performance

Conversation

@AhmedSalih3d
Copy link
Owner

Motivation

  • Improve memory locality and (potentially) runtime performance by reordering particle storage according to initial cell assignment before the main simulation loop.

Description

  • Add SortParticlesByCellID!(SimParticles::StructArray, ParticleOrder) which permutes every particle field using foreachfield and then resets ParticleOrder to the identity mapping.
  • Invoke the one-time sort immediately after the first UpdateNeighbors! call when SimMetaData.Iteration == 0 and record timing under the label "01b Initial Sort By CellID".
  • Leave all other neighbor-list and per-iteration logic unchanged so subsequent neighbor rebuilds continue to use the existing non-sorting update path.

Testing

  • No automated tests were run for this change.
  • Commands inspected or used while developing the change include rg -n ..., sed -n ..., and nl -ba ..., and the patch was applied to src/SPHCellList.jl.

Codex Task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant