Skip to content

Instantly share code, notes, and snippets.

@andrewnc
Created August 18, 2023 20:19
Show Gist options
  • 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