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 36 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):

  • Tutorial notebook showing
    • Demo for seafloor-like configuration
    • Demo for damping-like configuration
    • Demo for snapshotting only one region of the grid
  • Tests for propagator on subdomain
    • Including with MPI
  • 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 27.59924% with 766 lines in your changes missing coverage. Please review.

Project coverage is 44.92%. Comparing base (e8bf1fb) to head (a67dd12).

Files with missing lines Patch % Lines
tests/test_subdomains.py 14.24% 307 Missing ⚠️
tests/test_interpolation.py 15.06% 186 Missing ⚠️
devito/mpi/distributed.py 37.39% 76 Missing and 1 partial ⚠️
tests/test_mpi.py 14.11% 73 Missing ⚠️
devito/types/grid.py 56.12% 42 Missing and 1 partial ⚠️
devito/data/decomposition.py 40.54% 16 Missing and 6 partials ⚠️
devito/operations/interpolators.py 64.40% 17 Missing and 4 partials ⚠️
devito/types/basic.py 40.00% 11 Missing and 1 partial ⚠️
tests/test_pickle.py 45.45% 6 Missing ⚠️
devito/types/sparse.py 0.00% 5 Missing ⚠️
... and 6 more

❗ There is a different number of reports uploaded between BASE (e8bf1fb) and HEAD (a67dd12). Click for more details.

HEAD has 15 uploads less than BASE
Flag BASE (e8bf1fb) HEAD (a67dd12)
16 1
Additional details and impacted files
@@             Coverage Diff             @@
##           master    #2245       +/-   ##
===========================================
- Coverage   87.30%   44.92%   -42.38%     
===========================================
  Files         238      238               
  Lines       45972    46877      +905     
  Branches     4074     4134       +60     
===========================================
- Hits        40134    21061    -19073     
- Misses       5150    24926    +19776     
- Partials      688      890      +202     

☔ 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
@@ -230,6 +230,10 @@
"cell_type": "markdown",
"metadata": {},
"source": [
"The Devito `SubDomain` API features two steps. The first of these is to create a subclass of `SubDomain`, which encapsulates the template by which `SubDomain`s should be constructed. This is not tied to a specific `Grid`. On a basic level, this specification is created by defining a suitable `define` method for the subclass.\n",
"\n",
"Note if one intends to introduce a custom `__init__` when subclassing `SubDomain`, then it is necessary to provide the `kwarg` `grid=None`, and pass this through to `super().__init__()`. Such a custom `__init__` may be useful in applications such as creating many `SubDomain` instances with similar properties from a single template.\n",
Copy link
Contributor

Choose a reason for hiding this comment

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

this seems to kind of contradict the paragraph before...

@@ -339,17 +312,28 @@
"\n",
"The two other options available are `'left'` and `'right'`. For a statement of the form `d: ('left', N)` the `SubDomain` spans a contiguous region of `N` points starting at `d`\\'s left extreme. A statement of the form `('right', N)` is analogous to the previous case but starting at the dimensions right extreme instead.\n",
"\n",
"Now, to create a grid containing both of the subdomains defined above, 'mydomain' and 'inner', we simply pass these during the creation of a grid:"
"We can also attach this subdomain to the grid."
Copy link
Contributor

Choose a reason for hiding this comment

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

"We can" or "We must" ("we have to") since we actually want to use it?

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.

Now that the notebook updates are in, I think we also need:

  • either a short, additional notebook examples/userapi/03_subdomains_legacy_API.ipynb
  • or a section in examples/userapi/03_subdomains.ipynb explaining the legacy API

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