Is there a way to debug PTX code?

I’m currently working with PTX programming. My approach is to first generate myprogram.ptx by using nvcc -o myprogram myprogram.cu --keep, then modify myprogram.ptx. Finally, I compile the modified PTX code into an executable using ptxas and fatbinary. How can I perform step-by-step debugging at the PTX code level in this workflow? What are the correct steps typically used in PTX programming?

The only debugger offered by NVIDIA for use on linux is cuda-gdb. It can debug PTX code in the sense that it is always working at the SASS level anyway, but does not really function as a source-level debug facility in that respect/with respect to PTX source. You would have to associate the PTX source code to SASS code (yourself/manually), perhaps using any of the suggestions in your recent question. cuda-gdb is covered in the documentation for the CUDA toolkit, and you might wish to ask specific questions about it on the cuda-gdb sub-forum.

You can get a walkthrough of typical cuda-gdb usage in unit 12 of this online tutorial series. It does not touch on PTX, however.

This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.