Ascend Device Plugin

使用约束

在安装Ascend Device Plugin前,需要提前了解相关约束,具体说明请参见表1

表1 约束说明

约束场景

约束说明

NPU驱动

MindCluster Ascend Device Plugin会周期性调用NPU驱动的相关接口。如果要升级驱动,请先停止业务任务,再停止MindCluster Ascend Device Plugin容器服务。

配合MindCluster Ascend Docker Runtime使用

组件安装顺序要求如下:

MindCluster Ascend Device Plugin容器化运行时会自动识别是否安装了MindCluster Ascend Docker Runtime,需要优先安装MindCluster Ascend Docker RuntimeMindCluster Ascend Device Plugin才能正确识别MindCluster Ascend Docker Runtime的安装情况。

组件版本要求如下:

该功能要求MindCluster Ascend Docker RuntimeMindCluster Ascend Device Plugin版本保持一致且需要为5.0.RC1及以上版本,安装或卸载MindCluster Ascend Docker Runtime之后需要重启容器引擎才能使MindCluster Ascend Device Plugin正确识别。

若存在以下2种场景,需要卸载并重新安装MindCluster Ascend Device Plugin,才可使MindCluster Ascend Device Plugin正确识别MindCluster Ascend Docker Runtime
  • Docker场景:daemon.json配置了“{"live-restore": true }”选项。
  • Containerd场景:containerd.service配置了“KillMode=process”选项。
以下2种场景不支持MindCluster Ascend Device PluginMindCluster Ascend Docker Runtime配合使用。
  • 混插场景。
  • Atlas 200I SoC A1 核心板

DCMI动态库

DCMI动态库目录权限要求如下:

MindCluster Ascend Device Plugin调用的DCMI动态库及其所有父目录,需要满足属主为root,其他属主程序无法运行;同时,这些文件及其目录需满足group和other不具备写权限。

DCMI动态库路径深度必须小于20。

如果通过设置LD_LIBRARY_PATH设置动态库路径,LD_LIBRARY_PATH环境变量总长度不能超过1024。

Atlas 200I SoC A1 核心板

Atlas 200I SoC A1 核心板节点上如果使用容器化部署MindCluster Ascend Device Plugin,需要配置多容器共享模式,具体请参考Atlas 200I SoC A1 核心板 NPU驱动和固件安装指南

Atlas 200I SoC A1 核心板使用MindCluster Ascend Device Plugin组件,需要遵循以下配套关系:
  • 5.0.RC2版本的MindCluster Ascend Device Plugin需要配合Atlas 200I SoC A1 核心板的23.0.RC2及其之后的驱动一起使用。
  • 5.0.RC2之前版本的MindCluster Ascend Device Plugin只能和Atlas 200I SoC A1 核心板的23.0.RC2之前的驱动一起使用。

虚拟机场景

如果在虚拟机场景下部署MindCluster Ascend Device Plugin,需要在MindCluster Ascend Device Plugin的镜像中安装systemd,推荐在Dockerfile中加入RUN apt-get update && apt-get install -y systemd命令进行安装。

操作步骤

  1. 以root用户登录各计算节点,并执行以下命令查看镜像和版本号是否正确。

    docker images | grep k8sdeviceplugin

    回显示例如下:

    ascend-k8sdeviceplugin               v5.0.0.2              29eec79eb693        About an hour ago   105MB
    • 是,执行2
    • 否,请参见准备镜像,完成镜像制作和分发。

  2. 将软件包中的yaml文件拷贝到K8s管理节点上。请注意此处需使用适配具体处理器型号的yaml文件,并且为了避免自动识别MindCluster Ascend Docker Runtime功能出现异常,请勿修改yaml文件中DaemonSet.metadata.name字段,详见下表。

    表2 MindCluster Ascend Device Plugin的yaml文件列表

    yaml文件列表

    说明

    device-plugin-310-v{version}.yaml

    推理服务器(插Atlas 300I 推理卡)上不使用MindCluster Volcano的配置文件。

    device-plugin-310P-v{version}.yaml

    Atlas 推理系列产品上不使用MindCluster Volcano的配置文件。

    device-plugin-910-v{version}.yaml

    Atlas 训练系列产品Atlas A2 训练系列产品上不使用MindCluster Volcano的配置文件。

    device-plugin-310P-1usoc-v{version}.yaml

    Atlas 200I SoC A1 核心板上不使用MindCluster Volcano的配置文件。

    device-plugin-volcano-v{version}.yaml

    Atlas 训练系列产品Atlas A2 训练系列产品上使用MindCluster Volcano的配置文件。

    device-plugin-310-volcano-v{version}.yaml

    推理服务器(插Atlas 300I 推理卡)上使用MindCluster Volcano的配置文件。

    device-plugin-310P-volcano-v{version}.yaml

    Atlas 推理系列产品上使用MindCluster Volcano的配置文件。

    device-plugin-310P-1usoc-volcano-v{version}.yaml

    Atlas 200I SoC A1 核心板上使用MindCluster Volcano的配置文件。

  3. 如不修改组件启动参数,可跳过本步骤。否则,根据实际情况修改MindCluster Ascend Device Plugin的启动参数。启动参数请参见表3,可执行./device-plugin -h查看参数说明。

    • Atlas 200I SoC A1 核心板节点上,修改启动脚本“run_for_310P_1usoc.sh”MindCluster Ascend Device Plugin的启动参数。修改完后需在所有Atlas 200I SoC A1 核心板节点上重新制作镜像,或者将本节点镜像重新制作后分发到其余所有Atlas 200I Soc A1 核心板节点。

      如果不使用MindCluster Volcano作为调度器,在启动MindCluster Ascend Device Plugin的时候,需要修改“run_for_310P_1usoc.sh”MindCluster Ascend Device Plugin的启动参数,将“-volcanoType”参数设置为false。

    • 其他类型节点,修改对应启动yaml文件中MindCluster Ascend Device Plugin的启动参数。

  4. K8s管理节点上各yaml对应路径下执行以下命令,启动对应服务。

    • K8s集群中存在使用推理服务器(插Atlas 300I 推理卡)的节点(MindCluster Ascend Device Plugin独立工作,不协同MindCluster Volcano使用)。
      kubectl apply -f device-plugin-310-v{version}.yaml
    • K8s集群中存在使用Atlas 推理系列产品的节点(MindCluster Ascend Device Plugin独立工作,不协同MindCluster Volcano使用)。
      kubectl apply -f device-plugin-310P-v{version}.yaml
    • K8s集群中存在使用Atlas A2 训练系列产品Atlas 训练系列产品的节点(MindCluster Ascend Device Plugin独立工作,不协同MindCluster VolcanoMindCluster HCCL Controller使用)。
      kubectl apply -f device-plugin-910-v{version}.yaml
    • K8s集群中存在使用推理服务器(插Atlas 300I 推理卡)的节点(协同MindCluster Volcano使用)。
      kubectl apply -f device-plugin-310-volcano-v{version}.yaml
    • K8s集群中存在使用Atlas 推理系列产品的节点(协同MindCluster Volcano使用)。
      kubectl apply -f device-plugin-310P-volcano-v{version}.yaml
    • K8s集群中存在使用Atlas A2 训练系列产品Atlas 训练系列产品的节点(协同MindCluster VolcanoMindCluster HCCL Controller使用)。
      kubectl apply -f device-plugin-volcano-v{version}.yaml
    • K8s集群中存在使用Atlas 200I SoC A1 核心板的节点(协同MindCluster Volcano使用)。
      kubectl apply -f device-plugin-310P-1usoc-volcano-v{version}.yaml
    • K8s集群中存在使用Atlas 200I SoC A1 核心板的节点(MindCluster Ascend Device Plugin独立工作,不协同MindCluster Volcano使用)。
      kubectl apply -f device-plugin-310P-1usoc-v{version}.yaml

    如果K8s集群使用了多种类型的昇腾AI处理器,请分别执行对应命令。

    启动示例如下:

    serviceaccount/ascend-device-plugin-sa created
    clusterrole.rbac.authorization.K8s.io/pods-node-ascend-device-plugin-role created
    clusterrolebinding.rbac.authorization.K8s.io/pods-node-ascend-device-plugin-rolebinding created
    daemonset.apps/ascend-device-plugin-daemonset created
    执行kubectl get pod -n kube-system命令,出现Running表示组件启动成功。
    NAME                                       READY   STATUS    RESTARTS   AGE
    ...
    ascend-device-plugin-daemonset-d5ctz       1/1     Running   0          11s
    ...

参数说明

表3 MindCluster Ascend Device Plugin启动参数

参数

类型

默认值

说明

-fdFlag

bool

false

边缘场景标志,是否使用FusionDirector系统来管理设备。

-shareDevCount

uint

1

共享设备特性开关,默认值为1,代表不开启共享。有效取值范围为[1, 100],仅支持以下设备,其余设备该参数无效,不影响组件正常启动。

  • Atlas 500 A2 智能小站
  • Atlas 200I A2 加速模块
  • Atlas 200I DK A2 开发者套件
  • Atlas 300I Pro 推理卡
  • Atlas 300V 视频解析卡
  • Atlas 300V Pro 视频解析卡
说明:

若用户使用的是以上支持的Atlas 推理系列产品产品,需要注意以下问题:

  • 不支持在使用静态vNPU调度、动态vNPU调度、推理卡故障恢复和推理卡故障重调度等特性下使用共享设备功能。
  • 单任务的请求资源数必须为1,不支持分配多芯片和跨芯片使用的场景。
  • 依赖驱动开启共享模式,设置device-share为true,详细操作步骤和说明请参见Atlas 中心推理卡 npu-smi 命令参考中的“配置功能 > 设置指定芯片的容器共享模式”章节。

-edgeLogFile

string

/var/alog/AtlasEdge_log/devicePlugin.log

边缘场景日志文件。fdFlag设置为true时生效。

说明:

单个日志文件超过20 MB时会触发自动转储功能,文件大小上限不支持修改。

-useAscendDocker

bool

true

默认为true,容器引擎是否使用MindCluster Ascend Docker Runtime。开启K8s的CPU绑核功能时,需要卸载MindCluster Ascend Docker Runtime并重启容器引擎。

说明:

MindX 5.0.RC1及以上版本只支持自动获取运行模式,不接受指定。

-use310PMixedInsert

bool

false

是否使用Atlas 推理系列产品混插模式。

说明:
  • 仅支持服务器混插Atlas 300I Pro 推理卡Atlas 300V 视频解析卡Atlas 300V Pro 视频解析卡
  • 服务器混插模式下不支持MindCluster Volcano调度模式。
  • 服务器混插模式不支持虚拟化实例。
  • 服务器混插模式不支持故障重调度场景。
  • 服务器混插模式不支持MindCluster Ascend Docker Runtime
  • 非混插模式Atlas 推理系列产品上报给K8s资源名称不变。
    • 非混插模式上报的资源名称格式为huawei.com/Ascend310P。
    • 混插模式上报的资源名称格式为:huawei.com/Ascend310P-V、huawei.com/Ascend310P-VPro和huawei.com/Ascend310P-IPro。

-volcanoType

bool

false

是否使用MindCluster Volcano进行调度,当前已支持Atlas 训练系列产品Atlas A2 训练系列产品Atlas 推理系列产品和推理服务器(插Atlas 300I 推理卡)芯片。

-presetVirtualDevice

bool

true

虚拟化实例功能开关。
  • 设置为true时,表示使用静态虚拟化,目前支持Atlas 训练系列产品Atlas A2 训练系列产品Atlas 推理系列产品
  • 设置为false时,表示使用动态虚拟化。目前只支持Atlas 推理系列产品的动态虚拟化,需要同步开启Volcano使用,即设置“-volcanoType”参数为true。

-version

bool

false

查看当前MindCluster Ascend Device Plugin的版本号。

-listWatchPeriod

int

5

设置健康状态检查周期,取值范围为[3,60],单位为秒。

-autoStowing

bool

true

是否自动纳管已修复设备,volcanoType为true时生效。

  • true表示会自动纳管。
  • false表示不会自动纳管。
说明:

设备故障后,会自动从K8s里面隔离。如果设备恢复正常,默认会自动加入K8s集群资源池。如果设备不稳定,可以设置为false,此时需要手动纳管。

  • 用户可以使用以下命令,将健康状态由unhealthy恢复为healthy的芯片重新放入资源池。
    kubectl label nodes node_name huawei.com/Ascend910-Recover-
  • 用户可以使用以下命令,将参数面网络健康状态由unhealthy恢复为healthy的芯片重新放入资源池。
    kubectl label nodes node_name huawei.com/Ascend910-NetworkRecover-

-logLevel

int

0

日志级别:

  • -1:debug。
  • 0:info。
  • 1:warning。
  • 2:error。
  • 3:critical。

-maxAge

int

7

日志备份时间限制,取值范围为[7, 700],单位为天。

-logFile

string

/var/log/mindx-dl/devicePlugin/devicePlugin.log

非边缘场景日志文件。fdFlag设置为false时生效。

说明:

单个日志文件超过20 MB时会触发自动转储功能,文件大小上限不支持修改。转储后文件的命名格式为:devicePlugin-触发转储的时间.log,如:devicePlugin-2023-10-07T03-38-24.402.log。

-hotReset

int

-1

设备热复位功能参数。开启此功能,芯片发生故障后,会进行热复位操作,让芯片恢复健康。
  • -1:关闭芯片复位功能
  • 0:开启推理设备复位功能
  • 1:开启训练设备复位功能
该参数支持的训练设备:
  • Atlas 800 训练服务器(型号 9000)(NPU满配)
  • Atlas 800 训练服务器(型号 9010)(NPU满配)
  • Atlas 900T PoD Lite
  • Atlas 900 PoD(型号 9000)
  • Atlas 800T A2 训练服务器
  • Atlas 900 A2 PoD 集群基础单元
该参数支持的推理设备:
  • Atlas 300I Pro 推理卡
  • Atlas 300V 视频解析卡
  • Atlas 300V Pro 视频解析卡
  • Atlas 300I Duo 推理卡
  • Atlas 300I 推理卡(型号 3000)(整卡)
  • Atlas 300I 推理卡(型号 3010)
说明:

针对Atlas 300I Duo 推理卡形态硬件,仅支持按卡复位,即两颗芯片会同时复位。

-linkdownTimeout

int

30

网络linkdown超时时间,单位秒;最小支持设置为1s,最大支持设置为30s。

说明:

该参数取值建议与用户在训练脚本中配置的HCCL_RDMA_TIMEOUT时间一致。如果是多任务,建议设置为多任务中HCCL_RDMA_TIMEOUT的最小值。

-maxBackups

int

30

转储后日志文件保留个数上限,取值范围为(0,30],单位为个。

-h或者-help

不涉及

显示帮助信息。