Skip to content

compiler: Fix IET reconstruction with MPI overlap/full modes - #3112

Open
FabioLuporini wants to merge 10 commits into
mainfrom
misc-mpi-fixes
Open

FabioLuporini wants to merge 10 commits into
mainfrom
misc-mpi-fixes

Conversation

@FabioLuporini

Copy link
Copy Markdown
Contributor

Triggered via CPML + MPI

@codecov

codecov Bot commented Nov 17, 2026 •

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 49.38650% with 165 lines in your changes missing coverage. Please review.
✅ Project coverage is 84.25%. Comparing base (35e25b3) to head (1a09f56).

Files with missing lines Patch % Lines
tests/test_mpi.py 15.49% 60 Missing ⚠️
devito/mpi/routines.py 19.60% 41 Missing ⚠️
tests/test_subdomains.py 14.28% 18 Missing ⚠️
tests/test_gpu_openacc.py 20.00% 16 Missing ⚠️
tests/test_pickle.py 40.90% 13 Missing ⚠️
devito/ir/iet/efunc.py 50.00% 11 Missing and 1 partial ⚠️
conftest.py 25.00% 2 Missing and 1 partial ⚠️
devito/passes/iet/mpi.py 50.00% 1 Missing and 1 partial ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main    #3112      +/-   ##
==========================================
- Coverage   84.35%   84.25%   -0.10%     
==========================================
  Files         260      260              
  Lines       59230    59431     +201     
  Branches     5009     5019      +10     
==========================================
+ Hits        49962    50073     +111     
- Misses       8432     8522      +90     
  Partials      836      836              
Flag Coverage Δ
pytest-gpu-aomp-amdgpuX 68.34% <41.04%> (-0.01%) ⬇️
pytest-gpu-gcc- 79.01% <48.15%> (-0.07%) ⬇️
pytest-gpu-icx- 78.96% <48.15%> (-0.09%) ⬇️
pytest-gpu-nvc-nvidiaX 69.16% <38.31%> (-0.03%) ⬇️

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/ir/iet/efunc.py
def dynamic_defaults(self):
return {k: tuple(self.parameters[i] for i in v) for k, v in self._mapper.items()}
def region(self):
return next((i for i in self.parameters if isinstance(i, Region)), None)

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.

A slightly odd construction, but I guess it makes extracting the first parameter that's a Region into a one-liner

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.

yes. This is getting generated quite frequently. I checked it, and it's said to be pythonic 🤷‍♂️

Comment thread devito/ir/iet/efunc.py Outdated

def make_call(self, region=None, retobj=None, is_indirect=False):
if region is not None and self.region is None:
raise ValueError("No region parameter")

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.

Maybe reference self in this error message to make it usable for debugging?

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.

done

Comment thread devito/ir/iet/efunc.py Resolved
Comment thread devito/ir/iet/efunc.py

def __init__(self, name, body, retval='void', parameters=None, prefix=('static',),
dynamic_parameters=None):
def __init__(self, name, body, retval='void', parameters=None, prefix=('static',)):

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.

What was dynamic_parameters? I remember it giving me grief with functions on subdomains and full/overlap modes, but never got to the bottom of it

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.

the y_m/y_M/z_m/... symbols , used as formal parameters in an ElementalFunction to describe the halo region geometry

Comment thread devito/ir/iet/efunc.py Outdated
try:
if isinstance(a.function, Region):
return a
except AttributeError:

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.

contextlib.suppress

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.

done

Comment thread devito/mpi/routines.py Outdated
# Matching layouts must share a C type to permit compute helper reuse
for existing in self.regions:
if existing.pfields == region.pfields:
return region._rebuild(pname=existing.pname)

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.

Feels like an oversight to have to rebuild region here, given it was only created a couple of lines above. Is this information really not known prior to MPIRegion construction?

Additionally, is it worth having a mapper: frozendict({r: r.pfields for r in self.regions})?

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.

done

Comment thread devito/mpi/routines.py Outdated
f'compute{key}',
hs.body,
hs.arguments,
Region(region.name, region.pname, region.arguments),

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.

This isn't just a rebuild? Why is a new Region needed here?

Comment thread devito/mpi/routines.py Outdated
f'compute{key}',
iet,
hs.arguments,
Region(region.name, region.pname, region.arguments),

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.

Same again, could this go inside make_efunc?

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.

yr right, fixed

Comment thread tests/test_subdomains.py Outdated
Comment on lines +2460 to +2463
with switchconfig(mpi='basic'):
reference = Operator(eq0, name='SubDomainRegionReference')
op = Operator(eq1, name='SubDomainRegionArguments',
opt=('advanced', {'blockinner': True}))

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.

Compare to a serial run or an exact solution (e.g. a sinusoid). However, the allclose seems a little superfluous to the test

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.

tweaked

Comment thread tests/test_gpu_openacc.py Outdated
eqs = [Eq(u.forward, u + 1),
Eq(state, state + 1, subdomain=boundary,
implicit_dims=[grid.time_dim])]
op = Operator(eqs, platform='nvidiaX', language='openacc',

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.

Feels like an odd place to set this? Shouldn't this be handled by skipifs, given this test runs the operator?

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.

fixed

Comment thread tests/test_mpi.py Outdated

eq = Eq(u.forward, u + .01*u.laplace + .125)

op = Operator(eq, name='RegionParameters',

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.

Ultra-nitpick: Pointless to name this operator

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.

fixed

Comment thread tests/test_gpu_openacc.py Outdated
def test_iso_ac(self, mode):
TestOperator().iso_acoustic(opt='advanced')

@pytest.mark.skipif(configuration['language'] != 'openacc', reason='requires OpenACC')

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.

Do we not have a specific skipif in conftest.py?

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.

no we don't , but adding it

Comment thread devito/ir/support/guards.py Outdated
return f'{self.name}({printer.doprint(self.initvalue)})'

_ccode = _sympystr
_cxxcode = _sympystr

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.

That's not how we handle this, that should already be the default for any printer to default to sympystr

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