I have compiled a Dll using NVCC. I then run a 64-bit process (.exe) that uses LoadLibrary to load the dll and to call methods from the dll to run it. How can I debug the CUDA code inside this dll, using NSIGHT?
I should add that this 64-bit process is in fact a Visual Studio’s Unit Test that I run manually by calling vstest.console.exe. It is the unit test code that loads into its process,the dll compiled from NVCC
When I use Visual Studio 2017 in admin mode, debug->Attach to Process and choose Nsight GPU Debugger, then my local computer, I see the vstest.console process but it is greyed out and cannot be selected for debugging.
Is there a way that the NSIGHT debugger can debug a dll complied from NVCC that is loaded into a 64-bit process?
AFAIK you don’t need to anything special if you exe comes from a vc++ not a .not project, you just need to right click your project and start cuda debugging.
I can debug the host code in a nvcc compiled dll that is called from a unit test by adding a breakpoint in Visual Studio and then right click on the unit test name and select debug unit test. Visual Studio’s debugger then breaks at the breakpoint in the host code as expected.
Unhfortunately, there is no right click and debug unit test with NSight. Hence why I am having to call the unit test directly using vstest.console.exe. Despite having Nsight Monitor with admin prviliedges, when I try to attach to the vstest.console.exe process with the GPU debugger, that exe is greyed out.
So I cannot use NSIGHT to debug a Visual Studio Unit Test. In the old thead you said that the request to be able to do this was submitted. Any progress or can the request be resubmitted?
Nope, nothing updated, it’s a backlog issue, they are setting focused on next-gen debugger now, nsight monitor will be a legacy product.
If you know how to launch vstest.console.exe with your unit tests, there will be a detour for you, you know how to debug a dll in visual c++ right? If you try to launch a debugger for a dll project, visual studio will ask you to specify a exe you want to launch, then you can debug your dll in this process, you can do the same thing on with nishgt.
right click your dll project, click Nisght User Properties.
set vstest.console.exe in Launch external program, also make sure your argv and working directory are right, just make sure that your unit can work well.
then you can right click and use night to debug you dll unit test project if you dll and vstest.console.exe are in the same memory space, this works like using visual studio to debug a normal c++ dll project
Thanks Harryz_,
Did that and still not able to get NSIGHT to work for me!
vstest.console.exe in fact spawns another process; vstest.executionengine.exe, that runs the unittest.dll which in turn runs my CUDA code.
I did GPU debugger attach to the vsttest.executionengine.exe process but NSIGHT never stopped at any breakpoint in my kernel code :(
Ah, I wish there was some way I can get this to work.
The CMD windows displays…
"Microsoft (R) Test Execution Command Line Tool Version 15.0.26929.2
Copyright (c) Microsoft Corporation. All rights reserved.
Starting test execution, please wait…
Warning: Using Isolation mode to run tests as required by effective Platform:X64 and .Net Framework:Framework45 settings for test run. Use the /inIsolation parameter to suppress this warning."
I’m wondering now if vsttest.executionengine.exe runs this in another process still? Maybe that could be fooling NSIGHT?
You can try to select “Application is a launcher” in Nsight User Properties, if it still doesn’t work, I really have no idea how to make it work, maybe you should try the cppunit?