devitocodes / devito

DSL and compiler framework for automated finite-differences and stencil computation
http://www.devitoproject.org
MIT License
565 stars 229 forks source link

dsl: Move SubDimension thickness evaluation to the thicknesses themselves #2470

Closed EdCaunt closed 1 week ago

EdCaunt commented 1 month ago

Fixes issues with standalone use of SubDimension.symbolic_min or SubDimension.symbolic_max in an operator. Previously variants on

x = Dimension('x')
ix = SubDimension.left('ix', x, 2)
f = Function(name="f", dimensions=(ix,), shape=(5,), dtype=np.int32)

eqns = Eq(f[ix.symbolic_max], 1)

op = Operator(eqns)
op(x_m=0)

would suffer from two issues:

  1. The SubDimension thickness (ix.symbolic_max) would not be concretised from x_ltkn to x_ltkn0
  2. The SubDimension thickness would never be given a value by _arg_values unless the user explicitly passed it to the operator (and even then, it would not be adjusted to reflect any MPI decomposition)

These are rectified by this PR.

codecov[bot] commented 1 month ago

Codecov Report

Attention: Patch coverage is 97.03704% with 4 lines in your changes missing coverage. Please review.

Project coverage is 87.26%. Comparing base (2f4f80f) to head (6e7c017). Report is 21 commits behind head on master.

Files with missing lines Patch % Lines
devito/ir/equations/algorithms.py 81.81% 1 Missing and 1 partial :warning:
devito/types/dimension.py 97.82% 1 Missing and 1 partial :warning:
Additional details and impacted files ```diff @@ Coverage Diff @@ ## master #2470 +/- ## ========================================== + Coverage 87.22% 87.26% +0.04% ========================================== Files 238 238 Lines 45258 45278 +20 Branches 4019 4022 +3 ========================================== + Hits 39475 39512 +37 + Misses 5103 5085 -18 - Partials 680 681 +1 ```

:umbrella: View full report in Codecov by Sentry.
:loudspeaker: Have feedback on the report? Share it here.

review-notebook-app[bot] commented 3 weeks ago

Check out this pull request on  ReviewNB

See visual diffs & provide feedback on Jupyter Notebooks.


Powered by ReviewNB

FabioLuporini commented 1 week ago

Merged, thanks