Skip to content

Commit

Permalink
compiler: Switch to alternative solution
Browse files Browse the repository at this point in the history
  • Loading branch information
georgebisbas committed May 17, 2023
1 parent 9559437 commit 02a8511
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 8 deletions.
11 changes: 6 additions & 5 deletions devito/ir/clusters/algorithms.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,12 +210,13 @@ def guard(clusters):
k = d
else:
dims = pull_dims(cd.condition)
# If `cd` uses more dimensions than the ispace,
# stay under parent
if (not dims.issubset(set(c.ispace.dimensions)) and
cd.parent in dims):
k = cd.parent
# If `cd` uses, as condition, an arbitrary SymPy expression, then
# we must ensure to nest it inside the last of the Dimensions
# appearing in `cd.condition`
if cd._factor is not None:
k = d
else:
dims = pull_dims(cd.condition, flag=False)
k = max(dims, default=d, key=lambda i: c.ispace.index(i))

# Pull `cd` from any expr
Expand Down
6 changes: 3 additions & 3 deletions tests/test_subdomains.py
Original file line number Diff line number Diff line change
Expand Up @@ -632,7 +632,7 @@ class Dummy(SubDomainSet):

class TestSubDomain_w_condition(object):

def test_condition_w_subdomain(self):
def test_condition_w_subdomain_v0(self):

shape = (10, )
grid = Grid(shape=shape)
Expand Down Expand Up @@ -663,7 +663,7 @@ def define(self, dimensions):

assert_structure(op, ['i1x'], 'i1x')

def test_condition_w_subdomain_II(self):
def test_condition_w_subdomain_v1(self):

shape = (10, 10)
grid = Grid(shape=shape)
Expand Down Expand Up @@ -695,7 +695,7 @@ def define(self, dimensions):

assert_structure(op, ['xi1y'], 'xi1y')

def test_condition_w_subdomain_III(self):
def test_condition_w_subdomain_v2(self):

shape = (10, 10)
grid = Grid(shape=shape)
Expand Down

0 comments on commit 02a8511

Please sign in to comment.