From 47b6fc8db400b0947ef4cab908b3b94866998fbb Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Mon, 15 Apr 2019 17:45:38 -0500 Subject: [PATCH 1/2] Update names of dagrt statement classes, bump to 2019.1 --- examples/imex/imex.py | 4 ++-- examples/implicit_euler/implicit_euler.py | 6 +++--- leap/__init__.py | 2 +- leap/implicit.py | 14 +++++++------- leap/multistep/__init__.py | 2 +- leap/multistep/multirate/__init__.py | 4 ++-- leap/rk/__init__.py | 2 +- leap/step_matrix.py | 4 ++-- leap/transform.py | 4 ++-- leap/version.py | 2 +- requirements.txt | 2 +- setup.py | 2 +- test/test_imex.py | 8 ++++---- 13 files changed, 28 insertions(+), 28 deletions(-) diff --git a/examples/imex/imex.py b/examples/imex/imex.py index 16ca230..62d540d 100644 --- a/examples/imex/imex.py +++ b/examples/imex/imex.py @@ -92,8 +92,8 @@ def run(): # Generate the code for the method. code = mgen.generate() - from leap.implicit import replace_AssignSolved - code = replace_AssignSolved(code, {"solve": solver_hook}) + from leap.implicit import replace_AssignImplicit + code = replace_AssignImplicit(code, {"solve": solver_hook}) IMEXIntegrator = PythonCodeGenerator("IMEXIntegrator").get_class(code) # Set up the problem and run the method. diff --git a/examples/implicit_euler/implicit_euler.py b/examples/implicit_euler/implicit_euler.py index 405b382..d99e01b 100644 --- a/examples/implicit_euler/implicit_euler.py +++ b/examples/implicit_euler/implicit_euler.py @@ -57,9 +57,9 @@ class ImplicitEulerMethod(Method): dep_on=cb.phase_dependencies, statements=cb.statements) - from leap.implicit import replace_AssignSolved + from leap.implicit import replace_AssignImplicit - return replace_AssignSolved(code, {self.SOLVER_EXPRESSION_ID: solver_hook}) + return replace_AssignImplicit(code, {self.SOLVER_EXPRESSION_ID: solver_hook}) def _make_primary(self, builder): """Add code to drive the primary stage.""" @@ -74,7 +74,7 @@ class ImplicitEulerMethod(Method): self.component_id: solve_component }) - builder.assign_solved_1(self.state, solve_component, + builder.assign_implicit_1(self.state, solve_component, solve_expression, self.state, self.SOLVER_EXPRESSION_ID) diff --git a/leap/__init__.py b/leap/__init__.py index 7da7a74..cc43469 100644 --- a/leap/__init__.py +++ b/leap/__init__.py @@ -67,7 +67,7 @@ class Method(object): def implicit_expression(self, expression_tag=None): """ - Return a template that expressions in `class`:AssignSolved + Return a template that expressions in `class`:AssignImplicit instances will follow. :arg expression_tag: A name for the expression, if multiple diff --git a/leap/implicit.py b/leap/implicit.py index 02e98f1..17beeff 100644 --- a/leap/implicit.py +++ b/leap/implicit.py @@ -29,7 +29,7 @@ THE SOFTWARE. import six -def replace_AssignSolved(dag, solver_hooks): +def replace_AssignImplicit(dag, solver_hooks): """ :arg dag: The :class:`DAGCode` instance :arg solver_hooks: Either a callable, or a map from solver names to @@ -40,9 +40,9 @@ def replace_AssignSolved(dag, solver_hooks): def solver_hook(expr, var, id, **kwargs): where: - * *expr* is the expression passed to the AssignSolved instruction + * *expr* is the expression passed to the AssignImplicit instruction * *var* is the name of the unknown - * *id* is the *solver_id* field of the AssignSolved instruction + * *id* is the *solver_id* field of the AssignImplicit instruction * any other arguments are passed in *kwargs*. """ @@ -53,20 +53,20 @@ def replace_AssignSolved(dag, solver_hooks): new_statements = [] - from dagrt.language import AssignExpression, AssignSolved + from dagrt.language import Assign, AssignImplicit new_phases = {} for phase_name, phase in dag.phases.items(): for stmt in phase.statements: - if not isinstance(stmt, AssignSolved): + if not isinstance(stmt, AssignImplicit): new_statements.append(stmt) continue if len(stmt.assignees) != 1: from dagrt.utils import TODO - raise TODO("Implement lowering for AssignSolved statements " + raise TODO("Implement lowering for AssignImplicit statements " "returning multiple values.") expression = stmt.expressions[0] @@ -79,7 +79,7 @@ def replace_AssignSolved(dag, solver_hooks): solver_id, **other_params) new_statements.append( - AssignExpression( + Assign( assignee=stmt.assignees[0], assignee_subscript=(), expression=solver_expression, diff --git a/leap/multistep/__init__.py b/leap/multistep/__init__.py index 3eff65b..2187c46 100644 --- a/leap/multistep/__init__.py +++ b/leap/multistep/__init__.py @@ -343,7 +343,7 @@ class AdamsBashforthMethod(Method): time_id='', time=self.t) cb_bootstrap(self.step, self.step + 1) with cb_bootstrap.if_(self.step, "==", self.hist_length): - cb_bootstrap.phase_transition("primary") + cb_bootstrap.switch_phase("primary") return DAGCode( phases={ diff --git a/leap/multistep/multirate/__init__.py b/leap/multistep/multirate/__init__.py index 6817380..79f5593 100644 --- a/leap/multistep/multirate/__init__.py +++ b/leap/multistep/multirate/__init__.py @@ -716,8 +716,8 @@ class MultiRateMultiStepMethod(Method): if isubstep == 0: with cb.if_(self.bootstrap_step, "==", bootstrap_steps): - cb.phase_transition("primary") - cb.exit_step() + cb.switch_phase("primary") + cb.restart_step() cb.fence() diff --git a/leap/rk/__init__.py b/leap/rk/__init__.py index 35662fb..e019ca0 100644 --- a/leap/rk/__init__.py +++ b/leap/rk/__init__.py @@ -269,7 +269,7 @@ class ButcherTableauMethod(Method): (rhs_var.name, rhs_var_to_unknown[rhs_var]) for rhs_var in unknowns) - cb.assign_solved( + cb.assign_implicit( assignees=assignees, solve_components=[ rhs_var_to_unknown[unk].name diff --git a/leap/step_matrix.py b/leap/step_matrix.py index 9088bea..7e07154 100644 --- a/leap/step_matrix.py +++ b/leap/step_matrix.py @@ -244,7 +244,7 @@ class StepMatrixFinder(object): # {{{ exec methods - def exec_AssignExpression(self, stmt): + def exec_Assign(self, stmt): self.context[stmt.assignee] = self.eval_mapper(stmt.expression) def exec_AssignFunctionCall(self, stmt): @@ -270,7 +270,7 @@ class StepMatrixFinder(object): def exec_FailStep(self, stmt): raise FailStepException() - def exec_PhaseTransition(self, stmt): + def exec_SwitchPhase(self, stmt): pass # }}} diff --git a/leap/transform.py b/leap/transform.py index fdc2ad9..60083e4 100644 --- a/leap/transform.py +++ b/leap/transform.py @@ -39,7 +39,7 @@ def _elide_yield_state(statements): def _update_t_by_dt_factor(factor, statements): - from dagrt.language import AssignExpression, Nop + from dagrt.language import Assign, Nop from pymbolic import var from pymbolic.mapper.substitutor import make_subst_func, SubstitutionMapper @@ -52,7 +52,7 @@ def _update_t_by_dt_factor(factor, statements): return stmt.map_expressions(mapper) return [stmt - if (not isinstance(stmt, AssignExpression) + if (not isinstance(stmt, Assign) or stmt.lhs != var("")) else updater(stmt) for stmt in statements] diff --git a/leap/version.py b/leap/version.py index aac0098..78a7f0b 100644 --- a/leap/version.py +++ b/leap/version.py @@ -1,2 +1,2 @@ -VERSION = (2018, 1) +VERSION = (2019, 1) VERSION_TEXT = ".".join(str(i) for i in VERSION) diff --git a/requirements.txt b/requirements.txt index e22f333..ed0b128 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ git+git://github.com/inducer/pytools git+git://github.com/inducer/pymbolic -git+https://gitlab.tiker.net/inducer/dagrt.git \ No newline at end of file +git+https://gitlab.tiker.net/inducer/dagrt.git@statement-renaming diff --git a/setup.py b/setup.py index 9d4bceb..bff99cd 100644 --- a/setup.py +++ b/setup.py @@ -45,7 +45,7 @@ def main(): "pytools>=2014.1", "pymbolic>=2014.1", "pytest>=2.3", - "dagrt>=2018.1", + "dagrt>=2019.1", "mako", "six", ], diff --git a/test/test_imex.py b/test/test_imex.py index f853351..07ae489 100755 --- a/test/test_imex.py +++ b/test/test_imex.py @@ -60,8 +60,8 @@ def test_convergence(python_method_impl, problem, method, expected_order): code = method.generate() - from leap.implicit import replace_AssignSolved - code = replace_AssignSolved(code, {"solve": solver_hook}) + from leap.implicit import replace_AssignImplicit + code = replace_AssignImplicit(code, {"solve": solver_hook}) from pytools.convergence import EOCRecorder eocrec = EOCRecorder() @@ -130,8 +130,8 @@ def test_adaptive(python_method_impl, problem, method): code = generator.generate() #sgen = ScipySolverGenerator(*generator.implicit_expression()) - from leap.implicit import replace_AssignSolved - code = replace_AssignSolved(code, {"solve": solver_hook}) + from leap.implicit import replace_AssignImplicit + code = replace_AssignImplicit(code, {"solve": solver_hook}) from functools import partial interp = python_method_impl(code, function_map={ -- GitLab From 202301d3c7818a6474b7e11070f601dfd965190a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Kl=C3=B6ckner?= Date: Tue, 16 Apr 2019 02:55:04 +0200 Subject: [PATCH 2/2] Point CI back at master --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index ed0b128..e22f333 100644 --- a/requirements.txt +++ b/requirements.txt @@ -1,3 +1,3 @@ git+git://github.com/inducer/pytools git+git://github.com/inducer/pymbolic -git+https://gitlab.tiker.net/inducer/dagrt.git@statement-renaming +git+https://gitlab.tiker.net/inducer/dagrt.git \ No newline at end of file -- GitLab