Skip to content

Commit a297bbf

Browse files
hmgaudeckerclaude
andcommitted
M1: config-driven BQSEGM stochastic-node splay
The BQSEGM continuation integrates the child's stochastic next-states over their joint node mesh; reading it in one pass scales the peak intermediate with the full ride-along x node x child-grid product, which on the M1 slice (aime=38 fixed PIA-bend grid x many ride-along axes) is enormous. Expose n_bqsegm_stochastic_node_batch_size on GridConfig and pass it into the solver, so a memory-rich device reads the whole mesh in one pass (0, default) while a tighter budget loops it in blocks. Resolves the M1 solve OOM together with the upstream pylcm splay threading. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 9e863e7 commit a297bbf

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

‎src/aca_model/baseline/regimes/_bqsegm.py‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,10 @@ def build_bqsegm_solver(grids: Grids) -> BQSEGM:
4040
continuous_state="assets",
4141
budget_target="resources",
4242
post_decision_function="savings",
43+
# Splay the child stochastic-node expectation per the grid config: `0` (the
44+
# default) reads the whole node mesh in one pass on a memory-rich device; a
45+
# positive value loops it in blocks to fit a tighter budget (a CPU run).
46+
stochastic_node_batch_size=grids.grid_config.n_bqsegm_stochastic_node_batch_size,
4347
)
4448

4549

‎src/aca_model/config.py‎

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,6 +84,14 @@ class GridConfig:
8484
# gathered grid (value function unchanged). `0` keeps the whole grid in one
8585
# kernel. Only consulted under `solver="dcegm"`.
8686
n_savings_batch_size: int = 0
87+
# Block size for splaying the BQSEGM continuation's child stochastic-node
88+
# expectation (health, health-cost shocks, the wage residual). `0` reads the
89+
# whole joint node mesh in one pass — fast, but its peak intermediate scales
90+
# with the full ride-along × node × child-grid product. A positive value loops
91+
# the mesh in blocks of that size, trading runtime for a much smaller peak; `1`
92+
# (one node at a time) is the memory-minimal setting for a CPU validation grid.
93+
# Only consulted under `solver="bqsegm"`.
94+
n_bqsegm_stochastic_node_batch_size: int = 0
8795

8896

8997
MODEL_CONFIG = ModelConfig()

0 commit comments

Comments
 (0)