Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
grudge
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Andreas Klöckner
grudge
Commits
3a979aea
Commit
3a979aea
authored
4 years ago
by
Alexandru Fikl
Browse files
Options
Downloads
Patches
Plain Diff
add another example of a failing aggregation
parent
de1b1aca
No related branches found
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
test/test_grudge.py
+29
-13
29 additions, 13 deletions
test/test_grudge.py
with
29 additions
and
13 deletions
test/test_grudge.py
+
29
−
13
View file @
3a979aea
...
@@ -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
(
a
ctx_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
=
DG
Discretization
WithBoundaries
(
actx
,
mesh
,
order
=
target_order
)
discr
=
Discretization
Collection
(
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
=
DG
Discretization
WithBoundaries
(
actx
,
mesh
,
order
=
target_order
)
discr
=
Discretization
Collection
(
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
())
# }}}
# }}}
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment