Skip to content

Commit 3a7b4af

Browse files
committed
Merge remote-tracking branch 'upstream/master' into tpi_out
2 parents abb9147 + 9ae48b7 commit 3a7b4af

20 files changed

Lines changed: 2215 additions & 48 deletions

.github/workflows/build_and_test.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ jobs:
5050
shell: bash -l {0}
5151
working-directory: ./
5252
run: |
53-
python -m pytest -m "not local" --cov=./ --cov-report=xml
53+
python -m pytest -m "not local and not benchmark" --cov=./ --cov-report=xml
5454
- name: Upload coverage to Codecov
5555
if: matrix.os == 'ubuntu-latest' && contains(github.repository, 'PSLmodels/OG-Core')
5656
uses: codecov/codecov-action@v4

CHANGELOG.md

Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,37 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
66
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
77

88

9+
## [0.14.8] - 2025-08-26 12:00:00
10+
11+
### Added
12+
13+
- Adds a complete benchmark suite for measuring and optimizing Dask performance in OG-Core, with particular focus on Windows performance issues.
14+
- New and updated files:
15+
- tests/test_dask_benchmarks.py: Mock benchmark tests with synthetic workloads
16+
- tests/test_real_txfunc_benchmarks.py: Real-world tax function benchmarks
17+
- tests/run_benchmarks.py: Automated benchmark runner with reporting
18+
- tests/BENCHMARK_README.md: Comprehensive documentation and usage guide
19+
- pytest.ini: Updated with benchmark test markers
20+
- Key features:
21+
- Platform-specific optimization tests (Windows, macOS, Linux)
22+
- Memory usage and compute time benchmarking
23+
- Baseline establishment and performance regression detection
24+
- Comparison of different Dask schedulers and client configurations
25+
- Real tax function estimation performance measurement
26+
- Automated identification of optimal Dask settings per platform
27+
- Benefits:
28+
- Establishes performance baselines before optimization work
29+
- Identifies Windows-specific Dask performance bottlenecks
30+
- Provides automated regression detection for future changes
31+
- Enables data-driven optimization decisions
32+
- Supports continuous performance monitoring
33+
- Usage:
34+
- `python tests/run_benchmarks.py # Run all benchmarks`
35+
- `python tests/run_benchmarks.py --quick # Quick benchmarks only`
36+
- `python tests/run_benchmarks.py --save-baseline # Save performance baseline`
37+
- `python tests/run_benchmarks.py --compare-baseline # Compare against baseline`
38+
- 🤖 Generated with help from Claude Code
39+
940
## [0.14.7] - 2025-08-21 17:00:00
1041

1142
### Added
@@ -409,6 +440,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
409440
- 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.
410441

411442

443+
[0.14.8]: https://github.com/PSLmodels/OG-Core/compare/v0.14.7...v0.14.8
412444
[0.14.7]: https://github.com/PSLmodels/OG-Core/compare/v0.14.6...v0.14.7
413445
[0.14.6]: https://github.com/PSLmodels/OG-Core/compare/v0.14.5...v0.14.6
414446
[0.14.5]: https://github.com/PSLmodels/OG-Core/compare/v0.14.4...v0.14.5
File renamed without changes.
Lines changed: 0 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -21,10 +21,6 @@
2121
# Use a custom matplotlib style file for plots
2222
plt.style.use("ogcore.OGcorePlots")
2323

24-
# Set verbosity
25-
ogcore.SS.VERBOSE = False
26-
ogcore.TPI.VERBOSE = False
27-
2824

2925
def main():
3026
# Define parameters to use for multiprocessing

ogcore/SS.py

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,6 @@
1111
import warnings
1212
import logging
1313

14-
1514
if not SHOW_RUNTIME:
1615
warnings.simplefilter("ignore", RuntimeWarning)
1716

@@ -1273,27 +1272,25 @@ def SS_fsolve(guesses, *args):
12731272
+ list(error_BQ)
12741273
+ [error_TR]
12751274
)
1276-
logging.info(f"GE loop errors = ", [f"{error:.3e}" for error in errors])
1275+
error_string = [f"{error:.3e}" for error in errors]
1276+
logging.info(f"GE loop errors = {error_string}")
12771277

12781278
return errors
12791279

12801280

1281-
def run_SS(p, client=None, verbose=False):
1281+
def run_SS(p, client=None):
12821282
"""
12831283
Solve for steady-state equilibrium of OG-Core.
12841284
12851285
Args:
12861286
p (OG-Core Specifications object): model parameters
12871287
client (Dask client object): client
1288-
verbose (bool): if True, set logging to INFO level
12891288
12901289
Returns:
12911290
output (dictionary): dictionary with steady-state solution
12921291
results
12931292
12941293
"""
1295-
# Configure logging level based on verbose parameter
1296-
config.set_logging_level(verbose)
12971294
# Create list of deviation factors for initial guesses of r and TR
12981295
dev_factor_list = [
12991296
[1.00, 1.0],

ogcore/TPI.py

Lines changed: 2 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -543,28 +543,22 @@ def inner_loop(guesses, outer_loop_vars, initial_values, ubi, j, ind, p):
543543
n_vec = solutions.x[p.S :]
544544
n_mat[t + ind, ind] = n_vec
545545

546-
# print('Type ', j, ' max euler error = ',
547-
# np.absolute(euler_errors).max())
548-
549546
return euler_errors, b_mat, n_mat
550547

551548

552-
def run_TPI(p, client=None, verbose=False):
549+
def run_TPI(p, client=None):
553550
"""
554551
Solve for transition path equilibrium of OG-Core.
555552
556553
Args:
557554
p (OG-Core Specifications object): model parameters
558555
client (Dask client object): client
559-
verbose (bool): if True, set logging to INFO level
560556
561557
Returns:
562558
output (dictionary): dictionary with transition path solution
563559
results
564560
565561
"""
566-
# Configure logging level based on verbose parameter
567-
config.set_logging_level(verbose)
568562
# unpack tuples of parameters
569563
initial_values, ss_vars, theta, baseline_values = get_initial_SS_values(p)
570564
(B0, b_sinit, b_splus1init, factor, initial_b, initial_n) = initial_values
@@ -1187,7 +1181,7 @@ def run_TPI(p, client=None, verbose=False):
11871181
# print 'New Value of nu:', nu
11881182
TPIiter += 1
11891183
logging.info(f"Iteration: {TPIiter}")
1190-
logging.info(f"\tDistance: {TPIdist}")
1184+
logging.info(f"Distance: {TPIdist}")
11911185

11921186
# Compute effective and marginal tax rates for all agents
11931187
num_params = len(p.mtrx_params[0][0])

ogcore/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,4 +20,4 @@
2020
from ogcore.txfunc import *
2121
from ogcore.utils import *
2222

23-
__version__ = "0.14.7"
23+
__version__ = "0.14.8"

0 commit comments

Comments
 (0)