From e29fda62815671eea1ef6b73e1ef27a4bbd503b8 Mon Sep 17 00:00:00 2001 From: "T.J. Alumbaugh" Date: Mon, 15 Apr 2024 20:48:50 -0600 Subject: [PATCH 1/4] Scatter parameters once in TPI - Similar to the change in SS, put the parameters in global scope, then in `inner_loop` retrieve if possible. If they are not present, scatter them once for all future execution of `inner_loop`. --- ogcore/TPI.py | 17 +++++++++++++---- 1 file changed, 13 insertions(+), 4 deletions(-) diff --git a/ogcore/TPI.py b/ogcore/TPI.py index af05b3fbf..14a51762c 100644 --- a/ogcore/TPI.py +++ b/ogcore/TPI.py @@ -24,6 +24,13 @@ """ ENFORCE_SOLUTION_CHECKS = True +""" +A global future for the Parameters object for client workers. +This is scattered once and place at module scope, then used +by the client in the inner loop. +""" +scattered_p = None + def get_initial_SS_values(p): """ @@ -529,6 +536,12 @@ def run_TPI(p, client=None): results """ + global scattered_p + if client: + scattered_p = client.scatter(p, broadcast=True) + else: + scattered_p = p + # unpack tuples of parameters initial_values, ss_vars, theta, baseline_values = get_initial_SS_values(p) (B0, b_sinit, b_splus1init, factor, initial_b, initial_n) = initial_values @@ -719,10 +732,6 @@ def run_TPI(p, client=None): euler_errors = np.zeros((p.T, 2 * p.S, p.J)) lazy_values = [] - if client: - scattered_p = client.scatter(p, broadcast=True) - else: - scattered_p = p for j in range(p.J): guesses = (guesses_b[:, :, j], guesses_n[:, :, j]) lazy_values.append( From e40b50740708849cc4c7f83547c53f60617cae2f Mon Sep 17 00:00:00 2001 From: Richard Evans Date: Wed, 17 Apr 2024 12:47:28 -0600 Subject: [PATCH 2/4] Updated version and removed Python 3.9 tests --- .github/workflows/build_and_test.yml | 2 +- CHANGELOG.md | 9 +++++++++ ogcore/__init__.py | 2 +- pyproject.toml | 2 +- setup.py | 3 +-- 5 files changed, 13 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build_and_test.yml b/.github/workflows/build_and_test.yml index 5d10d86c7..1cc492be3 100644 --- a/.github/workflows/build_and_test.yml +++ b/.github/workflows/build_and_test.yml @@ -26,7 +26,7 @@ jobs: strategy: matrix: os: [ubuntu-latest, macos-latest, windows-latest] - python-version: ["3.9", "3.10", "3.11"] + python-version: ["3.10", "3.11"] steps: - name: Checkout diff --git a/CHANGELOG.md b/CHANGELOG.md index e0491b507..627bf6218 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,14 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [0.11.6] - 2024-04-17 14:00:00 + +### Added + +- Scatters parameters once in `TPI.py` +- Removes Python 3.9 tests from `build_and_test.yml` + + ## [0.11.5] - 2024-04-11 12:00:00 ### Added @@ -219,6 +227,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 - Any earlier versions of OG-USA can be found in the [`OG-Core`](https://github.com/PSLmodels/OG-Core) repository [release history](https://github.com/PSLmodels/OG-Core/releases) from [v.0.6.4](https://github.com/PSLmodels/OG-Core/releases/tag/v0.6.4) (Jul. 20, 2021) or earlier. +[0.11.6]: https://github.com/PSLmodels/OG-Core/compare/v0.11.5...v0.11.6 [0.11.5]: https://github.com/PSLmodels/OG-Core/compare/v0.11.4...v0.11.5 [0.11.4]: https://github.com/PSLmodels/OG-Core/compare/v0.11.3...v0.11.4 [0.11.3]: https://github.com/PSLmodels/OG-Core/compare/v0.11.2...v0.11.3 diff --git a/ogcore/__init__.py b/ogcore/__init__.py index d44505fcc..48ac6749f 100644 --- a/ogcore/__init__.py +++ b/ogcore/__init__.py @@ -20,4 +20,4 @@ from ogcore.txfunc import * from ogcore.utils import * -__version__ = "0.11.5" +__version__ = "0.11.6" diff --git a/pyproject.toml b/pyproject.toml index 0da40b0c4..ac83d1290 100644 --- a/pyproject.toml +++ b/pyproject.toml @@ -11,5 +11,5 @@ build-backend = "setuptools.build_meta" [tool.black] line-length = 79 -target-version = ["py39", "py310", "py311"] +target-version = ["py310", "py311"] include = '\.pyi?$' diff --git a/setup.py b/setup.py index 875504feb..387207319 100755 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setuptools.setup( name="ogcore", - version="0.11.5", + version="0.11.6", author="Jason DeBacker and Richard W. Evans", license="CC0 1.0 Universal (CC0 1.0) Public Domain Dedication", description="A general equilibribum overlapping generations model for fiscal policy analysis", @@ -44,7 +44,6 @@ "Operating System :: OS Independent", "Programming Language :: Python", "Programming Language :: Python :: 3", - "Programming Language :: Python :: 3.9", "Programming Language :: Python :: 3.10", "Programming Language :: Python :: 3.11", "Topic :: Software Development :: Libraries :: Python Modules", From 90b81798040f45969eb7e8ba7ce53e2b419ce8ce Mon Sep 17 00:00:00 2001 From: Richard Evans Date: Thu, 18 Apr 2024 23:49:43 -0600 Subject: [PATCH 3/4] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 627bf6218..fe5a4e3e2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [0.11.6] - 2024-04-17 14:00:00 +## [0.11.6] - 2024-04-18 23:55:00 ### Added From 9e0e312cc9c157c90f6d27bb2c157c8bb94663d8 Mon Sep 17 00:00:00 2001 From: Richard Evans Date: Thu, 18 Apr 2024 23:53:42 -0600 Subject: [PATCH 4/4] Update CHANGELOG.md --- CHANGELOG.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index fe5a4e3e2..746ad548a 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). -## [0.11.6] - 2024-04-18 23:55:00 +## [0.11.6] - 2024-04-19 01:00:00 ### Added