Skip to content

Commit

Permalink
tests: Added additional check to SubDomainSet with blocking
Browse files Browse the repository at this point in the history
  • Loading branch information
EdCaunt committed Jul 10, 2024
1 parent cff01df commit 9580e26
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
5 changes: 3 additions & 2 deletions devito/passes/clusters/implicit.py
Original file line number Diff line number Diff line change
Expand Up @@ -182,8 +182,9 @@ def callback(self, clusters, prefix):
if dim not in edims or not edims.issubset(prefix.dimensions):
continue

found[d.msd].clusters.append(c)
found[d.msd].mapper = reduce(found[d.msd].mapper, mapper, edims, prefix)
found[d.functions].clusters.append(c)
found[d.functions].mapper = reduce(found[d.functions].mapper,
mapper, edims, prefix)

# Turn the reduced mapper into a list of equations
mapper = {}
Expand Down
7 changes: 1 addition & 6 deletions devito/types/grid.py
Original file line number Diff line number Diff line change
Expand Up @@ -783,12 +783,7 @@ def __subdomain_finalize__(self, grid, counter=0, **kwargs):
# Check if shorthand notation has been provided:
for j in range(2):
idx = 2*i + j
if isinstance(self._local_bounds[idx], int):
sd_func.data[:, idx] = np.full((self._n_domains,),
self._local_bounds[idx],
dtype=np.int32)
else:
sd_func.data[:, idx] = self._local_bounds[idx]
sd_func.data[:, idx] = self._local_bounds[idx]

dname = '%si%d' % (d.name, counter)
dimensions.append(MultiSubDimension(dname, d,
Expand Down
9 changes: 9 additions & 0 deletions tests/test_subdomains.py
Original file line number Diff line number Diff line change
Expand Up @@ -642,6 +642,15 @@ class Dummy(SubDomainSet):
assert_structure(op, ['t,n0', 't,n0,xi20_blk0,yi20_blk0,x,y,z'],
't,n0,xi20_blk0,yi20_blk0,x,y,z')

xi, _, _ = dummy.dimensions
# Check that the correct number of thickness expressions are generated
sdsexprs = [i.expr for i in FindNodes(Expression).visit(op)
if i.expr.rhs.is_Indexed
and i.expr.rhs.function is xi.functions]
# The thickness expressions Eq(x_ltkn0, dummy[n0][0]), ...
# should be scheduled once per dimension
assert len(sdsexprs) == 6

def test_sequential_implicit(self):
"""
Make sure the implicit dimensions of the MultiSubDomain define a sequential
Expand Down

0 comments on commit 9580e26

Please sign in to comment.