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

Address second review pass

Martin Pluskalc9fd5240aff1
diff --git a/README.md b/README.md
index 48cee40..9d45e51 100644
--- a/README.md
+++ b/README.md
@@ -273,10 +273,10 @@ reference and the engine percentages are still measured.
Live check of the root-only readings on the same machine (`intel_gpu_top` from intel-gpu-tools as reference,
`perf_event_paranoid=2`): under `vkmark` load the header's GPU % reads 48-95% against `intel_gpu_top` Render
-51-92% across scenes, and power reads 0.4 W idle against its 0.4 W (9.0 W under load against 6.5-6.8 W in a
-nearby window; scenes vary). A VA-API `ffmpeg` decode loop drives the video engine to 99.9% on both
-(`intel_gpu_top` Video 99.4-99.9%). Without root the three stay `N/A` with a reason, while the GT clock,
-throttle and per-process rows keep working.
+51-92% across scenes, and power reads 0.4 W idle against its 0.4 W (under load 9.0 W against 6.5-6.8 W in a
+nearby window; scenes vary, and uncore is approximate while the CPU is active). A VA-API `ffmpeg` decode loop
+drives the video engine to 99.9% on both (`intel_gpu_top` Video 99.4-99.9%). Without root the three stay `N/A`
+with a reason, while the GT clock, throttle and per-process rows keep working.
**WSL** is different, because Windows owns the GPU. Linux cannot see how much VRAM its own
processes use: `nvidia-smi` lists no processes, NVML's per-process samples carry *Windows* PIDs
diff --git a/src/gputaskman/drm.py b/src/gputaskman/drm.py
index 81d97db..0089603 100644
--- a/src/gputaskman/drm.py
+++ b/src/gputaskman/drm.py
@@ -870,6 +870,9 @@ class DrmCounters:
self.sample()
self.scan_budget = budget
intel_cards = [c for c in self.cards if c.intel]
+ for card in intel_cards:
+ if card.integrated:
+ _intel_rapl_w() # arm the power baseline; RAPL is package-global, unaffected by sharing
if len(intel_cards) > 1:
# One i915 PMU for the whole driver: its counters can't be attributed to either card,
# so neither gets device load instead of both showing the same numbers.
@@ -877,12 +880,9 @@ class DrmCounters:
_INTEL_PMU_STATE.setdefault(card.sysfs, {"fds": {}, "prev": {}, "fail": "shared"})
return
for card in intel_cards:
- if card.intel:
- # Arm the device-wide baselines too: --once sleeps a second after Collector init,
- # so its single sample is already a rate over a real interval.
- _intel_pmu_rates(card.sysfs)
- if card.integrated:
- _intel_rapl_w()
+ # Arm the load baseline too: --once sleeps a second after Collector init,
+ # so its single sample is already a rate over a real interval.
+ _intel_pmu_rates(card.sysfs)
def _adapters(self) -> dict[int, AdapterGpu]:
out: dict[int, AdapterGpu] = {}
diff --git a/tests/test_drm.py b/tests/test_drm.py
index 8a82e6b..56b64c0 100644
--- a/tests/test_drm.py
+++ b/tests/test_drm.py
@@ -1752,7 +1752,7 @@ class IntelCounterStatusTests(unittest.TestCase):
def test_hwmon_power_needs_no_rapal_reason(self):
# A discrete card's hwmon sensor already answered: RAPL was never needed, so its
- # failure (cached from the unconditional start() priming) must not be reported.
+ # failure must not be reported. (start() primes RAPL only for integrated cards.)
drm._INTEL_RAPL_FAIL = "denied"
nv = SimpleNamespace(power_kind="Board")
self.assertEqual(drm.intel_counter_status(self._card(), nv), "")