|
| 1 | +# NSYS Analyzer & Visualizer (NAV) |
| 2 | + |
| 3 | +## Introduction |
| 4 | +High-performance computing (HPC) and AI workloads increasingly rely on **GPUs** for acceleration, yet **understanding performance impacts** of code changes remains challenging. **NVIDIA Nsight™ Systems (NSYS)** provides profiling tools, but lacks **efficient comparative analysis and detailed visualization** capabilities. |
| 5 | + |
| 6 | +**NAV (NSYS Analyzer and Visualizer)** enhances NSYS by offering **fast, automated, and insightful trace analysis**, helping developers and researchers quickly identify **performance regressions, bottlenecks, and optimizations** in GPU workloads. |
| 7 | + |
| 8 | +## Key Features |
| 9 | +✔ **Faster Extraction & Visualization** – Extracts trace data significantly faster (compared to NSYS recipes), **23.33× speedup** for 1.2G traces, **9.75× speedup** for 12G traces |
| 10 | +✔ **Comparative Analysis** – Enables **direct side-by-side performance comparisons** of multiple traces |
| 11 | +✔ **Advanced Data Representations** – Generates **histograms, violin plots, and multi-trace visualizations** |
| 12 | +✔ **Multi-Level Granularity** – Supports **Micro, Meso, and Macro-level** insights for deeper analysis |
| 13 | +✔ **Efficient Handling of Large Traces** – Uses **parallel processing** to manage high-frequency GPU traces |
| 14 | +✔ **Multiple Export Formats** – Save results in **CSV, LaTeX, and PNG** for easy reporting and integration |
| 15 | +✔ **Open-Source & Extensible** – Modify and extend NAV to **add new metrics, visualizations, and analyses** |
| 16 | + |
| 17 | +## Why Use NAV? |
| 18 | +🔹 **Automates** performance trace analysis, reducing manual effort |
| 19 | +🔹 **Uncovers hidden performance trends** that NSYS recipes may miss |
| 20 | +🔹 **Improves regression testing** by providing **intuitive, side-by-side comparisons** |
| 21 | +🔹 **Optimized for HPC, AI/ML, and GPU-intensive applications** |
| 22 | + |
| 23 | +--- |
| 24 | + |
| 25 | +## Requirements |
| 26 | + |
| 27 | +### Required Trace Flags |
| 28 | +Run NSYS with the necessary flags for full trace capture: |
| 29 | +```bash |
| 30 | +nsys profile --trace=cuda,mpi,ucx,nvtx |
| 31 | +``` |
| 32 | + |
| 33 | +### Extracting SQLite File from NSYS Report |
| 34 | +Convert an `.nsys-rep` file to an `.sqlite` database for NAV: |
| 35 | +```bash |
| 36 | +nsys export --type sqlite <nsys.rep file> |
| 37 | +``` |
| 38 | +Alternatively, opening the `.nsys-rep` file in the Nsight GUI may automatically generate an `.sqlite` file. |
| 39 | + |
| 40 | +### Required Python Libraries |
| 41 | +Ensure your environment has all dependencies installed: |
| 42 | +```bash |
| 43 | +pip install absl_py contourpy cycler fonttools joblib kiwisolver \ |
| 44 | +matplotlib numpy packaging pillow pyparsing python_dateutil \ |
| 45 | +scikit_learn scipy six sklearn threadpoolctl |
| 46 | +``` |
| 47 | + |
| 48 | +### **Pre-Compile Scripts for Faster Execution** |
| 49 | +Before running NAV, you can **precompile** the Python scripts to speed up future executions: |
| 50 | +```bash |
| 51 | +python -m compileall . |
| 52 | +``` |
| 53 | +--- |
| 54 | + |
| 55 | +## Script Usage |
| 56 | + |
| 57 | +### Generating NAV JSON Files from SQLite |
| 58 | +Extract data and generate tables/figures from an `.sqlite` trace file: |
| 59 | +```bash |
| 60 | +python3 main.py -df file.sqlite |
| 61 | +``` |
| 62 | +Extract data **without** generating tables/figures (useful for batch processing): |
| 63 | +```bash |
| 64 | +python3 main.py -df file.sqlite -nmo |
| 65 | +``` |
| 66 | +Extract data from multiple `.sqlite` files sequentially (**not recommended due to slow performance**): |
| 67 | +```bash |
| 68 | +python3 main.py -df "file1.sqlite file2.sqlite file3.sqlite" -mdl "Label1,Label2,Label3" |
| 69 | +``` |
| 70 | + |
| 71 | +### Recommended: Parallel Extraction for Multiple SQLite Files |
| 72 | +Run extractions separately to speed up processing: |
| 73 | +```bash |
| 74 | +# Execute on separate nodes or jobs in parallel |
| 75 | +python3 main.py -df "file1.sqlite" -nmo & |
| 76 | +python3 main.py -df "file2.sqlite" -nmo & |
| 77 | +python3 main.py -df "file3.sqlite" -nmo & |
| 78 | +``` |
| 79 | + |
| 80 | +### Generating Tables and Figures from NAV Files |
| 81 | +Process a single NAV file: |
| 82 | +```bash |
| 83 | +python3 main.py -jf file.nav |
| 84 | +``` |
| 85 | +Process multiple NAV files with comparative analysis: |
| 86 | +```bash |
| 87 | +python3 main.py -jf "file1.nav file2.nav file3.nav" -mdl "Label1,Label2,Label3" |
| 88 | +``` |
| 89 | + |
| 90 | +--- |
| 91 | + |
| 92 | +## Flags Overview |
| 93 | + |
| 94 | +### General Flags |
| 95 | +- `-o, --output_dir` → Output directory for NAV files, tables, and figures *(default: ./output)* |
| 96 | +- `-mdl, --multi_data_label` → *(Required for multi-file analysis)* Labels for each trace *(e.g., "1 GPU, 2 GPU, 3 GPU")* |
| 97 | +- `-mw, --max_workers` → Number of threads to use *(Defaults to CPU count if unset)* |
| 98 | + |
| 99 | +### Extraction Flags |
| 100 | +- `-df, --data_file` → Specify an `.sqlite` trace file for extraction |
| 101 | +- `-nf, --nav_file` → Use an existing NAV `.nav` file instead of extracting from `.sqlite` |
| 102 | +- `-nkm, --no_kernel_metrics` → Skip exporting kernel metrics |
| 103 | +- `-ntm, --no_transfer_metrics` → Skip exporting transfer metrics |
| 104 | +- `-ncm, --no_communication_metrics` → Skip exporting communication metrics |
| 105 | +- `-nsd, --no_save_data` → Prevent saving extracted data to a NAV file |
| 106 | + |
| 107 | +### Graphics & Table Flags |
| 108 | +- `-nmo, --no_metrics_output` → Disable metrics export after extraction |
| 109 | +- `-ncmo, --no_compare_metrics_output` → Disable comparison metric exports (for multi-file analysis) |
| 110 | +- `-ngmo, --no_general_metrics_output` → Disable general metric exports (Kernel, Transfer, Communication) |
| 111 | +- `-nsmo, --no_specific_metrics_output` → Disable specific metric exports (Duration, Size, Slack, Overhead, etc.) |
| 112 | +- `-nimo, --no_individual_metrics_output` → Disable exporting individual metric details |
| 113 | + |
| 114 | +--- |
0 commit comments