NVIDIA GPU Monitor for Project Nomad. #689
jrsphoto
started this conversation in
Show and tell
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
-
I'll get this out of the way first. I'm not a programmer. What I do, I do for myself and yes, I use Claude.
With that said, I've been testing a few different GPU's with Nomad and it got to be a pain to monitor the critical parameters of the card while doing prompts. so after a few rounds with Claude, I came up with a python gui monitor that worked for what I needed. Thought others might find it useful. Both of my cards are NVIDIA, and the code makes use of nvidia-smi. for amd cards, this code will not work.
nomad_monitor.py
There is nothing fancy about the python, It's a small web server that runs on your NOMAD machine and serves up a single dashboard page. Every second, your browser asks the server "what's going on?" and the server goes out and collects fresh data from three places:
nvidia-smi -- the NVIDIA command line tool that's already on your system. The script just runs it in the background and grabs the numbers it returns, things like GPU temperature, how hard the GPU is working, how much VRAM is in use, and how much power it's drawing.
Ollama's API -- Ollama has a built-in API endpoint that tells you what models are currently loaded and how much memory they're using. The script just calls that URL and reads the response.
Docker logs -- every time Ollama loads a model it writes a log entry saying how many layers it put on the GPU vs leaving on the CPU. The script reads the last few lines of those logs to pull out that information.
All three of those get bundled up as a JSON response and sent back to your browser, which updates the gauges, bars, and sparkline charts in real time.
There's no database, no background threads, nothing fancy. The server just answers questions when the browser asks. If you close the browser tab the server just sits idle. If you stop the script the dashboard goes away.
The whole thing is one Python file with no dependencies beyond what ships with Python and Linux.
At idle:

Processing a prompt:
Beta Was this translation helpful? Give feedback.
All reactions