I’m debugging the following program in Ubuntu-24.04 WSL:
#include <cstdio>
__global__ void kernel() {
printf("ok\n"); //break
printf("ok\n");
}
int main() {
kernel<<<1, 1>>>();
cudaDeviceSynchronize();
return 0;
}
Gdb fails with the assertion:
$ gdb /path/to/program
NVIDIA (R) cuda-gdb 12.8
Portions Copyright (C) 2007-2024 NVIDIA Corporation
Based on GNU gdb 13.2
Copyright (C) 2023 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This CUDA-GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://forums.developer.nvidia.com/c/developer-tools/cuda-developer-tools/cuda-gdb>.
Find the CUDA-GDB manual and other documentation resources online at:
<https://docs.nvidia.com/cuda/cuda-gdb/index.html>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from /home/nd/w/a/CLionProjects/cudaTest/cmake-build-debug-wsl-cuda-gdb/cudaTest...
(cuda-gdb) b main.cu:4
Breakpoint 1 at 0x8d8a: file /home/nd/w/a/CLionProjects/cudaTest/main.cu, line 6.
(cuda-gdb) run
Starting program: /home/nd/w/a/CLionProjects/cudaTest/cmake-build-debug-wsl-cuda-gdb/cudaTest
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff5fff000 (LWP 35007)]
[New Thread 0x7ffff4d6e000 (LWP 35008)]
[Detaching after fork from child process 35009]
[New Thread 0x7fffeffff000 (LWP 35018)]
[Thread 0x7fffeffff000 (LWP 35018) exited]
[New Thread 0x7fffeffff000 (LWP 35019)]
cuda-gdb/13/gdb/cuda/cuda-state.c:250: internal-error: create_module: Assertion `context' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
----- Backtrace -----
0x52954b ???
0x95ab34 ???
0x95ad58 ???
0xaf8ec1 ???
0x621ff6 ???
0x5ed474 ???
0x5edabe ???
0x49ba5f ???
0x798ba2 ???
0x9157c4 ???
0x7516b2 ???
0x7639b4 ???
0xaf98fc ???
0xaf9a05 ???
0x7ac1e6 ???
0x7ada14 ???
0x449524 ???
0x7f731acab1c9 __libc_start_call_main
../sysdeps/nptl/libc_start_call_main.h:58
0x7f731acab28a __libc_start_main_impl
../csu/libc-start.c:360
0x45133d ???
0xffffffffffffffff ???
---------------------
cuda-gdb/13/gdb/cuda/cuda-state.c:250: internal-error: create_module: Assertion `context' failed.
A problem internal to GDB has been detected,
further debugging may prove unreliable.
Quit this debugging session? (y or n)
Nvidia-smi output:
$ nvidia-smi
Wed Feb 19 12:03:37 2025
+-----------------------------------------------------------------------------------------+
| NVIDIA-SMI 570.86.17 Driver Version: 572.42 CUDA Version: 12.8 |
|-----------------------------------------+------------------------+----------------------+
| GPU Name Persistence-M | Bus-Id Disp.A | Volatile Uncorr. ECC |
| Fan Temp Perf Pwr:Usage/Cap | Memory-Usage | GPU-Util Compute M. |
| | | MIG M. |
|=========================================+========================+======================|
| 0 NVIDIA GeForce GTX 1650 On | 00000000:01:00.0 On | N/A |
| 30% 34C P8 N/A / 75W | 1133MiB / 4096MiB | 2% Default |
| | | N/A |
+-----------------------------------------+------------------------+----------------------+
+-----------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=========================================================================================|
| No running processes found |
+-----------------------------------------------------------------------------------------+