./Ascend-hdk-<chip_type>-npu-driver_<version>_linux-<arch>.run --debug
若安装CANN相关软件包时提示与驱动版本不匹配,可使用“--force”强制安装,该参数需要配合“--install”一起使用。
Ascend C算子的kernel侧源码通过毕昇编译器进行编译,编译后生成NPU域的可执行文件。编译选项添加 -g -O0,使算子编译时包含了所需的调试信息,以便于使用msDebug工具进行调试,具体方法可参考使用示例。
msdebug工具安装在Ascend-cann-toolkit开发套件包中,工具路径为${INSTALL_DIR}/tools/msdebug/bin/msdebug。
msdebug工具支持以下两种启动方式:
export TERMINFO=xx //xx信息可通过infocmp -D命令查询,可以选择符合当前终端配置的路径做为TERMINFO值
基于Ascend C算子的kernel侧框架执行一键式编译运行,可生成NPU侧可执行文件<kernel_name>_npu,具体操作可参考《Ascend C算子开发指南》中的“ 算子开发(基础篇)> 核函数运行验证”章节。
$ msdebug ./add_custom_npu
(msdebug) target create "./<kernel_name>_npu"
Current executable set to '${INSTALL_DIR}/projects/add_ascendc_sample/<kernel_name>_npu' (aarch64).
(msdebug)
msdebug ./<kernel_name>_npu parameter1 parameter2 ...
$ msdebug python3 test_ops_custom.py
msdebug(MindStudio Debugger) is part of MindStudio Operator-dev Tools.
The tool provides developers with a mechanism for debugging Ascend kernels running on actual hardware.
This enables developers to debug Ascend kernels without being affected by potential changes brought by simulation and emulation environments.
(msdebug) target create "./add_custom_npu"
Current executable set to ''${INSTALL_DIR}/projects/add_ascendc_sample/add_custom_npu' (aarch64).
(msdebug) settings set -- target.run-args "test_ops_custom.py"
(msdebug)
(msdebug) q [localhost add_ascendc_sample]$
该调试通道无法单独关闭,若要关闭调试通道,需要通过覆盖安装方式,具体请参见对应的NPU驱动和固件安装文档。
可以使用help命令输出工具命令的帮助信息,格式为“help msdebug_command”。
打印信息将会展示该命令的功能描述、使用语法以及参数选项。
(msdebug) help ascend aic change the id of the focused ascend aicore. Syntax: ascend aic <id>
如ascend info blocks命令的帮助信息如下所示:
(msdebug) help ascend info blocks show blocks overall info. Syntax: ascend info blocks Command Options Usage: ascend info blocks [-d] -d ( --details ) Show stopped states for all blocks.