Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

dsl: Introduce ability to define Functions on Subdomains #2245

Open
wants to merge 66 commits into
base: master
Choose a base branch
from

Conversation

EdCaunt
Copy link
Contributor

@EdCaunt EdCaunt commented Oct 24, 2023

Add Functions on SubDomains functionality.

Remaining todo (for future PRs I think):

  • MPI in full mode + functions on subdomains leads to an error which I haven't had time to debug

@codecov
Copy link

codecov bot commented Oct 24, 2023

Codecov Report

Attention: Patch coverage is 97.47145% with 31 lines in your changes missing coverage. Please review.

Project coverage is 87.53%. Comparing base (caaac39) to head (df89a8d).

Files with missing lines Patch % Lines
devito/types/grid.py 84.15% 14 Missing and 2 partials ⚠️
devito/mpi/distributed.py 95.12% 4 Missing and 2 partials ⚠️
devito/types/sparse.py 20.00% 4 Missing ⚠️
devito/data/decomposition.py 97.29% 0 Missing and 1 partial ⚠️
devito/deprecations.py 75.00% 1 Missing ⚠️
tests/test_interpolation.py 99.55% 0 Missing and 1 partial ⚠️
tests/test_mpi.py 98.82% 0 Missing and 1 partial ⚠️
tests/test_subdomains.py 99.79% 1 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##           master    #2245      +/-   ##
==========================================
+ Coverage   87.30%   87.53%   +0.22%     
==========================================
  Files         238      238              
  Lines       46001    46972     +971     
  Branches     4075     4139      +64     
==========================================
+ Hits        40161    41115     +954     
- Misses       5151     5165      +14     
- Partials      689      692       +3     

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

@mloubout mloubout added the API api (symbolics, types, ...) label Oct 24, 2023
devito/types/grid.py Outdated Show resolved Hide resolved
devito/types/grid.py Outdated Show resolved Hide resolved
devito/types/grid.py Outdated Show resolved Hide resolved
devito/types/grid.py Outdated Show resolved Hide resolved
Copy link

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

@EdCaunt EdCaunt added the WIP Still work in progress label Dec 13, 2023
Copy link
Contributor

@FabioLuporini FabioLuporini left a comment

Choose a reason for hiding this comment

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

For the amount of changes introduced, I'd prefer to see a lot more new tests.

Shouldn't all (most) of the old tests that @rhodrin wrote be here as well?

devito/mpi/distributed.py Outdated Show resolved Hide resolved
devito/mpi/distributed.py Outdated Show resolved Hide resolved
devito/mpi/distributed.py Outdated Show resolved Hide resolved
devito/mpi/distributed.py Outdated Show resolved Hide resolved
devito/mpi/distributed.py Outdated Show resolved Hide resolved
devito/types/dense.py Outdated Show resolved Hide resolved
devito/types/dense.py Outdated Show resolved Hide resolved
devito/types/equation.py Outdated Show resolved Hide resolved
devito/types/grid.py Outdated Show resolved Hide resolved
devito/types/grid.py Outdated Show resolved Hide resolved
Copy link
Contributor

@mloubout mloubout left a comment

Choose a reason for hiding this comment

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

quick pass

devito/mpi/distributed.py Outdated Show resolved Hide resolved
devito/mpi/distributed.py Outdated Show resolved Hide resolved
devito/mpi/distributed.py Outdated Show resolved Hide resolved
devito/mpi/distributed.py Outdated Show resolved Hide resolved
devito/types/dimension.py Outdated Show resolved Hide resolved
devito/types/dimension.py Outdated Show resolved Hide resolved
devito/types/grid.py Outdated Show resolved Hide resolved
devito/types/grid.py Outdated Show resolved Hide resolved
tests/test_caching.py Outdated Show resolved Hide resolved
@EdCaunt EdCaunt requested a review from mloubout April 4, 2024 13:01
@EdCaunt EdCaunt removed the WIP Still work in progress label Apr 4, 2024
@EdCaunt EdCaunt force-pushed the funcs_on_subdims branch from 4268c54 to af06ba9 Compare April 8, 2024 15:41
devito/data/decomposition.py Outdated Show resolved Hide resolved
devito/data/decomposition.py Outdated Show resolved Hide resolved
devito/data/decomposition.py Outdated Show resolved Hide resolved
devito/types/grid.py Show resolved Hide resolved
devito/types/grid.py Outdated Show resolved Hide resolved
devito/types/grid.py Outdated Show resolved Hide resolved
devito/types/grid.py Outdated Show resolved Hide resolved
devito/types/grid.py Outdated Show resolved Hide resolved
extra = filter_ordered([i for v in extras for i in v.dimensions
if i not in self._gdims and
if i not in gdims and
Copy link
Contributor

Choose a reason for hiding this comment

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

why didn't the previous version break any test?

for v in extras:
try:
egrid = v.grid
if egrid is not None and egrid.is_SubDomain:
Copy link
Contributor

Choose a reason for hiding this comment

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

egrid is not None isn't needed

the line egrid = v.grid can probably be dropped too


def _augment_implicit_dims(self, implicit_dims, extras=None):
if extras is not None:
# If variables are defined on a SubDomain of the Grid, then temprarily add
Copy link
Contributor

Choose a reason for hiding this comment

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

(nitpicking, just a wording thing) this comments reads odd, nothing is really to added to self._gdims


def _augment_implicit_dims(self, implicit_dims, extras=None):
if extras is not None:
# If variables are defined on a SubDomain of the Grid, then temprarily add
# their dimensions to self._gdims for the purpose of checking if extra
# dimensions have been included.
Copy link
Contributor

Choose a reason for hiding this comment

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

no full stop needed

devito/types/equation.py Show resolved Hide resolved
self._shape_local = tuple(0 if i.is_empty else i.end-i.start + 1 if i.is_Interval
else 1 for i in self.distributor.intervals)

def __subdomain_finalize_legacy__(self, grid):
Copy link
Contributor

Choose a reason for hiding this comment

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

if so, we need to do it a way that does not pollute the output log (e.g. emitting one warning per SubDomain instance ... something you can obtain easily by adding a new handler here https://github.com/devitocodes/devito/blob/master/devito/deprecations.py)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
API api (symbolics, types, ...)
Projects
None yet
Development

Successfully merging this pull request may close these issues.

7 participants