Skip to main content

Terminal UI for NVIDIA Nsight Systems profiles โ€” timeline viewer, kernel navigator, NVTX hierarchy

Project description

๐Ÿ”ฌ nsys-ai

Terminal UI for NVIDIA Nsight Systems profiles

Navigate GPU kernel timelines, explore NVTX hierarchies, and analyze performance โ€” all from your terminal.

CI PyPI Python 3.10+ License: MIT


โšก Install

pip install nsys-ai

That's it. No system dependencies, no CUDA required. Just Python 3.10+.


๐ŸŽฏ What It Does

nsys-ai reads .sqlite profile exports from NVIDIA Nsight Systems and gives you three ways to explore them:

๐Ÿ–ฅ๏ธ Timeline TUI

Perfetto-style horizontal timeline in your terminal

๐ŸŒฒ Tree TUI

Interactive NVTX hierarchy browser with kernel details

๐ŸŒ HTML Viewer

Exportable interactive visualizations for sharing

S21 โ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–ˆโ–ˆโ–ˆ
S56 โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆ
S60 โ–‘โ–‘โ–‘โ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–ˆโ–‘โ–‘โ–‘โ–‘โ–‘โ–ˆโ–ˆ
    |         โ”‚
    39.1s   39.5s
โ–ผ Iteration (324ms)
  โ–ผ forward (180ms)
    โ–ผ Attention (89ms)
      โ–  flash_fwd  26ms
      โ–  flash_bwd  63ms

Interactive HTML exports:
โ€ข NVTX stack viewer
โ€ข SQLite schema explorer
โ€ข Perfetto JSON traces


๐Ÿš€ Quick Start

1. Get a profile

# Profile your PyTorch training
nsys profile -o my_training python train.py
# โ†’ produces my_training.sqlite

2. Explore it

# Quick overview
nsys-ai info my_training.sqlite

# Interactive timeline (the main attraction)
nsys-ai timeline my_training.sqlite --gpu 0 --trim 39 42

# Interactive tree browser
nsys-ai tui my_training.sqlite --gpu 0 --trim 39 42

# GPU kernel summary
nsys-ai summary my_training.sqlite --gpu 0

3. Export & share

# Perfetto JSON (open in ui.perfetto.dev)
nsys-ai export my_training.sqlite -o traces/

# Interactive HTML viewer
nsys-ai viewer my_training.sqlite --gpu 0 --trim 39 42 -o report.html

# Flat CSV/JSON for scripting
nsys-ai export-csv my_training.sqlite --gpu 0 --trim 39 42 -o kernels.csv

โŒจ๏ธ Timeline TUI

The timeline is a Perfetto-style horizontal viewer with per-stream kernel visualization, NVTX hierarchy bars, and a time-cursor navigation model.

Navigation

Key Action
โ† โ†’ Pan through time
Shift+โ†/โ†’ Page pan (1/4 viewport)
โ†‘ โ†“ Select stream
Tab Snap to next kernel
+ - Zoom in / out
a Toggle absolute โ†” relative time

Analysis

Key Action
/ Filter kernels by name
m Set minimum duration threshold
d Toggle demangled kernel names
C Open config panel
h Full help overlay

Bookmarks

Key Action
B Save bookmark (with kernel + NVTX context)
' Bookmark list โ€” press 1-9 to jump
, . Cycle through bookmarks
` Jump back to previous position
[ ] Set range start / end

Config Panel (C)

Tweak settings live with โ†‘/โ†“ to select and โ†/โ†’ to adjust:

  • Selected stream rows (1-6)
  • Other stream rows (1-4)
  • Time tick density (2-20)
  • NVTX depth levels (0-8)
  • Min kernel duration filter

๐Ÿ“š Documentation

The docs/ directory includes comprehensive guides for Nsight Systems profiling:

Guide Topic
CLI Reference Full nsys command reference
SQLite Schema Database tables & relationships
NVTX Annotations Adding markers to your code
CUDA Trace GPU kernel tracing
NCCL Tracing Multi-GPU collective analysis
Python/PyTorch Profiling PyTorch workloads
Containers Profiling inside Docker/Slurm
Focused Profiling Targeted profiling strategies

๐Ÿ” Interactive SQLite Schema Explorer

The docs/sqlite-explorer/ contains an interactive HTML tool for exploring the Nsight SQLite schema โ€” tables, foreign keys, example queries, and key concepts. Open docs/sqlite-explorer/index.html in a browser:

  • Browse all Nsight SQLite tables with column types
  • See foreign key relationships visualized
  • Copy-paste ready SQL query examples
  • Cross-highlighted concept explanations

๐Ÿ› ๏ธ All Commands

Command Description
info Profile metadata & GPU hardware
summary Top kernels, stream breakdown, auto-commentary
overlap Compute / NCCL overlap analysis
nccl NCCL collective breakdown by type
iters Auto-detect training iterations
tree NVTX hierarchy as text
tui Interactive tree TUI
timeline Interactive timeline TUI
search Search kernels / NVTX by name
export Perfetto JSON traces
export-csv Flat CSV for spreadsheets
export-json Flat JSON for scripting
viewer Interactive HTML report
markdown NVTX hierarchy as markdown

๐Ÿค– AI Analysis (Optional)

nsys-ai includes an optional AI module that can analyze your profiles:

pip install nsys-ai[ai]
  • Auto-commentary on kernel distributions and performance patterns
  • NVTX annotation suggestions for un-annotated code regions
  • Performance bottleneck detection with actionable recommendations

๐Ÿง‘โ€๐Ÿ’ป Development

git clone https://github.com/GindaChen/nsys-ai.git
cd nsys-ai
pip install -e '.[dev]'
pytest tests/ -v

๐Ÿ“„ License

MIT โ€” see LICENSE.

Built for GPU performance engineers who live in the terminal.

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

nsys_ai-0.2.1.tar.gz (68.1 kB view details)

Uploaded Source

Built Distribution

If you're not sure about the file name format, learn more about wheel file names.

nsys_ai-0.2.1-py3-none-any.whl (75.2 kB view details)

Uploaded Python 3

File details

Details for the file nsys_ai-0.2.1.tar.gz.

File metadata

  • Download URL: nsys_ai-0.2.1.tar.gz
  • Upload date:
  • Size: 68.1 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for nsys_ai-0.2.1.tar.gz
Algorithm Hash digest
SHA256 b9bf39cd5bb41c4216428765f618dedd1ee0ba57c0fe8566ff4fd11da104e867
MD5 0a0837d7963894644706d30758e15faa
BLAKE2b-256 a1bf19ee90349898c46773e3e1e05a1f73b92c94e54b75b7324ca50555adc1ca

See more details on using hashes here.

File details

Details for the file nsys_ai-0.2.1-py3-none-any.whl.

File metadata

  • Download URL: nsys_ai-0.2.1-py3-none-any.whl
  • Upload date:
  • Size: 75.2 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/6.2.0 CPython/3.12.10

File hashes

Hashes for nsys_ai-0.2.1-py3-none-any.whl
Algorithm Hash digest
SHA256 a3bda9d446c189a0a27430560ba4f6293f60ad4d2a83637877849334cb23f4df
MD5 9366cd67b9d1d5753d4596fb7da3d5d6
BLAKE2b-256 61edef7e093b03fba7b141a51197cc738de8db068b476bd3cf99ed6cb11511aa

See more details on using hashes here.

Supported by

AWS Cloud computing and Security Sponsor Datadog Monitoring Depot Continuous Integration Fastly CDN Google Download Analytics Pingdom Monitoring Sentry Error logging StatusPage Status page