Skip to content

Commit

Permalink
compiler: Hotfix compare-ops
Browse files Browse the repository at this point in the history
  • Loading branch information
FabioLuporini committed Oct 30, 2023
1 parent d4e9cc5 commit 65b8cc6
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 1 deletion.
2 changes: 1 addition & 1 deletion devito/symbolics/inspection.py
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ def compare_ops(e1, e2):
return True if e1 == e2 else False
elif isinstance(e1, IndexDerivative) and isinstance(e2, IndexDerivative):
if e1.mapper == e2.mapper:
return compare_ops(e1.base, e2.base)
return compare_ops(e1.expr, e2.expr)
else:
return False
elif e1.is_Indexed and e2.is_Indexed:
Expand Down
15 changes: 15 additions & 0 deletions tests/test_unexpansion.py
Original file line number Diff line number Diff line change
Expand Up @@ -349,6 +349,21 @@ def test_v1(self):

op.cfunction

def test_diff_first_deriv(self):
grid = Grid(shape=(16, 16, 16))

u = TimeFunction(name='u', grid=grid, space_order=16)

eq = Eq(u.forward, u.dy2.dz + u.dy.dx + 1)

op = Operator(eq, opt=('advanced', {'expand': False}))

xs, ys, zs = get_params(op, 'x0_blk0_size', 'y0_blk0_size', 'z_size')
arrays = get_arrays(op)
assert len(arrays) == 2
check_array(arrays[0], ((8, 8), (0, 0), (8, 8)), (xs+16, ys, zs+16))
check_array(arrays[1], ((8, 8), (0, 0), (8, 8)), (xs+16, ys, zs+16))


def tti_sa_eqns(grid):
t = grid.stepping_dim
Expand Down

0 comments on commit 65b8cc6

Please sign in to comment.