2. 安装与运行
2.1. 用户须知
2.1.1. 支持的平台
支持曦云® 系列GPU。
支持的软硬件平台兼容列表,参见《曦云® 系列通用GPU用户指南》中“系统支持范围”章节。
2.1.2. 系统模块
MX-DCM包含以下模块:
MX-DCM库(mxdcml)
mxdcml是MX-DCM的核心模块。mxdcml封装了底层通信以及设备管理细节,对外提供C语言接口,方便第三方工具调用。mxdcml提供静态库和动态库。
MX-DCM常驻进程(mx-dcmd)
mx-dcmd运行在安装有GPU的主机上,对外提供RESTful接口,执行GPU监控和管理功能。
MX-DCM命令行工具(mx-dcmi)
mx-dcmi运行在管理节点上。mx-dcmi接收用户命令,解析命令参数,通过调用mxdcml接口实现对远程主机上的设备进行管理。
2.2. 安装
安装包种类包括支持x86架构的deb、rpm包,以及x86与Arm的镜像。用户需根据操作系统解压相应压缩包。
2.2.1. 解压安装包
执行以下命令解压deb/rpm压缩包,可分别得到mx-dcmi及mx-dcmd的deb/rpm安装包,以及 mxdcmd.service 脚本。
tar -xf maca-mxdcm-x.x.x.x.amd64.xxx.tar.gz
2.2.2. 安装mx-dcmi
支持使用deb/rpm包安装。推荐安装在集群管理节点。
执行以下命令安装deb包。
sudo dpkg -i mxdcmi-x.x.x.x-x.x.x.x.amd64.deb
执行以下命令安装rpm包。
sudo rpm -ivh mxdcmi-x.x.x.x-x.x.x.x.x86_64.rpm
2.2.3. 安装mx-dcmd
支持使用deb/rpm包安装。需安装在带GPU卡的服务器中。
执行以下命令安装deb包。
sudo dpkg -i mxdcmd-x.x.x.x-x.x.x.x.amd64.deb
执行以下命令安装rpm包。
sudo rpm -ivh mxdcmd-x.x.x.x-x.x.x.x.x86_64.rpm
支持使用容器镜像。
执行以下命令加载镜像,根据架构选取相应的容器镜像。对于x86架构,选择amd64结尾的镜像;对于Arm架构,选择arm64结尾的镜像。
docker load -i mxdcmd_-x.x.x.x-x.x.x.x.amd64.xz docker load -i mxdcmd_-x.x.x.x-x.x.x.x.arm64.xz
2.3. 运行
2.3.1. mx-dcmd直接运行
mx-dcmd默认安装在/opt/mxdcm/bin/mx-dcmd,同时在/usr/local/bin下创建了软连接,可全局使用。
使用 mx-dcmd -h 命令查看启动时可以配置的参数:
USAGE:
mx-dcmd [-hv] [-l <DIR>|-s][-c <FILE>] [-p <PORT>]
Where:
-c <FILE>, --config <FILE>
Path to the configuration file, default: /opt/mxdcm/config/mxdcmd.cfg
-p <PORT>, --port <PORT>
Port to bind, default: 23412
Either of:
-s, --stdout
Log to stdout, default: 0
-l <DIR>, --logdir <DIR>
PATH to the log directory, default: ./mxdcmd-log
--, --ignore_rest
Ignores the rest of the labeled arguments following this flag.
-v, --version
Displays version information and exits.
-h, --help
Displays usage information and exits.
MetaX Data Center Management Daemon
以上参数均是可选的,可以直接运行 mx-dcmd 启动。
2.3.2. 部署systemd自启动服务
执行以下命令开启systemd自启动服务,可查看到服务为 active (running)。
sudo cp mxdcmd.service /etc/systemd/system/mxdcmd.service
sudo systemctl enable mxdcmd.service
sudo systemctl start mxdcmd.service
systemctl status mxdcmd.service
2.3.3. mx-dcmd容器内运行
可以使用同目录下的 start_mxdcmd.sh 脚本启动mx-dcmd容器镜像,具体参数说明如下:
参数 |
说明 |
|---|---|
|
支持 |
|
传入使用的镜像,默认为 |
|
容器名称,默认为 |
|
mxdcmd 日志存放路径,默认为容器标准输出 |
|
mx-dcmd对外的HTTP监听端口 |
|
mx-dcmd在容器内使用的配置文件路径 |
|
启用( |
|
启用( |
|
查看使用帮助 |
2.3.3.1. 示例1
执行以下命令启动mx-dcmd,指定镜像为mxcr.io/cloud/mx-dcmd:2.2.11.1:
sudo bash start_mxdcmd.sh --image=mxcr.io/cloud/mx-dcmd:2.2.11.1
2.3.3.2. 示例2
执行以下命令启动mx-dcmd,监听端口为8002,配置文件为/home/user/mxdcmd.cfg:
sudo bash start_mxdcmd.sh -p=8002 -c=/home/user/mxdcmd.cfg
2.3.4. mx-dcmi使用
mx-dcmi默认安装在/opt/mxdcm/bin/mx-dcmi,同时在/usr/local/bin下创建了软连接,可全局使用。
2.3.4.1. 使用帮助
mx-dcmi -h
执行命令后,显示如下:
USAGE:
mx-dcmi [-hv] subsystem
Where:
--, --ignore_rest
Ignores the rest of the labeled arguments following this flag.
-v, --version
Displays version information and exits.
-h, --help
Displays usage information and exits.
Subsystem <discovery|group|fieldgroup|dmon|stats|health|config|diag|topo|
nic|mccl>
(required) The desired subsystem to be accessed.
Subsystems available:
discovery Discovery GPUs on the system [mx-dcmi discovery -h for more info]
group GPU Group Management [mx-dcmi group -h for more info]
fieldgroup Field Group Management [mx-dcmi fieldgroup -h for more info]
dmon Stats Monitoring fo GPUs [mx-dcmi dmon -h for more info]
stats Process Statistics [mx-dcmi stats -h for more info]
diag System Validation/Diagnostic [mx-dcmi diag -h for more info]
health Health Monitoring [mx-dcmi health -h for more info]
topo GPU Topology [mx-dcmi topo -h for more info]
nic Nic info and diagnostic [mx-dcmi nic -h for more info]
mccl Mccl diagnostic [mx-dcmi mccl -h for more info]
MetaX Data Center Management Interface
2.4. 配置文件
mx-dcmd安装后,配置文件在/opt/mxdcm/config/mxdcmd.cfg。用户可以自行修改其中的配置参数。
可配置的参数包括 ip,port,loglevel 及各个monitor的初始状态。
配置文件示例:
# mx-dcmd config file
#ip = 1.1.1.1
# if port is not set, 23412 will be used
port = 23412
# 0:off, 1:debug, 2:info, 3:warn, 4:error
loglevel = 2
# 0:off, 1:on, default:on
#logMonitor = 1
# 0:off, 1:on, default:off
#eventMonitor = 0
2.5. 日志文件
mx-dcmd运行时的日志文件默认保存在./mxdcmd-log/mxdcmd_<date>.log。
<date>表示程序启动时的日期。用户可以在mx-dcmd启动时通过
-l <DIR>参数修改日志存放的目录。若日志需要直接输出到终端,可在运行mx-dcmd时指定
-s,注意-s与-l不可同时使用。