I would like to ask how can we debug cuda kernel that is called from a mexfunction with VS 2010 and Nsight. I followed the instructions in http://http.developer.nvidia.com/NsightVisualStudio/2.2/Documentation/UserGuide/HTML/Content/Attach_CUDA_to_Process.htm but the attach button is not enabled in order to attach matlab.
PS: Win 7 64x, Matlab 2011 x64, VS 2010, CUDA SDK 5.5 64x, Nsight 3.1 64x, GForce 9600.
NSIGHT_CUDA_DEBUGGER = 1
via Advance System Settings -> Environmental Variables and add the aforementioned variable both in User and System variables in the two panels. Tested on Matlab 2011a 64x and VS 2010 with SP1.
It is enough to set the NSIGHT_CUDA_DEBUGGER
environment variable just for MATLAB , so you don't have to slow down your entire system by having every process attachable. Quoting NVIDIA's Nsight documentation:
Setting
NSIGHT_CUDA_DEBUGGER=1
can degrade the performance of an application, since the debugger is made resident. The effect is minimal on Tesla™ devices and headless devices; it is most severe on display devices with a desktop, where the debugger by necessity may need to serialize launches that would otherwise have been asynchronous. Therefore, it's not always desirable to setNSIGHT_CUDA_DEBUGGER=1
at a system-wide or user-wide level .
To set it in a running MATLAB session (and spare the rest of your system):
>> setenv('NSIGHT_CUDA_DEBUGGER','1')
Hit Refresh or reselect the Nsight GPU Debugger and it works:
You still need to configure Nsight to allow attaching, but it's a one-time setting:
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.