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
{{ message }}
This repository was archived by the owner on Jan 29, 2025. It is now read-only.
'gas-same-gpu: "container1,container2"' annotation tells GAS
to ensure listed containers are given the same GPU. Intended
to be used for multi-GPU nodes. Example use case: sharing
framebuffer from video renderer container into video stream
encoder container
Signed-off-by: Alexey Fomenko <alexey.fomenko@intel.com>
Copy file name to clipboardExpand all lines: gpu-aware-scheduling/docs/usage.md
+80-9Lines changed: 80 additions & 9 deletions
Original file line number
Diff line number
Diff line change
@@ -5,7 +5,7 @@ To begin with, it will help a lot if you have been successful already using the
5
5
6
6
## GPU-plugin
7
7
Resource management enabled version of the GPU-plugin is currently necessary for running GAS. The resource management enabled GPU-plugin version can read the necessary annotations of the PODs, and without those annotations, GPU allocations will not work correctly. A copy of the plugin deployment kustomization can be found from [docs/gpu_plugin](./gpu_plugin). It can be deployed simply by issuing:
@@ -15,14 +15,14 @@ The GPU plugin initcontainer needs to be used in order to get the extended resou
15
15
Basically all versions starting with [v0.6.0](https://github.com/kubernetes-sigs/node-feature-discovery/releases/tag/v0.6.0) should work. You can use it to publish the GPU extended resources and GPU-related labels printed by the hook installed by the GPU-plugin initcontainer.
16
16
17
17
For picking up the labels printed by the hook installed by the GPU-plugin initcontainer, deploy nfd master with this kind of command in its yaml:
The above would promote three labels, "memory.max", "millicores" and "tiles" to extended resources of the node that produces the labels.
23
23
24
24
If you want to enable i915 capability scanning, the nfd worker needs to read debugfs, and therefore it needs to run as privileged, like this:
25
-
```
25
+
```YAML
26
26
securityContext:
27
27
runAsNonRoot: null
28
28
# Adding GPU info labels needs debugfs "915_capabilities" access
@@ -31,7 +31,7 @@ If you want to enable i915 capability scanning, the nfd worker needs to read deb
31
31
```
32
32
33
33
In order to allow NFD to create extended resource, you will have to give it RBAC-rule to access nodes/status, like:
34
-
```
34
+
```YAML
35
35
rules:
36
36
- apiGroups:
37
37
- ""
@@ -44,7 +44,7 @@ rules:
44
44
45
45
A simple example of non-root NFD deployment kustomization can be found from [docs/nfd](./nfd). You can deploy it by running
46
46
47
-
```
47
+
```Bash
48
48
kubectl apply -k docs/nfd
49
49
```
50
50
@@ -55,7 +55,7 @@ You need some i915 GPUs in the nodes. Internal GPUs work fine for testing GAS, m
55
55
## PODs
56
56
57
57
Your PODs then, needs to ask for some GPU-resources. Like this:
58
-
```
58
+
```YAML
59
59
resources:
60
60
limits:
61
61
gpu.intel.com/i915: 1
@@ -64,7 +64,7 @@ Your PODs then, needs to ask for some GPU-resources. Like this:
64
64
```
65
65
66
66
Or like this for tiles:
67
-
```
67
+
```YAML
68
68
resources:
69
69
limits:
70
70
gpu.intel.com/i915: 1
@@ -119,13 +119,84 @@ share the same physical card.
119
119
120
120
## Allowlist and Denylist
121
121
122
-
You can use POD-annotations in your POD-templates to list the GPU names which you allow, or deny for your deployment. The values for the annotations are comma separated value lists of the form "card0,card1,card2", and the names of the annotations are:
122
+
You can use POD-annotations in your POD-templates to list the GPU names which you allow, or deny
123
+
for your deployment. The values for the annotations are comma separated value lists of the form
124
+
"card0,card1,card2", and the names of the annotations are:
123
125
124
126
- `gas-allow`
125
127
- `gas-deny`
126
128
127
129
Note that the feature is disabled by default. You need to enable allowlist and/or denylist via command line flags.
128
130
131
+
## Enforcing same gpu to multiple containers within Pod
132
+
133
+
By default when GAS checks if available Node resources are enough for Pod's resources requests,
134
+
the containers of the Pod are processed sequentially and independently. In multi-gpu nodes in
135
+
certain cases this may result (but not guaranteed) in container of the same Pod having different
136
+
GPUs allocated to them.
137
+
138
+
In case two or more containers of the same Pod require to use the same GPU, GAS supports
139
+
`gas-same-gpu`Pod annotation (value is a list of container names) that tells GAS which containers
140
+
should only be given the same GPU. In case if neither of the GPUs on the node have enough available
141
+
resources for all containers listed in such annotation, the current node will not be used for
142
+
scheduling.
143
+
144
+
<details>
145
+
<summary>Example Pod annotation</summary>
146
+
147
+
```YAML
148
+
apiVersion: apps/v1
149
+
kind: Deployment
150
+
metadata:
151
+
name: demo-app
152
+
labels:
153
+
app: demo
154
+
spec:
155
+
replicas: 1
156
+
selector:
157
+
matchLabels:
158
+
app: demo
159
+
template:
160
+
metadata:
161
+
labels:
162
+
app: demo
163
+
annotations:
164
+
gas-same-gpu: busybox1,busybox2
165
+
spec:
166
+
containers:
167
+
- name: nginx
168
+
image: nginx:latest
169
+
imagePullPolicy: IfNotPresent
170
+
resources:
171
+
limits:
172
+
gpu.intel.com/i915: 1
173
+
gpu.intel.com/millicores: 400
174
+
- name: busybox2
175
+
image: busybox:latest
176
+
imagePullPolicy: IfNotPresent
177
+
resources:
178
+
limits:
179
+
gpu.intel.com/i915: 1
180
+
gpu.intel.com/millicores: 100
181
+
command: ["/bin/sh", "-c", "sleep 3600"]
182
+
- name: busybox1
183
+
image: busybox:latest
184
+
imagePullPolicy: IfNotPresent
185
+
resources:
186
+
limits:
187
+
gpu.intel.com/i915: 1
188
+
gpu.intel.com/millicores: 100
189
+
command: ["/bin/sh", "-c", "sleep 3600"]
190
+
```
191
+
192
+
</details>
193
+
194
+
### Restrictions
195
+
196
+
- Containers listed in `gas-same-gpu` annotation have to request exactly one `gpu.intel.com/i915` resource
197
+
- Containers listed in `gas-same-gpu` annotation cannot request `gpu.intel.com/i915_monitoring` resource
198
+
- Containers listed in `gas-same-gpu` annotation cannot request `gpu.intel.com/tiles` resource
199
+
129
200
## Summary in a chronological order
130
201
131
202
- GPU-plugin initcontainer installs an NFD hook which prints labels for you, based on the Intel GPUs it finds
@@ -142,4 +213,4 @@ Check the logs (kubectl logs podname -n namespace) from all of these when in tro
142
213
- Check that NFD picks up the labels without complaints, no errors in NFD workers or the master
143
214
- Check that your GPU-enabled nodes have NFD-created GPU extended resources (kubectl describe node nodename) and GPU-labels
144
215
- Check the log of GAS POD. If the log does not show anything ending up happening during deploying of i915 resource consuming PODs, your scheduler extender setup may be incorrect. Verify that you have successfully run all the deployment steps and the related cluster setup script.
0 commit comments