pub struct GpuSpec {
pub count: u32,
pub vendor: String,
pub mode: Option<String>,
pub model: Option<String>,
pub scheduling: Option<SchedulingPolicy>,
pub distributed: Option<DistributedConfig>,
pub sharing: Option<GpuSharingMode>,
pub mps_pipe_dir: Option<String>,
pub mps_log_dir: Option<String>,
pub time_slice_index: Option<u32>,
pub time_slicing_config_path: Option<String>,
}Expand description
GPU resource specification
Supported vendors:
nvidia- NVIDIA GPUs via NVIDIA Container Toolkit (default)amd- AMD GPUs viaROCm(/dev/kfd + /dev/dri/renderD*)intel- Intel GPUs via VAAPI/i915 (/dev/dri/renderD*)apple- Apple Silicon GPUs via Metal/MPS (macOS only)
Unknown vendors fall back to DRI render node passthrough.
§GPU mode (macOS only)
When vendor is "apple", the mode field controls how GPU access is provided:
"native"– Seatbelt sandbox with direct Metal/MPS access (lowest overhead)"vm"– libkrun micro-VM with GPU forwarding (stronger isolation)None(default) – Auto-select based on platform and vendor
On Linux, mode is ignored; GPU passthrough always uses device node binding.
Fields§
§count: u32Number of GPUs to request
vendor: StringGPU vendor (nvidia, amd, intel, apple) - defaults to nvidia
mode: Option<String>GPU access mode (macOS only): "native", "vm", or None for auto-select
model: Option<String>Pin to a specific GPU model (e.g. “A100”, “H100”). Substring match against detected GPU model names.
scheduling: Option<SchedulingPolicy>Scheduling policy for GPU workloads.
best-effort(default): place what fitsgang: all-or-nothing for distributed jobsspread: distribute across nodes
distributed: Option<DistributedConfig>Distributed GPU job coordination.
When set, injects MASTER_ADDR, WORLD_SIZE, RANK, LOCAL_RANK env vars.
sharing: Option<GpuSharingMode>GPU sharing mode: exclusive (default), mps, or time-slice.
mps_pipe_dir: Option<String>Host directory for the NVIDIA MPS control pipe.
Only consulted when sharing == Mps. Defaults to /tmp/nvidia-mps
when unset. The directory MUST exist on the host (created by the
nvidia-cuda-mps-control daemon). It is bind-mounted into the
container at the same path and exported as CUDA_MPS_PIPE_DIRECTORY.
mps_log_dir: Option<String>Host directory for NVIDIA MPS log output.
Only consulted when sharing == Mps. Defaults to /tmp/nvidia-log
when unset. The directory MUST exist on the host. It is bind-mounted
into the container and exported as CUDA_MPS_LOG_DIRECTORY.
time_slice_index: Option<u32>CUDA device index this replica should see when sharing == TimeSlice.
Emitted as CUDA_VISIBLE_DEVICES=<slice_index>, overriding the default
0..count visibility list. Use this together with a host-side NVIDIA
time-slicing config to advertise a single physical GPU as multiple
virtual slices.
time_slicing_config_path: Option<String>Optional host path to a NVIDIA time-slicing config YAML.
When set, the file is bind-mounted read-only at
/etc/nvidia/gpu-time-slicing.yaml inside the container so tools that
inspect the slicing topology (e.g. monitoring sidecars) can read it.
The file is not interpreted by ZLayer — it’s purely informational for
the workload.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for GpuSpec
impl<'de> Deserialize<'de> for GpuSpec
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
impl Eq for GpuSpec
impl StructuralPartialEq for GpuSpec
Source§impl<'v_a> ValidateArgs<'v_a> for GpuSpec
impl<'v_a> ValidateArgs<'v_a> for GpuSpec
Auto Trait Implementations§
impl Freeze for GpuSpec
impl RefUnwindSafe for GpuSpec
impl Send for GpuSpec
impl Sync for GpuSpec
impl Unpin for GpuSpec
impl UnsafeUnpin for GpuSpec
impl UnwindSafe for GpuSpec
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.