Advertisement
Guest User

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

a guest
Apr 6th, 2014
4,824
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Bash 1.03 KB | None | 0 0
  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
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement