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

Fix another occurence of direct cache usage

parent 9772dbff
No related branches found
No related tags found
No related merge requests found
...@@ -13,6 +13,7 @@ from dune.codegen.generation import (backend, ...@@ -13,6 +13,7 @@ from dune.codegen.generation import (backend,
get_counted_variable, get_counted_variable,
get_global_context_value, get_global_context_value,
kernel_cached, kernel_cached,
retrieve_cache_items,
) )
from dune.codegen.pdelab.restriction import (Restriction, from dune.codegen.pdelab.restriction import (Restriction,
restricted_name, restricted_name,
...@@ -151,7 +152,7 @@ class PrimitiveApproximateOpcounter(FlopCounter): ...@@ -151,7 +152,7 @@ class PrimitiveApproximateOpcounter(FlopCounter):
raise NotImplementedError("The class {} should implement a symbolic flopcounter.".format(type(expr))) raise NotImplementedError("The class {} should implement a symbolic flopcounter.".format(type(expr)))
@kernel_cached @generator_factory(item_tags=("opcounts",), context_tags="kernel")
def store_operation_count(expr, count): def store_operation_count(expr, count):
return count return count
...@@ -183,7 +184,7 @@ def quadrature_penalized_strategy_cost(strat_tuple): ...@@ -183,7 +184,7 @@ def quadrature_penalized_strategy_cost(strat_tuple):
# Determine the number of floating point operations per quadrature point. # Determine the number of floating point operations per quadrature point.
# This flop counting is a very crude approximation, but that is totally sufficient here. # This flop counting is a very crude approximation, but that is totally sufficient here.
ops_per_qp = sum(i.value for i in store_operation_count._memoize_cache.values()) ops_per_qp = sum(i for i in retrieve_cache_items("opcounts"))
# Do the actual scaling. # Do the actual scaling.
return float((sf_flops + ops_per_qp * num_qp_new) / (sf_flops + ops_per_qp * num_qp_old)) * cost return float((sf_flops + ops_per_qp * num_qp_new) / (sf_flops + ops_per_qp * num_qp_old)) * cost
......
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