Skip to content

Commit

Permalink
api: remove un-necessary extra eqs and temp for gridpoint precomputed
Browse files Browse the repository at this point in the history
  • Loading branch information
mloubout committed Apr 15, 2024
1 parent 00a6fe8 commit f21f8ae
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 78 deletions.
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
116 changes: 47 additions & 69 deletions examples/userapi/07_sparse_operations.ipynb

Large diffs are not rendered by default.

0 comments on commit f21f8ae

Please sign in to comment.