Skip to content
Snippets Groups Projects
Commit 3a979aea authored by Alexandru Fikl's avatar Alexandru Fikl
Browse files

add another example of a failing aggregation

parent de1b1aca
No related branches found
No related tags found
No related merge requests found
...@@ -1138,14 +1138,12 @@ def test_empty_boundary(actx_factory): ...@@ -1138,14 +1138,12 @@ def test_empty_boundary(actx_factory):
assert len(component) == len(discr.discr_from_dd(BTAG_NONE).groups) assert len(component) == len(discr.discr_from_dd(BTAG_NONE).groups)
def test_operator_compiler_overwrite(ctx_factory): def test_operator_compiler_overwrite(actx_factory):
"""Tests that the same expression in ``eval_code`` and ``discr_code`` """Tests that the same expression in ``eval_code`` and ``discr_code``
does not confuse the OperatorCompiler in grudge/symbolic/compiler.py. does not confuse the OperatorCompiler in grudge/symbolic/compiler.py.
""" """
ctx = ctx_factory() actx = actx_factory()
queue = cl.CommandQueue(ctx)
actx = PyOpenCLArrayContext(queue)
ambient_dim = 2 ambient_dim = 2
target_order = 4 target_order = 4
...@@ -1154,7 +1152,7 @@ def test_operator_compiler_overwrite(ctx_factory): ...@@ -1154,7 +1152,7 @@ def test_operator_compiler_overwrite(ctx_factory):
mesh = generate_regular_rect_mesh( mesh = generate_regular_rect_mesh(
a=(-0.5,)*ambient_dim, b=(0.5,)*ambient_dim, a=(-0.5,)*ambient_dim, b=(0.5,)*ambient_dim,
n=(8,)*ambient_dim, order=1) n=(8,)*ambient_dim, order=1)
discr = DGDiscretizationWithBoundaries(actx, mesh, order=target_order) discr = DiscretizationCollection(actx, mesh, order=target_order)
# {{{ test # {{{ test
...@@ -1168,15 +1166,16 @@ def test_operator_compiler_overwrite(ctx_factory): ...@@ -1168,15 +1166,16 @@ def test_operator_compiler_overwrite(ctx_factory):
# }}} # }}}
@pytest.mark.parametrize("ambient_dim", [2, 3]) @pytest.mark.parametrize("ambient_dim", [
def test_incorrect_assignment_aggregation(ctx_factory, ambient_dim): 2,
pytest.param(3, marks=pytest.mark.xfail)
])
def test_incorrect_assignment_aggregation(actx_factory, ambient_dim):
"""Tests that the greedy assignemnt aggregation code works on a non-trivial """Tests that the greedy assignemnt aggregation code works on a non-trivial
expression (on which it didn't work at the time of writing). expression (on which it didn't work at the time of writing).
""" """
ctx = ctx_factory() actx = actx_factory()
queue = cl.CommandQueue(ctx)
actx = PyOpenCLArrayContext(queue)
target_order = 4 target_order = 4
...@@ -1184,12 +1183,28 @@ def test_incorrect_assignment_aggregation(ctx_factory, ambient_dim): ...@@ -1184,12 +1183,28 @@ def test_incorrect_assignment_aggregation(ctx_factory, ambient_dim):
mesh = generate_regular_rect_mesh( mesh = generate_regular_rect_mesh(
a=(-0.5,)*ambient_dim, b=(0.5,)*ambient_dim, a=(-0.5,)*ambient_dim, b=(0.5,)*ambient_dim,
n=(8,)*ambient_dim, order=1) n=(8,)*ambient_dim, order=1)
discr = DGDiscretizationWithBoundaries(actx, mesh, order=target_order) discr = DiscretizationCollection(actx, mesh, order=target_order)
# {{{ test # {{{ test with a relative norm
dd = sym.DD_VOLUME from grudge.dof_desc import DD_VOLUME
dd = DD_VOLUME
sym_x = sym.make_sym_array("y", ambient_dim, dd=dd)
sym_y = sym.make_sym_array("y", ambient_dim, dd=dd) sym_y = sym.make_sym_array("y", ambient_dim, dd=dd)
sym_norm_y = sym.norm(2, sym_y, dd=dd)
sym_norm_d = sym.norm(2, sym_x - sym_y, dd=dd)
sym_op = sym_norm_d / sym_norm_y
logger.info("%s", sym.pretty(sym_op))
# FIXME: this shouldn't raise a RuntimeError
with pytest.raises(RuntimeError):
bind(discr, sym_op)(actx, x=1.0, y=discr.discr_from_dd(dd).nodes())
# }}}
# {{{ test with repeated mass inverses
sym_minv_y = sym.cse(sym.InverseMassOperator()(sym_y), "minv_y") sym_minv_y = sym.cse(sym.InverseMassOperator()(sym_y), "minv_y")
sym_u = make_obj_array([0.5 * sym.Ones(dd), 0.0, 0.0])[:ambient_dim] sym_u = make_obj_array([0.5 * sym.Ones(dd), 0.0, 0.0])[:ambient_dim]
...@@ -1199,6 +1214,7 @@ def test_incorrect_assignment_aggregation(ctx_factory, ambient_dim): ...@@ -1199,6 +1214,7 @@ def test_incorrect_assignment_aggregation(ctx_factory, ambient_dim):
+ sym.MassOperator(dd)(sym_minv_y * sym_div_u) + sym.MassOperator(dd)(sym_minv_y * sym_div_u)
logger.info("%s", sym.pretty(sym_op)) logger.info("%s", sym.pretty(sym_op))
# FIXME: this shouldn't raise a RuntimeError either
bind(discr, sym_op)(actx, y=discr.discr_from_dd(dd).nodes()) bind(discr, sym_op)(actx, y=discr.discr_from_dd(dd).nodes())
# }}} # }}}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment