kunzmi / managedCuda

ManagedCUDA aims an easy integration of NVidia's CUDA in .net applications written in C#, Visual Basic or any other .net language.
Other
440 stars 79 forks source link

BreakPoint debugging in .cu file #88

Open chenw11 opened 4 years ago

chenw11 commented 4 years ago

I'm trying to achieve breakpoint debugging with .cu file in run time when using managedcuda. The way I tried is to run CUDADebugging directly on my C# project.However, my cu file is not reached, and the breakpoint shown error: "breakpoint will not currently be hit, no symbol have been loaded for this documents". Notice that the compile .ptx is already configured in the project.

There is a old post about GPU debugging(https://github.com/kunzmi/managedCuda/issues/1), and it is mentioned "For debugging you need of course to compile the kernels with debug info (-G flag for NVCC). " I'm very new in the field, so can someone guide me a little to understand this sentence? How should I setup this -G flag? Thank you.

kunzmi commented 4 years ago

In the project properties of your kernels, you have to switch on the debug infos (-G option) so that the cu files get compiled to ptx with debugging support. If you load in your application a ptx file without debugging information, the debugger can't know where the source file is and where to find the single code lines.

chenw11 commented 3 years ago

In the project properties of your kernels, you have to switch on the debug infos (-G option) so that the cu files get compiled to ptx with debugging support. If you load in your application a ptx file without debugging information, the debugger can't know where the source file is and where to find the single code lines.

In the kernel setting, under CUDA C/C++ menu. The setting for "Generate GPU Debug Information" and "Generate Host Debug Information" are both : "Yes (-G)". And under CUDA Linker>General meun, the setting for "Generate GPU Debug Information" is "inherit from porject". However, I still could not step into the breakpoints in .cu file when running system debugger. If I run system debugger I can reach the main program's breakpoint. When I tried to run cuda debugger(next-gen) instead, it will freeze after enter the main program, but I can't tell when it start to freeze exactly because neither the breakpoints at main program nor the ones at .cu file were hit (But I'm guessing it's related to the CUDA setup code). Then those breakpoints at main program and cu file both shown"The Breakpoint will not currently be hit. No symbols have been loaded for this documents".Interestintingly, I could profile just fine using NVIDIA visual profile. Any idea?