Files

1.2 KiB

gpu-broker plan (2026-11-11). Design: DESIGN.md. Go TDD; mise run test before each commit.

  1. internal/sched: Scheduler{Observe(gpus), Acquire(ctx, Request) (Grant, error), Renew, Release, Tick, Status}. Free = total - used - reserve - VRAM of leases granted within the load window. Tests: fit/prefer/most-free, reserve, wait then grant, priority order, timeout -> CPU or error, too big -> CPU now, no oversubscription inside the load window, unrenewed leases expire.
  2. internal/nvsmi: parse nvidia-smi --query-gpu=index,memory.total,memory.used --format=csv,noheader,nounits.
  3. api/openapi.yaml + oapi-codegen strict server (POST /v1/leases, POST /v1/leases/{id}/renew, DELETE /v1/leases/{id}, GET /v1/status, GET /v1/health) + /metrics.
  4. internal/ollamaproxy: lease per not-yet-loaded model (size from /api/tags * 1.2), CPU fallback injects options {num_gpu: 0, num_thread: 4}; loaded models and non-inference paths pass through.
  5. cmd/gpu-run: lease, CUDA_VISIBLE_DEVICES, renew loop, CPU cap via systemd-run.
  6. Deploy on yveltal: broker + proxy units, Ollama -> 127.0.0.1:11435, Ollama env (keep-alive 10m, max loaded 2), Jellyfin + Immich ML -> GPU 0; verify dogebot, music-genres, AFFiNE; Kuma + Prometheus scrape; memory + handoffs notes.