Nvvp instruction level profiling: source-file mappings missing from the kernel

Hi all!

After reading this very interesting post https://devblogs.nvidia.com/parallelforall/cuda-7-5-pinpoint-performance-problems-instruction-level-profiling/ I thought I’d give the visual profiler nvvp a try.

I have no issue running nvvp, but when I try to do the instruction level profiling, I get a view of the disassembled kernel. I’d like to see the source file.

In some box of the Results section, it says:
" The source-assembly viewer could not be shown because source-file mappings are missing from the kernel. You can enable source-file mappings by using the -lineinfo flag when compiling the kernels"

I’ve tried adding -linfo to the compiling, i.e. my makefile executes:
nvcc -x cu -O3 -std=c++11 -lineinfo -dc main.cpp
nvcc -x cu -O3 -std=c++11 -lineinfo -dc DG.cpp
nvcc -x cu -O3 -std=c++11 -lineinfo -dc Problem_functions.cpp
nvcc main.o DG.o Problem_functions.o -lineinfo -o DG1D

but it doesn’t help.

I have cuda 9.0. I’m on linux, and execute the profiler with “nvvp ./DG1D”

Any guess?

Instruction level profiling (i.e. PC sampling) requires a GPU of compute capability 5.2 or higher, as indicated in the article you linked.

Your compile commands are targetting a compute capability of 3.0

If you have a cc 5.2 or higher GPU, try compiling for the specific GPU target, e.g.

-arch=sm_52

or similar

Thank you for your reply. I have a cc 5.0 GPU, that may explain it.

I’m not sure, you may still see some source in your disassembly view if you compile for the correct architecture in your case with:

-arch=sm_50

but you won’t be able to run pc-sampling based profiling on a cc5.0 GPU.

I was working on my desktop computer. Fortunately, I have access to a cluster with more recent GPUs. So one alternative that I’ve found is to use run my code with nvprof on the cluster to create an analysis.prof file for my code.

nvprof --kernels “kernel_name” -analysis-metrics -o analysis.prof

Then I can just read the .prof file on my desktop computer.

Hi,

I have a similar problem here (Ubuntu 18.04, CUDA 10.1, GTX 1070). The program was compiled by a simple Makefile, so all of the .cu source files were compiled by commands like this:

nvcc file.cu -c -std=c++11 -DNDEBUG -Iinclude_dir -O3 --use_fast_math -g -lineinfo -rdc=true\
-gencode arch=compute_35,code=sm_35 -gencode arch=compute_60,code=sm_60 -o src/file.o

NVVP complained about missing source file mappings for kernels in one file (file1.cu). When I moved these kernels to other .cu source files, the complaint would be gone. I have also checked the PTX code (file1.ptx), in which I could find

.loc 1 206 9

        .file   1 "path_to/file1.cu", 1576738260, 10959
        .file   2 "/usr/local/cuda-10.1/include/vector_types.h", 1566421103, 13004

and similar code.

Any ideas?

Thanks.

What is the output of “nvcc --version”?

I’ve had the same problem with 10.1.243 (the 2nd re-release of 10.1) on a couple of different machines, but but found that downgrading CUDA to the original release of 10.1, where nvcc --version reports 10.1.105, resolved this problem for me.

Hi tera, your guess was correct. My nvcc version is 10.1.243.

Thanks for sharing your experience.