From d1cd793ce5a9dae8f5014273032f1e372c7aad79 Mon Sep 17 00:00:00 2001 From: Dominic Kempf <dominic.kempf@iwr.uni-heidelberg.de> Date: Tue, 24 Jan 2017 13:42:28 +0100 Subject: [PATCH] Some fixups --- python/dune/perftool/generation/loopy.py | 1 - python/dune/perftool/pdelab/localoperator.py | 19 ++++++++++++------- 2 files changed, 12 insertions(+), 8 deletions(-) diff --git a/python/dune/perftool/generation/loopy.py b/python/dune/perftool/generation/loopy.py index b618f0bc..be835b7a 100644 --- a/python/dune/perftool/generation/loopy.py +++ b/python/dune/perftool/generation/loopy.py @@ -212,5 +212,4 @@ def subst_rule(expr, rule): def set_subst_rule(name, expr, visitor): rule = lp.SubstitutionRule(name, (), visitor(expr)) subst_rule._memoize_cache = {k: v for k, v in subst_rule._memoize_cache.items() if v is not None} - print [type(v) for v in subst_rule._memoize_cache.values()] return subst_rule(expr, rule) diff --git a/python/dune/perftool/pdelab/localoperator.py b/python/dune/perftool/pdelab/localoperator.py index ecd2f787..9cb31a24 100644 --- a/python/dune/perftool/pdelab/localoperator.py +++ b/python/dune/perftool/pdelab/localoperator.py @@ -423,10 +423,12 @@ def visit_integrals(integrals): # Ensure CSE on detjac * quadrature weight domain = term.argument.argexpr.ufl_domain() - if term.argument.restriction: - set_subst_rule("integration_factor", uc.FacetJacobianDeterminant(domain)*uc.QuadratureWeight(domain), visitor) + if measure == "cell": + set_subst_rule("integration_factor_cell1", uc.QuadratureWeight(domain)*uc.Abs(uc.JacobianDeterminant(domain)), visitor) + set_subst_rule("integration_factor_cell2", uc.Abs(uc.JacobianDeterminant(domain))*uc.QuadratureWeight(domain), visitor) else: - set_subst_rule("integration_factor", uc.QuadratureWeight(domain)*uc.Abs(uc.JacobianDeterminant(domain)), visitor) + set_subst_rule("integration_factor_facet1", uc.FacetJacobianDeterminant(domain)*uc.QuadratureWeight(domain), visitor) + set_subst_rule("integration_factor_facet2", uc.QuadratureWeight(domain)*uc.FacetJacobianDeterminant(domain), visitor) get_backend(interface="accum_insn")(visitor, term, measure, subdomain_id) @@ -495,8 +497,6 @@ def extract_kernel_from_cache(tag, wrap_in_cgen=True): silenced_warnings=silenced, name=name, ) - from loopy import make_reduction_inames_unique - #kernel = make_reduction_inames_unique(kernel) # Apply the transformations that were gathered during tree traversals for trafo in transformations: @@ -504,8 +504,13 @@ def extract_kernel_from_cache(tag, wrap_in_cgen=True): # Precompute all the substrules for sr in substrules: - print sr.name - kernel = lp.precompute(kernel, sr.name) + try: + kernel = lp.precompute(kernel, sr.name) + except: + pass + + from loopy import make_reduction_inames_unique + kernel = make_reduction_inames_unique(kernel) from dune.perftool.loopy import heuristic_duplication kernel = heuristic_duplication(kernel) -- GitLab