Can't debug using Nsight, kernel code works fine Kernel call works fine , when trying to debug u


I wrote a small code in cuda (more like an example code). I’m using computer with couple gpu’s , I’m using VS10 , cuda toolkit 4.1 32bit , nsight 2.1.

Whenever I start my program for VS10 debug using (F5 ) in VS10, everything is works just great , there are no errors and the cuda code works just fine.

When I start my program with nsight -> start cuda debugging, the nsight connects and immediately disconnect from the program , I receive the following error:

The thread ‘CUDA Default Context’ (0x0) has exited with code 0 (0x0).
The thread ‘’ (0x2198890) has exited with code 0 (0x0).
The program ‘[1912] FaceDetection_Cuda.exe: CUDA’ has exited with code 0 (0x0).

any suggestions what to do next ?

It’s looks like everything works just fine , except that Nsight doesn’t stop execution on a break point.

In my program , I’m not using command line arguments at all

Here is a screen shot of the problem

Here is my code project - for references

Are you perhaps using command line arguments for the Visual Studio debugger but not nsight?

In my program , I’m not using command line arguments at all

Here is a screen shot of the problem

Here is my code project - for references

I might say something stupid since I’ve never tried nsight on Windows (never tried any CUDA on Windows actually), but AFAIK, nsight prior to version 2.2 requires 2GPU for CUDA debugging: one for driving the display and one fro running the CUDA code. I don’t know what the error messages are supposed to be when you try it with one GPU only, but that might be this.
Good news is that nsight 2.2 now supports single GPU debugging. It might be worth a try.

I would really recommend trying 2.2 aswell. I was shocked to find that it worked right out of the box on my machine for single GPU debugging! No tinkering needed!

Good job Nvidia!

Thanks for help…
I have tried using nsight 2.2 and had the same problem . no matter what I do, I can’t debug cuda…
unfortunately , that’s doesn’t solve the problem

Hi. This problem happened several times with me before, although I managed to fix them I don’t recall any particular fix. However I remember that whenever Nsight failed to run, it usually turned out to be a very subtle bug in the program.

I checked and briefly, maybe you should say in the execution configuration that you are using 4 bytes of shared memory…

Hey guys ,
Thanks for help
Finally I fixed this problem
Initially I have uninstalled ALL Cuda components, that’s include toolkit , sdk , nsight and driver as well.
I have installed the latest Cuda’s component version, and it worked !

Thanks for help :)

Great forum by Nvidia


Hi there,

I am new to CUDA programming. I am getting the same error “CUDA’ has exited with code 0 (0x0)”. I re-installed the CUDA components number of times but this error persists. Does anyboody has better solution to this problem?
Thanks in advance !

I forgot to add the configuration:
I am using Quadro k610M Nvidia GPU, Nsight version 4.2, CUDA tool kit 6.5 and VISUAL studio 2013.

I am not familiar with this particular setup, but generally speaking when a program terminates with a status of 0, it usually means that it terminated normally, without any errors detected.

This error, I got after starting the CUDA debugging option. I am not able to debug the kernel because of this error. Any idea about this, njuffa?

I do not use Nsight. My best guess is that your application ran to completion successfully. Debuggers commonly operate such that when the user issues a “run” directive, the program loaded into the debugger will run to completion unless a breakpoint or watchpoint has been set somewhere. Debuggers typically also provide a “single step” functionality that allow execution of a program line-by-line.

Is there some sort of tutorial/best practice to find, how to debug cuda memory variables, using Nsight on Visual Studio 2015 or windows setup. Please share the doc link.

try googling this:

nsight cuda debugging youtube