← 返回命令列表

Linux command

cuda-gdb 命令

文本

复制后可按需替换文件名、目录或参数。

常用示例

Debug a CUDA application

cuda-gdb [./program]

Debug with arguments

cuda-gdb --args [./program] [arg1] [arg2]

Attach to running process

cuda-gdb -p [pid]

Debug core dump

cuda-gdb [./program] [core]

Run with specific GPU

CUDA_VISIBLE_DEVICES=[0] cuda-gdb [./program]

说明

cuda-gdb is NVIDIA's extension of GNU GDB for debugging CUDA applications. It enables debugging both CPU and GPU code simultaneously, supporting breakpoints, single-stepping, and variable inspection in CUDA kernels. The debugger can stop execution at specific threads or blocks within a kernel, inspect device memory, and catch memory errors. It integrates CUDA's parallel execution model into GDB's interface, allowing navigation between thousands of concurrent threads. Focus modes let developers examine specific blocks and threads. Memory checking catches out-of-bounds accesses and other errors. Integration with NVIDIA Nsight systems provides IDE-based debugging.

参数

--args
Pass arguments to the debugged program.
-p _pid_
Attach to running process.
-x _file_
Execute GDB commands from file.
-tui
Enable text user interface mode.
-q, --quiet
Suppress startup messages.
--cuda-use-lockfile=0
Disable GPU lockfile (for multi-instance debugging).

FAQ

What is the cuda-gdb command used for?

cuda-gdb is NVIDIA's extension of GNU GDB for debugging CUDA applications. It enables debugging both CPU and GPU code simultaneously, supporting breakpoints, single-stepping, and variable inspection in CUDA kernels. The debugger can stop execution at specific threads or blocks within a kernel, inspect device memory, and catch memory errors. It integrates CUDA's parallel execution model into GDB's interface, allowing navigation between thousands of concurrent threads. Focus modes let developers examine specific blocks and threads. Memory checking catches out-of-bounds accesses and other errors. Integration with NVIDIA Nsight systems provides IDE-based debugging.

How do I run a basic cuda-gdb example?

Run `cuda-gdb [./program]` in a terminal, then adjust file names, paths, flags, or remote targets for your system.

What does --args do in cuda-gdb?

Pass arguments to the debugged program.