Nsight 5.2/VS2012 C++/CUDA 7.5 Crash

Newbie here, so please be gentle.

I am using Nsight 5.2 with CUDA 7.5 and VS2012 C++ on a Win10 64 bit machine with a GTX760.

I am trying to write a custom kernel.

Using the VS debugger, so far, so good. Everything, including the CUDA code works with no problem.

Now, I want to add breakpoints to the CUDA code.

In order to do that, I believe I need to use Nsight and select “Start CUDA debugging” (putting a breakpoint in the CUDA code of course).

Doing that, work fine for all the native C++ code that runs on the CPU.

Once the CUDA code is invoked however, I get an immediate crash that is reported as “unhandled .NET Framework exception”

Again, the exact same code runs fine using the VS debugger.

What am I doing wrong/how can I get Nsight to work here?

Any help appreciated.

Looks like the nsight is failed to be launched, can you try to launch the “C:\Program Files (x86)\NVIDIA Corporation\Nsight Visual Studio Edition 5.2\Monitor\Common\Nsight.Monitor.exe” manually?

Because the native C++ code is running when I invoke the NSight CUDA debugger from within VS2012, it would seem that NSight must be running. No?

Hi,

I have no idea what you are talking about, could you please tell me the detailed steps?

Best Regards
Harry

Sorry for being less than clear.

My code base includes a bunch of C++ code using OpenCV. OpenCV itself includes some GPU accelerated function based on CUDA. I can compile all of this just fine. Further, I can run this just fine by selecting “Debug”, “Start debugging.” I call this “native C++ code.”

In addition, I have written my own CUDA kernel for some functions that I can invoke by making program selections. I call this “CUDA code.” Using the method above, I can run all the code, including the CUDA code, and it all works.

Now, I want to put some breakpoints in the CUDA code. If you do that and invoke the VS debugger as above, the breakpoints are ignored but the code still runs fine.

In order for the breakpoints in the CUDA code to work, I believe I have to use the NSIght debugger. If I pick “NSight”, “Start CUDA debugging” from within VS, the “native C++ code” runs and runs fine. Now, I select a program option that causes my CUDA code to be invoked (i.e., the same code that ran fine using the VS debugger). At this point, the program crashes and I get a message saying “[program] stopped working.”

So, I am trying to figure out why that happens and get CUDA breakpoints to work.

Oh, I got it, could you try to disable the TDR in nsight monitor?

If it doesn’t help, could you tell me you computer info like GPU, CPU, memory and send me your compiled app, pdb and cuda kernel source to me, than I can try to repo it on my computer.

TDR is already disabled.

As I indicated above, I am using Nsight 5.2 with CUDA 7.5 and VS2012 C++/CLI on a Win10 64 bit machine with a GTX760. The underlying machine has an Intel i7 with 16GB.

How would I send you those files? Also, the underlying code is way too big and has too many librury, data file, and hardware dependencies to send and for anyone else to compile/run.

That sounds bad, I just found that the nsight 5.2 download link points to an old version, could you try the latest nsight in cuda 8.0 package and latest 378.92 driver, you don’t need to install the cuda 8.0, just the visual studio integration in it.

Naturally, I will do anything. That said, when I look at the NSight “About” dialog, it does say version 5.2.0.16268. Also, I know that the driver is 378.78.

5.2.0.16268 is old version, someone putted a wrong version on the web site, could you please download the cuda 8.0 package and install the nsight in it, the latest version should be 5.2.0.16321

Ok. Did that. No change in the behavior. One thing is that the CUDA samples seem to work with NSight (i.e., I can set breakpoints which work). That makes me think it is something about how this project is setup.

maybe we should check the log on your computer.

Quit NSight monitor if it’s running
Set NVLOG_CONFIG_FILE= Path Of Attached NvLogConfigCustomer.txt
Edit the attach NvLogConfigCustomer.txt of the first line, path to NVLOG.txt
Relaunch NSight monitor
Start debugging to repro the issue
Quit debugging
Sent us the NVLOG.txt
NvLogConfigCustomer.txt is attached.

NvLogConfigCustomer.txt (272 Bytes)

Sorry to be dumb, but do you mean to create an environment variable called “NVLOG_CONGIF_FILE”?
There is not one currently.

Yeah, an environment variable called “NVLOG_CONGIF_FILE” which points to the location of your NvLogConfigCustomer.txt, then launch the nsight monitor with this env var.

Should there already be a file called NVLOG.txt somewhere?
I am not finding one.

I am not finding that file anywhere.
I simply made a location for such a file.
Running NSight with that, no new file with the name “NVLOG.txt” appears to be created.

Is there any chance we could connect using TeamViewer, e.g., to try and solve this?

Hi,

Could you attach a picture of the error you got, nvlog works for the app you are debugging, if the exception comes from nsight monitor, we should use another log, actually I’m not sure where the exception comes from, and one more question, is your solution a .net exe + cuda dll or pure c++ project?

Anyway, I just attach a new log configuration file, the log will be written to “D:\NvLog\nvlog.txt”, you just need to close the nsight monitor, open a cmd and run “set NVLOG_CONFIG_FILE={path of your log config}”, use the same cmd to run the nsight monitor which should be “C:\Program Files (x86)\NVIDIA Corporation\Nsight Visual Studio Edition 5.2\Monitor\Common\Nsight.Monitor.exe”, then you can get the log at “D:\NvLog”, of course you should make sure the “D:\NvLog” exists.

Best Regards
Harry
nvlogconf.txt (116 Bytes)

My underlying app is a WinForms app using .net.

Also, I did everything you said with regard to Nvlog and still no “nvlog.txt” file created.

I am not seeing anyway for me to attach an image to this reply.
What I see is first, the program report “[myapp] stopped working” in a diolog box.
If you select “debug” from the dialog box, you see that it says “An unhandled Microsoft .NET Framework expcetion occurred in [myapp].”

Hi nvlog will be created when the injected dll is invoked in your app, no nvlog means the nsight monitor failed to start your app, the app even doesn’t invoke the debugging feature. I shall create a .net project to have a try.

BTW you can upload the attachment via editing the thread you post. please check my attached picture.