-
Notifications
You must be signed in to change notification settings - Fork 53
add documentation for Biren #430
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
Open
DSFans2014
wants to merge
4
commits into
Project-HAMi:master
Choose a base branch
from
DSFans2014:docs/support-biren
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
4 commits
Select commit
Hold shift + click to select a range
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 |
|---|---|---|
| @@ -0,0 +1,166 @@ | ||
| --- | ||
| title: Enable Biren Sharing | ||
| --- | ||
|
|
||
| ## Introduction | ||
|
|
||
| HAMi now supports sharing `birentech.com/gpu` (Birentech) devices and provides the following capabilities: | ||
|
|
||
| **Supports both full-card and SVI partitioning**: You can use either the full-card device or the SVI-based partitioning device. | ||
|
|
||
| **Device UUID selection**: You can specify or exclude particular devices through annotations. | ||
|
|
||
| ## Using Biren Devices | ||
|
|
||
| ### Enabling Biren Device Sharing | ||
|
|
||
| #### Label the Node | ||
|
|
||
| ```bash | ||
| kubectl label node {biren-node} biren=on | ||
| ``` | ||
|
|
||
| #### Deploy the `biren-device-plugin` | ||
|
|
||
| ```yaml | ||
| apiVersion: v1 | ||
| kind: Namespace | ||
| metadata: | ||
| name: biren-gpu | ||
| --- | ||
| apiVersion: v1 | ||
| kind: ServiceAccount | ||
| metadata: | ||
| name: device-plugin-sa | ||
| namespace: biren-gpu | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRole | ||
| metadata: | ||
| name: birentech-device-plugin | ||
| rules: | ||
| - apiGroups: [""] | ||
| resources: | ||
| - nodes | ||
| - pods | ||
| verbs: ["get", "list", "watch", "update", "patch"] | ||
|
|
||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRoleBinding | ||
| metadata: | ||
| name: birentech-device-plugin | ||
| roleRef: | ||
| apiGroup: rbac.authorization.k8s.io | ||
| kind: ClusterRole | ||
| name: birentech-device-plugin | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: device-plugin-sa | ||
| namespace: biren-gpu | ||
|
|
||
| --- | ||
| apiVersion: apps/v1 | ||
| kind: DaemonSet | ||
| metadata: | ||
| name: biren-device-plugin-daemonset | ||
| namespace: biren-gpu | ||
| spec: | ||
| selector: | ||
| matchLabels: | ||
| name: biren-device-plugin | ||
| template: | ||
| metadata: | ||
| annotations: | ||
| scheduler.alpha.kubernetes.io/critical-pod: "" | ||
| labels: | ||
| name: biren-device-plugin | ||
| app.kubernetes.io/component: exporter | ||
| app.kubernetes.io/name: gpu-exporter | ||
| spec: | ||
| nodeSelector: | ||
| biren: "on" | ||
| tolerations: | ||
| - key: CriticalAddonsOnly | ||
| operator: Exists | ||
| - key: birentech.com/gpu | ||
| operator: Exists | ||
| effect: NoSchedule | ||
| priorityClassName: "system-node-critical" | ||
| containers: | ||
| - name: k8s-device-plugin | ||
| image: projecthami/biren-device-plugin:latest | ||
| imagePullPolicy: Always | ||
| env: | ||
| - name: LD_LIBRARY_PATH | ||
| value: /usr/lib | ||
| - name: NODE_NAME | ||
| valueFrom: | ||
| fieldRef: | ||
| fieldPath: spec.nodeName | ||
| command: ["/root/k8s-device-plugin"] | ||
| args: ["--pulse", "300", "--container-runtime", "runc"] | ||
| securityContext: | ||
| privileged: true | ||
| volumeMounts: | ||
| - name: dp | ||
| mountPath: /var/lib/kubelet/device-plugins | ||
| - name: sys | ||
| mountPath: /sys | ||
| - name: brml | ||
| mountPath: /usr/lib | ||
| - name: brml-lib | ||
| mountPath: /usr/local/birensupa/driver/biren-smi/lib | ||
| readOnly: true | ||
| - name: brsmi | ||
| mountPath: /opt/birentech/bin | ||
| - mountPath: /dev | ||
| name: device | ||
| - name: cdi-config | ||
| mountPath: /etc/cdi | ||
| serviceAccountName: device-plugin-sa | ||
| volumes: | ||
| - name: dp | ||
| hostPath: | ||
| path: /var/lib/kubelet/device-plugins | ||
| - name: sys | ||
| hostPath: | ||
| path: /sys | ||
| - name: brml | ||
| hostPath: | ||
| path: /usr/lib | ||
| - name: brsmi | ||
| hostPath: | ||
| path: /usr/bin | ||
| - name: device | ||
| hostPath: | ||
| path: /dev | ||
| - name: cdi-config | ||
| hostPath: | ||
| path: /etc/cdi | ||
| - name: brml-lib | ||
| hostPath: | ||
| path: /usr/local/birensupa/driver/biren-smi/lib | ||
| ``` | ||
|
|
||
| ### Run Biren jobs | ||
|
|
||
| ```yaml | ||
| kind: Pod | ||
| metadata: | ||
| name: pod1 | ||
| spec: | ||
| containers: | ||
| - image: ubuntu | ||
| name: pod1-ctr | ||
| command: ["sleep"] | ||
| args: ["infinity"] | ||
| resources: | ||
| limits: | ||
| birentech.com/gpu: 1 | ||
| ``` | ||
|
|
||
| ## Notes | ||
|
|
||
| 1. When requesting Biren resources, you cannot specify the memory size. | ||
| 2. SVI partitioning can only split a single card into either two or four partitions. |
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,21 @@ | ||
| --- | ||
| title: Allocate Biren Device | ||
| --- | ||
|
|
||
| This example shows how to request a single Biren device in a plain Kubernetes Pod. The Pod runs a long-running container and requests one `birentech.com/gpu` device through the `resources.limits` section. You can use this as a starting point and adjust the image and resource limits to fit your own workloads. | ||
|
|
||
| ```yaml | ||
| apiVersion: v1 | ||
| kind: Pod | ||
| metadata: | ||
| name: pod1 | ||
| spec: | ||
| containers: | ||
| - image: ubuntu | ||
| name: pod1-ctr | ||
| command: ["sleep"] | ||
| args: ["infinity"] | ||
| resources: | ||
| limits: | ||
| birentech.com/gpu: 1 | ||
| ``` |
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
166 changes: 166 additions & 0 deletions
166
...urus-plugin-content-docs/current/userguide/biren-device/enable-biren-sharing.md
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,166 @@ | ||
| --- | ||
| title: 启用壁仞设备共享 | ||
| --- | ||
|
|
||
| ## Introduction | ||
|
|
||
| HAMi 现在支持共享 `birentech.com/gpu` (壁仞科技) 设备,并提供以下能力: | ||
|
|
||
| **支持整卡和 SVI 切分**: 可以在 HAMi 中使用整卡和SVI切分出来的卡。 | ||
|
|
||
| **设备 UUID 选择**: 可以通过注解指定或排除某些特定设备。 | ||
|
|
||
| ## 使用壁仞设备 | ||
|
|
||
| ### 启用壁仞设备共享 | ||
|
|
||
| #### 给节点打标签 | ||
|
|
||
| ```bash | ||
| kubectl label node {biren-node} biren=on | ||
| ``` | ||
|
|
||
| #### 部署 `biren-device-plugin` | ||
|
|
||
| ```yaml | ||
| apiVersion: v1 | ||
| kind: Namespace | ||
| metadata: | ||
| name: biren-gpu | ||
| --- | ||
| apiVersion: v1 | ||
| kind: ServiceAccount | ||
| metadata: | ||
| name: device-plugin-sa | ||
| namespace: biren-gpu | ||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRole | ||
| metadata: | ||
| name: birentech-device-plugin | ||
| rules: | ||
| - apiGroups: [""] | ||
| resources: | ||
| - nodes | ||
| - pods | ||
| verbs: ["get", "list", "watch", "update", "patch"] | ||
|
|
||
| --- | ||
| apiVersion: rbac.authorization.k8s.io/v1 | ||
| kind: ClusterRoleBinding | ||
| metadata: | ||
| name: birentech-device-plugin | ||
| roleRef: | ||
| apiGroup: rbac.authorization.k8s.io | ||
| kind: ClusterRole | ||
| name: birentech-device-plugin | ||
| subjects: | ||
| - kind: ServiceAccount | ||
| name: device-plugin-sa | ||
| namespace: biren-gpu | ||
|
|
||
| --- | ||
| apiVersion: apps/v1 | ||
| kind: DaemonSet | ||
| metadata: | ||
| name: biren-device-plugin-daemonset | ||
| namespace: biren-gpu | ||
| spec: | ||
| selector: | ||
| matchLabels: | ||
| name: biren-device-plugin | ||
| template: | ||
| metadata: | ||
| annotations: | ||
| scheduler.alpha.kubernetes.io/critical-pod: "" | ||
| labels: | ||
| name: biren-device-plugin | ||
| app.kubernetes.io/component: exporter | ||
| app.kubernetes.io/name: gpu-exporter | ||
| spec: | ||
| nodeSelector: | ||
| biren: "on" | ||
| tolerations: | ||
| - key: CriticalAddonsOnly | ||
| operator: Exists | ||
| - key: birentech.com/gpu | ||
| operator: Exists | ||
| effect: NoSchedule | ||
| priorityClassName: "system-node-critical" | ||
| containers: | ||
| - name: k8s-device-plugin | ||
| image: projecthami/biren-device-plugin:latest | ||
| imagePullPolicy: Always | ||
| env: | ||
| - name: LD_LIBRARY_PATH | ||
| value: /usr/lib | ||
| - name: NODE_NAME | ||
| valueFrom: | ||
| fieldRef: | ||
| fieldPath: spec.nodeName | ||
| command: ["/root/k8s-device-plugin"] | ||
| args: ["--pulse", "300", "--container-runtime", "runc"] | ||
| securityContext: | ||
| privileged: true | ||
| volumeMounts: | ||
| - name: dp | ||
| mountPath: /var/lib/kubelet/device-plugins | ||
| - name: sys | ||
| mountPath: /sys | ||
| - name: brml | ||
| mountPath: /usr/lib | ||
| - name: brml-lib | ||
| mountPath: /usr/local/birensupa/driver/biren-smi/lib | ||
| readOnly: true | ||
| - name: brsmi | ||
| mountPath: /opt/birentech/bin | ||
| - mountPath: /dev | ||
| name: device | ||
| - name: cdi-config | ||
| mountPath: /etc/cdi | ||
| serviceAccountName: device-plugin-sa | ||
| volumes: | ||
| - name: dp | ||
| hostPath: | ||
| path: /var/lib/kubelet/device-plugins | ||
| - name: sys | ||
| hostPath: | ||
| path: /sys | ||
| - name: brml | ||
| hostPath: | ||
| path: /usr/lib | ||
| - name: brsmi | ||
| hostPath: | ||
| path: /usr/bin | ||
| - name: device | ||
| hostPath: | ||
| path: /dev | ||
| - name: cdi-config | ||
| hostPath: | ||
| path: /etc/cdi | ||
| - name: brml-lib | ||
| hostPath: | ||
| path: /usr/local/birensupa/driver/biren-smi/lib | ||
| ``` | ||
|
|
||
| ### 运行壁仞任务 | ||
|
|
||
| ```yaml | ||
| kind: Pod | ||
| metadata: | ||
| name: pod1 | ||
| spec: | ||
| containers: | ||
| - image: ubuntu | ||
| name: pod1-ctr | ||
| command: ["sleep"] | ||
| args: ["infinity"] | ||
| resources: | ||
| limits: | ||
| birentech.com/gpu: 1 | ||
| ``` | ||
|
|
||
| ## 注意事项 | ||
|
|
||
| 1. 在申请壁仞资源时,**不能**指定显存大小。 | ||
| 2. 使用 SVI 切分时,一张卡只能切成两份或者四份。 | ||
21 changes: 21 additions & 0 deletions
21
...urus-plugin-content-docs/current/userguide/biren-device/examples/default-use.md
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,21 @@ | ||
| --- | ||
| title: 申请壁仞设备 | ||
| --- | ||
|
|
||
| 下面的示例展示了如何在一个普通的 Kubernetes Pod 中申请一个壁仞设备。该 Pod 以长时间运行的方式启动容器,并通过 `resources.limits` 中声明一个 `birentech.com/gpu` 设备。你可以在此基础上替换镜像、命令或资源配额,以适配自己的业务场景。 | ||
|
|
||
| ```yaml | ||
| apiVersion: v1 | ||
| kind: Pod | ||
| metadata: | ||
| name: pod1 | ||
| spec: | ||
| containers: | ||
| - image: ubuntu | ||
| name: pod1-ctr | ||
| command: ["sleep"] | ||
| args: ["infinity"] | ||
| resources: | ||
| limits: | ||
| birentech.com/gpu: 1 | ||
| ``` |
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.