Skip to content
This repository was archived by the owner on Jan 29, 2025. It is now read-only.

Commit 380d857

Browse files
Valtteri Rantalauniemimu
authored andcommitted
Added 5 examples to demostrate GPU aware scheduling features
This adds more examples for GAS. The tests prints the container names and corresponding GPUs to the logs. Signed-off-by: Valtteri Rantala <[email protected]>
1 parent 0342090 commit 380d857

File tree

7 files changed

+182
-5
lines changed

7 files changed

+182
-5
lines changed
Lines changed: 16 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,25 @@
1-
This folder has a simple example POD which uses kubernetes extended resources
1+
This folder has simple examples which use kubernetes extended resources and other GAS features.
22

33
To deploy, you can run in this folder:
44

55
```
6-
kubectl apply -f .
6+
kubectl apply -f <test_file_name>
77
```
88

99
Then you can check the GPU devices of the first pod in the deployment with:
1010

1111
```
12-
kubectl exec -it deploy/bb-example -- ls /dev/dri
13-
```
12+
kubectl exec -it deploy/<deployment name> -- ls /dev/dri
13+
```
14+
15+
Or you can use logs command to check which GPUs the pod is using:
16+
17+
```
18+
kubectl logs --all-containders=true <pod name>
19+
```
20+
21+
With describe command you can check in which GPUs GAS has scheduled the pods along with the other pod information:
22+
23+
```
24+
kubectl describe pods <deployment name>
25+
```
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: allowed-gpu-list-example
5+
spec:
6+
replicas: 1
7+
selector:
8+
matchLabels:
9+
app: allow-gpu-list-example
10+
template:
11+
metadata:
12+
annotations:
13+
#remember to enable allowlist and/or denylist via command line flags.
14+
#--enableAllowlist true
15+
#--enableDenylist true
16+
gas-allow: card1,card2,card3
17+
gas-deny: card0
18+
labels:
19+
app: allow-gpu-list-example
20+
spec:
21+
containers:
22+
- name: &containername allow-gpu-list-example
23+
image: busybox:1.33.1
24+
env:
25+
- name: MY_CONTAINER_NAME
26+
value: *containername
27+
command: ['sh', '-c', 'echo $MY_CONTAINER_NAME && ls -ltr /dev/dri && sleep 6000']
28+
resources:
29+
limits:
30+
gpu.intel.com/i915: 1

gpu-aware-scheduling/docs/example/bb_example.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@ spec:
1313
app: bb-example
1414
spec:
1515
containers:
16-
- name: gpu-resource-request
16+
- name: bb-example
1717
image: busybox:1.33.1
1818
command: ['sh', '-c', 'echo The gpu resource request app is running! && sleep 6000']
1919
resources:
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: memory-resource-example
5+
spec:
6+
replicas: 1
7+
selector:
8+
matchLabels:
9+
app: memory-resource-example
10+
template:
11+
metadata:
12+
labels:
13+
app: memory-resource-example
14+
spec:
15+
containers:
16+
- name: &containername memory-resource-example
17+
image: busybox:1.33.1
18+
env:
19+
- name: MY_CONTAINER_NAME
20+
value: *containername
21+
command: ['sh', '-c', 'echo $MY_CONTAINER_NAME && ls -ltr /dev/dri && sleep 6000']
22+
resources:
23+
limits:
24+
gpu.intel.com/i915: 1
25+
gpu.intel.com/memory.max: 500M
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: same-gpu-example
5+
spec:
6+
replicas: 1
7+
selector:
8+
matchLabels:
9+
app: same-gpu-example
10+
template:
11+
metadata:
12+
labels:
13+
app: same-gpu-example
14+
annotations:
15+
#List containers that needs to be in same GPU
16+
gas-same-gpu: same-gpu-container1,same-gpu-container3
17+
spec:
18+
containers:
19+
- name: &container1 same-gpu-container1
20+
image: busybox:1.33.1
21+
env:
22+
- name: MY_CONTAINER_NAME
23+
value: *container1
24+
command: ['sh', '-c', 'echo $MY_CONTAINER_NAME && ls -ltr /dev/dri && sleep 6000']
25+
resources:
26+
limits:
27+
gpu.intel.com/i915: 1
28+
gpu.intel.com/millicores: 400
29+
- name: &container2 same-gpu-container2
30+
image: busybox:1.33.1
31+
env:
32+
- name: MY_CONTAINER_NAME
33+
value: *container2
34+
command: ['sh', '-c', 'echo $MY_CONTAINER_NAME && ls -ltr /dev/dri && sleep 6000']
35+
resources:
36+
limits:
37+
gpu.intel.com/i915: 1
38+
gpu.intel.com/millicores: 300
39+
- name: &container3 same-gpu-container3
40+
image: busybox:1.33.1
41+
env:
42+
- name: MY_CONTAINER_NAME
43+
value: *container3
44+
command: ['sh', '-c', 'echo $MY_CONTAINER_NAME && ls -ltr /dev/dri && sleep 6000']
45+
resources:
46+
limits:
47+
gpu.intel.com/i915: 1
48+
gpu.intel.com/millicores: 400
49+
- name: &container4 same-gpu-container4
50+
image: busybox:1.33.1
51+
env:
52+
- name: MY_CONTAINER_NAME
53+
value: *container4
54+
command: ['sh', '-c', 'echo $MY_CONTAINER_NAME && ls -ltr /dev/dri && sleep 6000']
55+
resources:
56+
limits:
57+
gpu.intel.com/i915: 1
58+
gpu.intel.com/millicores: 300
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: tile-resource-request-example
5+
spec:
6+
replicas: 1
7+
selector:
8+
matchLabels:
9+
app: tile-resource-request-example
10+
template:
11+
metadata:
12+
labels:
13+
app: tile-resource-request-example
14+
spec:
15+
containers:
16+
- name: &containername tile-resource-request-example
17+
image: busybox:1.33.1
18+
env:
19+
- name: MY_CONTAINER_NAME
20+
value: *containername
21+
command: ['sh', '-c', 'echo $MY_CONTAINER_NAME && ls -ltr /dev/dri && sleep 6000']
22+
resources:
23+
limits:
24+
gpu.intel.com/i915: 1
25+
gpu.intel.com/tiles: 1
Lines changed: 27 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
apiVersion: apps/v1
2+
kind: Deployment
3+
metadata:
4+
name: xe-link-example
5+
spec:
6+
replicas: 1
7+
selector:
8+
matchLabels:
9+
app: xe-link-example
10+
template:
11+
metadata:
12+
labels:
13+
app: xe-link-example
14+
annotations:
15+
gas-allocate-xelink: 'true'
16+
spec:
17+
containers:
18+
- name: &containername xe-link-example
19+
image: busybox:1.33.1
20+
env:
21+
- name: MY_CONTAINER_NAME
22+
value: *containername
23+
command: ['sh', '-c', 'echo $MY_CONTAINER_NAME && ls -ltr /dev/dri && sleep 6000']
24+
resources:
25+
limits:
26+
gpu.intel.com/i915: 2
27+
gpu.intel.com/tiles: 2

0 commit comments

Comments
 (0)