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: libcuda.so.1: 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 paralelLayer.cu

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
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: libcuda.so.1: 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 paralelLayer.cu



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

#1
Posted 12/15/2009 08:16 AM   
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 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.

#2
Posted 02/15/2010 09:07 AM   
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: libtermcap.so.2: cannot open shared object file: No such file or directory

I got no idea what I did wrong.
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: libtermcap.so.2: cannot open shared object file: No such file or directory



I got no idea what I did wrong.

#3
Posted 02/15/2010 02:30 PM   
That's weird /confused.gif' class='bbc_emoticon' alt=':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.
That's weird /confused.gif' class='bbc_emoticon' alt=':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.

#4
Posted 02/15/2010 03:48 PM   
[quote name='oguz286' post='1001726' date='Feb 15 2010, 04:48 PM']That's weird /confused.gif' class='bbc_emoticon' alt=':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.[/quote]

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.
[quote name='oguz286' post='1001726' date='Feb 15 2010, 04:48 PM']That's weird /confused.gif' class='bbc_emoticon' alt=':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.

#5
Posted 02/15/2010 04:18 PM   
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.
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.

#6
Posted 02/15/2010 04:27 PM   
[quote name='timon' post='1001747' date='Feb 15 2010, 05:18 PM']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.[/quote]

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.
[quote name='timon' post='1001747' date='Feb 15 2010, 05:18 PM']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.



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.

#7
Posted 02/15/2010 04:55 PM   
[quote name='oguz286' post='1001766' date='Feb 15 2010, 05:55 PM']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.[/quote]

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.
[quote name='oguz286' post='1001766' date='Feb 15 2010, 05:55 PM']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.

#8
Posted 02/15/2010 05:10 PM   
[quote name='timon' post='1001778' date='Feb 15 2010, 06:10 PM']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.[/quote]

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.
[quote name='timon' post='1001778' date='Feb 15 2010, 06:10 PM']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.

#9
Posted 02/16/2010 11:25 AM   
I tried to debug a kernel.cu 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.
I tried to debug a kernel.cu 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.

#10
Posted 07/13/2011 02:46 PM   
[quote name='darwinxie' date='13 July 2011 - 04:46 PM' timestamp='1310568379' post='1264352']
I tried to debug a kernel.cu 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.
[/quote]
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.
[quote name='darwinxie' date='13 July 2011 - 04:46 PM' timestamp='1310568379' post='1264352']

I tried to debug a kernel.cu 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.

#11
Posted 07/17/2011 07:29 PM   
[quote name='kipodi' date='17 July 2011 - 09:29 PM' timestamp='1310930950' post='1266596']
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.
[/quote]

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. :(
[quote name='kipodi' date='17 July 2011 - 09:29 PM' timestamp='1310930950' post='1266596']

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. :(

#12
Posted 07/18/2011 07:40 AM   
Scroll To Top