Skip to content

Commit

Permalink
Update demo folder with examples for opaue config parameters
Browse files Browse the repository at this point in the history
Signed-off-by: Kevin Klues <[email protected]>
  • Loading branch information
klueska committed Aug 27, 2024
1 parent b466fcb commit 45fd39f
Show file tree
Hide file tree
Showing 6 changed files with 145 additions and 57 deletions.
Binary file modified demo/demo-apps.png
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
6 changes: 3 additions & 3 deletions demo/gpu-test1.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ apiVersion: resource.k8s.io/v1alpha3
kind: ResourceClaimTemplate
metadata:
namespace: gpu-test1
name: gpu.example.com
name: single-gpu
spec:
spec:
devices:
Expand All @@ -39,7 +39,7 @@ spec:
- name: gpu
resourceClaims:
- name: gpu
resourceClaimTemplateName: gpu.example.com
resourceClaimTemplateName: single-gpu

---
apiVersion: v1
Expand All @@ -60,4 +60,4 @@ spec:
- name: gpu
resourceClaims:
- name: gpu
resourceClaimTemplateName: gpu.example.com
resourceClaimTemplateName: single-gpu
25 changes: 11 additions & 14 deletions demo/gpu-test2.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# One pod, two containers
# Each asking for shared access to a single GPU
# One pod, one container
# Asking for 2 distinct GPUs

---
apiVersion: v1
Expand All @@ -12,20 +12,24 @@ apiVersion: resource.k8s.io/v1alpha3
kind: ResourceClaimTemplate
metadata:
namespace: gpu-test2
name: gpu.example.com
name: multiple-gpus
spec:
spec:
devices:
requests:
- name: gpu
- name: gpus
deviceClassName: gpu.example.com
allocationMode: ExactCount
count: 2

---
apiVersion: v1
kind: Pod
metadata:
namespace: gpu-test2
name: pod0
labels:
app: pod
spec:
containers:
- name: ctr0
Expand All @@ -34,14 +38,7 @@ spec:
args: ["export; sleep 9999"]
resources:
claims:
- name: shared-gpu
- name: ctr1
image: ubuntu:22.04
command: ["bash", "-c"]
args: ["export; sleep 9999"]
resources:
claims:
- name: shared-gpu
- name: gpus
resourceClaims:
- name: shared-gpu
resourceClaimTemplateName: gpu.example.com
- name: gpus
resourceClaimTemplateName: multiple-gpus
37 changes: 11 additions & 26 deletions demo/gpu-test3.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# One shared, global claim providing access to a GPU
# Two pods, each asking for access to the shared GPU
# One pod, two containers
# Each asking for shared access to a single GPU

---
apiVersion: v1
Expand All @@ -9,24 +9,23 @@ metadata:

---
apiVersion: resource.k8s.io/v1alpha3
kind: ResourceClaim
kind: ResourceClaimTemplate
metadata:
namespace: gpu-test3
name: shared-gpu
name: single-gpu
spec:
devices:
requests:
- name: gpu
deviceClassName: gpu.example.com
spec:
devices:
requests:
- name: gpu
deviceClassName: gpu.example.com

---
apiVersion: v1
kind: Pod
metadata:
namespace: gpu-test3
name: pod0
labels:
app: pod
spec:
containers:
- name: ctr0
Expand All @@ -36,21 +35,7 @@ spec:
resources:
claims:
- name: shared-gpu
resourceClaims:
- name: shared-gpu
resourceClaimName: shared-gpu

---
apiVersion: v1
kind: Pod
metadata:
namespace: gpu-test3
name: pod1
labels:
app: pod
spec:
containers:
- name: ctr0
- name: ctr1
image: ubuntu:22.04
command: ["bash", "-c"]
args: ["export; sleep 9999"]
Expand All @@ -59,4 +44,4 @@ spec:
- name: shared-gpu
resourceClaims:
- name: shared-gpu
resourceClaimName: shared-gpu
resourceClaimTemplateName: single-gpu
46 changes: 32 additions & 14 deletions demo/gpu-test4.yaml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# One pod, one container
# Asking for 4 distinct GPUs
# One shared, global claim providing access to a GPU
# Two pods, each asking for access to the shared GPU

---
apiVersion: v1
Expand All @@ -9,18 +9,15 @@ metadata:

---
apiVersion: resource.k8s.io/v1alpha3
kind: ResourceClaimTemplate
kind: ResourceClaim
metadata:
namespace: gpu-test4
name: multiple-gpus
name: single-gpu
spec:
spec:
devices:
requests:
- name: gpus
deviceClassName: gpu.example.com
allocationMode: ExactCount
count: 4
devices:
requests:
- name: gpu
deviceClassName: gpu.example.com

---
apiVersion: v1
Expand All @@ -38,7 +35,28 @@ spec:
args: ["export; sleep 9999"]
resources:
claims:
- name: gpus
- name: shared-gpu
resourceClaims:
- name: gpus
resourceClaimTemplateName: multiple-gpus
- name: shared-gpu
resourceClaimName: single-gpu

---
apiVersion: v1
kind: Pod
metadata:
namespace: gpu-test4
name: pod1
labels:
app: pod
spec:
containers:
- name: ctr0
image: ubuntu:22.04
command: ["bash", "-c"]
args: ["export; sleep 9999"]
resources:
claims:
- name: shared-gpu
resourceClaims:
- name: shared-gpu
resourceClaimName: single-gpu
88 changes: 88 additions & 0 deletions demo/gpu-test5.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,88 @@
# One pod, 1 container
# Run as deployment with 1 replica

---
apiVersion: v1
kind: Namespace
metadata:
name: gpu-test5

---
apiVersion: resource.k8s.io/v1alpha3
kind: ResourceClaimTemplate
metadata:
namespace: gpu-test5
name: multiple-gpus
spec:
spec:
devices:
requests:
- name: ts-gpu
deviceClassName: gpu.example.com
- name: sp-gpu
deviceClassName: gpu.example.com
config:
- requests: ["ts-gpu"]
opaque:
driver: gpu.example.com
parameters:
apiVersion: gpu.resource.example.com/v1alpha1
kind: GpuConfig
sharing:
strategy: TimeSlicing
timeSlicingConfig:
duration: Long
- requests: ["sp-gpu"]
opaque:
driver: gpu.example.com
parameters:
apiVersion: gpu.resource.example.com/v1alpha1
kind: GpuConfig
sharing:
strategy: SpacePartitioning
spacePartitioningConfig:
partitionCount: 10

---
apiVersion: v1
kind: Pod
metadata:
namespace: gpu-test5
name: pod0
spec:
containers:
- name: ts-ctr0
image: ubuntu:22.04
command: ["bash", "-c"]
args: ["export; sleep 9999"]
resources:
claims:
- name: shared-gpus
request: ts-gpu
- name: ts-ctr1
image: ubuntu:22.04
command: ["bash", "-c"]
args: ["export; sleep 9999"]
resources:
claims:
- name: shared-gpus
request: ts-gpu
- name: sp-ctr0
image: ubuntu:22.04
command: ["bash", "-c"]
args: ["export; sleep 9999"]
resources:
claims:
- name: shared-gpus
request: sp-gpu
- name: sp-ctr1
image: ubuntu:22.04
command: ["bash", "-c"]
args: ["export; sleep 9999"]
resources:
claims:
- name: shared-gpus
request: sp-gpu
resourceClaims:
- name: shared-gpus
resourceClaimTemplateName: multiple-gpus

0 comments on commit 45fd39f

Please sign in to comment.