How to Use Nsight Systems: Read CPU Calls and GPU Work on a Timeline
NVIDIA Nsight Systems is a system profiler that places CUDA calls from CPU threads, memory transfers, synchronization, and GPU work on one timeline. It helps answer “what ran when, and why was the next stage waiting?” It is not designed to explain every low-level inefficiency inside a kernel; first use it to find an important kernel or gap, then move to Nsight Compute when kernel-level metrics are needed.
How to Use Nsight Systems: Read CPU Calls and GPU Work on a Timeline
NVIDIA Nsight Systems is a system profiler that places CUDA calls from CPU threads, memory transfers, synchronization, and GPU work on one timeline. It helps answer “what ran when, and why was the next stage waiting?” It is not designed to explain every low-level inefficiency inside a kernel; first use it to find an important kernel or gap, then move to Nsight Compute when kernel-level metrics are needed.
What Nsight Systems can and cannot answer
A performance problem does not have to originate inside the GPU. CPU input preparation may be late, a thread may synchronize while submitting CUDA work, or transfers may fail to overlap with computation. In each case the GPU can wait for work. Conversely, a busy GPU timeline does not guarantee a fast application: it may be doing unnecessary work, or the captured region may not match the latency users experience.
Nsight Systems is suited to examining the order, overlap, and gaps between CPU API calls and GPU execution. CUDA API rows show Runtime and Driver calls made by host code. Rows below the GPU show device kernels and memory operations within CUDA contexts and streams. API-call duration and GPU-work duration are different intervals and can overlap. A timeline correlation suggests a cause to investigate; before calling a wait a bottleneck, check the code path and confirm that the pattern repeats in a representative run. Nsight Systems User Guide: CUDA Trace
Connect CPU and GPU rows in the report
Open the report and expand the application's CPU threads and CUDA API rows, then expand the GPU, CUDA contexts, and streams. Compare when a kernel or copy was submitted on the CUDA API row with when the device work starts and ends on a GPU stream. Event colors are visual aids; color alone does not identify a bottleneck or tell you whether an operation succeeded. Zoom out to see the full sequence, then zoom in on individual events.
| Timeline pattern | First question to ask | Next investigation |
|---|---|---|
| A recurring gap appears between a CPU CUDA call and the next GPU operation. | Is the CPU preparing input or submitting work, or is a thread waiting or synchronizing? | Inspect that thread's call sequence and NVTX range; add OS runtime or scheduling traces if needed. |
| Copies and kernels alternate without overlapping. | Is a dependency requiring the copy to finish, or do the buffer and stream setup permit overlap? | Inspect copy and synchronization APIs, dependencies between streams, and when the data is actually ready. |
| Very short kernels start frequently. | Are these useful iterations, or are host submission and small work units adding cost? | Compare call frequency with end-to-end time. Test a launch or batching hypothesis before deep kernel analysis. |
| One kernel has a long device execution interval. | Is that kernel on the critical path for user-visible latency? | Select an important launch and inspect its kernel-level metrics with Nsight Compute. |
| GPU rows are busy but the application is slow. | Does the captured region represent the real delay, or is the GPU doing unnecessary work? | Re-measure end-to-end latency or throughput with the same input and completion boundary, and check output correctness. |
Do not treat a sum of row durations as total runtime. Work can overlap across CPU threads, so their accumulated time can exceed wall-clock time. Asynchronous GPU work can continue after a host API returns. GPU utilization or one row's active time alone does not establish the cause; consider execution boundaries and dependencies together. Nsight Systems Post-Collection Analysis Guide
Set the installation and capture scope
Nsight Systems supports several combinations, including x86-64 systems with NVIDIA GPUs and Arm server or embedded targets, but features vary by operating system, host and target, GPU, driver, and tool release. You can collect on a remote target and analyze the report on another host. Before installation, check the current platform and compatibility guidance in the Nsight Systems Installation Guide. Check the installed CLI version with nsys -v and supported options with nsys profile --help. Basic collection does not require application-code changes; annotations such as NVTX help when you need to name and focus on specific phases. The following is a short Linux CUDA capture example.
nsys profile --trace=cuda,nvtx -d 20 \
--sample=none --cpuctxsw=none -o nsys-demo ./app --batch-size 32Replace ./app --batch-size 32 with the real executable and arguments. This collects CUDA and NVTX traces for up to 20 seconds and disables CPU sampling and thread-scheduling collection. Collection also ends if the application exits first. It is a lean starting point for connecting CUDA calls to device activity, but it does not show how the operating system scheduled CPU threads. For that question, enable the required CPU sampling, scheduling, or OS runtime collection according to the installed release, and account for permissions and added overhead. A short capture of performance-critical code produces less data than profiling an unnecessarily long run that includes initialization and validation. Nsight Systems User Guide: Focused Profiling
Name application phases with NVTX ranges
Low-level entries such as cudaLaunch or a stream number may not tell you whether a call belongs to preprocessing, model execution, or postprocessing. NVTX is NVIDIA's Tools Extension Library for adding readable markers and ranges to code. A marker identifies a point in time; a range spans a start and an end. Nsight Systems displays these annotations on CPU-thread timelines and can project GPU activity launched within a range onto the GPU timeline. NVTX documentation
For example, adding decode, upload, inference, and download ranges to an image-processing program makes it easier to see which phase contains a transfer or kernel. When adding C++ NVTX ranges, manage their lifetime so they close on both normal and error paths. Avoid constructing a new string on every iteration or annotating every tiny inner function. An annotation does not prove performance causation. Tool interception can also change the overhead of the first NVTX call and of collection, so verify final performance with annotations and profiler turned off.
Form a hypothesis from a gap and verify it in a representative run
Example (hypothetical): An image-inference timeline shows an empty GPU interval after an upload copy, and the kernel runs only after the next inference range begins. This does not prove that the GPU is slow. Possible causes to investigate include late CPU preparation of the next batch, a synchronization waiting for the copy, or an NVTX range that does not match the intended phase boundary. Collect the runtime-call or scheduling evidence needed to narrow the possibilities, then compare before and after a code change using the same input. This scenario is illustrative, not measured data.
**Measure a baseline without the profiler.** Use realistic input, fixed warm-up and repetition counts, and record end-to-end latency or throughput plus output correctness.
**Capture a short trace.** Use the CLI example above or enable CUDA tracing in the GUI. If test initialization or result checking obscures the region of interest, use NVTX or the CUDA profiler API to limit collection.
**Expand the relevant rows.** Compare CPU threads, CUDA APIs, and GPU context/stream timelines at the same scale. Look for the starts and ends of copies, synchronization, kernels, and gaps between repetitions.
**Collect evidence for one cause at a time.** If the hypothesis concerns CPU execution or scheduling, add those traces. If a long kernel is on the critical path, hand that launch to Nsight Compute. Enabling every trace at once can increase overhead and report size.
**Verify the change in a normal run.** Recheck latency or throughput and correctness with the same input and start/end boundaries. If a change looks better only in the capture, but not in an unprofiled run, do not count it as a performance improvement.
Troubleshoot missing or distorted captures
If CUDA rows are missing, check that the application was launched with nsys profile, that --trace=cuda and the target GPU/driver are supported, and whether the diagnostics summary reports hardware tracing or a fallback to software tracing. Nsight Systems uses CUPTI in single-subscriber mode by default. If a framework or another profiler also uses CUPTI, check whether the current guide's multi-subscriber requirements are met, or disable the conflicting profiler integration and collect again. If the application exits abnormally before trace buffers are copied, some events may be absent from the report. Nsight Systems User Guide: CUDA Trace
If the report is too large or the application slows noticeably, shorten the capture, disable features that do not answer the current question, and focus collection with NVTX. If you disabled CPU scheduling or OS-call data that the question requires, do not infer that cause from the timeline alone; enable the necessary rows in the next capture. After a change, return to a normal run without the profiler and check the output and full application time. Nsight Systems observes execution relationships; it does not make an application faster automatically. For detailed kernel metrics, continue with the Nsight Compute User Guide.
References
[NVIDIA Nsight Systems User Guide](https://docs.nvidia.com/nsight-systems/UserGuide/index.html)
[NVIDIA Nsight Systems Installation Guide](https://docs.nvidia.com/nsight-systems/InstallationGuide/)
[NVIDIA Nsight Systems Post-Collection Analysis Guide](https://docs.nvidia.com/nsight-systems/AnalysisGuide/)
[NVIDIA Tools Extension Library (NVTX)](https://nvidia.github.io/NVTX/)
[NVIDIA Nsight Compute User Guide](https://docs.nvidia.com/nsight-compute/NsightCompute/)