Skip to content

Implement sorting of neighbor lists for PrecomputedNeighborhoodSearch#138

Merged
svchb merged 9 commits intomainfrom
ef/sort-neighbor-lists
Dec 2, 2025
Merged

Implement sorting of neighbor lists for PrecomputedNeighborhoodSearch#138
svchb merged 9 commits intomainfrom
ef/sort-neighbor-lists

Conversation

@efaulhaber
Copy link
Member

This PR implements the "sorted NL" optimization mentioned in trixi-framework/TrixiParticles.jl#968. See this PR for benchmark results.

Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR implements sorted neighbor lists for PrecomputedNeighborhoodSearch to improve cache performance on CPUs and coalesced memory access on GPUs. The optimization involves sorting neighbor lists after construction, which can be controlled via a new sort_neighbor_lists parameter.

Key Changes:

  • Added sorteach! function to sort each inner vector in DynamicVectorOfVectors and Vector{Vector{T}}
  • Integrated sorting into PrecomputedNeighborhoodSearch with a new configurable sort_neighbor_lists field (default true)
  • Reorganized test suite into more structured testsets and added comprehensive tests for the new sorting functionality

Reviewed changes

Copilot reviewed 5 out of 5 changed files in this pull request and generated 5 comments.

Show a summary per file
File Description
src/vector_of_vectors.jl Implements sorteach! for sorting inner vectors; adds default_backend method for DynamicVectorOfVectors
src/nhs_precomputed.jl Adds sort_neighbor_lists parameter to constructor and integrates sorting into neighbor list initialization
src/util.jl Moves DynamicVectorOfVectors default_backend method to vector_of_vectors.jl; adds method for PermutedDimsArray
src/PointNeighbors.jl Reorders includes to place util.jl before vector_of_vectors.jl to resolve dependencies
test/vector_of_vectors.jl Reorganizes tests into testsets and adds new tests for sorteach! functionality

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

@codecov
Copy link

codecov bot commented Dec 1, 2025

Codecov Report

❌ Patch coverage is 77.77778% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.75%. Comparing base (68b4608) to head (9838285).
⚠️ Report is 2 commits behind head on main.

Files with missing lines Patch % Lines
src/vector_of_vectors.jl 80.00% 3 Missing ⚠️
src/util.jl 0.00% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #138      +/-   ##
==========================================
- Coverage   84.95%   84.75%   -0.21%     
==========================================
  Files          15       15              
  Lines         698      715      +17     
==========================================
+ Hits          593      606      +13     
- Misses        105      109       +4     
Flag Coverage Δ
unit 84.75% <77.77%> (-0.21%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

@efaulhaber efaulhaber marked this pull request as ready for review December 1, 2025 15:54
@efaulhaber efaulhaber requested review from LasNikas and svchb December 1, 2025 15:55
@svchb svchb merged commit d8b0de2 into main Dec 2, 2025
10 of 12 checks passed
@svchb svchb deleted the ef/sort-neighbor-lists branch December 2, 2025 09:31
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants