Performance Analysis of Your GPU Applications with Nsight Systems

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:

  • Access to these nodes is via the Cabeus Grace Hopper front ends, cghfe01 or cghfe02.
  • The available nvhpc modulefiles may be different.
  • The location of the Nsight Systems Python scripts is different.
  • HPE MPT is unavailable.

Loading a nvhpc Modulefile

Nsight 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:

cfe% qsub -I -q gpu_devel -lselect=1:ngpus=1:model=mil_a100 
a_GPU_node> source /usr/local/lib/global.profile  # if using bash
a_GPU_node> module use -a /nasa/modulefiles/testing
a_GPU_node> module load nvhpc/24.3 
a_GPU_node> nsys --version   # or nsys -v
a_GPU_node> nsys --help      # or nsys -h
a_GPU_node> nsys status -e   

Notes:

  • All of the current NAS NVIDIA GPU nodes use a CUDA driver version =/> 535.104.12, which uses driver 535 or newer to improve GPU profiling stability.
  • Use the latest available nsys version, which includes more features, by loading the latest available nvhpc modulefile.

Profiling an Application

  • For Single or Multi-Threaded non-MPI Applications:

    nsys profile [profile switches] application [application options]

  • For Single-Node MPI Applications:

    nsys profile [profile switches] mpirun [mpirun options] application [application options]

  • For Multi-Node MPI Applications:

    mpirun [mpirun options] nsys profile [profile switches] application [application options]

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 Application

Note: 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 Reports

Nsight 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:

  • Profiling and generating statistics summary in one command

    GPU_node> nsys profile --stats=true your_application

    This will profile your_application to create an .nsys‑rep file and also generate an SQLite database (.sqlite). Furthermore, statistics summary reports in text format will be shown to the terminal (when using interactive PBS session) or the PBS standard output file (when using batch job).

  • Generating the SQLite database and the statistics summary in text format from an existing .nsys-rep file

    nsys stats xxx.nsys-rep

    In this case, nsys will look for an accompanying SQLite file and use it. If no SQLite file exists, one will be exported and created.

  • Generating the statistics summary in text format from an existing .sqlite file

    nsys stats xxx.sqlite

Notes:

  • Post-processing an existing xxx.nsys‑rep or xxx.sqlite file can be done on a GPU node or a NAS Cabeus front end (cfe01 or cfe02).
  • By default, the statistics summary reports (such as nvtx_sum, osrt_sum, cuda_api_sum, etc.) generated are a subset of all available summary reports. See the ‑‑report section of the nsys stats ‑h printout for more information. In addition to summary reports, there are a few tracing reports (such as cuda_api_trace, cuda_gpu_trace, cuda_kern_exec_race, mpi_event_trace, etc.) one can generate. For a complete list, see nsys stats ‑‑help‑report printout. To generate a tracing report for, say, cuda_api_trace, perform the following:
    nsys stats --report=cuda_api_trace xxx.nsys-rep
    or
    nsys stats -r cuda_api_trace xxx.sqlite

Identifying Optimization Opportunities

The 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.

nsys analyze xxx.nsys-rep
or
nsys analyze xxx.sqlite

Using the Nsight Systems GUI

For 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:

  • Using a Cabeus front end (cfe01 or cfe02) through a VNC session is recommended for launching the Nsight Systems GUI.
  • Beyond the use of Nsight Systems for application-level overall performance analysis, use Nsight Compute for detailed CUDA kernel performance analysis and seek optimization opportunities in GPU utilization, kernel implementation, and memory access.

Profiling and Analyzing MPI Applications

Nsight Systems supports the use of OpenMPI. The description here should work for OpenMPI.

  • Single-node MPI applications

    nsys profile [profile switches] mpirun [mpirun options] application [application options]

    will generate a single xxx.nsys-rep file, which contains profiling data from all MPI ranks.

  • Multi-node MPI applications

    mpirun [mpirun options] nsys profile [profile switches] application [application options]

    will generate one xxx.nsys‑rep for each MPI rank. For example, if the directory already has a report1.nsys‑rep file, then by default profiling a 4‑rank MPI run will generate report2.nsys‑rep, report3.nsys-rep, report4.nsys‑rep, and report5.nsys‑rep.

    In order to better correlate each .nsys‑rep file with the corresponding MPI rank, it is recommended to add the OpenMPI rank identifier OMPI_COMM_WORLD_RANK into the .nsys‑rep files. For example,

    For bash:

    mpirun [mpirun options] nsys profile -o application_%q{OMPI_COMM_WORLD_RANK} application [application_options]

    For csh:

    mpirun [mpirun options] nsys profile -o application_%q\{OMPI_COMM_WORLD_RANK\} application [application options]

    TIP: Not all OpenMPI modulefiles at NAS are PBS-aware. When running across nodes, you may need to use:

    mpirun -np X -npernode Y --hostfile $PBS_NODEFILE -x PATH -x LD_LIBRARY_PATH nsys profile .... or mpirun -np X --map-by ppr:Y:node --hostfile $PBS_NODEFILE -x PATH -x LD_LIBRARY_PATH nsys profile ....

    where X is the total number of MPI ranks and Y is the number of MPI ranks on each node.

    This will generate application.0.nsys-rep, application.1.nsys‑rep, application.2.nsys‑rep, and application.3.nsys-rep for a 4‑rank MPI run.

    The -o option of nsys profile also allows the use of %h and %p to include the hostname and process id into the .nsys-rep output filename.

    To analyze multiple .nsys-rep files from multiple MPI ranks using Nsight Systems GUI nsys‑ui in a single 'Timeline View', perform the following:

    • Start nsys-ui
    • From the File pulldown, select New multi-report view. You should then see:

      Screenshot of the nsys GUI

    • Click the icon indicated by the red arrow to select and add multiple xxx.nsys-rep files one by one. After the first file is added, the Apply button indicated by the blue arrow will be enabled.
    • After all files you want to analyze together have been added, click Apply.
    WARNING: There may be too much data collected from all of the MPI ranks. Consider profile only a single or a few MPI processes to reduce the amount of data to be analyzed. See Profile a Single Process or a Subset of Processes for more information.

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:


source /usr/local/lib/global.profile    # if using bash
module use -a /nasa/modulefiles/testing
module load nvhpc-nompi/24.3
module load mpi-hpe/mpt

Besides setting the CUDA_VISIBLE_DEVICES variable properly, you will also need to set two environment variables before launching HPE MPT mpiexec.

For bash:
export MPI_SHEPHERD=1   
export MPI_USE_CUDA=1  

mpiexec -perhost Y -np X nsys profile -o application_%q{MPT_MPI_RANK} application ..

For csh:
setenv MPI_SHEPHERD 1
setenv MPI_USE_CUDA 1

mpiexec -perhost Y -np X nsys profile -o application_%q\{MPT_MPI_RANK\} application ..

Note: The option -perhost can be replaced with ‑ppn. Both ‑perhost and ‑ppn must come before the ‑np option.

References

Contact Us

General User Assistance

Security

  • Report security issues 24x7x365
  • Toll-free: 1-877-NASA-SEC (1-877-627-2732)
  • E-mail: soc@nasa.gov

User Documentation

High-End Computing Capability (HECC) Portfolio Office

NASA High-End Computing Program

Tell Us About It

Our goal is furnish all the information you need to efficiently and effectively use the HECC resources needed for your NASA computational projects.

We welcome your input on features and topics that you would like to see included on this website.

Please send us email with your wish list and other feedback.