-
Notifications
You must be signed in to change notification settings - Fork 229
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
api: Revamp interpolation/injection #2128
Conversation
Codecov Report
@@ Coverage Diff @@
## master #2128 +/- ##
==========================================
- Coverage 87.06% 87.06% -0.01%
==========================================
Files 228 228
Lines 40299 40539 +240
Branches 7357 7412 +55
==========================================
+ Hits 35088 35295 +207
- Misses 4625 4642 +17
- Partials 586 602 +16
|
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.
Sorry bunch of comments. I know this hasn't been touched in quite a few yers ut yes is needed to revamp and cleanup
31f3850
to
1f61f3a
Compare
35f331d
to
bf3cd61
Compare
e789aa7
to
2d7778d
Compare
devito/operations/interpolators.py
Outdated
return self.sfunction._point_symbols | ||
|
||
@property | ||
def _gdim(self): |
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.
imho, just "dimensions" as we do everywhere else
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 agree
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 these are not the dimensions these are the dimensions of the underlying grid which are different than the dimension of the Sparse object and associated interpolator
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.
then _gdims
at least (make it plural)
devito/types/sparse.py
Outdated
""" | ||
if self.gridpoints is not None: | ||
ddim = self.gridpoints.dimensions[-1] | ||
return tuple([self.gridpoints._subs(ddim, di) for di in range(self.grid.dim)]) |
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 I prefer n
for numbers instead of di
(or d
) which is typically used for Dimensions instead
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 like to use (namei, name) in zip(...)
so that's why I have di
since the "name" is d
but can change to n
devito/operations/interpolators.py
Outdated
return self.grid.dimensions | ||
|
||
def implicit_dims(self, implicit_dims): | ||
return as_tuple(implicit_dims) + self.sfunction.dimensions |
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.
Is it ok to have the same name of the function and the arg here?
devito/operations/interpolators.py
Outdated
return self.sfunction._point_symbols | ||
|
||
@property | ||
def _gdim(self): |
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 agree
devito/operations/interpolators.py
Outdated
@@ -230,7 +232,7 @@ def interpolate(self, expr, offset=0, increment=False, self_subs={}, | |||
interpolation expression, but that should be honored when constructing | |||
the operator. | |||
""" | |||
implicit_dims = as_tuple(implicit_dims) + self.sfunction.dimensions | |||
implicit_dims = self.implicit_dims(implicit_dims) |
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.
Yeah, not sure I like much this I want to get the implicit_dims of the implicit_dims
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.
also "implicit_dims" should be a private method.
Maybe _augment_implicit_dims
?
3be6f54
to
a945ed4
Compare
…ceptr out of acc loop
f89d454
to
2752814
Compare
As discussed on slack, issue opened for SubFunction and merging, SUbFunction cleanup top of the list next. |
ea78099
to
0f08bfb
Compare
6014418
to
3544a3f
Compare
devito/ir/equations/algorithms.py
Outdated
|
||
# StencilDimensions are lowered subsequently through special compiler | ||
# passes, so they can be ignored here | ||
relation = tuple(d for d in relation if not d.is_Stencil) | ||
|
||
return relation | ||
# Make sure indices appearance order satisfies "parent" order. Foe example |
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.
For example
devito/types/sparse.py
Outdated
# Rebuild subfunctions first to avoid new data creation as we have to use `_data` | ||
# as a reconstruction kwargs to avoid the circular dependency | ||
# with the parent in SubFunction | ||
# This is also necessary to avoid shaoe issue in the SubFunction with mpi |
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.
shaoe?
590fda9
to
e03a51a
Compare
@@ -15,6 +15,7 @@ | |||
class TestGradient(object): | |||
|
|||
@skipif(['chkpnt', 'cpu64-icc']) | |||
@switchconfig(safe_math=True) |
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.
is it correct to say that with the new interpolation loop nest structure we're somehow losing some accuracy?
how significant is the failure without safe_math?
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.
It's quite small, about 1e-5.
devito/types/sparse.py
Outdated
@@ -402,7 +724,7 @@ class SparseFunction(AbstractSparseFunction): | |||
Discretisation order for space derivatives. Defaults to 0. | |||
shape : tuple of ints, optional | |||
Shape of the object. Defaults to ``(npoint,)``. | |||
dimensions : tuple of Dimension, optional | |||
Dimensions : tuple of Dimension, optional |
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.
dimensions
devito/types/sparse.py
Outdated
Shape of the object. Defaults to ``(npoint,)``. | ||
dimensions : tuple of Dimension, optional | ||
Shape of the object. Defaults to `(npoint,)`. | ||
Dimensions : tuple of Dimension, optional |
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.
dimensions?
056b6ab
to
ab03930
Compare
ab03930
to
4d9abed
Compare
Revamp sparse function.
Issue fixed:
Fixes #920
Fixes #2147
Fixes #2189