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
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:
@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”’.
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().
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.
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.
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.