# dream-lab/pagoda architecture

> Architecture diagram of the GitHub repository dream-lab/pagoda, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/dream-lab/pagoda
- Repository: https://github.com/dream-lab/pagoda

## Overview

Pagoda studies DNN inference and training performance on Jetson-class accelerators. Its main workflow prepares ONNX models, estimates FLOPs and memory traffic analytically, profiles workloads with Nsight Compute, then processes and visualizes measurements for roofline and batch-size analysis. The graph also preserves the documented ERT analysis capability. Source excerpts support the analytical estimators and CSV processing; connections involving notebooks and automation are based on README descriptions, since those files were not sampled.

Main entry points: [`src/analytical_model/model.py`](https://github.com/dream-lab/pagoda/blob/main/src/analytical_model/model.py) (Estimate runner), [`src/scripts/inference_automation.sh`](https://github.com/dream-lab/pagoda/blob/main/src/scripts/inference_automation.sh) (NCU automation), [`src/tools/ncu_post_processing.py`](https://github.com/dream-lab/pagoda/blob/main/src/tools/ncu_post_processing.py) (NCU metric processor), [`src/analysis/create_onnx_models.ipynb`](https://github.com/dream-lab/pagoda/blob/main/src/analysis/create_onnx_models.ipynb) (ONNX export)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_model_prep["Model preparation"]
  node_onnx_export["ONNX export"]
  node_onnx_model["ONNX model"]
end

subgraph group_analytical["Analytical estimation"]
  node_estimate_cli["Estimate runner<br/>[model.py]"]
  node_general_estimator["ONNX estimator<br/>[estimates.py]"]
  node_lstm_estimator["LSTM estimator<br/>[estimates_lstm.py]"]
end

subgraph group_profiling["GPU profiling"]
  node_ncu_automation["NCU automation"]
  node_experiment_script["Experiment helper<br/>[exp_script.sh]"]
  node_ncu_csv["NCU reports"]
end

subgraph group_post_analysis["Measurement analysis"]
  node_ncu_processor["NCU metric processor"]
  node_ert_processor["ERT processor<br/>[ert_method.py]"]
  node_ncu_analysis["Kernel analysis"]
  node_roofline_analysis["Roofline experiments"]
  node_roofline_results["Roofline insights"]
end

node_user(("Engineer"))
node_jetson{{"Jetson accelerator"}}
node_ncu{{"Nsight Compute"}}

node_user -->|"exports models"| node_onnx_export
node_onnx_export -->|"creates"| node_onnx_model
node_user -->|"requests estimates"| node_estimate_cli
node_estimate_cli -->|"loads"| node_onnx_model
node_estimate_cli -->|"delegates"| node_general_estimator
node_estimate_cli -->|"selects for LSTM"| node_lstm_estimator
node_general_estimator -->|"loads and analyzes"| node_onnx_model
node_lstm_estimator -->|"loads and analyzes"| node_onnx_model
node_user -->|"runs profiling"| node_ncu_automation
node_ncu_automation -->|"profiles workloads"| node_jetson
node_ncu_automation -->|"invokes profiler"| node_ncu
node_ncu -->|"produces reports"| node_ncu_csv
node_experiment_script -.->|"assists experiments"| node_ncu_automation
node_user -->|"processes reports"| node_ncu_processor
node_ncu_processor -->|"reads CSV"| node_ncu_csv
node_user -->|"runs ERT analysis"| node_ert_processor
node_user -->|"analyzes measurements"| node_ncu_analysis
node_user -->|"explores rooflines"| node_roofline_analysis
node_ncu_analysis -->|"analyzes reports"| node_ncu_csv
node_roofline_analysis -->|"generates plots"| node_roofline_results
node_ncu_processor -.->|"computes metrics"| node_roofline_results
node_ert_processor -.->|"summarizes metrics"| node_roofline_results

click node_onnx_export "https://github.com/dream-lab/pagoda/blob/main/src/analysis/create_onnx_models.ipynb"
click node_estimate_cli "https://github.com/dream-lab/pagoda/blob/main/src/analytical_model/model.py"
click node_general_estimator "https://github.com/dream-lab/pagoda/blob/main/src/analytical_model/estimates.py"
click node_lstm_estimator "https://github.com/dream-lab/pagoda/blob/main/src/analytical_model/estimates_lstm.py"
click node_ncu_automation "https://github.com/dream-lab/pagoda/blob/main/src/scripts/inference_automation.sh"
click node_experiment_script "https://github.com/dream-lab/pagoda/blob/main/src/scripts/exp_script.sh"
click node_ncu_processor "https://github.com/dream-lab/pagoda/blob/main/src/tools/ncu_post_processing.py"
click node_ert_processor "https://github.com/dream-lab/pagoda/blob/main/src/tools/ert_method.py"
click node_ncu_analysis "https://github.com/dream-lab/pagoda/blob/main/src/analysis/ncu-files-analysis.ipynb"
click node_roofline_analysis "https://github.com/dream-lab/pagoda/blob/main/src/analysis/roofline_batch_size_expt.ipynb"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_onnx_export,node_onnx_model toneBlue
class node_estimate_cli,node_general_estimator,node_lstm_estimator toneAmber
class node_ncu_automation,node_experiment_script,node_ncu_csv toneMint
class node_ncu_processor,node_ert_processor,node_ncu_analysis,node_roofline_analysis,node_roofline_results toneRose
class node_user,node_jetson,node_ncu toneIndigo
```

## Components

### Model preparation

- [ONNX export](https://github.com/dream-lab/pagoda/blob/main/src/analysis/create_onnx_models.ipynb): `src/analysis/create_onnx_models.ipynb`
- **ONNX model**

### Analytical estimation

- [Estimate runner](https://github.com/dream-lab/pagoda/blob/main/src/analytical_model/model.py): `src/analytical_model/model.py`
- [ONNX estimator](https://github.com/dream-lab/pagoda/blob/main/src/analytical_model/estimates.py): `src/analytical_model/estimates.py`
- [LSTM estimator](https://github.com/dream-lab/pagoda/blob/main/src/analytical_model/estimates_lstm.py): `src/analytical_model/estimates_lstm.py`

### GPU profiling

- [NCU automation](https://github.com/dream-lab/pagoda/blob/main/src/scripts/inference_automation.sh): `src/scripts/inference_automation.sh`
- [Experiment helper](https://github.com/dream-lab/pagoda/blob/main/src/scripts/exp_script.sh): `src/scripts/exp_script.sh`
- **NCU reports**

### Measurement analysis

- [NCU metric processor](https://github.com/dream-lab/pagoda/blob/main/src/tools/ncu_post_processing.py): `src/tools/ncu_post_processing.py`
- [ERT processor](https://github.com/dream-lab/pagoda/blob/main/src/tools/ert_method.py): `src/tools/ert_method.py`
- [Kernel analysis](https://github.com/dream-lab/pagoda/blob/main/src/analysis/ncu-files-analysis.ipynb): `src/analysis/ncu-files-analysis.ipynb`
- [Roofline experiments](https://github.com/dream-lab/pagoda/blob/main/src/analysis/roofline_batch_size_expt.ipynb): `src/analysis/roofline_batch_size_expt.ipynb`
- **Roofline insights**

### Other components

- **Engineer**
- **Jetson accelerator**
- **Nsight Compute**

## Connections

- Engineer → ONNX export: exports models (evidence: `README.md`)
- ONNX export → ONNX model: creates (evidence: `README.md`)
- Engineer → Estimate runner: requests estimates (evidence: `README.md`)
- Estimate runner → ONNX model: loads (evidence: `src/analytical_model/model.py`)
- Estimate runner → ONNX estimator: delegates (evidence: `src/analytical_model/model.py`)
- Estimate runner → LSTM estimator: selects for LSTM (evidence: `src/analytical_model/model.py`)
- ONNX estimator → ONNX model: loads and analyzes (evidence: `src/analytical_model/estimates.py`)
- LSTM estimator → ONNX model: loads and analyzes (evidence: `src/analytical_model/estimates_lstm.py`)
- Engineer → NCU automation: runs profiling (evidence: `README.md`)
- NCU automation → Jetson accelerator: profiles workloads (evidence: `README.md`)
- NCU automation → Nsight Compute: invokes profiler (evidence: `README.md`)
- Nsight Compute → NCU reports: produces reports (evidence: `README.md`)
- Experiment helper → NCU automation: assists experiments
- Engineer → NCU metric processor: processes reports (evidence: `README.md`)
- NCU metric processor → NCU reports: reads CSV (evidence: `src/tools/ncu_post_processing.py`)
- Engineer → ERT processor: runs ERT analysis (evidence: `README.md`)
- Engineer → Kernel analysis: analyzes measurements (evidence: `README.md`)
- Engineer → Roofline experiments: explores rooflines (evidence: `README.md`)
- Kernel analysis → NCU reports: analyzes reports (evidence: `README.md`)
- Roofline experiments → Roofline insights: generates plots (evidence: `README.md`)
- NCU metric processor → Roofline insights: computes metrics
- ERT processor → Roofline insights: summarizes metrics
