Created
March 3, 2014 10:27
home-made GPU top using nvidia-smi
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
#!/bin/bash | |
SAMPLE_COUNT=20; | |
INTERVAL=0.5; | |
for (( c=1; c<=$SAMPLE_COUNT; c++ )); do nvidia-smi --query-gpu=utilization.gpu,utilization.memory --format=csv,noheader,nounits >> /tmp/GPU_$TIMESTAMP; sleep $INTERVAL; done; | |
GPU_USG_SUM=`cat /tmp/GPU_$TIMESTAMP | sed 's/, / /g' | awk '{sum+=$1}END{print sum}'` | |
GPU_USG_MIN=`cat /tmp/GPU_$TIMESTAMP | sed 's/, / /g' |cut -d ' ' -f 1 | sort | head -n 1` | |
GPU_USG_MAX=`cat /tmp/GPU_$TIMESTAMP | sed 's/, / /g' |cut -d ' ' -f 1 | sort | tail -n 1` | |
GPU_MEM_SUM=`cat /tmp/GPU_$TIMESTAMP | sed 's/, / /g' | awk '{sum+=$2}END{print sum}'` | |
GPU_MEM_MIN=`cat /tmp/GPU_$TIMESTAMP | sed 's/, / /g' |cut -d ' ' -f 2 | sort | head -n 1` | |
GPU_MEM_MAX=`cat /tmp/GPU_$TIMESTAMP | sed 's/, / /g' |cut -d ' ' -f 2 | sort | tail -n 1` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment