# xiao-yux/gpu_tool architecture

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

- Interactive diagram: https://gitdiagram.com/xiao-yux/gpu_tool
- Repository: https://github.com/xiao-yux/gpu_tool

## Overview

GPU Tool is a Linux server-delivery diagnostics and test application with a separate Flask/WebSocket interface for remote viewing and control. The CLI workflow starts in `main.py`, loads core/menu behavior, presents system or GPU test choices, runs commands through terminal sessions, and records diagnostic and run output. The Web interface exposes task, scanner, and client information operations backed by routes, persistent records, and WebSocket clients. The README documents GPU burn, fieldiag, NCCL, and result collection; sampled excerpts clarify only parts of their wiring, so uncertain links are omitted.

Main entry points: [`src/gpu_tool/menu/menu.py`](https://github.com/xiao-yux/gpu_tool/blob/main/src/gpu_tool/menu/menu.py) (Interactive menus), [`src/webserver/utils/routws.py`](https://github.com/xiao-yux/gpu_tool/blob/main/src/webserver/utils/routws.py) (HTTP routes), [`src/gpu_tool/runner/screen.py`](https://github.com/xiao-yux/gpu_tool/blob/main/src/gpu_tool/runner/screen.py) (Command sessions), [`src/gpu_tool/log/logger.py`](https://github.com/xiao-yux/gpu_tool/blob/main/src/gpu_tool/log/logger.py) (Log output)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_cli["CLI workflow"]
  node_cli_entry["CLI entry<br/>[main.py]"]
  node_core["Core loader<br/>[core.py]"]
  node_menu["Interactive menus<br/>[menu.py]"]
  node_config["Configuration<br/>[loader.py]"]
  node_i18n["Localization<br/>[i18n.py]"]
  node_testmanager["Test manager<br/>[testmanager.py]"]
end

subgraph group_runtime["Diagnostics and execution"]
  node_sysinfo["System inventory<br/>[bash.py]"]
  node_syscollect["Raw collection"]
  node_fdmenu["Fieldiag menus<br/>[fd_menu.py]"]
  node_runner["Command sessions<br/>[screen.py]"]
  node_localrunner["Local execution<br/>[local.py]"]
  node_logs["Log output<br/>[logger.py]"]
  node_gpu_tools["GPU utilities<br/>[tool.py]"]
  node_test_programs["GPU test programs"]
end

subgraph group_web["Web interface"]
  node_web_entry["Web server<br/>[main.py]"]
  node_task_ui["Task interface<br/>[tasks.js]"]
end

subgraph group_webdata["Web services and data"]
  node_routes["HTTP routes<br/>[routws.py]"]
  node_scanner["Network scanning<br/>[scanner.py]"]
  node_frp["Remote access<br/>[frprun.py]"]
  node_websocket["WebSocket service<br/>[ws.py]"]
  node_webdb[("Web records<br/>[db.py]")]
end

node_operator(("Operator"))
node_webuser(("Remote user"))

node_operator -->|"starts CLI"| node_cli_entry
node_cli_entry -->|"creates core"| node_core
node_core -->|"loads settings"| node_config
node_core -->|"runs menus"| node_menu
node_menu -->|"gets labels"| node_i18n
node_menu -->|"requests inventory"| node_sysinfo
node_menu -->|"opens tests"| node_fdmenu
node_menu -->|"runs commands"| node_runner
node_menu -->|"records results"| node_logs
node_menu -.->|"selects automation"| node_testmanager
node_testmanager -->|"records progress"| node_logs
node_sysinfo -->|"uses helpers"| node_gpu_tools
node_syscollect -->|"saves collection"| node_logs
node_runner -->|"runs commands"| node_gpu_tools
node_runner -->|"reports sessions"| node_logs
node_fdmenu -->|"dispatches tests"| node_runner
node_runner -->|"executes"| node_test_programs
node_webuser -->|"opens interface"| node_web_entry
node_web_entry -->|"registers routes"| node_routes
node_web_entry -->|"starts service"| node_websocket
node_task_ui -->|"calls task API"| node_routes
node_routes -->|"reads and writes"| node_webdb
node_routes -->|"dispatches scans"| node_scanner
node_routes -->|"starts access"| node_frp
node_routes -->|"requests client data"| node_websocket
node_websocket -.->|"caches client info"| node_webdb

click node_cli_entry "https://github.com/xiao-yux/gpu_tool/blob/main/src/gpu_tool/main.py"
click node_core "https://github.com/xiao-yux/gpu_tool/blob/main/src/gpu_tool/core/core.py"
click node_menu "https://github.com/xiao-yux/gpu_tool/blob/main/src/gpu_tool/menu/menu.py"
click node_config "https://github.com/xiao-yux/gpu_tool/blob/main/src/gpu_tool/config/loader.py"
click node_i18n "https://github.com/xiao-yux/gpu_tool/blob/main/src/gpu_tool/i18n/i18n.py"
click node_testmanager "https://github.com/xiao-yux/gpu_tool/blob/main/src/gpu_tool/testmanager/testmanager.py"
click node_sysinfo "https://github.com/xiao-yux/gpu_tool/blob/main/src/gpu_tool/bash/bash.py"
click node_syscollect "https://github.com/xiao-yux/gpu_tool/blob/main/src/gpu_tool/utils/check_and_save_system.py"
click node_fdmenu "https://github.com/xiao-yux/gpu_tool/blob/main/src/gpu_tool/menu/fd_menu.py"
click node_runner "https://github.com/xiao-yux/gpu_tool/blob/main/src/gpu_tool/runner/screen.py"
click node_localrunner "https://github.com/xiao-yux/gpu_tool/blob/main/src/gpu_tool/runner/local.py"
click node_logs "https://github.com/xiao-yux/gpu_tool/blob/main/src/gpu_tool/log/logger.py"
click node_gpu_tools "https://github.com/xiao-yux/gpu_tool/blob/main/src/gpu_tool/utils/tool.py"
click node_web_entry "https://github.com/xiao-yux/gpu_tool/blob/main/src/webserver/main.py"
click node_task_ui "https://github.com/xiao-yux/gpu_tool/blob/main/src/webserver/static/js/tasks.js"
click node_routes "https://github.com/xiao-yux/gpu_tool/blob/main/src/webserver/utils/routws.py"
click node_scanner "https://github.com/xiao-yux/gpu_tool/blob/main/src/webserver/utils/scanner.py"
click node_frp "https://github.com/xiao-yux/gpu_tool/blob/main/src/webserver/utils/frprun.py"
click node_websocket "https://github.com/xiao-yux/gpu_tool/blob/main/src/webserver/utils/ws.py"
click node_webdb "https://github.com/xiao-yux/gpu_tool/blob/main/src/webserver/utils/db.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_cli_entry,node_core,node_menu,node_config,node_i18n,node_testmanager,node_webuser toneBlue
class node_sysinfo,node_syscollect,node_fdmenu,node_runner,node_localrunner,node_logs,node_gpu_tools,node_test_programs toneAmber
class node_web_entry,node_task_ui toneMint
class node_routes,node_scanner,node_frp,node_websocket,node_webdb toneRose
class node_operator toneIndigo
```

## Components

### CLI workflow

- [CLI entry](https://github.com/xiao-yux/gpu_tool/blob/main/src/gpu_tool/main.py): `src/gpu_tool/main.py`
- [Core loader](https://github.com/xiao-yux/gpu_tool/blob/main/src/gpu_tool/core/core.py): `src/gpu_tool/core/core.py`
- [Interactive menus](https://github.com/xiao-yux/gpu_tool/blob/main/src/gpu_tool/menu/menu.py): `src/gpu_tool/menu/menu.py`
- [Configuration](https://github.com/xiao-yux/gpu_tool/blob/main/src/gpu_tool/config/loader.py): `src/gpu_tool/config/loader.py`
- [Localization](https://github.com/xiao-yux/gpu_tool/blob/main/src/gpu_tool/i18n/i18n.py): `src/gpu_tool/i18n/i18n.py`
- [Test manager](https://github.com/xiao-yux/gpu_tool/blob/main/src/gpu_tool/testmanager/testmanager.py): `src/gpu_tool/testmanager/testmanager.py`

### Diagnostics and execution

- [System inventory](https://github.com/xiao-yux/gpu_tool/blob/main/src/gpu_tool/bash/bash.py): `src/gpu_tool/bash/bash.py`
- [Raw collection](https://github.com/xiao-yux/gpu_tool/blob/main/src/gpu_tool/utils/check_and_save_system.py): `src/gpu_tool/utils/check_and_save_system.py`
- [Fieldiag menus](https://github.com/xiao-yux/gpu_tool/blob/main/src/gpu_tool/menu/fd_menu.py): `src/gpu_tool/menu/fd_menu.py`
- [Command sessions](https://github.com/xiao-yux/gpu_tool/blob/main/src/gpu_tool/runner/screen.py): `src/gpu_tool/runner/screen.py`
- [Local execution](https://github.com/xiao-yux/gpu_tool/blob/main/src/gpu_tool/runner/local.py): `src/gpu_tool/runner/local.py`
- [Log output](https://github.com/xiao-yux/gpu_tool/blob/main/src/gpu_tool/log/logger.py): `src/gpu_tool/log/logger.py`
- [GPU utilities](https://github.com/xiao-yux/gpu_tool/blob/main/src/gpu_tool/utils/tool.py): `src/gpu_tool/utils/tool.py`
- **GPU test programs**

### Web interface

- [Web server](https://github.com/xiao-yux/gpu_tool/blob/main/src/webserver/main.py): `src/webserver/main.py`
- [Task interface](https://github.com/xiao-yux/gpu_tool/blob/main/src/webserver/static/js/tasks.js): `src/webserver/static/js/tasks.js`

### Web services and data

- [HTTP routes](https://github.com/xiao-yux/gpu_tool/blob/main/src/webserver/utils/routws.py): `src/webserver/utils/routws.py`
- [Network scanning](https://github.com/xiao-yux/gpu_tool/blob/main/src/webserver/utils/scanner.py): `src/webserver/utils/scanner.py`
- [Remote access](https://github.com/xiao-yux/gpu_tool/blob/main/src/webserver/utils/frprun.py): `src/webserver/utils/frprun.py`
- [WebSocket service](https://github.com/xiao-yux/gpu_tool/blob/main/src/webserver/utils/ws.py): `src/webserver/utils/ws.py`
- [Web records](https://github.com/xiao-yux/gpu_tool/blob/main/src/webserver/utils/db.py): `src/webserver/utils/db.py`

### Other components

- **Operator**
- **Remote user**

## Connections

- Operator → CLI entry: starts CLI
- CLI entry → Core loader: creates core
- Core loader → Configuration: loads settings
- Core loader → Interactive menus: runs menus
- Interactive menus → Localization: gets labels
- Interactive menus → System inventory: requests inventory
- Interactive menus → Fieldiag menus: opens tests
- Interactive menus → Command sessions: runs commands
- Interactive menus → Log output: records results
- Interactive menus → Test manager: selects automation
- Test manager → Log output: records progress
- System inventory → GPU utilities: uses helpers
- Raw collection → Log output: saves collection
- Command sessions → GPU utilities: runs commands
- Command sessions → Log output: reports sessions
- Fieldiag menus → Command sessions: dispatches tests
- Command sessions → GPU test programs: executes
- Remote user → Web server: opens interface
- Web server → HTTP routes: registers routes
- Web server → WebSocket service: starts service
- Task interface → HTTP routes: calls task API
- HTTP routes → Web records: reads and writes
- HTTP routes → Network scanning: dispatches scans
- HTTP routes → Remote access: starts access
- HTTP routes → WebSocket service: requests client data
- WebSocket service → Web records: caches client info
