Skip to content

Commit

Permalink
tests: minor fixes and flake8
Browse files Browse the repository at this point in the history
  • Loading branch information
georgebisbas committed Mar 5, 2021
1 parent eb61dbd commit 299d305
Show file tree
Hide file tree
Showing 4 changed files with 6 additions and 10 deletions.
1 change: 1 addition & 0 deletions devito/passes/clusters/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@
from .blocking import * # noqa
from .asynchrony import * # noqa
from .misc import * # noqa
from .temporal import * # noqa
3 changes: 1 addition & 2 deletions devito/passes/clusters/blocking.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
from devito.tools import timed_pass
from devito.types import IncrDimension


__all__ = ['Blocking']


Expand Down Expand Up @@ -65,6 +64,7 @@ def callback(self, clusters, prefix):
return clusters

d = prefix[-1].dim

# Create the block Dimensions (in total `self.levels` Dimensions)
name = self.template % (d.name, self.nblocked[d], '%d')

Expand All @@ -81,7 +81,6 @@ def callback(self, clusters, prefix):

processed = []
for c in clusters:

if TILABLE in c.properties[d]:
ispace = decompose(c.ispace, d, block_dims)

Expand Down
4 changes: 0 additions & 4 deletions examples/seismic/acoustic/acoustic_example.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,8 +38,6 @@ def run(shape=(50, 50, 50), spacing=(20.0, 20.0, 20.0), tn=1000.0,
save = full_run and not checkpointing
# Define receiver geometry (spread across x, just below surface)
rec, u, summary = solver.forward(save=save, autotune=autotune)
print(norm(rec))
print(norm(u))

if preset == 'constant':
# With a new m as Constant
Expand All @@ -48,11 +46,9 @@ def run(shape=(50, 50, 50), spacing=(20.0, 20.0, 20.0), tn=1000.0,
# With a new vp as a scalar value
solver.forward(save=save, vp=2.0)


if not full_run:
return summary.gflopss, summary.oi, summary.timings, [rec, u.data]


# Smooth velocity
initial_vp = Function(name='v0', grid=solver.model.grid, space_order=space_order)
smooth(initial_vp, solver.model.vp)
Expand Down
8 changes: 4 additions & 4 deletions tests/test_dse.py
Original file line number Diff line number Diff line change
Expand Up @@ -230,8 +230,8 @@ def test_makeit_ssa(exprs, exp_u, exp_v):
assert np.all(v.data == exp_v)


@pytest.mark.parametrize('opt, expected', (['noop', 2], ['advanced', 2]))
def test_time_dependent_split(opt, expected):
@pytest.mark.parametrize('opt', ['noop', 'advanced'])
def test_time_dependent_split(opt):
grid = Grid(shape=(10, 10))
u = TimeFunction(name='u', grid=grid, time_order=2, space_order=2, save=3)
v = TimeFunction(name='v', grid=grid, time_order=2, space_order=0, save=3)
Expand All @@ -243,7 +243,8 @@ def test_time_dependent_split(opt, expected):
op = Operator(eq, opt=opt)

trees = retrieve_iteration_tree(op)
assert len(trees) == expected
assert len(trees) == 2

op()

assert np.allclose(u.data[2, :, :], 3.0)
Expand Down Expand Up @@ -494,7 +495,6 @@ def test_full_shape(self, rotate):
# Check numerical output
op0(time_M=1)
op1(time_M=1, u=u1)

assert np.all(u.data == u1.data)

@pytest.mark.parametrize('rotate', [False, True])
Expand Down

0 comments on commit 299d305

Please sign in to comment.