-
Notifications
You must be signed in to change notification settings - Fork 229
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
tests: Add a test-only init for issue 2448 #2465
Closed
Closed
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,7 @@ | |
SparseTimeFunction, Dimension, ConditionalDimension, div, | ||
SubDimension, SubDomain, Eq, Ne, Inc, NODE, Operator, norm, | ||
inner, configuration, switchconfig, generic_derivative, | ||
PrecomputedSparseFunction, DefaultDimension, Buffer) | ||
PrecomputedSparseFunction, DefaultDimension, Buffer, solve) | ||
from devito.arch.compiler import OneapiCompiler | ||
from devito.data import LEFT, RIGHT | ||
from devito.ir.iet import (Call, Conditional, Iteration, FindNodes, FindSymbols, | ||
|
@@ -17,7 +17,9 @@ | |
ComputeCall) | ||
from devito.mpi.distributed import CustomTopology | ||
from devito.tools import Bunch | ||
from devito.types.dimension import SpaceDimension | ||
|
||
from examples.seismic import Receiver, TimeAxis | ||
from examples.seismic.acoustic import acoustic_setup | ||
|
||
|
||
|
@@ -1005,6 +1007,59 @@ def test_avoid_haloupdate_if_distr_but_sequential(self, mode): | |
calls = FindNodes(Call).visit(op) | ||
assert len(calls) == 0 | ||
|
||
@pytest.mark.parallel(mode=1) | ||
def test_issue_2448(self, mode): | ||
# TOFIX: Placeholder test for issue 2448 | ||
# Space related | ||
extent = (1500., ) | ||
shape = (201, ) | ||
x = SpaceDimension(name='x', spacing=Constant(name='h_x', | ||
value=extent[0]/(shape[0]-1))) | ||
grid = Grid(extent=extent, shape=shape, dimensions=(x, )) | ||
|
||
# Time related | ||
t0, tn = 0., 30. | ||
dt = (10. / np.sqrt(2.)) / 6. | ||
time_range = TimeAxis(start=t0, stop=tn, step=dt) | ||
|
||
# Velocity and pressure fields | ||
so = 2 | ||
to = 1 | ||
v = TimeFunction(name='v', grid=grid, space_order=so, time_order=to) | ||
tau = TimeFunction(name='tau', grid=grid, space_order=so, time_order=to) | ||
|
||
# The receiver | ||
nrec = 1 | ||
rec = Receiver(name="rec", grid=grid, npoint=nrec, time_range=time_range) | ||
rec.coordinates.data[:, 0] = np.linspace(0., extent[0], num=nrec) | ||
rec_term = rec.interpolate(expr=v) | ||
|
||
# First order elastic-like dependencies equations | ||
pde_v = v.dt - (tau.dx) | ||
pde_tau = (tau.dt - ((v.forward).dx)) | ||
|
||
u_v = Eq(v.forward, solve(pde_v, v.forward)) | ||
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. Does it work with just 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. aa I will have to try |
||
u_tau = Eq(tau.forward, solve(pde_tau, tau.forward)) | ||
|
||
op = Operator([u_v] + [u_tau] + rec_term) | ||
|
||
calls = [i for i in FindNodes(Call).visit(op) | ||
if isinstance(i, HaloUpdateCall)] | ||
|
||
# try: | ||
|
||
# The correct we want | ||
assert len(calls) == 2 | ||
assert calls[0].arguments[0] is tau | ||
assert calls[1].arguments[0] is v | ||
|
||
# except: | ||
# # Current redundant codegen | ||
# assert len(calls) == 3 | ||
# assert calls[0].arguments[0] is tau | ||
# assert calls[1].arguments[0] is v | ||
# assert calls[2].arguments[0] is v | ||
|
||
@pytest.mark.parallel(mode=1) | ||
def test_avoid_haloupdate_with_subdims(self, mode): | ||
grid = Grid(shape=(4,)) | ||
|
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.
Nitpick: You don't need all these brackets right?
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.
incorporated in #2477