-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathwatchgpu
executable file
·35 lines (29 loc) · 2.49 KB
/
watchgpu
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
#!/bin/bash
#
# Author: Artur O. [email protected] (Justice @ Freenode #Archlinux)
queryGPU() {
_gpu_id="[gpu:0]"
_gpu_name=$(nvidia-settings -q gpus | awk '/GeForce/ {print $3 " " $4 " " $5}')
_utilization=$(nvidia-settings -t -q "$_gpu_id"/GPUUtilization | tr ',' '\n')
_core_temp=$(nvidia-settings -t -q "$_gpu_id"/GPUCoreTemp)
_total_memory=$(nvidia-settings -t -q "$_gpu_id"/TotalDedicatedGPUMemory)
_used_memory=$(nvidia-settings -t -q "$_gpu_id"/UsedDedicatedGPUMemory)
_gpu_usage=$(echo "$_utilization" | grep graphics | sed 's/[^0-9]//g')
_mem_usage=$(echo "$_utilization" | grep memory | sed 's/[^0-9]//g')
_pci_usage=$(echo "$_utilization" | grep PCIe | sed 's/[^0-9]//g')
_gpu_freq=($(nvidia-settings -t -q [gpu:0]/GPUCurrentClockFreqs | sed 's/,/ /g'))
_gpu_current=($(nvidia-settings -t -q [gpu:0]/GPUCurrentClockFreqsString | sed 's/,/ /g'))
_gpu_mem_transfer=(${_gpu_current[8]#*=})
_gpu_current_voltage=$(nvidia-settings -t -q [gpu:0]/GPUCurrentCoreVoltage)
echo ""
echo -e "\e[1;31m$_gpu_name\e[0m"
echo -e "\tGPU usage: $_gpu_usage%"
echo -e "\tMEM usage: $((100*$_used_memory/$_total_memory))% ($_used_memory/$_total_memory MB)"
echo -e "\tCore Temp: $_core_temp°C"
echo ""
echo -e "\tBandwidth" "\tFrequency" "\t\tVoltage"
echo -e "\tMEM: $_mem_usage%\tGPU: ${_gpu_freq[0]} MHz\tGPU Core: "$(bc <<< "scale=3; $_gpu_current_voltage/1000000")"V"
echo -e "\tPCIe: $_pci_usage%\tMemory: $_gpu_mem_transfer MHz"
echo ""
}
queryGPU