I am using a maxwell gpu for cuda programming.
I can use the current cuda-gdb debugger by setting the environment variable CUDA_USE_LEGACY_DEBUGGER to 1.
But i can not use the Nsight VSCode extension for cuda debugging.
I have tried to set the initCommands of the launch configuration so that the legacy debugger gets used.
But i still cannot debug using the nsight extension in VSCode…
Thanks for getting in touch. What specific error message or roadblock stops the progress? Can you set the logFile property in launch.json and share the results? Like in the screenshot below. This may shine some light on the issue.
I turned the logging on and after some time i could figure out what the problem was:
When there are breakpoints in the standard cpp code and in the code that runs on the GPU, then the debugger will always only stop at the breakpoints of the standard cpp code!
This seems to be independent of when the breakpoint gets reached, so the debugger will also only stop at a cpp-only line if the stop should be happening after the breakpoint in the gpu code.
By the way, the stopAtEntry flag in the launch configuration does set a breakpoint at the beginning of the cpp code, so it must be false if you want to debug on the GPU!
Could someone please add that to the documentation of the vscode nsight extension.
It would also be nice, if somewhere in the nsight documentation it would say that for older GPUs you must set some environment variables. It is only documented very shortly in the cuda-gdb documentation.
I did set the environment variables in the launch configuration in the following way: "initCommands": ["set environment CUDA_DEBUGGER_SOFTWARE_PREEMPTION=1", "set environment CUDBG_USE_LEGACY_DEBUGGER=1"]
I hope this is helpful for someone else in the future.