Nsight skips (ignores) over break points in VS10 Cuda works fine, nsight consistently skips over sev

Hey

I’m using nsight 2.2 , Toolkit 4.2 , latest nvidia driver , I’m using couple gpu’s in my computer. Build customize 4.2.

I have set “generate GPU ouput” on CUDA’s project properties, nsight monitor is on (everything looks great).

I set several break points on my global - kernel function . nsight stops at the declaration of the function , but skips over several break points. it’s just like nsight decide whether to hit a break point or skip over a break point.

The funny thing is that nsight stops at for loops , but doesn’t stop on simple assignment operations.

One more problem is that I can’t set focus or add variables to the watch list , In this case (see attached screenshot)I can’t resolve the value of variable : “posss” or “testDetctoinRate1”

which are registers in this case. on the other hand , shared memory or block memory would insert automatically to the local’s list.

Here is a screen shot of the kernel , before debugging:

Here is a screen shot during debugging

I evoke my kernel function with following call:

checkCUDA<<<1, 32>>>(sumMat->rows,sumMat->cols , (UINT *)pGPUsumMat); 

	cudaError = cudaGetLastError();

	if(cudaError != cudaSuccess)

	{

		printf("CUDA error: %s\n", cudaGetErrorString(cudaError));

		exit(-1);

	}

kernel call works without an error.

Is there any option to forcing nsight stops at all breakpoints ?

How can I add thread’s registers to my watch list ?

Any help would be appreciated

I can post my code on demand

Cheers

P.S how can I convert this post to nsight forum , somehow I can’t post messages on nsight forum.

May be basic, but are you launching your application through nsight->start cuda debugging?

Hep , sure … that’s what am I doing …

I just updated my post , Please watch my screen shots

Hi,
I’m not sure of the specifics of your own environment and the particularities of GPU debugging, but generally speaking, a debugger can only honour breakpoints at actual code statements. And a variable declaration is not such a statement. Those declarations are simply syntactical sugar the programming language requires, but are not translated into machine code.
So apparently, the debugger allows you to set meaningless breakpoints prior to run the code, and just discard them while running. The problem I see here is that those breakpoints shouldn’t have been allowed in the first place. It would be like allowing a breakpoint into a comment: not much of a hook to hang to then the code runs.

Hey @Gilles_C, Thanks for help

I’m totally agree that declaration is not considered as a code for the compiler. the c++ compiler goes through the code twice - first time for declaring the scope variables , second turning the code to a machine code.

With honesty , an assignment is considered as a compiler code, just like the command x= 5; , and nsight doesn’t hold on registers code. it’s seems to me that nsight holds only on block’s variables.

S

Right, sorry, I didn’t check to the end of the kernel.
Nonetheless, if your kernel is exactly what the screenshots show, neither “posss” nor “testDetctoinRate1” are actually used anywhere: posss can be optimised out to it’s assigned value that corresponds to the index for accessing “pGPUsumMat” and testDetctoinRate1 stores the corresponding value without using it. So actually, the compiler is free to optimise all the code out. Actually, the cuga-gdb documentation says that “-g -G” “forces -O0 compilation, with the exception of very limited dead‐code eliminations and register‐spilling optimizations”. I suspect you’re in the “dead-code elimination” case. Just try to pretend doing something with the variables to prevent the compiler from removing the statements…

Thanks for help

Initially , My debug command line is as followed:

Runtime API (NVCC Compilation Type is hybrid object or .c file)

set CUDAFE_FLAGS=–sdk_dir "c:\Program Files\Microsoft SDKs\Windows\v7.0A"

“C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.2\bin\nvcc.exe” --use-local-env --cl-version 2010 -ccbin “C:\Program Files\Microsoft Visual Studio 10.0\VC\bin” -I"…....\opencv\modules\gpu\src\opencv2\gpu\device" -I"…....\opencv\modules\gpu\include\opencv2\gpu" -I"…....\build\include\" -G --keep-dir “Debug” -maxrregcount=0 --machine 32 --compile -g -Xcompiler "/EHsc /nologo /Od /Zi /MDd " -o “Debug%(Filename)%(Extension).obj” “%(FullPath)”


I changed on property page → cuda → host → generate hosting debug information → No

Now my command line doesn’t contain the -g and -O letters , my command line is as followed:

Runtime API (NVCC Compilation Type is hybrid object or .c file)

set CUDAFE_FLAGS=–sdk_dir "c:\Program Files\Microsoft SDKs\Windows\v7.0A"

“C:\Program Files\NVIDIA GPU Computing Toolkit\CUDA\v4.2\bin\nvcc.exe” --use-local-env --cl-version 2010 -ccbin “C:\Program Files\Microsoft Visual Studio 10.0\VC\bin” -I"…....\opencv\modules\gpu\src\opencv2\gpu\device" -I"…....\opencv\modules\gpu\include\opencv2\gpu" -I"…....\build\include\" -G --keep-dir “Debug” -maxrregcount=0 --machine 32 --compile -Xcompiler "/EHsc /nologo /Od /Zi /MDd " -o “Debug%(Filename)%(Extension).obj” “%(FullPath)”

although, I do debug with -o , does it matter ?

It doesn’t make any change