Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

compiler: Bump default block size #2412

Merged
merged 1 commit into from
Jul 22, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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}
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

nitpicking: Can we add a "TODO" to check the args for space order and have some empirical 2*space_order or something?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

doing in a sec in upcoming PR, merging this one now

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
Loading