Repository navigation
Lectures run as used: aiyagari_jax and ifp_egm_jax in float32 and float64 - #3
Conversation
…1-gpu Adds lectures/, for whole QuantEcon lectures run as a reader or a CI build runs them: every code cell in one fresh process, compile time counted, timed per cell, in float64 as written or switched to float32. - lectures/run_lecture.py runs any MyST lecture that way. - lectures/aiyagari_jax/ answers project-compute's question before a card purchase: on a TITAN RTX, is float64 bound by bandwidth or by FP64 arithmetic? It has the scaling script for the lecture's own household operators (asset grids of 200 to 10,000), two diagnostics for the float32 slowdown, and the summaries. - lectures/results/qe-wharton1-gpu/2026-10-25/aiyagari_jax/ holds the runs: 12 whole-lecture runs (card and CPU, both precisions, three each), 12 scaling runs, the diagnostics' output and the environment. Co-Authored-By: Claude Opus 5.5 <[email protected]>
.gitignore drops every *.json as a benchmark output, which left the 24 aiyagari_jax runs out of the previous commit. Let lectures/results/ through; other JSON stays ignored. Co-Authored-By: Claude Opus 5.5 <[email protected]>
There was a problem hiding this comment.
🔵 Needs a closer look
The scripts are coupled to an external lecture file and a GPU/JAX runtime that cannot be re-executed here, and they reference the precision/ directory from the still-unmerged PR #2, so a human should give final sign-off.
1 open issue
What changed in this PR
This PR adds a new lectures/ area that runs whole QuantEcon lectures "as used" — every code cell executed in order in one fresh IPython process, timed per cell, in float64 as written or rewritten to float32. Its first application answers project-compute's pre-purchase question for the aiyagari_jax lecture on a TITAN RTX (is float64 bound by bandwidth or FP64 arithmetic), and commits the raw results, diagnostics, and summariser scripts. It complements the per-kernel precision/ suite (PR #2) by measuring what a reader actually waits for.
Changes:
- Adds
run_lecture.py(generic cell-by-cell lecture timer with--dtype/--record/--env-info) plusaiyagari_jax/scaling + diagnostic + summariser scripts. - Commits 12 whole-lecture runs, 12 scaling runs, diagnostics, and the package list under
lectures/results/qe-wharton1-gpu/2026-10-25/. - Updates
.gitignoreto keep result JSON underlectures/results/while still ignoring other*.json, and documents the harness in three READMEs.
| File | Description |
|---|---|
lectures/run_lecture.py |
Runs MyST cells via IPython, rewrites jax_enable_x64 for float32, records expressions, writes per-cell timings |
lectures/aiyagari_jax/aiyagari_scale.py |
Times household operators across asset grids; adds a stored-reward greedy variant (self-checked vs get_greedy) |
lectures/aiyagari_jax/hpi_check.py / bicgstab_check.py |
Diagnostics for the float32 slowdown (HPI loop counts; bicgstab convergence vs cap) |
lectures/aiyagari_jax/summarise_runs.py / summarise_scale.py / policy_gap.py |
Build the markdown tables and fidelity checks from results |
lectures/results/.../* |
Committed run/scale JSON, logs, diagnostics, environment.txt |
README.md, lectures/README.md, lectures/aiyagari_jax/README.md |
Document the harness and reproduction steps |
.gitignore |
Re-include lectures/results/**/*.json under the global *.json ignore |
I verified both summarisers run cleanly on the committed data, the .gitignore negation behaves as intended (git check-ignore), and the headline numbers match the PR narrative. The one issue found is a documentation gap: the only documented run_lecture.py command records just "K_star", while summarise_runs.py also requires K_vals.tolist(), np.asarray(σ_star).ravel().tolist(), and str(household.a_grid.dtype).
Review effort: Balanced
The second float64 lecture project-compute asked for. Its EGM operator interpolates instead of searching a dense choice grid. - lectures/ifp_egm_jax/: the JAX-solve check at the lecture's grid, the operator at savings grids of 200 to 50,000, the summary, the drivers and a README. - lectures/results/qe-wharton1-gpu/2026-10-25/ifp_egm_jax/: 12 solve checks and 12 scaling runs (the card and its host CPU, both precisions, three each), and 6 whole-lecture runs in float64. - The aiyagari_jax drivers, and README rows for them. Co-Authored-By: Claude Opus 5.5 <[email protected]>
- lectures/results/qe-mini1/2026-10-25/: aiyagari_jax as used and at scale, and ifp_egm_jax's solve check, operator scaling and float64 runs as used, on the M6's CPU, three runs each. state.txt records the machine before, during and after. - lectures/mac_set.sh, the driver: it pauses qe-mini1's agents and the console's animated wallpaper (SIGSTOP), and resumes them (SIGCONT) on exit. It also gives Remote Control its terminal back, which this run did by hand. - lectures/compare_hosts.py sets the TITAN RTX, its host's Threadripper and the M6 side by side. Co-Authored-By: Claude Opus 5.5 <[email protected]>
… patterns - Each lecture's README now has a "Reproducing a run" section with the exact run_lecture.py and scaling commands, including the --record set its summary script reads. lectures/README.md says so beside its one-value example, as Copilot pointed out. - mac_set.sh anchors each pgrep -f pattern to the start of its target's command line. Unanchored, the patterns also matched any shell whose command mentioned them, such as the one that launched a driver. That shell was then paused with the agents, as happened to a Phase 0 launch on 2026-10-25. Co-Authored-By: Claude Opus 5.5 <[email protected]>

Adds
lectures/: whole QuantEcon lectures run as a reader or a CI build runs them. Every code cell runs in order in one fresh process, with compile time counted, timed per cell, in float64 as written or switched to float32. The first use answers project-compute's question before a card purchase (its research file, §5): on a TITAN RTX, is float64 bound by bandwidth or by FP64 arithmetic?What it adds
lectures/run_lecture.py--dtype float32rewrites the lecture'sjax_enable_x64line;--recordkeeps chosen values for comparing precisionslectures/aiyagari_jax/lectures/results/qe-wharton1-gpu/2026-10-25/aiyagari_jax/lectures/ifp_egm_jax/lectures/results/qe-wharton1-gpu/2026-10-25/ifp_egm_jax/lectures/results/qe-mini1/2026-10-25/qe-mini1's M6, withstate.txtrecording the machine before, during and afterlectures/mac_set.sh,lectures/compare_hosts.py.gitignore*.jsonstays ignored, except underlectures/results/How it was run
On
qe-wharton1-gpuon 2026-10-25, with nothing else running:0b:00.0, and the Threadripper beside it;jax[cuda13]0.12.0.1, preallocation off;aiyagari_jaxandifp_egm_jaxfrom lecture-jax at4b939ec, unchanged apart from the precision line.The same CPU runs were made on
qe-mini1's M6, with its agents and the console's animated wallpaper paused (SIGSTOP) and resumed afterwards. While paused, the Mac idled at under 2% CPU.What it shows, in brief
aiyagari_jax, the whole lecture:log(c)over every (a, z, a′), so it is bound by FP64 arithmetic. The same step over stored rewards is about 2×.ifp_egm_jax:ifp_egm_jax, the JAX solve takes 4.95 s warm on the card in either precision, against 3.2 s on the CPU.The M6 against the card:
aiyagari_jaxin 5.1 s against the card's 90.7 s, andifp_egm_jax's JAX solve in 0.38 s against 4.95 s.The interpretation is written up in project-benchmarks-jax's
findings/.Notes
--env-info precisionuses Add a precision benchmark: float32 against float64 across CPU, CUDA and Apple Silicon #2'sprecision/env_info.pyfor the environment block, so that option needs Add a precision benchmark: float32 against float64 across CPU, CUDA and Apple Silicon #2 merged first.ifp_egm_jax. Its Numba cross-check, which runs on the CPU in every configuration, doesn't converge in float32. The JAX solve does.🤖 Generated with Claude Code