Pull requests / #2548
#2548 calibrate: an engine that stops while a later step measures it drops that candidate, not the run (#2313)
open · @qiuzan2001 · 0 comments · View on GitHub
Setup & installAMD / HIPWindowsLinux
Description
Fixes the calibrate side of #2313 (who sent the engine its SIGTERM is not known and not touched here).
**What it changes.** In `tools/calibrate.py` a later step's engine that fails to *start* already costs only that
candidate (#1337, `restart()`). An engine that started and then stopped *while it was measured* (`EngineDied`; in
#2313 exit code -15 during the 4-worker step) still ended the whole calibration: setup printed "the tuning did not
finish" and the PCIe share, draft floor and worker counts measured before were lost. Now, in the worker step and the
expert-tier step, a measurement that raises is said (`measuring 4 workers failed: the engine stopped unexpectedly
(exit code -15) - this candidate is dropped, the earlier results are kept`), noted in `report["failed_runs"]`, and
that candidate is dropped; the step's choice is made from the candidates that finished, and when the default's own
run failed the default stays.
`close()` also closes the pipe to an engine that has gone after the failed `QUIT` write, so Python no longer prints
`Exception ignored while finalizing file ... BrokenPipeError` later (the traceback in the issue).
**What it leaves alone.** Every run where no engine stops: the same measurements, choices and output. An engine that
stops during the first sweep (steps 1-3, one engine start) still ends the run, as before: nothing is measured yet.
`setup.py`'s `calibrate_config` is unchanged (it reads only `settings` and `tok_s`). This PR and #2544 (also
`tools/calibrate.py`, #2465) touch different lines of `measure()`.
**How it was checked.**
- `tools/test_calibrate.py`:
- `test_an_engine_that_stops_while_measured_only_drops_that_candidate_2313`: a stand-in engine raises `EngineDied`
in the 4-worker run and in the 80-swap tier run; the PCIe share and the 3-worker win survive, both failures are
in `failed_runs`. On `main` the run ends with `EngineDied`.
- `test_close_an_engine_that_has_gone_2313`: `close()` on a real child process that has exited leaves stdin
closed and nothing for `sys.unraisablehook`. On `main` the pipe stays open.
- `python3 tools/test_calibrate.py`: 19 tests OK.
- Python 3.14, Ubuntu (Linux 7.0); no GPU needed (stand-in engines). Not run on the reporter's HIP eGPU, nor on Windows.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Related on this site
Quick links to related pages.