Skip to content

Instantly share code, notes, and snippets.

@FindHao
Last active January 18, 2021 15:09
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save FindHao/ba9d219ddba8dcc958fee23a38388b22 to your computer and use it in GitHub Desktop.
Save FindHao/ba9d219ddba8dcc958fee23a38388b22 to your computer and use it in GitHub Desktop.
nvidia-smi
echo "" > /tmp/gpu.log
while true;
do
sleep 0.8
filesize=`ll /tmp/gpu.log |cut -d \ -f 5`
maxsize=$((1024*10))
if [ $filesize -gt $maxsize ]
then
tail -n 100 /tmp/gpu.log > /tmp.gpu2.log
mv /tmp/gpu2.log /tmp/gpu.log
fi
nvidia-smi --query-compute-apps=timestamp,pid,name,used_memory --format=csv >> /tmp/gpu.log
done
watch -n 0.5 'tail -n 2 /tmp/gpu.log'
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment