Skip to content

nvmlDeviceGetMemoryInfo_v2 not working #59

@152334H

Description

@152334H
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

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions