Open
Description
from pynvml import *
nvmlInit()
d=nvmlDeviceGetHandleByIndex(0)
nvmlDeviceGetMemoryInfo(d) # <-- works fine
nvmlDeviceGetMemoryInfo(d,2) # <-- errors
"""
Traceback (most recent call last):
File "/a.py", line 5, in <module>
nvmlDeviceGetMemoryInfo(d,2)
File "/.venv/lib/python3.10/site-packages/pynvml/nvml.py", line 2440, in nvmlDeviceGetMemoryInfo
_nvmlCheckReturn(ret)
File "/.venv/lib/python3.10/site-packages/pynvml/nvml.py", line 833, in _nvmlCheckReturn
raise NVMLError(ret)
pynvml.nvml.NVMLError_FunctionNotFound: Function Not Found
"""
Internally, the version=2
argument should call the correct nvmlDeviceGetMemoryInfo_v2
function with correct args:
def nvmlDeviceGetMemoryInfo(handle, version=None):
if not version:
c_memory = c_nvmlMemory_t()
fn = _nvmlGetFunctionPointer("nvmlDeviceGetMemoryInfo")
else:
c_memory = c_nvmlMemory_v2_t()
c_memory.version = version
fn = _nvmlGetFunctionPointer("nvmlDeviceGetMemoryInfo_v2")
ret = fn(handle, byref(c_memory))
_nvmlCheckReturn(ret)
return c_memory
idk why this does not work
Metadata
Metadata
Assignees
Labels
No labels