Could you try the same in the cuda-gdb
command line interface?
home@debian-home:~/projects/cuda/cuda-learn$ cuda-gdb a.out
NVIDIA (R) CUDA Debugger
CUDA Toolkit 12.3 release
Portions Copyright (C) 2007-2023 NVIDIA Corporation
GNU gdb (GDB) 12.1
Copyright (C) 2022 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 GDB was configured as "x86_64-pc-linux-gnu".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.
For help, type "help".
Type "apropos word" to search for commands related to "word"...
Reading symbols from a.out...
(cuda-gdb)
And if I try continue:
(cuda-gdb) b gpu_matrix_multiply_many
Breakpoint 1 at 0xc859: file /home/home/projects/cuda/cuda-learn/gpu.cu, line 46.
(cuda-gdb) run
Starting program: /home/home/projects/cuda/cuda-learn/a.out
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib/x86_64-linux-gnu/libthread_db.so.1".
[New Thread 0x7ffff5bff000 (LWP 3862)]
[New Thread 0x7fffeffff000 (LWP 3863)]
[Detaching after fork from child process 3864]
[New Thread 0x7fffee7dd000 (LWP 3875)]
[New Thread 0x7fffecfbb000 (LWP 3876)]
[Switching focus to CUDA kernel 0, grid 1, block (0,0,0), thread (0,0,0), device 0, sm 0, warp 0, lane 0]
Thread 1 "a.out" hit Breakpoint 1, gpu_matrix_multiply_many<<<(256,1,1),(256,1,1)>>> (a=0x7fffc6000000, b=0x7fffc4000000, result=0x7fffc2000000, index=0) at gpu.cu:47
47 int idx = blockIdx.x * blockDim.x + threadIdx.x;
This works in the cuda-gdb terminal.
(cuda-gdb) info locals
i = 15
local_a = {0, 6, -3, -6, -3, 0, 7, -8, -8, -10, -2, -1, 9, -7, -7, 0 <repeats 4081 times>}
local_c = {0 <repeats 4096 times>}
idx = 0
MSG = 64
local_b = {-4, 6, 5, -3, -7, -10, -3, -3, -1, -10, 5, 4, -10, -2, 10, 0 <repeats 4081 times>}
offset = 0
But not works in VS Code.
Could you provide more details here?
I trying to debug my program. I press F5 in VS Code and run debugging mode. I can step into
and step over
if break point is contained in the host function (main, for example). When break point gets into the device (__global__, for example) function I have problem, VS Code informs about error (The editor could not be opened because the file was not found
).
Are you trying to use cuda info devices
?
I didn`t understand how to call this command. This command not work, but nvidia-smi
works (if you want to see my device info):
home@debian-home:~/projects/cuda/cuda-learn$ nvidia-smi
Mon Jan 29 15:23:41 2024
+---------------------------------------------------------------------------------------+
| NVIDIA-SMI 545.23.08 Driver Version: 545.23.08 CUDA Version: 12.3 |
|-----------------------------------------+----------------------+----------------------+
| 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 MX230 On | 00000000:01:00.0 Off | N/A |
| N/A 49C P8 N/A / ERR! | 4MiB / 2048MiB | 0% Default |
| | | N/A |
+-----------------------------------------+----------------------+----------------------+
+---------------------------------------------------------------------------------------+
| Processes: |
| GPU GI CI PID Type Process name GPU Memory |
| ID ID Usage |
|=======================================================================================|
| 0 N/A N/A 882 G /usr/lib/xorg/Xorg 4MiB |
+---------------------------------------------------------------------------------------+