Skip to content

Instantly share code, notes, and snippets.

@andrewnc
Created August 18, 2023 20:19
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save andrewnc/919ac1ec7e4c32e786e7bd69cbf78a45 to your computer and use it in GitHub Desktop.
Save andrewnc/919ac1ec7e4c32e786e7bd69cbf78a45 to your computer and use it in GitHub Desktop.
hacky gpu ussage
def get_GPU_usage():
cmd = "nvidia-smi --query-gpu=utilization.gpu --format=csv,noheader,nounits"
result = subprocess.check_output(cmd, shell=True).decode('utf-8')
usages = list(map(int, result.strip().split('\n')))
return usages
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment