A reference/prototype implementation that extends Cloud Foundry to schedule, allocate, and expose GPU devices to application containers using CDI (Container Device Interface) and the existing Diego/Garden stack.
Phase 1 (Foundation) - In Progress
✅ Validated: NVIDIA driver and GPU compute on BOSH-managed VMs
- Custom Ubuntu Noble stemcell with pre-baked NVIDIA driver (595.58.03)
- Lifecycle errand validates GPU functionality on-demand (VM created/destroyed per test)
- GPU compute verified via comprehensive benchmarks (PyTorch & TensorFlow)
- PyTorch: 4.45 TFLOPS FP32, 40.79 TFLOPS FP16 (Tensor Cores)
- TensorFlow: 1.25 TFLOPS FP32, 3.08 TFLOPS FP16
- Cost-effective testing: ~$0.10-0.15 per test run vs $14/day for persistent VM
- See
bosh/gpu-test-release/for the working BOSH release
🚧 Next: Container GPU access via nvidia-container-toolkit
- Errand
container-gpu-errand-nobleinstalls the toolkit, generates a CDI spec, and runsnvidia-smi+ a CUDA workload inside a container on a BOSH-managed VM. Prerequisite for Garden/Diego integration. - See
bosh/gpu-test-release/manifests/container-gpu-test-noble.yml.
🧪 Diego scheduling POC (in forks): a GPU request now flows through
BBS → auctioneer → rep → executor → garden → guardian, with CAPI exposing GPU
as a v3 app feature flag. The Diego-stack code lives in forks under
github.com/ZPascal and the CAPI change on an
upstream cloud_controller_ng branch — nothing merged upstream yet. See the
POC forks reference.
See Summary & Outlook for the presentation overview, Roadmap for the full plan, and Shortcuts for PoC assumptions.
Developer
│
│ cf push myapp (gpu: true)
▼
┌──────────┐ REST ┌──────────┐ BBS RPC ┌─────────────┐
│ CF CLI │────────────▶│ CAPI │────────────▶│ BBS │
└──────────┘ └──────────┘ └──────┬──────┘
│ LRP desired
▼
┌─────────────┐
│ Diego Auc- │
│ tioneer │
└──────┬──────┘
│ gate on GPU capacity
┌───────────────┴────────────────┐
▼ ▼
┌─────────────┐ ┌─────────────┐
│ Diego Rep │ │ Diego Rep │
│ (GPU cell) │ │ (CPU cell) │
└──────┬──────┘ └─────────────┘
│ allocate GPU
▼
┌─────────────┐
│ Executor │ GPUManager.Allocate()
└──────┬──────┘
│ ContainerSpec + CDIDevices
▼
┌─────────────┐
│ garden-runc │ CDI injection → runc spec
└──────┬──────┘
│
▼
┌─────────────┐
│ runc │ /dev/nvidia0 in container
└──────┬──────┘
│
▼
┌─────────────┐
│ App │ CUDA_VISIBLE_DEVICES=0
│ Container │
└─────────────┘
│
▼
┌─────────────┐
│ GPU Metrics│ → Loggregator → Log Cache
│ Collector │
└─────────────┘
| Layer | Component | Role in GPU Support |
|---|---|---|
| Kernel/CGroup | cgroups v1/v2 | Isolate GPU device access per container |
| Container Runtime | runc + CDI | Inject GPU devices into OCI bundle via CDI specs |
| Garden | garden-runc | Translate CDIDevice specs into runc container configs |
| Diego Rep | rep/gpu_capacity.go |
Advertise GPU capacity; score bids in auction |
| Diego Executor | executor/gpu_manager.go |
Discover, allocate, and release GPU devices |
| BBS | bbs/models/gpu.proto |
Carry GPURequest in LRP/Task run-info |
| CAPI | capi/ |
Expose GPU as a v3 app feature flag (gpu_enabled); persist to BBS |
| CF CLI | (standard CLI) | Pass manifest gpu: true / app-feature through to CAPI |
| Monitoring | monitoring/gpu_metrics.go |
Collect per-container GPU utilization; emit to Loggregator |
| BOSH | bosh/ |
Deploy GPU cells with nvidia-container-toolkit job |
-
Operator deploys a GPU cell using the BOSH manifest in
bosh/manifests/gpu-cell.yml. Thenvidia-toolkitBOSH job installs nvidia-container-toolkit and writes CDI specs under/var/vcap/data/cdi/specs/. -
Operator registers the CDI spec dir with garden-runc (via
--cdi-spec-dirsflag). -
Developer pushes an app with GPU enabled:
cf push myapp -f manifest.yml # manifest.yml contains: gpu: true -
CAPI records the
gpu_enabledapp feature and carries aGPURequestinto the BBS desired LRP. (The POC uses a boolean feature flag; a count/type resource model is a deferred RFC question.) -
Diego Auctioneer calls each Rep's
/stateendpoint; Reps with GPUs reportgpu_capacity, and the auction gates a GPU-requesting LRP onto a cell with free GPU capacity. -
Diego Executor calls
GPUManager.Allocate(), obtains a GPU index, builds aContainerSpecwithCDIDevices: [{Name: "nvidia.com/gpu=0"}], and passes it to garden-runc. -
garden-runc expands the CDI device name into
/dev/nvidia0,/dev/nvidiactl,/dev/nvidia-uvmentries and the required library mounts in the OCI bundle, then invokesrunc. -
GPU Buildpack (if used at staging) sets
CUDA_VISIBLE_DEVICESand library paths in.profile.d/gpu-env.sh. -
Monitoring collects
gpu_utilizationandgpu_memory_usedmetrics per container and forwards them to Loggregator as v2 envelopes.
cf-gpuccino/
├── README.md ← this file
├── go.mod
├── bbs/
│ └── models/
│ └── gpu.proto ← Protobuf: GPURequest in RunInfo
├── garden/
│ └── gpu.go ← CDI device specs for garden-runc
├── executor/
│ └── gpu_manager.go ← GPU discovery & allocation
├── rep/
│ └── gpu_capacity.go ← Diego Rep auction GPU capacity
├── capi/
│ ├── models/
│ │ └── gpu_process.go ← CF v3 API models
│ └── api/
│ └── gpu_handler.go ← HTTP handlers
├── cdi/
│ └── specs/
│ ├── nvidia-gpu.json ← CDI spec for NVIDIA GPUs
│ └── amd-gpu.json ← CDI spec for AMD/ROCm GPUs
├── bosh/
│ ├── gpu-test-release/ ← ✅ Working BOSH release for GPU validation
├── buildpack/
│ └── gpu-buildpack/
│ └── README.md
├── monitoring/
│ └── gpu_metrics.go ← GPU metrics → Loggregator
└── docs/
├── architecture.md
├── deployment.md
├── roadmap.md ← Implementation phases
├── shortcuts.md ← PoC assumptions & deferred work
└── stemcell-options.md ← Driver packaging strategies
- Summary & Outlook – Presentation overview: what was built, what's next
- POC Forks & Branches – Where the Diego scheduling code lives
- Roadmap – Implementation phases and progress
- Architecture Details
- Deployment Guide
- Shortcuts & Assumptions – PoC trade-offs
- Stemcell Options – Driver packaging strategies
- GPU Test Release – Validate GPU on BOSH VMs
- GPU Buildpack
- CDI Specification
- NVIDIA Container Toolkit