fbcotter / py3nvml

Python 3 Bindings for NVML library. Get NVIDIA GPU status inside your program.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

could not get the GPU MEM usage percent

spenly opened this issue · comments

we could see an almost 100% for GPU MEM usage, but tested the code, and could only get '0'.

My test code:
from py3nvml.py3nvml import *
nvmlInit()
handle = nvmlDeviceGetHandleByIndex(0)
result = nvmlDeviceGetUtilizationRates(handle)
print(result.memory) # 0

sorry, i saw the solutions in the index page.

sample code:

info = nvmlDeviceGetMemoryInfo(handle)
print("Total memory: {}".format(info.total))

will print:

Total memory: 5636292608

print("Free memory: {}".format(info.free))

will print:

Free memory: 5578420224

print("Used memory: ".format(info.used))