Metadata-Version: 2.4
Name: procthumper
Version: 1.0.0
Summary: Cross-platform CPU / GPU / AI stress-test tool with a live dark-themed Qt UI
License: MIT
Project-URL: Homepage, https://github.com/007Style/procThumper
Project-URL: Source, https://github.com/007Style/procThumper
Project-URL: Issues, https://github.com/007Style/procThumper/issues
Keywords: stress-test,benchmark,cpu,gpu,npu,onnx,qt,hardware
Classifier: Environment :: X11 Applications :: Qt
Classifier: Intended Audience :: Developers
Classifier: Operating System :: MacOS
Classifier: Operating System :: POSIX :: Linux
Classifier: Operating System :: Microsoft :: Windows
Classifier: Topic :: System :: Benchmark
Classifier: Topic :: System :: Hardware
Requires-Python: >=3.10
Description-Content-Type: text/markdown
License-File: LICENSE
Requires-Dist: PyQt6>=6.6
Requires-Dist: pyqtgraph>=0.13
Requires-Dist: numpy>=1.24
Requires-Dist: psutil>=5.9
Requires-Dist: onnxruntime>=1.17
Requires-Dist: pyopencl>=2023.1; sys_platform != "darwin"
Requires-Dist: pynvml>=11.0; sys_platform != "darwin"
Provides-Extra: build
Requires-Dist: pyinstaller>=6.0; extra == "build"
Provides-Extra: macos
Requires-Dist: metalcompute>=0.3; extra == "macos"
Provides-Extra: windows
Requires-Dist: pyinstaller-hooks-contrib; extra == "windows"
Provides-Extra: dev
Requires-Dist: pytest>=7; extra == "dev"
Requires-Dist: pytest-env>=1.0; extra == "dev"
Dynamic: license-file

<div align="center">

```
██████╗ ██████╗  ██████╗  ██████╗████████╗██╗  ██╗██╗   ██╗███╗   ███╗██████╗ ███████╗██████╗
██╔══██╗██╔══██╗██╔═══██╗██╔════╝╚══██╔══╝██║  ██║██║   ██║████╗ ████║██╔══██╗██╔════╝██╔══██╗
██████╔╝██████╔╝██║   ██║██║        ██║   ███████║██║   ██║██╔████╔██║██████╔╝█████╗  ██████╔╝
██╔═══╝ ██╔══██╗██║   ██║██║        ██║   ██╔══██║██║   ██║██║╚██╔╝██║██╔═══╝ ██╔══╝  ██╔══██╗
██║     ██║  ██║╚██████╔╝╚██████╗   ██║   ██║  ██║╚██████╔╝██║ ╚═╝ ██║██║     ███████╗██║  ██║
╚═╝     ╚═╝  ╚═╝ ╚═════╝  ╚═════╝   ╚═╝   ╚═╝  ╚═╝ ╚═════╝ ╚═╝     ╚═╝╚═╝     ╚══════╝╚═╝  ╚═╝
```

### 🔥 Cross-platform CPU · GPU · AI stress-test tool with a live dark-themed Qt UI

[![Release](https://img.shields.io/badge/release-v1.0.0-FFD700?style=for-the-badge&logo=rocket&logoColor=black)](https://github.com/007Style/procThumper/releases)
[![Python](https://img.shields.io/badge/python-3.10%2B-3776AB?style=for-the-badge&logo=python&logoColor=white)](https://python.org)
[![PyQt6](https://img.shields.io/badge/PyQt6-6.6%2B-41CD52?style=for-the-badge&logo=qt&logoColor=white)](https://pypi.org/project/PyQt6/)
[![License](https://img.shields.io/badge/license-MIT-A855F7?style=for-the-badge)](LICENSE)
[![Tests](https://img.shields.io/badge/tests-42%20passing-00FFAA?style=for-the-badge&logo=pytest&logoColor=black)](tests/)

[![macOS](https://img.shields.io/badge/macOS-12%2B-FF6A00?style=flat-square&logo=apple&logoColor=white)](build/build_macos.sh)
[![Windows](https://img.shields.io/badge/Windows-10%2F11-00FFAA?style=flat-square&logo=windows&logoColor=black)](build/build_windows.bat)
[![Linux](https://img.shields.io/badge/Linux-x86__64%20%2F%20arm64-38BDF8?style=flat-square&logo=linux&logoColor=white)](build/build_linux.sh)

</div>

---

## ⚡ What is procThumper?

procThumper hammers **every compute subsystem** in your machine simultaneously and shows you exactly what is happening in real time — no installation required on end-user machines.

```
┌──────────────────────────────────────────────────────────────────────────────┐
│  File                                                                        │
├──────────────────────────────────────────────────────────────────────────────┤
│ 🟢 CPU  ──────────────────────────────────────────────────────────────────── │
│  Threads: [8 ▲▼]  ▶ Start  ■ Stop   ◉ RUNNING                               │
│  ┌─ Thread Activity (MOPS) ─────────────────────────────────────────────┐    │
│  │  ████████████████████████████████ 14.7 MOPS  ████████████████ 13.2  │    │
│  └──────────────────────────────────────────────────────────────────────┘    │
│  ┌─ Core Utilisation % ─────────────────────────────────────────────────┐    │
│  │  ▂▄▆█▆▄▂▄▆█  ▂▄▆█▆▄▂▄▆█  ▂▄▆█▆▄▂▄▆█  ▂▄▆█▆▄▂▄▆█  (all 8 cores)    │    │
│  └──────────────────────────────────────────────────────────────────────┘    │
├─────────────────────  ▶ START ALL   ■ STOP ALL  ─────────────────────────────┤
│ 🟠 GPU  ─────────────────── │ 🟣 NPU / AI  ──────────────────────────────── │
│  Dispatches: [4 ▲▼]         │   Threads: [2 ▲▼]  ▶ Start  ■ Stop           │
│  ┌─ GFLOPS ───────────────┐ │  ╔═══════════════════════════════╗             │
│  │  ▂▄▆█▆▄▂▄▆█▆▄▂▄▆ 842  │ │  ║      2.847  TOPS             ║             │
│  └────────────────────────┘ │  ╚═══════════════════════════════╝             │
│  ┌─ GPU Util % ───────────┐ │  ┌─ Latency ms ──┐  ┌─ Throughput ──────────┐ │
│  │  ████████████████ 91%  │ │  │  ▂▄▆▄▂▄▆ 3.2 │  │  infs/s ·· TOPS      │ │
│  └────────────────────────┘ │  └───────────────┘  └──────────────────────┘ │
├──────────────────────────────────────────────────────────────────────────────┤
│ CPU LOAD  CPU TEMP  CPU POWER  CPU FREQ  GPU LOAD  GPU TEMP  RAM USED        │
│  87.3%    68.4°C    22.1W     3800MHz   91.2%     74°C      9.1 GB          │
└──────────────────────────────────────────────────────────────────────────────┘
```

---

## ✨ Features

<table>
<tr>
<td width="50%">

### 🟢 CPU Stress Engine
Spawns **N GIL-free worker processes** cycling through three punishment phases:
- 🔢 **FP phase** — `sin·cos + sqrt` trig on LCG pseudo-random inputs
- 🔀 **Integer phase** — XOR + shift + multiply with intentional pipeline stalls
- 🌿 **Branch phase** — 4-way random conditionals with ~25% predictor hit rate

Live per-thread graph auto-scales: **OPS → KOPS → MOPS → GOPS → TOPS**

</td>
<td width="50%">

### 🟠 GPU Compute Engine
Dispatches **256×256 float32 matrix-multiply** kernels in parallel:
- 🍎 **macOS** — Metal via `metalcompute`
- 🪟 **Windows / 🐧 Linux** — OpenCL via `pyopencl`

~33 M FLOPs per dispatch. Live **GFLOPS** throughput graph + GPU utilisation %.

</td>
</tr>
<tr>
<td width="50%">

### 🟣 NPU / AI Inference Engine
Runs real **MobileNetV2** inference via **ONNX Runtime**, auto-selecting the best EP:

| Priority | Provider | Platform |
|:---:|---|---|
| 1 | `CoreML` | 🍎 Apple ANE |
| 2 | `DirectML` | 🪟 Intel/AMD NPU |
| 3 | `CUDA` | 🟩 NVIDIA GPU |
| 4 | `ROCM` | 🔴 AMD GPU |
| 5 | `CPU` | All platforms |

Live **TOPS** display, latency graph, and throughput chart.

</td>
<td width="50%">

### 🔵 System Telemetry Bar
Always-on bottom strip with **sparkline graphs** for every metric:

| Tile | Source |
|---|---|
| 🟢 CPU Load % | `psutil` (blocking, race-free) |
| 🌡️ CPU Temp | `psutil.sensors_temperatures` |
| ⚡ CPU Power | `powermetrics` (macOS) |
| 📶 CPU Freq | `psutil.cpu_freq` |
| 🟠 GPU Load % | NVML / `powermetrics` |
| 🌡️ GPU Temp | NVML / `powermetrics` |
| 🧠 RAM Used | `psutil.virtual_memory` |

Tiles unavailable on the current platform **hide themselves** after 5 s.

</td>
</tr>
</table>

---

## 🚀 Quick Start

### Run from source

```bash
# 1. Clone
git clone https://github.com/007Style/procThumper.git
cd procThumper

# 2. Virtual environment
python3 -m venv .venv

# 3. Install (pick your platform)
source .venv/bin/activate          # macOS / Linux
# .venv\Scripts\Activate.ps1       # Windows PowerShell

pip install -e ".[macos]"          # 🍎 macOS
pip install -e ".[windows]"        # 🪟 Windows  (+ pip install wmi  for sensors)
pip install -e .                   # 🐧 Linux

# 4. Download the AI model (one-time, ~14 MB)
curl -L -o src/procthumper/assets/model/mobilenetv2.onnx \
  https://github.com/onnx/models/raw/main/validated/vision/classification/mobilenet/model/mobilenetv2-12.onnx

# 5. Launch 🔥
python -m procthumper
```

### Use the pre-built DMG (macOS only)

Download `procThumper.dmg` from [Releases](https://github.com/007Style/procThumper/releases), mount it, drag to Applications. No Python needed.

> **First launch on macOS:** Right-click → **Open** to bypass Gatekeeper (app is ad-hoc signed, not notarised).

---

## 🏗️ Building Your Own Distributable

> PyInstaller does **not** cross-compile — build on the target OS.

<table>
<tr>
<th>Platform</th>
<th>Command</th>
<th>Output</th>
</tr>
<tr>
<td>🍎 macOS</td>
<td><code>bash build/build_macos.sh</code></td>
<td><code>dist/macos/procThumper.dmg</code></td>
</tr>
<tr>
<td>🪟 Windows</td>
<td><code>build\build_windows.bat</code></td>
<td><code>dist\windows\procThumper.zip</code></td>
</tr>
<tr>
<td>🐧 Linux</td>
<td><code>bash build/build_linux.sh</code></td>
<td><code>dist/linux/procThumper.tar.gz</code></td>
</tr>
</table>

All three scripts: print Python + PyInstaller versions, exit on error, and package the output into a distributable archive automatically.

---

## 🧪 Testing

```bash
pip install -e ".[dev]"   # adds pytest + pytest-env
python -m pytest          # 42 tests, ~5 seconds, fully headless
```

| File | Tests | Covers |
|---|:---:|---|
| `tests/smoke_test.py` | 6 | Imports, `HardwareProfile`, AI constants, queue helpers, styles, `MainWindow` |
| `tests/test_cpu_worker.py` | 10 | `_scale_ops()` all tiers, table validity, worker ops/sec, stop behaviour |
| `tests/test_telemetry_worker.py` | 6 | `_poll_psutil()` keys + ranges, blocking CPU util, worker lifecycle |
| `tests/test_dialogs.py` | 10 | About/Help windows, animated canvas, HTML content, sizes |
| `tests/test_main_window.py` | 10 | File menu, Help/About, F1 shortcut, separator, panels, start/stop |

---

## 📁 Project Layout

```
procThumper/
├── 📂 src/procthumper/
│   ├── 🐍 main.py                 Entry point + freeze_support bootstrap
│   ├── 📂 ui/
│   │   ├── main_window.py         QMainWindow + File menu
│   │   ├── cpu_panel.py           CPU stress + auto-scaling ops graph
│   │   ├── gpu_panel.py           GPU stress (Metal / OpenCL)
│   │   ├── ai_panel.py            ONNX Runtime NPU inference panel
│   │   ├── telemetry_bar.py       Live sensor tiles + sparklines
│   │   ├── about_window.py        Animated About dialog (v1.0.0)
│   │   ├── help_window.py         Scrollable Help dialog
│   │   └── styles.py              Global stylesheet + colour constants
│   ├── 📂 workers/
│   │   ├── cpu_worker.py          Multiprocessing stress loop
│   │   ├── gpu_worker.py          Metal / OpenCL matrix-multiply
│   │   ├── ai_worker.py           ONNX inference thread
│   │   └── telemetry_worker.py    System sensor polling thread
│   └── 📂 utils/
│       ├── hardware_detect.py     HardwareProfile singleton
│       └── metrics_queue.py       Queue utilities
├── 📂 assets/model/
│   └── mobilenetv2.onnx           ← download separately (see above)
├── 📂 build/
│   ├── procThumper.spec           PyInstaller spec (all platforms)
│   ├── build_macos.sh             🍎 → .app + .dmg
│   ├── build_linux.sh             🐧 → dir + .tar.gz
│   └── build_windows.bat          🪟 → dir + .zip
├── 📂 tests/                      42 headless unit tests
├── pyproject.toml                 Package metadata + pytest config
└── README.md                      You are here
```

---

## 🔧 Platform Notes

<details>
<summary><b>🍎 macOS</b></summary>

- **Apple Silicon (M1/M2/M3/M4):** ONNX Runtime auto-detects the Neural Engine via `CoreMLExecutionProvider` — expect genuine TOPS-class AI throughput.
- **Intel Mac:** Falls back to `CPUExecutionProvider` with AVX2 SIMD.
- **powermetrics:** CPU/GPU power + temperature data requires `sudo -n powermetrics` (passwordless sudo). The app never prompts — tiles hide silently if permission is denied.
- **Gatekeeper:** Right-click → Open on first launch, or self-sign: `codesign --deep --force --sign - procThumper.app`

</details>

<details>
<summary><b>🪟 Windows</b></summary>

- **GPU:** OpenCL 1.2+ required (Intel, AMD, or NVIDIA GPU driver).
- **NPU:** DirectML execution provider supported for Intel/AMD NPUs.
- **NVIDIA:** `pynvml` bundled — GPU temperature, power, and utilisation work out-of-the-box.
- **Sensors:** Install `wmi` for CPU temperature data via OpenHardwareMonitor.
- **Defender:** PyInstaller binaries may be flagged. Add a folder exclusion in *Windows Security → Virus & threat protection → Exclusions*.

</details>

<details>
<summary><b>🐧 Linux</b></summary>

- **Display:** X11 or Wayland + XWayland required. For headless testing: `QT_QPA_PLATFORM=offscreen`.
- **GPU:** Install your vendor's OpenCL ICD: `ocl-icd-libopencl1` + `intel-opencl-icd` / `nvidia-opencl-icd` / `rocm-opencl-icd`.
- **libGL/EGL:** `sudo apt install libgl1 libegl1` (Debian/Ubuntu) or `sudo dnf install mesa-libGL mesa-libEGL` (Fedora).
- **glibc:** Build on the oldest target distro for maximum compatibility (Ubuntu 20.04 / glibc 2.31 recommended).

</details>

---

## 🐛 Known Bugs Fixed in v1.0.0

| Bug | Root cause | Fix |
|---|---|---|
| **Multiple GUI windows** when starting CPU stress | `multiprocessing.freeze_support()` missing — spawned worker processes re-executed the frozen app entry point | Added `freeze_support()` at top of `main()` |
| **CPU LOAD always 0%** in telemetry bar | `psutil.cpu_percent(interval=None)` shares an internal timer with the CPU panel's 5 Hz per-core sampler; last reset was always milliseconds ago | Changed to blocking `interval=0.1` — self-contained, race-free measurement |

---

## 📦 Dependencies

| Package | Purpose | Platform |
|---|---|---|
| `PyQt6` | UI framework | All |
| `pyqtgraph` | Live charts + sparklines | All |
| `numpy` | Array ops for GPU/AI workers | All |
| `psutil` | CPU/RAM metrics | All |
| `onnxruntime` | AI inference (MobileNetV2) | All |
| `pyinstaller` | Binary packaging | All (build time) |
| `metalcompute` | Metal GPU backend | 🍎 macOS |
| `pyopencl` | OpenCL GPU backend | 🪟🐧 Win/Linux |
| `pynvml` | NVIDIA telemetry | 🪟🐧 Win/Linux |
| `wmi` | Windows CPU sensors | 🪟 Windows (optional) |

---

## 👥 Credits

<div align="center">

Built with 🔥 by

**[Daneyand](mailto:daneyand@ibm.com)** &nbsp;·&nbsp; daneyand@ibm.com

&nbsp;+&nbsp;

**IBM's Bob** — AI pair programmer

---

*"From the minds of Daneyand and IBM's Bob"*

</div>

---

## 📄 License

MIT — see [LICENSE](LICENSE) for details.

---

<div align="center">

**⭐ If procThumper melted your CPU, give it a star ⭐**

[![Star History](https://img.shields.io/github/stars/007Style/procThumper?style=social)](https://github.com/007Style/procThumper)

</div>
