Created
August 18, 2023 20:19
-
-
Save andrewnc/919ac1ec7e4c32e786e7bd69cbf78a45 to your computer and use it in GitHub Desktop.
hacky gpu ussage
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
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