From 2f78b2598ab4cb5dd9a59ce82cc80c3bf53f9c7f Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Mon, 27 Aug 2018 19:28:03 -0500 Subject: [PATCH 1/4] Fix some deprecations in Helmholtz Dirichlet example --- examples/helmholtz-dirichlet.py | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/examples/helmholtz-dirichlet.py b/examples/helmholtz-dirichlet.py index 22f8fa8a..847e5c3f 100644 --- a/examples/helmholtz-dirichlet.py +++ b/examples/helmholtz-dirichlet.py @@ -96,8 +96,10 @@ def main(): bdry_op_sym = (-loc_sign*0.5*sigma_sym + sqrt_w*( - alpha*sym.S(kernel, inv_sqrt_w_sigma, k=sym.var("k")) - - sym.D(kernel, inv_sqrt_w_sigma, k=sym.var("k")) + alpha*sym.S(kernel, inv_sqrt_w_sigma, k=sym.var("k"), + qbx_forced_limit=+1) + - sym.D(kernel, inv_sqrt_w_sigma, k=sym.var("k"), + qbx_forced_limit="avg") )) # }}} -- GitLab From 5046b86e69046de9b5eb8c0db7128c12dc48a38d Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Mon, 27 Aug 2018 19:28:17 -0500 Subject: [PATCH 2/4] Remove futures support from execution runtime --- pytential/qbx/__init__.py | 4 ++-- pytential/symbolic/compiler.py | 41 +++++++++++++++------------------ pytential/symbolic/execution.py | 2 +- pytential/unregularized.py | 4 ++-- 4 files changed, 24 insertions(+), 27 deletions(-) diff --git a/pytential/qbx/__init__.py b/pytential/qbx/__init__.py index 869f9222..e1e9a321 100644 --- a/pytential/qbx/__init__.py +++ b/pytential/qbx/__init__.py @@ -780,7 +780,7 @@ class QBXLayerPotentialSource(LayerPotentialSourceBase): (o.name, all_potentials_on_every_tgt[o.kernel_index][tgt_slice])) - return result, [] + return result # }}} @@ -941,7 +941,7 @@ class QBXLayerPotentialSource(LayerPotentialSourceBase): result.append((o.name, output_for_each_kernel[o.kernel_index])) - return result, [] + return result # }}} diff --git a/pytential/symbolic/compiler.py b/pytential/symbolic/compiler.py index 17d23ebf..456044e7 100644 --- a/pytential/symbolic/compiler.py +++ b/pytential/symbolic/compiler.py @@ -315,7 +315,7 @@ class Code(object): return "\n".join(lines) - # {{{ dynamic scheduler (generates static schedules by self-observation) + # {{{ dynamic scheduler class NoInstructionAvailable(Exception): pass @@ -372,38 +372,35 @@ class Code(object): done_insns = set() while True: - insn = None discardable_vars = [] + insn = None - # pick the next insn - if insn is None: - try: - insn, discardable_vars = self.get_next_step( - frozenset(list(context.keys())), - frozenset(done_insns)) + try: + insn, discardable_vars = self.get_next_step( + frozenset(list(context.keys())), + frozenset(done_insns)) - except self.NoInstructionAvailable: - # no available instructions: we're done - break - else: - for name in discardable_vars: - del context[name] + except self.NoInstructionAvailable: + # no available instructions: we're done + break + else: + for name in discardable_vars: + del context[name] - done_insns.add(insn) - assignments, new_futures = ( - insn.get_exec_function(exec_mapper) - (exec_mapper.queue, insn, exec_mapper.bound_expr, - exec_mapper)) + done_insns.add(insn) + assignments = ( + insn.get_exec_function(exec_mapper) + (exec_mapper.queue, insn, exec_mapper.bound_expr, + exec_mapper)) - if insn is not None: + assignees = insn.get_assignees() for target, value in assignments: if pre_assign_check is not None: pre_assign_check(target, value) + assert target in assignees context[target] = value - assert not new_futures - if len(done_insns) < len(self.instructions): print("Unreachable instructions:") for insn in set(self.instructions) - done_insns: diff --git a/pytential/symbolic/execution.py b/pytential/symbolic/execution.py index f658a6aa..45840de2 100644 --- a/pytential/symbolic/execution.py +++ b/pytential/symbolic/execution.py @@ -173,7 +173,7 @@ class EvaluationMapper(EvaluationMapperBase): def exec_assign(self, queue, insn, bound_expr, evaluate): return [(name, evaluate(expr)) - for name, expr in zip(insn.names, insn.exprs)], [] + for name, expr in zip(insn.names, insn.exprs)] # {{{ functions diff --git a/pytential/unregularized.py b/pytential/unregularized.py index b0d9926a..e7fe1b3e 100644 --- a/pytential/unregularized.py +++ b/pytential/unregularized.py @@ -187,7 +187,7 @@ class UnregularizedLayerPotentialSource(LayerPotentialSourceBase): result.append((o.name, output_for_each_kernel[o.kernel_index])) - return result, [] + return result # {{{ fmm-based execution @@ -288,7 +288,7 @@ class UnregularizedLayerPotentialSource(LayerPotentialSourceBase): # }}} - return result, [] + return result # }}} -- GitLab From 5a33bfd74b5ef3daa6ad6b5df11162ea5a14cced Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Mon, 27 Aug 2018 20:53:31 -0500 Subject: [PATCH 3/4] Fix PointPotentialSource to also not return futures --- pytential/source.py | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/pytential/source.py b/pytential/source.py index 6420494e..a8d0cba5 100644 --- a/pytential/source.py +++ b/pytential/source.py @@ -134,7 +134,7 @@ class PointPotentialSource(PotentialSource): result.append((o.name, output_for_each_kernel[o.kernel_index])) - return result, [] + return result @memoize_method def weights_and_area_elements(self): @@ -268,3 +268,5 @@ class LayerPotentialSourceBase(PotentialSource): # }}} # }}} + +# vim: foldmethod=marker -- GitLab From ced67e4acf6986bba4248542b3e6d63a6b49f153 Mon Sep 17 00:00:00 2001 From: Andreas Kloeckner Date: Mon, 27 Aug 2018 23:56:01 -0500 Subject: [PATCH 4/4] Eliminate futures return in performance data collection path --- pytential/qbx/__init__.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pytential/qbx/__init__.py b/pytential/qbx/__init__.py index e1e9a321..18b356be 100644 --- a/pytential/qbx/__init__.py +++ b/pytential/qbx/__init__.py @@ -757,7 +757,7 @@ class QBXLayerPotentialSource(LayerPotentialSourceBase): if self.geometry_data_inspector is not None: perform_fmm = self.geometry_data_inspector(insn, bound_expr, geo_data) if not perform_fmm: - return [(o.name, 0) for o in insn.outputs], [] + return [(o.name, 0) for o in insn.outputs] # }}} -- GitLab