CUDA Debugger > How To > Specify Debugger Context

Program execution in CUDA takes place over hundreds or thousands of threads simultaneously. The CUDA Debugger features the CUDA Focus Picker, which lets you choose the blocks and threads of interest in the currently debugged application.

The Locals and Watch window, as well as the Step Into function use the block and thread of interest as context for their functionality.

Choosing a Block and Thread of Interest
  1. From the Nsight menu, choose Windows > CUDA Debug Focus...
  2. Enter the desired block index and thread index in the text fields provided. The block text field will show you valid indices as you type. You can only choose blocks that are currently executing on the GPU hardware.
  3. Choose OK.
    The Locals and Watch tool windows show variables and expressions evaluated in the context of the newly chosen thread.

Note: The Focus Picker affects the behavior of breakpoints.

Breakpoints are initially unconditional. When the debugger encounters the first breakpoint, the location of the breakpoint becomes the focus for all debugging. Stepping and breakpoints are set on the focus thread. This resets on the next kernel launch, going back to unconditional breakpoints.

For example, if the current focus is Block(0,0):Thread(5,2,0), then breakpoints will only hit when block and thread indices match the current focus indices.
Which thread has focus?

Consider how threads grab focus in the CUDA Debugger. For example, the debugger can change focus to another thread without notifying you. If the focus thread is not at a breakpoint, and a different thread hits a data breakpoint, conditional breakpoint, or an unconditional breakpoint, the CUDA Debugger changes the current focus thread. For example, if stopped in block (0,0,0) and thread (0,0,0) and a breakpoint hits in block (1,0,0) thread (0,0,0), the debugger will switch to the new thread. The debugger does not switch the focus thread when stepping, since the other threads are frozen.

 


NVIDIA® Nsight™ Development Platform, Visual Studio Edition User Guide Rev. 3.2.131009 ©2009-2013. NVIDIA Corporation. All Rights Reserved.

of