Before You Start
Set up the environment.
Configure environment variables by referring to Environment Setup.
Restrictions
- To enable the msDebug tool, specify the --debug parameter when installing the driver. For details, see Environment Setup.
- For a single device, only one msDebug tool can be used for debugging. You are not advised to run other operator programs at the same time.
- During operator debugging, the overflow/underflow detection function is disabled.
Starting the Tool
The msDebug tool can be started in either of the following ways.
If Cannot read termcap database; using dumb terminal settings. is displayed, run the export TERMINFO= xx command to clear the prompt. xx indicates the local terminal path.
export TERMINFO= xx //xx can be queried by running the infocmp -D command. You can select a path that meets the current terminal configuration as the value of TERMINFO.
- Load the executable file application.
- After the operator is built, the executable file application on the NPU can be obtained.
- Use msDebug to load the executable file.
$ msdebug application (msdebug) target create "application" Current executable set to '${INSTALL_DIR}/projects/application' (aarch64). (msdebug)
If the executable file has other input parameters, pass them as follows:msdebug application parameter1 parameter2 ...
- By loading the Python script for operator call
- After plugins of the PyTorch framework are developed, you can directly call Ascend C custom operators from PyTorch through the custom Python script test_ops_custom.py.
- Use msDebug to load the Python script.
$ 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)
Exiting Debugging
Exit the debugger as follows:
(msdebug) q [localhost add_ascendc_sample]$
The debugging channel cannot be disabled independently. To disable the debugging channel, you need to enable the overwrite mode. For details, see the NPU driver and firmware installation documents.
Parent topic: msDebug (Operator Debugging)