cuda-gdb on eclipse (cdt)

Hi, i need to use cuda-gdb.
Does anyone know how to configure it in Eclipse (cdt)?
I just changed gdb to /usr/local/cuda/bin/cuda-gdb in a textbox located in debug configurations->debugger->debugger options->main (tab)->GDB debugger and i get this error:

‘Launching myProgram’ has encountered a problem.
Error creating session

In the details i get this error 3 times:

/usr/local/cuda/bin/cuda-gdb: error while loading shared libraries: cannot open shared object file: No such file or directory.

This is my line in the makefile:

nvcc -g -G --compiler-bindir $(HOME)/bin -c -arch sm_11 --device-emulation

So, as you can see, i’m using device emulation. In a near future i would like to run the program in a CUDA capable desktop computer using ssh and keep on developing in my laptop. Is it possible to debug a program running on the desktop through Eclipse running on my laptop?
Anyway, right now i just want to debug in the emulation mode. Any help with that will be great.

Thank you

I would like to do the same thing but I don’t get the same error as you. I did get that error, but that was because I had compiled my .cu file with SDK 2.3, but I was trying to debug with SDK 3.0beta. So it searched for a library that ended with “.so.2” but I had “.so.3” libraries because of version 3.0beta.

The error I get (after some time) is:

Error stopping at main.
Target request failed: Target is not responding (timed out).

I’d really like to debug with Eclipse (or Netbeans or some other program that allows me to visually debug), but I can’t get it to work.

I’m not trying it anymore because i managed to debug by little project with -device-emulation and printf.
if I try to use cuda-gdb in console i get:

$ cuda-gdb -version

cuda-gdb: error while loading shared libraries: cannot open shared object file: No such file or directory

I got no idea what I did wrong.

That’s weird :confused: I can debug with cuda-gdb on the console just fine, but I want to do it with a GUI and that’s where I have problems. Which distribution are you using? You can try to update all packages, because you also had library problems with your compiled code.

My program runs fine now. I use Ubuntu 9.10 (laptop [no cuda-capable], with a trick in the makefile to use g+±4.3) and ubuntu 8.10 (desktop).

What I’ve done to debug is just use gdb (with eclipse) and debug the kernel with --device-emulation and printf. If you do so, be careful with the warps, because there are things that would be calculated at the same time in the device (the threads within a warp) and will be calculated serially in the device emulation mode.

You can put same extra ifs if necessary and then remove them when all works as expected and you test your code in a real device.

I don’t know if you can trace a single thread with cuda-gdb anyway.

The libtermcap error with older versions of debian based distro was because cuda-gdb used to only be built for redhat 4/5, which still includes a termcap library. There were hacks floated around on the board to get cuda-gdb from cuda 2.1/2.2 to work on Ubuntu, but I don’t remember the details. They should show up if you use google to search this forum.

I see, but why would I want to use device emulation if I can debug on the device itself? The compilation and debugging work just fine. It’s just that I don’t want to debug in a terminal when I could debug in Eclipse itself which (for me) is much easier to use.

If I can get it working somehow, I’ll post how I did it here.

What I did is debugging with gdb (not cuda-gdb) in eclipse and use printf just for the kernel (device emulation required).

But if you can run cuda-gdb in a terminal i guess you can run it from eclipse.

Here’s my configuration for gdb:

Run->Debug configurations->Debugger tab

Debugger: gdb Debugger

Debugger options->Main tab

GDB debbuger: gdb

GDB command line: .gdbinit

Protocol: default

I hope this work for you.

Thank you. Those are the same as my settings. Unfortunately it doesn’t work :( I’ll have to figure out how to get it working somehow.

I tried to debug a using cuda-gdb, but it gave an error. It actually said that all CUDA devices are used by X11, so I need to “kill” X11 first, and after that I can run cuda-gdb well (but on terminal of course).
If cuda-gdb has been set that way (only works when X11 is killed), I think there is no way to run it on Eclipse, since Eclipse is a GUI based IDE.

It really makes sense that you can’t run cuda-gdb with X. When you hit a breakpoint the watchdog will have to reset your kernel, because it hangs for a certain amount of time. It is done to prevent your computer from hanging.

So if you want to debug GPU code and keep X running, you must add another GPU to run the X, or you can kill X and debug from the terminal.

What about running the program in my desktop and debugging it with X from my laptop using ssh or something?

Is that possible?

I’m still using the last version of cuda with the emulator just to run things in my non cuda capable laptop. :(