You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
In the gpu-memory.yaml file, the pod includes a `gpu-memory` annotation with a value of 2000 (in Mib), meaning:
43
43
* The pod is allowed to consume up to 2000 Mib of a GPU device memory
44
44
* The remaining GPU device memory can be shared with other pods in the cluster
45
+
46
+
### GPU Fraction with Non-Default Container
47
+
By default, GPU fraction allocation is applied to the first container (index 0) in the pod. However, you can specify a different container to receive the GPU allocation using the `gpu-fraction-container-name` annotation.
48
+
49
+
#### Specific Container
50
+
To allocate GPU fraction to a specific container in a multi-container pod:
In the gpu-sharing-non-default-container.yaml file, the pod includes:
56
+
*`gpu-fraction: "0.5"` - Requests half of a GPU device memory
57
+
*`gpu-fraction-container-name: "gpu-workload"` - Specifies that the container named "gpu-workload" should receive the GPU allocation instead of the default first container
58
+
59
+
This is useful for pods with sidecar containers where only one specific container needs GPU access.
60
+
61
+
#### Init Container
62
+
To allocate GPU fraction to an init container:
63
+
```
64
+
kubectl apply -f gpu-sharing-init-container.yaml
65
+
```
66
+
67
+
In the gpu-sharing-init-container.yaml file, the pod includes:
68
+
*`gpu-fraction: "0.5"` - Requests half of a GPU device memory
69
+
*`gpu-fraction-container-name: "gpu-init"` - Specifies the init container name. If not defined, will default to the first container.
70
+
*`gpu-fraction-container-type: "InitContainer"` - Indicates the container is an init container
71
+
72
+
This is useful for workloads that need GPU access during initialization (e.g., model loading, dataset preprocessing) before the main application container starts.
0 commit comments