Repository navigation
fix(sweep): 🐛 multi-GPU on Leonardo: survive pool fragmentation, 89% efficiency at the reference size - #60
Open
Panadestein wants to merge 6 commits into
Open
Panadestein wants to merge 6 commits into
Panadestein wants to merge 6 commits into
Conversation
Contributor
Test Results 5 files 5 suites 3m 7s ⏱️ Results for commit fb1b213. ♻️ This comment has been updated with latest results. |
Contributor
There was a problem hiding this comment.
🟡 Changes recommended
Result concatenation can reintroduce OOM, and removed Ruff suppressions will fail linting.
3 open findings
What changed in this PR
Improves sweep resilience to fragmented GPU memory and records Leonardo multi-GPU results.
Changes:
- Retries failed kernels using smaller batches.
- Adds QR-based accuracy measurement and Leonardo benchmark evidence.
- Documents memory handling and removes obsolete plans.
| File | Description |
|---|---|
src/src_method/_sweep.py |
Adds adaptive batch splitting. |
src/src_method/utils/_backend.py |
Adds pool-cache release helper. |
src/src_method/utils/__init__.py |
Exports the helper. |
tests/test_stack.py |
Tests split retries and failures. |
benches/large/bench_large.py |
Adds QR distance reporting. |
benches/large/README.md |
Documents Leonardo results. |
benches/large/leonardo/run_multi.sh |
Adds four-GPU job runner. |
benches/large/leonardo/logs/scaling_m1000.jsonl |
Records warm scaling results. |
benches/large/leonardo/logs/scaling_m1000_cold.jsonl |
Records cold scaling results. |
benches/large/leonardo/logs/retry_tests_1gpu_60137742.out |
Records retry test run. |
benches/large/leonardo/logs/retry_4gpu_60137752.out |
Records reference four-GPU run. |
benches/large/leonardo/logs/multi_E_budget_59783330.out |
Records budget comparisons. |
benches/large/leonardo/logs/multi_D_m4000_1gpu_60143214.out |
Records reference single-GPU run. |
benches/large/leonardo/logs/multi_B_m1000_59782618.out |
Records warm scaling run. |
benches/large/leonardo/logs/multi_B_m1000_59776459.out |
Records cold scaling run. |
benches/large/leonardo/logs/multi_A_tests_59776456.out |
Records GPU test results. |
docs/content/docs/features/large-problems.mdx |
Documents OOM splitting. |
docs/superpowers/specs/2026-09-25-src-multi-gpu-design.md |
Removes obsolete design. |
docs/superpowers/plans/2026-09-25-src-multi-gpu.md |
Removes obsolete plan. |
.gitignore |
Preserves benchmark logs. |
🧠 Review effort: Balanced
💡 Add a code-review agent skill or configure MCP servers for context-aware, tailored reviews. Learn more in the docs.
4 tasks done
- Add `leonardo/run_multi.sh`: any command with 4 GPUs in one process, printing the topology and peer-access matrix; `WARM_DIR` reads the stack beforehand. - `scaling` also reports a QR distance over `a - b`, which resolves differences below the sqrt(eps) floor of the inner-product distance. - GPU tests pass (19/19); D_M = 1000 scaling with QR distances below 1e-12. The reference size is queued; its results follow. - Keep `benches/*/leonardo/logs/*.out` in git. Assisted-by: GitHub Copilot:Claude Opus 5.5
The stall timer ends before the upload to the device, so it does not include the split upload or the NVLink gather; it also counts the loader waiting for the GPU. Assisted-by: GitHub Copilot:Claude Opus 5.5
At D_M = 4000, chi_out = 2000 on an A100-64GB, CuPy's pool fragments beyond the margin the plan leaves for it: live memory peaked at 52 GB against the planned 56.7 GB, but the pool held up to 66.7 GB and a 12.6-14.7 GB allocation failed, at a different point in each run. On out of memory, a kernel now releases the pool's cached blocks and computes the batch in halves, joined along the batch axis, keeping the split for the rest of the sweep. The plan and the batches the store reads and writes are unchanged, so the devices need not agree on it. Assisted-by: GitHub Copilot:Claude Opus 5.5
At D_M = 4000, chi_out = 2000: 3925.3 s on one A100-64GB, 1099.9 s on four, a speed-up of 3.57 and an efficiency of 89%. Reading environments back from host memory and disk takes 82-84% of the right-to-left pass. The docs describe the out-of-memory split. The 2-GPU point and the distance at this size are queued. Assisted-by: GitHub Copilot:Claude Opus 5.5
Phase 1 of the plan (#44's own description) called these dead weight. Assisted-by: GitHub Copilot:Claude Opus 5.5
A single-GPU sweep reused any CuPy core in place, so with Resources(devices=[d]) a core on another GPU met environments and sketches on GPU d. Reuse a core only when it sits on the sweep's GPU; stage the others through the host buffer as a group does. Addresses the Copilot review on #44. Assisted-by: GitHub Copilot:Claude Opus 5.5
Panadestein
force-pushed
the
chore/multi-gpu-leonardo
branch
from
October 13, 2026 12:29
0392e7e to
fb1b213
Compare
This branch has not been deployed
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.


🤖 AI text below 🤖
Runs #44 on real GPUs for the first time (one Leonardo Booster node: 4x A100-SXM-64GB, all pairs linked by NVLink) and fixes the out-of-memory error that stopped the reference size. Targets
feat/src-multi-gpu.Results
GPU tests:
tests/test_gpu_backend.py, 19/19 pass, including the five new multi-GPU tests. Peer access is on for every pair of GPUs, so the split-upload path is the one exercised. The fast suite passes on a GPU node too (264 tests).Reference size (D_M = 4000, chi_out = 2000, 50 sites, complex128, 184 GB of input):
This is above the 80% acceptance target. Every run at this size failed before the fix, including #59's single-GPU run on
main. Waiting for environments read back from host memory and disk is 82-84% of the right-to-left pass; with 4 GPUs each GPU reads only a quarter of each environment, so the wait drops 3.65x.D_M = 1000, chi_out = 500:
Full tables, per-GPU numbers and analysis are in the "Several GPUs (Leonardo, 4xA100-64GB)" section of
benches/large/README.md.Changes
fix(sweep): split a batch that runs out of GPU memory.scalingalso reports a QR-based distance over the differencea - b. The inner-product distance cancels down to aboutsqrt(eps)(~1.5e-8), so it cannot show1e-10; the QR distance can.benches/large/leonardo/run_multi.sh: runs any command with the 4 GPUs visible to one process, prints the topology and peer-access matrix, and withWARM_DIRreads the stack beforehand. The logs and JSON lines are committed.large-problems.mdxdescribes the out-of-memory split.docs/superpowers/planning docs, which feat(sweep): ✨ split the SRC sweep among the GPUs of a node #44's own description already called dead weight.Findings for follow-up
Still to add
scaling --devices 4 2run.