SHARE
TWEET

Until nvidia-smi gets fixed, this will have to do.

a guest Apr 6th, 2014 3,158 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. gpulist=`nvidia-settings -t -q gpus`
  2. gpulist=`echo "$gpulist" | sed -e 's/^ *//'` # no leading spaces
  3. gpulist=`echo "$gpulist" | grep -e '^\['`
  4.  
  5. echo $gpulist | while read LINE; do
  6.         gpuid=`echo "$LINE" | cut -d \  -f 2 | grep -E -o '\[.*\]'`
  7.         gpuname=`echo "$LINE" | cut -d \  -f 3-`
  8.        
  9.         gpuutilstats=`nvidia-settings -t -q "$gpuid"/GPUUtilization | tr ',' '\n'`
  10.         gputemp=`nvidia-settings -t -q "$gpuid"/GPUCoreTemp`
  11.         gputotalmem=`nvidia-settings -t -q "$gpuid"/TotalDedicatedGPUMemory`
  12.         gpuusedmem=`nvidia-settings -t -q "$gpuid"/UsedDedicatedGPUMemory`
  13.  
  14.         gpuusage=`echo "$gpuutilstats"|grep graphics|sed 's/[^0-9]//g'`
  15.         memoryusage=`echo "$gpuutilstats"|grep memory|sed 's/[^0-9]//g'`
  16.         bandwidthusage=`echo "$gpuutilstats"|grep PCIe|sed 's/[^0-9]//g'`
  17.  
  18.         echo "$gpuid $gpuname"
  19.         echo -e "\tRunning at : $gpuusage%"
  20.         echo -e "\tCurrent temperature : $gputemp°C"
  21.         echo -e "\tMemory usage : $gpuusedmem MB/$gputotalmem MB"
  22.         echo -e "\tMemory bandwidth usage : $memoryusage%"
  23.         echo -e "\tPCIe bandwidth usage : $bandwidthusage%"
  24. done
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top