Skip to content
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 8 additions & 4 deletions docs/source/contribute/cpp_debugger.md
Original file line number Diff line number Diff line change
Expand Up @@ -45,11 +45,15 @@ files you want to debug. All other source files are built and optimized as usual
We suggest the following steps:

1. Identify the source file you want to debug.
1. Build that file with debug symbols using a command similar to `USE_CUSTOM_DEBINFO="aten/src/ATen/native/Linear.cpp" python setup.py develop`.
1. Build that file with debug symbols using a command similar to

`USE_CUSTOM_DEBINFO="aten/src/ATen/native/Linear.cpp" python -m pip install --no-build-isolation -v -e .`
1. Set a breakpoint and start a debugger session. As you debug you will discover
additional files you want to debug.
1. Add those files to the `USE_CUSTOM_DEBINFO` environment variable.
1. Rebuild with a command similar to `USE_CUSTOM_DEBINFO="aten/src/ATen/native/Linear.cpp;newfile.cpp" python setup.py develop`.
1. Rebuild with a command similar to

`USE_CUSTOM_DEBINFO="aten/src/ATen/native/Linear.cpp;newfile.cpp" python -m pip install --no-build-isolation -v -e .`
1. Start your debugger session again.

At this point, your PyTorch is built with debugging symbols and ready to debug
Expand All @@ -62,7 +66,7 @@ For PyTorch, we recommend you do a full clean and rebuild each time.
Unfortunately, touching a file to update its timestamp does not reliably cause
that file to be rebuilt.

In the output of the `python setup.py develop` command, look for a line that
In the output of the `python -m pip install --no-build-isolation -v -e .` command, look for a line that
starts with `Source files with custom debug infos` to make sure your file was
built with debug symbols. For example:

Expand Down Expand Up @@ -188,7 +192,7 @@ settings turns off building CUDA and turns on handling an environment variable
to print dispatcher traces.

``` sh
USE_CUSTOM_DEBINFO="aten/src/ATen/native/Linear.cpp" USE_CUDA=0 LD_LIBRARY_PATH=/home/USERNAME/miniconda3/envs/torch310/lib CFLAGS="-DHAS_TORCH_SHOW_DISPATCH_TRACE" python setup.py develop
USE_CUSTOM_DEBINFO="aten/src/ATen/native/Linear.cpp" USE_CUDA=0 LD_LIBRARY_PATH=/home/USERNAME/miniconda3/envs/torch310/lib CFLAGS="-DHAS_TORCH_SHOW_DISPATCH_TRACE" python -m pip install --no-build-isolation -v -e .
```

## Future Work
Expand Down