From e2351eb9b66931a9038a988d1541fb908ab889e4 Mon Sep 17 00:00:00 2001 From: Yuan Chen Date: Tue, 7 May 2024 06:16:17 -0700 Subject: [PATCH] Add a timeslicing sharing example to quickstart Signed-off-by: Yuan Chen Update namespace Signed-off-by: Yuan Chen Update the timeslicing example Signed-off-by: Yuan Chen --- demo/specs/quickstart/README.md | 16 ++++ .../quickstart/gpu-test-timeslicing.yaml | 75 +++++++++++++++++++ 2 files changed, 91 insertions(+) create mode 100644 demo/specs/quickstart/gpu-test-timeslicing.yaml diff --git a/demo/specs/quickstart/README.md b/demo/specs/quickstart/README.md index b7feeca5..25033ead 100644 --- a/demo/specs/quickstart/README.md +++ b/demo/specs/quickstart/README.md @@ -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 +``` diff --git a/demo/specs/quickstart/gpu-test-timeslicing.yaml b/demo/specs/quickstart/gpu-test-timeslicing.yaml new file mode 100644 index 00000000..f7fdb272 --- /dev/null +++ b/demo/specs/quickstart/gpu-test-timeslicing.yaml @@ -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