Skip to content
Snippets Groups Projects
Commit 326c9945 authored by René Heß's avatar René Heß
Browse files

Cleanup dry run dummy construction

parent 48b2991d
No related branches found
No related tags found
No related merge requests found
......@@ -282,49 +282,22 @@ def generate_accumulation_instruction(visitor, accterm, measure, subdomain_id):
(maybe_wrap_subscript(result, prim.Variable(iname)),),
)
# In the case of FastDGGridOperator we can write directly into the resiudal/jacobi
# In the fastdg case we accumulate directly in the last step of the SF!
if get_option('fastdg'):
# TODO: We accumulate the result directly in the last step
# of the sumfactorization. This part of code is only here
# because the pymbolic sumfactorization node seems to
# vanish if there is no assignement afterwards. In the dry
# run we force the node to be present by doing an
# assignement here. After the dry run everything works as
# expected.
#
# (Note: This code does the right thing if you do not use direct_output.)
# In the dry run we need an instruction with a
# sumfactorization node. We use this to decide on a
# vectorization strategy. This is just a dummy
# instruction, in the real run the accumulation is done
# directly in the sumfactorization.
if get_global_context_value("dry_run", False):
ft = get_global_context_value("form_type")
if ft == 'residual' or ft == 'jacobian_apply':
shape = (basis_functions_per_direction(),) * world_dimension()
ftags = ",".join(["f"]*len(shape))
globalarg(accum, dtype=np.float64, shape=shape, dim_tags=ftags)
assignee = prim.Subscript(prim.Variable(accum), tuple(prim.Variable(i) for i in inames))
expression = prim.Sum((assignee, result))
instruction(assignee=assignee,
expression=expression,
forced_iname_deps=frozenset(inames),
forced_iname_deps_is_final=True,
depends_on=insn_dep,
)
else:
assert ft == 'jacobian'
shape = (basis_functions_per_direction(),) * (world_dimension() * 2)
ftags = ",".join(["f"] * len(shape))
globalarg(accum, dtype=np.float64, shape=shape, dim_tags=ftags)
_test_inames = tuple(prim.Variable(i) for i in inames)
# TODO the next line should get its inames from elsewhere. This is *NOT* robust (but works right now)
_ansatz_inames = tuple(Variable(visitor.inames[i]) for i in range(world_dimension()))
assignee = prim.Subscript(prim.Variable(accum), _ansatz_inames + _test_inames)
expression = prim.Sum((assignee, result))
instruction(assignee=assignee,
expression=expression,
forced_iname_deps=frozenset(inames + visitor.inames),
forced_iname_deps_is_final=True,
depends_on=insn_dep,
)
dummy = "dummy"
globalarg(dummy, dtype=np.float64)
instruction(assignee = prim.Variable(dummy),
expression = result,
forced_iname_deps=frozenset(inames),
forced_iname_deps_is_final=True,
depends_on=insn_dep,
)
# Default: Generate accumulation instructions
else:
expr = Call(PDELabAccumulationFunction(accum, rank),
......
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