Skip to content
KebanFiruPublic

About

ramp + gate: hold each job’s warm-up ramp at the gate, measure what it really uses, then reserve exactly that. An embeddable GPU admission scheduler for ML training.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

rampgate

PyPI CI Python License

ramp + gate: hold each job's warm-up ramp at the gate, measure what it really uses, then reserve exactly that.

rampgate is an observation-based admission scheduler packaged as a small, embeddable, pure-Python library (zero runtime dependencies in the core). It decides when a job may start on a device the caller chose:

  • Probation: at most one warming job per device, so ramp-ups never race.
  • Observed-peak reservation: reserve observed_peak × safety_margin, growing if the peak grows.
  • OOM feedback: an OOM grows the estimate and requeues the job; with a runner that checkpoints, completed epochs are not lost.

Status: alpha, on PyPI. L4 gates: met on the held-out freeze 3 (simulator v2, seeds 3000–3019 for the six original scenarios and 3000–3049 for the family scenarios, tag bench-freeze-3, results). History: failed on the first held-out evaluation (freeze 1, 6 OOMs) and met on the second (freeze 2, seeds 2000–2019) after the fixes listed in Methodology; both were recorded under simulator v1. A further fix round (simulator v2, one admission/accounting charge, allocator granularity) preceded freeze 3.

Install

pip install rampgate            # the core: stdlib only
pip install rampgate-nvml       # NVIDIA GPU probe (NVML)
pip install rampgate-psutil     # host RAM/CPU probe
pip install rampgate-docker     # Docker executor and event watcher

Quickstart

from rampgate import Device, FifoPolicy, Job, MarkStable, Resources, Start
from rampgate.sim import RampPlateau, Scenario, SimJob, simulate

gpu = Device("gpu0", Resources(vram=24))  # GB here; any unit works
ramp = RampPlateau(load_s=20, ramp_s=40, plateau=Resources(vram=9), duration_s=300)
jobs = tuple(SimJob(Job(f"train-{i}", {"gpu0": None}), ramp, submit_at=0) for i in range(3))

trace = simulate(Scenario((gpu,), jobs), FifoPolicy(), max_time=3000)
for tick in trace.ticks:
    for action in tick.decision.actions:
        if isinstance(action, Start | MarkStable):
            print(f"t={tick.now:5.0f}  {type(action).__name__:10} {action.job_id}")
print("OOM kills:", trace.world.oom_count, " finished at t =", trace.ticks[-1].now)

Three jobs ramp one at a time (probation) and are reserved at their observed peaks. The third has no history, so it starts in the room that is left, is OOM-killed once (a first-contact OOM), and is requeued until it really fits (with a runner that checkpoints, completed epochs are not lost). With real devices, drive the same Engine from your own loop: see docs/integrating.md and examples/docker_gpu_queue.py.

Results (simulated)

makespan vs OOM kills per run, freeze 3

In six simulated scenarios (freeze 3, held-out seeds 3000–3019, simulator v2), rampgate had no OOMs except a few first-contact ones (14 over the 120 cold runs, in b_mixed and d_under_declared; none in warm runs) and finished in 0.12–0.71× the makespan of Serial, the other strategy that is OOM-free in every scenario. The price is makespan: warm rampgate took 1.12–1.50× as long as GreedyFree, which OOMs a median of 158–549 times per run in the five scenarios where it OOMs (0 in e_trainq), and it missed its own ≤ 1.2× target in four of six (b_mixed 1.26, c_late_spike 1.42, d_over_declared 1.50, d_under_declared 1.26; met in a_small 1.12 and e_trainq 1.18). All makespan ratios here are ratios of medians. In the TrainQ-like scenario (e), GreedyFree has 0 OOMs and 0 lost work on these seeds, so warm rampgate's 1.18× makespan there is a pure cost: no OOM is avoided.

On six synthetic family scenarios (seeds 3000–3049) all gates passed too: no bug OOMs and no repeat-device OOMs, and the makespan target was met in all six (1.12–1.18).

Freeze 1 and freeze 2 were recorded under simulator v1 and are kept as recorded in docs/benchmark.md; they are not comparable one-to-one with freeze 3. All benchmark results are from rampgate's deterministic simulator. Demonstrated (not benchmarked) on one laptop GPU (RTX 4050, 6 GB) with synthetic memory-hog containers: probation, a Rule V vacate and an OOM→Rule O cycle, checked by script. Not yet tested: multiple GPUs, gang jobs, CPU devices, a real framework's caching allocator, orchestrator restart, sub-second spikes.

Full tables, the protocol and the three held-out evaluations: docs/benchmark.md. What the real runs confirmed and contradicted: docs/real-run/assumptions.md.

Documentation

The full site is at kebanfiru.github.io/rampgate.

Prior art

The closest related work is CARMA (arXiv 2508.19073), a collocation-aware GPU resource manager for deep-learning training that combines pre-run memory estimators with OOM recovery; rampgate needs no pre-run estimator or declared memory and admits from observed usage. Related work, differences and limitations: docs/prior-art.md.

Packages

Distribution Purpose
rampgate Core: model, reducer, decide, policies, estimators, Engine, simulator. Stdlib only.
rampgate-nvml NVIDIA GPU probe; process → container mapping via /proc/<pid>/cgroup
rampgate-psutil Host RAM/CPU probe; process-tree usage
rampgate-docker Docker executor, exit classification, event watcher, usage mapper

Development

Everything runs in Docker; nothing needs to be installed on the host.

./dev build          # build the dev image (uv + CPython 3.11–3.13)
./dev ci             # ruff, mypy --strict, pytest+coverage on 3.11, 3.12, 3.13
./dev ci 3.12        # a single version
./dev zero-deps      # verify the core wheel has no runtime dependencies
./dev shell          # interactive shell with a synced venv

License

Apache-2.0. See LICENSE and NOTICE.

About

ramp + gate: hold each job’s warm-up ramp at the gate, measure what it really uses, then reserve exactly that. An embeddable GPU admission scheduler for ML training.

Topics

Resources

Contributing

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages