Created
June 30, 2024 12:22
-
-
Save Blayung/cabac85f656b88fd882b5dd692f52a0c to your computer and use it in GitHub Desktop.
nvidia gpu usage python script meant for i3blocks
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/python3 | |
import bs4 | |
import subprocess | |
xmlData = bs4.BeautifulSoup(subprocess.check_output(["nvidia-smi", "-q", "-x"]), "xml") | |
print(f"GPU: {xmlData.find('gpu_util').string[:-2]}%, {xmlData.find('memory_util').string[:-2]}%") |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment