English | 中文
This guide covers deploying ascend-device-plugin for use with the Volcano scheduler, via Volcano's HAMi mode deviceshare plugin. For background, see Volcano's own Ascend vNPU user guide.
-
Kubernetes: ≥ 1.20
-
Volcano: ≥ 1.14 (≥ 1.16 required for
hami-coresoft slicing) -
Ascend Driver Version: ≥ 25.5
-
npu-smimust be reachable on the host (only needed forhami-coresoft slicing), at one of the following paths (checked in order):/usr/local/Ascend/driver/tools/npu-smi(from the existing driver hostPath mount)/usr/local/sbin/npu-smi(mounted by default)/usr/local/bin/npu-smi
If
npu-smiis located at/usr/local/bin/npu-smi, please add the path mount inascend-device-plugin.yaml.
Note: hami-core soft slicing currently only supports ARM platforms; template-based hard slicing has no such restriction.
Follow the Volcano Installer Guide if Volcano isn't already installed in your cluster.
kubectl label node {ascend-node} ascend=onkubectl apply -f https://raw.githubusercontent.com/Project-HAMi/ascend-device-plugin/main/ascend-runtimeclass.yamlThis configMap is used for global configurations, like resourceName, mode, and templates.
- (Optional) Under
vnpus, sethamiVnpuCore: trueif you want to enablehami-vnpu-coresoft slicing on all nodes (unless overridden per node inhami-device-node-config).
kubectl apply -f https://raw.githubusercontent.com/Project-HAMi/ascend-device-plugin/main/ascend-device-configmap.yamlThe hami-device-node-config is used to enable or override hami-vnpu-core for specific nodes within the cluster. Node hamiVnpuMode takes priority over global vnpus.hamiVnpuMode; an omitted mode inherits the global setting. It also supports filterDevices to ignore specific devices on a node, e.g. filterDevices: {index: [0, 1], uuid: []}.
kubectl apply -f https://raw.githubusercontent.com/Project-HAMi/ascend-device-plugin/main/ascend-device-node-configmap.yamlkubectl apply -f https://raw.githubusercontent.com/Project-HAMi/ascend-device-plugin/main/ascend-device-plugin.yamlEnable the deviceshare plugin's Ascend HAMi vNPU support in volcano-scheduler-configmap:
kind: ConfigMap
apiVersion: v1
metadata:
name: volcano-scheduler-configmap
namespace: volcano-system
data:
volcano-scheduler.conf: |
actions: "enqueue, allocate, backfill"
tiers:
- plugins:
- name: predicates
- name: deviceshare
arguments:
deviceshare.AscendHAMiVNPUEnable: true # enable ascend vnpu
deviceshare.SchedulePolicy: binpack # scheduling policy: binpack / spread
deviceshare.KnownGeometriesCMNamespace: kube-system
deviceshare.KnownGeometriesCMName: hami-scheduler-deviceNote: volcano-vgpu has its own KnownGeometriesCMName/KnownGeometriesCMNamespace. If you need both vNPU and vGPU in the same Volcano cluster, merge the ConfigMaps from both sides and reference the merged one here.
Note: Each Ascend chip model has its own resourceName, resourceMemoryName, and resourceCoreName; see the hami-scheduler-device ConfigMap for the full mapping.
Note: To exclusively use an entire card or request multiple cards, you only need to set the corresponding resourceName.
Note: The device plugin applies soft slicing (libvnpu / hami-vnpu-core mounts and environment) only when the Pod sets huawei.com/vnpu-mode: hami-core. Pods without this annotation still follow the original vNPU path (virtualization templates and ASCEND_VNPU_SPECS), so on nodes that only expose hami-vnpu-core soft-slicing capacity, such Pods may stay Pending indefinitely.
Set schedulerName: volcano on your Pods so Volcano schedules them.
Without the hami-core annotation, Pods use the legacy template-based vNPU allocation:
apiVersion: v1
kind: Pod
metadata:
name: ascend-pod
spec:
schedulerName: volcano
runtimeClassName: ascend
containers:
- name: ubuntu-container
image: swr.cn-south-1.myhuaweicloud.com/ascendhub/ascend-pytorch:24.0.RC1-A2-1.11.0-ubuntu20.04
command: ["sleep"]
args: ["100000"]
resources:
limits:
huawei.com/Ascend310P: "1"
huawei.com/Ascend310P-memory: "4096"runtimeClassName: ascend (deployed in Deployment above) is required for all Ascend Pods regardless of slicing mode. To additionally use hami-vnpu-core soft slicing, also add the huawei.com/vnpu-mode: hami-core annotation:
apiVersion: v1
kind: Pod
metadata:
name: ascend-pod
annotations:
huawei.com/vnpu-mode: hami-core
spec:
schedulerName: volcano
runtimeClassName: ascend
containers:
- name: ubuntu-container
image: quay.io/ascend/vllm-ascend:v0.18.0-310p
command: ["sleep"]
args: ["100000"]
resources:
limits:
huawei.com/Ascend310P: "1"
huawei.com/Ascend310P-memory: "4096"
huawei.com/Ascend310P-core: "90"Deploy this plugin with its pinned hami-vnpu-core 9f7be4c library for per-card accounting. Multi-card allocations require equal memory and compute quotas on all selected cards. For four Ascend910B3 cards with 20 GiB memory and 50% compute each, use:
resources:
limits:
huawei.com/Ascend910B3: "4"
huawei.com/Ascend910B3-memory: "20480" # 20 GiB per card
huawei.com/Ascend910B3-core: "50" # 50% per cardThe plugin sets NPU_MEMORY_LIMIT_MB=20480 and NPU_COMPUTE_LIMIT=50, applied independently to every card; do not request -memory: "81920". The default compute policy is spatial. See the HAMi configuration guide for policy selection and upgrades.
NPU_GLOBAL_SHM_PATH=/hami-shared-region/global_registry and NPU_LOCAL_SHM_PATH=/hami-vnpu-shmem/vnpu_local_shmem are neutral base paths. On first use of a card, the core appends .device-<physicalID> to both paths. Local domains isolate container/card accounting; global domains share the same base across containers. No path is tied to the first allocated card. Applications continue to use container-local logical device IDs.
When a node runs in hami-vnpu-core (soft slicing) mode, the device plugin starts an embedded Prometheus exporter on :9395/metrics that reports physical-device and per-container vNPU usage. It is not started for the legacy template-based vNPU (or whole-card) path, which has no soft-slice data to export.
Quick check from inside the cluster:
POD_IP=$(kubectl -n kube-system get pod -l app.kubernetes.io/component=hami-ascend-device-plugin -o jsonpath='{.items[0].status.podIP}')
curl -s $POD_IP:9395/metrics | grep hami_| Metric | Labels | Description |
|---|---|---|
hami_host_gpu_memory_used_bytes |
device_index, device_uuid, device_type |
Physical NPU memory used (bytes) |
hami_host_gpu_utilization_ratio |
device_index, device_uuid, device_type |
Physical NPU AICore utilization (0–100) |
hami_vgpu_memory_used_bytes |
namespace, pod, container, vdevice_index, device_uuid |
Hook-accounted memory for this container on this NPU (bytes) |
hami_vgpu_memory_limit_bytes |
namespace, pod, container, vdevice_index, device_uuid |
This container's memory limit on this NPU (bytes) |
hami_container_device_utilization_ratio |
namespace, pod, container, vdevice_index, device_uuid |
AICore utilization of the device the container runs on (0–100) |
For per-device SHM domains, vdevice_index is the host physical device ID and device_uuid identifies that card. Legacy unsuffixed SHM retains its annotation/array ordinal. Only initialized domains are exported. Container memory describes hook-accounted allocations; host memory remains physical HBM usage reported by DCMI. The container utilization metric is the whole card's utilization, shared by containers on that card.