NPU Scheduling
You can use NPUs in CCE containers.
Prerequisites
- An NPU node has been created. For details, see Creating a Node.
- The huawei-npu has been installed. For details, see CCE AI Suite (Ascend NPU).
Using NPUs
Create a workload and request NPUs. You can specify the number of NPUs as follows:
kind: Deployment apiVersion: apps/v1 metadata: name: npu-test namespace: default spec: replicas: 1 selector: matchLabels: app: npu-test template: metadata: labels: app: npu-test spec: containers: - name: container-0 image: nginx:perl resources: limits: cpu: 250m huawei.com/ascend-310: '1' memory: 512Mi requests: cpu: 250m huawei.com/ascend-310: '1' memory: 512Mi imagePullSecrets: - name: default-secret
Specify the number of NPUs to be requested in huawei.com/ascend-310.
When you use huawei.com/ascend-310 to specify the number of NPUs, the values of requests and limits must be the same.
After huawei.com/ascend-310 is specified, workloads will be scheduled only to nodes with NPUs. If NPUs are insufficient, a Kubernetes event similar to "0/2 nodes are available: 2 Insufficient huawei.com/ascend-310." will be reported.
To use NPUs on the CCE console, select the NPU quota and specify the number of NPUs to be used when creating a workload.
NPU Node Labels
CCE will label NPU-enabled nodes that are ready to use.
$ kubectl get node -L accelerator/huawei-npu NAME STATUS ROLES AGE VERSION HUAWEI-NPU 10.100.2.59 Ready <none> 2m18s v1.19.10-r0-CCE21.11.1.B006-21.11.1.B006 ascend-310
kind: Deployment apiVersion: apps/v1 metadata: name: npu-test namespace: default spec: replicas: 1 selector: matchLabels: app: npu-test template: metadata: labels: app: npu-test spec: nodeSelector: accelerator/huawei-npu: ascend-310 containers: - name: container-0 image: nginx:perl resources: limits: cpu: 250m huawei.com/ascend-310: '1' memory: 512Mi requests: cpu: 250m huawei.com/ascend-310: '1' memory: 512Mi imagePullSecrets: - name: default-secret
Feedback
Was this page helpful?
Provide feedbackThank you very much for your feedback. We will continue working to improve the documentation.