debug single kernel function

I have a problem in my code and need to debug it. Tried everything I can think of, but cannot find the problem without a debug similar to serial debug and my problem comes down to this:

This is a part of a sample code, which is the one that presents itself if you create new cuda project in VS , but my question is:

I’ve added just the lines 13-18 and several breakpoints, which is describing my problem. How can I debug this kernel (let’s say thread 1) and get n to actually iterate from 0-4, because like this, the loop seems to iterate (if i click continue, it jumps through breakpoints 5 times), but n is always ‘n’ has no value at the target location

Hello stanoo,

I’ve seen you question at stack overflow, looks like you compile your project use release mode, just switch to the debug mode and rebuild it, then you can see the value in nsight.

Best Regards
Harry

Hello Harry,

thank you for your answer, but it still doesn’t work, doesn’t matter if I compile, build, debug under release or debug mode.

I cannot repo on my local computer, could you tell me which version of gpu, driver, cuda and nsight you use, also it will be much helpful if you can give me your project.