Logging temperature of your GPU

This script (using BASH and AWK) allows to log the core temperature of NVIDIA’s GPUs.

#!/bin/bash
count=0
sum=0
oldt=0
while true
do
val=`nvidia-settings -q [gpu:0]/GPUCoreTemp | grep "Attribute" | sed -e "s/.*: //g" -e "s/\.//g"`
t=`date +%s`
if [ "$oldt" -ne $t ]
then
if [ "$oldt" -ne 0 ]
then
mean=`echo $sum $count | awk '{print $1/$2}'`
echo $oldt $mean
fi
count=0
sum=0
fi
count=$(($count+1))
sum=`echo $sum $val | awk '{print $1+$2}'`
oldt=$t
done

Here’re the results, showing how the GPU heats up during a short run, playing with the fluidsGL example from NVIDIA’s SDK.
GPU temperature

Popularity: 51%

Posted in computer, programming

Leave a Reply

Archives
Categories
Visitors over the last 30 days