Skip to content

Commit

Permalink
compiler: prevent invering dtype on empty cluster
Browse files Browse the repository at this point in the history
  • Loading branch information
mloubout committed Oct 31, 2023
1 parent cf85b06 commit e6ca17e
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 3 deletions.
3 changes: 2 additions & 1 deletion devito/finite_differences/differentiable.py
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,8 @@ def _fd(self):
fd_args = []
for f in self._args_diff:
try:
if f.space_order <= self.space_order and f.time_order <= self.time_order:
if f.space_order <= self.space_order and \
(not f.is_TimeDependent or f.time_order <= self.time_order):
fd_args.append(f)
except AttributeError:
pass
Expand Down
2 changes: 1 addition & 1 deletion devito/ir/clusters/cluster.py
Original file line number Diff line number Diff line change
Expand Up @@ -483,7 +483,7 @@ def dtype(self):
If two Clusters perform calculations with different precision, the
data type with highest precision is returned.
"""
dtypes = {i.dtype for i in self}
dtypes = {i.dtype for i in self} - {None}

return infer_dtype(dtypes)

Expand Down
3 changes: 2 additions & 1 deletion tests/test_lower_exprs.py
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,10 @@ def test_symbolic_constant_times_add(self):
dt = grid.time_dim.spacing

u = TimeFunction(name="u", grid=grid, space_order=4, time_order=2)
f = Function(name='f', grid=grid)
f = Function(name='f', grid=grid, space_order=4)

eq = Eq(u.forward, u.laplace + dt**0.2*u.biharmonic(1/f))

leq = collect_derivatives.func([eq])[0]

assert len(eq.rhs.args) == 3
Expand Down

0 comments on commit e6ca17e

Please sign in to comment.