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
Fix AMD SMI temperature units and forbid bundling AMD SMI libraries
Scott Hanselmanb33265193bd7
diff --git a/src/gputaskman/amdsmi.py b/src/gputaskman/amdsmi.pyindex a94f1ef..667d407 100644--- a/src/gputaskman/amdsmi.py+++ b/src/gputaskman/amdsmi.py@@ -68,7 +68,7 @@ class AmdSmi:temp = self._call("amdsmi_get_temp_metric", self.handle,self.api.AmdSmiTemperatureType.EDGE, self.api.AmdSmiTemperatureMetric.CURRENT)value = _number(temp)- d.temp = value / 1000 if value is not None else None+ d.temp = value # AMD SMI reports degrees Celsiusexcept AttributeError:passreturn ddiff --git a/tests/test_core.py b/tests/test_core.pyindex 9fc755e..c4aea3e 100644--- a/tests/test_core.py+++ b/tests/test_core.py@@ -155,11 +155,11 @@ class DeviceSelectionTests(unittest.TestCase):amdsmi_get_power_info=lambda h: {"socket_power": 42, "power_limit": "N/A"},AmdSmiTemperatureType=SimpleNamespace(EDGE=1),AmdSmiTemperatureMetric=SimpleNamespace(CURRENT=2),- amdsmi_get_temp_metric=lambda *args: 47500,+ amdsmi_get_temp_metric=lambda *args: 47, # AMD SMI reports degrees Celsius)provider = AmdSmi(amd, [amd], api)sample = provider.sample()- self.assertEqual((sample.source, sample.util_gpu, sample.temp, sample.power_w), ("AMD SMI", 0, 47.5, 42))+ self.assertEqual((sample.source, sample.util_gpu, sample.temp, sample.power_w), ("AMD SMI", 0, 47, 42))self.assertIsNone(sample.power_limit_w)self.assertIsNone(sample.util_mem)provider.close()diff --git a/tests/test_portable.py b/tests/test_portable.pyindex b7ea1bf..2d5dc72 100644--- a/tests/test_portable.py+++ b/tests/test_portable.py@@ -79,9 +79,11 @@ class PortableTests(unittest.TestCase):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")+ for dll in ("NVML.dll", "atiadlxx.dll", "amd_smi.dll"):+ (root / dll).write_bytes(b"driver")+ with self.assertRaisesRegex(ValueError, "must not be distributed"):+ create_archive(root, root / "output", "0.1.0", "arm64")+ os.remove(root / dll)class LinuxPortableTests(unittest.TestCase):@@ -134,7 +136,7 @@ class LinuxPortableTests(unittest.TestCase):with tempfile.TemporaryDirectory() as temporary:root = Path(temporary)self.write_elf(root / "gputaskman", 0x3E)- for lib in ("libnvidia-ml.so.1", "libcuda.so.1"):+ for lib in ("libnvidia-ml.so.1", "libcuda.so.1", "libamd_smi.so.0"):(root / lib).write_bytes(b"driver")with self.assertRaisesRegex(ValueError, "must not be distributed"):create_linux_archive(root, root / "output", "0.1.0", "x64")diff --git a/tools/build_portable.py b/tools/build_portable.pyindex 0ee6831..8668ce5 100644--- a/tools/build_portable.py+++ b/tools/build_portable.py@@ -22,7 +22,7 @@ ROOT = Path(__file__).resolve().parents[1]MACHINES = {"x64": 0x8664, "arm64": 0xAA64} # PE machineELF_MACHINES = {"x64": 0x3E, "arm64": 0xB7} # ELF e_machine# Provided by Windows or the installed GPU driver, never by the portable app.-FORBIDDEN = ("nvml.dll", "nvcuda.dll", "atiadlxx.dll", "dxgi.dll", "pdh.dll", "libnvidia-ml.so", "libcuda.so", "libdxcore.so")+FORBIDDEN = ("nvml.dll", "nvcuda.dll", "atiadlxx.dll", "amd_smi.dll", "libamd_smi.so", "dxgi.dll", "pdh.dll", "libnvidia-ml.so", "libcuda.so", "libdxcore.so")PLATFORMS = {"win-amd64": ("windows", "x64"), "win-arm64": ("windows", "arm64"),"linux-x86_64": ("linux", "x64"), "linux-aarch64": ("linux", "arm64")}diff --git a/tools/portable.spec b/tools/portable.specindex 9533af3..dac4b83 100644--- a/tools/portable.spec+++ b/tools/portable.spec@@ -10,7 +10,7 @@ analysis = Analysis()# These belong to the operating system or the installed NVIDIA driver, not the portable app.-driver_libs = ("nvml.dll", "nvcuda.dll", "atiadlxx.dll", "dxgi.dll", "pdh.dll", "libnvidia-ml.so", "libcuda.so", "libdxcore.so")+driver_libs = ("nvml.dll", "nvcuda.dll", "atiadlxx.dll", "amd_smi.dll", "libamd_smi.so", "dxgi.dll", "pdh.dll", "libnvidia-ml.so", "libcuda.so", "libdxcore.so")def is_driver_lib(name):