# Debugging Optix 7.1 with Nsight

**URL:** <https://forums.developer.nvidia.com/t/debugging-optix-7-1-with-nsight/142843>\
**Category:** OptiX\
**Created:** [July 20, 2020, 11:57pm UTC](https://forums.developer.nvidia.com/t/debugging-optix-7-1-with-nsight/142843 "2020-07-20T23:57:10Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Bird33](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Bird33](https://forums.developer.nvidia.com/u/Bird33)\
**Post date:** [July 20, 2020, 11:57pm UTC](https://forums.developer.nvidia.com/t/debugging-optix-7-1-with-nsight/142843/1 "2020-07-20T23:57:10Z")

</div>

I am unable to read the values of local variables in Optix 7.1 and the latest Nsight Cuda Debugger(Next-Gen). When the debugger hits a break point all I get in the “locals” window is an entry called Launch Details. Here’s a screen grab of the Optix 7.1 sample optixHello. I modified the NVRTC compiler options to include -G. Is there anything else that needs to be done to read local variables?

Optix 7.1  
Nsight Visual Studio Edition 2020.1  
Cuda v11.0

 ![OptixDebug](https://global.discourse-cdn.com/nvidia/original/3X/b/d/bda83491fc24894f29e9b0e418a0086080425b05.jpeg)

---

<div class="post-metadata">

**Author:** ![dhart](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/dhart/32/14043_2.png) [@dhart](https://forums.developer.nvidia.com/u/dhart)\
**Post date:** [July 21, 2020, 3:58pm UTC](https://forums.developer.nvidia.com/t/debugging-optix-7-1-with-nsight/142843/2 "2020-07-21T15:58:56Z")

</div>

Have you turned on lineinfo and disabled optimizations in your compile options?

```
    module_compile_options.optLevel = OPTIX_COMPILE_OPTIMIZATION_LEVEL_0;
    module_compile_options.debugLevel = OPTIX_COMPILE_DEBUG_LEVEL_LINEINFO;

```

---

<div class="post-metadata">

**Author:** ![Bird33](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Bird33](https://forums.developer.nvidia.com/u/Bird33)\
**Post date:** [July 21, 2020, 6:48pm UTC](https://forums.developer.nvidia.com/t/debugging-optix-7-1-with-nsight/142843/3 "2020-07-21T18:48:59Z")

</div>

Yes, I tried that and it didn’t make any difference.

---

<div class="post-metadata">

**Author:** ![dhart](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/dhart/32/14043_2.png) [@dhart](https://forums.developer.nvidia.com/u/dhart)\
**Post date:** [July 22, 2020, 3:23pm UTC](https://forums.developer.nvidia.com/t/debugging-optix-7-1-with-nsight/142843/4 "2020-07-22T15:23:12Z")

</div>

You’re right, inspecting locals does not currently work. I tried it and reproduced the same behavior, and then confirmed with the team that it’s not expected to work right now. I apologize for suggesting the optimization and lineinfo flags would help, I had thought it was all working. The team intends to fix this in the near future. In the mean time, maybe I can suggest some alternatives?

The register view should be working in the CUDA debugger just fine, so if you can map any of your locals to a specific register, you’ll be able to see the value. That isn’t normally very easy to do.

Another option, and my personal favorite, is to define a print macro that only activates when you click on a pixel. I’ve posted example code at the bottom of this comment:

> [@Vector functions for OptiX 7 with NVRTC?](https://forums.developer.nvidia.com/t/vector-functions-for-optix-7-with-nvrtc/80825/9):
>
> Hi, yes GTX 1050 is fine, there is no difference for Nsight debugging GTX vs RTX. By “watch” I assume you mean setting a breakpoint that is conditioned on a variable being equal to some value you choose? I haven’t been able to try this today in OptiX, but the Nsight VSE manual says you can set conditional breakpoints. If this works in OptiX programs, you will probably have to create a local variable with your pixel coordinates (via optixGetLaunchIndex) in order to get this to break on a pixel …

–  
David.

---

<div class="post-metadata">

**Author:** ![Bird33](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Bird33](https://forums.developer.nvidia.com/u/Bird33)\
**Post date:** [July 23, 2020, 10:39am UTC](https://forums.developer.nvidia.com/t/debugging-optix-7-1-with-nsight/142843/5 "2020-07-23T10:39:37Z")

</div>

Thanks for confirming and providing some workarounds!

---

<div class="post-metadata">

**Author:** ![gabemgem](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@gabemgem](https://forums.developer.nvidia.com/u/gabemgem)\
**Post date:** [September 25, 2020, 1:55pm UTC](https://forums.developer.nvidia.com/t/debugging-optix-7-1-with-nsight/142843/6 "2020-09-25T13:55:27Z")

</div>

@dhart Is there any update on whether locals are working now?

I am running into the same issue, though I did manage to get the register view working. I tried to use printf statements, but I always get ‘catastrophic error: cannot open source file “stdio.h”’.

---

<div class="post-metadata">

**Author:** ![dhart](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/dhart/32/14043_2.png) [@dhart](https://forums.developer.nvidia.com/u/dhart)\
**Post date:** [September 25, 2020, 10:18pm UTC](https://forums.developer.nvidia.com/t/debugging-optix-7-1-with-nsight/142843/7 "2020-09-25T22:18:46Z")

</div>

We don’t have symbol support for locals just yet, unfortunately, we’re still working on that.

How are you compiling your device code? Which compiler & CUDA toolkit do you have? The stdio.h error means that your build system isn’t giving the include path to stdio.h to your compiler.

If you are using the CUDA driver API, you could also consider cuPrintf().

–  
David.

---

<div class="post-metadata">

**Author:** ![gabemgem](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@gabemgem](https://forums.developer.nvidia.com/u/gabemgem)\
**Post date:** [September 29, 2020, 5:51pm UTC](https://forums.developer.nvidia.com/t/debugging-optix-7-1-with-nsight/142843/8 "2020-09-29T17:51:47Z")

</div>

I am compiling it with NVRTC through Visual Studios with the cmake file provided in the Optix 7.1 samples. My CUDA toolkit version is 11.0, but Visual Studio can’t find the cuPrintf files so I haven’t been able to use it.

---

<div class="post-metadata">

**Author:** ![Bird33](https://developer.download.nvidia.com/images/forums/profile-default-devtalk-84.png) [@Bird33](https://forums.developer.nvidia.com/u/Bird33)\
**Post date:** [December 4, 2020, 11:28pm UTC](https://forums.developer.nvidia.com/t/debugging-optix-7-1-with-nsight/142843/9 "2020-12-04T23:28:28Z")

</div>

Hi David,

Will local symbol support require a new version of OptiX7? Or will it be added via a new driver or new version of Nsight? It’s still not working here using Cuda 11.1.1, OptiX7.2 and Nsight 2020.2.1.20303.

Nsight 2020.2.1.20303 does seem to fix the slowdown in vs2019 intellisense  
https://forums.developer.nvidia.com/t/visual-studio-2019-became-too-slow-after-installing-cuda-11-1/155952

---

<div class="post-metadata">

**Author:** ![dhart](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/dhart/32/14043_2.png) [@dhart](https://forums.developer.nvidia.com/u/dhart)\
**Post date:** [December 5, 2020, 12:58am UTC](https://forums.developer.nvidia.com/t/debugging-optix-7-1-with-nsight/142843/10 "2020-12-05T00:58:32Z")

</div>

Those are all reasonable guesses. I don’t know yet what the release requirements will be, but we will definitely post on the forum about it when it arrives.

–  
David.

---

<div class="post-metadata">

**Author:** ![TomNVIDIA](https://sea2.discourse-cdn.com/nvidia/user_avatar/forums.developer.nvidia.com/tomnvidia/32/14181_2.png) [@TomNVIDIA](https://forums.developer.nvidia.com/u/TomNVIDIA)\
**Post date:** [June 14, 2022, 9:02pm UTC](https://forums.developer.nvidia.com/t/debugging-optix-7-1-with-nsight/142843/11 "2022-06-14T21:02:49Z")

</div>

Closed on June 14, 2022, 9:02pm UTC


