Skip to content

Commit 35c7ef2

Browse files
committed
docs(gpu): document counted CDI defaults
Signed-off-by: Evan Lezar <elezar@nvidia.com>
1 parent ba85b94 commit 35c7ef2

6 files changed

Lines changed: 185 additions & 85 deletions

File tree

architecture/compute-runtimes.md

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -55,11 +55,12 @@ through the driver configuration. The Helm chart defaults sandbox agents to
5555
`Unconfined` so runtime/default AppArmor profiles do not block supervisor
5656
network namespace setup on AppArmor-enabled nodes.
5757

58-
GPU requests enter the driver layer through `SandboxSpec.gpu` and
59-
`SandboxSpec.gpu_device`. Docker and Podman map default GPU requests to one
60-
concrete NVIDIA CDI device when individual CDI devices are available, use
61-
`nvidia.com/gpu=all` only for WSL2/all-only compatibility, and pass explicit
62-
driver-native device IDs through.
58+
GPU requests enter the driver layer through `SandboxSpec.resource_requirements`.
59+
An omitted GPU count is interpreted as one GPU. Docker and Podman pass explicit
60+
`driver_config.cdi_devices` values through as opaque CDI IDs; otherwise they
61+
refresh their CDI inventory and select the requested number of default NVIDIA
62+
CDI devices in round-robin order. The `nvidia.com/gpu=all` fallback is used only
63+
for WSL2/all-only compatibility and counts as one selectable device.
6364

6465
VM runtime state paths are derived only from driver-validated sandbox IDs
6566
matching `[A-Za-z0-9._-]{1,128}`. The gateway-owned VM driver socket uses a

crates/openshell-driver-docker/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ contract:
3232
| `apparmor=unconfined` | Avoids Docker's default profile blocking required mount operations. |
3333
| `restart_policy = unless-stopped` | Keeps managed sandboxes resumable across daemon or gateway restarts. |
3434
| `PidsLimit` | Enforces the sandbox PID budget at the Docker cgroup layer. Set `[openshell.drivers.docker].sandbox_pids_limit = 0` to inherit the Docker/runtime default. |
35-
| CDI GPU request | Uses `driver_config.cdi_devices` when set; otherwise selects one concrete NVIDIA CDI GPU when the sandbox resource requirements ask for GPU support and daemon CDI support is detected. Docker daemon `/info` can permit `nvidia.com/gpu=all` as a WSL2 all-only compatibility fallback. Count-only GPU requests are rejected; exact CDI device lists with more than one entry require an explicit GPU count matching the device list length. |
35+
| CDI GPU request | Uses opaque `driver_config.cdi_devices` values when set; otherwise selects the requested count of NVIDIA CDI GPUs in round-robin order when daemon CDI support is detected. Docker daemon `/info` can permit `nvidia.com/gpu=all` as a WSL2 all-only compatibility fallback, where it counts as one selectable device. Exact CDI device lists must not contain duplicates and must match the effective GPU count. |
3636

3737
The agent child process does not retain these supervisor privileges.
3838

crates/openshell-driver-podman/README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ The container spec in `container.rs` sets these security-critical fields:
4646
| `no_new_privileges` | `true` | Prevents privilege escalation after exec. |
4747
| `seccomp_profile_path` | `unconfined` | The supervisor installs its own policy-aware BPF filter. A container-level profile can block Landlock/seccomp syscalls during setup. |
4848
| `mounts` | Private tmpfs at `/run/netns` | Lets the supervisor create named network namespaces in rootless Podman. |
49-
| CDI GPU devices | `driver_config.cdi_devices` when set, otherwise one concrete NVIDIA CDI GPU. Local `/dev/dxg` permits `nvidia.com/gpu=all` as a WSL2 all-only compatibility fallback. | Exposes requested GPUs to GPU-enabled sandbox containers. Count-only GPU requests are rejected; exact CDI device lists with more than one entry require an explicit GPU count matching the device list length. |
49+
| CDI GPU devices | Opaque `driver_config.cdi_devices` values when set, otherwise the requested count of NVIDIA CDI GPUs selected in round-robin order. Local `/dev/dxg` permits `nvidia.com/gpu=all` as a WSL2 all-only compatibility fallback, where it counts as one selectable device. | Exposes requested GPUs to GPU-enabled sandbox containers. Exact CDI device lists must not contain duplicates and must match the effective GPU count. |
5050

5151
The restricted agent child does not retain these supervisor privileges.
5252

docs/reference/sandbox-compute-drivers.mdx

Lines changed: 21 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -53,19 +53,29 @@ openshell sandbox create \
5353
```
5454

5555
Driver config is for fields without a stable public flag. Prefer `--cpu`,
56-
`--memory`, and `--gpu` for supported resource intent. Pass a count to `--gpu`
57-
when the active driver supports counted allocation. Docker and Podman reject
58-
count-only GPU selection. If `driver_config` lists more than one exact CDI
59-
device, pass `--gpu COUNT`; the count must match the number of listed devices.
60-
A single exact CDI device is compatible with the default `--gpu` request.
56+
`--memory`, and `--gpu` for supported resource intent. When `--gpu` is present
57+
without a count, OpenShell treats it as a request for one GPU. Pass
58+
`--gpu COUNT` when requesting more than one GPU.
59+
60+
Kubernetes maps the GPU count to the `nvidia.com/gpu` pod resource limit.
61+
Docker and Podman satisfy count-only GPU requests by selecting the requested
62+
number of NVIDIA CDI devices from the local CDI inventory in round-robin order.
63+
The drivers refresh the CDI inventory before validating or creating the
64+
sandbox, so CDI devices added or removed after gateway start can affect later
65+
creates. On WSL2 all-only runtimes, Docker or Podman can use
66+
`nvidia.com/gpu=all` as a compatibility fallback, where it counts as one
67+
selectable device.
6168

6269
Exact GPU device selection remains driver-owned and requires `--gpu`. Docker
63-
and Podman accept `cdi_devices`; replace the top-level `docker` key with
64-
`podman` when using the Podman driver, for example
65-
`{"docker":{"cdi_devices":["nvidia.com/gpu=0"]}}`. The VM driver accepts
66-
`gpu_device_ids`, for example `{"vm":{"gpu_device_ids":["0000:2d:00.0"]}}`;
67-
the current VM implementation accepts at most one entry and allows either
68-
`--gpu` or `--gpu 1` when `gpu_device_ids` is set.
70+
and Podman accept `cdi_devices` as opaque CDI device names; replace the
71+
top-level `docker` key with `podman` when using the Podman driver, for example
72+
`{"docker":{"cdi_devices":["nvidia.com/gpu=0"]}}`. Explicit CDI device lists
73+
must not contain duplicates, and their length must match the effective GPU
74+
count. A single exact CDI device is compatible with the default `--gpu`
75+
request. The VM driver accepts `gpu_device_ids`, for example
76+
`{"vm":{"gpu_device_ids":["0000:2d:00.0"]}}`; the current VM implementation
77+
accepts at most one entry and allows either `--gpu` or `--gpu 1` when
78+
`gpu_device_ids` is set.
6979

7080
For Kubernetes, `pod.runtime_class_name` maps to PodSpec `runtimeClassName`.
7181
It overrides the gateway's configured default runtime class for that sandbox,

docs/sandboxes/manage-sandboxes.mdx

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -76,25 +76,27 @@ Request a specific number of GPUs by passing a count to `--gpu`:
7676
openshell sandbox create --gpu 2 -- claude
7777
```
7878
79-
Support for counted GPU requests is driver-dependent. Kubernetes honors a
80-
counted `--gpu` request by setting the `nvidia.com/gpu` limit. Docker and Podman
81-
reject count-only selection. If `driver_config` lists more than one exact CDI
82-
device, pass `--gpu COUNT`; the count must match the number of listed devices.
83-
A single exact CDI device is compatible with the default `--gpu` request. VM
84-
gateways accept only one GPU, either through `--gpu` or `--gpu 1`; a single
85-
`gpu_device_ids` entry works with either form.
79+
When you omit the count, OpenShell treats the request as `--gpu 1`.
80+
Kubernetes honors counted `--gpu` requests by setting the `nvidia.com/gpu`
81+
limit. Docker and Podman select the requested number of default NVIDIA CDI
82+
devices in round-robin order. VM gateways accept only one GPU, either through
83+
`--gpu` or `--gpu 1`; a single `gpu_device_ids` entry works with either form.
8684
8785
For Docker-backed sandboxes, GPU injection uses Docker CDI. If you enable Docker
8886
CDI after the gateway starts, restart the gateway so OpenShell can detect the
8987
updated Docker daemon capability.
9088
91-
Docker and Podman gateways map a default `--gpu` request to one concrete
92-
NVIDIA CDI device when individual CDI devices are available. On WSL2 all-only
93-
runtimes, the default can fall back to `nvidia.com/gpu=all`.
89+
Docker and Podman refresh the CDI inventory before validating or creating a
90+
default GPU request, so CDI devices added or removed after the driver starts can
91+
be reflected in later sandbox creates. On WSL2 all-only runtimes, the default
92+
can fall back to `nvidia.com/gpu=all`; that fallback counts as one selectable
93+
device.
9494
9595
Exact GPU device selection is driver-specific and still requires `--gpu`. For
9696
Docker or Podman, pass CDI IDs through `cdi_devices`. The top-level key must
97-
match the active driver; replace `docker` with `podman` when using Podman:
97+
match the active driver; replace `docker` with `podman` when using Podman. CDI
98+
IDs are treated as opaque strings. The list must not contain duplicate IDs, and
99+
its length must match the effective GPU count:
98100
99101
```shell
100102
openshell sandbox create \

0 commit comments

Comments
 (0)