Repository navigation
docs(concepts): add a Concepts section with SVG diagrams #940
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
Merged
Merged
Changes from all commits
Commits
Show all changes
19 commits
Select commit
Hold shift + click to select a range
92d657e
docs(concepts): replace Introduction with a Concepts category
togettoyou 5361ae1
docs(concepts): add device plugin and DRA background page
togettoyou e40c94a
docs(concepts): rewrite Architecture around the path of a Pod
togettoyou 740cab8
docs(concepts): explain the device sharing resource model
togettoyou 8e1ddab
docs(concepts): explain how HAMi-Core isolates memory and compute
togettoyou 04ee462
docs(concepts): add a Scheduling concept page
togettoyou 8da704f
docs(concepts): add an Observability concept page
togettoyou d509dfd
docs(concepts): redraw the ecosystem integrations diagram as SVG
togettoyou 4ad0b80
docs(concepts): redraw the GPU software stack diagrams as SVG
togettoyou b532eb9
docs(concepts): redraw the GPU drivers diagram and fix the module notes
togettoyou e73db0c
docs(concepts): add the problem, a diagram and how it works to What i…
togettoyou 66656a3
docs(concepts): move What is HAMi to the top of the sidebar
togettoyou 8cf0abe
docs(concepts): sync the Concepts section to v2.10.0
togettoyou e186a27
docs(concepts): fix arrow and label overlaps in three diagrams
togettoyou 9b244e8
docs(concepts): address review comments and replace the animated diag…
togettoyou aaf34c4
docs(concepts): clarify what the device plugin reports to kubelet
togettoyou 5ddcb72
docs(concepts): keep the Concepts section in next only
togettoyou 07e389f
docs(concepts): address review comments on facts and diagram readability
togettoyou fb2bbbd
docs(concepts): redo the diagrams in draw.io with brand colors and da…
togettoyou File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,30 +1,32 @@ | ||
| --- | ||
| title: Architecture | ||
| description: The four HAMi components and the path a Pod takes through them. | ||
| --- | ||
|
|
||
| The overall architecture of HAMi is shown as below: | ||
|
|
||
|  | ||
|   | ||
|
|
||
| HAMi consists of the following components: | ||
|
|
||
| - HAMi MutatingWebhook | ||
| - HAMi scheduler-extender | ||
| - Device-plugin (HAMi-device-plugin) | ||
| - In-container resource control (HAMi-Core) | ||
| | Component | Runs as | What it does | | ||
| | --- | --- | --- | | ||
| | MutatingWebhook | Part of the `hami-scheduler` Deployment | Checks each new Pod. If the Pod asks for HAMi resources and names no other scheduler, sets `schedulerName` to `hami-scheduler`. Other Pods pass through unchanged. | | ||
| | HAMi scheduler | `hami-scheduler` Deployment, next to `kube-scheduler` as a scheduler extender | Keeps a view of every GPU in the cluster. Filters nodes, picks a card, and writes the choice to the Pod's annotations. | | ||
| | HAMi device plugin | DaemonSet on each GPU node | Reports the node's cards to kubelet and to the scheduler. When a Pod starts, mounts the chosen card and HAMi-Core into the container and passes the limits as environment variables. | | ||
| | HAMi-Core (`libvgpu.so`) | Library loaded inside the container | Intercepts CUDA and NVML calls. Rejects memory allocations past the limit and can throttle kernel launches to the compute share. | | ||
|
|
||
| ## HAMi MutatingWebhook {#hami-mutatingwebhook} | ||
| ## The path of a Pod | ||
|
|
||
| HAMi MutatingWebhook checks if this task can be handled by HAMi. It scans the resource field of each pod submitted. If each resource the pod requires is either 'CPU', 'Memory' or a HAMi-resource, then it will set the schedulerName field of this pod to 'hami-scheduler'. | ||
| Take a Pod that asks for `nvidia.com/gpumem: 3000`: | ||
|
|
||
| ## HAMi Scheduler {#hami-scheduler} | ||
| 1. **Admission.** The webhook sees a HAMi resource and routes the Pod to `hami-scheduler`. | ||
| 2. **Scheduling.** The HAMi scheduler reads each card's memory and compute from node annotations. It keeps the nodes with a card that has 3000 MiB free, picks one card by policy, and records the card's UUID and the Pod's share in Pod annotations. | ||
| 3. **Start.** kubelet on the chosen node starts the Pod and calls the device plugin's `Allocate`. | ||
| 4. **Injection.** The device plugin reads the annotations, mounts the card, `libvgpu.so`, and `/etc/ld.so.preload` into the container, and sets `CUDA_DEVICE_MEMORY_LIMIT_0=3000m`. | ||
| 5. **Enforcement.** When any process in the container starts, the dynamic linker loads HAMi-Core first. From then on, HAMi-Core checks memory allocations and kernel launches against the limits. See [Device resource isolation](../key-features/device-resource-isolation.md). | ||
|
|
||
| The HAMi scheduler is responsible for assigning tasks to the appropriate nodes and devices. At the same time, the scheduler needs to maintain a global view of heterogeneous computing devices for monitoring. | ||
| ## Learn more | ||
|
|
||
| ## Device Plugin {#device-plugin} | ||
|
|
||
| The device-plugin layer obtains the scheduling result from the annotations field of the task and maps the corresponding device to the container. | ||
|
|
||
| ## HAMi-Core {#hami-core} | ||
|
|
||
| The in-container resource control is responsible for monitoring the resource usage within the container and providing hard isolation capabilities. | ||
| - [GPU virtualization principles](./gpu-virtualization.md): a detailed walk through registration, scheduling, and injection | ||
| - [Protocol design](../developers/protocol.md): the annotations the scheduler and device plugin exchange |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,51 @@ | ||
| --- | ||
| title: Device Plugin and DRA | ||
| description: The two ways Kubernetes hands devices to Pods, and how classic HAMi and HAMi-DRA use them. | ||
| sidebar_label: Device plugin and DRA | ||
| --- | ||
|
|
||
| Kubernetes has two ways to hand a device to a Pod: the device plugin API and Dynamic Resource Allocation (DRA). Classic HAMi uses a device plugin. [HAMi-DRA](https://github.com/Project-HAMi/HAMi-DRA) uses DRA. | ||
|
|
||
|   | ||
|
|
||
| ## Device plugin | ||
|
|
||
| A device plugin runs as a DaemonSet on each GPU node. It does three things: | ||
|
|
||
| 1. **Register** with kubelet under a resource name such as `nvidia.com/gpu`. | ||
| 2. **Report** its devices, each with an ID and a health state. kubelet publishes the count in the node's capacity. | ||
| 3. **Allocate** a device when a Pod starts on the node. kubelet calls the plugin, and the plugin returns the device files, mounts, and environment variables for the container. | ||
|
|
||
| The scheduler sees only that count. It learns that a node has 4 GPUs, and nothing about their memory or model. For a whole-card request that is enough. To place a 3000 MiB slice, the scheduler needs more. | ||
|
|
||
| HAMi fills the gap in two ways: | ||
|
|
||
| - The HAMi device plugin reports each card `deviceSplitCount` times (10 by default), so up to 10 Pods can hold a share of one card. A node with one GPU shows `nvidia.com/gpu: 10`. | ||
| - It writes each card's details to the node annotation `hami.io/node-nvidia-register`: UUID, memory, compute, model, NUMA node, and health. The HAMi scheduler reads this annotation to pick a card. | ||
|
|
||
| See [Protocol design](../developers/protocol.md) for how the scheduler and device plugin pass decisions through annotations. | ||
|
|
||
| ## Dynamic Resource Allocation | ||
|
|
||
| DRA reached general availability in Kubernetes v1.34. It describes devices and requests with these API objects: | ||
|
|
||
| | Object | Role | | ||
| | --- | --- | | ||
| | `ResourceSlice` | Published by the DRA driver. Lists each device with its attributes. | | ||
| | `DeviceClass` | A named set of devices, selected by attributes. | | ||
| | `ResourceClaim` | A Pod's request for devices, similar to a PersistentVolumeClaim. | | ||
| | `ResourceClaimTemplate` | A template the Pod references. Kubernetes creates a `ResourceClaim` from it for each Pod. | | ||
|
|
||
| The scheduler reads device attributes from `ResourceSlice` objects directly, so no annotation is needed. | ||
|
|
||
| HAMi-DRA keeps the HAMi Pod spec. Its webhook converts `nvidia.com/gpu`, `nvidia.com/gpumem`, and `nvidia.com/gpucores` into a `ResourceClaim`. HAMi-Core still enforces the limits inside the container, so isolation works the same way in both modes. | ||
|
|
||
| ## Which one to use | ||
|
|
||
| HAMi-DRA needs Kubernetes v1.34 or later with the DRA Consumable Capacity feature gate, plus CDI in the container runtime. On any other cluster, use classic HAMi. [Choose your setup](../get-started/choose-your-setup.md) has the full comparison. | ||
|
|
||
| ## Learn more | ||
|
|
||
| - [Kubernetes device plugins](https://kubernetes.io/docs/concepts/extend-kubernetes/compute-storage-net/device-plugins/) | ||
| - [Kubernetes Dynamic Resource Allocation](https://kubernetes.io/docs/concepts/scheduling-eviction/dynamic-resource-allocation/) | ||
| - [HAMi DRA for Kubernetes](../installation/how-to-use-hami-dra.md) |
|
togettoyou marked this conversation as resolved.
Resolved
|
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.