Skip to content

Whole lectures as used: lecture-jax on the TITAN RTX, the Threadripper and the M6 - #8

Merged
mmcky merged 2 commits into
mainfrom
whole-lectures
Oct 25, 2026
Merged

mmcky merged 2 commits into
mainfrom
whole-lectures

Conversation

@mmcky

@mmcky mmcky commented Oct 25, 2026

Copy link
Copy Markdown
Contributor

The first part of #4: every lecture in lecture-jax at 4b939ec, run as written in a fresh process, timed cell by cell, three times each, on qe-wharton1-gpu's TITAN RTX and its Threadripper 2990WX, and on qe-mini1's M6 with its agents paused. The full table and the method are in lectures/whole/README.md.

What it shows

  • The M6 runs 21 of the 28 lectures with code faster than the card, 20 of them by more than 2×. The Threadripper is fastest on none.
  • The card wins the seven built on one large vectorised computation, by 2× to 24×: overborrowing, wealth_dynamics_jax, schelling_shocks, opt_invest, hopenhayn, kesten_processes_jax and opt_savings_2.
  • Over the whole set the card is faster, 873 s to 1,256 s, because overborrowing and wealth_dynamics_jax take 834 s of the M6's total.
  • Where the card loses, the work is sequential or small. schelling_jax calls a small jitted function per agent from a Python loop: 34.8 s in one cell on the card, 0.7 s on the M6. keras and jax_nn train small networks for thousands of tiny steps. Small lectures pay 3 s to 12 s on the card for CUDA's start-up and slower first calls, against 0.4 s to 2 s on the M6.
  • No unexpected cell failures. The one failing cell is jax_intro_jax's, which the lecture tags raises-exception.

What changed

Path What it is
lectures/run_lecture.py --dtype as-written runs a lecture at the precision it sets; each cell records its tags, and a raises-exception cell counts as an expected error
lectures/whole/summarise_whole.py The per-lecture table across hosts: medians, the fastest device, each device's slowest cells. It reads expected errors from the lecture source, since the machines ran run_lecture.py before it recorded tags
lectures/whole/lectures_set.sh, mac_lectures.sh, lectures.txt The drivers as run, and the 29 lectures
lectures/results/<host>/2026-10-25/whole/ 174 runs from qe-wharton1-gpu and 87 from qe-mini1, with each machine's environment.txt and log, and qe-mini1's state.txt

The results were scanned before committing: no home paths, addresses or credentials, and every .err file was empty, so none is included.

Still to come under #4

  • The JAX lectures in lecture-python.myst, sargent_surico among them.
  • float32 runs of the 13 float64 lectures.
  • qe-wharton2's M5 Pro, once it is onboarded.
  • The T4 the lectures' CI uses, which bears most directly on meta#350's question 1.
  • A per-lecture view in the dashboard, in QuantEcon/project-benchmarks-jax.

🤖 Generated with Claude Code

mmcky and others added 2 commits October 25, 2026 19:58
- --dtype as-written runs a lecture untouched, whatever precision it
  sets, for the whole-lecture comparison (#4). float32 and float64
  still require exactly one jax_enable_x64 line.
- Each cell records its MyST tags. A cell tagged raises-exception,
  which a lecture uses to show an error on purpose (jax_intro_jax's
  a[0] = 1), counts as an expected error, not a failure, in all_ok.

Co-Authored-By: Claude Opus 5.5 <[email protected]>
…he Threadripper and the M6

The first part of #4: 28 lectures with code, as written, three runs each,
timed per cell. The M6 runs 21 faster than the card, 20 of them by more
than 2x; the card wins the seven built on one large vectorised
computation, and over the whole set, 873 s to 1,256 s.

Adds summarise_whole.py, the drivers and the results, with a README.

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

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 is a large empirical data contribution whose correctness depends on the run_lecture.py/summarise_whole.py code changes referenced in the description but not presented in the reviewed diff, so a human should verify the full change set.

No open issues 🎉

What changed in this PR

This PR adds the first part of #4: every lecture in lecture-jax (at commit 4b939ec) run "as written" in a fresh process and timed cell-by-cell, three times each, on qe-wharton1-gpu's TITAN RTX and Threadripper 2990WX and on qe-mini1's Apple M6. It fits the repository's existing "lectures, run as used" methodology (alongside the aiyagari_jax/ifp_egm_jax studies), extending it from single lectures to the whole lecture set to answer which lectures run faster on a CPU than on the GPU they are built on.

Changes:

  • Adds the driver scripts and lecture list used to produce the runs (lectures_set.sh, mac_lectures.sh, lectures.txt), mirroring the existing mac_set.sh pause/resume convention.
  • Commits the per-run result JSON (174 runs from qe-wharton1-gpu, 87 from qe-mini1) plus each host's environment.txt and qe-mini1's state.txt.
  • Updates lectures/README.md to point at the new whole/ set and its results path.

Note: the PR description also references changes to lectures/run_lecture.py and lectures/whole/summarise_whole.py, but those files' diffs were not part of the changed-file set presented for review; I read them only as context to confirm the driver scripts invoke them correctly.

File Description
lectures/​whole/​lectures_set.sh Per-platform driver: runs each lecture in lectures.txt via run_lecture.py --dtype as-written, one-hour perl alarm cap, writes JSON/err per run.
lectures/​whole/​mac_lectures.sh qe-mini1 wrapper that SIGSTOPs agents/wallpaper, records state.txt, then calls lectures_set.sh; resumes on EXIT.
lectures/​whole/​lectures.txt The 29 lecture names driving the runs; matches the committed result directories exactly.
lectures/​README.md Adds the whole/ row to the results table and documents the whole-lecture results path (also fixes a leading-whitespace glitch).
lectures/​results/​qe-wharton1-gpu/​.../​whole/​**/​*.json Card + Threadripper per-cell timing results (intentionally committed per .gitignore).
lectures/​results/​qe-mini1/​.../​whole/​**/​*.json Apple M6 per-cell timing results.
lectures/​results/​*/​.../​whole/​environment.txt Pinned package lists for each host's environment.
lectures/​results/​qe-mini1/​.../​whole/​state.txt Machine state before/paused/after the M6 run.

Review effort: Balanced

@mmcky
mmcky merged commit 736a9ee into main Oct 25, 2026
1 check passed
@mmcky
mmcky deleted the whole-lectures branch October 25, 2026 09:08
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