Skip to content
Snippets Groups Projects
Commit 4aab42a1 authored by Dominic Kempf's avatar Dominic Kempf
Browse files

Start introducing backend calls

parent ff40bed1
No related branches found
No related tags found
No related merge requests found
...@@ -103,7 +103,7 @@ def name_trialfunction(element, restriction, component): ...@@ -103,7 +103,7 @@ def name_trialfunction(element, restriction, component):
rawname = "u" + "_".join(str(c) for c in component) rawname = "u" + "_".join(str(c) for c in component)
name = restricted_name(rawname, restriction) name = restricted_name(rawname, restriction)
container = name_coefficientcontainer(restriction) container = name_coefficientcontainer(restriction)
evaluate_coefficient(element, name, container, restriction, component) get_backend("eval_coefficient")(element, name, container, restriction, component)
return name return name
...@@ -119,7 +119,7 @@ def name_apply_function(element, restriction, component): ...@@ -119,7 +119,7 @@ def name_apply_function(element, restriction, component):
rawname = "z_func" + "_".join(str(c) for c in component) rawname = "z_func" + "_".join(str(c) for c in component)
name = restricted_name(rawname, restriction) name = restricted_name(rawname, restriction)
container = name_applycontainer(restriction) container = name_applycontainer(restriction)
evaluate_coefficient(element, name, container, restriction, component) get_backend("eval_coefficient")(element, name, container, restriction, component)
return name return name
......
""" Generators for basis evaluations """ """ Generators for basis evaluations """
from dune.perftool.generation import (cached, from dune.perftool.generation import (backend,
cached,
class_member, class_member,
generator_factory, generator_factory,
include_file, include_file,
...@@ -123,6 +124,7 @@ def shape_as_pymbolic(shape): ...@@ -123,6 +124,7 @@ def shape_as_pymbolic(shape):
return tuple(_shape_as_pymbolic(s) for s in shape) return tuple(_shape_as_pymbolic(s) for s in shape)
@backend(interface="eval_coefficient")
@cached @cached
def evaluate_coefficient(element, name, container, restriction, component): def evaluate_coefficient(element, name, container, restriction, component):
from ufl.functionview import select_subelement from ufl.functionview import select_subelement
......
...@@ -403,11 +403,13 @@ def generate_accumulation_instruction(visitor, accterm, measure, subdomain_id): ...@@ -403,11 +403,13 @@ def generate_accumulation_instruction(visitor, accterm, measure, subdomain_id):
(ansatz_lfs.get_args() + test_lfs.get_args() + (pymbolic_expr,)) (ansatz_lfs.get_args() + test_lfs.get_args() + (pymbolic_expr,))
) )
from dune.perftool.generation import instruction from dune.perftool.generation import get_backend, instruction
from dune.perftool.pdelab.quadrature import quadrature_iname from dune.perftool.options import option_switch
quad_inames = get_backend(interface="quadinames", selector=option_switch("sumfac"))()
instruction(assignees=(), instruction(assignees=(),
expression=expr, expression=expr,
forced_iname_deps=additional_inames.union(frozenset(visitor.inames).union(frozenset({quadrature_iname()}))), forced_iname_deps=additional_inames.union(frozenset(visitor.inames).union(quad_inames)),
forced_iname_deps_is_final=True, forced_iname_deps_is_final=True,
predicates=predicates predicates=predicates
) )
......
...@@ -17,6 +17,11 @@ def quadrature_iname(): ...@@ -17,6 +17,11 @@ def quadrature_iname():
return "q" return "q"
@backend(interface="quadinames")
def quadrature_inames():
return frozenset({quadrature_iname()})
def quadrature_preamble(code, **kw): def quadrature_preamble(code, **kw):
return instruction(inames=quadrature_iname(), code=code, **kw) return instruction(inames=quadrature_iname(), code=code, **kw)
......
from dune.perftool.pdelab.argument import pymbolic_coefficient from dune.perftool.pdelab.argument import pymbolic_coefficient
from dune.perftool.generation import (domain, from dune.perftool.generation import (backend,
domain,
get_counter, get_counter,
iname, iname,
instruction, instruction,
...@@ -60,7 +61,8 @@ def setup_theta(element, container, restriction, component, a_matrices): ...@@ -60,7 +61,8 @@ def setup_theta(element, container, restriction, component, a_matrices):
# TODO this code is WIP and mainly used for experiments. # TODO this code is WIP and mainly used for experiments.
def start_sumfactorization(element, container, restriction, component): @backend(interface="eval_coefficient", name="sumfact")
def start_sumfactorization(element, name, container, restriction, component):
theta = name_theta() theta = name_theta()
rows = quadrature_points_per_direction() rows = quadrature_points_per_direction()
cols = basis_functions_per_direction() cols = basis_functions_per_direction()
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment