-
Notifications
You must be signed in to change notification settings - Fork 256
compiler: fix halo placement for non out dim exchange #2892
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
Changes from all commits
7633a1a
86fa36f
013bb51
076af37
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -2,7 +2,6 @@ | |
|
|
||
| import numpy as np | ||
| import pytest | ||
| from test_dse import TestTTI | ||
|
|
||
| from conftest import _R, assert_blocking, assert_structure, body0 | ||
| from devito import ( | ||
|
|
@@ -2203,6 +2202,25 @@ def test_lift_halo_update_outside_distributed(self, mode): | |
| halo_update = tloop.nodes[0].body[0].body[0].body[0] | ||
| assert isinstance(halo_update, HaloUpdateList) | ||
|
|
||
| @pytest.mark.parallel(mode=4) | ||
| def test_halo_inner_dim(self, mode): | ||
| grid = Grid((11, 11, 11)) | ||
|
|
||
| np.random.seed(0) | ||
| v = TimeFunction(name="v", grid=grid, space_order=4, | ||
| time_order=1, save=Buffer(1)) | ||
| v.data[:] = np.random.randn(*grid.shape) | ||
| e = TimeFunction(name="dummy", grid=grid, space_order=4, time_order=0) | ||
|
|
||
| eq = [Eq(v.forward, v + 1), Eq(e, v.forward.dydz)] | ||
|
|
||
| op = Operator(eq, opt=('advanced', {'blocklevels': 0})) | ||
|
|
||
| assert_structure(op, ['txyz', 't', 'txyz', 'txyz'], 'txyzxyzz') | ||
| op(time=100) | ||
|
|
||
| assert np.isclose(norm(e), 23484.863, rtol=0, atol=1e-1) | ||
|
|
||
|
|
||
| class TestOperatorAdvanced: | ||
|
|
||
|
|
@@ -2734,9 +2752,10 @@ def test_haloupdate_same_timestep_v2(self, mode): | |
|
|
||
| titer = op.body.body[-1].body[0] | ||
| assert titer.dim is grid.time_dim | ||
| assert titer.nodes[0].body[0].body[0].is_List | ||
| assert len(titer.nodes[0].body[0].body[0].body[0].body) == 1 | ||
| assert titer.nodes[0].body[0].body[0].body[0].body[0].is_Call | ||
| block = titer.nodes[0].body[0].body[1] | ||
| assert block.is_List | ||
| assert len(block.body) == 3 | ||
| assert block.body[0].body[0].is_Call | ||
|
|
||
| op.apply(time=0) | ||
|
|
||
|
|
@@ -3139,7 +3158,7 @@ def test_fission_due_to_antidep(self, mode): | |
| assert_structure(op1, ['t', | ||
| 't,x0_blk0,y0_blk0,x,y,z', | ||
| 't,x0_blk0,y0_blk0,x,y,z'], | ||
| 't,x0_blk0,y0_blk0,x,y,z,z') | ||
| 'tx0_blk0y0_blk0xyzz') | ||
|
|
||
| def init(f, v=1): | ||
| f.data[:] = np.indices(grid.shape).sum(axis=0) % (.004*v) + .01 | ||
|
|
@@ -3513,9 +3532,9 @@ def test_issue_2448_backward(self, mode): | |
|
|
||
| class TestTTIOp: | ||
|
|
||
| @pytest.mark.skipif(TestTTI is None, reason="Requires installing the tests") | ||
| @pytest.mark.parallel(mode=1) | ||
| def test_halo_structure(self, mode): | ||
| from test_dse import TestTTI | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. or it doesn't matter? I will never remember...
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think both work? THis is just moved from a top import becuase somehow importing it at the top runs all the tests in TestTTI at import |
||
| solver = TestTTI().tti_operator(opt='advanced', space_order=8) | ||
| op = solver.op_fwd(save=False) | ||
|
|
||
|
|
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Would it be worth using a sinusoidal function here and comparing to the analytical solution? Would need a bigger grid however, and the existing check is already pretty strong
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not a big fan of randn either
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It's random with a seed. I tend to prefer random values for tests, forces things to be more stable but can change it if makes people uncomfortable