-
Notifications
You must be signed in to change notification settings - Fork 231
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
compiler: Add optional pass to check stability
- Loading branch information
1 parent
5df7b3d
commit d4abfcd
Showing
5 changed files
with
119 additions
and
8 deletions.
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
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
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
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
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 |
---|---|---|
@@ -0,0 +1,21 @@ | ||
import pytest | ||
|
||
from devito import Grid, Function, TimeFunction, Eq, Operator, switchconfig | ||
from devito.exceptions import ExecutionError | ||
|
||
|
||
@switchconfig(safe_math=True) | ||
def test_stability(): | ||
grid = Grid(shape=(10, 10)) | ||
|
||
f = Function(name='f', grid=grid, space_order=2) | ||
u = TimeFunction(name='u', grid=grid, space_order=2) | ||
|
||
eq = Eq(u.forward, u/f) | ||
|
||
op = Operator(eq, opt=('advanced', {'errctl': 'max'})) | ||
|
||
u.data[:] = 1. | ||
|
||
with pytest.raises(ExecutionError): | ||
op.apply(time_M=200, dt=.1) |