Simulator assumptions vs a real GPU (L5)¶
Measured on the development machine on 2026-10-28:
- GPU: NVIDIA GeForce RTX 4050 Laptop GPU, 6141 MiB. The display runs on the Intel iGPU;
kwin_waylandholds 7 MiB of the NVIDIA GPU. - Containers and OS: Docker 29.9 with the NVIDIA runtime, cgroup v2 (systemd driver), Fedora 43 with SELinux enforcing.
- Workload: the memory hog
docker/hog/hog.py, which allocates GPU memory in 64 MiB chunks through the CUDA driver API. - What this is: a demonstration, not a benchmark. The Engine ran with the default
Configof each run's commit. - Evidence: each run's
run.jsonl(every event, action, probe sample and exit classification) andscenario.json.examples/check_run_log.pychecks the gates on them; its output for the three runs is incheck-output.txt. The hogs' raw container logs are not published; the lines used here (for example the OOM message) are also inrun.jsonl.
Runs¶
| Run | Commit | Staged | Result |
|---|---|---|---|
staged-20261028-103628 |
e15b99e (orig. c0c0c0e) |
yes | All three gates pass. But see the harness bug below: the Rule V trigger in this run came from inflated foreign usage. |
unstaged-20261028-121757 |
c0e52d0 (orig. 8dca1f2) |
no | 4/4 SUCCEEDED, makespan 460 s. 0 OOMs, 0 vacates, 1 Overcommitted warning. Probation serialized every ramp. |
staged-20261028-122553 |
c0e52d0 (orig. 8dca1f2) |
yes | The rerun with the harness fixed. All three gates pass. One vacate (t=192), with no second vacate. All jobs SUCCEEDED, makespan 766 s. |
preempt.json |
f30f501 (orig. 67d7594) |
— | Start-up and preemption latency: 20 samples. |
Aborted run (not reported). One unstaged run (unstaged-20261028-121658) was stopped after about 30 s, when the harness bug was found. Its results were not read. Its log is not committed.
Harness bug, found in the first staged run and fixed in c0e52d0 (example code, not rampgate).
- What happened: docker_gpu_queue.py fed each sample's DeviceObserved before that sample's JobObserved. rampgate infers foreign usage at a DeviceObserved from the jobs' latest usage. So while a job was growing at 256 MiB/s, its growth since the previous sample was counted as foreign: 679–807 MiB instead of the real 423 MiB.
- In the staged run: this put U at t=190 at 6091 MiB, over the 6018 MiB threshold. With the real foreign usage it was 5707 MiB, under the threshold. Rule V would still have fired as Y kept growing (U reaches 6475 MiB at Y's full peak), but one or two growth steps later.
- What it affected: the trigger moment. It also caused a ForeignUsageHigh warning that held Y's restart for 8 s.
- The record: the first staged run stays as recorded. The rerun with the fix is staged-20261028-122553.
- Lesson for integrators: feed per-job observations before the device total of the same sample. This should go into the adapter docs and the integration guide.
Assumptions¶
| # | Simulator assumption | Measured on the real GPU | Effect on rampgate | Follow-up |
|---|---|---|---|---|
| 1 | Sampling. A job's usage is exactly its workload's usage, observed every dt = 1 s. |
NVML's per-process usage = the hog's allocation + 82 MiB of CUDA context, in all 20 preempt.json samples and in every run. Device and process numbers came from one NVML read per second. |
The context is part of what a job needs, so counting it is right. It also means a tiny job never needs less than about 80 MiB. Allocations shorter than the sampling interval are invisible; that wasn't tested here. | Record the context overhead per device kind. Test sub-second spikes in the CPU/TrainQ device work. |
| 2 | Foreign usage is a configured load. | NVML's used (v1 API) includes 371 MiB of driver-reserved memory. nvidia-smi reports that reserved memory separately. Same-sample foreign usage was 410–423 MiB in every run, steady. |
It's handled correctly as foreign. It only gets inflated when the device total and the job samples come from different instants (harness bug above). | Document the observation order (above). Consider reading device and process memory with NVML's v2 API. |
| 3 | Start-up start_delay_s = 15 (container, CUDA init, imports). |
Start → JobStarted (Docker start event): 0.19–0.25 s. create → hog visible in NVML: 0.31–0.47 s. → full allocation: 0.53–0.84 s. |
The simulator overstates start-up cost for this hog. A real trainer adds imports and framework init: seconds to tens of seconds, not measured here. The 15 s is not contradicted for real frameworks. The hog is just much lighter. | Measure with a real PyTorch image before tuning start_timeout_s. |
| 4 | Preemption. On Stop(PREEMPT) (SIGTERM) the job saves a checkpoint (rampgate itself saves nothing) and exits after ckpt_save_s = 10, and the memory is freed at exit. |
SIGTERM → container exit: 0.22–0.27 s with no save, 2.22–2.34 s with the hog's 2 s save. SIGTERM → memory freed in NVML: 0.12–0.18 s with no save, 2.12–2.20 s with the save. Memory is freed when the process is gone, slightly before Docker reports the exit. Exit code 143 in all 20 samples. | Confirmed: preemption costs the job's own save time plus about 0.15 s, and the memory comes back at once. Rule V's "preempt is cheap" holds for the memory side. Two cautions. A job keeps its memory for its whole save time; the hog stops allocating on SIGTERM, but a real job might not. And rampgate learns the exit about 0.1 s after the memory is free, so in that window the freed memory isn't yet attributed to anyone. | None for L5. The save-time growth case is already covered by the "Rule V vacates STABLE jobs only" rationale. |
| 5 | OOM. When a device overflows, the job whose usage grew most recently is killed with OOM, and the OOM is always detected. |
Staged run: A grew next to the STABLE neighbour Y, while Y kept allocating and freeing 128 MiB every 6 s. A died (cuMemAlloc of 64 MiB failed while holding 2176 MiB), exit code 1, OOMKilled false. classify_exit labelled it OOM from the log line CUDA out of memory. Rule O grew A's estimate (1282 → 2662 MiB), and A's next attempt succeeded. The neighbour was not blamed. Rerun: the same outcome. A died at t=421 holding 2176 MiB, was classified OOM, and Rule O grew A's estimate from 1282 to 2725 MiB. That is 2 samples, both with the same timing design. |
The simulator's model matched in this sample. On a real GPU only the process whose allocation fails gets the error. That's usually the grower, but a neighbour allocating at the wrong moment can be the one, and then Rule O would grow the innocent job's estimate and requeue it. This wasn't observed, but nothing in rampgate prevents it. Detection also depends on the job printing a recognisable message: there is no OOMKilled for GPU memory. |
Design risk (v0.2, not fixed in L5): when an OOM'd job had been STABLE and not growing, while a WARMING neighbour on the same device grew in the last seconds, attribute the OOM to the grower. Grow the grower's estimate as well, or instead, and mark the victim's exit as LOST-like (no estimate change). Needs a simulator mode where the failing allocation, not the most recent growth, picks the victim. |
| 6 | Vacate estimate. After Requeue(VACATED), the job waits until its estimate fits. |
Staged run: Y was vacated at t=190 while still growing (STABLE, reservation rising through UpdateReservation). Its requeue estimate was its peak at that moment, 2898 MiB, a lower bound of its real peak (about 3540–3670 MiB). It restarted next to X at t=201 and was vacated again when it became STABLE at t=276. The second estimate, 3538 MiB, was right, so it then waited for X. Rerun, with the harness fixed: Rule V fired at t=192 (U = 2386 + 3538 + 423 = 6347 > 6018), while Y was at 3538 MiB, still about 128 MiB below its final peak. That estimate was close enough that Y waited for X (restart at t=302), and there was no second vacate. The first run's churn was made worse by the harness bug's early trigger (Y was vacated 640 MiB below its peak). The mechanism remains: a vacate during growth leaves a lower-bound estimate. |
Vacate churn: a job vacated mid-growth restarts too early and is vacated again. It costs a restart and its warm-up each time. The simulator didn't show this: in the simulator the same rules apply, but its scenarios rarely vacate a job that is still growing. | v0.2: when Rule V vacates a job whose peak grew in its last stable_window_s, record the vacate peak as a lower bound (so it grows by oom_growth, like an OOM's). Add a simulator scenario with growth after STABLE next to an old peak. |
| 7 | Exit classification. The simulator reports ExitKind directly. |
Every exit in the runs was classified as intended: 143 after a requested stop → PREEMPTED, 0 → SUCCESS, 1 with CUDA out of memory → OOM. |
The adapter's job, and it worked. A script that exits 0 on SIGTERM would be recorded as SUCCEEDED (Lifecycle), so the hog exits 143. | Say this in the adapter docs (already in rampgate-docker's README). |
| 8 | Stability (Rule S). Jobs report steps and epochs, or are judged on time alone. | The hogs report neither. Rule S ran on time alone: STABLE 60–75 s after the last growth. u2-eval's two eval spikes, at 60 s and 120 s, restarted the quiet window, so it took 121 s. |
As designed. A job that doesn't touch the GPU for its first 60–90 s would be marked STABLE with a near-zero reservation: nothing in rampgate sees a ramp that hasn't started. | Integration guide: report steps when possible, so Rule S's step gate applies. |
What the real runs did not test¶
- Several GPUs, gang jobs, CPU devices, and the cgroup/CPU-RAM variant (deferred to the CPU device work).
- A real framework: PyTorch's caching allocator holds freed memory, so NVML would show its reserved memory, not what it allocated.
- Restarts of the orchestrator during a run (dump/load against real containers).
- Sub-second allocation spikes.