-
Notifications
You must be signed in to change notification settings - Fork 1.5k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
enable breakpoints set in cu and cuh files #4585
enable breakpoints set in cu and cuh files #4585
Conversation
… in cu and cuh files
@trxcllnt Thanks for your PR. We have had some users asking questions about how to configure CUDA debugging. is the |
@pieandcakes I can't say one way or the other. I use
After that, I have a custom build step to generate a {
"version": "0.2.0",
"configurations": [
{
"name": "Debug C++ and CUDA tests",
"type": "cppdbg",
"request": "launch",
"cwd": "${workspaceFolder}",
"envFile": "${workspaceFolder}/.env",
"program": "${workspaceFolder}/build/gtests/${input:TEST_NAME}",
"MIMode": "gdb", "miDebuggerPath": "/usr/local/cuda/bin/cuda-gdb",
"setupCommands": [
{
"description": "Enable pretty-printing for gdb",
"text": "-enable-pretty-printing",
"ignoreFailures": true
}
]
},
],
"inputs": [
{
"id": "TEST_NAME",
"type": "pickString",
"description": "Please select a test to run",
"options": ["TEST_1","TEST_2","TEST_3","TEST_4"]
}
]
} Having this as part of the build means the test names are automatically inserted into the Hope this helps, |
Hey @trxcllnt, idk if it's a right place for it, but could you share how you use clangd with cuda files, since cmake doesn't provide compile_commands.json for .cu files? |
@friendnick CMake should include .cu files in the compilation database if you do |
@trxcllnt do you tweak cuda compiler setting in cmake to use clang then? by default cmake uses nvcc and then clangd fails to translate that to clang, giving |
@friendnick ah right. No, we use gcc and nvcc in CMake (with the Here's a quick run-down of the setup:
That bash script also has some other things in it you may find useful like CCaching for nvcc. You have to use CMake>=3.17.0 and ccache 4.0 (currently only available if built from master), then set the compiler symlinks manually (unfortunately using |
This PR adds a
"language": "cuda"
entry to package.json breakpoints list to allow setting breakpoints for thevscode-cpptools
plugin in.cu
and.cuh
files.This new entry shouldn't have any effect on regular users, but should enable breakpoints in
.cu
and.cuh
files for users with thevscode-cudacpp
plugin installed. That plugin contributes a CUDA language definition (with"languageId": "cuda"
), and handles some of the cuda-specific syntax like the<<< >>>
kernel launch parameters.This PR opts for the minimum changes necessary to get these two plugins working together. An alternate approach is to include the
vscode-cudacpp
CUDA language definitions invscode-cpptools
itself, which would enablevscode-cpptools
to support CUDA out of the box.In my testing, debugging CUDA is largely already supported by adding the following to any
"type": "cppdbg"
launch.json debugging configuration: