a problem about debugging cuda codes mixed with mexfunction of matlab

i have followed the procedures about attach vs with matlab using nsight ,but something wrong happened ,it can not stop to the breakpoints i set. The Output just shows

Context created : 3e8b5130
Module loaded: 52910b80 lwx.cu
Module unloaded: 52910b80
Context created : 0e7d5130
Module loaded: 4648c9b0 lwx.cu

i need some help


When in debug mode, are the breakpoints solid red or do they have a questionmark or hollow? (note that they will be solid red before starting the debug session.
Where are you setting the breakpoint? in lwx.cu? how and where was lwx.cu compiled? did it have the -G on?


Firstly,thanks for your tips.When in debug mode,the breakpoints are solid red and when i turn to the matlab to run the code(lwx.cu),it shows " The breakpoint will not currently be hit. No symbols have been loaded for this document. ".Of course I set the breakpoints in both host codes and device codes which are in the file , lwx.cu. I really have compiled the lwx.cu with ‘-G’ on the matlab which it will create a pdb file.I have tested the mixture coding with C and matlab and it worked.In accordance with the procedures ,to perform the mixture coding with cuda and matlab , I changed some steps ,choosing the Nsight debugger when attached to matlab , but it failed as I described above . Have you succeeded before ? It drives me crazy…

Could you tell me the versions of what you have(VS, driver, Nsight version) and which GPU?

Are the binaries being built on the same machine as it is being debugged? Just to clarify, the PDB is for the CPU side of things (which is a good thing), but for Nsight to work, we need to be able to get the debug info which for CUDA runtime, it gets embedded into the EXE/DLL.
The easiest way is to verify that when nvcc is called with the -G command line switch (note that it is the upper case and not the lower case).

driver versions: 320.57
Nsight: 2.2
GPU : Tesla C2050

I just input the commandline , ‘nvcc --help’ on the cmd and it shows

–debug (-g)
Generate debug information for host code.

–device-debug (-G)
Generate debug information for device code.

I never notice these !!! And I guess this is the reason why I failed.
But the new question is how to debug the lwx.cu with ‘-G’?
let me show the steps I made:
1.open the VS2010 and open the lwx.cu without building a project
2.open matlab and enter the directory , to compile the lwx.cu using ‘nvmex -g’
3.vs2010 attach the matlab using the Nsight debugger
4.run the lwx.cu invoked by test.m
now where to debug the lwx.cu with ‘-G’ ? matlab , vs2010 or cmd ? and put the pdb file pruduced by it to where ?


I wanted to get more detailed info before replying back earlier.

NVMEX is not a MathWorks tool – it is a 3rd party alternative to the MEX support (which pre-dates the MEX support), so it is a bit difficult to provide you some detailed support there. What happens if you get the help from NVMEX, what options do you have? Could the authors help you on this?

If you want to try MathWorks MEX support instead, you can look at: http://www.mathworks.com/matlabcentral/answers/88541-failed-to-attach-matlab-in-visual-studio-2010-in-order-to-debug-cuda-kernel

Hopefully this helps you in some way…