Version: v2.9.0
Allocate a part of device memory by percentage to container
To allocate a certain size of GPU device memory by percentage, you need only to assign nvidia.com/gpumem-percentage besides nvidia.com/gpu.
apiVersion: v1
kind: Pod
metadata:
name: gpu-pod
spec:
containers:
- name: ubuntu-container
image: ubuntu:22.04
command: ["bash", "-c", "sleep 86400"]
resources:
limits:
nvidia.com/gpu: 2 # requesting 2 vGPUs
nvidia.com/gpumem-percentage: 50 # each vGPU requests 50% of device memory
note
Prefer specifying memory using one of these resources. If both are set and nvidia.com/gpumem is a positive integer, it takes precedence when determining the memory request. See Allocate device memory for details.