Skip to content

Commit b0c4da7

Browse files
committed
tests: Add MPI test for Border
1 parent 2284bef commit b0c4da7

File tree

2 files changed

+66
-16
lines changed

2 files changed

+66
-16
lines changed

examples/userapi/03_subdomains.ipynb

Lines changed: 50 additions & 15 deletions
Large diffs are not rendered by default.

tests/test_subdomains.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -727,7 +727,6 @@ class Dummy(SubDomainSet):
727727

728728
class TestBorder:
729729
# Note: This class is partially covered by doctests
730-
# TODO: Will need to add MPI tests, including overrides
731730
def test_exceptions(self):
732731
"""Test exceptions are raised for malformed specifications"""
733732
grid = Grid(shape=(5,))
@@ -919,6 +918,22 @@ def test_border_3d(self, inset, corners):
919918

920919
assert np.all(f.data == check)
921920

921+
@pytest.mark.parallel(mode=[2, 4])
922+
def test_mpi(self, mode):
923+
shape = (7, 7)
924+
grid = Grid(shape=shape)
925+
926+
border = Border(grid, 2)
927+
f = Function(name='f', grid=grid, dtype=np.int32)
928+
Operator(Eq(f, f+1, subdomain=border))()
929+
930+
check = np.full(shape, 1, dtype=np.int32)
931+
check[2:-2, 2:-2] = 0
932+
933+
data = f.data_gather()
934+
if grid.distributor.myrank == 0:
935+
assert np.all(data == check)
936+
922937

923938
class TestSubDomain_w_condition:
924939

0 commit comments

Comments
 (0)