-
-
Save lgalke/4d551ad72129fadc190074f4745047e4 to your computer and use it in GitHub Desktop.
gtop: who uses how much RAM on which GPUs
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
#!/usr/bin/env bash | |
GPUID_PID_RAM=`nvidia-smi | sed '0,/Processes:/d' | grep -oe "\<[0-9]\+\(MiB\)\?\>" | xargs` | |
set -- $GPUID_PID_RAM | |
while [ -n "$3" ]; do | |
_u=`ps -q "$2" -eo "uname" | tail -n +2` | |
printf '%s is using %s on GPU %s\n' "$_u" "$3" "$1" | |
shift 3 | |
done |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
~/bin
.~/bin
is present in$PATH
.gtop
anywhere to quickly find out which GPUs are free.