From a91a343c85bbb097c8a94442b9b02b6476106203 Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Mon, 6 Apr 2020 10:43:29 -0500 Subject: [PATCH] BoundOperator: Fix bitrot when passed debug_flags --- grudge/execution.py | 5 +++-- grudge/symbolic/compiler.py | 9 +++++++-- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/grudge/execution.py b/grudge/execution.py index 4fe592dd..948be131 100644 --- a/grudge/execution.py +++ b/grudge/execution.py @@ -628,13 +628,14 @@ def bind(discr, sym_operator, post_bind_mapper=lambda x: x, allocator=allocator) if "dump_op_code" in debug_flags: - from grudge.tools import open_unique_debug_file + from pytools.debug import open_unique_debug_file outf, _ = open_unique_debug_file("op-code", ".txt") with outf: outf.write(str(bound_op)) if "dump_dataflow_graph" in debug_flags: - bound_op.code.dump_dataflow_graph() + discr_code.dump_dataflow_graph("discr") + eval_code.dump_dataflow_graph("eval") return bound_op diff --git a/grudge/symbolic/compiler.py b/grudge/symbolic/compiler.py index e425fa49..51eb5202 100644 --- a/grudge/symbolic/compiler.py +++ b/grudge/symbolic/compiler.py @@ -385,10 +385,15 @@ class Code(object): # self.last_schedule = None self.static_schedule_attempts = 5 - def dump_dataflow_graph(self): + def dump_dataflow_graph(self, name=None): from pytools.debug import open_unique_debug_file - outf, _ = open_unique_debug_file("dataflow", ".dot") + if name is None: + stem = "dataflow" + else: + stem = "dataflow-%s" % name + + outf, _ = open_unique_debug_file(stem, ".dot") with outf: outf.write(dot_dataflow_graph(self, max_node_label_length=None)) -- GitLab