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

api: Cleanup sparse setup for precomputed #2353

Merged
merged 1 commit into from
Apr 15, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 7 additions & 6 deletions devito/operations/interpolators.py
Original file line number Diff line number Diff line change
Expand Up @@ -319,7 +319,7 @@ def _interpolate(self, expr, increment=False, self_subs={}, implicit_dims=None):
rhs = Symbol(name='sum', dtype=self.sfunction.dtype)
summands = [Eq(rhs, 0., implicit_dims=implicit_dims)]
# Substitute coordinate base symbols into the interpolation coefficients
summands.extend([Inc(rhs, (_expr * self._weights).xreplace(idx_subs),
summands.extend([Inc(rhs, (self._weights * _expr).xreplace(idx_subs),
implicit_dims=implicit_dims)])

# Write/Incr `self`
Expand Down Expand Up @@ -377,7 +377,7 @@ def _inject(self, field, expr, implicit_dims=None):

# Substitute coordinate base symbols into the interpolation coefficients
eqns = [Inc(_field.xreplace(idx_subs),
(_expr * self._weights).xreplace(idx_subs),
(self._weights * _expr).xreplace(idx_subs),
implicit_dims=implicit_dims)
for (_field, _expr) in zip(fields, _exprs)]

Expand Down Expand Up @@ -432,11 +432,12 @@ class PrecomputedInterpolator(WeightedInterpolator):
_name = 'precomp'

def _positions(self, implicit_dims):
if self.sfunction.gridpoints is None:
if self.sfunction.gridpoints_data is None:
return super()._positions(implicit_dims)
# No position temp as we have directly the gridpoints
return [Eq(p, floor(k), implicit_dims=implicit_dims)
for (k, p) in self.sfunction._position_map.items()]
else:
# No position temp as we have directly the gridpoints
return[Eq(p, k, implicit_dims=implicit_dims)
for (k, p) in self.sfunction._position_map.items()]

@property
def interpolation_coeffs(self):
Expand Down
2 changes: 1 addition & 1 deletion devito/types/sparse.py
Original file line number Diff line number Diff line change
Expand Up @@ -1154,7 +1154,7 @@ def _position_map(self):
the position. We mitigate this problem by computing the positions
individually (hence the need for a position map).
"""
if self.gridpoints is not None:
if self.gridpoints_data is not None:
ddim = self.gridpoints.dimensions[-1]
return OrderedDict((self.gridpoints._subs(ddim, di), p)
for (di, p) in zip(range(self.grid.dim),
Expand Down
2 changes: 0 additions & 2 deletions docker/Dockerfile.intel
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,6 @@ FROM icx as cpu-sycl
ENV DEVITO_ARCH="sycl"
ENV DEVITO_LANGUAGE="sycl"
ENV DEVITO_PLATFORM="intel64"
ENV MPICC=sycl

##############################################################
# ICX SYCL GPU image
Expand All @@ -117,4 +116,3 @@ FROM icx as gpu-sycl
ENV DEVITO_ARCH="sycl"
ENV DEVITO_LANGUAGE="sycl"
ENV DEVITO_PLATFORM="intelgpuX"
ENV MPICC=sycl
georgebisbas marked this conversation as resolved.
Show resolved Hide resolved
116 changes: 47 additions & 69 deletions examples/userapi/07_sparse_operations.ipynb
Copy link
Contributor

Choose a reason for hiding this comment

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

Why are positions differnt now?

Copy link
Contributor

Choose a reason for hiding this comment

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

you mean in the produced output? the numerical differences?

Large diffs are not rendered by default.

Loading