VS2010的局部变量和全局变量工具窗口只支持在一个thread中查看变量一次,Nsight Debuger使用current focus thread and stack frame来计算这些表达式。
Nsight提出cuda Warp Watch的工具窗口,可以展示一个单独的focused Warp中的表达式的值的信息。
The view updates when the current CUDA focus changes, and always shows the warp that contains the current focus thread.
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.
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 isfloat
, but it is shadowing anint
.
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.
The CUDA Memory Checker shows results in the Warps Page of the CUDA Info window. Select theWarp 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 theSet 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.