云容器引擎 CCE-NPU调度:使用NPU
使用NPU
创建工作负载申请NPU资源,可按如下方法配置,指定显卡的数量。
kind: DeploymentapiVersion: apps/v1metadata: name: npu-test namespace: defaultspec: 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
通过 huawei.com/ascend-310 指定申请NPU的数量。
指定 huawei.com/ascend-310 后,在调度时不会将负载调度到没有NPU的节点。如果缺乏NPU资源,会报类似“0/2 nodes are available: 2 Insufficient huawei.com/ascend-310.”的Kubernetes事件。
在CCE控制台使用NPU资源,只需在创建负载时,勾选昇腾310配额,并指定使用310芯片的数量,如下图所示。