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
1b02ba97
Commit
1b02ba97
authored
8 years ago
by
René Heß
Browse files
Options
Downloads
Patches
Plain Diff
Fix another bug in jacobian splitting
parent
4c41c5a7
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/sumfact/sumfact.py
+12
-7
12 additions, 7 deletions
python/dune/perftool/sumfact/sumfact.py
python/dune/perftool/ufl/extract_accumulation_terms.py
+7
-20
7 additions, 20 deletions
python/dune/perftool/ufl/extract_accumulation_terms.py
with
19 additions
and
27 deletions
python/dune/perftool/sumfact/sumfact.py
+
12
−
7
View file @
1b02ba97
...
...
@@ -159,8 +159,9 @@ def generate_accumulation_instruction(visitor, accterm, measure, subdomain_id):
index
=
()
vectag
=
frozenset
()
base_storage_size
=
product
(
max
(
mat
.
rows
,
mat
.
cols
)
for
mat
in
a_matrices
)
temp
=
initialize_buffer
(
buf
,
base_storage_size
=
product
(
max
(
mat
.
rows
,
mat
.
cols
)
for
mat
in
a_matrices
)
,
base_storage_size
=
base_storage_size
,
num
=
2
).
get_temporary
(
shape
=
shape
,
dim_tags
=
dim_tags
,
...
...
@@ -168,9 +169,11 @@ def generate_accumulation_instruction(visitor, accterm, measure, subdomain_id):
)
# Those input fields, that are padded need to be set to zero
# in order to do a horizontal_add lateron
# in order to do a horizontal_add later
on
for
pad
in
padding
:
instruction
(
assignee
=
prim
.
Subscript
(
prim
.
Variable
(
temp
),
tuple
(
Variable
(
i
)
for
i
in
quadrature_inames
())
+
(
pad
,)),
assignee
=
prim
.
Subscript
(
prim
.
Variable
(
temp
),
tuple
(
Variable
(
i
)
for
i
in
quadrature_inames
())
+
(
pad
,))
instruction
(
assignee
=
assignee
,
expression
=
0
,
forced_iname_deps
=
frozenset
(
quadrature_inames
()
+
visitor
.
inames
),
forced_iname_deps_is_final
=
True
,
...
...
@@ -316,13 +319,15 @@ def generate_accumulation_instruction(visitor, accterm, measure, subdomain_id):
depends_on
=
insn_dep
,
)
# Mark the transformation that moves the quadrature loop inside the trialfunction loops for application
# Mark the transformation that moves the quadrature loop
# inside the trialfunction loops for application
transform
(
nest_quadrature_loops
,
visitor
.
inames
)
return
insn_dep
# Extract the restrictions on argument-1:
jac_restrictions
=
frozenset
(
tuple
(
ma
.
restriction
for
ma
in
extract_modified_arguments
(
accterm
.
term
,
argnumber
=
1
)))
jac_restrictions
=
frozenset
(
tuple
(
ma
.
restriction
for
ma
in
extract_modified_arguments
(
accterm
.
term
,
argnumber
=
1
,
do_index
=
True
)))
if
not
jac_restrictions
:
jac_restrictions
=
frozenset
({
0
})
...
...
@@ -461,9 +466,9 @@ def sum_factorization_kernel(a_matrices,
It can make sense to permute the order of directions. If you have
a small m_l (e.g. stage 1 on faces) it is better to do direction l
first. This can be done
permuting
:
first. This can be done
by
:
-
T
he order of the A matrices.
-
Permuting t
he order of the A matrices.
- Permuting the input tensor.
- Permuting the output tensor (this assures that the directions of
the output tensor are again ordered from 0 to d-1).
...
...
This diff is collapsed.
Click to expand it.
python/dune/perftool/ufl/extract_accumulation_terms.py
+
7
−
20
View file @
1b02ba97
...
...
@@ -132,31 +132,18 @@ def split_into_accumulation_terms(expr):
# 5) Further split according to trial function in jacobian terms
if
all_jacobian_args
:
jac_args
=
extract_modified_arguments
(
replace_expr
,
argnumber
=
1
,
do_index
=
False
)
for
jac_arg
in
jac_args
:
# 5.1) Cut the expression to this ansatz function
indexed_jac_args
=
extract_modified_arguments
(
replace_expr
,
argnumber
=
1
,
do_index
=
True
)
for
restriction
in
(
Restriction
.
NONE
,
Restriction
.
POSITIVE
,
Restriction
.
NEGATIVE
):
replacement
=
{
ma
.
expr
:
Zero
(
shape
=
ma
.
expr
.
ufl_shape
,
free_indices
=
ma
.
expr
.
ufl_free_indices
,
index_dimensions
=
ma
.
expr
.
ufl_index_dimensions
)
for
ma
in
jac_args
}
replacement
[
jac_arg
.
expr
]
=
jac_arg
.
expr
jac_expr
=
replace_expression
(
replace_expr
,
replacemap
=
replacement
)
# 5.2) Propagate indexed zeros to simplify expression
jac_expr
=
zero_propagation
(
jac_expr
)
if
ma
.
restriction
!=
restriction
else
ma
.
expr
for
ma
in
indexed_jac_args
}
indexed_jac_args
=
extract_modified_arguments
(
jac_expr
,
argnumber
=
1
,
do_index
=
True
)
for
restriction
in
(
Restriction
.
NONE
,
Restriction
.
POSITIVE
,
Restriction
.
NEGATIVE
):
replacement
=
{
ma
.
expr
:
Zero
(
shape
=
ma
.
expr
.
ufl_shape
,
free_indices
=
ma
.
expr
.
ufl_free_indices
,
index_dimensions
=
ma
.
expr
.
ufl_index_dimensions
)
if
ma
.
restriction
!=
restriction
else
ma
.
expr
for
ma
in
indexed_jac_args
}
jac_accum_expr
=
replace_expression
(
jac_expr
,
replacemap
=
replacement
)
jac_expr
=
replace_expression
(
replace_expr
,
replacemap
=
replacement
)
if
not
isinstance
(
jac_expr
,
Zero
):
ret
.
append
(
AccumulationTerm
(
jac_
accum_
expr
,
test_arg
,
indexmap
,
newi
))
if
not
isinstance
(
jac_expr
,
Zero
):
ret
.
append
(
AccumulationTerm
(
jac_expr
,
test_arg
,
indexmap
,
newi
))
else
:
if
not
isinstance
(
replace_expr
,
Zero
):
ret
.
append
(
AccumulationTerm
(
replace_expr
,
test_arg
,
indexmap
,
newi
))
...
...
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