msProbe工具安装指南
环境和依赖
使用msProbe工具前,要求已存在可执行的用户AI应用,其中要求昇腾环境:
可正常运行用户AI应用,详细设备型号请参见《昇腾产品形态说明》。
已安装配套版本的CANN Toolkit开发套件包和算子包并配置环境变量,详情请参见《CANN 软件安装指南》。
安装说明
本文主要介绍msProbe工具的安装。当前支持从PyPI安装、下载whl包安装和编译安装三种方式。
推荐使用miniconda管理环境依赖。
conda create -n msprobe python
conda activate msprobe
工具限制与注意事项
工具读写的所有路径,如
config_path、dump_path等,只允许包含大小写字母、数字、下划线、斜杠、点和短横线。出于安全性及权限最小化角度考虑,本工具不应使用root等高权限账户,建议使用普通用户权限安装执行。
使用本工具前请确保执行用户的umask值大于等于0027,否则可能会导致工具生成的精度数据文件和目录权限过大。
用户须自行保证使用最小权限原则,如给工具输入的文件要求other用户不可写,在一些对安全要求更严格的功能场景下还需确保输入的文件group用户不可写。
msProbe建议执行用户与安装用户保持一致,如果使用root执行,请自行关注root高权限触及的安全风险。
从PyPI安装
pip install mindstudio-probe --pre
目前msProbe工具版本为预发布版本,请在命令行末尾添加--pre参数进行安装。
打印如下信息时,表示msProbe安装成功。
Successfully installed mindstudio-probe-{version}
下载whl包安装
请参考版本说明中的“版本配套说明”章节,下载msProbe的whl软件包。
获取到whl软件包后执行如下命令进行安装。
sha256sum {name}.whl # 验证whl包,若校验码一致,则whl包在下载中没有受损
pip install ./mindstudio_probe-{version}-py3-none-any.whl # 安装whl包
打印如下信息时,表示msProbe安装成功。
Successfully installed mindstudio-probe-{version}
若覆盖安装,请在命令行末尾添加 --force-reinstall 参数。
上面提供的whl包链接不包含adump、aclgraph_dump和atb_probe功能,如果需要使用这些功能,请参考编译安装下载源码编译whl包。
编译安装
功能说明
通过setup.py脚本编译msProbe工具的whl软件包。
命令格式
python3 setup.py bdist_wheel [--include-mod=<include_mode>] [--no-check]
参数说明
参数 |
可选/必选 |
说明 |
|---|---|---|
–include-mod |
可选 |
指定可选模块,可取值: |
–no-check |
可选 |
跳过证书校验。–include-mod指定adump或 tb_graph_ascend后,会下载所依赖的第三方库包,下载过程会进行证书校验,配置本参数可以跳过证书校验。 |
使用示例
编译安装基础工具包
git clone https://gitcode.com/Ascend/msprobe.git cd msprobe pip install setuptools wheel python3 setup.py bdist_wheel cd ./dist pip install ./mindstudio_probe*.whl
编译安装基础工具包和adump模块
git clone https://gitcode.com/Ascend/msprobe.git cd msprobe pip install setuptools wheel python3 setup.py bdist_wheel --include-mod=adump --no-check cd ./dist pip install ./mindstudio_probe*.whl
编译安装基础工具包和aclgraph_dump模块
git clone https://gitcode.com/Ascend/msprobe.git cd msprobe pip install setuptools wheel python3 setup.py bdist_wheel --include-mod=aclgraph_dump --no-check cd ./dist pip install ./mindstudio_probe*.whl
编译安装基础工具包和分级可视化插件
git clone https://gitcode.com/Ascend/msprobe.git cd msprobe pip install setuptools wheel python3 setup.py bdist_wheel --include-mod=tb_graph_ascend --no-check cd ./dist pip install ./mindstudio_probe*.whl
编译安装基础工具包和趋势可视化插件
git clone https://gitcode.com/Ascend/msprobe.git cd msprobe pip install setuptools wheel python3 setup.py bdist_wheel --include-mod=trend_analyzer --no-check cd ./dist pip install ./mindstudio_probe*.whl
编译安装基础工具包,同时编译安装分级可视化和趋势可视化插件
git clone https://gitcode.com/Ascend/msprobe.git cd msprobe pip install setuptools wheel python3 setup.py bdist_wheel --include-mod=tb_graph_ascend,trend_analyzer --no-check cd ./dist pip install ./mindstudio_probe*.whl
编译安装基础工具包和atb_probe模块
git clone https://gitcode.com/Ascend/msprobe.git cd msprobe pip install setuptools wheel python3 setup.py bdist_wheel --include-mod=atb_probe --no-check cd ./dist pip install ./mindstudio_probe*.whl
输出说明
打印如下信息时,表示msProbe安装成功。
Successfully installed mindstudio-probe-{version}
卸载
执行如下命令卸载msProbe工具。
pip uninstall mindstudio-probe
打印如下信息时,表示msProbe卸载成功。
Successfully uninstalled mindstudio-probe-{version}
升级
查看msProbe工具信息
pip show mindstudio-probe
示例如下:
Name: mindstudio-probe
Version: 26.0.x
Summary: Ascend MindStudio Probe Utils
Home-page: https://gitcode.com/Ascend/MindStudio-Probe
Author: Ascend Team
Author-email: pmail_mindstudio@xx.com
License: Mulan PSL v2
Location: /home/xxx/miniconda3/envs/xxx/lib/python3.x/site-packages/
Requires: einops, matplotlib, numpy, onnx, onnxruntime, openpyxl, pandas, protobuf, pyyaml, rich, setuptools, skl2onnx, tensorboard, tqdm, wheel
Required-by:
Ascend生态链接
安装CANN包
根据CPU架构和NPU型号选择Toolkit或Kernel,可参见昇腾社区下的《CANN 软件安装指南》。
运行示例:
Ascend-cann-toolkit_{version}_linux-{arch}.run --full --install-path={cann_path} Ascend-cann-kernels_{version}_linux-{arch}.run --install --install-path={cann_path}
配置环境变量
source {cann_path}/Ascend/ascend-toolkit/set_env.sh
安装PyTorch_NPU
安装MindSpeed LLM
请参见MindSpeed LLM。