{"slug": "mockup-nvidia-gpus-on-linux-systems", "title": "Mockup Nvidia GPUs on Linux systems", "summary": "A new open-source tool, Mock Nvidia GPUs, lets Linux developers simulate NVIDIA GPU telemetry for monitoring software by intercepting NVML and nvidia-smi calls, without emulating CUDA or actual GPU hardware. The tool, built with gcc and make, provides scenario files for idle, loaded, thermal, and multi-GPU states, and supports runtime scenario swapping by reloading JSON files on modification. It is designed to test monitoring applications safely without replacing host drivers.", "body_md": "Mock nvidia gpus in Linux for monitoring software that reads NVIDIA telemetry\nthrough NVML or `nvidia-smi`\n\n. It does not emulate CUDA, PCI hardware, kernel\nioctls, MIG provisioning, or GPU computation.\n\n```\nmake\nmake test\n```\n\nRequirements: Linux, `gcc`\n\n, `make`\n\n, Python 3.\n\n```\nexport MOCK_NVIDIA_STATE=\"$PWD/scenarios/loaded.json\"\nexport LD_LIBRARY_PATH=\"$PWD/build${LD_LIBRARY_PATH:+:$LD_LIBRARY_PATH}\"\nexport PATH=\"$PWD/bin:$PATH\"\n\nnvidia-smi\nnvidia-smi --query-gpu=uuid,name,utilization.gpu,memory.used,memory.total,temperature.gpu,power.draw,power.limit --format=csv,noheader,nounits\npython3 examples/read_nvml.py\n```\n\nRun the loader diagnostic before testing a third-party program:\n\n```\n./bin/diagnose-loader\n```\n\nThe build provides all common loader names: `libnvidia-ml.so.1`\n\n,\n`libnvidia-ml.so`\n\n, `libnvml.so.1`\n\n, and `libnvml.so`\n\n. NVTOP currently documents\nthat it loads `libnvml.so`\n\n, rather than the canonical NVIDIA filename.\n\nFor an application linked to NVML:\n\n```\nLD_LIBRARY_PATH=\"$PWD/build\" MOCK_NVIDIA_STATE=\"$PWD/scenarios/thermal.json\" ./monitor\n```\n\nIf the application loads an absolute path, mount `build/libnvidia-ml.so.1`\n\nover\nthat library inside an isolated test container. Never replace the host driver\nlibrary.\n\n`LD_LIBRARY_PATH`\n\nis commonly removed by `sudo`\n\nand ignored by confined Snap or\nsetuid applications. A systemd service also needs both `LD_LIBRARY_PATH`\n\nand\n`MOCK_NVIDIA_STATE`\n\nin its unit environment. Run the tool directly as the same\nuser while establishing basic compatibility.\n\nPoint `MOCK_NVIDIA_STATE`\n\nat a scenario file to render a different operating\nface through `nvidia-smi`\n\nor the NVML library. Each mode is independent and\ncan be swapped at runtime.\n\n`scenarios/idle.json`\n\n— a GPU at rest. Low GPU and memory utilization, an idle\ntemperature, fans near their floor, and a minimal power draw. Clocks sit at\ntheir baseline speed.\n\n`scenarios/loaded.json`\n\n— a GPU running a busy compute workload. High GPU\nutilization, boosted graphics and memory clocks, and most of VRAM consumed.\n\n`scenarios/thermal.json`\n\n— a GPU at its thermal and power ceiling. Temperature\napproaches maximum, fans run at 100%, power draw is capped at the limit, the\nperformance state sags, and ECC reports errors.\n\n`scenarios/4gpus.json`\n\n— four GPUs under a mixed workload: two H100s in a\nbusy state and two L40S blades, one loaded and one idle. GPU order in the\narray determines the NVML index.\n\nThe library reloads the JSON file when its modification time changes. Switch scenarios without restarting the monitored process:\n\n```\ncp scenarios/thermal.json /tmp/mock-gpu.json\nexport MOCK_NVIDIA_STATE=/tmp/mock-gpu.json\n# edit or replace /tmp/mock-gpu.json while the collector runs\n```\n\nSupported state fields are demonstrated in `scenarios/loaded.json`\n\n. Memory is\nspecified in MiB and power in watts. NVML returns bytes and milliwatts as the\nreal API does.\n\nFor multiple GPUs, place one to eight device objects in `gpus`\n\n:\n\n```\n{\n  \"gpus\": [\n    {\n      \"name\": \"NVIDIA H100 80GB HBM3\",\n      \"uuid\": \"GPU-FAKE-0001\",\n      \"pci_bus_id\": \"00000000:01:00.0\",\n      \"gpu_utilization_percent\": 94,\n      \"vram_total_mib\": 81559,\n      \"vram_used_mib\": 74200,\n      \"temperature_c\": 78,\n      \"power_draw_w\": 610,\n      \"power_limit_w\": 700\n    },\n    {\n      \"name\": \"NVIDIA L40S\",\n      \"uuid\": \"GPU-FAKE-0002\",\n      \"pci_bus_id\": \"00000000:02:00.0\",\n      \"gpu_utilization_percent\": 20,\n      \"vram_total_mib\": 46068,\n      \"vram_used_mib\": 9000,\n      \"temperature_c\": 51,\n      \"power_draw_w\": 160,\n      \"power_limit_w\": 350\n    }\n  ]\n}\n```\n\nSee `scenarios/4gpus.json`\n\nfor a complete mixed-load example. GPU order in the\narray determines the NVML index. UUID and PCI bus ID must be unique.\n\n- initialization and shutdown\n- device count and handles by index or UUID\n- name, UUID, serial and PCI information\n- utilization, memory, temperature and fan speed\n- power draw and power limit\n- graphics, SM and memory clocks\n- performance state and compute mode\n- ECC mode and aggregate error count\n- running compute process count\n- driver and NVML versions\n\nUnsupported calls are absent. Add any required function to `src/mock_nvml.c`\n\nusing the same state loader and NVIDIA NVML function signature.\n\nThis package validates collectors, dashboards, alerts and recommendation logic. It cannot validate the NVIDIA kernel driver, CUDA workloads, PCI discovery, DCGM diagnostics, ECC hardware, throttling behavior or real process accounting.\n\nSupport the project and other projects like this by supporting the creator, feel free to reach out for other ways to contribute.\n\n- EVM:\n`0x6e8e3c2b31424266e7cff59e910df1587c317427`\n\n(ERC-20, BEP-20, TRC-20, AVAX-C, SPL, MATIC, POL, ARB, BASE, TON) - BTC:\n`bc1qzzvcguvqjc6qhwe2y5vy38w2zke7hksukjhm68`\n\n- LTC:\n`MPfm5QLKH1r9XxgWmH75Gyps4LDfX5c53L`\n\n- SOL:\n`GEaCMpnyM8tB5BU4RMuLm6tgMr3q9FgMHodxDxxAGby`\n\n- DOGE:\n`DPkJheSBTTkFv9oxnEwGsfvrcCvEWDVhVY`", "url": "https://wpnews.pro/news/mockup-nvidia-gpus-on-linux-systems", "canonical_source": "https://github.com/rnts08/Mock-nvidia-gpu-linux", "published_at": "2026-08-22 00:19:49+00:00", "updated_at": "2026-08-22 00:43:32.349133+00:00", "lang": "en", "topics": ["developer-tools", "ai-infrastructure"], "entities": ["NVIDIA", "NVML", "nvidia-smi", "Mock Nvidia GPUs", "H100", "L40S"], "alternates": {"html": "https://wpnews.pro/news/mockup-nvidia-gpus-on-linux-systems", "markdown": "https://wpnews.pro/news/mockup-nvidia-gpus-on-linux-systems.md", "text": "https://wpnews.pro/news/mockup-nvidia-gpus-on-linux-systems.txt", "jsonld": "https://wpnews.pro/news/mockup-nvidia-gpus-on-linux-systems.jsonld"}}