Skip to content

Commit b9f873f

Browse files
Merge pull request #60 from peachest/feat/runtime-class
feat: add ascend RuntimeClass manifest
2 parents 6415c27 + 1b9a332 commit b9f873f

3 files changed

Lines changed: 39 additions & 6 deletions

File tree

README.md

Lines changed: 17 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -32,17 +32,22 @@ docker buildx build -t $IMAGE_NAME .
3232

3333
### Label the Node with `ascend=on`
3434

35-
36-
```
35+
```bash
3736
kubectl label node {ascend-node} ascend=on
38-
```
37+
```
3938

4039
### Deploy ConfigMap
4140

42-
```
41+
```bash
4342
kubectl apply -f ascend-device-configmap.yaml
4443
```
4544

45+
### Deply RuntimeClass
46+
47+
```bash
48+
kubectl apply -f ascend-runtimeclass.yaml
49+
```
50+
4651
### Deploy `ascend-device-plugin`
4752

4853
```bash
@@ -51,6 +56,14 @@ kubectl apply -f ascend-device-plugin.yaml
5156

5257
If scheduling Ascend devices in HAMi, simply set `devices.ascend.enabled` to true when deploying HAMi, and the ConfigMap and `ascend-device-plugin` will be automatically deployed. refer https://github.com/Project-HAMi/HAMi/blob/master/charts/hami/README.md#huawei-ascend
5358

59+
If you require HAMi to automatically add the `runtimeClassName` configuration to Pods requesting Ascend resources (this is disabled by default), you should set `devices.ascend.runtimeClassName` value to **a non-empty string** in HAMi’s `values.yaml` file, ensuring it matches the name of the `RuntimeClass` resource. For example:
60+
61+
```yaml
62+
devices:
63+
ascend:
64+
runtimeClassName: ascend
65+
```
66+
5467
## Usage
5568
5669
To exclusively use an entire card or request multiple cards, you only need to set the corresponding resourceName. If multiple tasks need to share the same NPU, you need to set the corresponding resource request to 1 and configure the appropriate ResourceMemoryName.

README_cn.md

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -32,16 +32,22 @@ docker buildx build -t $IMAGE_NAME .
3232

3333
### 给 Node 打 ascend 标签
3434

35-
```
35+
```bash
3636
kubectl label node {ascend-node} ascend=on
3737
```
3838

3939
### 部署 ConfigMap
4040

41-
```
41+
```bash
4242
kubectl apply -f ascend-device-configmap.yaml
4343
```
4444

45+
### 部署 RuntimeClass
46+
47+
```bash
48+
kubectl apply -f ascend-runtimeclass.yaml
49+
```
50+
4551
### 部署 `ascend-device-plugin`
4652

4753
```bash
@@ -50,6 +56,14 @@ kubectl apply -f ascend-device-plugin.yaml
5056

5157
如果要在HAMi中使用升腾NPU, 在部署HAMi时设置 `devices.ascend.enabled` 为 true 会自动部署 ConfigMap 和 `ascend-device-plugin`。 参考 <https://github.com/Project-HAMi/HAMi/blob/master/charts/hami/README.md#huawei-ascend>
5258

59+
如果需要 HAMi 为申请 ascend 资源的 Pod 自动添加 runtimeClassName 配置(默认关闭),则应该在 HAMi 的 values.yaml 文件中配置 `deivces.ascend.runtimeClassName`**一个非空字符串**,并且与 RuntimeClass 资源名称保持一致。 例如:
60+
61+
```yaml
62+
devices:
63+
ascend:
64+
runtimeClassName: ascend
65+
```
66+
5367
## 使用
5468
5569
如果要独占整卡或者申请多张卡只需要设置对应的 resourceName 即可。如果多个任务要共享同一张卡,需要将 resourceName 设置为1,并且设置对应的 ResourceMemoryName。

ascend-runtimeclass.yaml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
apiVersion: node.k8s.io/v1
2+
handler: ascend
3+
kind: RuntimeClass
4+
metadata:
5+
name: ascend
6+
handler: ascend

0 commit comments

Comments
 (0)