CUDA C++ code debugging is failing in visual studio.

Hi All,

I am a beginner. I want to debug the cuda code in visual studio. I tried a lot of things but unable to debug the program. I am getting an error for both debuggers,

  1. CUDA Nsight Next-Gen debugger: could not initialize driver for debugging.
  2. CUDA Nsight Legacy debugger: cuda grid launch failed.

Find the following details.
GTX1050ti
cuda 9.2
driver version: 417.01
Nsight 5.6
visual studio 2015
Windows 7

sample code:

#include “cuda_runtime.h”
#include “device_launch_parameters.h”
#include <stdio.h>

global void myKernel()
{
printf(“Hello World\n”);
}

int main()
{
myKernel <<<1, 1000 >>>();
cudaDeviceSynchronize();
getchar();
}

Thanks in advance.

If you only have one GPU, you must be running in WDDM mode (vs TCC mode), since this is your display card.

In WDDM mode,

  • Next-Gen debugging requires win10 RS4 or later, so your win7 config will not work unless you get another display card and put your 1050ti into TCC mode.
  • Legacy debugging should work with your win7 config.

We’ll see if we can reproduce the win7/WDDM mode/Legacy debugging issue, but in the meantime

  1. You may want to udpate to the CUDA 10.0 toolkit (which includes the NsightVSE v6.0 debuggers)
  2. You may want to use the driver included with CUDA 9.2 and NsightVSE 5.6 (397.xx)

.

For Next-Gen/Legacy Debugger supported GPU configurations (GPU, OS, DriverMode, DriverVersion), see
https://developer.nvidia.com/nsight-visual-studio-edition-supported-gpus-full-list#SupportedComputeConfigs

CUDA 10.0 : https://developer.nvidia.com/cuda-downloads
NsightVSE 6.0 : https://developer.nvidia.com/nsight-visual-studio-edition-downloads
TCC/WDDM Mode: https://docs.nvidia.com/gameworks/content/developertools/desktop/nsight/tesla_compute_cluster.htm

Hi rbisschof,

Thank you for your reply. I have only one GPU and it is running in WDDM mode. Is it not possible to work with cuda 9.2? As I have built opencv libraries with cuda 9.2.

Thanks in advance.

Hi rbisschof,

Now, I am able to debug the program in WDDM mode

cuda version 9.2
Nsight version 6
driver version 417.22
visual studio 2015
Windows 7
GTX 1050ti

Thanks

Good! I assume you’re using the Legacy CUDA Debugger with Win7.
There must be some incompatibility with the latest drivers and the older version of the NsightVSE CUDA Debugger.

Hi, rbischof.
I am a beginner. I have a similar problem. I use the matrixMul program code in CUDA Samples ship with CUDA toolkit. But I got error for both debuggers:

  1. CUDA Nsight Next-Gen debugger: stopped at the breakpoint and couldn’t go on.
  2. CUDA Nsight Legacy debugger: cuda grid launch failed.

I’m running in WDDM mode.

Find the following details.
Nvidia GeForce 1070 & Intel HD Graphics 630
cuda 9.0
driver version: 417.71
Nsight 5.5
visual studio 2015
Windows 10 ( Windows version: 17134.648)

Is this problem caused by the Intel GPU? Or it’s about incompatibility?

I believe your problem is due to a incompatibility between the OS, GPU, driver, and old NsightVSE.
With the Pascal GPU and WDDM mode driver after 496.xx on win10 RS4 or later, you need to use NsightVSE version 6.0 or later.
See this OS/driver/GPU/Debugger compatibility chart: [url]Nsight Visual Studio Edition Supported GPUs (Full List) | NVIDIA Developer

I’d recommend visiting [url]https://developer.nvidia.com/nsight-visual-studio-edition[/url] for the latest NsightVSE and recommended driver downloads.

Note: Win10 RS4 is (Windows 10 April 2018 Update, version 1803, build number 10.0.17134)

Hi rbisschof,

Thank you for your reply. I have reinstalled CUDA 9.0, then the driver rollback, and this problem is solved.

And after I install CUDA10.0, the Next-Gen debugger works, the Legacy debugger still didn’t work, so the problem is indeed an incompatibility.