贡献 / #1693
#1693 setup: the page-file warning advises a fixed size, and says why when Windows is set to grow the file (#60)
open · @sergqwer · 0 评论 · 去 GitHub 看
Setup & installServer & APINVIDIA / CUDADocumentationWindowsLinux
说明
Step 1 warns when Windows' page file is below 4 GB (issue #60) and advises `Set it to "System managed"`. In #60 that advice did not help:
- the reporter set "System managed", then a custom 4096-32768 MB, and still got the same `cudaMalloc ... out of memory`;
- the engine started once the page file had a fixed 64 GB limit.
A page file that Windows grows on demand may not grow in time while WDDM charges the card's memory to the commit. Microsoft's [sizing page](https://learn.microsoft.com/en-us/troubleshoot/windows-client/performance/how-to-determine-the-appropriate-page-file-size-for-64-bit-versions-of-windows) says a system-managed file grows "when the system commit charge is more than 90 percent of the system commit limit", which is after the fact for one large allocation.
This is mostly a text change. The 4 GB threshold and the size step 1 measures stay as they are.
**Change** (`setup.py`, two doc rows, a new test file):
- The warning advises a fixed size: Custom size, the same initial and maximum size, 65536 MB (`PAGE_FILE_FIXED_MB`, the fixed 64 GB that worked in #60), then restart. It no longer advises "System managed".
- `page_file_setting()` reads the Virtual memory setting. That is `PagingFiles` under `HKLM\SYSTEM\CurrentControlSet\Control\Session Manager\Memory Management`, which needs no admin; `?:` (every drive automatic) is the drive `ExistingPageFiles` names.
- It is used only for the advice. When a file is system-managed, or its initial size is below its maximum, the warning says the file grows on demand and that a growing page file may not keep up (#60).
- `page_file_gb()` still counts only what is there for sure:
- the commit limit minus RAM, as before;
- or a file's configured initial size, when that is larger than the file is now (within its drive's free space).
- Never the maximum, and never what a system-managed file may grow to. When the setting cannot be read it is the commit limit minus RAM alone.
- `docs/AI_SETUP.md` and `docs/DETAILS.md` (the `ExpertCache: cudaMalloc(...) failed` rows) give the same advice.
- `tools/strata_mcp.py` keeps calling `page_file_gb()` and reports the same number as before.
**Before / after.** Step 1 runs under `--check` through `tools/test_setup_golden.py`'s harness, with the page-file reading done as on Windows. The registry, the drives and GlobalMemoryStatusEx are mocked in every row except the first. The same script ran against fb58e0db and this branch:
| PC | page files | fb58e0db | this PR |
|---|---|---|---|
| RTX 5090, 127.2 GiB RAM (real registry, drives, commit limit) | C: and D:, fixed 64000 MB each | 125.00 GB, no warning | 125.00 GB, no warning |
| 32 GB PC (31.9 GiB, the harness's `32GB-2x24GB`) | system-managed (`?:`), now 4083 MB | 3.99 GB, `Set it to "System managed"` | 3.99 GB, `It is set to grow on demand ... may not grow in time ... Set a fixed size ... 65536 MB` |
| same | custom 1024-32768 MB, now 1024 MB | 1.00 GB, `Set it to "System managed"` | 1.00 GB, the same "grows on demand" text and the fixed size |
| same | fixed 2048 MB | 2.00 GB, `Set it to "System managed"` | 2.00 GB, `Set a fixed size ... 65536 MB` |
| same | off (`PagingFiles` empty) | 0.00 GB, `Set it to "System managed"` | 0.00 GB, `Set a fixed size ... 65536 MB` |
| same | system-managed, now 8192 MB | 8.00 GB, no warning | 8.00 GB, no warning (the threshold is unchanged) |
The new warning on the system-managed PC:
```
[!] Windows' page file is 4.0 GB: the graphics card's memory needs room there too (issue #60), so the model may not start or may use less VRAM. It is set to grow on demand ("System managed" or an initial size below the maximum), and a growing page file may not grow in time for the card's memory (#60: "System managed" and 4096-32768 MB still failed, a fixed 64 GB worked). Set a fixed size: System > About > Advanced system settings > Performance > Advanced > Virtual memory > Change, untick "Automatically manage", Custom size with initial and maximum size 65536 MB, Set, then restart Windows
```
**Tests.** The new `tools/test_setup_page_file.py` has 10 tests:
- the entry forms;
- the reading: a growing file counts at its size now, a larger configured initial size counts within the free space, the file off, the setting unread, off Windows;
- the advice: always a fixed size, and the "grows on demand" sentence only when the setting has Windows grow a file;
- step 1 under `--check` on the harness's 32 GB PC: system-managed, a fixed 2048 MB file and none are warned; 8 GB system-managed and a fixed 64000 MB are not.
It uses mocks only, so it runs on Linux as well. `python -m unittest discover -s tools -p "test_setup*.py"` gives 418 OK on fb58e0db and 428 OK on this branch (Windows 11, Python 3.12). `tools.test_strata_mcp` gives 24 OK.
**Not changed:**
- The 4 GB threshold. A system-managed file that is 4 GB or more now is still not warned about, although #60's PC failed with a system-managed one. #1607 proposes replacing the threshold with a check against the model's needs.
- The engine's own retry with a smaller cache.
**Not measured:** a real PC with a system-managed or growing page file. The page files here are fixed, and changing them needs admin and a restart.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
https://claude.ai/code/session_01VZy1yKaDDiA8a7svdwaHio
本站相关内容
相关页面的快捷入口。