*install pynvml
https://pypi.org/project/pynvml/
pip install pynvml
*use below code in python code
from pynvml import *
nvmlInit()
h = nvmlDeviceGetHandleByIndex(0)
info = nvmlDeviceGetMemoryInfo(h)
print(f'total : {info.total}')
print(f'free : {info.free}')
print(f'used : {info.used}')
No comments:
Post a Comment