Skip to content

Commit

Permalink
Add a timeslicing sharing example to quickstart
Browse files Browse the repository at this point in the history
Signed-off-by: Yuan Chen <[email protected]>

Update namespace

Signed-off-by: Yuan Chen <[email protected]>

Update the timeslicing example

Signed-off-by: Yuan Chen <[email protected]>
  • Loading branch information
yuanchen8911 committed May 15, 2024
1 parent bbaffa0 commit e2351eb
Show file tree
Hide file tree
Showing 2 changed files with 91 additions and 0 deletions.
16 changes: 16 additions & 0 deletions demo/specs/quickstart/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -76,3 +76,19 @@ kubectl get pod -A
```console
nvidia-smi -L
```

#### Show the TimeSlicing example

```console
vim -O gpu-test-timeslicing.yaml
```

#### Deploy the MPS example
```console
kubectl apply -f gpu-test-timeslicing.yaml
```

#### Show the pod running
```console
kubectl get pod -n test-timeslicing -l app=pod
```
75 changes: 75 additions & 0 deletions demo/specs/quickstart/gpu-test-timeslicing.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# Two pods share GPU via TimeSlicing

apiVersion: v1
kind: Namespace
metadata:
name: timeslicing-gpu-test

---
apiVersion: resource.k8s.io/v1alpha2
kind: ResourceClaimTemplate
metadata:
namespace: timeslicing-gpu-test
name: timeslicing-gpu-test
spec:
spec:
resourceClassName: gpu.nvidia.com
parametersRef:
apiGroup: gpu.resource.nvidia.com
kind: GpuClaimParameters
name: timeslicing-gpu-test
---
apiVersion: gpu.resource.nvidia.com/v1alpha1
kind: GpuClaimParameters
metadata:
namespace: timeslicing-gpu-test
name: timeslicing-gpu-test
spec:
sharing:
strategy: TimeSlicing
timeSlicingConfig:
timeSlice: Short

---
apiVersion: v1
kind: Pod
metadata:
namespace: timeslicing-gpu-test
name: gpu-pod-1
labels:
app: pod
spec:
containers:
- name: ctr
image: oguzpastirmaci/gpu-burn
args: ["30"] # 30 seconds
resources:
claims:
- name: shared-gpu
resourceClaims:
- name: shared-gpu
source:
resourceClaimTemplateName: timeslicing-gpu-test
restartPolicy: Never

---
apiVersion: v1
kind: Pod
metadata:
namespace: timeslicing-gpu-test
name: gpu-pod-2
labels:
app: pod
spec:
containers:
- name: ctr
image: oguzpastirmaci/gpu-burn
args: ["30"] # 30 seconds
resources:
claims:
- name: shared-gpu
resourceClaims:
- name: shared-gpu
source:
resourceClaimTemplateName: timeslicing-gpu-test
restartPolicy: Never

0 comments on commit e2351eb

Please sign in to comment.