Skip to content

chenyu-jiang/nsys2json

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

6 Commits
 
 
 
 
 
 

Repository files navigation

nsys2json

nsys2json_screenshot

A Python script to convert the output of NVIDIA Nsight Systems (in SQLite format) to JSON in Google Chrome Trace Event Format for more customizable visualization and analysis. To view the resulting json file, goto chrome://tracing in Google Chrome or use Perfetto.

Inspired and adapted from nvprof2json.

The SQLite schema used by Nsight Systems is documented here.

Usage

If you have a '.qdrep' file, you can convert it first to SQLite format through Nsight Systems UI or CLI.

To extract kernel activities and NVTX annotated regions (e.g. torch.cuda.nvtx.range):

python3 nsys2json.py <nsys_sqlite_file> -o <output_json>

To filter out kernel activities or NVTX annotated regions, use:

-activity-type {kernel, nvtx-cpu, nvtx-kernel}
  • kernel: Raw CUDA kernel activities
  • nvtx-cpu: NVTX annotated regions on CPU threads
  • nvtx-kernel: NVTX annotated regions, but calculate the start and end time from CUDA kernel activities launched within the region

To filter NVTX regions based on name, use:

--nvtx-event-prefix <prefix>

To apply custom coloring scheme to NVTX regions, use:

--nvtx-color-scheme <dict_mapping_regex_to_chrome_colors>

e.g.,

--nvtx-color-scheme '{"comm": "thread_state_iowait", "Layer .* compute": "thread_state_running"}

For the list of available colors, see here.

Known Issues

  • This script assumes each process in the profile only executes kernel on one GPU. Process id is used to match NVTX regions to the corresponding device. Changes to process and thread naming scheme in the JSON file are needed if this assumption is violated.

About

A Python script to convert the output of NVIDIA Nsight Systems (in SQLite format) to JSON in Google Chrome Trace Event Format.

Resources

License

Stars

Watchers

Forks

Languages