# gpgpu-sim/gpgpu-sim_distribution architecture

> Architecture diagram of the GitHub repository gpgpu-sim/gpgpu-sim_distribution, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2025-06-19). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/gpgpu-sim/gpgpu-sim_distribution
- Repository: https://github.com/gpgpu-sim/gpgpu-sim_distribution

## Overview

##### Project type and purpose
- This is GPGPU-Sim, a cycle-level GPU simulator for CUDA/OpenCL workloads.
- It includes three major deliverables:
- The core simulator (PTX/SASS front-end, pipeline, interconnect, memory hierarchy)
- A power-model extension (AccelWattch)
- A performance-visualization tool (AerialVision)

##### File structure
Top-level directories:
- src/         → core simulation modules (gpgpu-sim, cuda-sim, accelwattch, intersim2)
- libcuda/, libopencl/ → runtime API wrappers for cuda and OpenCL calls
- cuobjdump_to_ptxplus/ → a standalone binary translator (SASS → PTX+)
- aerialvision/ → Python-based visualization front-end
- debug_tools/ → GUI and command-line debug harnesses (e.g., WatchYourStep)
- configs/     → static XML/Text files modeling GPU microarchitectures
- bin/         → top-level driver scripts (aerialvision.py, aerialvision startup)

Build & CI:
- CMakeLists.txt, Makefile, cmake/ → build orchestration
- .github/, .travis.yml, bitbucket-pipelines.yml → continuous integration

##### README for additional insights
- Simulator is invoked by setting CUDA_INSTALL_PATH and sourcing setup_environment.
- Supports PTX-level, SASS-trace-level, and hybrid simulation.
- AccelWattch is pluggable via XML config (power_simulation_enabled, mode, xml file).
- AerialVision reads simulator dump files via Python PLY; depends on numpy, matplotlib.
- Debug tools rely on Flex/Bison parsers for PTX/SASS.

## Diagram (Mermaid)

```mermaid
flowchart TD
    %% Host Environment & Build
    subgraph "Host Environment & Build"
        direction TB
        SetupEnv["setup_environment script"]:::host
        CMake["CMakeLists.txt"]:::host
        CMakeDir["cmake/"]:::host
        Makefile["Makefile"]:::host
    end

    %% Input Workloads & Translators
    subgraph "Input Workloads & Translators"
        direction TB
        Workload["CUDA/OpenCL Binary"]:::ext
        Translator["cuobjdump_to_ptxplus"]:::ext
        PTXParser["PTX Parser"]:::ext
    end

    %% Simulator Core
    subgraph "Simulator Core" 
        direction TB
        SimulatorBin["Simulator Binary"]:::core
        OptionParser["Option Parser"]:::core
        CUDASim["CUDA Functional Simulator"]:::core
        GPGPUSim["GPGPU-Sim Core & Memory"]:::core
        Interconnect["BookSim2 Interconnect"]:::core
    end

    %% Power Model
    subgraph "Power Model (AccelWattch)"
        direction TB
        AccelWattch["AccelWattch Modules"]:::power
        AWConfigs["XML Configs"]:::power
    end

    %% External API Wrappers
    subgraph "External API Wrappers"
        direction TB
        LibCUDA["libcuda/"]:::host
        LibOpenCL["libopencl/"]:::host
    end

    %% Output & Visualization
    subgraph "Output & Visualization"
        direction TB
        StatsLogs["Statistics & Power Logs"]:::core
        AerialVision["AerialVision GUI"]:::vis
        AVScript["bin/aerialvision.py"]:::vis
    end

    %% Debug & Analysis Tools
    subgraph "Debug & Analysis Tools"
        direction TB
        WatchYourStep["WatchYourStep Debugger"]:::vis
    end

    %% Documentation
    subgraph "Documentation"
        direction TB
        Doxygen["Doxygen Docs"]:::host
    end

    %% Configurations
    Configs["configs/"]:::host

    %% Connections
    SetupEnv --> SimulatorBin
    CMake --> SimulatorBin
    CMakeDir --> SimulatorBin
    Makefile --> SimulatorBin

    Workload --> Translator
    Translator --> PTXParser
    PTXParser --> OptionParser

    SimulatorBin --> OptionParser
    OptionParser --> CUDASim
    OptionParser --> GPGPUSim
    CUDASim --> Interconnect
    GPGPUSim --> Interconnect
    Interconnect --> GPGPUSim

    GPGPUSim --> StatsLogs
    StatsLogs --> AerialVision
    AVScript --> AerialVision

    CUDASim --> AccelWattch
    GPGPUSim --> AccelWattch
    AccelWattch --> StatsLogs
    AWConfigs --> AccelWattch

    SimulatorBin --> LibCUDA
    SimulatorBin --> LibOpenCL

    Configs --> OptionParser
    Configs --> CUDASim
    Configs --> GPGPUSim
    Configs --> AccelWattch

    WatchYourStep --> SimulatorBin

    Doxygen --> SimulatorBin

    %% Click Events
    click SetupEnv "https://github.com/gpgpu-sim/gpgpu-sim_distribution/tree/dev/setup_environment"
    click CMake "https://github.com/gpgpu-sim/gpgpu-sim_distribution/blob/dev/CMakeLists.txt"
    click CMakeDir "https://github.com/gpgpu-sim/gpgpu-sim_distribution/tree/dev/cmake/"
    click Makefile "https://github.com/gpgpu-sim/gpgpu-sim_distribution/tree/dev/Makefile"
    click Translator "https://github.com/gpgpu-sim/gpgpu-sim_distribution/blob/dev/cuobjdump_to_ptxplus/cuobjdump_to_ptxplus.cc"
    click PTXParser "https://github.com/gpgpu-sim/gpgpu-sim_distribution/blob/dev/src/cuda-sim/ptx_parser.cc"
    click PTXParser "https://github.com/gpgpu-sim/gpgpu-sim_distribution/blob/dev/src/cuda-sim/ptx_parser.h"
    click PTXParser "https://github.com/gpgpu-sim/gpgpu-sim_distribution/blob/dev/src/cuda-sim/ptx.l"
    click PTXParser "https://github.com/gpgpu-sim/gpgpu-sim_distribution/blob/dev/src/cuda-sim/ptx.y"
    click OptionParser "https://github.com/gpgpu-sim/gpgpu-sim_distribution/blob/dev/src/option_parser.cc"
    click OptionParser "https://github.com/gpgpu-sim/gpgpu-sim_distribution/blob/dev/src/option_parser.h"
    click CUDASim "https://github.com/gpgpu-sim/gpgpu-sim_distribution/tree/dev/src/cuda-sim/"
    click GPGPUSim "https://github.com/gpgpu-sim/gpgpu-sim_distribution/tree/dev/src/gpgpu-sim/"
    click Interconnect "https://github.com/gpgpu-sim/gpgpu-sim_distribution/tree/dev/src/intersim2/"
    click AccelWattch "https://github.com/gpgpu-sim/gpgpu-sim_distribution/tree/dev/src/accelwattch/"
    click AWConfigs "https://github.com/gpgpu-sim/gpgpu-sim_distribution/tree/dev/src/accelwattch/"
    click LibCUDA "https://github.com/gpgpu-sim/gpgpu-sim_distribution/tree/dev/libcuda/"
    click LibOpenCL "https://github.com/gpgpu-sim/gpgpu-sim_distribution/tree/dev/libopencl/"
    click Configs "https://github.com/gpgpu-sim/gpgpu-sim_distribution/tree/dev/configs/"
    click AerialVision "https://github.com/gpgpu-sim/gpgpu-sim_distribution/tree/dev/aerialvision/"
    click AVScript "https://github.com/gpgpu-sim/gpgpu-sim_distribution/blob/dev/bin/aerialvision.py"
    click WatchYourStep "https://github.com/gpgpu-sim/gpgpu-sim_distribution/tree/dev/debug_tools/WatchYourStep/"
    click Doxygen "https://github.com/gpgpu-sim/gpgpu-sim_distribution/tree/dev/doc/doxygen/"

    %% Styles
    classDef host fill:#DDDDDD,stroke:#333,stroke-width:1px
    classDef core fill:#BBDEFB,stroke:#333,stroke-width:1px
    classDef power fill:#C8E6C9,stroke:#333,stroke-width:1px
    classDef vis fill:#FFE0B2,stroke:#333,stroke-width:1px
    classDef ext fill:#F5F5F5,stroke:#333,stroke-width:1px
```
