-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathbenchmark
executable file
·54 lines (45 loc) · 1.23 KB
/
benchmark
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
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
#!/bin/bash
queryGPU() {
_gpu_id="[gpu:0]"
_utilization=$(nvidia-settings -t -q "$_gpu_id"/GPUUtilization | tr ',' '\n')
_core_temp=$(nvidia-settings -t -q "$_gpu_id"/GPUCoreTemp)
_used_memory=$(nvidia-settings -t -q "$_gpu_id"/UsedDedicatedGPUMemory)
_total_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')
echo ""
echo -e "\tRunning at : $_gpu_usage%"
echo -e "\tCurrent temperature : $_core_temp°C"
echo -e "\tMemory usage : $_used_memory MB/$_total_memory MB"
echo -e "\tMemory bandwidth usage : $_mem_usage%"
echo -e "\tPCIe bandwidth usage : $_pci_usage%"
echo ""
}
# Create tempfile for process id
pids=~/pids
# Create renders
for i in {1..50}
do
glxspheres64 &> /dev/null &
echo $! >> "$pids"
queryGPU
sleep 1
done
# Wait x sekonds
queryGPU
sleep 10
queryGPU
echo "10 seconds left"
sleep 10
queryGPU
echo "Benchmark finished"
# Terminate render process
for i in {1..10}
do
kill $(sed -n "$i"'{p;q}' pids)
sleep 1
done
queryGPU
# Cleanup
rm "$pids"