From 378fcc4ed75536c3d5588c6398b3353d7fbba41f Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Wed, 20 Nov 2019 15:16:31 -0600 Subject: [PATCH 1/4] WIP: DO NOT MERGE: Test against dagrt!30 --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index e22f333..58e822b 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@remove-restart-step -- GitLab From cdcf9e9448ddebfce249fb462e5833e4aa69f06c Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Wed, 20 Nov 2019 19:46:49 -0600 Subject: [PATCH 2/4] Dagrt language changes: * cb constructor arg is now mandatory * cb constructor arg name is "name", not label * DAGCode.from_steady_phase() is removed Bumps leap version to 2019.4 --- examples/adaptive-rk/adaptive-rk.py | 2 +- examples/implicit_euler/implicit_euler.py | 6 ++++-- examples/semi-implicit-rk/semi-implicit-rk.py | 2 +- leap/multistep/__init__.py | 6 +++--- leap/multistep/multirate/__init__.py | 6 +++--- leap/rk/__init__.py | 4 ++-- leap/version.py | 2 +- setup.py | 2 +- 8 files changed, 16 insertions(+), 14 deletions(-) diff --git a/examples/adaptive-rk/adaptive-rk.py b/examples/adaptive-rk/adaptive-rk.py index 936d92d..5362329 100755 --- a/examples/adaptive-rk/adaptive-rk.py +++ b/examples/adaptive-rk/adaptive-rk.py @@ -126,7 +126,7 @@ def demo_rk_adaptive(): var(name) for name in "k1 k2 k3 k4
dt_old y y_hi y_lo f norm_inf".split()) # noqa - with CodeBuilder() as cb: + with CodeBuilder("primary") as cb: # Calculate the RK stage values cb(k1, f(t, y)) cb(k2, f(t + 1/2 * dt, y + dt * (1/2 * k1))) diff --git a/examples/implicit_euler/implicit_euler.py b/examples/implicit_euler/implicit_euler.py index 63e03f3..6ce1d9e 100644 --- a/examples/implicit_euler/implicit_euler.py +++ b/examples/implicit_euler/implicit_euler.py @@ -50,10 +50,12 @@ class ImplicitEulerMethod(Method): """Return code that implements the implicit Euler method for the single state component supported.""" - with CodeBuilder(label="primary") as cb: + with CodeBuilder(name="primary") as cb: self._make_primary(cb) - code = DAGCode.create_with_steady_phase(statements=cb.statements) + code = DAGCode.from_phases_list( + [cb.as_execution_phase(next_phase="primary")], + initial_phase="primary") from leap.implicit import replace_AssignImplicit diff --git a/examples/semi-implicit-rk/semi-implicit-rk.py b/examples/semi-implicit-rk/semi-implicit-rk.py index f940f69..6f9fd15 100755 --- a/examples/semi-implicit-rk/semi-implicit-rk.py +++ b/examples/semi-implicit-rk/semi-implicit-rk.py @@ -79,7 +79,7 @@ def demo_rk_implicit(): gamma = (2 - 2**0.5) / 2 - with CodeBuilder() as cb: + with CodeBuilder("primary") as cb: cb.assign_implicit_1( k1, solve_component=k1, diff --git a/leap/multistep/__init__.py b/leap/multistep/__init__.py index 8cd44d7..c18155e 100644 --- a/leap/multistep/__init__.py +++ b/leap/multistep/__init__.py @@ -272,11 +272,11 @@ class AdamsBashforthMethod(Method): rhs_var = var("rhs_var") # Initialization - with CodeBuilder(label="initialization") as cb_init: + with CodeBuilder(name="initialization") as cb_init: cb_init(self.step, 1) # Primary - with CodeBuilder(label="primary") as cb_primary: + with CodeBuilder(name="primary") as cb_primary: if not self.static_dt: time_history_data = self.time_history + [self.t] @@ -330,7 +330,7 @@ class AdamsBashforthMethod(Method): initial_phase="initial") # Bootstrap - with CodeBuilder(label="bootstrap") as cb_bootstrap: + with CodeBuilder(name="bootstrap") as cb_bootstrap: self.rk_bootstrap(cb_bootstrap) cb_bootstrap(self.t, self.t + self.dt) cb_bootstrap.yield_state(expression=self.state, diff --git a/leap/multistep/multirate/__init__.py b/leap/multistep/multirate/__init__.py index 54bca48..8d172f9 100644 --- a/leap/multistep/multirate/__init__.py +++ b/leap/multistep/multirate/__init__.py @@ -1125,13 +1125,13 @@ class MultiRateMultiStepMethod(Method): from dagrt.language import DAGCode, CodeBuilder - with CodeBuilder(label="initialization") as cb_init: + with CodeBuilder(name="initialization") as cb_init: self.emit_initialization(cb_init) - with CodeBuilder(label="primary") as cb_primary: + with CodeBuilder(name="primary") as cb_primary: self.emit_ab_method(cb_primary, explainer) - with CodeBuilder(label="bootstrap") as cb_bootstrap: + with CodeBuilder(name="bootstrap") as cb_bootstrap: self.emit_rk_bootstrap(cb_bootstrap) return DAGCode( diff --git a/leap/rk/__init__.py b/leap/rk/__init__.py index 9d5061e..9b474c5 100644 --- a/leap/rk/__init__.py +++ b/leap/rk/__init__.py @@ -172,7 +172,7 @@ class ButcherTableauMethod(Method): last_rhss = {} - with CodeBuilder(label="initialization") as cb: + with CodeBuilder(name="initialization") as cb: for name in stage_coeff_set_names: if ( name in self.recycle_last_stage_coeff_set_names @@ -203,7 +203,7 @@ class ButcherTableauMethod(Method): last_state_est_var = cb.fresh_var("last_state_est") last_state_est_var_valid = False - with CodeBuilder(label="primary") as cb: + with CodeBuilder(name="primary") as cb: equations = [] unknowns = set() diff --git a/leap/version.py b/leap/version.py index 74bb455..0d96d97 100644 --- a/leap/version.py +++ b/leap/version.py @@ -1,2 +1,2 @@ -VERSION = (2019, 3) +VERSION = (2019, 4) VERSION_TEXT = ".".join(str(i) for i in VERSION) diff --git a/setup.py b/setup.py index b530f09..71e94f4 100644 --- a/setup.py +++ b/setup.py @@ -45,7 +45,7 @@ def main(): "pytools>=2014.1", "pymbolic>=2014.1", "pytest>=2.3", - "dagrt>=2019.3", + "dagrt>=2019.4", "mako", "six", ], -- GitLab From b0b1fcfbb70f8ab94349f165101fe709bf7f1012 Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Wed, 20 Nov 2019 20:27:37 -0600 Subject: [PATCH 3/4] Pylint fixes --- leap/transform.py | 3 +++ 1 file changed, 3 insertions(+) diff --git a/leap/transform.py b/leap/transform.py index c321af0..77da714 100644 --- a/leap/transform.py +++ b/leap/transform.py @@ -134,18 +134,21 @@ def strang_splitting(dag1, dag2, stepping_phase): 4. Return u3 """ new_phases[phase_name] = ExecutionPhase( + name=phase_name, next_phase=s2_name, statements=( _update_t_by_dt_factor(0, _elide_yield_state( phase1_half_dt)))) new_phases[s2_name] = ExecutionPhase( + name=s2_name, next_phase=s3_name, statements=( _update_t_by_dt_factor(1/2, _elide_yield_state( substed_s2_stmts)))) new_phases[s3_name] = ExecutionPhase( + name=s3_name, next_phase=phase1.next_phase, statements=phase1_half_dt) else: -- GitLab From 804c9d45a9835c691158103b972c1be29199910e Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Andreas=20Kl=C3=B6ckner?= Date: Fri, 22 Nov 2019 00:19:20 +0100 Subject: [PATCH 4/4] Point requirements.txt back at dagrt master --- requirements.txt | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/requirements.txt b/requirements.txt index 58e822b..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@remove-restart-step +git+https://gitlab.tiker.net/inducer/dagrt.git \ No newline at end of file -- GitLab