Python Source file not displayed - only SASS view

Hi,

I am trying to profile a kernel in a Python program using the following command:

/nsight-compute/ncu --set full --import-source on -f -o profile python gym_env/main.py

However, when I open the resulting report, the Python source column is missing, and I can only see the SASS view.

Additionally, I receive the following warning:

No source files were imported. Check that the target application was compiled with -lineinfo.

How can I compile the target Python code with -lineinfo?

For context, I am running ncu inside a Docker container with all the necessary files already copied into it.

Hi, @gioele.molinari

We can see the python source file. For example, as below

Which version of NCU do you use ?
Are you running ncu within docker and use ncu-ui outside docker ?
If possible, please provide the report for check.

Nsight Compute profiles the GPU side of the Python application, meaning the CUDA kernels launched by Python or through the frameworks called by it. How to enable line information for this depends on the framework and library used. For numba.cuda, you can find that info here. For other libraries, please contact the library developer or its documentation on how to enable this.

Hi @veraj,
thanks for your answer:
I am currently using

NVIDIA (R) Nsight Compute Command Line Profiler
Copyright (c) 2018-2024 NVIDIA Corporation
Version 2024.3.2.0 (build 34861637) (public-release)

Yes, I’m running ncu within docker and use ncu-ui outside docker.

Then it should be the file path difference between in docker and outside docker.
Can you try “resolve” to specify the source file?

Hi @felix_dt,
thanks for your answer.
I’m currently using NVIDIA Warp as framework. I was able to perform a general system profiling using Nsight System as described here (Profiling — Warp 1.5.1). Now I wanted to profile a specific kernel of the code written in Warp using Nsight Compute.

Do you know how to enable line information for Warp?

Contrary to what I see in your screenshot I do not see any “resolve” aside the “Navigate By”

The ability to “Resolve” requires line info to start with. Once you have line info, to avoid the need to resolve, you can also profile with --import-source yes. I am not aware that Nvidia Warp supports lineinfo, but I sent a message to the team to check.

Thank you!
I have also tried to set:

wp.config.mode = "debug"

in my main.py file (according to this Debugging — Warp 1.5.1) but this also doesn’t solve my issue.

I confirmed with the team that Debugging — Warp 1.5.1 does in fact work and produce lineinfo for GPU code. It should map to the main CUDA file generated from your Warp Python code though, not to the original Python.

It’s hard to say why it doesn’t work in your particular case. That said, there is no dedicated lineinfo option, and using the debug mode will make the profile result not actionable due to the debug overhead. We will look into adding such an option in the future, including mapping to the original Python.

Thank you for informing and letting me know very quickly!