diff --git a/examples/adaptive-rk/adaptive-rk.py b/examples/adaptive-rk/adaptive-rk.py index 3cba6ca14c6d54c745f4fe2cf359b737565358fa..936d92d1f693b28756ac8e102cdecdf332d5386d 100755 --- a/examples/adaptive-rk/adaptive-rk.py +++ b/examples/adaptive-rk/adaptive-rk.py @@ -140,7 +140,6 @@ def demo_rk_adaptive(): # Update dt based on the error estimate err_est = norm(y_lo - y_hi) order = 3 - cb.reset_dep_tracking() cb(dt, 0.9 * dt * (tol / err_est) ** (1 / order)) # Adapt the step size with cb.if_(err_est, "<=", tol): diff --git a/examples/implicit_euler/implicit_euler.py b/examples/implicit_euler/implicit_euler.py index b2f2d5e7eefa64970aaef9b17384a7c9493c0de7..63e03f3c1094e2b5ec146a13852657d55d723dc5 100644 --- a/examples/implicit_euler/implicit_euler.py +++ b/examples/implicit_euler/implicit_euler.py @@ -53,9 +53,7 @@ class ImplicitEulerMethod(Method): with CodeBuilder(label="primary") as cb: self._make_primary(cb) - code = DAGCode.create_with_steady_phase( - dep_on=cb.phase_dependencies, - statements=cb.statements) + code = DAGCode.create_with_steady_phase(statements=cb.statements) from leap.implicit import replace_AssignImplicit @@ -80,5 +78,4 @@ class ImplicitEulerMethod(Method): builder.yield_state(self.state, self.component_id, self.t + self.dt, 'final') - builder.reset_dep_tracking() builder.assign(self.t, self.t + self.dt) diff --git a/examples/semi-implicit-rk/semi-implicit-rk.py b/examples/semi-implicit-rk/semi-implicit-rk.py index 2988af9db77775973ca628c9ade6ae579bbe4345..f940f69396cf24c1b04a94430b9092c0c5c00878 100755 --- a/examples/semi-implicit-rk/semi-implicit-rk.py +++ b/examples/semi-implicit-rk/semi-implicit-rk.py @@ -90,7 +90,6 @@ def demo_rk_implicit(): solve_component=k2, expression=k2 - f(t + dt, y + dt * ((1 - gamma) * k1 + gamma * k2)), # noqa guess=k1) - cb.reset_dep_tracking() cb(y, y + dt * ((1 - gamma) * k1 + gamma * k2)) cb(t, t + dt) cb.yield_state(y, "y", t, None) diff --git a/leap/__init__.py b/leap/__init__.py index a078a13eac4abcc3f5e39ab6cf7dd5479e98a544..df957ddb30bf704cf6000ea8b8c9185618c0221f 100644 --- a/leap/__init__.py +++ b/leap/__init__.py @@ -144,13 +144,11 @@ class TwoOrderAdaptiveMethodMixin(Method): cb.raise_(TimeStepUnderflow) with cb.else_(): cb.fail_step() - cb.reset_dep_tracking() with cb.else_(): # This updates :
should not be set before this is called. self.finish_nonadaptive(cb, high_order_estimate, low_order_estimate) - cb.reset_dep_tracking() cb(self.dt, Min((0.9 * self.dt * rel_error ** (-1 / self.high_order), self.max_dt_growth * self.dt))) diff --git a/leap/implicit.py b/leap/implicit.py index 17beeffed87ed9620716ae2604fe2fc5b721e725..ee10a648c02bad853cea7ea3982d8d0d8052fc39 100644 --- a/leap/implicit.py +++ b/leap/implicit.py @@ -51,13 +51,13 @@ def replace_AssignImplicit(dag, solver_hooks): from collections import defaultdict solver_hooks = defaultdict(lambda: hook) - new_statements = [] - from dagrt.language import Assign, AssignImplicit new_phases = {} for phase_name, phase in dag.phases.items(): + new_statements = [] + for stmt in phase.statements: if not isinstance(stmt, AssignImplicit): diff --git a/leap/multistep/__init__.py b/leap/multistep/__init__.py index 619b3cada28c9b8dec89dae16c0feb6552375a6f..8cd44d76ca14a91b6de9972ada2bb1361bed8aa8 100644 --- a/leap/multistep/__init__.py +++ b/leap/multistep/__init__.py @@ -135,8 +135,6 @@ def _emit_func_family_operation(cb, name_gen, for j in range(len(function_family)*len(function_family)): cb(sig_array[j], 0) - cb.reset_dep_tracking() - for i in range(len(function_family)): cb(sig_array[i*(nfunctions+1)], sigma[i]**-1) @@ -297,7 +295,6 @@ class AdamsBashforthMethod(Method): t_end = 1 cb_primary(rhs_var, self.eval_rhs(self.t, self.state)) - cb_primary.reset_dep_tracking() history = self.history + [rhs_var] ab_sum = emit_ab_integration( @@ -313,13 +310,11 @@ class AdamsBashforthMethod(Method): # Rotate history and time history. for i in range(self.hist_length - 1): - cb_primary.reset_dep_tracking() cb_primary(self.history[i], history[i + 1]) if not self.static_dt: cb_primary(self.time_history[i], time_history_data[i + 1]) - cb_primary.reset_dep_tracking() cb_primary(self.t, self.t + self.dt) cb_primary.yield_state(expression=self.state, component_id=self.component_id, @@ -400,7 +395,6 @@ class AdamsBashforthMethod(Method): # Merge the values of the RHSs. rk_comb = sum(coeff * rhss[j] for j, coeff in enumerate(rk_coeffs)) - cb.reset_dep_tracking() state_est = self.state + self.dt * rk_comb if self.state_filter is not None: diff --git a/leap/multistep/multirate/__init__.py b/leap/multistep/multirate/__init__.py index 6792ecc9ffba07b42c14b85b86403b476e532d2e..54bca48d91f9714850659d455efbe9b7f72b5c77 100644 --- a/leap/multistep/multirate/__init__.py +++ b/leap/multistep/multirate/__init__.py @@ -539,8 +539,6 @@ class MultiRateMultiStepMethod(Method): # }}} - cb.reset_dep_tracking() - component_state_ests = {} for icomp, (comp_name, component_rhss) in enumerate( @@ -576,8 +574,6 @@ class MultiRateMultiStepMethod(Method): component_state_ests[comp_name] = state_var - cb.reset_dep_tracking() - for component_name in self.component_names: state = component_state_ests[component_name] if self.is_ode_component[component_name]: @@ -588,8 +584,6 @@ class MultiRateMultiStepMethod(Method): cb(var(""+component_name), state) - cb.reset_dep_tracking() - cb(self.t, self.t + self.dt/self.nsubsteps) # }}} @@ -712,18 +706,13 @@ class MultiRateMultiStepMethod(Method): # }}} - cb.reset_dep_tracking() - if isubstep == 0: with cb.if_(self.bootstrap_step, "==", bootstrap_steps): cb.switch_phase("primary") cb.restart_step() - cb.reset_dep_tracking() - self.emit_small_rk_step(cb, name_prefix, name_gen, current_rhss) - cb.reset_dep_tracking() cb(self.bootstrap_step, self.bootstrap_step + 1) return cb @@ -1081,16 +1070,12 @@ class MultiRateMultiStepMethod(Method): # }}} - cb.reset_dep_tracking() - log_hist_state() end_states = [ get_state(component_name, self.nsubsteps) for component_name in self.component_names] - cb.reset_dep_tracking() - # {{{ commit temp history to permanent history def commit_temp_hist_vars(): @@ -1104,13 +1089,11 @@ class MultiRateMultiStepMethod(Method): temp_time_vars[comp_name, irhs][-rhs.history_length:]): cb(time_var, time_expr) - cb.reset_dep_tracking() for hist_var, hist_expr in zip( self.history_vars[key], temp_hist_vars[comp_name, irhs][-rhs.history_length:]): cb(hist_var, hist_expr) - cb.reset_dep_tracking() commit_temp_hist_vars() @@ -1125,8 +1108,6 @@ class MultiRateMultiStepMethod(Method): cb(var(""+component_name), state) - cb.reset_dep_tracking() - cb(self.t, self.t + self.dt) # }}} diff --git a/leap/rk/__init__.py b/leap/rk/__init__.py index 6b385929f5b826de76a0b10d49ad073f68d3cfc7..9d5061e594b298f499676884def087070139e8d1 100644 --- a/leap/rk/__init__.py +++ b/leap/rk/__init__.py @@ -336,8 +336,6 @@ class ButcherTableauMethod(Method): estimate_vars[iest], state_est) - cb.reset_dep_tracking() - # This updates . self.finish(cb, estimate_coeff_set_names, estimate_vars) @@ -350,8 +348,6 @@ class ButcherTableauMethod(Method): self.c, stage_coeff_sets[name])): cb(last_rhss[name], stage_rhs_vars[name][-1]) - cb.reset_dep_tracking() - cb_primary = cb # }}} @@ -366,7 +362,6 @@ class ButcherTableauMethod(Method): def finish(self, cb, estimate_names, estimate_vars): cb(self.state, estimate_vars[0]) cb.yield_state(self.state, self.component_id, self.t + self.dt, 'final') - cb.reset_dep_tracking() cb(self.t, self.t + self.dt) # }}} @@ -612,7 +607,6 @@ class EmbeddedButcherTableauMethod( cb(self.state, est) cb.yield_state(self.state, self.component_id, self.t + self.dt, 'final') - cb.reset_dep_tracking() cb(self.t, self.t + self.dt) # }}} @@ -776,7 +770,6 @@ class LSRK4Method(Method): with CodeBuilder("primary") as cb: for a, b, c in self.coeffs: - cb.reset_dep_tracking() cb(rhs_val, rhs_func(t=t + c*dt, **{comp_id: state})) cb(residual, a*residual + dt*rhs_val) new_state_expr = state + b * residual @@ -784,11 +777,9 @@ class LSRK4Method(Method): if self.state_filter is not None: new_state_expr = self.state_filter(**{comp_id: new_state_expr}) - cb.reset_dep_tracking() cb(state, new_state_expr) cb.yield_state(state, comp_id, t + dt, 'final') - cb.reset_dep_tracking() cb(t, t + dt) cb_primary = cb diff --git a/leap/rk/imex.py b/leap/rk/imex.py index 5c0183fbc120812ebe2b6ba42557311118ad9747..af6631552c57e86f47b5fdcbbdaf9a26793fd785 100644 --- a/leap/rk/imex.py +++ b/leap/rk/imex.py @@ -152,7 +152,6 @@ class KennedyCarpenterIMEXRungeKuttaMethodBase( cb(self.state, est) cb.yield_state(self.state, self.component_id, self.t + self.dt, 'final') - cb.reset_dep_tracking() cb(self.t, self.t + self.dt) diff --git a/leap/transform.py b/leap/transform.py index 60083e49321187a021af074e2c2962b6cc79a4e0..c321af0fc97400add246d4b85947821be9f3833c 100644 --- a/leap/transform.py +++ b/leap/transform.py @@ -135,21 +135,18 @@ def strang_splitting(dag1, dag2, stepping_phase): """ new_phases[phase_name] = ExecutionPhase( next_phase=s2_name, - depends_on=phase1.depends_on, statements=( _update_t_by_dt_factor(0, _elide_yield_state( phase1_half_dt)))) new_phases[s2_name] = ExecutionPhase( next_phase=s3_name, - depends_on=phase2.depends_on, statements=( _update_t_by_dt_factor(1/2, _elide_yield_state( substed_s2_stmts)))) new_phases[s3_name] = ExecutionPhase( next_phase=phase1.next_phase, - depends_on=phase1.depends_on, statements=phase1_half_dt) else: from dagrt.transform import fuse_two_phases diff --git a/leap/version.py b/leap/version.py index b8345dcde7d523978a5e5aa3767bf2a76c09ccde..74bb455b564e9cb676ea466c03fd92cdde8d74a2 100644 --- a/leap/version.py +++ b/leap/version.py @@ -1,2 +1,2 @@ -VERSION = (2019, 2) +VERSION = (2019, 3) VERSION_TEXT = ".".join(str(i) for i in VERSION) diff --git a/setup.py b/setup.py index db14a32034cfcb32509731491cd7cc5c5d856733..b530f094ba01c382a6204f72655c06dfeb1e7f84 100644 --- a/setup.py +++ b/setup.py @@ -45,7 +45,7 @@ def main(): "pytools>=2014.1", "pymbolic>=2014.1", "pytest>=2.3", - "dagrt>=2019.2", + "dagrt>=2019.3", "mako", "six", ],