How to see PTX/CU/source code?

Hi! I am using nsight compute, and see one of my friend can see PTX and SASS and source code in nsight compute! I am very interested but do not know how. Like this:



So he use Visual Studio, under debug mode, press that green triangle button, and get a a.exe. Input to nsight compute and get it. He is using 3060 PC.

Below is my operations:
I am using 1650PC and also try another 3050PC. In cmd, I enter nvcc kernel.cu -arch=sm_75. Then I get a.exe. In nsight compute, I choose that a.exe, and choose this mode:


Then I press launch:

And only see a “SASS” here!!! Can not find other choice! Same thing happens in 3050PC…

Must I buy a 3060? Or I have some mistake? (I also tried to use VS to compile, but have some problem now)

Thank you!!!

==========================

Later I successfully use VS to compile a “debug” .exe file. And it works! Well…Can I directly compile it in nvcc? Maybe with
nvcc kernel.cu --debug???Or something similar?

Thank you!!!

You can pass the --generate-line-info command-line parameter to the nvcc, to generate line-number information for device code. For example
nvcc --generate-line-info -arch=sm_75 kernel.cu

This will generate executable with source-sass line information.

This is because, the debug mode generates debug information for device code, that includes source line information. But this is not intended for profiling, you should use --generate-line-info instead for profiling. For more information please check
https://docs.nvidia.com/cuda/cuda-compiler-driver-nvcc/index.html#options-for-altering-compiler-linker-behavior-device-debug

1 Like

Thank you! It works! just one question, how to see the “source code”? Do I need to do some extra operations?

No, you don’t need any extra steps to see source code. Can you please provide some more details?

Are you doing remote profiling?
Did you move/rename your source files by chance?
You can try resolving source file manually in case file not found. Click “Resolve” button and you will be able to select your source file manually in file browser. Hope this helps

1 Like

Oh! Resolve works!

Thank you!!!

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