mirror of
https://github.com/floci-io/floci.git
synced 2026-12-01 01:12:48 -05:00
Floci's container launcher has no way to ask a daemon for an accelerator, so every container it starts is CPU-only. Services that need a GPU, such as SageMaker training and hosting, have nowhere to express the request. Adds optional device requests to the shared container layer: - withGpuCount(int) / withAllGpus() build Docker's count form - withGpuDeviceIds(List) pins specific devices by index or vendor UUID - withCdiDevices(List) selects Container Device Interface devices by name Count, device ids and CDI names are alternatives, and passing more than one is rejected: a Docker request carrying both a count and explicit ids is refused by the daemon. CDI is included because Floci already documents rootless Podman as a supported host, and CDI is how a Podman daemon exposes accelerators over its Docker-compatible API. It is also not GPU-specific, so the same primitive reaches any device the host's CDI specs describe. The two forms are not interchangeable: Podman accepts Docker's count form and then starts the container with no device attached (containers/podman#22645), so the javadoc steers a caller that may be talking to Podman toward CDI, whose failure mode is a refused start rather than a silent CPU-only container. Default behavior is unchanged. A spec that asks for no device sets no DeviceRequests on the HostConfig, so a daemon configured with an accelerator runtime as its default does not start handing devices to every container Floci launches. Existing ContainerSpec constructors keep working through a delegating overload that defaults the new component to empty. Tests cover the exact request built for each form, the absence of any request by default, the validation rules, and that requests reach the HostConfig. ContainerGpuDockerIntegrationTest exercises real hardware and is opt-in via -Dgpu.integration.enabled=true, skipping cleanly where no GPU exists, so CI still covers request construction without needing one. Verified on an RTX 5060 Ti against Podman 5.8.2 with NVIDIA Container Toolkit 1.19.1: a container requesting the device by CDI name reported exactly that UUID from nvidia-smi, and a container requesting nothing failed to start rather than reaching a GPU.