📜  pytorch 中的 cuda 内存 - Python 代码示例

📅  最后修改于: 2022-03-11 14:45:16.670000             🧑  作者: Mango

代码示例1
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}')