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
deb684d1
Commit
deb684d1
authored
6 years ago
by
Marcel Koch
Browse files
Options
Downloads
Patches
Plain Diff
only generate jacobian method if the computation is not matrix free
parent
467f2a3e
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/pdelab/localoperator.py
+31
-28
31 additions, 28 deletions
python/dune/perftool/pdelab/localoperator.py
with
31 additions
and
28 deletions
python/dune/perftool/pdelab/localoperator.py
+
31
−
28
View file @
deb684d1
...
...
@@ -826,35 +826,10 @@ def generate_jacobian_kernels(form, original_form):
jacform
=
offdiagonal_block_jacobian
(
jacform
)
operator_kernels
=
{}
with
global_context
(
form_type
=
"
jacobian
"
):
if
get_form_option
(
"
generate_jacobians
"
):
if
get_form_option
(
"
sumfact
"
):
was_sumfact
=
True
if
get_form_option
(
"
sumfact_regular_jacobians
"
):
set_form_option
(
"
sumfact
"
,
False
)
for
measure
in
set
(
i
.
integral_type
()
for
i
in
jacform
.
integrals
()):
logger
.
info
(
"
generate_jacobian_kernels: measure {}
"
.
format
(
measure
))
with
global_context
(
integral_type
=
measure
):
from
dune.perftool.pdelab.signatures
import
assembler_routine_name
with
global_context
(
kernel
=
assembler_routine_name
()):
kernel
=
[
k
for
k
in
get_backend
(
interface
=
"
generate_kernels_per_integral
"
)(
jacform
.
integrals_by_type
(
measure
))]
operator_kernels
[(
measure
,
'
jacobian
'
)]
=
kernel
# Generate dummy functions for those kernels, that vanished in the differentiation process
# We *could* solve this problem by using lambda_* terms but we do not really want that, so
# we use empty jacobian assembly methods instead
alpha_measures
=
set
(
i
.
integral_type
()
for
i
in
form
.
integrals
())
jacobian_measures
=
set
(
i
.
integral_type
()
for
i
in
jacform
.
integrals
())
for
it
in
alpha_measures
-
jacobian_measures
:
with
global_context
(
integral_type
=
it
):
from
dune.perftool.pdelab.signatures
import
assembly_routine_signature
operator_kernels
[(
it
,
'
jacobian
'
)]
=
[
LoopyKernelMethod
(
assembly_routine_signature
(),
kernel
=
None
)]
if
get_form_option
(
"
sumfact_regular_jacobians
"
):
if
was_sumfact
:
set_form_option
(
"
sumfact
"
,
True
)
# Jacobian apply methods for matrix-free computations
# Decide if the jacobian apply or jacobian method is needed
if
get_form_option
(
"
matrix_free
"
):
# Matrix-free computations need the jacobian apply method
# The apply vector has reserved index 1 so we directly use Coefficient class from ufl
from
ufl
import
Coefficient
apply_coefficient
=
Coefficient
(
form
.
coefficients
()[
0
].
ufl_element
(),
1
)
...
...
@@ -881,6 +856,34 @@ def generate_jacobian_kernels(form, original_form):
with
global_context
(
integral_type
=
it
):
from
dune.perftool.pdelab.signatures
import
assembly_routine_signature
operator_kernels
[(
it
,
'
jacobian_apply
'
)]
=
[
LoopyKernelMethod
(
assembly_routine_signature
(),
kernel
=
None
)]
else
:
# Non matrix-free computations need the jacobian method
with
global_context
(
form_type
=
"
jacobian
"
):
if
get_form_option
(
"
generate_jacobians
"
):
if
get_form_option
(
"
sumfact
"
):
was_sumfact
=
True
if
get_form_option
(
"
sumfact_regular_jacobians
"
):
set_form_option
(
"
sumfact
"
,
False
)
for
measure
in
set
(
i
.
integral_type
()
for
i
in
jacform
.
integrals
()):
logger
.
info
(
"
generate_jacobian_kernels: measure {}
"
.
format
(
measure
))
with
global_context
(
integral_type
=
measure
):
from
dune.perftool.pdelab.signatures
import
assembler_routine_name
with
global_context
(
kernel
=
assembler_routine_name
()):
kernel
=
[
k
for
k
in
get_backend
(
interface
=
"
generate_kernels_per_integral
"
)(
jacform
.
integrals_by_type
(
measure
))]
operator_kernels
[(
measure
,
'
jacobian
'
)]
=
kernel
# Generate dummy functions for those kernels, that vanished in the differentiation process
# We *could* solve this problem by using lambda_* terms but we do not really want that, so
# we use empty jacobian assembly methods instead
alpha_measures
=
set
(
i
.
integral_type
()
for
i
in
form
.
integrals
())
jacobian_measures
=
set
(
i
.
integral_type
()
for
i
in
jacform
.
integrals
())
for
it
in
alpha_measures
-
jacobian_measures
:
with
global_context
(
integral_type
=
it
):
from
dune.perftool.pdelab.signatures
import
assembly_routine_signature
operator_kernels
[(
it
,
'
jacobian
'
)]
=
[
LoopyKernelMethod
(
assembly_routine_signature
(),
kernel
=
None
)]
if
get_form_option
(
"
sumfact_regular_jacobians
"
):
if
was_sumfact
:
set_form_option
(
"
sumfact
"
,
True
)
return
operator_kernels
...
...
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