请参考环境准备,完成相关环境变量的配置。
算子调试前,需先启用调试-g -O0编译选项重新编译,使算子二进制带上调试信息,具体方法可参考基于样例工程编译算子。
多算子场景时,仅支持导入指定单算子的调试信息,不支持导入多算子的调试信息,且仅支持对指定单算子的.o文件进行调试。
export LAUNCH_KERNEL_PATH={path_to_kernel}/my_kernel.o //{path_to_kernel}为kernel侧.o文件所在目录
(msdebug) image add {path_to_kernel}/my_kernel.o //{path_to_kernel}为kernel侧.o文件所在目录
(msdebug) image load -f {path_to_kernel}/my_kernel.o -s 0
msDebug工具支持以下两种启动方式:
export TERMINFO=xx //xx信息可通过infocmp -D命令查询,可以选择符合当前终端配置的路径做为TERMINFO值
$ msdebug ./application
msdebug -- ./application --flag1 arg1 --flag2 args2 ...
1 2 3 4 5 6 7 8 |
$ 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 "application" Current executable set to ''${INSTALL_DIR}/projects/application' (aarch64). (msdebug) settings set -- target.run-args "test_ops_custom.py" (msdebug) |
(msdebug) q [localhost add_ascendc_sample]$
该调试通道无法单独关闭,若要关闭调试通道,需要通过覆盖安装方式,具体请参见对应的NPU驱动和固件安装文档。