Debugging cuda code using visual studio
  1 / 2    
Hi, I just started developing some code for cuda. I'm running on an xp box using vs2005. For some reason i can't get the debugger to step into the cuda code even when I'm running under EmuDebug. Can some one help me ?

Thanks

Eri
Hi, I just started developing some code for cuda. I'm running on an xp box using vs2005. For some reason i can't get the debugger to step into the cuda code even when I'm running under EmuDebug. Can some one help me ?



Thanks



Eri

#1
Posted 04/19/2007 09:39 AM   
Put a breakpoint inside one of your __global__ functions rather than trying to step into GPU code from the host code. I have found that I cannot step into a foo<<<>>>() function directly, but I can put a break inside it to debug it.

Mark
Put a breakpoint inside one of your __global__ functions rather than trying to step into GPU code from the host code. I have found that I cannot step into a foo<<<>>>() function directly, but I can put a break inside it to debug it.



Mark

#2
Posted 04/19/2007 11:01 AM   
[quote name='Mark Harris' date='Apr 19 2007, 04:01 AM']Put a breakpoint inside one of your __global__ functions rather than trying to step into GPU code from the host code.  I have found that I cannot step into a foo<<<>>>() function directly, but I can put a break inside it to debug it.

Mark
[right][snapback]186930[/snapback][/right]
[/quote]

thanks did the trick
[quote name='Mark Harris' date='Apr 19 2007, 04:01 AM']Put a breakpoint inside one of your __global__ functions rather than trying to step into GPU code from the host code.  I have found that I cannot step into a foo<<<>>>() function directly, but I can put a break inside it to debug it.



Mark

[snapback]186930[/snapback]






thanks did the trick

#3
Posted 04/23/2007 07:22 AM   
Any suggestion for inspecting shared variables in visual studio 2005? They seem to give me a problem.

Thanks

[quote name='Eri Rubin' date='Apr 22 2007, 11:22 PM']thanks did the trick
[right][snapback]188454[/snapback][/right]
[/quote]
Any suggestion for inspecting shared variables in visual studio 2005? They seem to give me a problem.



Thanks



[quote name='Eri Rubin' date='Apr 22 2007, 11:22 PM']thanks did the trick

[snapback]188454[/snapback]


#4
Posted 04/23/2007 11:29 AM   
[quote name='thegallier' date='Apr 23 2007, 04:29 AM']Any suggestion for inspecting shared variables in visual studio 2005?  They seem to give me a problem.

Thanks
[right][snapback]188502[/snapback][/right]
[/quote]

I had the same problem. It was solved after copeing the custom compile options from the sdk.

hope this helps

Eri
[quote name='thegallier' date='Apr 23 2007, 04:29 AM']Any suggestion for inspecting shared variables in visual studio 2005?  They seem to give me a problem.



Thanks

[snapback]188502[/snapback]






I had the same problem. It was solved after copeing the custom compile options from the sdk.



hope this helps



Eri

#5
Posted 04/23/2007 11:46 AM   
I will check that out.

thanks
[quote name='Eri Rubin' date='Apr 23 2007, 03:46 AM']I had the same problem. It was solved after copeing the custom compile options from the sdk.

hope this helps

Eri
[right][snapback]188503[/snapback][/right]
[/quote]
I will check that out.



thanks

[quote name='Eri Rubin' date='Apr 23 2007, 03:46 AM']I had the same problem. It was solved after copeing the custom compile options from the sdk.



hope this helps



Eri

[snapback]188503[/snapback]


#6
Posted 04/24/2007 03:11 PM   
I have a similar problem but placing a breakpoint within the kernel doesn't work. It will step into the kernel?

Here's the setup:
A .cpp file launches a routine in a .cu file that then invokes a kernel call. The kernel is in this same .cu file. The .cpp files are compiled using msvc compiler and the .cu with nvcc.

It was built as a DLL using CUDA rules and setting the properties of the .cu file as follows:[code]
nvcc.exe -ccbin "C:\Program Files\Microsoft Visual Studio 8\VC\bin" -deviceemu -c  -Xcompiler "/EHsc /W3 /nologo /Wp64 /O2 /Zi   /MDd /GR"  -o Debug\rtw_gpu_cu.obj rtw_gpu_cu.cu
[/code]

Any ideas?
Thanks for your help!
I have a similar problem but placing a breakpoint within the kernel doesn't work. It will step into the kernel?



Here's the setup:

A .cpp file launches a routine in a .cu file that then invokes a kernel call. The kernel is in this same .cu file. The .cpp files are compiled using msvc compiler and the .cu with nvcc.



It was built as a DLL using CUDA rules and setting the properties of the .cu file as follows:


nvcc.exe -ccbin "C:\Program Files\Microsoft Visual Studio 8\VC\bin" -deviceemu -c  -Xcompiler "/EHsc /W3 /nologo /Wp64 /O2 /Zi   /MDd /GR"  -o Debug\rtw_gpu_cu.obj rtw_gpu_cu.cu




Any ideas?

Thanks for your help!

#7
Posted 02/28/2008 02:46 AM   
Hi all,

I am facing a problem with a new cuda dll project : when I am debugging my test project, the values displayed by the debugger are completely wrong for most of them, although the program works correctly (that values are ok when returned by the dll functions to the main program). I included two cuda dlls in the project, the first can be debugged but not the new one. Here is the command line :

[code]"nvcc.exe" -ccbin "C:\Program Files\Microsoft Visual Studio 8\VC\bin" -c -D"WIN32" -D"_DEBUG" -D"_CONSOLE" -D_MBCS -Xcompiler "/EHsc /W3 /nologo /Wp64 /O2 /Zi /MTd " -I"C:\CUDA_2_0\include" -I"./" -I"C:\Program Files\NVIDIA Corporation\NVIDIA CUDA SDK\common\inc" -I"C:\Program Files\GnuWin32\include" -o "Debug\blabla.obj" blabla.cu[/code]

I used the cuda.rules file. I have been looking for the error since severall days so if anyone has an idea...
Hi all,



I am facing a problem with a new cuda dll project : when I am debugging my test project, the values displayed by the debugger are completely wrong for most of them, although the program works correctly (that values are ok when returned by the dll functions to the main program). I included two cuda dlls in the project, the first can be debugged but not the new one. Here is the command line :



"nvcc.exe" -ccbin "C:\Program Files\Microsoft Visual Studio 8\VC\bin"  -c -D"WIN32" -D"_DEBUG" -D"_CONSOLE" -D_MBCS -Xcompiler "/EHsc /W3 /nologo /Wp64 /O2 /Zi   /MTd " -I"C:\CUDA_2_0\include" -I"./" -I"C:\Program Files\NVIDIA Corporation\NVIDIA CUDA SDK\common\inc" -I"C:\Program Files\GnuWin32\include" -o "Debug\blabla.obj" blabla.cu




I used the cuda.rules file. I have been looking for the error since severall days so if anyone has an idea...

#8
Posted 03/05/2009 03:24 PM   
I reply to my one question since I (finally) found the bug :

The compilation options must be the same for the visual compiler and the cuda compiler : in my case, I had /O2 option for cuda and /Od for visual.
I reply to my one question since I (finally) found the bug :



The compilation options must be the same for the visual compiler and the cuda compiler : in my case, I had /O2 option for cuda and /Od for visual.

#9
Posted 03/05/2009 03:48 PM   
[quote name='sudoca' post='514060' date='Mar 5 2009, 07:48 AM']I reply to my one question since I (finally) found the bug :

The compilation options must be the same for the visual compiler and the cuda compiler : in my case, I had /O2 option for cuda and /Od for visual.[/quote]

Thank you for that tip, sudoca!
[quote name='sudoca' post='514060' date='Mar 5 2009, 07:48 AM']I reply to my one question since I (finally) found the bug :



The compilation options must be the same for the visual compiler and the cuda compiler : in my case, I had /O2 option for cuda and /Od for visual.



Thank you for that tip, sudoca!

#10
Posted 06/25/2009 12:21 AM   
[quote name='sudoca' post='514060' date='Mar 6 2009, 12:48 AM']I reply to my one question since I (finally) found the bug :

The compilation options must be the same for the visual compiler and the cuda compiler : in my case, I had /O2 option for cuda and /Od for visual.[/quote]

Thanks here, too!
[quote name='sudoca' post='514060' date='Mar 6 2009, 12:48 AM']I reply to my one question since I (finally) found the bug :



The compilation options must be the same for the visual compiler and the cuda compiler : in my case, I had /O2 option for cuda and /Od for visual.



Thanks here, too!

#11
Posted 06/25/2009 06:13 AM   
[quote name='sudoca' post='514060' date='Mar 5 2009, 05:48 PM']I reply to my one question since I (finally) found the bug :

The compilation options must be the same for the visual compiler and the cuda compiler : in my case, I had /O2 option for cuda and /Od for visual.[/quote]

Thanks!

In my case I did not have any cpp files in my project but had the /O2 optimization option enabled. I disabled optimizations (/Od flag) and I worked fine.
[quote name='sudoca' post='514060' date='Mar 5 2009, 05:48 PM']I reply to my one question since I (finally) found the bug :



The compilation options must be the same for the visual compiler and the cuda compiler : in my case, I had /O2 option for cuda and /Od for visual.



Thanks!



In my case I did not have any cpp files in my project but had the /O2 optimization option enabled. I disabled optimizations (/Od flag) and I worked fine.

#12
Posted 08/24/2010 08:36 AM   
[quote name='sudoca' post='514060' date='Mar 5 2009, 05:48 PM']I reply to my one question since I (finally) found the bug :

The compilation options must be the same for the visual compiler and the cuda compiler : in my case, I had /O2 option for cuda and /Od for visual.[/quote]

Thanks!

In my case I did not have any cpp files in my project but had the /O2 optimization option enabled. I disabled optimizations (/Od flag) and I worked fine.
[quote name='sudoca' post='514060' date='Mar 5 2009, 05:48 PM']I reply to my one question since I (finally) found the bug :



The compilation options must be the same for the visual compiler and the cuda compiler : in my case, I had /O2 option for cuda and /Od for visual.



Thanks!



In my case I did not have any cpp files in my project but had the /O2 optimization option enabled. I disabled optimizations (/Od flag) and I worked fine.

#13
Posted 08/24/2010 08:36 AM   
[quote name='tilo' post='1108073' date='Aug 24 2010, 01:36 PM']Thanks!

In my case I did not have any cpp files in my project but had the /O2 optimization option enabled. I disabled optimizations (/Od flag) and I worked fine.[/quote]

You can try NSight but it does not allow debugging on a single GPU config (which I suppose is really absurd) and you need to have atleast 2 GPUs to debug your kernels on the device unlike the emuDebug, monitor global and shared memory etc.

Take a look: [url="http://www.nvidia.com/nsight"]http://www.nvidia.com/nsight[/url]
[quote name='tilo' post='1108073' date='Aug 24 2010, 01:36 PM']Thanks!



In my case I did not have any cpp files in my project but had the /O2 optimization option enabled. I disabled optimizations (/Od flag) and I worked fine.



You can try NSight but it does not allow debugging on a single GPU config (which I suppose is really absurd) and you need to have atleast 2 GPUs to debug your kernels on the device unlike the emuDebug, monitor global and shared memory etc.



Take a look: http://www.nvidia.com/nsight

Best,

Salman Ul Haq,

TunaCode Pvt. Limited

Developers of GPU based Computing solutions

(CUDA for Vision and Imaging Library)

W: www.cuvilib.com

E: salman@tunacode.com



GPU: NVIDIA Tesla C2050

CPU: Core2Duo 2.33GHz 2.5GB DDR2 RAM

CUDA Toolkit v4.0RC

#14
Posted 08/29/2010 04:58 PM   
[quote name='tilo' post='1108073' date='Aug 24 2010, 01:36 PM']Thanks!

In my case I did not have any cpp files in my project but had the /O2 optimization option enabled. I disabled optimizations (/Od flag) and I worked fine.[/quote]

You can try NSight but it does not allow debugging on a single GPU config (which I suppose is really absurd) and you need to have atleast 2 GPUs to debug your kernels on the device unlike the emuDebug, monitor global and shared memory etc.

Take a look: [url="http://www.nvidia.com/nsight"]http://www.nvidia.com/nsight[/url]
[quote name='tilo' post='1108073' date='Aug 24 2010, 01:36 PM']Thanks!



In my case I did not have any cpp files in my project but had the /O2 optimization option enabled. I disabled optimizations (/Od flag) and I worked fine.



You can try NSight but it does not allow debugging on a single GPU config (which I suppose is really absurd) and you need to have atleast 2 GPUs to debug your kernels on the device unlike the emuDebug, monitor global and shared memory etc.



Take a look: http://www.nvidia.com/nsight

Best,

Salman Ul Haq,

TunaCode Pvt. Limited

Developers of GPU based Computing solutions

(CUDA for Vision and Imaging Library)

W: www.cuvilib.com

E: salman@tunacode.com



GPU: NVIDIA Tesla C2050

CPU: Core2Duo 2.33GHz 2.5GB DDR2 RAM

CUDA Toolkit v4.0RC

#15
Posted 08/29/2010 04:58 PM   
  1 / 2    
Scroll To Top