FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

mpi: Prevent parallel halo exchanges by FabioLuporini · Pull Request #2972 · devitocodes/devito · GitHub

mpi: Prevent parallel halo exchanges - #2972

Merged
FabioLuporini merged 1 commit into
mainfrom
hotfix-halo-exchange
Jul 15, 2026
Merged

mpi: Prevent parallel halo exchanges#2972
FabioLuporini merged 1 commit into
mainfrom
hotfix-halo-exchange

Conversation

Copy link
Copy Markdown
Contributor

No description provided.

FabioLuporini added the bug-C bug in the generated code label Jul 15, 2026
# the first nest triggering all necessary halo exchanges along `f`
mapper = as_mapper(found, lambda c1: c1.ispace)
for k, v in mapper.items():
mapper = as_mapper(found, lambda c1: (c1.ispace, c1.properties))

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

How does c1.properties end up being used here?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

that's the actual bug fix

if you don't use the HaloTouch's properties, where the d loop in correctly tagged as sequential, but rather reuse c's properties via rebuild (main's behaviour) then d may erroneously be tagged as parallell depending on its status in c

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Oh, so the rebuild was actually changing the properties of the innermost dimension of the cluster?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

not quite. We were using the rebuild to create a new Cluster -- a Cluster whose sole purpose was carrying a halo_scheme. But using c's rebuild cause us inheriting the wrong properties

for v in mapper.values():
hs = HaloScheme.union([c1.halo_scheme for c1 in v])
processed.append(c.rebuild(exprs=[], ispace=k, halo_scheme=hs))
processed.append(v[0].rebuild(exprs=[], halo_scheme=hs))

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Isn't this changing the type being appended to processed from Cluster to IterationSpace?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

no, v[0] is any c1 within v, that is, a Cluster

if what you said were true, many many tests would fail badly

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Ah ok, this is from me misunderstanding as_mapper

Comment thread tests/test_mpi.py
halo_update = tloop.nodes[0].body[0].body[0].body[0]
assert isinstance(halo_update, HaloUpdateList)

@pytest.mark.parallel(mode=4)

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

The incorrect code still gets generated with 1 rank of MPI fwiw. It also won't hang CI in this configuration if it does go wrong, and will instead fail on the structure tests

Comment thread tests/test_mpi.py
g = Function(name="g", grid=grid, space_order=8, dimensions=(x, y, d), shape=(n, n, 2))
h = g.func(name='h')

eqns = [Eq(a, 0.0),

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Some of these equations can be dropped or simplified iirc. I had something along the lines of:

eqns = [Eq(h, 1), Inc(a, h.dx + h.dy)]

which also allows for the Functions to be tidied up

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

yes, I know, but I don't think it hurts to leave it a little bit more convoluted, in this particular case and based on what I see while I was debugging it

Comment thread tests/test_mpi.py
assert iters[2].dim is d and iters[2].is_Parallel
assert iters[3].dim is d and iters[3].is_Sequential

# Probably unnecessary, but ensures there's no hanging

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.

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

Hanging CI is annoying at best and I agree the .apply() is overkill

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

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

Choose a reason Spam Abuse Off Topic Outdated Duplicate Resolved Low Quality

it won't hang anyway since we run it under a timeout of 300 secs -- not sign of life in 5 mins => death

FabioLuporini force-pushed the hotfix-halo-exchange branch from 9dfb15a to f5af2f6 Compare July 15, 2026 09:59

codecov Bot commented Jul 15, 2026
edited
Loading

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 9.52381% with 19 lines in your changes missing coverage. Please review.
✅ Project coverage is 83.53%. Comparing base (41e92cc) to head (f5af2f6).

Files with missing lines Patch % Lines
tests/test_mpi.py 11.11% 16 Missing ⚠️
devito/ir/stree/algorithms.py 0.00% 3 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #2972      +/-   ##
==========================================
- Coverage   83.55%   83.53%   -0.03%     
==========================================
  Files         257      257              
  Lines       53558    53576      +18     
  Branches     4585     4585              
==========================================
+ Hits        44751    44755       +4     
- Misses       8013     8028      +15     
+ Partials      794      793       -1     
Flag Coverage Δ
pytest-gpu-aomp-amdgpuX 68.40% <0.00%> (ø)
pytest-gpu-gcc- 78.39% <9.52%> (-0.02%) ⬇️
pytest-gpu-icx- 78.32% <9.52%> (-0.03%) ⬇️
pytest-gpu-nvc-nvidiaX 69.05% <0.00%> (ø)

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.

FabioLuporini merged commit 85e7304 into main Jul 15, 2026
42 checks passed
FabioLuporini deleted the hotfix-halo-exchange branch July 15, 2026 11:48
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

Labels

bug-C bug in the generated code

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants


Back | FazBrowse Home | New Git URL