diff --git a/examples/implicit_euler/implicit_euler.py b/examples/implicit_euler/implicit_euler.py index 2a073b508e3a9ec498a943354edd47316a10a540..f52e9190a8a7133115b1a6f265f18d52a5335bdb 100644 --- a/examples/implicit_euler/implicit_euler.py +++ b/examples/implicit_euler/implicit_euler.py @@ -53,8 +53,8 @@ class ImplicitEulerMethod(Method): with CodeBuilder(label="primary") as cb: self._make_primary(cb) - code = DAGCode.create_with_steady_state( - dep_on=cb.state_dependencies, + code = DAGCode.create_with_steady_phase( + dep_on=cb.phase_dependencies, instructions=cb.instructions) from leap.implicit import replace_AssignSolved diff --git a/examples/implicit_euler/test_implicit_euler.py b/examples/implicit_euler/test_implicit_euler.py index 0ad7c6c537547ea65b3be53b26d9012b4063366d..8066452bee23f7ce87ab2a1062ee36e2fed5b79c 100755 --- a/examples/implicit_euler/test_implicit_euler.py +++ b/examples/implicit_euler/test_implicit_euler.py @@ -131,5 +131,5 @@ if __name__ == "__main__": if len(sys.argv) > 1: exec(sys.argv[1]) else: - from py.test.cmdline import main + from pytest import main main([__file__]) diff --git a/examples/stability/mr-max-eigvals.py b/examples/stability/mr-max-eigvals.py index 4c784b7f996b46231c20fbffd3094e7fc4ecc82f..f8055e648bb235d3204b061ae627d405bf7a15c5 100644 --- a/examples/stability/mr-max-eigvals.py +++ b/examples/stability/mr-max-eigvals.py @@ -47,7 +47,7 @@ def main(): }, exclude_variables=["
bootstrap_step"]) - mat = finder.get_state_step_matrix("primary") + mat = finder.get_phase_step_matrix("primary") left = -3 right = 1 diff --git a/examples/stability/mr-stability-diagram.py b/examples/stability/mr-stability-diagram.py index 74b8f61e1c5a3af76b55b263887895af46210ea1..2cb1fe9244b5ea4c411c5fa046e6b82861ce8240 100644 --- a/examples/stability/mr-stability-diagram.py +++ b/examples/stability/mr-stability-diagram.py @@ -38,7 +38,7 @@ def main(): }, exclude_variables=["
bootstrap_step"]) - mat = finder.get_state_step_matrix("primary") + mat = finder.get_phase_step_matrix("primary") if 0: print('Variables: %s' % finder.variables) diff --git a/examples/stability/multirate-step-matrix.py b/examples/stability/multirate-step-matrix.py index c321c00e034e08ddbcd6ecbb57cb3ba2b2e6b8df..1c60cb569a3362ad7b33e165d4844cb3b53d07c9 100644 --- a/examples/stability/multirate-step-matrix.py +++ b/examples/stability/multirate-step-matrix.py @@ -33,7 +33,7 @@ def main(): }, exclude_variables=["
bootstrap_step"]) - mat = finder.get_state_step_matrix("primary") + mat = finder.get_phase_step_matrix("primary") if 0: print('Variables: %s' % finder.variables) diff --git a/examples/stability/step-matrix.py b/examples/stability/step-matrix.py index 2ad82bee0b0aa9f93180eb8552d20c045388d69d..2cb942a7c3312b512db8d6ffe0837796daa935f6 100644 --- a/examples/stability/step-matrix.py +++ b/examples/stability/step-matrix.py @@ -24,7 +24,7 @@ def main(): exclude_variables=["
step"])
print(finder.get_maxima_expressions("primary"))
- mat = finder.get_state_step_matrix("primary")
+ mat = finder.get_phase_step_matrix("primary")
print('Variables: %s' % finder.variables)
np.set_printoptions(formatter={"all": str})
diff --git a/leap/implicit.py b/leap/implicit.py
index 79f7021fa6aa52934878ba88767d64217a772972..f7d891e6e50f2d2d96ef93ea2fef958a80b3f5b0 100644
--- a/leap/implicit.py
+++ b/leap/implicit.py
@@ -53,10 +53,10 @@ def replace_AssignSolved(dag, solver_hooks):
from dagrt.language import AssignExpression, AssignSolved
- new_states = {}
+ new_phases = {}
- for state_name, state in dag.states.items():
- for insn in state.instructions:
+ for phase_name, phase in dag.phases.items():
+ for insn in phase.instructions:
if not isinstance(insn, AssignSolved):
new_instructions.append(insn)
@@ -81,6 +81,6 @@ def replace_AssignSolved(dag, solver_hooks):
condition=insn.condition,
depends_on=insn.depends_on))
- new_states[state_name] = state.copy(instructions=new_instructions)
+ new_phases[phase_name] = phase.copy(instructions=new_instructions)
- return dag.copy(states=new_states)
+ return dag.copy(phases=new_phases)
diff --git a/leap/multistep/__init__.py b/leap/multistep/__init__.py
index 0787df3b6a76b13e6bbffd05d58f58daa6a181ec..3eff65bbd425a9cdb3a10d7d6a87e64125080bca 100644
--- a/leap/multistep/__init__.py
+++ b/leap/multistep/__init__.py
@@ -328,11 +328,11 @@ class AdamsBashforthMethod(Method):
if self.hist_length == 1:
# The first order method requires no bootstrapping.
return DAGCode(
- states={
- "initial": cb_init.as_execution_state(next_state="primary"),
- "primary": cb_primary.as_execution_state(next_state="primary")
+ phases={
+ "initial": cb_init.as_execution_phase(next_phase="primary"),
+ "primary": cb_primary.as_execution_phase(next_phase="primary")
},
- initial_state="initial")
+ initial_phase="initial")
# Bootstrap
with CodeBuilder(label="bootstrap") as cb_bootstrap:
@@ -343,15 +343,15 @@ 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.state_transition("primary")
+ cb_bootstrap.phase_transition("primary")
return DAGCode(
- states={
- "initialization": cb_init.as_execution_state("bootstrap"),
- "bootstrap": cb_bootstrap.as_execution_state("bootstrap"),
- "primary": cb_primary.as_execution_state("primary"),
+ phases={
+ "initialization": cb_init.as_execution_phase("bootstrap"),
+ "bootstrap": cb_bootstrap.as_execution_phase("bootstrap"),
+ "primary": cb_primary.as_execution_phase("primary"),
},
- initial_state="initialization")
+ initial_phase="initialization")
def eval_rhs(self, t, y):
"""Return a node that evaluates the RHS at the given time and
diff --git a/leap/multistep/multirate/__init__.py b/leap/multistep/multirate/__init__.py
index 421e670ed53fae0d8a1cfa3635301be33cac7cfd..6c55997b87b7f90140ab6a0928eaebf07bd8a535 100644
--- a/leap/multistep/multirate/__init__.py
+++ b/leap/multistep/multirate/__init__.py
@@ -729,7 +729,7 @@ class MultiRateMultiStepMethod(Method):
if isubstep == 0:
with cb.if_(self.bootstrap_step, "==", bootstrap_steps):
- cb.state_transition("primary")
+ cb.phase_transition("primary")
cb.exit_step()
cb.fence()
@@ -1167,12 +1167,12 @@ class MultiRateMultiStepMethod(Method):
self.emit_rk_bootstrap(cb_bootstrap)
return DAGCode(
- states={
- "initialization": cb_init.as_execution_state("bootstrap"),
- "bootstrap": cb_bootstrap.as_execution_state("bootstrap"),
- "primary": cb_primary.as_execution_state("primary"),
+ phases={
+ "initialization": cb_init.as_execution_phase("bootstrap"),
+ "bootstrap": cb_bootstrap.as_execution_phase("bootstrap"),
+ "primary": cb_primary.as_execution_phase("primary"),
},
- initial_state="initialization")
+ initial_phase="initialization")
# }}}
diff --git a/leap/rk/__init__.py b/leap/rk/__init__.py
index 408d40413a75853fdfa00452892bd496564aff0d..c421e1c6694a091e63aeee8a8aae7d24a241de4c 100644
--- a/leap/rk/__init__.py
+++ b/leap/rk/__init__.py
@@ -149,6 +149,7 @@ class ButcherTableauMethod(Method):
coeff_sum = sum(stage_coeff_sets[name][istage])
assert abs(coeff_sum - self.c[istage]) < 1e-12, (
name, istage, coeff_sum, self.c[istage])
+
# }}}
# {{{ initialization
@@ -340,11 +341,11 @@ class ButcherTableauMethod(Method):
# }}}
return DAGCode(
- states={
- "initial": cb_init.as_execution_state(next_state="primary"),
- "primary": cb_primary.as_execution_state(next_state="primary")
+ phases={
+ "initial": cb_init.as_execution_phase(next_phase="primary"),
+ "primary": cb_primary.as_execution_phase(next_phase="primary")
},
- initial_state="initial")
+ initial_phase="initial")
def finish(self, cb, estimate_names, estimate_vars):
cb(self.state, estimate_vars[0])
@@ -769,11 +770,11 @@ class LSRK4Method(Method):
from dagrt.language import DAGCode
return DAGCode(
- states={
- "initial": cb_init.as_execution_state(next_state="primary"),
- "primary": cb_primary.as_execution_state(next_state="primary")
+ phases={
+ "initial": cb_init.as_execution_phase(next_phase="primary"),
+ "primary": cb_primary.as_execution_phase(next_phase="primary")
},
- initial_state="initial")
+ initial_phase="initial")
# }}}
diff --git a/leap/step_matrix.py b/leap/step_matrix.py
index 2c000f7571daed7dea4cbb17f2a95d0569658ff7..693666ccdd41c27129389323f6ce86767188fb6d 100644
--- a/leap/step_matrix.py
+++ b/leap/step_matrix.py
@@ -94,8 +94,8 @@ class StepMatrixFinder(object):
def _get_state_variables(self):
"""Extract all state-related variables from the code."""
all_var_ids = set()
- for state in six.itervalues(self.code.states):
- for inst in state.instructions:
+ for phase in six.itervalues(self.code.phases):
+ for inst in phase.instructions:
all_var_ids |= inst.get_written_variables()
all_var_ids |= inst.get_read_variables()
@@ -112,11 +112,11 @@ class StepMatrixFinder(object):
VectorComponent = namedtuple("VectorComponent", "name, index")
- def run_symbolic_step(self, state_name, shapes={}):
+ def run_symbolic_step(self, phase_name, shapes={}):
"""
`shapes` maps variable names to vector lengths.
"""
- state = self.code.states[state_name]
+ phase = self.code.phases[phase_name]
from pymbolic import var
@@ -143,14 +143,14 @@ class StepMatrixFinder(object):
self.context["