Skip to content

A GPU task manager for Windows, Linux, and WSL: per-process VRAM, GPU activity, and LLM model/KV-cache insights (Windows AMD and NVIDIA).

Python

Add eight-chart responsive TUI, video clock, and portable x64/ARM64 release builds

Scott Hanselmanf37e8ad0c0d9
diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml
new file mode 100644
index 0000000..826aad7
--- /dev/null
+++ b/.github/workflows/release.yml
@@ -0,0 +1,84 @@
+name: Portable Windows release
+
+on:
+ workflow_dispatch:
+ push:
+ tags: ["v*"]
+
+permissions:
+ contents: read
+
+jobs:
+ build:
+ name: Windows ${{ matrix.arch }}
+ runs-on: ${{ matrix.runner }}
+ strategy:
+ fail-fast: false
+ matrix:
+ include:
+ - arch: x64
+ runner: windows-2022
+ - arch: arm64
+ runner: windows-11-arm
+ steps:
+ - uses: actions/checkout@v4
+ - uses: astral-sh/setup-uv@v6
+ with:
+ version: "0.13.6"
+ python-version: "3.13"
+ - run: uv sync --locked --group release
+ - run: uv run --locked python -m unittest discover -s tests -v
+ - name: Build portable ZIP
+ shell: pwsh
+ env:
+ BUILD_ARCH: ${{ matrix.arch }}
+ run: |
+ $buildArgs = @("--arch", $env:BUILD_ARCH)
+ if ($env:GITHUB_REF_TYPE -eq "tag") {
+ $buildArgs += @("--tag", $env:GITHUB_REF_NAME)
+ }
+ uv run --locked --group release python tools\build_portable.py @buildArgs
+ if ($LASTEXITCODE -ne 0) { throw "Portable build failed" }
+ - name: Smoke-test the extracted executable without Python
+ shell: pwsh
+ run: |
+ $zip = Get-Item dist\*.zip
+ $portable = Join-Path $env:RUNNER_TEMP "portable app"
+ Expand-Archive -LiteralPath $zip.FullName -DestinationPath $portable
+ $exe = (Get-ChildItem $portable -Filter gputaskman.exe -Recurse).FullName
+ $env:PYTHONPATH = ""
+ $env:PYTHONHOME = ""
+ $env:PATH = "$env:SystemRoot\System32;$env:SystemRoot"
+ Push-Location $portable
+ try {
+ & $exe --help
+ if ($LASTEXITCODE -ne 0) { throw "Frozen executable smoke test failed" }
+ } finally {
+ Pop-Location
+ }
+ - uses: actions/upload-artifact@v4
+ with:
+ name: windows-${{ matrix.arch }}-portable
+ path: |
+ dist/*.zip
+ dist/*.zip.sha256
+ if-no-files-found: error
+
+ publish:
+ if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')
+ needs: build
+ runs-on: ubuntu-latest
+ permissions:
+ contents: write
+ steps:
+ - uses: actions/download-artifact@v4
+ with:
+ pattern: windows-*-portable
+ merge-multiple: true
+ path: release-assets
+ - name: Publish both architectures together
+ env:
+ GH_TOKEN: ${{ github.token }}
+ GH_REPO: ${{ github.repository }}
+ RELEASE_TAG: ${{ github.ref_name }}
+ run: gh release create "$RELEASE_TAG" release-assets/* --verify-tag --generate-notes --title "GPU Task Manager $RELEASE_TAG"
diff --git a/README.md b/README.md
index 919b64c..772555e 100644
--- a/README.md
+++ b/README.md
@@ -20,6 +20,27 @@ CPU-only, NPU-only, and cloud workloads are out of scope.
> Early, experimental software. Device and process counters are measurements; classifications
> and GGUF-derived breakdowns are estimates. This does not dump VRAM or enumerate a game's textures.
+## Portable Windows download
+
+The [Releases page](https://github.com/shanselman/gputaskman/releases) is where tagged builds
+publish two portable ZIPs: `gputaskman-VERSION-windows-x64.zip` for Intel/AMD Windows PCs, and
+`gputaskman-VERSION-windows-arm64.zip` for native Windows ARM64. These are separate native builds,
+not a universal executable. If no release is published yet, use the source instructions below.
+
+Extract the **entire ZIP**, keeping `_internal` beside `gputaskman.exe`. Open Windows Terminal
+or PowerShell in the extracted folder:
+
+```powershell
+.\gputaskman.exe
+.\gputaskman.exe --once
+.\gputaskman.exe --json
+```
+
+No Python, uv, CUDA Toolkit, model download, or installation is needed. An NVIDIA GPU with a
+current Windows WDDM driver is still required. Builds are currently **unsigned**; code signing
+and an installer are not part of this initial distribution. Each ZIP includes licenses and a
+`.zip.sha256` companion file is published for integrity checks.
+
## Clone and run
Use **64-bit Windows 10/11**, an **NVIDIA GPU with a current WDDM driver**, and a terminal
@@ -67,7 +88,8 @@ skips the consistency check, so do not use it after changing dependencies.
## What you get
-- **Device view:** VRAM usage, GPU activity, memory activity, PCIe traffic, temperature, power and clocks.
+- **Device view:** VRAM usage, GPU activity, memory activity, PCIe traffic, temperature, power,
+ video-engine clock, and responsive history charts with an all-charts or single-metric view.
- **Process view:** local GPU memory, GPU-accessible system RAM, estimated non-resident commit,
engine activity, and detected runtimes such as CUDA, Vulkan, Direct3D, ggml and ONNX Runtime.
- **Model inspector:** which model each process holds (LLM, decision, embedding, speech, or diffusion), how
@@ -110,6 +132,7 @@ uv run --locked gputaskman --help
|---|---|
| Up / Down | Select a process and inspect it |
| `s` | Cycle sort: VRAM, GPU%, spill, paged, name |
+| `c` | Cycle all charts or a single metric (also available in the **Charts** dropdown) |
| `a` | Switch between top and all collected processes |
| `p` | Pause / resume collection |
| `?` | Explain the counters and their limits |
@@ -117,6 +140,12 @@ uv run --locked gputaskman --help
| `q` | Quit |
A wide terminal (roughly 140 columns or more) makes the full table easier to read.
+All eight history charts are shown by default: GPU, SM clock, VRAM, memory activity,
+temperature, power, encoder, and decoder. They stack in narrow terminals and share rows as
+the window widens. Click the **Charts** dropdown to focus on one metric or return to **All charts**.
+A blank sample means no reading; zero is drawn at the baseline. Percentages use a 0–100%
+scale, temperature uses 0–120°C, and the power and SM clock scales are displayed below the charts.
+The dashboard and inspector scroll independently in short terminals so the process list stays usable.
Model/runtime discovery is throttled, so newly loaded models may take about 15 seconds to appear.
`--gpu N` selects a detected NVIDIA graphics adapter, ordered by dedicated memory; an out-of-range
@@ -177,7 +206,7 @@ fallback and slower inference, but the counter alone cannot establish why it was
It is not an eviction trace, a pagefile measurement, or proof that Windows just moved
those bytes out of VRAM. The value is also less reliable when fallback counters are in use.
-Memory labels currently use `GB` / `MB` for binary units (GiB / MiB). The top-level `MemBW`
+Memory labels currently use `GB` / `MB` for binary units (GiB / MiB). The `Mem activity`
reading is NVML's memory-activity percentage, **not measured bandwidth in GB/s**.
## LLM and model support
@@ -323,6 +352,30 @@ uv build
The Windows CI runs hardware-independent checks on Python 3.11 and 3.13. Live GPU behavior
still needs a real Windows GPU; the CI does not pretend to validate that.
+### Building portable releases
+
+Use Python 3.13 of the **target architecture**. PyInstaller does not cross-compile: an x64
+Python process makes an x64 executable even when running under ARM64 emulation.
+
+```powershell
+uv sync --locked --group release --python 3.13
+uv run --locked --group release python tools\build_portable.py --arch x64
+# On a native ARM64 interpreter, use --arch arm64 instead.
+```
+
+The builder verifies the interpreter and executable architectures, includes Textual resources
+and dependency licenses, and writes the complete portable ZIP and SHA-256 file to `dist`.
+It does not bundle Windows/NVIDIA DLLs, inference servers, or models. Keep uv for development;
+the executable ZIP is for running the monitor without a Python environment.
+
+The **Portable Windows release** GitHub Actions workflow builds on `windows-2022` (x64) and
+`windows-11-arm` (ARM64). A manual run produces downloadable workflow artifacts without publishing
+a release. A pushed `vVERSION` tag must match `project.version` in `pyproject.toml`; once both builds
+pass, the workflow publishes both ZIPs and checksums together with generated release notes.
+Build jobs have read-only permissions; only the tag-triggered publish job can write releases.
+CI checks the extracted executable's `--help` outside the checkout with Python removed from `PATH`;
+interactive rendering and real GPU snapshots require local hardware testing.
+
To capture native SVG screenshots of your own running workloads:
```powershell
diff --git a/pyproject.toml b/pyproject.toml
index aa1e1c4..4a128bb 100644
--- a/pyproject.toml
+++ b/pyproject.toml
@@ -30,6 +30,9 @@ gtm = "gputaskman.cli:main"
Repository = "https://github.com/shanselman/gputaskman"
Issues = "https://github.com/shanselman/gputaskman/issues"
+[dependency-groups]
+release = ["pyinstaller==6.22.3"]
+
[build-system]
requires = ["uv_build>=0.9.26,<0.10.0"]
build-backend = "uv_build"
diff --git a/src/gputaskman/app.py b/src/gputaskman/app.py
index 78c7bc7..a4ceda3 100644
--- a/src/gputaskman/app.py
+++ b/src/gputaskman/app.py
@@ -12,14 +12,14 @@ from rich.text import Text
from textual import work
from textual.app import App, ComposeResult
from textual.binding import Binding
-from textual.containers import VerticalScroll
+from textual.containers import Horizontal, Vertical, VerticalScroll
from textual.screen import ModalScreen
-from textual.widgets import DataTable, Footer, Markdown, Static
+from textual.widgets import DataTable, Footer, Markdown, Select, Static
from textual.worker import get_current_worker
from .collector import Collector, ProcRow, Snapshot
from .llm import gb
-from .nvml import format_metric
+from .nvml import NvDevice, format_metric
KIND_STYLE = {
"LLM": "bold magenta", "decision": "bold orchid", "decision?": "orchid",
@@ -93,13 +93,24 @@ not necessarily current residency. A game's textures cannot be enumerated here.
**GPU%** = busiest engine (like Task Manager). On GeForce/WDDM, CUDA kernels are usually reported
on the **3D** engine.
-Keys: `↑/↓` select · `s` sort · `a` show all · `p` pause · `?` this help · `q` quit
+Keys: `↑/↓` select · `s` sort · `c` chart · `a` show all · `p` pause · `?` this help · `q` quit
+
+All eight trend charts are visible by default. They stack in narrow terminals and
+share rows when there is room. Click the **Charts** dropdown to show all charts or
+one metric; `c` cycles the same choices. A blank sample means no reading; zero is
+drawn at the baseline. Percentage charts use 0–100%, temperature uses 0–120°C,
+and the power and SM clock scales are shown below the charts. In short terminals,
+scroll the dashboard or inspector without losing the process list.
"""
def spark(values, width: int = 30, top: float = 100.0) -> str:
vals = list(values)[-width:]
- return "".join(SPARK[min(int(v / top * (len(SPARK) - 1) + 0.5), len(SPARK) - 1)] if v else " " for v in vals)
+ return "".join(
+ SPARK[min(max(int(v / top * (len(SPARK) - 1) + 0.5), 0), len(SPARK) - 1)]
+ if v is not None else " "
+ for v in vals
+ )
def stacked_bar(parts: list[tuple[float, str]], total: float, width: int) -> Text:
@@ -131,13 +142,22 @@ class GpuTaskManager(App):
TITLE = "gputaskman"
CSS = """
Screen { layout: vertical; }
+ #dashboard { height: auto; max-height: 50%; }
#device { height: auto; border: round $accent; padding: 0 1; }
- #procs { height: 1fr; min-height: 8; }
- #inspector { height: auto; max-height: 55%; border: round $secondary; padding: 0 1; }
+ #history { height: auto; border: round $secondary; padding: 0 1; }
+ #chart-controls { height: 1; }
+ #chart-label { width: 8; text-style: bold; }
+ #chart-mode { width: 24; }
+ #chart-hint { width: 1fr; color: $text-muted; }
+ #charts { height: auto; }
+ #chart-note { height: auto; color: $text-muted; }
+ #procs { height: 1fr; min-height: 4; }
+ #inspector { height: auto; max-height: 30%; overflow-y: auto; border: round $secondary; padding: 0 1; }
"""
BINDINGS = [
Binding("q", "quit", "Quit"),
Binding("s", "cycle_sort", "Sort"),
+ Binding("c", "cycle_chart", "Chart"),
Binding("a", "toggle_all", "All/Top"),
Binding("p", "pause", "Pause"),
Binding("question_mark", "help", "Explain"),
@@ -145,6 +165,17 @@ class GpuTaskManager(App):
SORTS = [("VRAM", lambda r: -r.gpu.dedicated), ("GPU%", lambda r: -r.gpu.gpu_pct),
("spill", lambda r: -r.gpu.shared), ("paged", lambda r: -r.gpu.paged_out),
("name", lambda r: r.name.lower())]
+ CHART_COLORS = {
+ "GPU": "#4ade80",
+ "SM clock": "#fb923c",
+ "VRAM": "#60a5fa",
+ "Mem activity": "#a78bfa",
+ "Temperature": "#ef4444",
+ "Power": "#facc15",
+ "Encoder": "#e2e8f0",
+ "Decoder": "#22d3ee",
+ }
+ CHARTS = tuple(CHART_COLORS)
def __init__(self, gpu_index: int = 0, interval: float = 1.0) -> None:
super().__init__()
@@ -156,12 +187,29 @@ class GpuTaskManager(App):
self.show_all = False
self.paused = False
self.hist_util: deque = deque(maxlen=60)
+ self.hist_clock: deque = deque(maxlen=60)
self.hist_bw: deque = deque(maxlen=60)
self.hist_vram: deque = deque(maxlen=60)
+ self.hist_temp: deque = deque(maxlen=60)
+ self.hist_power: deque = deque(maxlen=60)
+ self.hist_enc: deque = deque(maxlen=60)
+ self.hist_dec: deque = deque(maxlen=60)
+ self.chart_idx = -1
self._auto_selected = False
def compose(self) -> ComposeResult:
- yield Static("Sampling GPU counters...", id="device")
+ with VerticalScroll(id="dashboard"):
+ yield Static("Sampling GPU counters...", id="device")
+ with Vertical(id="history"):
+ with Horizontal(id="chart-controls"):
+ yield Static("Charts", id="chart-label")
+ yield Select(
+ [("All charts", -1), *((name, index) for index, name in enumerate(self.CHARTS))],
+ value=-1, allow_blank=False, compact=True, id="chart-mode",
+ )
+ yield Static("Click to choose · c cycles", id="chart-hint")
+ yield Static(id="charts")
+ yield Static(id="chart-note")
table = DataTable(id="procs", cursor_type="row", zebra_stripes=True)
yield table
yield Static("", id="inspector")
@@ -171,6 +219,7 @@ class GpuTaskManager(App):
t = self.query_one("#procs", DataTable)
for col in ("PID", "Process", "Kind", "Runtime", "VRAM", "Spill", "Paged", "GPU%", "3D", "Copy", "Video", "What's inside"):
t.add_column(col, key=col)
+ t.focus()
self.poll()
@work(thread=True, exclusive=True)
@@ -194,14 +243,24 @@ class GpuTaskManager(App):
nv = snap.nv
if nv:
self.hist_util.append(nv.util_gpu)
+ self.hist_clock.append(nv.sm_clock)
self.hist_bw.append(nv.util_mem)
- self.hist_vram.append(100 * snap.vram_used / snap.vram_total if snap.vram_total else 0)
+ self.hist_temp.append(nv.temp)
+ self.hist_power.append(nv.power_w)
+ self.hist_enc.append(nv.enc)
+ self.hist_dec.append(nv.dec)
+ else:
+ for history in (self.hist_util, self.hist_clock, self.hist_bw, self.hist_temp,
+ self.hist_power, self.hist_enc, self.hist_dec):
+ history.append(None)
+ self.hist_vram.append(100 * snap.vram_used / snap.vram_total if snap.vram_total else None)
if not self._auto_selected:
llm = next((r for r in sorted(snap.procs, key=lambda r: -r.gpu.dedicated) if r.llm), None)
if llm:
self.selected_pid = llm.pid
self._auto_selected = True
self.query_one("#device", Static).update(self.render_device(snap))
+ self.render_charts()
self.render_table(snap)
self.render_inspector()
@@ -246,12 +305,8 @@ class GpuTaskManager(App):
tx = nv.pcie_tx_kbs / 1024 if nv.pcie_tx_kbs is not None else None
pstate = f"P{nv.pstate}" if nv.pstate is not None else "P N/A"
m = Text()
- m.append("GPU ", style="bold")
- m.append(f"{format_metric(nv.util_gpu, unit='%'):>4} ", style="bold green")
- m.append(spark(self.hist_util, 24), style="green")
- m.append(" MemBW ", style="bold")
- m.append(f"{format_metric(nv.util_mem, unit='%'):>4} ", style="bold dark_orange")
- m.append(spark(self.hist_bw, 24), style="dark_orange")
+ m.append(f"GPU {format_metric(nv.util_gpu, unit='%')}", style=f"bold {self.CHART_COLORS['GPU']}")
+ m.append(f" Mem activity {format_metric(nv.util_mem, unit='%')}", style=self.CHART_COLORS["Mem activity"])
m.append(f" PCIe↓{format_metric(rx, '.0f'):>5} ↑{format_metric(tx, '.0f'):>4} MB/s")
if nv.enc or nv.dec:
m.append(f" enc {format_metric(nv.enc, unit='%')} dec {format_metric(nv.dec, unit='%')}")
@@ -259,7 +314,7 @@ class GpuTaskManager(App):
st = Text(f"{format_metric(nv.temp, unit='°C')} {format_metric(nv.power_w, '.0f')}/"
f"{format_metric(nv.power_limit_w, '.0f')} W {pstate} "
f"SM {format_metric(nv.sm_clock)}/{format_metric(nv.sm_clock_max)} MHz "
- f"mem {format_metric(nv.mem_clock)} MHz "
+ f"mem {format_metric(nv.mem_clock)} MHz video {format_metric(nv.video_clock)} MHz "
f"PCIe gen{format_metric(nv.pcie_gen)} x{format_metric(nv.pcie_width)} "
f"CC {nv.compute_cap or 'N/A'}", style="grey70")
if nv.throttle:
@@ -267,6 +322,64 @@ class GpuTaskManager(App):
lines.append(st)
return Group(*lines)
+ def chart_series(self, index: int, nv: NvDevice | None) -> tuple[deque, float, str, str]:
+ chart = self.CHARTS[index]
+ color = self.CHART_COLORS[chart]
+ if chart == "GPU":
+ return self.hist_util, 100, "%", color
+ if chart == "SM clock":
+ values = [value for value in self.hist_clock if value is not None]
+ scale = max((nv.sm_clock_max if nv else None) or 0, max(values, default=0), 1)
+ return self.hist_clock, scale, " MHz", color
+ if chart == "VRAM":
+ return self.hist_vram, 100, "%", color
+ if chart == "Mem activity":
+ return self.hist_bw, 100, "%", color
+ if chart == "Temperature":
+ return self.hist_temp, 120, "°C", color
+ if chart == "Power":
+ values = [value for value in self.hist_power if value is not None]
+ scale = max((nv.power_limit_w if nv else None) or 0, max(values, default=0), 1)
+ return self.hist_power, scale, " W", color
+ if chart == "Encoder":
+ return self.hist_enc, 100, "%", color
+ return self.hist_dec, 100, "%", color
+
+ def render_charts(self) -> None:
+ if self.snap is None:
+ return
+ widget = self.query_one("#charts", Static)
+ # Reserve the border, padding, and scrollbar even before child resize events arrive.
+ width = max(1, self.size.width - 6)
+ indices = list(range(len(self.CHARTS))) if self.chart_idx == -1 else [self.chart_idx]
+ columns = min(len(indices), 3, max(1, (width + 2) // 46))
+ cell_width = max(1, (width - 2 * (columns - 1)) // columns)
+ grid = Table.grid(padding=(0, 2), pad_edge=False, expand=True)
+ for _ in range(columns):
+ grid.add_column(width=cell_width, no_wrap=True, overflow="crop")
+ cells = []
+ for index in indices:
+ values, scale, unit, style = self.chart_series(index, self.snap.nv)
+ current = values[-1] if values else None
+ cell = Text(f"{self.CHARTS[index]:<12} ", style=style)
+ cell.append(f"{format_metric(current, '.0f', unit):>8} ", style="bold")
+ cell.append(spark(values, max(1, cell_width - 22), scale))
+ cells.append(cell)
+ for start in range(0, len(cells), columns):
+ grid.add_row(*cells[start:start + columns])
+ widget.update(grid)
+ _, power_scale, _, _ = self.chart_series(self.CHARTS.index("Power"), self.snap.nv)
+ _, clock_scale, _, _ = self.chart_series(self.CHARTS.index("SM clock"), self.snap.nv)
+ self.query_one("#chart-note", Static).update(
+ f"Recent samples · blank = no reading · power 0–{power_scale:.0f} W · "
+ f"SM clock 0–{clock_scale:.0f} MHz"
+ )
+
+ def on_resize(self) -> None:
+ if self.is_mounted and self.snap is not None:
+ self.query_one("#device", Static).update(self.render_device(self.snap))
+ self.call_after_refresh(self.render_charts)
+
def visible_rows(self, s: Snapshot) -> list[ProcRow]:
rows = s.procs
if not self.show_all:
@@ -404,6 +517,14 @@ class GpuTaskManager(App):
if self.snap:
self.render_table(self.snap)
+ def action_cycle_chart(self) -> None:
+ self.query_one("#chart-mode", Select).value = (self.chart_idx + 2) % (len(self.CHARTS) + 1) - 1
+
+ def on_select_changed(self, event: Select.Changed) -> None:
+ if event.select.id == "chart-mode" and isinstance(event.value, int):
+ self.chart_idx = event.value
+ self.render_charts()
+
def action_toggle_all(self) -> None:
self.show_all = not self.show_all
if self.snap:
diff --git a/src/gputaskman/nvml.py b/src/gputaskman/nvml.py
index d2f9442..46e8c52 100644
--- a/src/gputaskman/nvml.py
+++ b/src/gputaskman/nvml.py
@@ -31,6 +31,7 @@ class NvDevice:
sm_clock: int | None = None
sm_clock_max: int | None = None
mem_clock: int | None = None
+ video_clock: int | None = None
pcie_rx_kbs: int | None = None # host -> GPU
pcie_tx_kbs: int | None = None # GPU -> host
pcie_gen: int | None = None
@@ -112,6 +113,7 @@ class Nvml:
d.sm_clock = _try(N.nvmlDeviceGetClockInfo, h, N.NVML_CLOCK_SM)
d.sm_clock_max = _try(N.nvmlDeviceGetMaxClockInfo, h, N.NVML_CLOCK_SM)
d.mem_clock = _try(N.nvmlDeviceGetClockInfo, h, N.NVML_CLOCK_MEM)
+ d.video_clock = _try(N.nvmlDeviceGetClockInfo, h, N.NVML_CLOCK_VIDEO)
d.pcie_rx_kbs = _try(N.nvmlDeviceGetPcieThroughput, h, N.NVML_PCIE_UTIL_RX_BYTES)
d.pcie_tx_kbs = _try(N.nvmlDeviceGetPcieThroughput, h, N.NVML_PCIE_UTIL_TX_BYTES)
d.pcie_gen = _try(N.nvmlDeviceGetCurrPcieLinkGeneration, h)
diff --git a/src/gputaskman/report.py b/src/gputaskman/report.py
index 7030ea6..9aae91b 100644
--- a/src/gputaskman/report.py
+++ b/src/gputaskman/report.py
@@ -61,7 +61,9 @@ def to_text(s: Snapshot, limit: int = 30) -> str:
out.append(f"GPU {format_metric(nv.util_gpu, unit='%')} mem-bandwidth {format_metric(nv.util_mem, unit='%')} "
f"{format_metric(nv.temp, unit='C')} {format_metric(nv.power_w, '.0f')}/"
f"{format_metric(nv.power_limit_w, '.0f')} W {pstate} "
- f"SM {format_metric(nv.sm_clock)} MHz PCIe rx {format_metric(rx, '.0f')} MB/s "
+ f"SM {format_metric(nv.sm_clock)} MHz "
+ f"video {format_metric(nv.video_clock)} MHz "
+ f"PCIe rx {format_metric(rx, '.0f')} MB/s "
f"tx {format_metric(tx, '.0f')} MB/s")
out.append("")
out.append(f"{'PID':>7} {'PROCESS':<24} {'KIND':<10} {'RUNTIME':<24} {'VRAM':>9} {'SPILL':>8} {'PAGED':>8} {'GPU%':>5} INSIDE")
diff --git a/tests/test_core.py b/tests/test_core.py
index 74131ab..6792f8d 100644
--- a/tests/test_core.py
+++ b/tests/test_core.py
@@ -4,20 +4,25 @@ import contextlib
import io
import json
import os
+from types import SimpleNamespace
import tempfile
import unittest
import xml.etree.ElementTree as ET
from pathlib import Path
from unittest.mock import patch
-from gputaskman.app import GpuTaskManager
+from rich.console import Console
+from rich.table import Table
+from textual.widgets import Footer, Select, Static
+
+from gputaskman.app import GpuTaskManager, spark
from gputaskman.cli import main
from gputaskman.collector import ProcRow, Snapshot, select_adapter, select_nv_device
from gputaskman.dxgi import Adapter
from gputaskman.gguf import GgufInfo, read_gguf
from gputaskman.llm import (LlmView, ServerInfo, build_view, is_gpu_device, llama_server_models, lmstudio_models,
parse_flags, parse_load_log, probe_server)
-from gputaskman.nvml import NvDevice
+from gputaskman.nvml import NvDevice, Nvml
from gputaskman.pdh import GpuCounters, ProcGpu
from gputaskman.procinfo import (AI_KINDS, MappedModel, ProcDetail, ProcInspector, _is_model_file,
_models_from_cmdline, classify, installed_models, make_model)
@@ -139,15 +144,65 @@ class MemoryTests(unittest.TestCase):
def test_text_shows_unavailable_device_metrics_without_fabricating_zeroes(self):
s = snapshot()
- s.nv = NvDevice(index=0, util_gpu=0, power_w=2.4, pcie_tx_kbs=0)
+ s.nv = NvDevice(index=0, util_gpu=0, power_w=2.4, pcie_tx_kbs=0, video_clock=656)
text = to_text(s)
self.assertIn("GPU 0%", text)
self.assertIn("mem-bandwidth N/A", text)
self.assertIn("2/N/A W", text)
self.assertIn("P N/A", text)
+ self.assertIn("video 656 MHz", text)
self.assertIn("PCIe rx N/A MB/s tx 0 MB/s", text)
self.assertNotIn("None", text.splitlines()[2])
self.assertIsNone(to_dict(s)["device"]["power_limit_w"])
+ self.assertEqual(to_dict(s)["device"]["video_clock"], 656)
+
+ def test_video_clock_is_optional_nvml_metric(self):
+ memory = SimpleNamespace(total=16 * GiB, used=GiB, reserved=0)
+ clock_calls = []
+
+ def clock_info(_handle, clock):
+ clock_calls.append(clock)
+ if clock == 8:
+ return 656
+ raise RuntimeError("unsupported")
+
+ api = SimpleNamespace(
+ NVML_CLOCK_SM=1, NVML_CLOCK_MEM=2, NVML_CLOCK_VIDEO=8,
+ NVML_TEMPERATURE_GPU=0, nvmlMemory_v2=object(),
+ NVML_PCIE_UTIL_RX_BYTES=0, NVML_PCIE_UTIL_TX_BYTES=1,
+ nvmlInit=lambda: None, nvmlShutdown=lambda: None,
+ nvmlSystemGetDriverVersion=lambda: "621.01",
+ nvmlSystemGetCudaDriverVersion_v2=lambda: None,
+ nvmlSystemGetCudaDriverVersion=lambda: None,
+ nvmlDeviceGetCount=lambda: 1, nvmlDeviceGetHandleByIndex=lambda _i: "gpu",
+ nvmlDeviceGetName=lambda _h: "NVIDIA test GPU",
+ nvmlDeviceGetPciInfo=lambda _h: SimpleNamespace(busId=b"0000:01:00.0"),
+ nvmlDeviceGetDriverModel=lambda _h: (0, 0),
+ nvmlDeviceGetMemoryInfo=lambda *_args: memory,
+ nvmlDeviceGetUtilizationRates=lambda _h: None,
+ nvmlDeviceGetEncoderUtilization=lambda _h: None,
+ nvmlDeviceGetDecoderUtilization=lambda _h: None,
+ nvmlDeviceGetTemperature=lambda *_args: None,
+ nvmlDeviceGetPowerUsage=lambda _h: None,
+ nvmlDeviceGetEnforcedPowerLimit=lambda _h: None,
+ nvmlDeviceGetFanSpeed=lambda _h: None,
+ nvmlDeviceGetPerformanceState=lambda _h: None,
+ nvmlDeviceGetClockInfo=clock_info,
+ nvmlDeviceGetMaxClockInfo=lambda *_args: None,
+ nvmlDeviceGetPcieThroughput=lambda *_args: None,
+ nvmlDeviceGetCurrPcieLinkGeneration=lambda _h: None,
+ nvmlDeviceGetCurrPcieLinkWidth=lambda _h: None,
+ nvmlDeviceGetCurrentClocksEventReasons=lambda _h: None,
+ nvmlDeviceGetCurrentClocksThrottleReasons=lambda _h: None,
+ nvmlDeviceGetCudaComputeCapability=lambda _h: None,
+ )
+ with patch("gputaskman.nvml.N", api):
+ nvml = Nvml()
+ device = nvml.sample()[0]
+ nvml.close()
+ self.assertEqual(device.video_clock, 656)
+ self.assertIn(api.NVML_CLOCK_VIDEO, clock_calls)
+ self.assertIsNone(device.mem_clock)
def test_capture_does_not_change_original_or_publish_command_line(self):
original = snapshot()
@@ -516,7 +571,65 @@ class IdentityTests(unittest.TestCase):
self.assertEqual(model.sources, ["cmdline"])
+class ChartTests(unittest.TestCase):
+ def test_spark_distinguishes_zero_from_missing_and_clamps_values(self):
+ self.assertEqual(spark([None, 0, 50, 100], 4), " ▁▅█")
+ self.assertEqual(spark([-10, 200], 2), "▁█")
+ self.assertEqual(spark([100, None, 0], 2), " ▁")
+
+ def test_chart_palette_uses_distinct_explicit_colors_consistently(self):
+ app = GpuTaskManager()
+ colors = app.CHART_COLORS
+ self.assertEqual(len(set(colors.values())), len(app.CHARTS))
+ for index, name in enumerate(app.CHARTS):
+ self.assertRegex(colors[name], r"^#[0-9a-f]{6}$")
+ self.assertEqual(app.chart_series(index, None)[3], colors[name])
+ s = snapshot()
+ s.nv = NvDevice(index=0, util_gpu=0, util_mem=0)
+ metrics = next(line for line in app.render_device(s).renderables if "Mem activity" in line.plain)
+ self.assertTrue(any(span.style == colors["Mem activity"] for span in metrics.spans))
+
+
class UiTests(unittest.IsolatedAsyncioTestCase):
+ def chart_text(self, app):
+ widget = app.query_one("#charts", Static)
+ output = io.StringIO()
+ Console(file=output, width=widget.content_size.width, color_system=None).print(widget.content)
+ return output.getvalue()
+
+ async def test_eighth_chart_records_sm_clock_with_scale_and_missing_readings(self):
+ with patch.object(GpuTaskManager, "poll"):
+ app = GpuTaskManager()
+ async with app.run_test(size=(117, 59)) as pilot:
+ self.assertEqual(len(app.CHARTS), 8)
+ index = app.CHARTS.index("SM clock")
+ s = snapshot()
+ s.nv = NvDevice(index=0, sm_clock=1500, sm_clock_max=3003)
+ app.apply(s)
+ await pilot.pause()
+ self.assertIn("1500 MHz", self.chart_text(app))
+ self.assertIn("SM clock 0–3003 MHz", str(app.query_one("#chart-note", Static).content))
+ self.assertEqual(app.chart_series(index, s.nv)[1:3], (3003, " MHz"))
+ self.assertEqual(len(app.query_one("#charts", Static).content.rows), 4)
+
+ s.nv.sm_clock = 0
+ app.apply(s)
+ s.nv.sm_clock = None
+ s.nv.sm_clock_max = None
+ app.apply(s)
+ self.assertEqual(list(app.hist_clock), [1500, 0, None])
+ self.assertEqual(app.chart_series(index, s.nv)[1], 1500)
+ app.query_one("#chart-mode", Select).value = index
+ await pilot.pause()
+ self.assertIn("N/A", self.chart_text(app))
+ self.assertIn("█▁ ", self.chart_text(app))
+
+ s.nv = None
+ app.apply(s)
+ self.assertEqual(list(app.hist_clock), [1500, 0, None, None])
+ app.hist_clock.clear()
+ self.assertEqual(app.chart_series(index, None)[1], 1)
+
async def test_unavailable_device_metrics_render_as_na(self):
with patch.object(GpuTaskManager, "poll"):
app = GpuTaskManager()
@@ -532,6 +645,116 @@ class UiTests(unittest.IsolatedAsyncioTestCase):
self.assertIsNone(app.hist_util[-1])
self.assertEqual(app.hist_bw[-1], 0)
+ async def test_chart_cycle_shows_selected_metric_and_preserves_gaps(self):
+ with patch.object(GpuTaskManager, "poll"):
+ app = GpuTaskManager()
+ async with app.run_test(size=(180, 42)) as pilot:
+ s = snapshot()
+ s.nv = NvDevice(index=0, util_gpu=50, util_mem=0, temp=49, power_w=72,
+ power_limit_w=150, enc=None, dec=0, video_clock=656)
+ app.apply(s)
+ await pilot.pause()
+ self.assertEqual(app.chart_idx, -1)
+ self.assertEqual(app.query_one("#chart-mode", Select).value, -1)
+ for name in app.CHARTS:
+ self.assertIn(name, self.chart_text(app))
+ for expected in app.CHARTS:
+ await pilot.press("c")
+ await pilot.pause()
+ self.assertEqual(app.CHARTS[app.chart_idx], expected)
+ rendered = self.chart_text(app)
+ self.assertIn(expected, rendered)
+ self.assertEqual(len(app.query_one("#charts", Static).content.columns), 1)
+ if expected == "Encoder":
+ self.assertIn("N/A", rendered)
+ screenshot = ET.fromstring(app.export_screenshot())
+ self.assertIn("Encoder", "".join(screenshot.itertext()))
+ await pilot.press("c")
+ self.assertEqual(app.chart_idx, -1)
+ device = "\n".join(line.plain for line in app.render_device(s).renderables)
+ self.assertIn("video 656 MHz", device)
+ self.assertIsNone(app.hist_enc[-1])
+ self.assertEqual(app.hist_dec[-1], 0)
+ self.assertIn("0%", rendered)
+ self.assertIn("▁", rendered)
+
+ async def test_chart_dropdown_is_clickable_and_keyboard_accessible(self):
+ with patch.object(GpuTaskManager, "poll"):
+ app = GpuTaskManager()
+ async with app.run_test(size=(117, 59)) as pilot:
+ app.apply(snapshot())
+ await pilot.pause()
+ self.assertIs(app.focused, app.query_one("#procs"))
+ await pilot.click("#chart-mode", offset=(2, 0))
+ selector = app.query_one("#chart-mode", Select)
+ self.assertTrue(selector.expanded)
+ await pilot.press("down", "down", "enter")
+ await pilot.pause()
+ self.assertEqual(selector.value, 1)
+ self.assertEqual(app.chart_idx, 1)
+ self.assertIn(app.CHARTS[1], self.chart_text(app))
+ await pilot.press("enter", "home", "enter")
+ await pilot.pause()
+ self.assertEqual(selector.value, -1)
+ for name in app.CHARTS:
+ self.assertIn(name, self.chart_text(app))
+
+ async def test_chart_layout_reflows_while_paused_and_keeps_processes_visible(self):
+ with patch.object(GpuTaskManager, "poll"):
+ app = GpuTaskManager()
+ async with app.run_test(size=(180, 50)) as pilot:
+ s = snapshot()
+ s.nv = NvDevice(index=0, util_gpu=50, temp=49, power_w=200, power_limit_w=150)
+ app.apply(s)
+ await pilot.pause()
+ await pilot.press("down", "p")
+ history = list(app.hist_util)
+ for width, height, columns in ((180, 50, 3), (117, 59, 2), (80, 40, 1),
+ (60, 24, 1), (80, 24, 1), (180, 50, 3)):
+ with self.subTest(width=width, height=height):
+ await pilot.resize_terminal(width, height)
+ await pilot.pause()
+ grid = app.query_one("#charts", Static).content
+ self.assertIsInstance(grid, Table)
+ self.assertEqual(len(grid.columns), columns)
+ self.assertEqual(len(grid.rows), (len(app.CHARTS) + columns - 1) // columns)
+ self.assertEqual(list(app.hist_util), history)
+ self.assertEqual(app.selected_pid, 20)
+ self.assertTrue(app.paused)
+ processes = app.query_one("#procs")
+ footer = app.query_one(Footer)
+ self.assertGreaterEqual(processes.region.height, 4)
+ self.assertLessEqual(processes.region.bottom, footer.region.y)
+ self.assertLessEqual(app.query_one("#inspector").region.bottom, footer.region.y)
+ self.assertLessEqual(footer.region.bottom, height)
+ for name in app.CHARTS:
+ self.assertIn(name, self.chart_text(app))
+ if height == 24:
+ dashboard = app.query_one("#dashboard")
+ self.assertGreater(dashboard.max_scroll_y, 0)
+ dashboard.scroll_end(animate=False)
+ await pilot.pause()
+ screenshot = "".join(ET.fromstring(app.export_screenshot()).itertext())
+ self.assertIn("Decoder", screenshot)
+ if width == 60:
+ note = app.query_one("#chart-note", Static)
+ self.assertGreaterEqual(note.region.height, 2)
+ self.assertIn("0–200 W", str(app.query_one("#chart-note", Static).content))
+
+ async def test_all_charts_work_without_nvml_or_vram_capacity(self):
+ with patch.object(GpuTaskManager, "poll"):
+ app = GpuTaskManager()
+ async with app.run_test(size=(117, 59)) as pilot:
+ s = snapshot()
+ s.vram_total = 0
+ app.apply(s)
+ await pilot.pause()
+ self.assertIsNone(app.hist_vram[-1])
+ self.assertIsNone(app.hist_util[-1])
+ rendered = self.chart_text(app)
+ self.assertEqual(rendered.count("N/A"), len(app.CHARTS))
+ self.assertNotIn("▁", rendered)
+
async def test_likely_kind_is_explicit_in_process_and_inspector(self):
g = gguf("qwen35", block_count=2, context_length=4096, **{"general.name": "Snapshot_Cfg"})
with patch.object(GpuTaskManager, "poll"):
diff --git a/tests/test_portable.py b/tests/test_portable.py
new file mode 100644
index 0000000..e400a43
--- /dev/null
+++ b/tests/test_portable.py
@@ -0,0 +1,83 @@
+from pathlib import Path
+import struct
+import tempfile
+import unittest
+import zipfile
+import hashlib
+
+from tools.build_portable import architecture, check_executable, create_archive, nvidia_license, validate_version
+
+
+class PortableTests(unittest.TestCase):
+ def write_executable(self, path, machine):
+ header = bytearray(64)
+ header[:2] = b"MZ"
+ struct.pack_into("<I", header, 60, 64)
+ path.write_bytes(header + b"PE\0\0" + struct.pack("<H", machine))
+
+ def test_interpreter_architecture_not_host_architecture(self):
+ self.assertEqual(architecture("win-amd64"), "x64")
+ self.assertEqual(architecture("win-arm64"), "arm64")
+ with self.assertRaises(ValueError):
+ architecture("win32")
+
+ def test_version_and_tag(self):
+ validate_version("0.1.0", "v0.1.0")
+ with self.assertRaises(ValueError):
+ validate_version("0.1.0", "v0.2.0")
+ with self.assertRaises(ValueError):
+ validate_version("..\\outside")
+
+ def test_inline_nvidia_license_is_preserved(self):
+ notice = "#####\n# Copyright Example\n# Redistribution and use are permitted.\n#####\n"
+ self.assertEqual(nvidia_license(notice + "import ctypes\n"), notice)
+ with self.assertRaises(ValueError):
+ nvidia_license("import ctypes\n")
+
+ def test_executable_machine(self):
+ with tempfile.TemporaryDirectory() as temporary:
+ exe = Path(temporary) / "gputaskman.exe"
+ for arch, machine in [("x64", 0x8664), ("arm64", 0xAA64)]:
+ self.write_executable(exe, machine)
+ check_executable(exe, arch)
+ with self.assertRaises(ValueError):
+ check_executable(exe, "x64")
+ exe.write_bytes(b"not an exe")
+ with self.assertRaises(ValueError):
+ check_executable(exe, "x64")
+
+ def test_archive_includes_complete_runtime_and_checksum(self):
+ with tempfile.TemporaryDirectory() as temporary:
+ root = Path(temporary)
+ bundle = root / "bundle"
+ (bundle / "_internal").mkdir(parents=True)
+ self.write_executable(bundle / "gputaskman.exe", 0x8664)
+ (bundle / "_internal" / "data.css").write_text("resource", encoding="utf-8")
+ install_metadata = bundle / "_internal" / "gputaskman-0.1.0.dist-info"
+ install_metadata.mkdir()
+ (install_metadata / "direct_url.json").write_text(
+ '{"url": "file:///private-build-path"}', encoding="utf-8",
+ )
+ archive = create_archive(bundle, root / "output", "0.1.0", "x64")
+ with zipfile.ZipFile(archive) as zipped:
+ self.assertEqual(set(zipped.namelist()), {
+ "gputaskman-0.1.0-windows-x64/gputaskman.exe",
+ "gputaskman-0.1.0-windows-x64/_internal/data.css",
+ })
+ expected = hashlib.sha256(archive.read_bytes()).hexdigest()
+ self.assertEqual(
+ archive.with_suffix(".zip.sha256").read_text(encoding="utf-8"),
+ f"{expected} {archive.name}\n",
+ )
+
+ def test_archive_rejects_driver_dlls(self):
+ with tempfile.TemporaryDirectory() as temporary:
+ root = Path(temporary)
+ self.write_executable(root / "gputaskman.exe", 0xAA64)
+ (root / "NVML.dll").write_bytes(b"driver")
+ with self.assertRaisesRegex(ValueError, "must not be distributed"):
+ create_archive(root, root / "output", "0.1.0", "arm64")
+
+
+if __name__ == "__main__":
+ unittest.main()
diff --git a/tools/build_portable.py b/tools/build_portable.py
new file mode 100644
index 0000000..fd70cce
--- /dev/null
+++ b/tools/build_portable.py
@@ -0,0 +1,162 @@
+"""Build a native Windows console executable and ZIP its complete runtime."""
+
+from __future__ import annotations
+
+import argparse
+import hashlib
+from importlib import metadata
+from pathlib import Path
+import re
+import shutil
+import struct
+import subprocess
+import sys
+import sysconfig
+import tempfile
+import tomllib
+import zipfile
+
+
+ROOT = Path(__file__).resolve().parents[1]
+MACHINES = {"x64": 0x8664, "arm64": 0xAA64}
+
+
+def architecture(platform_tag: str) -> str:
+ platforms = {"win-amd64": "x64", "win-arm64": "arm64"}
+ if platform_tag not in platforms:
+ raise ValueError(f"Unsupported build interpreter: {platform_tag}")
+ return platforms[platform_tag]
+
+
+def validate_version(version: str, tag: str | None = None) -> None:
+ if not re.fullmatch(r"[A-Za-z0-9][A-Za-z0-9.+-]*", version):
+ raise ValueError(f"Unsafe package version: {version!r}")
+ if tag is not None and tag != f"v{version}":
+ raise ValueError(f"Release tag {tag!r} must match package version v{version}")
+
+
+def check_executable(path: Path, arch: str) -> None:
+ with path.open("rb") as binary:
+ header = binary.read(64)
+ if len(header) != 64 or header[:2] != b"MZ":
+ raise ValueError(f"Not a Windows executable: {path}")
+ binary.seek(struct.unpack_from("<I", header, 60)[0])
+ pe = binary.read(6)
+ if len(pe) != 6 or pe[:4] != b"PE\0\0":
+ raise ValueError(f"Invalid PE header: {path}")
+ machine = struct.unpack_from("<H", pe, 4)[0]
+ if machine != MACHINES[arch]:
+ raise ValueError(f"Expected {arch} PE machine {MACHINES[arch]:#06x}, got {machine:#06x}")
+
+
+def create_archive(bundle: Path, output: Path, version: str, arch: str) -> Path:
+ validate_version(version)
+ check_executable(bundle / "gputaskman.exe", arch)
+ forbidden = {"nvml.dll", "nvcuda.dll", "dxgi.dll", "pdh.dll"}
+ # Editable-install origins contain build-machine paths and are not needed at runtime.
+ files = sorted(
+ path for path in bundle.rglob("*")
+ if path.is_file()
+ and not (path.name == "direct_url.json" and path.parent.name.endswith(".dist-info"))
+ )
+ for path in files:
+ if path.name.lower() in forbidden:
+ raise ValueError(f"Driver/system DLL must not be distributed: {path}")
+ name = f"gputaskman-{version}-windows-{arch}"
+ output.mkdir(parents=True, exist_ok=True)
+ archive = output / f"{name}.zip"
+ with zipfile.ZipFile(archive, "w", compression=zipfile.ZIP_DEFLATED) as zipped:
+ for path in files:
+ zipped.write(path, Path(name) / path.relative_to(bundle))
+ with archive.open("rb") as packaged:
+ digest = hashlib.file_digest(packaged, "sha256").hexdigest()
+ archive.with_suffix(".zip.sha256").write_text(f"{digest} {archive.name}\n", encoding="utf-8")
+ return archive
+
+
+def nvidia_license(source: str) -> str:
+ header, boundary, _ = source.partition("\n#####\n")
+ if not boundary or "Redistribution and use" not in header or "Copyright" not in header:
+ raise ValueError("NVIDIA Python bindings' inline license was not found")
+ return header + boundary
+
+
+def add_notices(bundle: Path) -> None:
+ shutil.copy2(ROOT / "LICENSE", bundle / "LICENSE")
+ shutil.copy2(Path(sys.base_prefix) / "LICENSE.txt", bundle / "PYTHON-LICENSE.txt")
+ installer = metadata.distribution("pyinstaller")
+ license_files = [
+ path for path in installer.files or ()
+ if path.name.lower() in {"copying.txt", "license", "license.txt"}
+ ]
+ if not license_files:
+ raise RuntimeError("PyInstaller's bootloader license was not found")
+ notices = bundle / "licenses" / "pyinstaller"
+ notices.mkdir(parents=True)
+ for path in license_files:
+ shutil.copy2(installer.locate_file(path), notices / path.name)
+ nvml = metadata.distribution("nvidia-ml-py")
+ nvml_notices = bundle / "licenses" / "nvidia-ml-py"
+ nvml_notices.mkdir(parents=True)
+ (nvml_notices / "LICENSE.txt").write_text(
+ nvidia_license(nvml.locate_file("pynvml.py").read_text(encoding="utf-8")),
+ encoding="utf-8",
+ )
+ (bundle / "THIRD-PARTY-NOTICES.txt").write_text(
+ "Python: see PYTHON-LICENSE.txt.\n"
+ "PyInstaller bootloader: see licenses\\pyinstaller (including its exception).\n"
+ "NVIDIA Python bindings: see licenses\\nvidia-ml-py.\n"
+ "Runtime package metadata and license texts are included in _internal\\*.dist-info.\n"
+ "NVIDIA and Windows DLLs are provided by the installed driver and operating system.\n",
+ encoding="utf-8",
+ )
+
+
+def build(output: Path, arch: str, tag: str | None = None) -> Path:
+ actual = architecture(sysconfig.get_platform())
+ if actual != arch:
+ raise ValueError(f"Requested {arch}, but this Python interpreter is {actual}")
+ version = tomllib.loads((ROOT / "pyproject.toml").read_text(encoding="utf-8"))["project"]["version"]
+ validate_version(version, tag)
+ with tempfile.TemporaryDirectory(prefix=f"gputaskman-{arch}-") as temporary:
+ work = Path(temporary)
+ subprocess.run(
+ [
+ sys.executable, "-m", "PyInstaller", "--noconfirm", "--clean",
+ "--distpath", str(work / "dist"), "--workpath", str(work / "build"),
+ str(ROOT / "tools" / "portable.spec"),
+ ],
+ cwd=ROOT,
+ check=True,
+ )
+ bundle = work / "dist" / "gputaskman"
+ add_notices(bundle)
+ (bundle / "README.txt").write_text(
+ f"GPU Task Manager {version} - Windows {arch}\n\n"
+ "Extract the entire ZIP before running. Keep _internal beside gputaskman.exe.\n"
+ "Open PowerShell or Windows Terminal in this folder:\n\n"
+ " .\\gputaskman.exe\n"
+ " .\\gputaskman.exe --once\n"
+ " .\\gputaskman.exe --json\n\n"
+ "Press q to quit the interactive display.\n"
+ "Requires Windows and an NVIDIA GPU with a current WDDM driver.\n"
+ "No Python, uv, CUDA Toolkit, models, or administrator session is required.\n"
+ "This build is unsigned. No drivers or inference servers are bundled.\n"
+ "Snapshots can contain local paths and model names; redact before sharing.\n\n"
+ "Documentation: https://github.com/shanselman/gputaskman\n",
+ encoding="utf-8",
+ )
+ return create_archive(bundle, output, version, arch)
+
+
+def main() -> None:
+ parser = argparse.ArgumentParser(description=__doc__)
+ parser.add_argument("--arch", choices=MACHINES, required=True)
+ parser.add_argument("--output", type=Path, default=ROOT / "dist")
+ parser.add_argument("--tag", help="Require a release tag matching the package version")
+ args = parser.parse_args()
+ print(build(args.output.resolve(), args.arch, args.tag))
+
+
+if __name__ == "__main__":
+ main()
diff --git a/tools/portable.spec b/tools/portable.spec
new file mode 100644
index 0000000..2a72a0c
--- /dev/null
+++ b/tools/portable.spec
@@ -0,0 +1,28 @@
+from pathlib import Path
+
+from PyInstaller.utils.hooks import collect_data_files, copy_metadata
+
+root = Path(SPECPATH).parent
+analysis = Analysis(
+ [str(root / "tools" / "portable_entry.py")],
+ pathex=[str(root / "src")],
+ datas=collect_data_files("textual") + copy_metadata("gputaskman", recursive=True),
+)
+
+# These belong to Windows or the installed NVIDIA driver, not the portable app.
+driver_dlls = {"nvml.dll", "nvcuda.dll", "dxgi.dll", "pdh.dll"}
+analysis.binaries = [
+ entry for entry in analysis.binaries
+ if Path(entry[0]).name.lower() not in driver_dlls
+]
+
+pyz = PYZ(analysis.pure)
+exe = EXE(
+ pyz,
+ analysis.scripts,
+ [],
+ exclude_binaries=True,
+ name="gputaskman",
+ console=True,
+)
+bundle = COLLECT(exe, analysis.binaries, analysis.datas, name="gputaskman")
diff --git a/tools/portable_entry.py b/tools/portable_entry.py
new file mode 100644
index 0000000..9b3ead7
--- /dev/null
+++ b/tools/portable_entry.py
@@ -0,0 +1,4 @@
+from gputaskman.cli import main
+
+if __name__ == "__main__":
+ main()
diff --git a/uv.lock b/uv.lock
index 71c179e..f302e50 100644
--- a/uv.lock
+++ b/uv.lock
@@ -1,7 +1,16 @@
version = 1
-revision = 3
+revision = 5
requires-python = ">=3.11"
+[[package]]
+name = "altgraph"
+version = "0.17.5"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/7e/f8/97fdf103f38fed6792a1601dbc16cc8aac56e7459a9fff08c812d8ae177a/altgraph-0.17.5.tar.gz", hash = "sha256:c87b395dd12fabde9c99573a9749d67da8d29ef9de0125c7f536699b4a9bc9e7", size = 48428, upload-time = "2025-11-21T20:35:50.583Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/a9/ba/000a1996d4308bc65120167c21241a3b205464a2e0b58deda26ae8ac21d1/altgraph-0.17.5-py2.py3-none-any.whl", hash = "sha256:f3a22400bce1b0c701683820ac4f3b159cd301acab067c51c653e06961600597", size = 21228, upload-time = "2025-11-21T20:35:49.444Z" },
+]
+
[[package]]
name = "gputaskman"
version = "0.1.0"
@@ -12,6 +21,11 @@ dependencies = [
{ name = "textual" },
]
+[package.dev-dependencies]
+release = [
+ { name = "pyinstaller" },
+]
+
[package.metadata]
requires-dist = [
{ name = "nvidia-ml-py", specifier = ">=13.615.71" },
@@ -19,6 +33,9 @@ requires-dist = [
{ name = "textual", specifier = ">=8.2.8" },
]
+[package.metadata.requires-dev]
+release = [{ name = "pyinstaller", specifier = "==6.22.3" }]
+
[[package]]
name = "linkify-it-py"
version = "2.2.0"
@@ -28,6 +45,18 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/13/d4/1152d1c7ab42d8b908be64fd200ddc870dc9d4925e951198702084aa1a7d/linkify_it_py-2.2.0-py3-none-any.whl", hash = "sha256:3adc40eb5af300b2605fcfdb968c24e1d780a90f1f2221af7c15e5111e94d443", size = 21971, upload-time = "2026-08-29T07:07:07.164Z" },
]
+[[package]]
+name = "macholib"
+version = "1.16.4"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "altgraph" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/10/2f/97589876ea967487978071c9042518d28b958d87b17dceb7cdc1d881f963/macholib-1.16.4.tar.gz", hash = "sha256:f408c93ab2e995cd2c46e34fe328b130404be143469e41bc366c807448979362", size = 59427, upload-time = "2025-11-22T08:28:38.373Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/c7/d1/a9f36f8ecdf0fb7c9b1e78c8d7af12b8c8754e74851ac7b94a8305540fc7/macholib-1.16.4-py2.py3-none-any.whl", hash = "sha256:da1a3fa8266e30f0ce7e97c6a54eefaae8edd1e5f86f3eb8b95457cae90265ea", size = 38117, upload-time = "2025-11-22T08:28:36.939Z" },
+]
+
[[package]]
name = "markdown-it-py"
version = "4.2.0"
@@ -75,6 +104,24 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/53/a1/1681dfa1c904d4e3e72e51b55a0ff012d50b766843ef832d584abe2113c6/nvidia_ml_py-13.615.71-py3-none-any.whl", hash = "sha256:959bf4adf6fe1308e4bd739e722236b0d1ec8392e2cefad33ff70c311380b9b6", size = 58132, upload-time = "2026-09-25T15:15:26.54Z" },
]
+[[package]]
+name = "packaging"
+version = "26.3"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/7d/fa/3944b40b07da9ce895c0e6303a5ab7d53da063554f534556b134a54d6093/packaging-26.3.tar.gz", hash = "sha256:94edc256424af38762eb31306eed28beb9f0efc50a8837492c9d6fd6004aed79", size = 313412, upload-time = "2026-08-04T18:15:28.737Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/63/34/ba1c580383c9eada3711951fef0795c80b829a078d72188184bcab9dd527/packaging-26.3-py3-none-any.whl", hash = "sha256:d7193f7c8e4e93f444fde0262bf90af30e16fa0ad0ad44cb553c87339b23cd1c", size = 129956, upload-time = "2026-08-04T18:15:27.159Z" },
+]
+
+[[package]]
+name = "pefile"
+version = "2024.8.26"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/03/4f/2750f7f6f025a1507cd3b7218691671eecfd0bbebebe8b39aa0fe1d360b8/pefile-2024.8.26.tar.gz", hash = "sha256:3ff6c5d8b43e8c37bb6e6dd5085658d658a7a0bdcd20b6a07b1fcfc1c4e9d632", size = 76008, upload-time = "2024-08-26T20:58:38.155Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/54/16/12b82f791c7f50ddec566873d5bdd245baa1491bac11d15ffb98aecc8f8b/pefile-2024.8.26-py3-none-any.whl", hash = "sha256:76f8b485dcd3b1bb8166f1128d395fa3d87af26360c2358fb75b80019b957c6f", size = 74766, upload-time = "2024-08-26T21:01:02.632Z" },
+]
+
[[package]]
name = "platformdirs"
version = "4.14.3"
@@ -121,6 +168,55 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/71/46/17f022dd3e953bf20a04a028a21ec746d942f8d2af30fa0f124fa0e6a684/pygments-2.21.0-py3-none-any.whl", hash = "sha256:2363c69b61c4a97c838da3b130dcd6468f4848992b21a82f2a63ec34377137d9", size = 1250147, upload-time = "2026-08-17T08:02:44.912Z" },
]
+[[package]]
+name = "pyinstaller"
+version = "6.22.3"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "altgraph" },
+ { name = "macholib", marker = "sys_platform == 'darwin'" },
+ { name = "packaging" },
+ { name = "pefile", marker = "sys_platform == 'win32'" },
+ { name = "pyinstaller-hooks-contrib" },
+ { name = "pywin32-ctypes", marker = "sys_platform == 'win32'" },
+ { name = "setuptools" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/63/41/f90302845945abd4ed647933ff5ee7c6ac93983187be67f897b6cb613331/pyinstaller-6.22.3.tar.gz", hash = "sha256:05eb2f5615503e72939a7224d68b4aff572c6b0438ee4a17d0a4b481f399362d", size = 4437180, upload-time = "2026-09-12T21:54:09.669Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/ec/af/898f70947e27f8e65d55183c780e77112e023c0b4a6fba6255d4d563a27d/pyinstaller-6.22.3-py3-none-macosx_10_13_universal2.whl", hash = "sha256:052f4a1cd4f81092ccb7a18fe8ebc9ecf832a5917317e39fb3775af4e959b253", size = 1071847, upload-time = "2026-09-12T21:53:01.711Z" },
+ { url = "https://files.pythonhosted.org/packages/c4/96/99f5184985141c2b024bfa61335e9142ae444555224f303186e59b7bb438/pyinstaller-6.22.3-py3-none-manylinux2014_aarch64.whl", hash = "sha256:312da84b4b31ab9750066a823734c11b7c68757fdd67c9f038bf19c330a954e4", size = 758172, upload-time = "2026-09-12T21:53:06.171Z" },
+ { url = "https://files.pythonhosted.org/packages/69/9f/9ccb12cc1e6617042cb028fe79f0a756f5f03305bd14b584a4e043fe3844/pyinstaller-6.22.3-py3-none-manylinux2014_i686.whl", hash = "sha256:020d4fe0627f5c73dfbcfad1a6578ef354d5fe4bdccd9d8e5a615528f5a45d2b", size = 772135, upload-time = "2026-09-12T21:53:10.291Z" },
+ { url = "https://files.pythonhosted.org/packages/c1/43/4b1d5193a88628c052db89f064433681076959a9f41d0d9f660001b49079/pyinstaller-6.22.3-py3-none-manylinux2014_ppc64le.whl", hash = "sha256:9e4f7bd64b2103f14b4a6240fb9155e9fe7bc61391b4043bbddb7d3ebc8ab0fa", size = 770461, upload-time = "2026-09-12T21:53:14.592Z" },
+ { url = "https://files.pythonhosted.org/packages/cb/83/f173f8757c618d83e116fa2b8e57c5cd796e5ad09792e664eabd6ac5edae/pyinstaller-6.22.3-py3-none-manylinux2014_s390x.whl", hash = "sha256:f82d0fb89f21c3ed6f482ee16f341bc59e8a31dbabb9bae9ef04e53ade4dc0d9", size = 764997, upload-time = "2026-09-12T21:53:19.079Z" },
+ { url = "https://files.pythonhosted.org/packages/7b/b6/dd21d61fc5e25377be24eabf13e99e4e46548a5abe2bf7b15d8b3d9cc74a/pyinstaller-6.22.3-py3-none-manylinux2014_x86_64.whl", hash = "sha256:451a4ae14b719365bf1a2f0a99dae7b3463060061c3a394c70d5264cfb439528", size = 764974, upload-time = "2026-09-12T21:53:23.176Z" },
+ { url = "https://files.pythonhosted.org/packages/6c/fd/d9590942972b1fc205519f7ccffb0d5cd8eb1d6fa61edad319c71d25baed/pyinstaller-6.22.3-py3-none-musllinux_1_1_aarch64.whl", hash = "sha256:ea240b5dfa831ff673c97505eee0ec24670bccf71396c83109440348944c83d0", size = 764450, upload-time = "2026-09-12T21:53:27.419Z" },
+ { url = "https://files.pythonhosted.org/packages/72/d6/f22c55d1768433b65c460b19a3136dd9769b6c74b786149b829344654c7d/pyinstaller-6.22.3-py3-none-musllinux_1_1_x86_64.whl", hash = "sha256:a2b6fc26601e8c2596c3d54981566934a3382e85d05d0fe91b55b6a8dcc6b282", size = 763863, upload-time = "2026-09-12T21:53:31.609Z" },
+ { url = "https://files.pythonhosted.org/packages/c5/87/cf28cfd42ceca889171e6dd5e7f1553d4372db83d047049ffb7cf95fcbd4/pyinstaller-6.22.3-py3-none-win32.whl", hash = "sha256:46a3e30a118341a1ec20667a5a95aa7e0aa8c4fa129893c0151b3eb3f801a722", size = 1390905, upload-time = "2026-09-12T21:53:38.133Z" },
+ { url = "https://files.pythonhosted.org/packages/24/83/c5422204772a27aef643280fdc887b7ef55679989096b21dceb1b9625fc4/pyinstaller-6.22.3-py3-none-win_amd64.whl", hash = "sha256:500bd58c7bf7e584a8435adccbd763a0b918d5c12b08d74ff50fd79b2915458b", size = 1454907, upload-time = "2026-09-12T21:53:44.812Z" },
+ { url = "https://files.pythonhosted.org/packages/67/2e/ebc93968bf63f81b122e205da116b16036b653b7ce2cc8ad86e3ddd19586/pyinstaller-6.22.3-py3-none-win_arm64.whl", hash = "sha256:31df3cc4261e804a53d358b7897c293ec8b88b167a7cca06c78018085c855f97", size = 1402956, upload-time = "2026-09-12T21:53:51.369Z" },
+]
+
+[[package]]
+name = "pyinstaller-hooks-contrib"
+version = "2026.9"
+source = { registry = "https://pypi.org/simple" }
+dependencies = [
+ { name = "packaging" },
+]
+sdist = { url = "https://files.pythonhosted.org/packages/96/25/e47c6188228281372be7e9911a93931e01ec8798c02c93abd680b9b9521f/pyinstaller_hooks_contrib-2026.9.tar.gz", hash = "sha256:2748767901acb5cecd1304652b6c7add5bffcff1d71d01207fe24a5d42942a56", size = 180783, upload-time = "2026-10-20T15:43:54Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/93/fe/ded0e20de0580257d97dbabb4db7ab4d96ad8ade7d41149e66308057cf52/pyinstaller_hooks_contrib-2026.9-py3-none-any.whl", hash = "sha256:fb3e67dd64122561724c48ad0366ac9e8c16e638b63bf7d85de03bf3fdbf06c3", size = 462931, upload-time = "2026-10-20T15:43:52.632Z" },
+]
+
+[[package]]
+name = "pywin32-ctypes"
+version = "0.2.3"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/85/9f/01a1a99704853cb63f253eea009390c88e7131c67e66a0a02099a8c917cb/pywin32-ctypes-0.2.3.tar.gz", hash = "sha256:d162dc04946d704503b2edc4d55f3dba5c1d539ead017afa00142c38b9885755", size = 29471, upload-time = "2024-08-14T10:15:34.626Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/de/3d/8161f7711c017e01ac9f008dfddd9410dff3674334c233bde66e7ba65bbf/pywin32_ctypes-0.2.3-py3-none-any.whl", hash = "sha256:8a1513379d709975552d202d942d9837758905c8d01eb82b8bcc30918929e7b8", size = 30756, upload-time = "2024-08-14T10:15:33.187Z" },
+]
+
[[package]]
name = "rich"
version = "15.0.0"
@@ -134,6 +230,15 @@ wheels = [
{ url = "https://files.pythonhosted.org/packages/82/3b/64d4899d73f91ba49a8c18a8ff3f0ea8f1c1d75481760df8c68ef5235bf5/rich-15.0.0-py3-none-any.whl", hash = "sha256:33bd4ef74232fb73fe9279a257718407f169c09b78a87ad3d296f548e27de0bb", size = 310654, upload-time = "2026-04-12T08:24:02.83Z" },
]
+[[package]]
+name = "setuptools"
+version = "84.2.1"
+source = { registry = "https://pypi.org/simple" }
+sdist = { url = "https://files.pythonhosted.org/packages/70/b3/c19426f783614d625699a4b247faf628ea9ab1db228674491767b417f9e1/setuptools-84.2.1.tar.gz", hash = "sha256:3ff8b3b5492a0aa66960f4419365a86b84e013070d4313e4d4a6894f5d64d6bc", size = 1230289, upload-time = "2026-10-20T19:01:37.742Z" }
+wheels = [
+ { url = "https://files.pythonhosted.org/packages/ef/55/6dc6d6bb953bdfc52519a0059592c52b6e3b8ad51cf8256dffceb55b0610/setuptools-84.2.1-py3-none-any.whl", hash = "sha256:ca140b45d5325a9478f880e351484f62fef15f336462e449ca0c03c873d589c2", size = 876263, upload-time = "2026-10-20T19:01:35.678Z" },
+]
+
[[package]]
name = "textual"
version = "8.2.8"