[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"project-107924":3},{"id":4,"name":5,"fullName":6,"owner":7,"repo":5,"description":8,"homepage":9,"htmlUrl":9,"language":10,"languages":9,"totalLinesOfCode":9,"stars":11,"forks":12,"watchers":13,"openIssues":14,"contributorsCount":15,"subscribersCount":15,"size":15,"stars1d":16,"stars7d":17,"stars30d":18,"stars90d":15,"forks30d":15,"starsTrendScore":19,"compositeScore":20,"rankGlobal":9,"rankLanguage":9,"license":21,"archived":22,"fork":22,"defaultBranch":23,"hasWiki":24,"hasPages":22,"topics":25,"createdAt":9,"pushedAt":26,"updatedAt":27,"readmeContent":28,"aiSummary":29,"trendingCount":15,"starSnapshotCount":15,"syncStatus":30,"lastSyncTime":31,"discoverSource":32},107924,"gputaskman","shanselman\u002Fgputaskman","shanselman","A GPU task manager for Windows, Linux, and WSL: per-process VRAM, GPU activity, and LLM model\u002FKV-cache insights for NVIDIA, AMD, and Intel GPUs (plus Huawei Ascend on Linux).",null,"Python",3736,184,22,8,0,26,320,3623,158,108.79,"MIT License",false,"main",true,[],"2026-11-23 07:17:01","2026-11-23 20:25:30","# gputaskman\n\n**An `htop` for what's inside your GPU, not just how full it is.**\n\nWindows + NVIDIA\u002FAMD, with NVIDIA support on Linux and WSL (see [Linux and WSL](#linux-and-wsl)) and\nmacOS on Apple Silicon (see [macOS](#macos-apple-silicon)). A terminal UI\nthat connects per-process GPU memory and engine activity with loaded runtimes, model files, and\nLLM buffer breakdowns.\n\nTask Manager says \"15 GB used.\" This tries to answer: *by what? Model weights? KV cache?\nYour browser? The desktop compositor? And why is so much GPU memory in system RAM?*\n\n**Scope: local GPU workloads, not cloud services.** Decision models, vision, speech, LLM inference,\ntraining\u002Ffine-tuning (including Unsloth), graphics, and video all belong here. Visibility varies:\nprocess memory and engine activity are measured; identifying individual models and their work\nrequires supporting evidence. A PyTorch\u002FCUDA DLL alone cannot identify a model or prove training,\nand a mapped file does not prove that model is resident on the GPU or being exercised.\nCPU-only, NPU-only, and cloud workloads are out of scope.\n\n![Live GPU overview with an LLM's weights, KV cache, and compute buffer breakdown](docs\u002Fscreenshots\u002Foverview.png)\n\n> Early, experimental software. Device and process counters are measurements; classifications\n> and GGUF-derived breakdowns are estimates. This does not dump VRAM or enumerate a game's textures.\n\n## Portable Windows download\n\nThe [Releases page](https:\u002F\u002Fgithub.com\u002Fshanselman\u002Fgputaskman\u002Freleases) is where tagged builds\npublish two portable ZIPs: `gputaskman-VERSION-windows-x64.zip` for Intel\u002FAMD Windows PCs, and\n`gputaskman-VERSION-windows-arm64.zip` for native Windows ARM64. These are separate native builds,\nnot a universal executable. If no release is published yet, use the source instructions below.\n\nExtract the **entire ZIP**, keeping `_internal` beside `gputaskman.exe`. Open Windows Terminal\nor PowerShell in the extracted folder:\n\n```powershell\n.\\gputaskman.exe\n.\\gputaskman.exe --once\n.\\gputaskman.exe --json\n```\n\nNo Python, uv, CUDA Toolkit, model download, or installation is needed. A supported GPU with a\ncurrent Windows WDDM driver is required. Builds are currently **unsigned**; code signing\nand an installer are not part of this initial distribution. Each ZIP includes licenses and a\n`.zip.sha256` companion file is published for integrity checks.\n\n## Clone and run\n\nUse **64-bit Windows 10\u002F11**, an **NVIDIA or AMD GPU with a current WDDM driver**, and a terminal\n(Windows Terminal is recommended). Live workload checks have included an RTX 4080 SUPER and an\nRTX Spark N1X on Windows ARM64. CUDA workloads are supported on ARM64 with a compatible NVIDIA\ndriver and ARM64 CUDA runtime.\n\nAMD live check: Radeon 860M Graphics on Windows 11 Enterprise build 26300, AMD driver 32.0.22050.1003.\nDuring desktop\u002Fbrowser activity, WDDM reported per-process VRAM and AMD ADL reported GPU utilization,\nclocks, and ASIC power; temperature, memory activity, and PCIe readings were unavailable. Vulkan\u002FROCm\nworkloads were not tested on this machine.\n\nInstall [Git for Windows](https:\u002F\u002Fgit-scm.com\u002Fdownloads\u002Fwin) and\n[uv](https:\u002F\u002Fdocs.astral.sh\u002Fuv\u002Fgetting-started\u002Finstallation\u002F) if needed. With WinGet:\n\n```powershell\nwinget install --id Git.Git --exact\nwinget install --id astral-sh.uv --exact\n```\n\nOpen a new PowerShell window so those tools are on `PATH`, then:\n\n```powershell\ngit clone https:\u002F\u002Fgithub.com\u002Fshanselman\u002Fgputaskman.git\ncd gputaskman\nuv run --locked gputaskman\n```\n\n**That's it.** uv obtains the pinned Python version if needed, creates `.venv`, and installs\nthe locked dependencies. The first run needs internet access. There is no CUDA Toolkit,\nVisual Studio, administrator session, API key, or model download required to monitor the GPU.\nNVML ships with the NVIDIA driver; AMD ADL is supplied by supported AMD Windows drivers.\n\nAlready have Python 3.11+ and prefer pip?\n\n```powershell\ngit clone https:\u002F\u002Fgithub.com\u002Fshanselman\u002Fgputaskman.git\ncd gputaskman\npy -m venv .venv\n.\\.venv\\Scripts\\python.exe -m pip install .\n.\\.venv\\Scripts\\gputaskman.exe\n```\n\nNo PowerShell activation script or execution-policy change is needed. The pip route resolves\ncompatible dependencies; the uv route uses the checked-in lockfile.\n\nIf an alternate package index makes `--locked` report a stale lockfile on an unchanged checkout,\n`uv run --frozen gputaskman` uses the checked-in lockfile without re-resolving it. `--frozen`\nskips the consistency check, so do not use it after changing dependencies.\n\n## Linux and WSL\n\nTagged releases include portable Linux builds: `gputaskman-VERSION-linux-x64.tar.gz` and\n`gputaskman-VERSION-linux-arm64.tar.gz`. They need glibc 2.35 or newer (Ubuntu 22.04, Debian 12,\nor newer) and an NVIDIA driver, and work natively, in containers, and in WSL:\n\n```bash\ntar -xzf gputaskman-VERSION-linux-x64.tar.gz\ncd gputaskman-VERSION-linux-x64\n.\u002Fgputaskman\n```\n\nOr clone and run from source, in a Linux or WSL shell:\n\n```bash\ngit clone https:\u002F\u002Fgithub.com\u002Fshanselman\u002Fgputaskman.git\ncd gputaskman\nuv run --locked gputaskman\n```\n\nWhat can be measured depends on where it runs, and the UI says which mode it is in.\n\n| | Native Linux | WSL, interop on (default) | WSL, interop off or `--no-host` |\n|---|---|---|---|\n| Device totals, load, temperature, power, clocks | NVML | NVML | NVML |\n| Per-process VRAM | NVML, measured (in a container: owner matched, `*` or `?`) | Matched from the Windows host, marked `*` or `?` | `n\u002Fa` |\n| Per-process GPU load | NVML (SM, encoder, decoder) | `n\u002Fa` for Linux processes | `n\u002Fa` |\n| Spill \u002F Paged | Not available (blank) | Windows rows only | Not available |\n| WSL VM total, Windows apps | — | Windows host counters | — |\n| Runtimes, model files, LLM breakdown | `\u002Fproc\u002F\u003Cpid>\u002Fmaps`, command line | Same | Same |\n\n**Native Linux** reads per-process memory from NVML's running compute and graphics process lists\nand per-process SM, encoder, and decoder load from NVML utilization samples. Linux has no\nequivalent of WDDM's shared-memory or commit counters, so Spill and Paged stay blank rather than\nshowing zero. Only processes you can inspect are listed; other users' processes need `sudo`.\n\nJSON uses `null` for unavailable counters, not a measured zero: spill\u002Fcommit\u002Fpaged values on\nnative Linux, and per-process engine load for WSL Linux rows. Native NVML engine readings remain\navailable even if NVML hides that process's VRAM. Windows host rows retain their measured counters.\n\n**Containers** (Docker, Kubernetes, rented GPU boxes) need one more step: NVML reports *host*\nPIDs, which mean nothing in the container's `\u002Fproc`, and the container cannot see the host PID of\nits own processes. gputaskman pairs NVML's unresolved PIDs with the container's processes that\nhave `libcuda.so` mapped (NVML-only tools such as `nvidia-smi` open the same device files but\nnever load libcuda). Both PID namespaces number processes in creation order, so the pairing is by\norder: `*` when the counts match or a process starting while gputaskman runs pins it, `?` when\nNVML lists more compute processes than the container has (another container on the same GPU).\nPer-process GPU load follows the match. Anything left over is shown as `H:\u003Cpid>`,\n*outside this container* (for example, the host's display server), and is never looked up locally.\n\nLive check, on a Vast.ai Docker container (Ubuntu 22.04, RTX 3060 Ti, driver 580.82.09): two\nPyTorch jobs already running at startup, a third started while watching, and one killed, were all\nmatched to the right container PIDs with their NVML sizes (1.12, 2.52 and 1.59 GB) and live GPU%.\nAn Ollama `qwen3:0.6b` runner was detected and named from Ollama's store with `api+mapped+cmdline`\nevidence, its weights \u002F KV-cache \u002F compute split shown, and the TUI rendered. Bare-metal Linux\n(same PID namespace, no matching needed) is covered by tests but has not been run on hardware.\n\n**WSL** is different, because Windows owns the GPU. Linux cannot see how much VRAM its own\nprocesses use: `nvidia-smi` lists no processes, NVML's per-process samples carry *Windows* PIDs\n(never looked up in Linux's `\u002Fproc`), and Windows charges all Linux GPU memory to the VM worker\nprocess, `vmwp.exe`. When WSL interop is enabled (`\u002Fproc\u002Fsys\u002Ffs\u002Fbinfmt_misc\u002FWSLInterop` reads\n`enabled`), gputaskman starts one long-lived `powershell.exe` that reads the Windows GPU counters\nthrough the same PDH array API as the Windows backend and streams them back once a second:\n\n- **WSL VM (`vmwp.exe`)** is the exact total of Linux GPU memory, across every distro, WSLg, and\n  Docker Desktop.\n- **Windows apps** appear as `W:\u003Cpid>` rows with their VRAM, spill, paged, and engine load.\n  Windows and Linux PIDs are separate namespaces, so the prefix keeps them apart.\n- **Linux rows** get a size by matching `vmwp.exe`'s GPU contexts to Linux processes (below).\n\nThe first host sample takes about 2.5 s; the TUI shows `starting` until then, and `--once` waits\nfor it. The host adapter is paired with the NVML device by memory usage, because WSL's adapter\nLUIDs differ from the host's. An ambiguous pairing shows `unmatched` instead of guessing. With other\nHyper-V VMs or Windows Sandbox running, the row is labeled `VM worker` because it cannot be tied\nto WSL alone. `--no-host` turns the host stream off; without interop you get device-wide numbers\nand a list of the Linux processes that hold `\u002Fdev\u002Fdxg`, with VRAM shown as `n\u002Fa`.\n\n### How WSL per-process VRAM is matched\n\n`vmwp.exe` exposes one GPU-memory instance per guest GPU context, all with the same name: sizes\nwithout owners. Measured on WSL2 with driver 610.88, every Linux process that opens `\u002Fdev\u002Fdxg`\ngets exactly one context (an NVML-only process too, at 0 bytes), and Windows lists them **newest\nfirst**, keeping that order as contexts come and go. Contexts from outside this distro (WSLg, other\ndistros, Docker, services you cannot inspect) are interleaved by their own age.\n\ngputaskman follows the contexts from sample to sample and labels them with evidence:\n\n| Marker | Meaning | Established by |\n|---|---|---|\n| `*` matched | Windows' exact size; the owner is inferred, and only one explanation fits (or every one that fits gives the same size) | A new Linux GPU process and a new context appearing together; elimination; this monitor's own context being the only zero-byte candidate at startup; candidate contexts that are exactly the same size |\n| `?` guess | Heuristic owner for processes that were already running | Newer process ↔ newer context, outside contexts assumed oldest; cached foreign sizes can rank extra candidates but never establish ownership |\n| `n\u002Fa` | No context could be assigned | For example, a process that has not created its GPU context yet |\n\nA guess is recomputed every refresh and never counts as evidence for itself. An exited process's\ncontext is held aside until it disappears, so it is not handed to a newcomer, and a context that\ngrows by gigabytes between refreshes (weights uploading) keeps an established owner. Multiple\nzero-byte contexts at startup do not pin the monitor to an arbitrary one that might later grow.\nForeign sizes observed while only the monitor is running are cached per WSL boot in\n`~\u002F.cache\u002Fgputaskman\u002F`, but remain hints: a process may exit while the monitor is off and a local\nprocess may reuse its size. Observed foreign-context exits and idle samples clear obsolete hints.\n\nThe matched size also feeds VRAM sorting, initial model selection, the bounded model-file scan\npriority, and the LLM weights \u002F KV-cache breakdown. Inferred Linux rows remain below the VM total\nand are never added to it again. The inspector and `--json` (`vram_inferred_by`) say which kind\nof match each row has.\n\nIn one live check, a 2 GB and a 5 GB PyTorch allocation were matched to the right PIDs at\n2.119 GiB and 4.914 GiB: the allocator's own figure plus about 0.26 GiB of CUDA context.\nThat is one machine and driver, not a guarantee. A process that started long before it first used\nthe GPU can break the start-order guess, and processes started in the same refresh are ordered by\nguess unless their sizes match.\n\n## macOS (Apple Silicon)\n\nRun from a clone (`uv run gputaskman`); there is no portable macOS download yet. Apple GPUs share\none pool of memory with the CPU, so there is no VRAM to split and no spill\u002Fcommit counters. What\nmacOS exposes without root:\n\n| Column | Source | Who |\n|---|---|---|\n| GPU memory (header) | IOAccelerator `PerformanceStatistics`: `Alloc system memory` (all GPU allocations) out of physical RAM | device |\n| GPU% (header) | `Device Utilization %` | device |\n| GPU% | Each Metal client (`AGXDeviceUserClient`) names its creator PID and keeps a cumulative `accumulatedGPUTime`; the rate between samples, per client (a closed client never hides the others' work) | every process |\n| VRAM | `footprint`: the process's memory macOS charges to graphics (the `(graphics)` categories: Metal buffers, textures) | your own processes |\n| Runtime, model files | Mapped files from `proc_pidinfo` region walks (psutil has no memory maps on macOS): `libggml*.dylib`, `libllama*.dylib`, `libmlx*.dylib`, `libtorch_cpu.dylib`, the Metal driver bundle | your own processes |\n\nOther users' processes (WindowServer, system daemons) show GPU% with memory `n\u002Fa`: `footprint` needs\nroot for them. Idle ones are left out of the table, except WindowServer. Run with `sudo` to measure\nevery process's memory. `footprint` takes ~70 ms per process, so it runs in a background thread:\nbusy processes and new ones every pass (~2 s), idle ones every 30 s. A new process shows `n\u002Fa` for a\nsecond or two until its first measurement; a single failed measurement keeps the last size, and three\nin a row back off for a minute. Measurements are tied to the process's start time, so a reused PID\nnever shows the previous process's numbers.\n\nMetal reports one GPU time per process, with no 3D\u002Fcompute\u002Fcopy\u002Fvideo split, so those columns show\n`n\u002Fa`; a Metal process above 10% GPU is classified `3D\u002Fgame` unless something more specific applies\n(AI runtime, browser, compositor). Spill, paged, clocks, power, and temperature are not available, so\nthe chart picker offers only GPU and GPU memory. Handy's log is read from\n`~\u002FLibrary\u002FLogs\u002Fcom.pais.handy\u002Fhandy.log`.\n\nLive check on an M4 Mac mini (macOS 26.3.1): a PyTorch MPS job with a 2 GiB buffer and a matmul loop\nshowed `Python  AI  PyTorch+Metal  3.06 GB  99%`, with device utilization at 99% and allocated GPU\nmemory rising by the same amount.\n\nScans skip other apps' sandbox containers (`~\u002FLibrary\u002FContainers`, `~\u002FLibrary\u002FGroup Containers`) and\nsystem files without opening them: opening a file in a protected container blocks while macOS waits\nfor a privacy consent prompt.\n\n## What you get\n\n- **Device view:** VRAM usage, GPU activity, memory activity, PCIe traffic, temperature, power,\n  video-engine clock, and responsive history charts with an all-charts or single-metric view.\n- **Process view:** local GPU memory, GPU-accessible system RAM, estimated non-resident commit,\n  engine activity, and detected runtimes such as CUDA, HIP, Vulkan, Direct3D, ggml and ONNX Runtime.\n- **Model inspector:** which model each process holds (LLM, decision, embedding, speech, or diffusion), how\n  it was identified, architecture, quantization, layer count, weights, estimated KV cost, and\n  buffer sizes from compatible load logs.\n- **Live server hints:** context size, busy slots, throughput when available, and friendly Ollama\n  or LM Studio model names.\n- **Scriptable output:** one-shot text and JSON, using the same collector as the TUI.\n\n### Screenshots\n\nThese are captures of real local workloads through Textual's screenshot renderer, not mock data.\nFull filesystem paths and command lines were omitted in the capture copy. Measurements vary\nwith the workload; the examples are not benchmarks.\n\n**The compositor, without treating all shared surfaces as its private VRAM**\n\n![Compositor selected, showing local memory and the explanation of shared-surface accounting](docs\u002Fscreenshots\u002Fcompositor.png)\n\n**GPU-accessible system RAM, sorted by the Spill column**\n\n![Processes sorted by system-memory usage, alongside the selected process's memory explanation](docs\u002Fscreenshots\u002Fsystem-memory.png)\n\n**An explanation of what is measured, inferred, and unavailable**\n\n![Built-in help explaining GPU counters and the limits of memory introspection](docs\u002Fscreenshots\u002Fhelp.png)\n\n## Usage\n\n```powershell\nuv run --locked gputaskman              # live TUI\nuv run --locked gtm                     # shorter alias\nuv run --locked gputaskman -i 2         # sample every two seconds\nuv run --locked gputaskman --once       # one text snapshot\nuv run --locked gputaskman --json       # one JSON snapshot; implies --once\nuv run --locked gputaskman diff before.json after.json   # compare two --json snapshots\nuv run --locked gputaskman --no-host    # WSL: don't read Windows host counters through interop\nuv run --locked gputaskman --help\n```\n\n| Key | Action |\n|---|---|\n| Up \u002F Down | Select a process and inspect it |\n| `s` | Cycle sort: VRAM, GPU%, spill, paged, name |\n| `c` | Cycle all charts or a single metric (also available in the **Charts** dropdown) |\n| `a` | Switch between top and all collected processes |\n| `p` | Pause \u002F resume collection |\n| `?` | Explain the counters and their limits |\n| Escape | Close help |\n| `q` | Quit |\n\nA wide terminal (roughly 140 columns or more) makes the full table easier to read.\nAll eight history charts are shown by default: GPU, SM clock (GFX clock on AMD), VRAM, memory activity,\ntemperature, power, encoder, and decoder. They stack in narrow terminals and share rows as\nthe window widens. Click the **Charts** dropdown to focus on one metric or return to **All charts**.\nA blank sample means no reading; zero is drawn at the baseline. Percentages use a 0–100%\nscale, temperature uses 0–120°C, and the power and clock scales are displayed below the charts.\nThe dashboard and inspector scroll independently in short terminals so the process list stays usable.\nModel\u002Fruntime discovery is throttled, so newly loaded models may take about 15 seconds to appear.\n\n`--list-gpus` lists selectable hardware adapters with their vendor and LUID. `--gpu N` selects\none of these adapters: NVIDIA adapters are listed first, followed by other vendors, with each\ngroup ordered by dedicated memory. An out-of-range\nindex is rejected rather than silently selecting another device. Compute-only devices such as an\nNPU are not graphics adapters. AMD and NVIDIA hardware coverage is described below; configurations\nwith multiple GPUs and mixed vendors need further validation.\nDevice telemetry is matched to WDDM adapters by PCI location, not display name or enumeration order.\nIf a unique match cannot be established, telemetry is unavailable; buffer logs can still span devices,\nso model-buffer attribution across GPUs is not yet reliable. This conservative matching also applies\nto NVIDIA and may suppress telemetry when Windows does not expose a usable PCI address.\n\nAMD adapters can be selected and use the existing Windows GPU process counters; HIP runtime DLLs\nare recognized as runtime evidence. On supported drivers, the AMD Display Library supplied by the\nWindows driver can provide graphics activity, clocks, edge temperature, board or ASIC power, fan\nand PCIe lane count. An optional AMD SMI Python installation is a fallback and may provide graphics\nactivity, edge temperature and socket power. Both require a PCI match to the selected WDDM adapter.\nThe SMI library and its native dependencies must be available to the Python environment; it is not\nbundled in the portable build. The RX 9060 XT HIP workload and ADL telemetry have been observed on\nthis machine; AMD SMI telemetry and Vulkan workloads remain unvalidated.\nA loaded DLL does not prove GPU execution.\n\nUnavailable utilization, temperature, power, clock and PCIe readings are displayed as `N\u002FA` in\ntext and the TUI and as `null` in JSON. For example, a missing NVML power limit means that the\ndriver did not expose that reading; it does not by itself indicate a hardware fault.\nMissing per-process memory or engine samples likewise show `N\u002FA`\u002F`null`; the paged estimate is\nunavailable when any of its input counters is missing.\n\n### Comparing snapshots\n\nTo see which memory bucket actually grew when you load a model or change the context length, save\na JSON snapshot before and after and compare them:\n\n```powershell\nuv run --locked gputaskman --json > before.json\n# load the model, or restart the server with a different -c, then send it one request\nuv run --locked gputaskman --json > after.json\nuv run --locked gputaskman diff before.json after.json          # add --json for machine-readable output\n```\n\nThe device and process tables compare **measured** counters only. Runtime-reported segments\n(llama.cpp buffer logs) and estimates (KV cache from GGUF metadata and `-c`) are listed separately\nunder each process and are never added to measured totals. A model file that appears in a process\nis listed as evidence that the process opened or named it, not as GPU growth.\n\nProcesses are paired by PID, then by name and listening ports, then by a unique name, because a\nmodel reload often restarts the server under a new PID. A process missing from one snapshot shows\n`not listed`, not zero: it was not running or used too little GPU to be listed. Processes that\nmoved by less than 16 MB are hidden from the text output but included in `--json`.\n\nTake the \"after\" snapshot once the model has answered one request: CUDA and Vulkan can allocate\nlazily, and allocators keep freed memory cached, so shrinkage may appear late. On an RTX 4080 SUPER\nwith Docker Model Runner's llama-server (Vulkan) and gemma-3-270m, changing `-c 4096` to `-c 32768`\nestimated +504 MB of KV cache, but the server's measured dedicated memory grew by only +83 MB.\nGemma 3 uses sliding-window attention, so the estimate is an upper bound. The comparison makes\nthat gap visible instead of hiding it.\n\n## How can it know what's inside?\n\nIt combines evidence rather than reading arbitrary GPU memory. Windows' graphics kernel supplies\nper-process memory and engine counters, while NVML or AMD ADL\u002FSMI supplies device metrics. Process DLLs suggest\nthe runtime, and mapped files or command-line arguments identify candidate models. GGUF metadata\nand tensor offsets let it estimate weights and KV-cache costs; compatible runtime logs and local\nserver APIs add allocated buffer sizes and live state. That can explain a llama.cpp process well,\nbut a runtime DLL or filename alone does not prove which allocation contains which object.\n\n| Question | Evidence | Confidence \u002F limitation |\n|---|---|---|\n| How full and busy is the card? | WDDM adapter counters and NVML or AMD ADL\u002FSMI | Measured; driver support varies by metric |\n| Which process uses GPU memory? | WDDM process counters; NVML on Linux | Measured accounting, not a resource ownership graph |\n| Which WSL process uses GPU memory? | Windows host counters for `vmwp.exe`, matched to Linux processes | Exact VM total; per-process owner inferred (`*`) or guessed (`?`) |\n| Which engines are active? | WDDM engine counters | CUDA can appear on the **3D** engine |\n| Which runtime is loaded? | Mapped DLL names | Detection, not proof that every library is doing GPU work |\n| Which model file is present? | Mapped files, CLI flags, GGUF magic\u002Fheader | A file mapping does not prove GPU placement |\n| Weights \u002F KV \u002F compute sizes? | Load logs, GGUF math, server state | Log-reported allocations or estimates, not a VRAM scan |\n| Which texture, tensor, or kernel is this? | Not available here | Use PIX, Nsight, or runtime-specific instrumentation |\n\n### Why not just `nvidia-smi`?\n\nOn GeForce under **WDDM**, Windows manages GPU memory and NVML may report per-process memory as\n`N\u002FA`. Windows GPU counters can still attribute memory and activity across Direct3D, Vulkan,\nOpenGL, and CUDA. NVML remains useful for device-level readings. Under WSL, `nvidia-smi` lists\nno processes at all; see [Linux and WSL](#linux-and-wsl).\n\n### DWM, Spill, and Paged: read these carefully\n\n**DWM is not everything.** Windows' per-process `Dedicated Usage` includes resources shared\nbetween processes. The same surface may appear against its application, `csrss.exe`, and\n`dwm.exe`. Adding those rows double-counts memory. This tool prefers `Local Usage` and\n`Non Local Usage`; it falls back to `Dedicated Usage` \u002F `Shared Usage` when the preferred\ncounters cannot be added. The adapter total remains the reference. See Microsoft's\n[GPU accounting explanation](https:\u002F\u002Fdevblogs.microsoft.com\u002Fdirectx\u002Fgpus-in-the-task-manager\u002F).\n\nIn one live sample, DWM's older counter read about 15.3 GiB while `Local Usage` was about\n1.4 GiB. The latter reduced the inflated process sum substantially. This is an observed\nimprovement, not a guarantee that every driver's process counters add up exactly.\nWhen the row sum exceeds the adapter total, the category bar is normalized to fit;\nlegend values remain raw, and the UI labels the normalization.\n\n**Spill means GPU-accessible system RAM, not proven overflow.** It can include intentionally\nallocated or pinned host buffers. Large usage alongside a nearly full GPU can indicate\nfallback and slower inference, but the counter alone cannot establish why it was allocated.\n\n**Paged is an estimate:** `max(Total Committed - Local Usage - Non Local Usage, 0)`.\nIt is not an eviction trace, a pagefile measurement, or proof that Windows just moved\nthose bytes out of VRAM. The value is also less reliable when fallback counters are in use.\n\nMemory labels currently use `GB` \u002F `MB` for binary units (GiB \u002F MiB). The `Mem activity`\nreading is NVML's memory-activity percentage, **not measured bandwidth in GB\u002Fs**.\n\n## LLM and model support\n\n| Runtime | Current support |\n|---|---|\n| llama.cpp \u002F llama-server | GGUF discovery, CLI settings, buffer logs, `\u002Fprops` + `\u002Fv1\u002Fmodels` state; exercised live |\n| Ollama | Bundled runners, mapped GGUF blobs named from Ollama manifests (`qwen3:14b`), parent `\u002Fapi\u002Fps`, compatible `server.log`; exercised live |\n| LM Studio | Mapped files named from its models folder, `\u002Fapi\u002Fv1\u002Fmodels` (falls back to `\u002Fapi\u002Fv0\u002Fmodels`); tested with fixture responses, not yet end to end |\n| stable-diffusion.cpp (`--diffusion-model`) | Diffusion, text-encoder and VAE files from launch arguments; no LLM memory breakdown |\n| Hugging Face cache | `models--org--repo` paths are named `org\u002Frepo` |\n| Other AI runtimes | DLL detection, plus model files installed with the app (marked *not proven loaded*) |\n| Handy | Reads selected model from settings and bounded load\u002Fstart\u002Fpreview\u002Funload events from `handy.log`; selection is not load evidence and log events are historical, not proof of current residency |\n| WinML \u002F local helper processes | GPU-backed execution is in scope; generic process counters and runtime detection only. No WinML-specific model\u002Fsession or client-to-helper attribution yet |\n| Windows Studio Effects | Only any observable GPU portion is in scope. NPU inference is out of scope; do not interpret GPU camera\u002Frender activity as proof of model execution |\n\nWinML can select different execution backends; a local helper\u002Fservice is still **local**, not\ncloud-hosted. The GPU counters belong to whichever process holds\u002Fuses the GPU resources.\nParent-PID lookup currently helps find Ollama\u002FLM Studio APIs; it is not a general cross-process\nownership graph for shared Windows services.\n\nGPU-backed WinML and Studio Effects paths have **not been validated on a Copilot+ PC**. A future\nhardware check should compare idle versus active workload samples, record the actual GPU adapter\nand resource-owning PID (including helpers), and verify the execution provider using runtime\ndiagnostics. Match any reported model\u002Fsession to that PID before claiming attribution. If execution\nis CPU\u002FNPU-only, record it as out of scope rather than a missing GPU model. No NPU collector is planned.\n\n### How models are identified\n\nEvery model row shows its **evidence**, strongest first:\n\n| Evidence | Meaning |\n|---|---|\n| `api` | The runtime's local API reports the model as loaded |\n| `mapped` | Windows shows the file memory-mapped into the process right now |\n| `cmdline` | The file was a launch argument (`-m model.gguf`) |\n| `installed` | Found in the app's install or data folder; nothing proves it is loaded |\n| Handy settings \u002F log | Settings show selection; timestamped log events show what Handy reported, not current residency |\n\nTwo sources including `api` or `mapped` show as **confirmed**. Runtime logs can report model events,\nbut are displayed as timestamped history and do not prove current residency. Model-store folders\nonly supply a friendly name. The authoritative model *kind* comes from GGUF header keys: `decision.type` marks a\ndecision model (for example [Laya](https:\u002F\u002Fhuggingface.co\u002Fggml-org\u002FLaya-GGUF)), `pooling_type`\nan embedding model or reranker, `stt.*` a speech model, and a causal model with layers and a\ntrained context an LLM. llama-server's `\u002Fv1\u002Fmodels` `output_modalities` (`text`, `decisions`)\nconfirms it. Non-causal encoders such as Laya allocate no KV cache, so none is estimated.\n\nWhen a file lacks specific kind metadata, known local decision-model names (`openjev`, `laya`,\n`julia-1`, `lev`, `kev`) supply a **likely decision model (name)** hint. Matching uses delimited\nnames in the filename, immediate model folder, or resolved store model name, not arbitrary path\nsubstrings, publishers, or Ollama tags. The process category is `decision?`; specific GGUF kinds\ntake precedence. Hints do not change loading evidence, causal\u002FKV calculations, or installed-candidate\nstatus. JSON preserves the header-derived `kind` separately from `kind_hint` and `kind_label`.\n\nFor example, [ggml-org\u002FOpenJev-GGUF](https:\u002F\u002Fhuggingface.co\u002Fggml-org\u002FOpenJev-GGUF) includes\n`qwen35.decision.type=openjev`; the inspected community\n[openjev\u002Fopenjev-GGUF](https:\u002F\u002Fhuggingface.co\u002Fopenjev\u002Fopenjev-GGUF) Q4_K_M header lacks that key and\nuses the generic internal name `Snapshot_Cfg`, so its filename or store name supplies only a hint.\nNeither a type hint nor an API\u002Ffile match proves which model produced the process's GPU activity.\n\nSome runtimes (ONNX Runtime, whisper.cpp) read a model into memory and close the file. Windows then\nhas no record of which file is loaded, so the app's installed models are listed as candidates only.\nFor Handy, gputaskman reads the configured `selected_model` and only model-load, streaming-start,\npreview, and unload events from its local log. Settings prove selection; a fresh log event proves\nHandy reported that event after the current process started. Neither proves continuous GPU residency.\nLog parsing is bounded to the last 512 KiB, cached until the file changes, and ignores transcription\ncontent. Handy's selected Hugging Face model can live outside its Roaming `models` folder. Handy\nlogs in UTC; JSON keeps that UTC timestamp and the TUI\u002Ftext output show local time.\n\n**Other speech and vision apps.** Handy is the first *app adapter*: a read-only recipe for where an\napp keeps its settings and which log lines mark a model load or unload. Most whisper-style apps\n(whisper.cpp, faster-whisper, sherpa-onnx, ONNX Runtime) read a model and close the file, so the OS\nkeeps no record of it. Adapters give exact names when an app logs them, but each app needs its own\nrecipe, and a log-format change can break it. The runtime-agnostic answer is to see the file being\nopened during the load: Windows kernel file-I\u002FO ETW events record which process opened which model\nfile. Combined with that process's VRAM jump, this identifies the model without app-specific code.\nIt needs elevation and must already be running when the load happens, so it is planned as an\nopt-in mode. Until then, unknown apps show their runtime DLLs, VRAM, engine activity, and installed\ncandidates. Reading model names out of another process's memory is deliberately not done.\n\nIdentification is designed to stay cheap. Measured on one Windows machine:\n\n| Probe | Cost | Used |\n|---|---|---|\n| Process list, command line, listening ports | under 1 ms | Once per process \u002F every 5 s |\n| Memory-map scan (DLLs + mapped files) | 1-50 ms per process | New processes, a 64 MiB \u002F 10% memory change, or every 2 min; at most 150 ms per refresh |\n| GGUF header, model-store manifests | ms, cached | Once per file \u002F every 60 s |\n| Local API probes | ms, local only | llama-server `\u002Fv1\u002Fmodels` only when its model path changes |\n| `psutil.open_files()` | 0.6-2.5 s per process | Never |\n| macOS: `ioreg` device stats + Metal clients | ~10 ms | Every refresh |\n| macOS: memory-map scan (`proc_pidinfo` region walk) | ~4 ms per process | Same policy as the memory-map scan above |\n| macOS: `footprint` GPU memory | ~70 ms per process, background thread | Busy and new processes every ~2 s, idle ones every 30 s (54 runs in 40 s with 27 GPU processes, M4 Mac mini) |\n\nWith two llama-servers running, a steady refresh costs roughly 15-30 ms of CPU (about 340 ms before\nprocess details were cached).\n\nFor log-reported buffer sizes, start your own llama-server with logging enabled:\n\n```powershell\nllama-server.exe -m .\\model.gguf -ngl 99 -c 8192 --metrics --log-file server.log -lv 4\n```\n\nUse a real model you already have. This is an example workload, **not a prerequisite for\nrunning gputaskman**. Verbosity 4 was needed to capture the buffer-size lines in the tested\nllama.cpp build. Prefer an absolute log path if the server and monitor use different\nworking directories.\n\nThe collector probes existing local listening ports with GET requests to `\u002Fprops`, `\u002Fslots`,\n`\u002Fmetrics`, `\u002Fv1\u002Fmodels`, `\u002Fapi\u002Fps`, `\u002Fapi\u002Fv1\u002Fmodels`, and `\u002Fapi\u002Fv0\u002Fmodels`. Endpoints may be\nabsent, disabled, or authenticated; other evidence is still useful. It does not launch `ollama`,\n`lms`, or an inference request. Throughput may update only after a request completes.\n\nOllama's local `server.log` is considered when one Ollama runner is detected. Log formats,\nrotation, and stale load blocks can affect attribution, so compare the reported model and\nprocess when interpreting logs. Log sizes describe allocations at load time, not necessarily\nwhich pages remain resident now. An inferred remainder is runtime\u002Funknown overhead, not an\nexact measurement of the CUDA context.\n\nWithout logs, estimates assume llama.cpp-style placement. Architecture, partial offload,\nKV quantization, sliding-window attention, and multiple models in one process can all change\nthe result. Separate runner processes get separate rows; per-model KV accounting within\none process is not yet supported.\n\n### Spot checks against llama.cpp\n\nThe following comparisons used llama.cpp b12061, CUDA 13.4, and an RTX 4080 SUPER.\nThey validate these examples, not every model architecture or backend.\n\n| Allocation | GGUF estimate | Runtime log |\n|---|---|---|\n| Qwen3-0.6B Q8_0 GPU weights | 604.15 MiB | 604.15 MiB |\n| Qwen3-0.6B KV, 8,192 context, f16 | 896 MiB | 896 MiB |\n| Gemma-3-270M GPU weights | 271.81 MiB | 271.86 MiB |\n| Gemma-3-270M KV, 4,096 context | 72 MiB upper bound | 49.5 MiB with sliding-window attention |\n\n## Privacy and troubleshooting\n\nThe monitor reads local process metadata, compatible model headers, load logs, and local server\nresponses. It does not dump model weights or send telemetry. **The normal inspector and JSON\noutput can contain paths, command-line flags, model names, and local ports. Review and redact\ncaptures before posting them publicly.** The screenshot helper omits command lines and full\nfile paths, but model and process names still require review.\n\n| Symptom | What to check |\n|---|---|\n| `uv` or `git` is not recognized | Install the prerequisites, then open a new terminal |\n| Empty or incomplete GPU readings | Check the GPU driver and WDDM 2.0+ support in `dxdiag`; use a normal local desktop session |\n| \"supports Windows and Linux\u002FWSL only\" | macOS is not supported |\n| WSL: `Windows host counters: off (WSL interop is disabled)` | Enable `[interop]` in `\u002Fetc\u002Fwsl.conf`, then `wsl --shutdown`; or accept device-wide numbers |\n| WSL: `starting` for a few seconds | The first Windows counter sample takes about 2.5 s |\n| WSL: `unmatched` | No Windows adapter's usage matched the NVML device; multi-GPU WSL is not validated |\n| WSL: Linux rows show `?` | Processes were running before gputaskman started; they become `*` with evidence (see the matching table) |\n| Linux: a GPU process is missing | Processes owned by other users need `sudo`; Docker and other WSL distros are not visible from this one |\n| Linux container: `H:\u003Cpid>` rows | GPU processes outside this container's PID namespace (host or other containers); NVML sees them, the container cannot name them |\n| Missing DLLs or model details | Protected processes may deny inspection; basic counters can still work without elevation |\n| No exact LLM breakdown | Enable compatible buffer logging, or use the GGUF estimate; API\u002Flog access is optional |\n| The screen looks cramped | Widen the terminal or use `--once` \u002F `--json` |\n\n## Development\n\n```powershell\nuv sync --locked\nuv run --locked python -m unittest discover -s tests -v\nuv build\n```\n\nCI runs hardware-independent checks on Windows, Ubuntu and macOS, Python 3.11 and 3.13. Live GPU behavior\nstill needs real hardware; the CI does not pretend to validate that. The WSL matching tests replay\ncontext sequences measured on a real WSL2 machine.\n\nContributors and coding agents: [AGENTS.md](AGENTS.md) lists the evidence rules every change must\nkeep, a module map, verification steps, and the release process.\n\n### Building portable releases\n\nUse Python 3.13 of the **target architecture**. PyInstaller does not cross-compile: an x64\nPython process makes an x64 executable even when running under ARM64 emulation.\n\n```powershell\nuv sync --locked --group release --python 3.13\nuv run --locked --group release python tools\\build_portable.py --arch x64\n# On a native ARM64 interpreter, use --arch arm64 instead.\n```\n\nThe same command on Linux (`tools\u002Fbuild_portable.py`) produces a `.tar.gz`, which keeps the\nexecutable bit. The builder refuses to package NVIDIA driver libraries (`libnvidia-ml.so`,\n`libcuda.so`) on either platform; they come from the installed driver.\n\nThe builder verifies the interpreter and executable architectures, includes Textual resources\nand dependency licenses, and writes the complete portable ZIP and SHA-256 file to `dist`.\nIt does not bundle Windows or GPU driver DLLs, inference servers, or models. Keep uv for development;\nthe executable ZIP is for running the monitor without a Python environment.\n\nThe **Portable release** GitHub Actions workflow builds on `windows-2022` (x64), `windows-11-arm`\n(ARM64), `ubuntu-22.04` (Linux x64), and `ubuntu-22.04-arm` (Linux ARM64). Linux builds use the\noldest supported Ubuntu because the frozen binary needs the build machine's glibc or newer. A manual run produces downloadable workflow artifacts without publishing\na release. A pushed `vVERSION` tag must match `project.version` in `pyproject.toml`; once all builds\npass, the workflow publishes all four archives and checksums together with generated release notes.\nBuild jobs have read-only permissions; only the tag-triggered publish job can write releases.\nCI checks the extracted executable's `--help` outside the checkout with Python removed from `PATH`;\ninteractive rendering and real GPU snapshots require local hardware testing.\n\nTo capture native SVG screenshots of your own running workloads:\n\n```powershell\nuv run --locked python tools\\capture_screenshots.py --output .\\captures\n```\n\nThe checked-in gallery uses PNG renderings of these captures. No models, logs, or executable\ndownloads are bundled in this repository.\n\n| Module | Responsibility |\n|---|---|\n| `pdh.py` \u002F `dxgi.py` | Windows counters and adapter enumeration |\n| `linux.py` | Linux backend: NVML adapters and per-process usage, container PID matching, WSL detection, `\u002Fdev\u002Fdxg` holders |\n| `wslhost.py` | WSL: interop check, Windows host counter stream, adapter pairing, context matching |\n| `macos.py` | macOS backend: IOKit device stats and per-process GPU time, `footprint` GPU memory poller, libproc memory maps |\n| `nvml.py` | NVIDIA device readings |\n| `adl.py`, `amdsmi.py` | Optional AMD device readings |\n| `procinfo.py` | Runtime, mapped-file, and process discovery |\n| `stores.py` | Friendly names from Ollama, LM Studio, and Hugging Face model stores |\n| `gguf.py` | Model metadata, kind, and size estimates |\n| `llm.py` | Buffer logs, local server probing, and breakdowns |\n| `collector.py` | Shared snapshot collection |\n| `app.py` \u002F `report.py` \u002F `cli.py` | TUI, text\u002FJSON, and command-line entry points |\n| `diff.py` | Before\u002Fafter comparison of two `--json` snapshots |\n\n## Next\n\n- Model identity for non-GGUF runtimes (ONNX Runtime, PyTorch, TensorRT) beyond installed candidates.\n- Explicit provenance and availability for every counter and estimate.\n- Reliable multi-GPU matching and per-device model placement.\n- Bare-metal Linux validation on hardware; AMD and Intel GPUs on Linux through DRM fdinfo.\n- macOS: a portable build, Ollama\u002Fllama.cpp\u002FMLX validation, and compressed GPU memory (footprint's\n  `swapped`) as the paged column.\n- WSL: per-process GPU load for Linux rows, and Ollama's systemd journal as a log source.\n- Live throughput deltas, LM Studio validation, and per-model context accounting.\n- Opt-in ETW file-open tracing to name models loaded by read-and-close runtimes (any whisper or ONNX\n  app), correlated with the process's VRAM jump at load time.\n- Data-driven app adapters (settings path plus load\u002Funload log patterns) once a second app needs one.\n- Optional ETW \u002F runtime instrumentation for allocation lifetime and residency detail.\n\n## License\n\n[MIT](LICENSE).\n","gputaskman 是一款跨平台 GPU 任务管理工具，用于实时监控本地 GPU 上各进程的显存占用、计算活动及大语言模型（LLM）相关资源分布。它支持 Windows（NVIDIA\u002FAMD）、Linux\u002FWSL（NVIDIA）和 macOS（Apple Silicon），提供类似 htop 的终端界面，可区分模型权重、KV 缓存、计算缓冲区等 VRAM 组成，并关联运行时环境与模型文件路径。项目不依赖 Python 运行时，采用便携式二进制分发，适用于本地 LLM 推理、微调、AI 应用调试及 GPU 资源瓶颈分析等场景，不覆盖云服务或纯 CPU\u002FNPU 工作负载。",2,"2026-11-24 04:32:59","CREATED_QUERY"]