Profiling with nvprof

Posted on Fri 19 April 2024 in Nvidia, GPU, Profiling, Jetson • Tagged with Nvidia, GPU, Profiling, Jetson

I'm working on a Jetson Nano and I want to profile my code. Nvidia provides several tools, being Nsight Compute the most powerful one. However, it cannot be run on the Jetson Nano, so I have resorted to using nvprof.

nvprof is a command-line profiler that can be used to profile CUDA applications. It is included in the CUDA Toolkit, so you should have it installed if you have CUDA installed. However, you need to be root to run it. As root, I don't have the CUDA environment set up, so I need use the full path. These are two commands that I've found useful:

/usr/local/cuda/bin/nvprof --print-gpu-trace ./my_program

This shows the GPU trace of the program. It is useful to see how the GPU is being used.

/usr/local/cuda/bin/nvprof --metrics all ./my_program

This shows all the metrics that nvprof can measure. It is useful to see how the program is using the GPU.

In addition, you can use the --log-file option to save the output to a file …


Continue reading