Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add a MIG example #182

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
57 changes: 57 additions & 0 deletions demo/specs/quickstart/gpu-test-mig.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
# Run as a deployment with 4 replicas
# Each replica shares a mig-enabled GPU with a profile of '1g.5gb'.

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

---
apiVersion: resource.k8s.io/v1alpha3
kind: ResourceClaimTemplate
metadata:
namespace: gpu-test-mig
name: mig-devices
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
name: mig-devices
name: mig-device

spec:
spec:
devices:
requests:
- name: mig-1g-5gb
deviceClassName: mig.nvidia.com
selectors:
- cel:
expression: "device.attributes['gpu.nvidia.com'].profile == '1g.5gb'"
constraints:
- requests: []
matchAttribute: "gpu.nvidia.com/parentUUID"
Comment on lines +25 to +27
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need for this with just a single MIG device request -- this pulls together the different requests and ensures the allocations come from the same underlying GPU

---
apiVersion: apps/v1
kind: Deployment
metadata:
namespace: gpu-test-mig
name: pod
labels:
app: gpu-test-mig
spec:
replicas: 4
selector:
matchLabels:
app: pod
template:
metadata:
labels:
app: pod
spec:
resourceClaims:
- name: mig-ts-gpu
resourceClaimTemplateName: mig-devices
Comment on lines +46 to +48
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we move this below the list of containers

containers:
- name: ctr
image: ubuntu:22.04
command: ["bash", "-c"]
args: ["nvidia-smi -L; trap 'exit 0' TERM; sleep 9999 & wait"]
resources:
claims:
- name: mig-ts-gpu
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wouldn't use the name *-ts-* here unless you put an explicit timeSlicing config on the request.

request: mig-1g-5gb