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

compiler: Patch bug in SubDomainSet lowering #2408

Merged
merged 1 commit into from
Jul 16, 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
2 changes: 2 additions & 0 deletions devito/passes/clusters/implicit.py
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ def callback(self, clusters, prefix):
d = None
if d is None:
processed.append(c)
# If no MultiSubDomain present in this cluster, then tip should be reset
tip = None
continue

# Get all MultiSubDimensions in the cluster and get the dynamic thickness
Expand Down
30 changes: 30 additions & 0 deletions tests/test_subdomains.py
Original file line number Diff line number Diff line change
Expand Up @@ -307,6 +307,36 @@ class MySubdomains(SubDomainSet):
reads = set().union(*[e.reads for e in exprs])
assert len(reads) == 4 # f, g, h, mydomains

def test_multi_eq_split(self):
"""
Test cases where two loops over the same SubDomainSet will be
separated by another loop.
"""
# Note: a bug was found where this would cause SubDomainSet
# bounds expressions not to be generated in the second loop over
# the SubDomainSet
class MSD(SubDomainSet):
name = 'msd'

msd = MSD(N=1, bounds=(1, 1, 1, 1))

grid = Grid(shape=(11, 11), subdomains=(msd,))

f = Function(name='f', grid=grid)
g = Function(name='g', grid=grid)

eq0 = Eq(f, 1, subdomain=msd)
eq1 = Eq(f, g) # Dependency needed to fix equation order
eq2 = Eq(g, 1, subdomain=msd)

op = Operator([eq0, eq1, eq2])

# Ensure the loop structure is correct
# Note the two 'n0' correspond to the thickness definitions
assert_structure(op,
['n0', 'n0xy', 'xy', 'n0', 'n0xy'],
'n0xyxyn0xy')

def test_multi_sets(self):
"""
Check functionality for when multiple subdomain sets are present.
Expand Down
Loading