Skip to content

mpi: Patch bug where sparse interpolations with footprints spanning multiple ranks would result in incomplete sums being calculated with MPI - #3125

Open
EdCaunt wants to merge 1 commit into
mainfrom
sparse-interp-mpi
Open

EdCaunt wants to merge 1 commit into
mainfrom
sparse-interp-mpi

Conversation

@EdCaunt

@EdCaunt EdCaunt commented Nov 27, 2026 •

Copy link
Copy Markdown
Contributor

Still needs some refinement. The bug occurs when an interpolation stencil grazes a rank boundary. On the grazed rank, not all of the points are within the data present on the rank (owned + halo), so a partial sum of the interpolation is calculated on these ranks. When gathering the interpolated result, the last rank was selected (which may not have had access to all the points in the footprint) rather than the rank that owns the sparse point (which always has access to all the required data). Note this was only an issue with sinc interp - linear doesn't have a big enough footprint to trigger it.

…ultiple ranks would result in incomplete sums being calculated with MPI
@codecov

codecov Bot commented Nov 27, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 13.63636% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.10%. Comparing base (8f24c29) to head (cd37c8a).
⚠️ Report is 1 commits behind head on main.

Files with missing lines Patch % Lines
tests/test_mpi.py 20.00% 12 Missing ⚠️
devito/types/sparse.py 0.00% 7 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3125      +/-   ##
==========================================
- Coverage   84.12%   84.10%   -0.03%     
==========================================
  Files         260      260              
  Lines       59671    59692      +21     
  Branches     5036     5036              
==========================================
+ Hits        50200    50201       +1     
- Misses       8634     8653      +19     
- Partials      837      838       +1     
Flag Coverage Δ
pytest-gpu-aomp-amdgpuX 68.24% <0.00%> (-0.01%) ⬇️
pytest-gpu-gcc- 78.84% <13.63%> (-0.04%) ⬇️
pytest-gpu-icx- 78.78% <13.63%> (-0.04%) ⬇️
pytest-gpu-nvc-nvidiaX 69.07% <0.00%> (-0.01%) ⬇️

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

☔ View full report in Codecov by Harness.
📢 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.

Comment thread devito/types/sparse.py
self._comm.Alltoallv([data, rcount, rdisp, self._mpitype],
[gathered, scount, sdisp, self._mpitype])

# A point is sent to every rank its support touches, but a rank only

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

I get what it does but i feel it's not the right way to do it. Ideally this wouldn't be needed if the scatter was aware if it's for and interp or inject to avoid this case alltogether. But it's quite a bit more work so i think this is fine for now but would be good to open an issue about it pointing at this as potential improvement.

@FabioLuporini FabioLuporini Nov 30, 2026 •

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

further, not sure if relevant, it seems like some of this work could be cached once and for all

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

and bonus, with such a _dist_data_<find_a_good_suffix> cached property, you'd be able to have a proper docstring with an illustrative example

This branch has not been deployed

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

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants