-
Notifications
You must be signed in to change notification settings - Fork 228
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: Move SubDimension thickness evaluation to the thicknesses themselves #2470
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Looks like a very nice clean up!
@@ -640,6 +642,11 @@ def _prepare_arguments(self, autotune=None, **kwargs): | |||
for d in reversed(toposort): | |||
args.update(d._arg_values(self._dspace[d], grid, **kwargs)) | |||
|
|||
# Process SubDimensionThicknesses | |||
for p in self.parameters: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I think this should be triggered from within SubDimension._arg_values
itself
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, the issue is that the SubDimension
isn't necessarily available to the operator. You can craft legal Operator
s which only contain the thickness, not the parent subdimension, hence the reworking in this PR
@@ -536,6 +535,81 @@ def _arg_check(self, *args, **kwargs): | |||
# The Dimensions below are exposed in the user API. They can only be created by | |||
# the user | |||
|
|||
class SubDimensionThickness(DataSymbol): | |||
"""A DataSymbol to represent a thickness of a SubDimension""" |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
full stop
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thought we didn't do those on single line docstrings?
rtkn = r_rtkn or 0 | ||
|
||
return {i.name: v for i, v in zip(self._thickness_map, (ltkn, rtkn))} | ||
# SubDimension thicknesses at runtime are calculated by the thicknesses |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
as I wrote in another comment, this SubDimension should trigger the processing of its own arguments, namely its own Thicknesses
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
They shouldn't (or at least it would be redundant if it did), see my other comment
Codecov ReportAttention: Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## master #2470 +/- ##
===========================================
- Coverage 87.17% 57.49% -29.68%
===========================================
Files 239 238 -1
Lines 45160 45155 -5
Branches 4007 4007
===========================================
- Hits 39367 25961 -13406
- Misses 5112 18373 +13261
- Partials 681 821 +140 ☔ View full report in Codecov by Sentry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
some mnior comments
|
||
mapper[d] = d._rebuild(symbolic_min=left, symbolic_max=right, thickness=thickness) | ||
tkns = tuple(t._rebuild(name=sregistry.make_name(prefix=t.name)) for t in d.tkns) | ||
mapper.update({t0: t1 for t0, t1 in zip(d.tkns, tkns)}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I would avoid t0 and t1 due to name clash with time buffers.
It's not about correctness, but mostly when grepping
# Dimension is of type `left`/`right` - compute the offset | ||
# and then add 1 to get the appropriate thickness | ||
if self.value is not None: | ||
tkn = grid.distributor.glb_to_loc(self.root, r_tkn-1, self.side) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
why r_tkn-1?
@property | ||
def is_abstract(self): | ||
return all(i is None for i in flatten(self.thickness)) | ||
tkns = thickness # Shortcut for thickness |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
should this not be a cached propertry?
Fixes issues with standalone use of
SubDimension.symbolic_min
orSubDimension.symbolic_max
in an operator. Previously variants onwould suffer from two issues:
ix.symbolic_max
) would not be concretised fromx_ltkn
tox_ltkn0
_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.