From fd832124ecf9264abba68b5cded9720b656f9d3e Mon Sep 17 00:00:00 2001 From: Matt Wala Date: Thu, 2 May 2019 13:29:41 -0500 Subject: [PATCH] CodeBuilder: Rename fence() to reset_dep_tracking(). Also bumps the version to 2019.2 for the API change. --- dagrt/language.py | 14 +++++++------- dagrt/version.py | 2 +- examples/adaptive_rk.py | 2 +- test/test_code_builder.py | 2 +- test/test_codegen_fortran.py | 6 +++--- test/test_codegen_python.py | 14 +++++++------- 6 files changed, 20 insertions(+), 20 deletions(-) diff --git a/dagrt/language.py b/dagrt/language.py index 9e5fb16..708b8d9 100644 --- a/dagrt/language.py +++ b/dagrt/language.py @@ -819,7 +819,7 @@ class CodeBuilder(object): as the root dependencies, the phase can be executed by following the dependency list of each statement. - .. automethod:: fence + .. automethod:: reset_dep_tracking .. automethod:: if_ .. automethod:: else_ .. automethod:: __call__ @@ -876,7 +876,7 @@ class CodeBuilder(object): self._all_var_names = set() self._all_generated_var_names = set() - def fence(self): + def reset_dep_tracking(self): """ Enter a new logical block of statements. Force all prior statements to execute before subsequent ones. @@ -1171,19 +1171,19 @@ class CodeBuilder(object): time_id=time_id)) def fail_step(self): - self.fence() + self.reset_dep_tracking() self._add_inst_to_context(FailStep()) def restart_step(self): - self.fence() + self.reset_dep_tracking() self._add_inst_to_context(RestartStep()) def raise_(self, error_condition, error_message=None): - self.fence() + self.reset_dep_tracking() self._add_inst_to_context(Raise(error_condition, error_message)) def switch_phase(self, next_phase): - self.fence() + self.reset_dep_tracking() self._add_inst_to_context(SwitchPhase(next_phase)) def __enter__(self): @@ -1191,7 +1191,7 @@ class CodeBuilder(object): return self def __exit__(self, *ignored): - self.fence() + self.reset_dep_tracking() self.phase_dependencies = list(self._contexts[-1].lead_statement_ids) self.statements = set(self._statement_map.values()) diff --git a/dagrt/version.py b/dagrt/version.py index 78a7f0b..b8345dc 100644 --- a/dagrt/version.py +++ b/dagrt/version.py @@ -1,2 +1,2 @@ -VERSION = (2019, 1) +VERSION = (2019, 2) VERSION_TEXT = ".".join(str(i) for i in VERSION) diff --git a/examples/adaptive_rk.py b/examples/adaptive_rk.py index 18f8a4c..c2b093d 100644 --- a/examples/adaptive_rk.py +++ b/examples/adaptive_rk.py @@ -68,7 +68,7 @@ def adaptive_rk_method(tol): # Adaptation cb(dt_old, dt) - cb.fence() + cb.reset_dep_tracking() cb(dt, dt * dt_scaling(tol, y_h - y_e)) # Accept or reject step diff --git a/test/test_code_builder.py b/test/test_code_builder.py index 1ef7a66..0641a80 100755 --- a/test/test_code_builder.py +++ b/test/test_code_builder.py @@ -147,7 +147,7 @@ def test_CodeBuilder_restart_step(python_method_impl): with CodeBuilder() as builder1: builder1("

x", 1) builder1.restart_step() - builder1.fence() + builder1.reset_dep_tracking() builder1("

x", 2) with CodeBuilder() as builder2: diff --git a/test/test_codegen_fortran.py b/test/test_codegen_fortran.py index 3e690c0..df4cf82 100755 --- a/test/test_codegen_fortran.py +++ b/test/test_codegen_fortran.py @@ -76,20 +76,20 @@ def test_arrays_and_linalg(): cb("nodes", "`array`(n)") cb("vdm", "`array`(n*n)") cb("identity", "`array`(n*n)") - cb.fence() + cb.reset_dep_tracking() cb("nodes[i]", "i/n", loops=[("i", 0, "n")]) cb("identity[i]", "0", loops=[("i", 0, "n*n")]) - cb.fence() + cb.reset_dep_tracking() cb("identity[i*n + i]", "1", loops=[("i", 0, "n")]) cb("vdm[j*n + i]", "nodes[i]**j", loops=[("i", 0, "n"), ("j", 0, "n")]) - cb.fence() + cb.reset_dep_tracking() cb("vdm_inverse", "`linear_solve`(vdm, identity, n, n)") cb("myarray", "`matmul`(vdm, vdm_inverse, n, n)") diff --git a/test/test_codegen_python.py b/test/test_codegen_python.py index ff0b29e..d2eb7ff 100755 --- a/test/test_codegen_python.py +++ b/test/test_codegen_python.py @@ -334,7 +334,7 @@ def test_IfThenElse_expansion(python_method_impl): def test_arrays_and_looping(python_method_impl): with CodeBuilder(label="primary") as cb: cb("myarray", "`array`(20)") - cb.fence() + cb.reset_dep_tracking() cb("myarray[i]", "i", loops=[("i", 0, 20)]) cb.yield_state("myarray[15]", "result", 0, "final") @@ -352,20 +352,20 @@ def test_arrays_and_linalg(python_method_impl): cb("nodes", "`array`(n)") cb("vdm", "`array`(n*n)") cb("identity", "`array`(n*n)") - cb.fence() + cb.reset_dep_tracking() cb("nodes[i]", "i/n", loops=[("i", 0, "n")]) cb("identity[i]", "0", loops=[("i", 0, "n*n")]) - cb.fence() + cb.reset_dep_tracking() cb("identity[i*n + i]", "1", loops=[("i", 0, "n")]) cb("vdm[j*n + i]", "nodes[i]**j", loops=[("i", 0, "n"), ("j", 0, "n")]) - cb.fence() + cb.reset_dep_tracking() cb("vdm_inverse", "`linear_solve`(vdm, identity, n, n)") cb("myarray", "`matmul`(vdm, vdm_inverse, n, n)") @@ -391,7 +391,7 @@ def test_svd(python_method_impl): cb("nodes", "`array`(n)") cb("vdm", "`array`(n*n)") cb("identity", "`array`(n*n)") - cb.fence() + cb.reset_dep_tracking() cb("nodes[i]", "i/n", loops=[("i", 0, "n")]) @@ -399,10 +399,10 @@ def test_svd(python_method_impl): cb("vdm[j*n + i]", "nodes[i]**j", loops=[("i", 0, "n"), ("j", 0, "n")]) - cb.fence() + cb.reset_dep_tracking() cb("vdm_u, vdm_sigma, vdm_vt", "`svd`(vdm, n)") - cb.fence() + cb.reset_dep_tracking() cb("vdm_usigma", "`array`(n*n)") cb("vdm_v", "`array`(n*n)") cb("vdm_usigma[i + j*n]", "vdm_u[i + j*n] * vdm_sigma[j]", -- GitLab