Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
D
dune-codegen
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Container Registry
Model registry
Operate
Environments
Monitor
Incidents
Service Desk
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
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
Christian Heinigk
dune-codegen
Commits
ed0d0683
Commit
ed0d0683
authored
8 years ago
by
Dominic Kempf
Browse files
Options
Downloads
Patches
Plain Diff
Broadcast theta matrices where possible
parent
70589afb
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
python/dune/perftool/sumfact/tabulation.py
+15
-7
15 additions, 7 deletions
python/dune/perftool/sumfact/tabulation.py
with
15 additions
and
7 deletions
python/dune/perftool/sumfact/tabulation.py
+
15
−
7
View file @
ed0d0683
...
...
@@ -20,10 +20,12 @@ from dune.perftool.generation import (class_member,
valuearg
)
from
dune.perftool.loopy.buffer
import
get_buffer_temporary
from
dune.perftool.loopy.vcl
import
get_vcl_typename
from
dune.perftool.pdelab.localoperator
import
(
name_domain_field
,
lop_template_range_field
,
)
from
dune.perftool.pdelab.quadrature
import
quadrature_order
from
dune.perftool.tools
import
maybe_wrap_subscript
from
loopy
import
CallMangleInfo
from
loopy.symbolic
import
FunctionIdentifier
from
loopy.types
import
NumpyType
...
...
@@ -32,7 +34,7 @@ from pytools import ImmutableRecord, product
import
pymbolic.primitives
as
prim
import
loopy
as
lp
import
numpy
import
numpy
as
np
def
ceildiv
(
a
,
b
):
...
...
@@ -84,7 +86,6 @@ class BasisTabulationMatrix(BasisTabulationMatrixBase, ImmutableRecord):
return
self
.
basis_size
def
pymbolic
(
self
,
indices
):
assert
len
(
indices
)
==
2
name
=
"
{}{}Theta{}{}_qp{}_dof_{}
"
.
format
(
"
face{}_
"
.
format
(
self
.
face
)
if
self
.
face
is
not
None
else
""
,
"
d
"
if
self
.
derivative
else
""
,
"
T
"
if
self
.
transpose
else
""
,
...
...
@@ -160,6 +161,13 @@ class BasisTabulationMatrixArray(BasisTabulationMatrixBase):
def
pymbolic
(
self
,
indices
):
assert
len
(
indices
)
==
3
# Check whether we can realize this by broadcasting the values of a simple tabulation
if
len
(
set
(
self
.
tabs
))
==
1
:
vcltype
=
get_vcl_typename
(
np
.
float64
,
vector_width
=
len
(
self
.
tabs
))
theta
=
self
.
tabs
[
0
].
pymbolic
(
indices
[:
-
1
])
return
prim
.
Call
(
prim
.
Variable
(
vcltype
),
(
theta
,))
abbrevs
=
tuple
(
"
{}x{}
"
.
format
(
"
d
"
if
t
.
derivative
else
""
,
"
s{}
"
.
format
(
t
.
slice_index
)
if
t
.
slice_size
is
not
None
else
""
)
for
t
in
self
.
tabs
)
...
...
@@ -183,7 +191,7 @@ class BasisTabulationMatrixArray(BasisTabulationMatrixBase):
member
=
loopy_class_member
(
name
,
classtag
=
"
operator
"
,
dtype
=
n
umpy
.
float64
,
dtype
=
n
p
.
float64
,
dim_tags
=
"
f,f,vec
"
,
shape
=
(
self
.
rows
,
self
.
cols
,
self
.
width
),
potentially_vectorized
=
True
,
...
...
@@ -218,7 +226,7 @@ def basis_functions_per_direction():
def
define_oned_quadrature_weights
(
name
):
loopy_class_member
(
name
,
dtype
=
n
umpy
.
float64
,
dtype
=
n
p
.
float64
,
classtag
=
"
operator
"
,
shape
=
(
quadrature_points_per_direction
(),),
)
...
...
@@ -233,7 +241,7 @@ def name_oned_quadrature_weights():
def
define_oned_quadrature_points
(
name
):
loopy_class_member
(
name
,
dtype
=
n
umpy
.
float64
,
dtype
=
n
p
.
float64
,
classtag
=
"
operator
"
,
shape
=
(
quadrature_points_per_direction
(),),
)
...
...
@@ -315,7 +323,7 @@ class PolynomialLookup(FunctionIdentifier):
@function_mangler
def
polynomial_lookup_mangler
(
target
,
func
,
dtypes
):
if
isinstance
(
func
,
PolynomialLookup
):
return
CallMangleInfo
(
func
.
name
,
(
NumpyType
(
n
umpy
.
float64
),),
(
NumpyType
(
n
umpy
.
int32
),
NumpyType
(
n
umpy
.
float64
)))
return
CallMangleInfo
(
func
.
name
,
(
NumpyType
(
n
p
.
float64
),),
(
NumpyType
(
n
p
.
int32
),
NumpyType
(
n
p
.
float64
)))
def
define_theta
(
name
,
tabmat
,
additional_indices
=
(),
width
=
None
):
...
...
@@ -332,7 +340,7 @@ def define_theta(name, tabmat, additional_indices=(), width=None):
shape
=
shape
+
(
width
,)
loopy_class_member
(
name
,
dtype
=
n
umpy
.
float64
,
dtype
=
n
p
.
float64
,
shape
=
shape
,
classtag
=
"
operator
"
,
dim_tags
=
dim_tags
,
...
...
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