|
Article ID: 701
Last updated: 14 Sep, 2026
NVIDIA Nsight Systems is a low-overhead statistical sampling profiler with tracing features to check overall performance of your GPU applications. The Feature Table in Get Started with Nsight Systems provides a glimpse of its capabilities, including but not limited to: profiling both the CPUs and the GPUs; investigating CPU-GPU interactions; tracing CUDA Application Programming Interface (API) and CUDA libraries; correlating API and GPU workload; and identifying GPU idle and sparse usage. Nsight Systems provides both a command line interface (CLI), called nsys, and a graphical user interface (GUI), called nsys-ui. Using the CLI facilitates a quick way to collect performance data on a target (the CPU, the GPU, or both). The collected data can then be copied to any system where Nsight Systems is installed for analysis through the Nsight Systems CLI and/or GUI. Note: Starting with Nsight Systems version 2024.4, no source code line number is available in the profiling data. This article provides basic information primarily to help you use the Nsight Systems CLI on NAS systems. The examples use the Cabeus front ends (CFEs) for GPUs with x86_64-based CPUs (mil_a100). gh200 nodes: If you are using GPUs with aarch64-based CPUs (gh200), please be aware of the following differences from use of the GPUs with x86_64-based CPUs:
Loading a nvhpc ModulefileNsight Systems is included in the NVIDIA HPC Software Development Kit (SDK). To access the kit, load one of the HPC SDK modulefiles on a NAS GPU compute node either through an interactive PBS job or a batch job script. The example below starts an interactive PBS session on a mil_a100 node through a qsub command from a CFE (cfe01 or cfe02), loads an nvhpc module, checks the version of nsys, prints its help page, and returns info about the system's profiling environment:
Notes:
Profiling an Application
All available profile switches (including their description, possible parameters and default setting) are listed in the Nsight Systems User Guide or through the nsys ‑h profile or nsys profile ‑h help page. Profiling a Non-MPI ApplicationNote: If you want to profile an MPI application, see the Profiling and Analyzing MPI Applications section. The simplest way to profile an application is by running: GPU_node> nsys profile your_application This will launch your_application, start collection immediately, and end collection when your_application stops. It will also trace CUDA, OpenGL, NVTX, and OS runtime libraries APIs, and collect CPU sampling information and thread scheduling information. At the end, a profiling output file with the suffix .nsys‑rep is generated. Note: The NVIDIA Tools Extension (NVTX) library is a set of functions that a developer can use to annotate the source code for profiling time line, customizing their appearance and assigning names to resources. By default, the first profile output filename in a directory is report1.nsys‑rep. A new output generated in the same directory will be named report2.nsys‑rep, followed by report3.nsys‑rep, and so on. You can add the option ‑‑output=filename (long notation, use of "=" is optional) or -o filename (short notation) to name the output file filename.nsys‑rep. You can also add the option ‑‑force‑overwrite=true or ‑f true to force overwriting existing xxx.nsys‑rep with same output filename. Instead of tracing the default APIs (CUDA, OPENGL, NVTX, OS Runtime), using ‑t or ‑‑trace switch allows you to choose what API(s) to trace. To keep the overhead small, try to narrow down to the set of features you specifically want to trace and only trace a smaller number of iterations. See the nsys profile ‑h help page for possible ‑t API options. For example: GPU_node> nsys profile --trace=cublas,openacc your_application See the Example Single Command Lines section of the Nsight Systems User Guide for many more nsys profile examples. Generating Profiling Statistics ReportsNsight Systems includes many python scripts that read data from a SQLite database to generate various reports. You can find these scripts in (for example) the /nasa/nvidia/hpc_sdk/toss4/Linux_x86_64/24.3/profilers/Nsight_Systems/host-linux-64/reports directory. Therefore, the xxx.nsys‑rep file needs to be exported to a xxx.sqlite file first before reports can be generated. There are a few choices:
Notes:
Identifying Optimization OpportunitiesThe nsys command option analyze can be used to get a high-level diagnosis of possible issues and suggestions for performance improvement in the areas of synchronization, data movement, overlap and parallelization.
Using the Nsight Systems GUIFor more detailed analysis of your application (such as looking into the timeline and correlation of events happening on different CPU cores, GPU devices, or threads), use the Nsight Systems GUI nsys‑ui. For example, nsys-ui xxx.nsys-rep To learn and gain experience with nsys‑ui, watch the videos listed in the reference section below. Notes:
Profiling and Analyzing MPI ApplicationsNsight Systems supports the use of OpenMPI. The description here should work for OpenMPI.
Use of Nsight Systems with HPE MPT to profile GPU applications may work but is not guaranteed. To proceed, load a nvhpc-nompi modulefile followed by mpi-hpe/mpt. For example:
Besides setting the CUDA_VISIBLE_DEVICES variable properly, you will also need to set two environment variables before launching HPE MPT mpiexec.
Note: The option -perhost can be replaced with ‑ppn. Both ‑perhost and ‑ppn must come before the ‑np option. References
|
