Skip to content

Commit

Permalink
Merge pull request #2412 from devitocodes/change-default-bs
Browse files Browse the repository at this point in the history
compiler: Bump default block size
  • Loading branch information
FabioLuporini authored Jul 22, 2024
2 parents ea94a0f + c98988f commit d343ae0
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 1 addition & 3 deletions devito/types/dimension.py
Original file line number Diff line number Diff line change
Expand Up @@ -1307,10 +1307,8 @@ def _arg_names(self):
return ()

def _arg_defaults(self, **kwargs):
# TODO: need a heuristic to pick a default incr size
# TODO: move default value to __new__
try:
return {self.step.name: 8}
return {self.step.name: 16}
except AttributeError:
# `step` not a Symbol
return {}
Expand Down
10 changes: 7 additions & 3 deletions tests/test_dse.py
Original file line number Diff line number Diff line change
Expand Up @@ -2447,8 +2447,6 @@ def test_ftemps_option(self):
t = grid.stepping_dim

nthreads = 2
x0_blk0_size = 8
y0_blk0_size = 8

u = TimeFunction(name='u', grid=grid, space_order=3)
u1 = TimeFunction(name="u", grid=grid, space_order=3)
Expand All @@ -2475,6 +2473,12 @@ def test_ftemps_option(self):
with pytest.raises(InvalidArgument):
op1(time_M=1, u=u1)

block_dims = [i for i in op1.dimensions if i.is_Block and i._depth == 1]
assert len(block_dims) == 2
mapper = {d.root: d for d in block_dims}
x0_blk0_size = mapper[x]._arg_defaults()[mapper[x].step.name]
y0_blk0_size = mapper[y]._arg_defaults()[mapper[y].step.name]

# Prepare to run op1
shape = [nthreads, x0_blk0_size, y0_blk0_size, grid.shape[-1]]
ofuncs = [i.make(shape) for i in op1.temporaries]
Expand Down Expand Up @@ -2845,7 +2849,7 @@ def test_fullopt(self):

# Check expected opcount/oi
assert summary[('section1', None)].ops == 92
assert np.isclose(summary[('section1', None)].oi, 2.072, atol=0.001)
assert np.isclose(summary[('section1', None)].oi, 1.99, atol=0.001)

# With optimizations enabled, there should be exactly four BlockDimensions
op = wavesolver.op_fwd()
Expand Down

0 comments on commit d343ae0

Please sign in to comment.