Skip to content

Commit 27a8ff6

Browse files
committed
compiler: fix halo placement for non out dimm exchange
1 parent bab9aae commit 27a8ff6

2 files changed

Lines changed: 29 additions & 1 deletion

File tree

devito/ir/stree/algorithms.py

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -197,8 +197,18 @@ def preprocess(clusters, options=None, **kwargs):
197197
diff = dims - distributed_aindices
198198
intersection = dims & distributed_aindices
199199

200+
# Does the cluster writes into the halo scheme
201+
halo_write = False
202+
for f, w in c.scope.writes.items():
203+
loc_vals = c1.halo_scheme.loc_values
204+
if f in c1.halo_scheme.fmapper:
205+
for a in [wi.access for wi in w]:
206+
if set(a.indices) & loc_vals:
207+
halo_write = True
208+
break
209+
200210
if all(c1.guards.get(d) == c.guards.get(d) for d in diff) and \
201-
len(intersection) > 0:
211+
len(intersection) > 0 and not halo_write:
202212
found.append(c1)
203213
queue.remove(c1)
204214

tests/test_mpi.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2203,6 +2203,24 @@ def test_lift_halo_update_outside_distributed(self, mode):
22032203
halo_update = tloop.nodes[0].body[0].body[0].body[0]
22042204
assert isinstance(halo_update, HaloUpdateList)
22052205

2206+
@pytest.mark.parallel(mode=4)
2207+
def test_halo_inner_dim(self, mode):
2208+
grid = Grid((11, 11, 11))
2209+
2210+
np.random.seed(0)
2211+
v = TimeFunction(name="v", grid=grid, space_order=4,
2212+
time_order=1, save=Buffer(1))
2213+
v.data[:] = np.random.randn(*grid.shape)
2214+
e = TimeFunction(name="dummy", grid=grid, space_order=4, time_order=0)
2215+
2216+
eq = [Eq(v.forward, v + 1), Eq(e, v.forward.dydz)]
2217+
2218+
op = Operator(eq)
2219+
assert_structure(op, ['txyz', 't', 'txyz', 'txyz'], 'txyzxyzz')
2220+
op(time=100)
2221+
2222+
assert np.isclose(norm(e), 23484.863, rtol=0, atol=1e-1)
2223+
22062224

22072225
class TestOperatorAdvanced:
22082226

0 commit comments

Comments
 (0)