I want to debug my Cuda project inside the Optix project in Visual Studio 2017.
I set up a breakpoint then I start to debugging by Nsight -> Start Cuda Debugging. When I chose Debug -> Windows -> Locals I see some not defined by me variables like blockIdx, but I can’t see defined by me variables, I can’t see the variable that I iterate in a loop, etc.
Is it possible to get these values?
There are a number of restrictions when debugging and profiling in Optix code, as described in Nsight VSE’s Optix Restrictions. For the Nsight VSE debugger, the behavior you described is expected when in an [NVIDIA Internal] callstack function.
After the Optix callback, your breaking in your kernels will provide full inspection functionality.
Note that typically Optix code is compiled with nvcc -lineinfo instead of -G, so stepping/breaking in the optimized code may behave somewhat unexpectedly (compared to unoptimized code).