Hello everyone,
I am trying to set up debugging on a station with the following configuration:
- Windows 11
- NVidia T500 laptop GPU.
- WSL2 with Ubuntu 20.04 and Ubuntu 18.04.
CUDA debugging works fine within Visual Studio Community 2019 and Visual Studio 2022 (local development under Windows).
However, when I launch cuda-gdb
in WSL2, it fails:
cuda-gdb ./test_cuda_program
...
Reading symbols from ./test_cuda_program...
(cuda-gdb) r
...
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
HOST starting...
[Detaching after fork from child process 159]
fatal: One or more CUDA devices cannot be used for debugging. Please consult the list of supported CUDA devices for more details. (error code = CUDBG_ERROR_INVALID_DEVICE(0xb)
The same CUDBG_ERROR_INVALID_DEVICE
happens to:
- A cuda-gdb session inside a CUDA Docker container running in WSL2
- VSCode connected to WSL2
- VSCode connected to a CUDA Docker container running in WSL2
Otherwise, nvcc
compilation and running compiled CUDA code works fine under WSL2 and under a CUDA Docker container running in WSL2.
CUDA Toolkit Documentation mentions this: “CUDA debugging or profiling tools are not supported in WSL 2. This capability will be added in a future release.”
Does this mean that as of time of writing it is not possible to debug CUDA code with cuda-dbg
or with Nsight Visual Studio Code Edition if the target runs under WSL2 or a CUDA Docker container under WSL2?
–
Related post: Cuda-gdb not working for kernel code under WSL2