Skip to content

Commit

Permalink
tests: Enhance skewing testing with more cases
Browse files Browse the repository at this point in the history
  • Loading branch information
georgebisbas committed Apr 6, 2021
1 parent f4cf7d2 commit 253ff49
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 4 deletions.
1 change: 1 addition & 0 deletions devito/passes/clusters/blocking.py
Original file line number Diff line number Diff line change
Expand Up @@ -106,6 +106,7 @@ def callback(self, clusters, prefix):
properties.update({bd: c.properties[d] - {TILABLE} for bd in block_dims})
properties.update({bd: c.properties[d] - {SKEWABLE}
for bd in block_dims[:-1]})

processed.append(c.rebuild(exprs=exprs, ispace=ispace,
properties=properties))
else:
Expand Down
15 changes: 11 additions & 4 deletions tests/test_dimension.py
Original file line number Diff line number Diff line change
Expand Up @@ -497,7 +497,10 @@ def test_arrays_defined_over_subdims(self):
# "ValueError: No value found for parameter xi_size"
op()

def test_expandingbox_like(self):
@pytest.mark.parametrize('opt', ['advanced',
('advanced', {'skewing': True}),
('advanced', {'skewing': True, 'blockinner': True})])
def test_expandingbox_like(self, opt):
"""
Make sure SubDimensions aren't an obstacle to expanding boxes.
"""
Expand All @@ -511,7 +514,7 @@ def test_expandingbox_like(self):
eqn = Eq(u.forward, u + 1)
eqn = eqn.subs({x: xi, y: yi})

op = Operator(eqn)
op = Operator(eqn, opt=opt)

op.apply(time=3, x_m=2, x_M=5, y_m=2, y_M=5,
xi_ltkn=0, xi_rtkn=0, yi_ltkn=0, yi_rtkn=0)
Expand Down Expand Up @@ -595,7 +598,10 @@ def test_basic_shuffles(self):
assert np.all([np.allclose(usave.data[i], i*factor)
for i in range((nt+factor-1)//factor)])

def test_spacial_subsampling(self):
@pytest.mark.parametrize('opt', ['advanced',
('advanced', {'skewing': True}),
('advanced', {'skewing': True, 'blockinner': True})])
def test_spacial_subsampling(self, opt):
"""
Test conditional dimension for the spatial ones.
This test saves u every two grid points :
Expand All @@ -616,7 +622,8 @@ def test_spacial_subsampling(self):
assert(time in u2.indices)

eqns = [Eq(u.forward, u + 1.), Eq(u2, u)]
op = Operator(eqns)
op = Operator(eqns, opt=opt)
import pdb;pdb.set_trace()
op.apply(time_M=nt-2)
# Verify that u2[x,y]= u[2*x, 2*y]
assert np.allclose(u.data[:-1, 0::2, 0::2], u2.data[:-1, :, :])
Expand Down

0 comments on commit 253ff49

Please sign in to comment.