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
901cdcf9
Commit
901cdcf9
authored
5 years ago
by
Dominic Kempf
Browse files
Options
Downloads
Patches
Plain Diff
Cache the flopcost of a sumfact kernel object
parent
d4f90764
No related branches found
No related tags found
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
python/dune/codegen/sumfact/permutation.py
+1
-0
1 addition, 0 deletions
python/dune/codegen/sumfact/permutation.py
python/dune/codegen/sumfact/symbolic.py
+11
-3
11 additions, 3 deletions
python/dune/codegen/sumfact/symbolic.py
with
12 additions
and
3 deletions
python/dune/codegen/sumfact/permutation.py
+
1
−
0
View file @
901cdcf9
...
@@ -3,6 +3,7 @@
...
@@ -3,6 +3,7 @@
import
itertools
import
itertools
from
dune.codegen.options
import
get_option
from
dune.codegen.options
import
get_option
from
dune.codegen.sumfact.tabulation
import
quadrature_points_per_direction
from
dune.codegen.ufl.modified_terminals
import
Restriction
from
dune.codegen.ufl.modified_terminals
import
Restriction
...
...
This diff is collapsed.
Click to expand it.
python/dune/codegen/sumfact/symbolic.py
+
11
−
3
View file @
901cdcf9
...
@@ -14,7 +14,7 @@ from dune.codegen.sumfact.permutation import (flop_cost,
...
@@ -14,7 +14,7 @@ from dune.codegen.sumfact.permutation import (flop_cost,
sumfact_cost_permutation_strategy
,
sumfact_cost_permutation_strategy
,
sumfact_quadrature_permutation_strategy
,
sumfact_quadrature_permutation_strategy
,
)
)
from
dune.codegen.sumfact.tabulation
import
BasisTabulationMatrixBase
,
BasisTabulationMatrixArray
from
dune.codegen.sumfact.tabulation
import
BasisTabulationMatrixBase
,
BasisTabulationMatrixArray
,
quadrature_points_per_direction
from
dune.codegen.loopy.target
import
dtype_floatingpoint
,
type_floatingpoint
from
dune.codegen.loopy.target
import
dtype_floatingpoint
,
type_floatingpoint
from
dune.codegen.loopy.vcl
import
ExplicitVCLCast
,
VCLLowerUpperLoad
from
dune.codegen.loopy.vcl
import
ExplicitVCLCast
,
VCLLowerUpperLoad
from
dune.codegen.tools
import
get_leaf
,
maybe_wrap_subscript
,
remove_duplicates
from
dune.codegen.tools
import
get_leaf
,
maybe_wrap_subscript
,
remove_duplicates
...
@@ -564,6 +564,7 @@ class SumfactKernel(SumfactKernelBase, ImmutableRecord, prim.Variable):
...
@@ -564,6 +564,7 @@ class SumfactKernel(SumfactKernelBase, ImmutableRecord, prim.Variable):
# Precompute and cache a number of keys
# Precompute and cache a number of keys
self
.
_cached_cache_key
=
None
self
.
_cached_cache_key
=
None
self
.
_cached_flop_cost
=
{}
#
#
# The methods/fields needed to get a well-formed pymbolic node
# The methods/fields needed to get a well-formed pymbolic node
...
@@ -824,7 +825,10 @@ class SumfactKernel(SumfactKernelBase, ImmutableRecord, prim.Variable):
...
@@ -824,7 +825,10 @@ class SumfactKernel(SumfactKernelBase, ImmutableRecord, prim.Variable):
def
operations
(
self
):
def
operations
(
self
):
"""
The total number of floating point operations for the kernel
"""
The total number of floating point operations for the kernel
to be carried out
"""
to be carried out
"""
return
flop_cost
(
self
.
matrix_sequence_cost_permuted
)
qp
=
quadrature_points_per_direction
()
if
qp
not
in
self
.
_cached_flop_cost
:
self
.
_cached_flop_cost
[
qp
]
=
flop_cost
(
self
.
matrix_sequence_cost_permuted
)
return
self
.
_cached_flop_cost
[
qp
]
# Extract the argument list and store it on the class. This needs to be done
# Extract the argument list and store it on the class. This needs to be done
...
@@ -873,6 +877,7 @@ class VectorizedSumfactKernel(SumfactKernelBase, ImmutableRecord, prim.Variable)
...
@@ -873,6 +877,7 @@ class VectorizedSumfactKernel(SumfactKernelBase, ImmutableRecord, prim.Variable)
# Precompute and cache a number of keys
# Precompute and cache a number of keys
self
.
_cached_cache_key
=
None
self
.
_cached_cache_key
=
None
self
.
_cached_flop_cost
=
{}
def
__getinitargs__
(
self
):
def
__getinitargs__
(
self
):
return
(
self
.
kernels
,
self
.
horizontal_width
,
self
.
vertical_width
,
self
.
buffer
,
self
.
insn_dep
)
return
(
self
.
kernels
,
self
.
horizontal_width
,
self
.
vertical_width
,
self
.
buffer
,
self
.
insn_dep
)
...
@@ -1135,4 +1140,7 @@ class VectorizedSumfactKernel(SumfactKernelBase, ImmutableRecord, prim.Variable)
...
@@ -1135,4 +1140,7 @@ class VectorizedSumfactKernel(SumfactKernelBase, ImmutableRecord, prim.Variable)
def
operations
(
self
):
def
operations
(
self
):
"""
The total number of floating point operations for the kernel
"""
The total number of floating point operations for the kernel
to be carried out
"""
to be carried out
"""
return
flop_cost
(
self
.
matrix_sequence_cost_permuted
)
qp
=
quadrature_points_per_direction
()
if
qp
not
in
self
.
_cached_flop_cost
:
self
.
_cached_flop_cost
[
qp
]
=
flop_cost
(
self
.
matrix_sequence_cost_permuted
)
return
self
.
_cached_flop_cost
[
qp
]
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