NVIDIA Nsight Visual Studio Edition 2.2 User Guide > CUDA Debugger > How To > Use the CUDA Warp Watch

Visual Studio's local and global variable tool windows only support viewing a variable in a single thread at a time. The NVIDIA Nsight CUDA Debugger uses the current focus thread and stack frame to evaluate these expressions.

NVIDIA Nsight introduces the CUDA Warp Watch tool window, which shows information about evaluated expressions in a single focused warp in the NVIDIA Nsight CUDA Debugger within Visual Studio.

To use the CUDA Debugger Warp Watch feature: 
  1. Begin debugging your project in Visual Studio.
  2. From the Nsight menu, choose WindowsCUDA Warp Watch.
  3. Select the appropriate warp watch window.



  4. After selecting, you will be presented with a Warp Watch window, in which users can add their own expressions to watch.
    Expressions will be evaluated when the CUDA Debugger stops in a kernel by hitting a breakpoint or exception (for example, from the CUDA memory checker).



  5. The expressions can be edited from the Warp Watch context menu, by right-clicking on the tool window.



    The features shown here include the following: 
  6. The CUDA focus can be changed via one of the following four tool windows: 

    The view updates when the current CUDA focus changes, and always shows the warp that contains the current focus thread.

     

 

Example Scenarios

Example: Diverged Warp Watch

In this scenario, the lane is at a different PC than the focus lane. Lanes diverged from focus have a gray background.

Note this is NOT the same as inactive lanes. You can change to an inactive lane, and the other lanes will show diverged.



Example 1. An example of a successful evaluation, diverged at lane 16. In this figure, the focus is lane 16.



Example 2. Changing to a different focus shows the other lanes as diverged from focus. (This is represented by reversing the white and gray backgrounds.) In this instance, the lane was changed to 0, so lanes 16-31 are now gray; the PC is at line 54.



Example 3. Here, you can see that it is possible to have a variable that is valid in some lanes, but not in others.

 

Example: Error Types

Errors can occur for various reasons within the warp watch. For example: 


Example 4. This illustrates a shadow variable error. Here, the focus variable's type is float, but it is shadowing an int.

 

Another common cause for error is when the lane has diverged from the focus lane and is in a different stack frame. The CUDA Warp Watch feature does not evaluate in other stack frames.


Example 5. This illustrates a stack frame error. Here, the frame "SubFrame" does not exist in the even lanes, hence it cannot evaluate.

 

Warp Exceptions

The CUDA Memory Checker shows results in the Warps Page of the CUDA Info window. Select the Warp Exceptions bookmark, and it will filter to show any warp that is currently at an exception. These exceptions will match the output in the Output window.

When an exception is detected, the CUDA Debugger will stop in the first CUDA thread that triggered the exception. Use the Set Focus command in the Lanes and Warps pages, to switch to other threads.

 



Figure 1. A misaligned load in Global memory. The exception is being hit on the first 16 lanes in 5 warps.





Figure 2. The focus lane shows that 16 of the lanes have hit the exception.

 

 

 


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