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
144d1c81
Commit
144d1c81
authored
8 years ago
by
Dominic Kempf
Browse files
Options
Downloads
Patches
Plain Diff
Include stage 3, with a lot of dummies etc.
parent
e73b2ca4
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/perftool/pdelab/localoperator.py
+5
-2
5 additions, 2 deletions
python/dune/perftool/pdelab/localoperator.py
python/dune/perftool/sumfact/sumfact.py
+50
-0
50 additions, 0 deletions
python/dune/perftool/sumfact/sumfact.py
with
55 additions
and
2 deletions
python/dune/perftool/pdelab/localoperator.py
+
5
−
2
View file @
144d1c81
...
...
@@ -2,12 +2,14 @@ from __future__ import absolute_import
from
os.path
import
splitext
from
dune.perftool.options
import
get_option
from
dune.perftool.generation
import
(
base_class
,
from
dune.perftool.generation
import
(
backend
,
base_class
,
class_basename
,
class_member
,
constructor_parameter
,
domain
,
dump_accumulate_timer
,
get_backend
,
global_context
,
iname
,
include_file
,
...
...
@@ -361,6 +363,7 @@ def grad_iname(index, dim):
return
name
@backend
(
interface
=
"
accum_insn
"
)
def
generate_accumulation_instruction
(
visitor
,
accterm
,
measure
,
subdomain_id
):
# First we do the tree traversal to get a pymbolic expression representing this expression
pymbolic_expr
=
visitor
(
accterm
.
term
)
...
...
@@ -467,7 +470,7 @@ def generate_kernel(integrals):
interface
=
PDELabInterface
()
from
dune.perftool.ufl.visitor
import
UFL2LoopyVisitor
visitor
=
UFL2LoopyVisitor
(
interface
,
measure
,
indexmap
)
ge
nerate_accumulation_instruction
(
visitor
,
term
,
measure
,
subdomain_id
)
ge
t_backend
(
interface
=
"
accum_insn
"
)
(
visitor
,
term
,
measure
,
subdomain_id
)
# Extract the information, which is needed to create a loopy kernel.
# First extracting it, might be useful to alter it before kernel generation.
...
...
This diff is collapsed.
Click to expand it.
python/dune/perftool/sumfact/sumfact.py
+
50
−
0
View file @
144d1c81
...
...
@@ -4,9 +4,12 @@ from dune.perftool.pdelab.argument import (name_coefficientcontainer,
from
dune.perftool.generation
import
(
backend
,
domain
,
get_counter
,
get_global_context_value
,
globalarg
,
iname
,
instruction
,
silenced_warning
,
temporary_variable
,
)
from
dune.perftool.loopy.buffer
import
(
get_buffer_temporary
,
initialize_buffer
,
...
...
@@ -82,6 +85,53 @@ def pymbolic_trialfunction(element, restriction, component):
return
Subscript
(
Variable
(
var
),
tuple
(
Variable
(
i
)
for
i
in
quadrature_inames
()))
@backend
(
interface
=
"
accum_insn
"
,
name
=
"
sumfact
"
)
def
generate_accumulation_instruction
(
visitor
,
accterm
,
measure
,
subdomain_id
):
pymbolic_expr
=
visitor
(
accterm
.
term
)
if
pymbolic_expr
==
0
:
return
# Get geometric dimension
formdata
=
get_global_context_value
(
'
formdata
'
)
dim
=
formdata
.
geometric_dimension
# Get a matrix that holds the result of the pymbolic_expr at all quadrature points
name
=
"
blubb
"
temporary_variable
(
name
,
shape
=
(
quadrature_points_per_direction
(),)
*
dim
,
managed
=
True
)
instruction
(
assignee
=
Subscript
(
Variable
(
name
),
tuple
(
Variable
(
i
)
for
i
in
quadrature_inames
())),
expression
=
pymbolic_expr
,
forced_iname_deps
=
frozenset
(
quadrature_inames
()),
forced_iname_deps_is_final
=
True
,
depends_on
=
frozenset
({
stage_insn
(
1
)}),
)
theta_transposed
=
name_theta_transposed
()
rows
=
basis_functions_per_direction
()
cols
=
quadrature_points_per_direction
()
a_matrix
=
AMatrix
(
theta_transposed
,
rows
,
cols
)
a_matrices
=
(
a_matrix
,
a_matrix
)
# Do stage 1
initialize_buffer
(
"
reffub
"
,
base_storage_size
=
product
(
max
(
mat
.
rows
,
mat
.
cols
)
for
mat
in
a_matrices
),
num
=
2
)
result
=
sum_factorization_kernel
(
a_matrices
,
"
reffub
"
,
2
)
from
dune.perftool.pdelab.spaces
import
LFSLocalIndex
# Now write all this into the correct residual
inames
=
tuple
(
sumfact_iname
(
mat
.
rows
,
'
accum
'
)
for
mat
in
a_matrices
)
globalarg
(
"
r
"
,
shape
=
(
basis_functions_per_direction
()
^
dim
,))
instruction
(
expression
=
Subscript
(
Variable
(
result
),
tuple
(
Variable
(
i
)
for
i
in
inames
)),
# assignee=Subscript(Variable("r"), (Call(LFSLocalIndex("lfs"), tuple(Variable(i) for i in inames)),)),
assignee
=
Subscript
(
Variable
(
"
r
"
),
(
0
,)),
forced_iname_deps
=
frozenset
(
inames
),
forced_iname_deps_is_final
=
True
,
depends_on
=
frozenset
({
stage_insn
(
3
)}),
)
# # Do stage 3 (for f=u => mass matrix)
# theta_transposed = name_theta_transposed()
# a_matrix_transposed = AMatrix(theta_transposed, cols, rows)
...
...
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