2
votes

I am using NSight to debug my CUDA code and I have question: how can I place a breakpoint for a specific thread and block?

When I place a breakpoint on the kernel the debugger always stops at thread 0 of block 0.

2

2 Answers

9
votes

As discussed in the online help in Nsight, you can set a breakpoint and make it conditional on block and thread id like this:

To set a block or thread condition on a CUDA C breakpoint:

  1. Set a breakpoint on a line of source code.
  2. Right-click on the breakpoint.
  3. From the drop-down menu, select Condition...
  4. Type:

    @blockIdx(0,2,0) && @threadIdx(5,0,0)

  5. Click OK. The breakpoint glyph shows a plus sign.

4
votes

try to use CUDA Debug Focus. you can debug any thread in any block you want...