How to debug CUDA kernels in Visual studio or Parallel Nsight - visual-studio

I have CUDA 4.1 SDK with Parallel Nsight 2.1 installed on Win7 x64. I want to debug my CUDA kernels, how to do this? Is this possible with one GPU? There is a utility Nsight Monitor. I have tried it, first disabled Timeout Detection and Recovery on Windows, and disable WPF, as Nsight monitor told me. I set a breakpoint in VS, run the code but nothing happend. Nsight monitor said i am connected. So can i debug in VS or shall i debug in Parallel Nsight? How to? Thanks a million.

If you only have one GPU then you cannot do debugging with Parallel Nsight 2.1 since stopping the GPU stops the display (Nsight stops you doing this). With Parallel Nsight 2.2 (release candidate now available) you can now do local debugging with a single GPU.
So you're on the right track (disabling TDR/WPF etc.) but you'll need to update to Parallel Nsight 2.2 to debug with a single GPU.

Related

Cuda debugging using Single GPU with visual studio

I am working on Windows 7, Visual studio 2010.
Can we debug cuda code using single GPU which also providing display to the monitor in the same PC?
What tools are available ? NSIGHT seems to be working with two GPUs.
Windows 7 support has been dropped in newer versions of Nsight, (see here) basically anything that was released in 2020 or newer. So you're stuck with older versions. Older versions will also have a support chart like the one I previously linked which explains the supported debug scenarios. Generally speaking, single GPU debug as you describe should be possible with a "newer" GPU like Kepler or newer.
The last Nsight version that supported Win 7 is 2019.4 and the associated documentation indicates support for single GPU debugging.
Note that in the 2019.x timeframe, the Nsight tools had both a "legacy" and "next gen" debugger, and the one you should use will depend on which GPU you are using (and possibly driver model WDDM/TCC), see here.
Also note that the last CUDA toolkit that had official support for VS 2010 was in the CUDA 9.x generation.

How to debug CUDA kernels in Visual Studio 2010 without monitor halting

I have CUDA 6.5 SDK with Parallel Nsight 4.2 installed on Win7 x64. I want to debug my CUDA kernels, but my monitor halts at break points.
In my Nsigt montior options under CUDA menu I have
Desktop GPU must use SW preemption: true
Headless GPU must use SW preemption: true
TCC GPU must use SW preemption: true
And in my VS 2010 Nsight Cuda options I have
Preemption preference: Prefer NO SW preeption
I tried SW preemption in VS 2010 Nsight settings but same thing the monitor halts.
It's not related with code because I was able to debug in Linux using nsight eclipse using the beta feature to be able to debug using 1 GPU.But I prefer to work in Windows.
In Nsight Monitor settings in Geenral tab I changed
WDDM TDR enabled to false and now it seems to be working.
I am using NVIDIA GTX 970 GPU and NVidia Driver 344.75.

How to debug in Nsight in Visual studio when you have multiple gpus

Does anyone know how to switch between GPUs in Nsight in Visual Studio while debugging, I am programming 2 quadro cards. Code is in cuda C.
You can enumrate your cards in your CUDA program, and explicitly choose one of them. Or you can set an enviroment variable before launching your Nsight Monitor, "CUDA_VISIBLE_DEVICES=0" choose the card with ordinal 0.
You can refer to the deviceQueryDrv sample in CUDA SDK, for listing ordinals of you GPUs. You can also refer for how to enumrate your GPUs.

Possible to use AMD gDEBugger 6.0 only for OpenCL CPU Kernel debugging? NVIDIA GPU seems to hold this off

is there a way to make AMD gDEBugger 6 debug at least OpenCL CPU Kernels even though a dedicated NVIDIA GPU is installed?
When I start the gDEBugger, I get a warning: You do not have an AMD GPU installed. Kernel debugging will be disabled.
Well, I just want to debug CPU kernels...
My development environment:
NVIDIA GPU Computing SDK 4 --> for GPU kernel creation
AMD APP SDK --> for CPU kernel creation
OS: Windows 7, Visual Studio 2010 Ultimate
My OpenCL program itself runs fine, both platforms are found without any changes in my VC project properties and the kernel can be executed on my CPU as well as on my GPU.
AFAIK Debugging OpenCL Kernel on CPU is not possible or not available with AMD gDEBugger 6.0 or even 6.1 does not have this feature.

How to debug into CUDA kernel code using visual studio 2008?

Hey,
I am using Visual Studio 2008, with CUDA 3.2. I am trying to debug into a function with this signature:
MatrixMultiplication_Kernel<<<dimGrid, dimBlock>>>(Md, Nd, Pd, Width);
I can step into the function, however when I get into the function it doesn't let me step over any of the code and tells me that no source is available. Anybody knows how to debug into this properly?
Thank you!
You can now debug on a single machine with only one GPU using NSight.
Thought I'd update this, since the previous answers are no longer correct (you no longer need 2 GPUs) and it sent me off in the wrong direction for a while.
Update: Parallel Nsight is now free and supports debugging with only one GPU in your system.
To debug device code within Visual Studio you will need Parallel Nsight. The standard version is free and offers the debugging you require as well as device code profiling.
If you want to debug on a single machine then you will need two GPUs (since the GPU running the code will be stopped when it hits a breakpoint, and hence your display would block as well). They don't need to be high-end GPUs though, anything from G92 onwards will do (including most Fermi GPUs as listed here).
Are you using Nsight? Vanilla Visual Studio cannot step into device code, but with Nsight, this is possible. Unfortunately, limitations of the Windows device driver model mean there are some serious restrictions. It used to be that two machines were required to do the debugging. The target machine would run the CUDA code on it's GPU, and had to be using the TCC driver. The host machine would run Visual Studio and control the target. It seems that it is now possible to debug CUDA code on the same machine as long as you have two GPU's, one for compute and one for display. There are a number of other problems mentioned in the user guide.
This may not be an acceptable answer, but: If you can compile your code on Linux, you can use cuda-gdb to debug kernels. cuda-gdb is part of the Linux CUDA toolkit.
You can't debug CUDA kernel code using visual studio. Visual studio can only debug programs that run on the CPU.
In fact, I don't think that you can debug CUDA kernel code in Windows at all any more. CUDA used to have a host emulation mode, but that was removed in 3.0. The only debugging tools available are cuda-gdb and ocelot, and, as far as I know, neither of them supports Windows.

Resources