改动 / #3276
#3276 [Other] setup: calibrate a dual config whose gpu is the string 0,1
open · @MEsfits · 0 评论 · 去 GitHub 看
Setup & installServer & APIMulti-GPUAMD / HIPNVIDIA / CUDAWindowsLinux
说明
## Problem and result
Setup's calibration of a dual config whose `"gpu"` is the string form `"0,1"` (accepted and split by serve) dies after all measurement rounds with `[X] there is no GPU 0,1: 0 = NVIDIA GeForce RTX 3090 Ti, 1 = NVIDIA GeForce RTX 3090`. Nothing is saved, because the hardware key the rounds are stored under cannot be computed.
`hardware_key()` passed the raw value to `gpu_info()`, which matches one card by number (`x["index"] == pick`), so the string matched nothing. List-form duals (`[0, 1]`) worked; only the string form died. `recommend_remote_expert_opt()` had the same blind spot: its `isinstance(cfg.get("gpu"), list)` check skipped string-form duals, so they never got the helper-cache recommendation.
After the fix the same config keys and calibrates exactly like the list form.
## Related discussion
Fixes #3275. The identical fix was sent earlier for the 0.1.45 line (#2378) and did not land; the 0.2.0 tree still had the pre-fix line. Focused bug fix, no scope agreement needed.
## Approach
- `gpu_sel(value)`: a config's `"gpu"` as a list of card numbers -- `0`, `[0, 2]` and the string form `"0,2"` (which serve splits the same way); `[]` when it names none.
- `hardware_key()`: string-form selectors go through `gpu_sel()` before `gpu_info()`.
- `recommend_remote_expert_opt()`: `len(gpu_sel(...)) < 2` instead of the `isinstance(..., list)` check.
- Regression test in `CalibrationKey`: `"0,1"` keys exactly like `[0, 1]`; `gpu_sel("0,1") == [0, 1]`, `gpu_sel("0") == [0]`.
The NVIDIA key format is unchanged (the existing test asserts it). No behavior change outside setup; serve and the engine are untouched.
## Validation
**Passed:**
- `python -m unittest tools.test_setup_amd.CalibrationKey` on 3f52b2d7 (0.2.0 tree, e88ee39d) -- 8/8 tests OK, including the new `test_nvidia_string_dual_keys_like_the_list`.
- Real dual config on 2x RTX 3090 (3090 Ti + 3090), Ubuntu 26.04, engine 0.1.45.3: `hardware_key(cfg)` with `"gpu": "0,1"` now returns `NVIDIA GeForce RTX 3090 Ti + NVIDIA GeForce RTX 3090|48GB|AMD Ryzen 7 9800X3D 8-Core Processor|59GB|<model>|262144|images`; before the fix the same call died with `there is no GPU 0,1`.
**Failed:**
- none observed
**Not run:**
- Full calibrate round-trip after the fix (the failing call itself is covered; the re-run on the reporting box is the next check).
- No engine rebuild: the change is `setup.py` only (pure Python); CUDA/HIP/SYCL/CPU binaries are untouched.
## Limits
- Executed on Linux/NVIDIA only; the code path is platform-agnostic but Windows and macOS were not run.
- Only `hardware_key()` and `recommend_remote_expert_opt()` are covered; the other `gpu_info()` callers already pass card numbers.
本站相关内容
相关页面的快捷入口。