2

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')
0

1 Answer 1

5

See the documentation

https://github.com/anderskm/gputil#usage

Use getGPUs and query the GPU class's load member

GPUs = GPUtil.getGPUs()
load = GPUs[0].load
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.