Skip to content

Instantly share code, notes, and snippets.

Avatar

Xiaoyang Chen xychenunc

  • Chapel Hill, USA
View GitHub Profile
@xychenunc
xychenunc / gpu_stat.py
Created Dec 11, 2018 — forked from matpalm/gpu_stat.py
json formatting of nvidia-settings
View gpu_stat.py
#!/usr/bin/env python
# gpu_stat.py [DELAY [COUNT]]
# dump some gpu stats as a line of json
# {"util":{"PCIe":"0", "memory":"11", "video":"0", "graphics":"13"}, "used_mem":"161"}
import json, socket, subprocess, sys, time
try:
delay = int(sys.argv[1])
except:
delay = 1