Skip to content

ncu: GPU CUDA Kernel Profiler

Available

  • Roihu-GPU: version depends on the CUDA environment

License

Usage is possible for both academic and commercial purposes.

Usage

NVIDIA Nsight Compute is a CUDA kernel profiler that provides detailed performance data and offers guidance for optimizing your CUDA kernels. The ncu profiling and debugging tool collects and views profiling data from the command-line. It is a low level CUDA kernel profiling tool. It enables the collection of a timeline of CUDA-related activities on both CPU and GPU, including kernel execution, memory transfers, memory set and CUDA API calls and events or metrics for CUDA kernels.

Profiling is done in two steps:

  1. Collect profiling data by running the application under ncu command line tool
  2. Analyze the results with ncu-ui GUI.

To use ncu, one needs to first load the CUDA module:

module load cuda

For collecting data, run your application normally via Slurm and prepend your executable with ncu <profiling options>:

#SBATCH ...
...

srun ncu -o profile ./my_executable
Depending on the performance metrics collected, each kernel launch may be replayed multiple times, adding significant overhead to the application run time. Thus, it is recommended to shorten the duration of the application (e.g. run only limited number of time steps or iterations), and collect metrics only for the most relevant GPU kernels. See NVIDIA documentation for more details.

The profiling report (.ncu-rep is appended to filename given with the -o option) is analysed with the ncu-ui GUI:

ncu-ui profile.ncu-rep`

The ncu-ui can be run directly on the CSC supercomputers (**Note: in Roihu GUI does not work at the moment), however, for smoother operation of the GUI it is recommended to copy the results files to your local workstation and view them using a local installation of Nsight Compute.

Do you find this page useful?
Thank you for your feedback!
Thank you! Your feedback is appreciated.

Please let us know how we could improve this page by contacting us or by creating an issue in GitHub. You can also edit this page yourself and contribute your improvements by creating a pull request.