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
ee63935c
Commit
ee63935c
authored
8 years ago
by
Dominic Kempf
Browse files
Options
Downloads
Patches
Plain Diff
Overhaul of quadrature and range based for loop generator
parent
37b01732
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/loopy/target.py
+42
-0
42 additions, 0 deletions
python/dune/perftool/loopy/target.py
python/dune/perftool/pdelab/quadrature.py
+37
-12
37 additions, 12 deletions
python/dune/perftool/pdelab/quadrature.py
with
79 additions
and
12 deletions
python/dune/perftool/loopy/target.py
+
42
−
0
View file @
ee63935c
...
@@ -67,3 +67,45 @@ class DuneTarget(TargetBase):
...
@@ -67,3 +67,45 @@ class DuneTarget(TargetBase):
body
.
append
(
gen_code
.
ast
)
body
.
append
(
gen_code
.
ast
)
return
str
(
body
),
gen_code
.
implemented_domains
return
str
(
body
),
gen_code
.
implemented_domains
def
get_value_arg_decl
(
self
,
name
,
shape
,
dtype
,
is_written
):
assert
shape
==
()
return
"
blubb
"
def
get_global_arg_decl
(
self
,
name
,
shape
,
dtype
,
is_written
):
return
"
blubb
"
def
emit_sequential_loop
(
self
,
codegen_state
,
iname
,
iname_dtype
,
static_lbound
,
static_ubound
,
inner
):
from
loopy.codegen
import
wrap_in
# Some of our loops are special as they use PDELab specific concepts.
# Fortunately those loops are tied to specific inames.
from
dune.perftool.pdelab.quadrature
import
quadrature_iname
if
iname
==
quadrature_iname
():
from
cgen
import
CustomLoop
from
dune.perftool.pdelab.quadrature
import
quadrature_loop_statement
loop_stmt
=
quadrature_loop_statement
()
return
wrap_in
(
CustomLoop
,
"
for({})
"
.
format
(
loop_stmt
),
inner
)
# From here on it is the default implementation taken from loopys CTarget.
ecm
=
codegen_state
.
expression_to_code_mapper
from
loopy.symbolic
import
aff_to_expr
from
pymbolic.mapper.stringifier
import
PREC_NONE
from
cgen
import
For
return
wrap_in
(
For
,
"
%s %s = %s
"
%
(
self
.
dtype_to_typename
(
iname_dtype
),
iname
,
ecm
(
aff_to_expr
(
static_lbound
),
PREC_NONE
,
"
i
"
)),
"
%s <= %s
"
%
(
iname
,
ecm
(
aff_to_expr
(
static_ubound
),
PREC_NONE
,
"
i
"
)),
"
++%s
"
%
iname
,
inner
)
This diff is collapsed.
Click to expand it.
python/dune/perftool/pdelab/quadrature.py
+
37
−
12
View file @
ee63935c
...
@@ -18,25 +18,31 @@ def quadrature_preamble(code, **kw):
...
@@ -18,25 +18,31 @@ def quadrature_preamble(code, **kw):
@symbol
@symbol
def
name_quadrature_
rule
():
def
name_quadrature_
point
():
return
"
rule
"
return
"
qp
"
@symbol
@symbol
def
name_quadrature_point
():
def
name_quadrature_position
():
rule
=
name_quadrature_rule
()
qp
=
name_quadrature_point
()
return
"
{}.position()
"
.
format
(
rule
)
return
"
{}.position()
"
.
format
(
qp
)
@symbol
def
name_quadrature_weight
():
qp
=
name_quadrature_point
()
return
"
{}.weight()
"
.
format
(
qp
)
def
define_quadrature_factor
(
fac
):
def
define_quadrature_factor
(
fac
):
rule
=
name_quadrature_
rule
()
weight
=
name_quadrature_
weight
()
geo
=
name_geometry
()
geo
=
name_geometry
()
q
p
=
name_quadrature_po
int
()
p
os
=
name_quadrature_po
sition
()
code
=
"
{} = {}
->weight()
*{}.integrationElement({});
"
.
format
(
fac
,
code
=
"
{} = {}*{}.integrationElement({});
"
.
format
(
fac
,
rule
,
weight
,
geo
,
geo
,
qp
,
pos
,
)
)
return
quadrature_preamble
(
code
,
assignees
=
fac
)
return
quadrature_preamble
(
code
,
assignees
=
fac
)
...
@@ -45,3 +51,22 @@ def name_factor():
...
@@ -45,3 +51,22 @@ def name_factor():
temporary_variable
(
"
fac
"
,
shape
=
())
temporary_variable
(
"
fac
"
,
shape
=
())
define_quadrature_factor
(
"
fac
"
)
define_quadrature_factor
(
"
fac
"
)
return
"
fac
"
return
"
fac
"
@symbol
def
name_order
():
# TODO how to determine integration order in a generic fashion here?
# Or maybe just read it from the ini file? Or define some mapping from the
# finite elements?
return
"
2
"
@cached
def
quadrature_loop_statement
():
qp
=
name_quadrature_point
()
geo
=
name_geometry
()
order
=
name_order
()
return
"
const auto& {} : quadratureRule({}, {})
"
.
format
(
qp
,
geo
,
order
,
)
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