Repository navigation
site-build: the GPU leg; programming joins the base environment - #87
Conversation
Step 3 of bringing the sites into one environment for every site (QuantEcon/project-monorepo#77), by the owner's order of 2026-11-22: intro, then advanced, then the GPU sites, programming first. A site on the g4dn.2xlarge class now builds on a RunsOn machine with one NVIDIA T4, from QuantEcon's GPU machine image (by the AMI ID the GPU series' own runs-on.yml gives), with no container, and in the base environment alone. In the shape the owner chose on 2026-11-22, the one the environment scan of 2026-11-19 proved: setup-miniconda creates _base/environment.yml (Python 3.13 and anaconda=2026.07, the full image's base), conda env update applies _base/environment-update.yml, and jax[cuda13] at the list's jax version is added, with a check that jax finds the GPU. tools/site-matrix gives each entry its leg and RunsOn machine spec, builds RunsOn's label from --run-id, and refuses a GPU site outside the base environment. The job's container is empty for a GPU site. Its cache key hashes the machine spec and _base/environment.yml in place of the image's marker file. Stage and unstage run in a login shell, where the GPU machine has the environment's python. _base/environment-update.yml is untouched, so intro's and advanced's caches keep their keys. The READMEs name programming and the GPU leg. Three stale lines from the reviews of #85 and #86 are corrected on the way: the count of sites still to move in sites/README.md, the root README's "dp alone", and the workflow's "(dp publishes HTML alone)". Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WT8bMacV9Lmy1VLUc6XJoL
Validation: programming built from the pool on the GPU leg, against programming's own buildsBuilds compared, all of programming's
The GPU leg's environment. setup-miniconda created Noise baseline. programming's two own builds differ on 13 of 31 pages: random draws, memory addresses and object identities, timings and download progress. This pull request's build differs from the first on 15 pages: the same 13, plus two where every difference is explained.
On the 13 noise pages, every line that differs is a random value, an address, a timing or install output, as between programming's own two builds. The status page differs only in its times. One file only programming's build has: Warnings. The build log has no Sphinx warning; its only warning lines are Node.js deprecation notices from GitHub's own actions. The cell outputs carry the same warnings and tracebacks as programming's own build, page by page. These are the lectures' own demonstrations: names lists the built-in names, the warning classes among them, and debugging, numpy, oop_intro, python_advanced_features and python_essentials raise errors on purpose. The other legs. intro and dp restored their execution caches under unchanged keys, with every page taken from the cache. So the string form of |
There was a problem hiding this comment.
🟢 Approval recommended
No active review issues block approval of the GPU build and shared-environment changes.
No open issues 🎉
What changed in this PR
Adds a GPU build leg to the shared site-build workflow and moves programming into the common base environment, following intro and advanced.
Changes:
- Adds RunsOn GPU runner support, Conda environment setup, and CUDA-enabled JAX with a GPU check.
- Enables programming’s strict HTML build and GPU-specific execution cache keys while preserving CPU cache keys.
- Extends matrix tests and updates documentation for the four enabled sites.
| File | Description |
|---|---|
tools/tests/test_site_matrix.py |
Tests GPU matrix entries, invalid configurations, and workflow run-ID forwarding. |
tools/site-matrix |
Adds GPU runner settings and run-ID validation. |
sites/README.md |
Documents GPU builds, environment selection, and caching. |
sites/programming/site.yml |
Selects the shared base environment for programming. |
README.md |
Updates the build overview to include all four enabled sites. |
.github/workflows/site-build.yml |
Adds GPU setup, CUDA verification, cache handling, and programming builds. |
_base/README.md |
Explains the GPU base environment and shared package list. |
_base/environment.yml |
Defines the GPU base with Python 3.13 and Anaconda 2026.07. |
Review effort: Balanced (adaptive)
The organiser's review of #87; the owner chose "Fix the channel, then merge". _base/environment.yml named the channel `default`, copied from programming's environment.yml. That is the anaconda.org user channel "default", empty today, which conda would search first; the Anaconda channels are `defaults`. The GPU leg's cache key hashes this file, so programming's key changes. Wording: the base environment's container and root-user notes say they are the container leg's; extra_packages go into "the environment jb runs in"; sites/README's environment row names the GPU leg; _base/README no longer hard-codes the jax version the workflow reads from the list. The cache-key step tests the leg, as the other steps do. _base/environment-update.yml's own comment still names 0.12.1: the base cache key hashes that whole file, so it waits for the plotly-orca pull request. Co-Authored-By: Claude Opus 5.5 <[email protected]> Claude-Session: https://claude.ai/code/session_01WT8bMacV9Lmy1VLUc6XJoL
Validation of
|
The fourth step of the site builds in Matt's order of 2026-11-22 (intro, advanced, then the GPU sites: programming, intermediate and jax): intermediate builds from the pool on the GPU leg, in the base environment, as programming does since #87. ## What changes - **`sites/intermediate/site.yml`** gains `environment: base`. On the GPU leg that means `_base/environment.yml` is created on the RunsOn machine, `_base/environment-update.yml` is applied, and `jax[cuda13]` is added at the list's jax version. - **`site-build.yml`**: `SITES` gains `intermediate`, and the header and the GPU leg's notes name it. jax is the one site left. - **The job's time limit.** `tools/site-matrix` gives each leg `cell_timeout` plus an allowance for a build from an empty cache. intermediate's own builds from an empty cache took 128 to 139 minutes in November 2026 (twelve `cache.yml` runs), so the old allowance of 120 minutes would have left intermediate a limit of 160, about 20 minutes above its slowest build. The allowance is now 150 minutes, so intermediate's limit is 190 minutes. The limit is only a ceiling: it changes no key and no build, and costs time only on a hung job. The tests follow. - **The docs**: `README.md`, `sites/README.md`, `_base/README.md` and the list's header name the five sites built. ## Checks before this pull request - **The machine image.** The AMI in `tools/site-matrix`, `ami-0edec81935264b6d3`, is the one the three GPU series' `.github/runs-on.yml` name: QuantEcon/lecture-python.myst, QuantEcon/lecture-jax and QuantEcon/lecture-python-programming, read 2026-11-26. intermediate's own fresh builds today ran on it. - **The text.** By the ledger, intermediate is the canonical source of 156 of the 157 pool lectures its table of contents lists. The other, `pandas_panel` (canonical in programming), has the same text as intermediate's copy. So the site's lecture text is intermediate's own at its pin, `eb06599`. - **The installs.** `tools/pool-check --installs` lists no install that would replace a pin. The `--upgrade jax` in `kesten_processes` was removed upstream (QuantEcon/lecture-python.myst#1135). - **The cache.** The list's header edit is a comment. Since #98 the base key hashes only the list's entries, so intro, advanced and programming should restore their caches; this is the first test of that. ## Validation (to follow, in a comment) This pull request's intermediate leg builds from an empty cache, about 2.5 hours on the T4. It will be compared page by page with intermediate's own fresh builds of `eb06599` from today: [QuantEcon/lecture-python.myst 45766690882](https://github.com/QuantEcon/lecture-python.myst/actions/runs/45766690882), and a second for the noise baseline, [QuantEcon/lecture-python.myst 45804060322](https://github.com/QuantEcon/lecture-python.myst/actions/runs/45804060322). The comparison covers log warnings, cell-output warnings and errors, in-cell installs and every page with its figures. It adds a per-page GPU check: every lecture that uses jax ran it on the GPU, as in intermediate's own builds, with no fallback to the CPU. Copilot: not requested (Matt, 2026-11-22). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01WT8bMZxoF4m8xKRb8BcHnG
The last step of the site builds in Matt's order of 2026-11-22 (intro, advanced, then the GPU sites: programming, intermediate and jax): jax builds from the pool on the GPU leg, in the base environment, as programming (#87) and intermediate (#99) do. With it, `site-build.yml` builds all six sites. ## What changes - **`sites/jax/site.yml`** gains `environment: base`. On the GPU leg that means `_base/environment.yml` is created on the RunsOn machine, `_base/environment-update.yml` is applied, and `jax[cuda13]` is added at the list's jax version (0.12.1, the version jax's own workflows pin). Its other fields, re-read at lecture-jax `3431f12` (the pin) on 2026-11-27, are unchanged. - **`site-build.yml`**: `SITES` gains `jax`, and the header and the GPU leg's notes name it. - **The time limit** needs no change: jax's `cell_timeout` is 2400 seconds, so its limit is 40 + 150 = 190 minutes, against its own builds from an empty cache of 20 to 23 minutes (the ten `cache.yml` runs in November 2026 before this pull request; an earlier version of this description said eight). - **The docs.** With jax in, the base sites are every site but dp, so `README.md`, `sites/README.md`, `_base/README.md` and the list's header say that, instead of listing the sites in each place. intermediate's build times now stay in `tools/site-matrix` alone, with jax's added beside them; `sites/README.md` points there. - **The organiser's nits on #99**, in the lines this edits anyway: the list's header names #99 and this pull request; the stray `names, with` line in `site-build.yml`'s notes is rewrapped; and `tools/site-matrix`'s AMI note says when it was last read. ## Checks before this pull request - **The machine image.** The AMI in `tools/site-matrix`, `ami-0edec81935264b6d3`, is still the one the three GPU series' `.github/runs-on.yml` name (QuantEcon/lecture-jax, QuantEcon/lecture-python.myst and QuantEcon/lecture-python-programming), read 2026-11-27. - **The text.** By the ledger, jax is the canonical source of 27 of the 28 pool lectures its table of contents lists. The other, `autodiff` (canonical in programming), has the same digest as jax's copy. So the site's lecture text is jax's own at its pin, `3431f12`, which is lecture-jax's main. - **The installs.** `tools/pool-check --installs` lists no install that would replace a pin. jax's lectures install `quantecon`, `keras`, `optax` and `jax` in their cells, and all four are in the list. In jax's own builds those cells fetch the newest releases, so a version difference shows up in the comparison, not as a failure. - **The cache.** The list's header edit is a comment. Since #98 the base key hashes only the list's entries, so the other base sites restore their caches, as on #99. - Locally: tests 330 passed and 1 skipped; pool-check clean; `tools/site-matrix` gives jax the GPU leg, the base environment and 190 minutes; actionlint clean. ## Validation (to follow, in a comment) This pull request's jax leg builds from an empty cache. It will be compared page by page with two fresh builds of jax's own site at `3431f12`, dispatched today: [QuantEcon/lecture-jax 45901655935](https://github.com/QuantEcon/lecture-jax/actions/runs/45901655935), and a second for the noise baseline, [QuantEcon/lecture-jax 45901668136](https://github.com/QuantEcon/lecture-jax/actions/runs/45901668136). The comparison covers log warnings, cell-output warnings and errors, in-cell installs and every page with its figures. It adds a per-page GPU check: every lecture that uses jax ran it on the GPU, as in jax's own builds, with no fallback to the CPU. Copilot: not requested (Matt, 2026-11-22). 🤖 Generated with [Claude Code](https://claude.com/claude-code) https://claude.ai/code/session_01WT8bMZxoF4m8xKRb8BcHnG
What
Step 3 of bringing the sites into one environment for every site (QuantEcon/project-monorepo#77), in the owner's order of 2026-11-22: intro (#84), advanced (#86), then the GPU sites, programming first. This writes the GPU leg and builds programming's site on it.
The GPU leg's shape is the owner's choice of 2026-11-22: "The scan's shape (Recommended)", that is, "setup-miniconda with python=3.13 + anaconda=2026.07 on the RunsOn machine, then the list, then jax[cuda13]==0.12.1 with a GPU check; the design note revised to match". The environment scan of 2026-11-19 built all three GPU sites in this shape with nothing new. It gives a GPU site the same environment as a CPU site: the RunsOn machine image's own Conda environment has no
anacondametapackage, so updating that one with the list (the design note's first plan) would not have.tools/site-matrixg4dn.2xlargeclass has a leg. Each entry gainsleg(containerorgpu) andmachine(RunsOn's spec:family=g4dn.2xlarge/ami=ami-0edec81935264b6d3/volume=80gb/spot=false, the AMI the GPU series' own.github/runs-on.ymlnames). A GPU site'sruns_onis RunsOn's label,runs-on=<run ID>/<machine>, from the new--run-id, and itsimageis empty. A GPU site outsideenvironment: baseis refused..github/workflows/site-build.ymlcontainer: ${{ matrix.site.image }}, empty for a GPU site, so its job runs on the machine. Three GPU steps: setup-miniconda creates_base/environment.yml;conda env updateapplies_base/environment-update.yml; thennvidia-smi,jax[cuda13]at the list's jax version, and a check thatjax.devices()is a GPU. A GPU site's cache key hashes the machine spec and_base/environment.ymlin place of/etc/quantecon-container. Staging and unstaging run in a login shell, where the GPU machine has the environment'spython.SITES: dp intro advanced programming. Comments updated._base/environment.ymlanaconda=2026.07, as the full image carries it.sites/programming/site.ymlenvironment: basetools/tests/test_site_matrix.pysites/README.md,_base/README.md,README.md_base/environment-update.ymlis not touched, so intro's and advanced's caches keep their keys. The job limit for programming is 130 minutes (cell_timeout600 s plus 120). It builds HTML alone for now.Validation
Done on 2026-11-22; the evidence is in the comment below. Programming's leg builds green and strict on the RunsOn GPU machine, with no container, in 7 minutes. jax 0.12.1 finds the T4, every page with code is executed, and all 39 pins are installed with
jax[cuda13]on top. Against two fresh builds of programming's own atbae31ee, every difference beyond their noise is install output or the working directory a cell prints. The cell-output warnings are the same, and the build log has no Sphinx warning. The container legs still build: intro and dp restored their caches under unchanged keys, and advanced built cold and green.🤖 Generated with Claude Code
https://claude.ai/code/session_01WT8bMacV9Lmy1VLUc6XJoL