Skip to content

Commit

Permalink
Added 5 examples to demostrate GPU aware scheduling features
Browse files Browse the repository at this point in the history
This adds more examples for GAS. The tests prints the container names
and corresponding GPUs to the logs.

Signed-off-by: Valtteri Rantala <vrantala@intel.com>
  • Loading branch information
Valtteri Rantala authored and uniemimu committed Jun 29, 2023
1 parent 0342090 commit 380d857
Show file tree
Hide file tree
Showing 7 changed files with 182 additions and 5 deletions.
20 changes: 16 additions & 4 deletions gpu-aware-scheduling/docs/example/README.md
@@ -1,13 +1,25 @@
This folder has a simple example POD which uses kubernetes extended resources
This folder has simple examples which use kubernetes extended resources and other GAS features.

To deploy, you can run in this folder:

```
kubectl apply -f .
kubectl apply -f <test_file_name>
```

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

```
kubectl exec -it deploy/bb-example -- ls /dev/dri
```
kubectl exec -it deploy/<deployment name> -- ls /dev/dri
```

Or you can use logs command to check which GPUs the pod is using:

```
kubectl logs --all-containders=true <pod name>
```

With describe command you can check in which GPUs GAS has scheduled the pods along with the other pod information:

```
kubectl describe pods <deployment name>
```
30 changes: 30 additions & 0 deletions gpu-aware-scheduling/docs/example/allowed_gpu_list.yaml
@@ -0,0 +1,30 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: allowed-gpu-list-example
spec:
replicas: 1
selector:
matchLabels:
app: allow-gpu-list-example
template:
metadata:
annotations:
#remember to enable allowlist and/or denylist via command line flags.
#--enableAllowlist true
#--enableDenylist true
gas-allow: card1,card2,card3
gas-deny: card0
labels:
app: allow-gpu-list-example
spec:
containers:
- name: &containername allow-gpu-list-example
image: busybox:1.33.1
env:
- name: MY_CONTAINER_NAME
value: *containername
command: ['sh', '-c', 'echo $MY_CONTAINER_NAME && ls -ltr /dev/dri && sleep 6000']
resources:
limits:
gpu.intel.com/i915: 1
2 changes: 1 addition & 1 deletion gpu-aware-scheduling/docs/example/bb_example.yaml
Expand Up @@ -13,7 +13,7 @@ spec:
app: bb-example
spec:
containers:
- name: gpu-resource-request
- name: bb-example
image: busybox:1.33.1
command: ['sh', '-c', 'echo The gpu resource request app is running! && sleep 6000']
resources:
Expand Down
25 changes: 25 additions & 0 deletions gpu-aware-scheduling/docs/example/memory_resource_example.yaml
@@ -0,0 +1,25 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: memory-resource-example
spec:
replicas: 1
selector:
matchLabels:
app: memory-resource-example
template:
metadata:
labels:
app: memory-resource-example
spec:
containers:
- name: &containername memory-resource-example
image: busybox:1.33.1
env:
- name: MY_CONTAINER_NAME
value: *containername
command: ['sh', '-c', 'echo $MY_CONTAINER_NAME && ls -ltr /dev/dri && sleep 6000']
resources:
limits:
gpu.intel.com/i915: 1
gpu.intel.com/memory.max: 500M
58 changes: 58 additions & 0 deletions gpu-aware-scheduling/docs/example/same-gpu-example.yaml
@@ -0,0 +1,58 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: same-gpu-example
spec:
replicas: 1
selector:
matchLabels:
app: same-gpu-example
template:
metadata:
labels:
app: same-gpu-example
annotations:
#List containers that needs to be in same GPU
gas-same-gpu: same-gpu-container1,same-gpu-container3
spec:
containers:
- name: &container1 same-gpu-container1
image: busybox:1.33.1
env:
- name: MY_CONTAINER_NAME
value: *container1
command: ['sh', '-c', 'echo $MY_CONTAINER_NAME && ls -ltr /dev/dri && sleep 6000']
resources:
limits:
gpu.intel.com/i915: 1
gpu.intel.com/millicores: 400
- name: &container2 same-gpu-container2
image: busybox:1.33.1
env:
- name: MY_CONTAINER_NAME
value: *container2
command: ['sh', '-c', 'echo $MY_CONTAINER_NAME && ls -ltr /dev/dri && sleep 6000']
resources:
limits:
gpu.intel.com/i915: 1
gpu.intel.com/millicores: 300
- name: &container3 same-gpu-container3
image: busybox:1.33.1
env:
- name: MY_CONTAINER_NAME
value: *container3
command: ['sh', '-c', 'echo $MY_CONTAINER_NAME && ls -ltr /dev/dri && sleep 6000']
resources:
limits:
gpu.intel.com/i915: 1
gpu.intel.com/millicores: 400
- name: &container4 same-gpu-container4
image: busybox:1.33.1
env:
- name: MY_CONTAINER_NAME
value: *container4
command: ['sh', '-c', 'echo $MY_CONTAINER_NAME && ls -ltr /dev/dri && sleep 6000']
resources:
limits:
gpu.intel.com/i915: 1
gpu.intel.com/millicores: 300
@@ -0,0 +1,25 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: tile-resource-request-example
spec:
replicas: 1
selector:
matchLabels:
app: tile-resource-request-example
template:
metadata:
labels:
app: tile-resource-request-example
spec:
containers:
- name: &containername tile-resource-request-example
image: busybox:1.33.1
env:
- name: MY_CONTAINER_NAME
value: *containername
command: ['sh', '-c', 'echo $MY_CONTAINER_NAME && ls -ltr /dev/dri && sleep 6000']
resources:
limits:
gpu.intel.com/i915: 1
gpu.intel.com/tiles: 1
27 changes: 27 additions & 0 deletions gpu-aware-scheduling/docs/example/xe-link-example.yaml
@@ -0,0 +1,27 @@
apiVersion: apps/v1
kind: Deployment
metadata:
name: xe-link-example
spec:
replicas: 1
selector:
matchLabels:
app: xe-link-example
template:
metadata:
labels:
app: xe-link-example
annotations:
gas-allocate-xelink: 'true'
spec:
containers:
- name: &containername xe-link-example
image: busybox:1.33.1
env:
- name: MY_CONTAINER_NAME
value: *containername
command: ['sh', '-c', 'echo $MY_CONTAINER_NAME && ls -ltr /dev/dri && sleep 6000']
resources:
limits:
gpu.intel.com/i915: 2
gpu.intel.com/tiles: 2

0 comments on commit 380d857

Please sign in to comment.