Skip to content

Instantly share code, notes, and snippets.

@Mehanik
Created July 13, 2018 09:34
Show Gist options
  • Save Mehanik/cd308151a3a93398f442c1e33dc8ca01 to your computer and use it in GitHub Desktop.
Save Mehanik/cd308151a3a93398f442c1e33dc8ca01 to your computer and use it in GitHub Desktop.
Monitor GPU status by memory consumption and show GPU availability in linux framebuffer.
#!/bin/bash
PREV_STARUS=3
while true; do
if (( $(nvidia-smi --query-gpu=memory.used --format=csv,nounits,noheader) > 1000 )); then
STATUS=0
else
STATUS=1
fi
if [ $STATUS != $PREV_STARUS ]; then
if [ $STATUS == 1 ]; then
fbi -T 1 /home/eggnot/free.png
else
fbi -T 1 /home/eggnot/busy.png
fi
fi
PREV_STARUS=$STATUS
sleep 5
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment