I have been using a library called GPUtil to try and log the utilisation percentage value of my GPU in an array.
The command i have used outputs too many pieces of data to be added to my array. I only want the percentage utilisation of the core. The memory utilisation doesn't concern me.
The two arrays are being used for a graph in PyQtgraph
The function I have written looks like this:
import GPUtil
import time
time_x = []
gpu_y = []
def gpu_util_timer(self):
for n in range(10):
Graph_Util.gpu_y.append(GPUtil.showUtilization())
Graph_Util.time_x.append(n)
time.sleep(1)
print('gpu done')
I have since taken the advice below and implmented it as such:
def N_gpu_util_timer(self):
for n in range(10):
GPUs = GPUtil.getGPUs()
gpu_load = GPUs[0].load
Graph.gpu_y.append(gpu_load)
time.sleep(1)
print(Graph.gpu_y)
print('N gpu done')