Cannot step into CUDA kernel while debugging with VSCode on WSL2 Ubuntu 22.04

Hi,

I’m developing a CUDA application on Windows 11 using WSL2 with Ubuntu 22.04, and debugging with VS Code.

My current setup allows me to:

  • Successfully run CUDA programs (nvcc and cuda-gdb are working),
  • Launch and attach the debugger from VS Code,
  • Set breakpoints in both host code and device (kernel) code.

However, although breakpoints can be set in the kernel code, when I try to step into a kernel function (e.g., at a cudaMalloc or kernel launch like myKernel<<<>>>), the debugger immediately skips over the kernel and does not enter or step through the device code. It just resumes execution on the host side.

I have already:

  • Verified that /usr/local/cuda-12.6 is installed correctly in WSL2,
  • Added cuda-gdb to my environment path,
  • Enabled the registry key HKEY_LOCAL_MACHINE\SOFTWARE\NVIDIA Corporation\GPUDebugger\EnableInterface with DWORD 1 on the Windows side,
  • Ensured the GPU is visible to WSL2 with nvidia-smi.

Still, stepping into the kernel doesn’t work.

How can I get CUDA-GDB (via VSCode or otherwise) to properly debug inside kernel code?

Thanks in advance!

Have you tried using cuda-gdb directly ? Is it the same behavior ?
Have you tried other CUDA sample ? You can use GitHub - NVIDIA/cuda-samples: Samples for CUDA Developers which demonstrates features in CUDA Toolkit

If you still repro, please provide the src code.

CUDA 12.9 Update 1 is recently released. Can you try with it ? Thanks !

Any update with the latest release ?
Are you ssh remote to the WSL ?

I have the same problem? How to solve it.

1 Like

Sorry, this is a known issue for now. Please don’t use cuda-gdb by SSH into WSL.
This is supposed to be fixed in future release.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.