Skip to content

Whole lectures: float32 against float64, on the TITAN RTX, the Threadripper and both Macs - #16

Merged
mmcky merged 5 commits into
mainfrom
float32-pass
Oct 26, 2026
Merged

mmcky merged 5 commits into
mainfrom
float32-pass

Conversation

@mmcky

@mmcky mmcky commented Oct 26, 2026 •

Copy link
Copy Markdown
Contributor

The float32 pass for #4: the 13 lecture-jax lectures that set jax_enable_x64, each run in float64 and then in float32, three times on each of four devices. The results, and a new section in lectures/whole/README.md that reads them.

What it shows

TITAN RTX Threadripper M6 M5 Pro
The 12 that ran in both, float64 → float32 556 → 1,850 s 1,140 → 3,694 s 278 → 397 s 252 → 390 s
Most float32 gains on one lecture 1.21× (hopenhayn) 1.56× (inventory_ssd) 1.81× (hopenhayn) 1.49× (arellano_jax)
  • float32 is not a speed-up on the card for these lectures. At the lectures' sizes the TITAN RTX isn't limited by float64 arithmetic, though float32 is 24.5× faster for it on dense matmul in the precision benchmark.
  • Over the set, float32 is slower on every device, because loops that stop at a tolerance take longer or never stop: policy iteration in opt_invest and opt_savings_2 runs to its 250-loop cap, and in aiyagari_jax to its 10,000-loop cap at 2 of 50 capital values.
  • markov_asset_jax fails in float32 on every device: its 15-step power-iteration estimate of the spectral radius comes out at 1.026, so its stability assertion fails, though the exact radius is 0.994.
  • What the lectures print changes, in largely the same cells on every device: hopenhayn's equilibrium price comes out 12% higher, for one.

In this PR

  • lectures/results/qe-wharton1-gpu/2026-10-25/whole/: 156 runs (13 lectures × card and CPU × two precisions × three), with the pass's log and float32-pass-state.txt. Home paths that a float32 warning prints are shortened to ~/.
  • The M6 and M5 Pro runs and summarise_precision.py, from the branch's earlier commit.
  • summarise_precision.py now skips cells that run a shell command. Each lecture's !nvidia-smi prints the date and the card's state, which flagged it as changed on the Linux host.
  • main merged in, with lecture-python.myst's JAX lectures on the M5 Pro #15's lecture-python.myst section. Its README conflicted with this one only where both added text; both sections are kept, the float32 one first.

The project-benchmarks-jax dashboard already reads these files: a build from this branch shows all four devices in the lectures page's float32 view.

Run on qe-wharton1-gpu from 23:15 UTC on 2026-10-25 to 05:25 UTC on 2026-10-26, card 0b:00.0, both cards idle at the start and the end.

🤖 Generated with Claude Code

mmcky and others added 4 commits October 26, 2026 10:13
lectures_set.sh takes DTYPES, run_lecture.py's --dtype values run in turn
for each lecture on each platform (as-written by default), and LIST, the
lectures to run (lectures.txt by default). lectures-float64.txt lists the
13 lectures that set jax_enable_x64, for #4's float32 pass, which runs
each in float64 and float32 back to back. mac_lectures.sh passes its
arguments to lectures_set.sh.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The 13 float64 lectures in float64 and float32, three times each on each
Mac's CPU, from e5b3f8f, with summarise_precision.py to compare them. A
check records markov_asset_jax's spectral radius in both precisions,
whose stability assertion fails in float32. Home paths that a float32
warning prints are shortened to ~/, and qe-wharton2's state is redacted
as before.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
The 13 float64 lectures in float64 and float32, three times each on
qe-wharton1-gpu's card and CPU, from e5b3f8f, beside the Macs' runs. Home
paths a float32 warning prints are shortened to ~/.

summarise_precision.py now skips cells that run a shell command: each
lecture's !nvidia-smi prints the date and the card's state, which flagged
it as changed on the Linux host. The README gains a section on the pass:
float32 is at most 1.21x faster on the card, slower over the set on every
device, and changes what several lectures print.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
Copilot AI balanced review requested due to automatic review settings October 26, 2026 05:33

Copilot AI left a comment

Copy link
Copy Markdown

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

🔵 Needs a closer look

It commits a large volume of machine-generated benchmark result data across four devices whose correctness cannot be verified by code review, so final human sign-off is warranted even though the small tooling changes look correct.

No open issues 🎉

What changed in this PR

This PR adds the float32 pass for #4: the 13 lecture-jax lectures that enable jax_enable_x64 are each run in float64 and then float32, three times, on four devices (TITAN RTX, Threadripper, M6, M5 Pro). It commits the result JSON under lectures/results/, adds a summarise_precision.py reader, extends the run scripts to iterate precisions, and (per the already-merged README) documents the findings — notably that float32 is slower across these lectures and that markov_asset_jax's stability assertion fails in float32.

Changes:

  • New summarise_precision.py compares float64/float32 median times and flags cells whose printed numbers move, skipping shell (!) cells.
  • lectures_set.sh gains DTYPES and LIST env knobs (default as-written/lectures.txt) and loops --dtype per platform; mac_lectures.sh now forwards arguments.
  • Adds lectures-float64.txt and the per-device result JSON, pass-state logs, and the markov_asset spectral-radius check.
File Description
lectures/​whole/​summarise_precision.py New summariser; reuses device_name/expected from summarise_whole, parses numbers with a lookbehind that excludes dtype names, skips shell cells. Logic is sound.
lectures/​whole/​lectures_set.sh Adds DTYPES/LIST; output/err filenames stay compatible with the *-as-written-*/*-<dtype>-* glob patterns.
lectures/​whole/​mac_lectures.sh Passes through args to lectures_set.sh; the SIGCONT resume trap is preserved.
lectures/​whole/​lectures-float64.txt List of the 13 x64 lectures driving the float32 pass.
lectures/​results/​** (JSON, *-state.txt, checks/​*.txt) Committed run artifacts; dates are in the past, commit e5b3f8f is consistent, correctly tracked via .gitignore re-include.

Review effort: Balanced

# Conflicts:
#	lectures/whole/README.md
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants