diff --git a/python/dune/perftool/pdelab/argument.py b/python/dune/perftool/pdelab/argument.py index 0e81542cd1259e42c7823159187a03500dc72dcf..76639a230edfdb5f1b3e613a678fa31bb8806a9c 100644 --- a/python/dune/perftool/pdelab/argument.py +++ b/python/dune/perftool/pdelab/argument.py @@ -103,7 +103,7 @@ def name_trialfunction(element, restriction, component): rawname = "u" + "_".join(str(c) for c in component) name = restricted_name(rawname, restriction) container = name_coefficientcontainer(restriction) - evaluate_coefficient(element, name, container, restriction, component) + get_backend("eval_coefficient")(element, name, container, restriction, component) return name @@ -119,7 +119,7 @@ def name_apply_function(element, restriction, component): rawname = "z_func" + "_".join(str(c) for c in component) name = restricted_name(rawname, restriction) container = name_applycontainer(restriction) - evaluate_coefficient(element, name, container, restriction, component) + get_backend("eval_coefficient")(element, name, container, restriction, component) return name diff --git a/python/dune/perftool/pdelab/basis.py b/python/dune/perftool/pdelab/basis.py index 09ecddb0e0c6cdd4908bcd7c77b7b1f45b44004e..ad587091096fff8a51debf2002332da2412890bf 100644 --- a/python/dune/perftool/pdelab/basis.py +++ b/python/dune/perftool/pdelab/basis.py @@ -1,6 +1,7 @@ """ Generators for basis evaluations """ -from dune.perftool.generation import (cached, +from dune.perftool.generation import (backend, + cached, class_member, generator_factory, include_file, @@ -123,6 +124,7 @@ def shape_as_pymbolic(shape): return tuple(_shape_as_pymbolic(s) for s in shape) +@backend(interface="eval_coefficient") @cached def evaluate_coefficient(element, name, container, restriction, component): from ufl.functionview import select_subelement diff --git a/python/dune/perftool/pdelab/localoperator.py b/python/dune/perftool/pdelab/localoperator.py index 7a299ab70e4da7ccc339f9e5ff39e346722ef040..f456b8d8640fa9e50eb1a30280a77850f95bed1b 100644 --- a/python/dune/perftool/pdelab/localoperator.py +++ b/python/dune/perftool/pdelab/localoperator.py @@ -403,11 +403,13 @@ def generate_accumulation_instruction(visitor, accterm, measure, subdomain_id): (ansatz_lfs.get_args() + test_lfs.get_args() + (pymbolic_expr,)) ) - from dune.perftool.generation import instruction - from dune.perftool.pdelab.quadrature import quadrature_iname + from dune.perftool.generation import get_backend, instruction + from dune.perftool.options import option_switch + quad_inames = get_backend(interface="quadinames", selector=option_switch("sumfac"))() + instruction(assignees=(), 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, predicates=predicates ) diff --git a/python/dune/perftool/pdelab/quadrature.py b/python/dune/perftool/pdelab/quadrature.py index b778de54c01aeb7160a0af100caff893d2c1c85d..b50c8248512ce363cb35b735c199698102ddf110 100644 --- a/python/dune/perftool/pdelab/quadrature.py +++ b/python/dune/perftool/pdelab/quadrature.py @@ -17,6 +17,11 @@ def quadrature_iname(): return "q" +@backend(interface="quadinames") +def quadrature_inames(): + return frozenset({quadrature_iname()}) + + def quadrature_preamble(code, **kw): return instruction(inames=quadrature_iname(), code=code, **kw) diff --git a/python/dune/perftool/sumfact/sumfact.py b/python/dune/perftool/sumfact/sumfact.py index a7ee0a042c1fab3ac5b3662877c5a4b3a841f8a4..5a3e364d2705281f8184ceb1ab4b013956bba50a 100644 --- a/python/dune/perftool/sumfact/sumfact.py +++ b/python/dune/perftool/sumfact/sumfact.py @@ -1,5 +1,6 @@ from dune.perftool.pdelab.argument import pymbolic_coefficient -from dune.perftool.generation import (domain, +from dune.perftool.generation import (backend, + domain, get_counter, iname, instruction, @@ -60,7 +61,8 @@ def setup_theta(element, container, restriction, component, a_matrices): # 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() rows = quadrature_points_per_direction() cols = basis_functions_per_direction()