NVIDIA Nsight Python Enables GPU Kernel Profiling Directly Through Function Decorators
NVIDIA has streamlined GPU profiling by introducing Python decorator support into the Nsight tooling ecosystem. Developers can now isolate, measure, and inspect kernel performance directly inside their standard PyTorch workflows without running detached profiler binaries. This eliminates friction when diagnosing tensor bottlenecks.

Why it matters
Profile GPU bottlenecks directly inside your local Python scripts by adding a decorator to your execution loop.
TL;DR
- 01Decorate Python functions to capture kernel-level GPU metrics without separate profiler orchestration.
- 02Identify memory bottlenecks and compute bound layers directly during local model development.
- 03Integrate profiling hooks cleanly into PyTorch training and evaluation loops.
Programmatic GPU Profiling in Python Workflows
NVIDIA's Nsight Python integration introduces decorator-based profiling to streamline GPU kernel analysis. Rather than orchestrating external system profilers across distributed runs, developers can tag specific computational functions to capture kernel execution timing and hardware utilization directly within their existing machine learning development environment.
Try it in 2 minutes
# Profile GPU operations with Nsight Python hooks
import torch
# Wrap target kernel execution
def benchmark_step(x, w):
return torch.matmul(x, w)python
✓ When to use
- When diagnosing memory transfer stalls and execution latency in custom PyTorch layers.
- When optimizing local CUDA kernel configurations during iterative model development.
✕ When NOT to use
- When benchmarking production services where instrumentation overhead might skew latency metrics.
- When working entirely with CPU-only machine learning workloads.
What to do today
- Audit existing GPU functions to identify operations with unexplained inference latency.
- Apply profiling decorators around critical tensor transforms before deploying models.