cuda-gdb does not debug device code

Hello everybody,

I hope you can help me with the question which I was not able to find via Google:

I have the Optimus video card: NVIDIA GeForce 540m. And I use it under Ubuntu 12.10 x64 via optirun (Bumblebee) to develop CUDA applications. Unfortunately, I am not able to debug device code using nsight or cuda-gdb. Somehow, the device code is skipped and I always see the last line without when all threads were finished.

The link ([url]CUDA 5 Debugging Mode - CUDA Programming and Performance - NVIDIA Developer Forums) says that I need two GPUs, but with Optimus both GPUs are available: NVIDIA and Intel. IDE or debugger, I launch like that:

nvcc -g -G application.cu -o cudaApplication
optirun nsight # or
optirun cuda-gdb cudaApplication

So, you see that I generate debugging symbols, but cuda-gdb says that they are not available.

If possible, please share your experience with me. Is it possible to debug applications using my configuration, because even for Visual Studio the same approach does not work. Maybe I need to install development version of drivers, or configure my Linux somehow, or even the debugging process without TWO NVIDIA cards is impossible.

However, printf works fine, but if cuda-gdb is available, it probably works on somebody’s machine :)

If you need more information about my system, please tell me, because I am struggling with the issue…

Thank you in advance,
Vest

Have you tried the steps for setting up Optimus systems outlined in CUDA Toolkit getting started CUDA Toolkit Documentation ?

Hello eugeneo,

Thank you for the reply. Yes, I made exact steps, and I am able to run CUDA programs. But in fact, the question is about their debugging. Do you use the debugger with CUDA? If yes, please tell me if you can debug device code in Linux.

Thank you,
Vest

Vest, I ran cuda-gdb on the Optimus laptop in the past.
Have you tried running without optirun?

Eugeneo, without optirun you cannot launch any CUDA application, because in this case the Intel video card is used, and it does not support CUDA code.

Since you ran the debugger in the past, were you able to debug the device code under linux? and how :(
What Linux and CUDA toolkit versions did you have?

Hi Vest,

Can you provide some more information :

  1. Can you confirm if you are able to run CUDA programs without Optirun ?
  2. Can you post the output of
ls -la /dev  | grep nvidia
  1. Can you post the output of
lsmod

Interesting, looks like line numbers got appended to the commands. Please remove "1. " when executing the commands in the previous comment.

Hello vyas,

No, I cannot launch CUDA applications without optirun, because by default all screens are rendered using Intel. But I am able to compile applications without optirun.

Unfortunately, I cannot access my computer right now to give you additional information. Bug I remember that nvidia (or even nouveau) module is not loaded by default (because of Optimus technology).

Kind regards,
Vest

cuda-gdb just needs to have the nvidia card available that’s rendering to the screen (you can even use cuda-gdb on a single-card system if you dont have x11 running). Are you positive your igpu is handling the display and not your nvidia gpu?

You really should be able to use cuda-gdb with your configuration

hello everybody,

Here is the output of asked commands:

$ ls -la /dev  | grep nvidia
crw-rw-rw-   1 root root    195,   0 Nov 10 19:30 nvidia0
crw-rw-rw-   1 root root    195, 255 Nov 10 19:30 nvidiactl
$ lsmod
Module                  Size  Used by
nvidia               9367980  38 
bbswitch               13358  0 
parport_pc             32688  0 
ppdev                  17073  0 
rfcomm                 46619  0 
bnep                   18140  2 
bluetooth             209199  10 rfcomm,bnep
snd_hda_codec_hdmi     32007  1 
snd_hda_codec_realtek    77876  1 
joydev                 17457  0 
arc4                   12529  2 
asus_nb_wmi            12710  0 
asus_wmi               24088  1 asus_nb_wmi
sparse_keymap          13890  1 asus_wmi
coretemp               13400  0 
kvm_intel             132759  0 
kvm                   414070  1 kvm_intel
ghash_clmulni_intel    13180  0 
aesni_intel            51037  3 
cryptd                 20403  2 ghash_clmulni_intel,aesni_intel
aes_x86_64             17208  1 aesni_intel
microcode              22803  0 
snd_hda_intel          33491  6 
snd_hda_codec         134212  3 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel
snd_hwdep              13602  1 snd_hda_codec
snd_pcm                96580  5 snd_hda_codec_hdmi,snd_hda_intel,snd_hda_codec
snd_seq_midi           13324  0 
snd_rawmidi            30512  1 snd_seq_midi
iwlwifi               386826  0 
snd_seq_midi_event     14899  1 snd_seq_midi
snd_seq                61521  2 snd_seq_midi,snd_seq_midi_event
snd_timer              29425  2 snd_pcm,snd_seq
snd_seq_device         14497  3 snd_seq_midi,snd_rawmidi,snd_seq
mac80211              539908  1 iwlwifi
snd                    78734  20 snd_hda_codec_hdmi,snd_hda_codec_realtek,snd_hda_intel,snd_hda_codec,snd_hwdep,snd_pcm,snd_rawmidi,snd_seq,snd_timer,snd_seq_device
ttm                    83595  0 
mxm_wmi                12979  0 
wmi                    19070  2 asus_wmi,mxm_wmi
mei                    40690  0 
i915                  520629  6 
uvcvideo               76749  1 
psmouse                95552  0 
mac_hid                13205  0 
videobuf2_core         32851  1 uvcvideo
videodev              120309  3 uvcvideo,videobuf2_core
videobuf2_vmalloc      12860  1 uvcvideo
serio_raw              13215  0 
videobuf2_memops       13368  1 videobuf2_vmalloc
drm_kms_helper         46784  1 i915
lpc_ich                17061  0 
drm                   275528  8 ttm,i915,drm_kms_helper
cfg80211              206566  2 iwlwifi,mac80211
lp                     17759  0 
i2c_algo_bit           13413  1 i915
parport                46345  3 parport_pc,ppdev,lp
video                  19335  1 i915
soundcore              15047  1 snd
snd_page_alloc         18484  2 snd_hda_intel,snd_pcm
hid_generic            12493  0 
usbhid                 46947  0 
hid                   100366  2 hid_generic,usbhid
atl1c                  41101  0

in the last command, the module nvidia is appeared when something was executed with optirun. When you do not use optirun, the nvidia module disappears from lsmod.

I think that x11 runs using Intel, because when I call glxgears, I get 60fps (60hz) without acceleration.

Kind regards,
Vest

By the way, is it important to use some kind development drivers for nvidia (linux or windows)? Because I do not understand the difference between latest drivers on the website/repositories or old drivers included to the toolkit.

Vest, can you do the following :

  1. Start your laptop up with the iGPU
  2. Run the following commands as root. (This is from the getting started guide at CUDA Toolkit Documentation) :
mknod -m 666 /dev/nvidiactl c 195 255
 mknod -m 666 /dev/nvidia0 c 195 0
  1. Run a cuda app without optirun.
  2. You should now be able to use cuda-gdb on applications without optirun.