# mintii13/a_new_construction_method_for_bptree_with_gpgpu architecture

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

- Interactive diagram: https://gitdiagram.com/mintii13/a_new_construction_method_for_bptree_with_gpgpu
- Repository: https://github.com/mintii13/a_new_construction_method_for_bptree_with_gpgpu

## Overview

##### Project Type and Purpose
- This is a GPU-accelerated B⁺-tree construction toolkit/research prototype.
- It includes four construction methods: two CPU (top-down, bottom-up), one previous GPU, and one novel fully parallel GPU method.
- It is an open-source experimental tool, written in Python, leveraging CuPy and Numba/CUDA kernels.

##### File Structure
- Top-level directories:
- DataSet/ : raw input data
- Source/  : Python scripts implementing each algorithm
- In Source/:
- TopDownCPU.py
- BottomUpCPU.py
- PreviousGPU.py
- ProposedMethod.py
- No separate “frontend” or “backend” – this is a computational pipeline.

##### README for Architecture Insights
- Four methods are executed by separate scripts.
- The novel GPU method consists of two CUDA kernels:
a) Parallel 3D tree-array construction
b) Parallel 3D→2D conversion
- Dependencies: cupy, numpy, numba, Python standard libs.

##### Main Components
a. Data Sources
- Raw datasets (e.g., DataSet/DataSet.txt)
- External Google Drive link (for larger/multiple datasets)
b. Experiment Orchestrator
- Python “driver” scripts in Source/
- Loads input, chooses algorithm, records timings, writes CSV
c. CPU-based Modules
- TopDownCPU module
- BottomUpCPU module
- Each: sequential B⁺-tree insertion routines
d. GPU-based Modules
- PreviousGPU module: level-by-level parallelism
- ProposedMethod module:
- Kernel A: 3D tree construction
- Kernel B: 3D→2D conversion
- Underlying libraries: CuPy (for array ops), Numba/CUDA
e. Hardware Resources
- CPU (AMD Ryzen)
- GPU (NVIDIA RTX series)
f. Results & Visualization
- CSV or tables of timings
- Static images (flowcharts, tables) in Images/
- Potential plotting scripts

##### Relationships & Data Flows
- Input DataSet → Experiment Orchestrator (script)
- Orchestrator → (via Python)
- CPU module → build tree → return time
- GPU module → cupy array sort → kernel A → kernel B → return time
- Orchestrator → outputs CSV → plot generator → Images

##### Architectural Patterns & Design Principles
- Pipeline pattern: Data ingestion → Algorithm selection → Processing → Result collection
- Modular separation: each algorithm in its own module
- Data-parallel design inside GPU kernels
- Clear dependency layering:
- Top layer: Python scripts
- Middle layer: algorithm implementations (pure Python vs. CUDA kernels)
- Bottom layer: hardware (CPU cores, GPU cores)

##### Essential Elements to Capture
- Data ingestion path (DataSet → script)
- Four algorithmic branches (Top-Down CPU, Bottom-Up CPU, Previous GPU, Proposed GPU)
- Internal GPU pipeline (Sort → Kernel A → Kernel B)
- Time measurement & result export
- External dependencies (CuPy, Numba, CUDA Toolkit)

– Clearly separates CPU vs. GPU workflows
– Shows data flow from raw input to final performance charts
– Captures the two-kernel design of the proposed method
– Highlights the modular, research-tool nature of the codebase

## Diagram (Mermaid)

```mermaid
flowchart TD
    subgraph "Documentation"
        README["README.md"]:::doc
    end
    click README "https://github.com/mintii13/a_new_construction_method_for_bptree_with_gpgpu/blob/master/README.md"

    subgraph "Data Sources"
        DS["DataSet/DataSet.txt"]:::data
        GD["Google Drive"]:::external
    end
    click DS "https://github.com/mintii13/a_new_construction_method_for_bptree_with_gpgpu/blob/master/DataSet/DataSet.txt"

    DS --> O["Experiment Orchestrator"]:::orchestrator
    GD --> O

    click O "https://github.com/mintii13/a_new_construction_method_for_bptree_with_gpgpu/tree/master/Source/"

    subgraph "Source/ - Algorithm Modules"
        TD["TopDownCPU.py"]:::cpu
        BU["BottomUpCPU.py"]:::cpu
        PG["PreviousGPU.py"]:::gpu
        PM["ProposedMethod.py"]:::gpu
    end
    click TD "https://github.com/mintii13/a_new_construction_method_for_bptree_with_gpgpu/blob/master/Source/TopDownCPU.py"
    click BU "https://github.com/mintii13/a_new_construction_method_for_bptree_with_gpgpu/blob/master/Source/BottomUpCPU.py"
    click PG "https://github.com/mintii13/a_new_construction_method_for_bptree_with_gpgpu/blob/master/Source/PreviousGPU.py"
    click PM "https://github.com/mintii13/a_new_construction_method_for_bptree_with_gpgpu/blob/master/Source/ProposedMethod.py"

    O --> TD
    O --> BU
    O --> PG
    O --> PM

    subgraph "Hardware Resources"
        CPU["CPU (AMD Ryzen)"]:::hardware
        GPU["GPU (NVIDIA RTX)"]:::hardware
    end

    TD --> CPU
    BU --> CPU
    PG --> GPU
    PM --> GPU

    subgraph "ProposedMethod Internals"
        SORT["CuPy Array Sort"]:::library
        KA["Kernel A: 3D Construction"]:::gpu
        KB["Kernel B: 3D→2D Conversion"]:::gpu
    end

    PM --> SORT --> KA --> KB --> PM

    O --> CSV["Results CSV"]:::data
    CSV --> IMG["Images/"]:::external
    click IMG "https://github.com/mintii13/a_new_construction_method_for_bptree_with_gpgpu/tree/master/Images/"

    classDef data fill:#b4e197,stroke:#333,stroke-width:1px
    classDef external fill:#d3d3d3,stroke:#333,stroke-width:1px
    classDef cpu fill:#9ad0f5,stroke:#333,stroke-width:1px
    classDef gpu fill:#f5b97a,stroke:#333,stroke-width:1px
    classDef orchestrator fill:#d9a4ff,stroke:#333,stroke-width:1px
    classDef hardware fill:#e0e0e0,stroke:#333,stroke-width:1px
    classDef library fill:#fdf5a3,stroke:#333,stroke-width:1px
    classDef doc fill:#e8e8e8,stroke:#333,stroke-width:1px
```
