# milanfusco/mcframework-gpu architecture

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

- Interactive diagram: https://gitdiagram.com/milanfusco/mcframework-gpu
- Repository: https://github.com/milanfusco/mcframework-gpu

## Overview

mcFramework-GPU is a Monte Carlo π estimation demo and CPU/GPU comparison tool. The main workflow runs scalar Python, NumPy, or PyTorch CPU/CUDA estimators, then benchmarks their accuracy and timings; a separate visualization command reads benchmark JSON and produces comparison, speedup, convergence, and sampling plots. CUDA availability and batched execution are also supported. Benchmark and demo source was not excerpted, so their links to estimator implementations are shown as unverified rather than asserted as direct calls.

Main entry points: [`pi_estimation/benchmark.py`](https://github.com/milanfusco/mcframework-gpu/blob/master/pi_estimation/benchmark.py) (Benchmark runner), [`pi_estimation/visualize.py`](https://github.com/milanfusco/mcframework-gpu/blob/master/pi_estimation/visualize.py) (Plot generation), [`examples/simple_demo.py`](https://github.com/milanfusco/mcframework-gpu/blob/master/examples/simple_demo.py) (Simple demo), [`pi_estimation/cpu_methods.py`](https://github.com/milanfusco/mcframework-gpu/blob/master/pi_estimation/cpu_methods.py) (Python and NumPy)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_entry["User entry points"]
  node_demo["Simple demo<br/>[simple_demo.py]"]
end

subgraph group_estimators["Estimation methods"]
  node_cpu["Python and NumPy<br/>[cpu_methods.py]"]
  node_gpu["PyTorch CPU and CUDA<br/>[gpu_methods.py]"]
end

subgraph group_analysis["Benchmarking"]
  node_benchmark["Benchmark runner<br/>[benchmark.py]"]
  node_results["Benchmark JSON"]
end

subgraph group_visualization["Visualization"]
  node_visualizer["Plot generation<br/>[visualize.py]"]
  node_plots["PNG plots"]
end

node_user(("User"))

node_user -->|"runs"| node_demo
node_user -->|"runs"| node_benchmark
node_user -->|"runs"| node_visualizer
node_benchmark -.->|"uses"| node_cpu
node_benchmark -.->|"uses"| node_gpu
node_benchmark -->|"writes"| node_results
node_visualizer -->|"reads"| node_results
node_visualizer -->|"writes"| node_plots

click node_demo "https://github.com/milanfusco/mcframework-gpu/blob/master/examples/simple_demo.py"
click node_benchmark "https://github.com/milanfusco/mcframework-gpu/blob/master/pi_estimation/benchmark.py"
click node_cpu "https://github.com/milanfusco/mcframework-gpu/blob/master/pi_estimation/cpu_methods.py"
click node_gpu "https://github.com/milanfusco/mcframework-gpu/blob/master/pi_estimation/gpu_methods.py"
click node_visualizer "https://github.com/milanfusco/mcframework-gpu/blob/master/pi_estimation/visualize.py"

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_demo,node_user toneBlue
class node_cpu,node_gpu toneAmber
class node_benchmark,node_results toneMint
class node_visualizer,node_plots toneRose
```

## Components

### User entry points

- [Simple demo](https://github.com/milanfusco/mcframework-gpu/blob/master/examples/simple_demo.py): `examples/simple_demo.py`

### Estimation methods

- [Python and NumPy](https://github.com/milanfusco/mcframework-gpu/blob/master/pi_estimation/cpu_methods.py): `pi_estimation/cpu_methods.py`
- [PyTorch CPU and CUDA](https://github.com/milanfusco/mcframework-gpu/blob/master/pi_estimation/gpu_methods.py): `pi_estimation/gpu_methods.py`

### Benchmarking

- [Benchmark runner](https://github.com/milanfusco/mcframework-gpu/blob/master/pi_estimation/benchmark.py): `pi_estimation/benchmark.py`
- **Benchmark JSON**

### Visualization

- [Plot generation](https://github.com/milanfusco/mcframework-gpu/blob/master/pi_estimation/visualize.py): `pi_estimation/visualize.py`
- **PNG plots**

### Other components

- **User**

## Connections

- User → Simple demo: runs (evidence: `README.md`)
- User → Benchmark runner: runs (evidence: `README.md`)
- User → Plot generation: runs (evidence: `README.md`)
- Benchmark runner → Python and NumPy: uses
- Benchmark runner → PyTorch CPU and CUDA: uses
- Benchmark runner → Benchmark JSON: writes (evidence: `README.md`)
- Plot generation → Benchmark JSON: reads (evidence: `README.md`)
- Plot generation → PNG plots: writes (evidence: `README.md`)
