From 029ab581d548ad9d329b88d9fd80c0aec951bcf3 Mon Sep 17 00:00:00 2001 From: Michael Droettboom Date: Mon, 19 Oct 2026 12:05:54 -0400 Subject: [PATCH] Backport recent generator changes to the 13.4.x branch to fix nvbug6771788 --- .../cuda/bindings/_internal/_fast_enum.py | 18 +- .../cuda/bindings/_internal/driver_linux.pyx | 12 +- .../bindings/_internal/driver_windows.pyx | 12 +- cuda_bindings/cuda/bindings/_lib/utils.pxd | 4 +- cuda_bindings/cuda/bindings/_lib/utils.pxi | 267 +- cuda_bindings/cuda/bindings/_v2/nvrtc.pyx | 184 +- cuda_bindings/cuda/bindings/cudla.pxd | 4 +- cuda_bindings/cuda/bindings/cudla.pyx | 471 +- cuda_bindings/cuda/bindings/cufile.pxd | 14 +- cuda_bindings/cuda/bindings/cufile.pyx | 456 +- cuda_bindings/cuda/bindings/cycufile.pxd | 43 +- cuda_bindings/cuda/bindings/cydriver.pxd | 324 +- cuda_bindings/cuda/bindings/cyruntime.pxd | 261 +- cuda_bindings/cuda/bindings/driver.pxd | 143 +- cuda_bindings/cuda/bindings/driver.pyx | 940 +- cuda_bindings/cuda/bindings/nvfatbin.pyx | 49 +- cuda_bindings/cuda/bindings/nvjitlink.pyx | 40 +- cuda_bindings/cuda/bindings/nvml.pxd | 46 +- cuda_bindings/cuda/bindings/nvml.pyx | 10732 ++++++++++------ cuda_bindings/cuda/bindings/nvrtc.pxd | 3 +- cuda_bindings/cuda/bindings/nvvm.pyx | 131 +- cuda_bindings/cuda/bindings/runtime.pxd | 105 +- cuda_bindings/cuda/bindings/runtime.pyx | 651 +- cuda_bindings/docs/source/module/driver.rst | 4 +- 24 files changed, 8601 insertions(+), 6313 deletions(-) diff --git a/cuda_bindings/cuda/bindings/_internal/_fast_enum.py b/cuda_bindings/cuda/bindings/_internal/_fast_enum.py index 63a2336da1a..18ad0239def 100644 --- a/cuda_bindings/cuda/bindings/_internal/_fast_enum.py +++ b/cuda_bindings/cuda/bindings/_internal/_fast_enum.py @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 -# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=581469c1fadb5f72c43b478d73f2b905562136c8723a25e2f4240b5b681e2894 +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=35d522fae601127f3ffc9d0de45d9adf2572934ee3308f5d99567aa8efd5ae77 """ This is a replacement for the stdlib enum.IntEnum. @@ -33,10 +33,14 @@ def __init__(cls, name, bases, namespace): else: continue - singleton = int.__new__(cls, value) - singleton.__doc__ = doc - singleton._name = name - cls.__singletons__[value] = singleton + # A name sharing a value with an already-processed member is an + # alias (e.g. a deprecated name kept for backward compatibility): + # it resolves to the same singleton, but isn't a distinct member. + if (singleton := cls.__singletons__.get(value)) is None: + singleton = int.__new__(cls, value) + singleton.__doc__ = doc + singleton._name = name + cls.__singletons__[value] = singleton cls.__members__[name] = singleton for name, member in cls.__members__.items(): @@ -46,10 +50,10 @@ def __repr__(cls) -> str: return f"" def __len__(cls) -> int: - return len(cls.__members__) + return len(cls.__singletons__) def __iter__(cls) -> Iterator["FastEnum"]: - return iter(cls.__members__.values()) + return iter(cls.__singletons__.values()) def __contains__(cls, item: Any) -> bool: return item in cls.__singletons__ diff --git a/cuda_bindings/cuda/bindings/_internal/driver_linux.pyx b/cuda_bindings/cuda/bindings/_internal/driver_linux.pyx index 6fc1ca20c77..59d14f75b9e 100644 --- a/cuda_bindings/cuda/bindings/_internal/driver_linux.pyx +++ b/cuda_bindings/cuda/bindings/_internal/driver_linux.pyx @@ -3,7 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 # # This code was automatically generated across versions from 12.9.0 to 13.4.1. Do not modify it directly. -# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=f23c5b6833163c19813f5a513216d2a4192b545a5ae8a47ffe7c95ebbc9bdbaf +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=c6a477ceb1a35675c0ffe5e40f9826ea3e3bd9cbec23720f78fe4cf28feafbe0 # <<<< PREAMBLE CONTENT >>>> @@ -1896,19 +1896,19 @@ cdef int _init_driver() except -1 nogil: cuGetProcAddress_v2('cuGreenCtxStreamCreate', &__cuGreenCtxStreamCreate, 12050, ptds_mode, NULL) global __cuLogsRegisterCallback - cuGetProcAddress_v2('cuLogsRegisterCallback', &__cuLogsRegisterCallback, 12080, ptds_mode, NULL) + cuGetProcAddress_v2('cuLogsRegisterCallback', &__cuLogsRegisterCallback, 12090, ptds_mode, NULL) global __cuLogsUnregisterCallback - cuGetProcAddress_v2('cuLogsUnregisterCallback', &__cuLogsUnregisterCallback, 12080, ptds_mode, NULL) + cuGetProcAddress_v2('cuLogsUnregisterCallback', &__cuLogsUnregisterCallback, 12090, ptds_mode, NULL) global __cuLogsCurrent - cuGetProcAddress_v2('cuLogsCurrent', &__cuLogsCurrent, 12080, ptds_mode, NULL) + cuGetProcAddress_v2('cuLogsCurrent', &__cuLogsCurrent, 12090, ptds_mode, NULL) global __cuLogsDumpToFile - cuGetProcAddress_v2('cuLogsDumpToFile', &__cuLogsDumpToFile, 12080, ptds_mode, NULL) + cuGetProcAddress_v2('cuLogsDumpToFile', &__cuLogsDumpToFile, 12090, ptds_mode, NULL) global __cuLogsDumpToMemory - cuGetProcAddress_v2('cuLogsDumpToMemory', &__cuLogsDumpToMemory, 12080, ptds_mode, NULL) + cuGetProcAddress_v2('cuLogsDumpToMemory', &__cuLogsDumpToMemory, 12090, ptds_mode, NULL) global __cuCheckpointProcessGetRestoreThreadId cuGetProcAddress_v2('cuCheckpointProcessGetRestoreThreadId', &__cuCheckpointProcessGetRestoreThreadId, 12080, ptds_mode, NULL) diff --git a/cuda_bindings/cuda/bindings/_internal/driver_windows.pyx b/cuda_bindings/cuda/bindings/_internal/driver_windows.pyx index 729808ed432..3d298bc3ba1 100644 --- a/cuda_bindings/cuda/bindings/_internal/driver_windows.pyx +++ b/cuda_bindings/cuda/bindings/_internal/driver_windows.pyx @@ -3,7 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 # # This code was automatically generated across versions from 12.9.0 to 13.4.1. Do not modify it directly. -# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=f49a90c93b3876714d90f8948fabc654d408ba6c8bc3a122503b1d1ef663f434 +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=a04dbfec5a461010c493b3aca0b092910ff3eb49d31942a68c957309892b2aa6 # <<<< PREAMBLE CONTENT >>>> @@ -1899,19 +1899,19 @@ cdef int _init_driver() except -1 nogil: cuGetProcAddress_v2('cuGreenCtxStreamCreate', &__cuGreenCtxStreamCreate, 12050, ptds_mode, NULL) global __cuLogsRegisterCallback - cuGetProcAddress_v2('cuLogsRegisterCallback', &__cuLogsRegisterCallback, 12080, ptds_mode, NULL) + cuGetProcAddress_v2('cuLogsRegisterCallback', &__cuLogsRegisterCallback, 12090, ptds_mode, NULL) global __cuLogsUnregisterCallback - cuGetProcAddress_v2('cuLogsUnregisterCallback', &__cuLogsUnregisterCallback, 12080, ptds_mode, NULL) + cuGetProcAddress_v2('cuLogsUnregisterCallback', &__cuLogsUnregisterCallback, 12090, ptds_mode, NULL) global __cuLogsCurrent - cuGetProcAddress_v2('cuLogsCurrent', &__cuLogsCurrent, 12080, ptds_mode, NULL) + cuGetProcAddress_v2('cuLogsCurrent', &__cuLogsCurrent, 12090, ptds_mode, NULL) global __cuLogsDumpToFile - cuGetProcAddress_v2('cuLogsDumpToFile', &__cuLogsDumpToFile, 12080, ptds_mode, NULL) + cuGetProcAddress_v2('cuLogsDumpToFile', &__cuLogsDumpToFile, 12090, ptds_mode, NULL) global __cuLogsDumpToMemory - cuGetProcAddress_v2('cuLogsDumpToMemory', &__cuLogsDumpToMemory, 12080, ptds_mode, NULL) + cuGetProcAddress_v2('cuLogsDumpToMemory', &__cuLogsDumpToMemory, 12090, ptds_mode, NULL) global __cuCheckpointProcessGetRestoreThreadId cuGetProcAddress_v2('cuCheckpointProcessGetRestoreThreadId', &__cuCheckpointProcessGetRestoreThreadId, 12080, ptds_mode, NULL) diff --git a/cuda_bindings/cuda/bindings/_lib/utils.pxd b/cuda_bindings/cuda/bindings/_lib/utils.pxd index aaa6e272be1..96308f9a96e 100644 --- a/cuda_bindings/cuda/bindings/_lib/utils.pxd +++ b/cuda_bindings/cuda/bindings/_lib/utils.pxd @@ -11,10 +11,8 @@ from cpython.buffer cimport PyBuffer_Release, Py_buffer cdef class _HelperKernelParams: cdef Py_buffer _pybuffer cdef bint _pyobj_acquired - cdef void** _ckernelParams + cdef void** ckernelParams cdef char* _ckernelParamsData - cdef int _length - cdef bint _malloc_list_created cdef struct _HelperInputVoidPtrStruct: Py_buffer _pybuffer diff --git a/cuda_bindings/cuda/bindings/_lib/utils.pxi b/cuda_bindings/cuda/bindings/_lib/utils.pxi index d39a32902a5..f2a808077fb 100644 --- a/cuda_bindings/cuda/bindings/_lib/utils.pxi +++ b/cuda_bindings/cuda/bindings/_lib/utils.pxi @@ -2,17 +2,15 @@ # SPDX-License-Identifier: Apache-2.0 from cpython.buffer cimport PyObject_CheckBuffer, PyObject_GetBuffer, PyBuffer_Release, PyBUF_SIMPLE, PyBUF_ANY_CONTIGUOUS +from cpython.mem cimport PyMem_Calloc, PyMem_Free from libc.stdlib cimport calloc, free -from libc.stdint cimport int32_t, uint32_t, int64_t, uint64_t -from libc.stddef cimport wchar_t +from libc.stdint cimport int8_t +from libc.stddef cimport size_t from libc.string cimport memcpy +from libcpp cimport bool as cpp_bool from cuda.bindings._internal._fast_enum import FastEnum as _FastEnum import ctypes as _ctypes cimport cuda.bindings.cydriver as cydriver -cimport cuda.bindings._lib.param_packer as param_packer - -# Import-time init so feed() is a pure read under free threading. -param_packer.init_param_packer() cdef void* _callocWrapper(length, size): cdef void* out = calloc(length, size) @@ -20,114 +18,187 @@ cdef void* _callocWrapper(length, size): raise MemoryError('Failed to allocated length x size memory: {}x{}'.format(length, size)) return out -cdef class _HelperKernelParams: - supported_types = { # excluding void_p and None, which are handled specially - _ctypes.c_bool, - _ctypes.c_char, - _ctypes.c_wchar, - _ctypes.c_byte, - _ctypes.c_ubyte, - _ctypes.c_short, - _ctypes.c_ushort, - _ctypes.c_int, - _ctypes.c_uint, - _ctypes.c_long, - _ctypes.c_ulong, - _ctypes.c_longlong, - _ctypes.c_ulonglong, - _ctypes.c_size_t, - _ctypes.c_float, - _ctypes.c_double - } - - max_param_size = max(_ctypes.sizeof(max(_HelperKernelParams.supported_types, key=lambda t:_ctypes.sizeof(t))), sizeof(void_ptr)) +cdef object ctypes_c_bool = _ctypes.c_bool +cdef object ctypes_c_char = _ctypes.c_char +cdef object ctypes_c_wchar = _ctypes.c_wchar +cdef object ctypes_c_byte = _ctypes.c_byte +cdef object ctypes_c_ubyte = _ctypes.c_ubyte +cdef object ctypes_c_short = _ctypes.c_short +cdef object ctypes_c_ushort = _ctypes.c_ushort +cdef object ctypes_c_int = _ctypes.c_int +cdef object ctypes_c_uint = _ctypes.c_uint +cdef object ctypes_c_long = _ctypes.c_long +cdef object ctypes_c_ulong = _ctypes.c_ulong +cdef object ctypes_c_longlong = _ctypes.c_longlong +cdef object ctypes_c_ulonglong = _ctypes.c_ulonglong +cdef object ctypes_c_size_t = _ctypes.c_size_t +cdef object ctypes_c_float = _ctypes.c_float +cdef object ctypes_c_double = _ctypes.c_double +cdef object ctypes_c_void_p = _ctypes.c_void_p +cdef object ctypes_Structure = _ctypes.Structure + +# excluding void_p and None, which are handled specially +cdef object supported_types = { + ctypes_c_bool, + ctypes_c_char, + ctypes_c_wchar, + ctypes_c_byte, + ctypes_c_ubyte, + ctypes_c_short, + ctypes_c_ushort, + ctypes_c_int, + ctypes_c_uint, + ctypes_c_long, + ctypes_c_ulong, + ctypes_c_longlong, + ctypes_c_ulonglong, + ctypes_c_size_t, + ctypes_c_float, + ctypes_c_double, +} + +# A slot wide enough for all `supported_types` (and `void_p`) +cdef size_t MAX_PARAM_SIZE = max(_ctypes.sizeof(t) for t in supported_types) +# For correct access pointers have to fit (appended) and the size +# must be a multiple of the max alignment (guaranteed if power of 2). +assert MAX_PARAM_SIZE % sizeof(void*) == 0 +assert ((MAX_PARAM_SIZE - 1) & MAX_PARAM_SIZE) == 0 + + +cdef int _try_specific_types(char* slot, object value, object ctype) except -1: + """Helper for specific type parsing. If this fails, conversion goes + via `ctype(value)`. This converter is more strict than ctypes + (e.g. raises for out of bound integers). It should be extended if a + specific argument is slow. + """ + cdef object value_type = type(value) + if ctype is ctypes_c_int and value_type is int: + (slot)[0] = value + return 1 + if ctype is ctypes_c_bool and value_type is bool: + (slot)[0] = value + return 1 + if ctype is ctypes_c_byte and value_type is int: + (slot)[0] = value + return 1 + if ctype is ctypes_c_double: + if value_type is float: + (slot)[0] = value + return 1 + if isinstance(value, ctypes_c_float): + # This explicitly allows c_float for double arguments. + (slot)[0] = value.value + return 1 + return 0 + if ctype is ctypes_c_float and value_type is float: + (slot)[0] = value + return 1 + if ctype is ctypes_c_longlong and value_type is int: + (slot)[0] = value + return 1 + return 0 + + +cdef int _pack_argument(void** ptr, char* slot, object value, object ctype) except -1: + cdef size_t size + cdef void* addr + cdef object getPtr + + if ctype is None: + getPtr = getattr(value, 'getPtr', None) + if callable(getPtr): + ptr[0] = getPtr() + elif isinstance(value, ctypes_Structure): + ptr[0] = _ctypes.addressof(value) + elif isinstance(value, _FastEnum): + ptr[0] = slot + (slot)[0] = value # _FastEnum is an int + else: + raise TypeError(f"Provided argument is of type {type(value)} but expected Type {_ctypes.Structure}, {_ctypes.c_void_p} or CUDA Binding structure with getPtr() attribute") + return 0 + + ptr[0] = slot + if _try_specific_types(slot, value, ctype): + return 0 + if ctype in supported_types: + if not isinstance(value, ctype): + value = ctype(value) + size = _ctypes.sizeof(ctype) + addr = _ctypes.addressof(value) + memcpy(slot, addr, size) + return 0 + elif ctype is ctypes_c_void_p: + if isinstance(value, (int, ctypes_c_void_p)): + (slot)[0] = value.value if isinstance(value, ctypes_c_void_p) else value + else: + getPtr = getattr(value, 'getPtr', None) + if callable(getPtr): + (slot)[0] = getPtr() + else: + raise TypeError(f"Provided argument is of type {type(value)} but expected Type {int}, {_ctypes.c_void_p} or CUDA Binding structure with getPtr() attribute") + return 0 + raise TypeError(f"Unsupported type: {ctype!r}") + +cdef class _HelperKernelParams: def __cinit__(self, kernelParams): + cdef tuple values, types + cdef Py_ssize_t i, n + cdef size_t data_bytes, total + cdef char* block + cdef char* slot + cdef int err_buffer + cdef void** ptrs + self._pyobj_acquired = False - self._malloc_list_created = False + self.ckernelParams = NULL + self._ckernelParamsData = NULL + if kernelParams is None: - self._ckernelParams = NULL - elif isinstance(kernelParams, (int)): + pass + elif isinstance(kernelParams, int): # Easy run, user gave us an already configured void** address - self._ckernelParams = kernelParams + self.ckernelParams = kernelParams elif PyObject_CheckBuffer(kernelParams): # Easy run, get address from Python Buffer Protocol err_buffer = PyObject_GetBuffer(kernelParams, &self._pybuffer, PyBUF_SIMPLE | PyBUF_ANY_CONTIGUOUS) if err_buffer == -1: raise RuntimeError("Argument 'kernelParams' failed to retrieve buffer through Buffer Protocol") self._pyobj_acquired = True - self._ckernelParams = self._pybuffer.buf - elif isinstance(kernelParams, (tuple)) and len(kernelParams) == 2 and isinstance(kernelParams[0], (tuple)) and isinstance(kernelParams[1], (tuple)): - # Hard run, construct and fill out contigues memory using provided kernel values and types based - if len(kernelParams[0]) != len(kernelParams[1]): + self.ckernelParams = self._pybuffer.buf + elif ( + isinstance(kernelParams, tuple) + and len(kernelParams) == 2 + and isinstance(kernelParams[0], tuple) + and isinstance(kernelParams[1], tuple) + ): + # Hard run, construct and fill out contiguous memory using provided kernel values and types + values = kernelParams[0] + types = kernelParams[1] + n = len(values) + if n != len(types): raise TypeError("Argument 'kernelParams' has tuples with different length") - if len(kernelParams[0]) != 0: - self._length = len(kernelParams[0]) - self._ckernelParams = _callocWrapper(len(kernelParams[0]), sizeof(void*)) - self._ckernelParamsData = _callocWrapper(len(kernelParams[0]), _HelperKernelParams.max_param_size) - self._malloc_list_created = True - - idx = 0 - data_idx = 0 - for value, ctype in zip(kernelParams[0], kernelParams[1]): - if ctype is None: - # special cases for None - if callable(getattr(value, 'getPtr', None)): - self._ckernelParams[idx] = value.getPtr() - elif isinstance(value, (_ctypes.Structure)): - self._ckernelParams[idx] = _ctypes.addressof(value) - elif isinstance(value, (_FastEnum)): - self._ckernelParams[idx] = &(self._ckernelParamsData[data_idx]) - (self._ckernelParams[idx])[0] = value.value - data_idx += sizeof(int) - else: - raise TypeError("Provided argument is of type {} but expected Type {}, {} or CUDA Binding structure with getPtr() attribute".format(type(value), type(_ctypes.Structure), type(_ctypes.c_void_p))) - elif ctype in _HelperKernelParams.supported_types: - self._ckernelParams[idx] = &(self._ckernelParamsData[data_idx]) - - # handle case where a float is passed as a double - if ctype == _ctypes.c_double and isinstance(value, _ctypes.c_float): - value = ctype(value.value) - if not isinstance(value, ctype): # make it a ctype - size = param_packer.feed(self._ckernelParams[idx], value, ctype) - if size == 0: # feed failed - value = ctype(value) - size = _ctypes.sizeof(ctype) - addr = (_ctypes.addressof(value)) - memcpy(self._ckernelParams[idx], addr, size) - else: - size = _ctypes.sizeof(ctype) - addr = (_ctypes.addressof(value)) - memcpy(self._ckernelParams[idx], addr, size) - data_idx += size - elif ctype == _ctypes.c_void_p: - # special cases for void_p - if isinstance(value, (int, _ctypes.c_void_p)): - self._ckernelParams[idx] = &(self._ckernelParamsData[data_idx]) - (self._ckernelParams[idx])[0] = value.value if isinstance(value, (_ctypes.c_void_p)) else value - data_idx += sizeof(void_ptr) - elif callable(getattr(value, 'getPtr', None)): - self._ckernelParams[idx] = &(self._ckernelParamsData[data_idx]) - (self._ckernelParams[idx])[0] = value.getPtr() - data_idx += sizeof(void_ptr) - else: - raise TypeError("Provided argument is of type {} but expected Type {}, {} or CUDA Binding structure with getPtr() attribute".format(type(value), type(int), type(_ctypes.c_void_p))) - else: - raise TypeError("Unsupported type: " + str(type(ctype))) - idx += 1 + if n == 0: + return + data_bytes = n * MAX_PARAM_SIZE + total = data_bytes + n * sizeof(void*) + block = PyMem_Calloc(1, total) + if block == NULL: + raise MemoryError('Failed to allocated length x size memory: {}x{}'.format(n, MAX_PARAM_SIZE)) + self._ckernelParamsData = block + ptrs = (block + data_bytes) + self.ckernelParams = ptrs + for i in range(n): + slot = block + i * MAX_PARAM_SIZE + _pack_argument(ptrs + i, slot, values[i], types[i]) else: raise TypeError("Argument 'kernelParams' is not a valid type: tuple[tuple[Any, ...], tuple[Any, ...]] or PyObject implimenting Buffer Protocol or Int") def __dealloc__(self): - if self._pyobj_acquired is True: + if self._pyobj_acquired: PyBuffer_Release(&self._pybuffer) - if self._malloc_list_created is True: - free(self._ckernelParams) - free(self._ckernelParamsData) - - @property - def ckernelParams(self): - return self._ckernelParams + if self._ckernelParamsData: + PyMem_Free(self._ckernelParamsData) cdef class _HelperInputVoidPtr: def __cinit__(self, ptr): @@ -155,7 +226,7 @@ cdef void * _helper_input_void_ptr(ptr, _HelperInputVoidPtrStruct *helper): raise RuntimeError("Failed to retrieve buffer through Buffer Protocol") return (helper[0]._pybuffer.buf) else: - raise TypeError("Provided argument is of type {} but expected Type {}, {} or object with Buffer Protocol".format(type(ptr), type(None), type(int))) + raise TypeError(f"Provided argument is of type {type(ptr)} but expected Type None, int or object with Buffer Protocol") diff --git a/cuda_bindings/cuda/bindings/_v2/nvrtc.pyx b/cuda_bindings/cuda/bindings/_v2/nvrtc.pyx index 9cc508aeef6..37776341963 100644 --- a/cuda_bindings/cuda/bindings/_v2/nvrtc.pyx +++ b/cuda_bindings/cuda/bindings/_v2/nvrtc.pyx @@ -3,23 +3,25 @@ # SPDX-License-Identifier: Apache-2.0 # # This code was automatically generated across versions from 12.9.0 to 13.4.1. Do not modify it directly. -# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=3b41a6e66b9064266d04521a6cc9b9a4f715c453d21323ab9741f9e34e6f2d80 +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=343843af0d4fa5698e46b9e9dd9ba41a1abe2f056ba3fe97ad98351bf2261c1b # <<<< PREAMBLE CONTENT >>>> cimport cpython as _cyb_cpython cimport cpython.buffer as _cyb_cpython_buffer +from cpython.buffer cimport ( + PyBUF_SIMPLE as _cyb_PyBUF_SIMPLE, + PyBuffer_Release as _cyb_PyBuffer_Release, + PyObject_GetBuffer as _cyb_PyObject_GetBuffer, + Py_buffer as _cyb_Py_buffer, +) from cython cimport view as _cyb_view from libc.stdint cimport intptr_t -from libc.stdlib cimport ( - calloc as _cyb_calloc, - free as _cyb_free, - malloc as _cyb_malloc, -) from libc.string cimport ( memcmp as _cyb_memcmp, memcpy as _cyb_memcpy, + memmove as _cyb_memmove, ) from cuda.bindings._internal._fast_enum import FastEnum as _cyb_FastEnum @@ -48,7 +50,7 @@ cdef _cyb_from_buffer(buffer, size, lowpp_type): raise ValueError("buffer itemsize must be 1 byte") if view.len != size: raise ValueError(f"buffer length must be {size} bytes") - return lowpp_type.from_ptr(view.buf, not view.readonly, buffer) + return lowpp_type.from_ptr(view.buf, view.readonly != 0, buffer) finally: _cyb_cpython.PyBuffer_Release(&view) @@ -256,26 +258,16 @@ cdef class BundledHeadersInfo: .. seealso:: `nvrtcBundledHeadersInfo` """ cdef: + nvrtcBundledHeadersInfo _data nvrtcBundledHeadersInfo *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvrtcBundledHeadersInfo)) - if self._ptr == NULL: - raise MemoryError("Error allocating BundledHeadersInfo") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvrtcBundledHeadersInfo *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.BundledHeadersInfo object at {hex(id(self))}>" @@ -304,14 +296,22 @@ cdef class BundledHeadersInfo: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvrtcBundledHeadersInfo)) - if self._ptr == NULL: - raise MemoryError("Error allocating BundledHeadersInfo") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvrtcBundledHeadersInfo)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This BundledHeadersInfo instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvrtcBundledHeadersInfo): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvrtcBundledHeadersInfo), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvrtcBundledHeadersInfo)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -408,16 +408,12 @@ cdef class BundledHeadersInfo: raise ValueError("ptr must not be null (0)") cdef BundledHeadersInfo obj = BundledHeadersInfo.__new__(BundledHeadersInfo) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvrtcBundledHeadersInfo)) - if obj._ptr == NULL: - raise MemoryError("Error allocating BundledHeadersInfo") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvrtcBundledHeadersInfo)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvrtcBundledHeadersInfo)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -622,6 +618,7 @@ cpdef remove_bundled_headers(bytes install_path): cpdef str get_error_string(int result): """nvrtcGetErrorString is a helper function that returns a string describing the given ``nvrtcResult`` code, e.g., NVRTC_SUCCESS to ``"NVRTC_SUCCESS"``. For unrecognized enumeration values, it returns ``"NVRTC_ERROR unknown"``. + Args: result (Result): CUDA Runtime Compilation API result code. @@ -638,9 +635,9 @@ cpdef str get_error_string(int result): cpdef tuple version(): """nvrtcVersion sets the output parameters ``major`` and ``minor`` with the CUDA Runtime Compilation version number. + Returns: A 2-tuple containing: - - int: CUDA Runtime Compilation major version number. - int: CUDA Runtime Compilation minor version number. @@ -657,6 +654,8 @@ cpdef tuple version(): cpdef int get_num_supported_archs() except? -1: """nvrtcGetNumSupportedArchs sets the output parameter ``num_archs`` with the number of architectures supported by NVRTC. This can then be used to pass an array to ``nvrtcGetSupportedArchs`` to get the supported architectures. + see ``nvrtcGetSupportedArchs``. + Returns: int: number of supported architectures. @@ -672,6 +671,8 @@ cpdef int get_num_supported_archs() except? -1: cpdef object get_supported_archs(): """nvrtcGetSupportedArchs populates the array passed via the output parameter ``supported_archs`` with the architectures supported by NVRTC. The array is sorted in the ascending order. The size of the array to be passed can be determined using ``nvrtcGetNumSupportedArchs``. + see ``nvrtcGetNumSupportedArchs``. + Returns: int: sorted array of supported architectures. @@ -681,19 +682,20 @@ cpdef object get_supported_archs(): with nogil: __status__ = nvrtcGetNumSupportedArchs(&numArchs) check_status(__status__) - if numArchs == 0: - return _cyb_view.array(shape=(1,), itemsize=sizeof(int), format="i", mode="c")[:0] - cdef _cyb_view.array supported_archs = _cyb_view.array(shape=(numArchs,), itemsize=sizeof(int), format="i", mode="c") - cdef int *supported_archs_ptr = (supported_archs.data) - with nogil: - __status__ = nvrtcGetSupportedArchs(supported_archs_ptr) - check_status(__status__) + cdef _cyb_view.array _supported_archs_alloc_ = _cyb_view.array(shape=(max(numArchs, 1),), itemsize=sizeof(int), format="i", mode="c") + cdef int *supported_archs_ptr = (_supported_archs_alloc_.data) + cdef object supported_archs = _supported_archs_alloc_[:numArchs] + if numArchs != 0: + with nogil: + __status__ = nvrtcGetSupportedArchs(supported_archs_ptr) + check_status(__status__) return supported_archs cpdef destroy_program(intptr_t prog): """nvrtcDestroyProgram destroys the given program. + Args: prog (intptr_t): CUDA Runtime Compilation program. @@ -708,6 +710,7 @@ cpdef destroy_program(intptr_t prog): cpdef size_t get_ptx_size(intptr_t prog) except? 0: """nvrtcGetPTXSize sets the value of ``ptx_size_ret`` with the size of the PTX generated by the previous compilation of ``prog`` (including the trailing ``NULL``). + Args: prog (intptr_t): CUDA Runtime Compilation program. @@ -727,6 +730,7 @@ cpdef size_t get_ptx_size(intptr_t prog) except? 0: cpdef bytes get_ptx(intptr_t prog): """nvrtcGetPTX stores the PTX generated by the previous compilation of ``prog`` in the memory pointed by ``ptx``. + Args: prog (intptr_t): CUDA Runtime Compilation program. @@ -739,19 +743,19 @@ cpdef bytes get_ptx(intptr_t prog): with nogil: __status__ = nvrtcGetPTXSize(prog, &ptxSizeRet) check_status(__status__) - if ptxSizeRet == 0: - return b"" cdef bytes _ptx_ = bytes(ptxSizeRet) cdef char* ptx = _ptx_ - with nogil: - __status__ = nvrtcGetPTX(prog, ptx) - check_status(__status__) + if ptxSizeRet != 0: + with nogil: + __status__ = nvrtcGetPTX(prog, ptx) + check_status(__status__) return _ptx_ cpdef size_t get_cubin_size(intptr_t prog) except? 0: """nvrtcGetCUBINSize sets the value of ``cubin_size_ret`` with the size of the cubin generated by the previous compilation of ``prog``. The value of cubin_size_ret is set to 0 if the value specified to ``-arch`` is a virtual architecture instead of an actual architecture. + Args: prog (intptr_t): CUDA Runtime Compilation program. @@ -770,6 +774,7 @@ cpdef size_t get_cubin_size(intptr_t prog) except? 0: cpdef bytes get_cubin(intptr_t prog): """nvrtcGetCUBIN stores the cubin generated by the previous compilation of ``prog`` in the memory pointed by ``cubin``. No cubin is available if the value specified to ``-arch`` is a virtual architecture instead of an actual architecture. The cubin does not contain code for the Tile functions (``__tile__`` / ``__tile_global__``) or variables (``__tile__``); use :func:`get_tile_ir` to extract the cuda_tile IR generated for Tile code. + Args: prog (intptr_t): CUDA Runtime Compilation program. @@ -782,19 +787,19 @@ cpdef bytes get_cubin(intptr_t prog): with nogil: __status__ = nvrtcGetCUBINSize(prog, &cubinSizeRet) check_status(__status__) - if cubinSizeRet == 0: - return b"" cdef bytes _cubin_ = bytes(cubinSizeRet) cdef char* cubin = _cubin_ - with nogil: - __status__ = nvrtcGetCUBIN(prog, cubin) - check_status(__status__) + if cubinSizeRet != 0: + with nogil: + __status__ = nvrtcGetCUBIN(prog, cubin) + check_status(__status__) return _cubin_ cpdef size_t get_ltoir_size(intptr_t prog) except? 0: """nvrtcGetLTOIRSize sets the value of ``ltoir_size_ret`` with the size of the LTO IR generated by the previous compilation of ``prog``. The value of ltoir_size_ret is set to 0 if the program was not compiled with ``-dlto``. + Args: prog (intptr_t): CUDA Runtime Compilation program. @@ -813,6 +818,7 @@ cpdef size_t get_ltoir_size(intptr_t prog) except? 0: cpdef bytes get_ltoir(intptr_t prog): """nvrtcGetltoir stores the LTO IR generated by the previous compilation of ``prog`` in the memory pointed by ``ltoir``. No LTO IR is available if the program was compiled without ``-dlto``. + Args: prog (intptr_t): CUDA Runtime Compilation program. @@ -825,19 +831,19 @@ cpdef bytes get_ltoir(intptr_t prog): with nogil: __status__ = nvrtcGetLTOIRSize(prog, <OIRSizeRet) check_status(__status__) - if LTOIRSizeRet == 0: - return b"" cdef bytes _ltoir_ = bytes(LTOIRSizeRet) cdef char* ltoir = _ltoir_ - with nogil: - __status__ = nvrtcGetLTOIR(prog, ltoir) - check_status(__status__) + if LTOIRSizeRet != 0: + with nogil: + __status__ = nvrtcGetLTOIR(prog, ltoir) + check_status(__status__) return _ltoir_ cpdef size_t get_optix_ir_size(intptr_t prog) except? 0: """nvrtcGetOptiXIRSize sets the value of ``optixir_size_ret`` with the size of the OptiX IR generated by the previous compilation of ``prog``. The value of nvrtcGetOptiXIRSize is set to 0 if the program was compiled with options incompatible with OptiX IR generation. + Args: prog (intptr_t): CUDA Runtime Compilation program. @@ -856,6 +862,7 @@ cpdef size_t get_optix_ir_size(intptr_t prog) except? 0: cpdef bytes get_optix_ir(intptr_t prog): """nvrtcGetOptiXIR stores the OptiX IR generated by the previous compilation of ``prog`` in the memory pointed by ``optixir``. No OptiX IR is available if the program was compiled with options incompatible with OptiX IR generation. + Args: prog (intptr_t): CUDA Runtime Compilation program. @@ -868,19 +875,21 @@ cpdef bytes get_optix_ir(intptr_t prog): with nogil: __status__ = nvrtcGetOptiXIRSize(prog, &optixirSizeRet) check_status(__status__) - if optixirSizeRet == 0: - return b"" cdef bytes _optixir_ = bytes(optixirSizeRet) cdef char* optixir = _optixir_ - with nogil: - __status__ = nvrtcGetOptiXIR(prog, optixir) - check_status(__status__) + if optixirSizeRet != 0: + with nogil: + __status__ = nvrtcGetOptiXIR(prog, optixir) + check_status(__status__) return _optixir_ cpdef size_t get_program_log_size(intptr_t prog) except? 0: """nvrtcGetProgramLogSize sets ``log_size_ret`` with the size of the log generated by the previous compilation of ``prog`` (including the trailing ``NULL``). + Note that compilation log may be generated with warnings and informative + messages, even when the compilation of ``prog`` succeeds. + Args: prog (intptr_t): CUDA Runtime Compilation program. @@ -900,6 +909,7 @@ cpdef size_t get_program_log_size(intptr_t prog) except? 0: cpdef bytes get_program_log(intptr_t prog): """nvrtcGetProgramLog stores the log generated by the previous compilation of ``prog`` in the memory pointed by ``log``. + Args: prog (intptr_t): CUDA Runtime Compilation program. @@ -912,24 +922,25 @@ cpdef bytes get_program_log(intptr_t prog): with nogil: __status__ = nvrtcGetProgramLogSize(prog, &logSizeRet) check_status(__status__) - if logSizeRet == 0: - return b"" cdef bytes _log_ = bytes(logSizeRet) cdef char* log = _log_ - with nogil: - __status__ = nvrtcGetProgramLog(prog, log) - check_status(__status__) + if logSizeRet != 0: + with nogil: + __status__ = nvrtcGetProgramLog(prog, log) + check_status(__status__) return _log_ cpdef add_name_expression(intptr_t prog, name_expression): """nvrtcAddNameExpression notes the given name expression denoting the address of a global function or device/__constant__ variable. + The identical name expression string must be provided on a subsequent call to + nvrtcGetLoweredName to extract the lowered name. + Args: prog (intptr_t): CUDA Runtime Compilation program. - name_expression (str): constant expression denoting the - address of a global function or device/__constant__ - variable. + name_expression (str): constant expression denoting the address of + a global function or device/__constant__ variable. .. seealso:: `nvrtcAddNameExpression` """ @@ -945,9 +956,10 @@ cpdef add_name_expression(intptr_t prog, name_expression): cpdef size_t get_pch_heap_size() except? 0: """retrieve the current size of the PCH Heap. + Returns: - size_t: pointer to location where the size of the PCH Heap - will be stored. + size_t: pointer to location where the size of the PCH Heap will be + stored. .. seealso:: `nvrtcGetPCHHeapSize` """ @@ -961,6 +973,10 @@ cpdef size_t get_pch_heap_size() except? 0: cpdef set_pch_heap_size(size_t size): """set the size of the PCH Heap. + The requested size may be rounded up to a platform dependent alignment (e.g. + page size). If the PCH Heap has already been allocated, the heap memory will be + freed and a new PCH Heap will be allocated. + Args: size (size_t): requested size of the PCH Heap, in bytes. @@ -974,6 +990,20 @@ cpdef set_pch_heap_size(size_t size): cpdef int get_pch_create_status(intptr_t prog) except? -1: """returns the PCH creation status. + NVRTC_SUCCESS indicates that the PCH was successfully created. + NVRTC_ERROR_NO_PCH_CREATE_ATTEMPTED indicates that no PCH creation was + attempted, either because PCH functionality was not requested during the + preceding nvrtcCompileProgram call, or automatic PCH processing was requested, + and compiler chose not to create a PCH file. + NVRTC_ERROR_PCH_CREATE_HEAP_EXHAUSTED indicates that a PCH file could + potentially have been created, but the compiler ran out space in the PCH heap. + In this scenario, the :func:`get_pch_heap_size_required` can be used to query + the required heap size, the heap can be reallocated for this size with + :func:`set_pch_heap_size` and PCH creation may be reattempted again invoking + :func:`compile_program` with a new NVRTC program instance. + NVRTC_ERROR_PCH_CREATE indicates that an error condition prevented the PCH file + from being created. + Args: prog (intptr_t): CUDA Runtime Compilation program. @@ -988,6 +1018,7 @@ cpdef int get_pch_create_status(intptr_t prog) except? -1: cpdef size_t get_pch_heap_size_required(intptr_t prog) except? 0: """retrieve the required size of the PCH heap required to compile the given program. + Args: prog (intptr_t): CUDA Runtime Compilation program. @@ -1007,6 +1038,7 @@ cpdef size_t get_pch_heap_size_required(intptr_t prog) except? 0: cpdef size_t get_tile_ir_size(intptr_t prog) except? 0: """nvrtcGetTileIRSize sets the value of ``tile_ir_size_ret`` with the size of the cuda_tile IR generated by the previous compilation of ``prog``. + Args: prog (intptr_t): CUDA Runtime Compilation program. @@ -1025,6 +1057,7 @@ cpdef size_t get_tile_ir_size(intptr_t prog) except? 0: cpdef bytes get_tile_ir(intptr_t prog): """nvrtcGettile_ir stores the cuda_tile IR generated by the previous compilation of ``prog`` in the memory pointed by ``tile_ir``. + Args: prog (intptr_t): CUDA Runtime Compilation program. @@ -1037,13 +1070,12 @@ cpdef bytes get_tile_ir(intptr_t prog): with nogil: __status__ = nvrtcGetTileIRSize(prog, &TileIRSizeRet) check_status(__status__) - if TileIRSizeRet == 0: - return b"" cdef bytes _tile_ir_ = bytes(TileIRSizeRet) cdef char* tile_ir = _tile_ir_ - with nogil: - __status__ = nvrtcGetTileIR(prog, tile_ir) - check_status(__status__) + if TileIRSizeRet != 0: + with nogil: + __status__ = nvrtcGetTileIR(prog, tile_ir) + check_status(__status__) return _tile_ir_ diff --git a/cuda_bindings/cuda/bindings/cudla.pxd b/cuda_bindings/cuda/bindings/cudla.pxd index 90cddb7e342..9b30ff4beaa 100644 --- a/cuda_bindings/cuda/bindings/cudla.pxd +++ b/cuda_bindings/cuda/bindings/cudla.pxd @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 # This code was automatically generated across versions from 1.5.0 to 13.4.1. Do not modify it directly. -# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=f6b70193e4ca3c62bd5749b3d19d305f0e268225bf1a6dcf6b95091cb0511791 +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=6eb337830ce6124c51007631ed0be6c3232fcd43f6d1e53f28b060ec0adf97f8 # <<<< PREAMBLE CONTENT >>>> @@ -56,7 +56,7 @@ cpdef intptr_t create_device(uint64_t device, uint32_t flags) except * cpdef intptr_t mem_register(intptr_t dev_handle, intptr_t ptr, size_t size, uint32_t flags) except * cpdef intptr_t module_load_from_memory(intptr_t dev_handle, p_module, size_t module_size, uint32_t flags) except * cpdef module_unload(intptr_t h_module, uint32_t flags) -cpdef submit_task(intptr_t dev_handle, intptr_t ptr_to_tasks, uint32_t num_tasks, intptr_t stream, uint32_t flags) +cpdef submit_task(intptr_t dev_handle, ptr_to_tasks, uint32_t num_tasks, intptr_t stream, uint32_t flags) cpdef object device_get_attribute(intptr_t dev_handle, int attrib) cpdef mem_unregister(intptr_t dev_handle, intptr_t dev_ptr) cpdef int get_last_error(intptr_t dev_handle) except? 0 diff --git a/cuda_bindings/cuda/bindings/cudla.pyx b/cuda_bindings/cuda/bindings/cudla.pyx index 9d04eb6013d..d5a86038549 100644 --- a/cuda_bindings/cuda/bindings/cudla.pyx +++ b/cuda_bindings/cuda/bindings/cudla.pyx @@ -2,13 +2,19 @@ # SPDX-License-Identifier: Apache-2.0 # This code was automatically generated across versions from 1.5.0 to 13.4.1. Do not modify it directly. -# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=27847299a8355597d74d78c538539764838b579ac5331197a0773132e9c1fc18 +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=7a208273ab596a5fc3e4ce5ca2f4cd474a4d3e649aa06b78bc8e5564fe2cebfd # <<<< PREAMBLE CONTENT >>>> cimport cpython as _cyb_cpython cimport cpython.buffer as _cyb_cpython_buffer +from cpython.buffer cimport ( + PyBUF_SIMPLE as _cyb_PyBUF_SIMPLE, + PyBuffer_Release as _cyb_PyBuffer_Release, + PyObject_GetBuffer as _cyb_PyObject_GetBuffer, + Py_buffer as _cyb_Py_buffer, +) from cython cimport view as _cyb_view from libc.stdint cimport ( intptr_t, @@ -16,14 +22,10 @@ from libc.stdint cimport ( uint64_t, uint8_t, ) -from libc.stdlib cimport ( - calloc as _cyb_calloc, - free as _cyb_free, - malloc as _cyb_malloc, -) from libc.string cimport ( memcmp as _cyb_memcmp, memcpy as _cyb_memcpy, + memmove as _cyb_memmove, ) from enum import IntEnum as _cyb_IntEnum @@ -52,7 +54,7 @@ cdef _cyb_from_buffer(buffer, size, lowpp_type): raise ValueError("buffer itemsize must be 1 byte") if view.len != size: raise ValueError(f"buffer length must be {size} bytes") - return lowpp_type.from_ptr(view.buf, not view.readonly, buffer) + return lowpp_type.from_ptr(view.buf, view.readonly != 0, buffer) finally: _cyb_cpython.PyBuffer_Release(&view) @@ -75,7 +77,9 @@ cdef intptr_t _cyb_get_buffer_pointer(buf, Py_ssize_t size, readonly=True) excep flags |= _cyb_cpython.PyBUF_WRITABLE cdef int status = -1 cdef _cyb_cpython.Py_buffer view - if isinstance(buf, int): + if buf is None: + ptr = 0 + elif isinstance(buf, int): ptr = buf else: try: @@ -86,7 +90,7 @@ cdef intptr_t _cyb_get_buffer_pointer(buf, Py_ssize_t size, readonly=True) excep except Exception as e: adj = "writable " if not readonly else "" raise ValueError( - "buf must be either a Python int representing the pointer " + "buf must be None, a Python int representing the pointer " f"address to a valid buffer, or a 1D contiguous {adj}" f"buffer, of size {size}" ) from e @@ -133,26 +137,16 @@ cdef class ExternalMemoryHandleDesc: .. seealso:: `cudlaExternalMemoryHandleDesc_t` """ cdef: + cudlaExternalMemoryHandleDesc_t _data cudlaExternalMemoryHandleDesc_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(cudlaExternalMemoryHandleDesc_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating ExternalMemoryHandleDesc") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef cudlaExternalMemoryHandleDesc_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.ExternalMemoryHandleDesc object at {hex(id(self))}>" @@ -181,14 +175,22 @@ cdef class ExternalMemoryHandleDesc: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(cudlaExternalMemoryHandleDesc_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating ExternalMemoryHandleDesc") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(cudlaExternalMemoryHandleDesc_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This ExternalMemoryHandleDesc instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(cudlaExternalMemoryHandleDesc_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(cudlaExternalMemoryHandleDesc_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(cudlaExternalMemoryHandleDesc_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -241,16 +243,12 @@ cdef class ExternalMemoryHandleDesc: raise ValueError("ptr must not be null (0)") cdef ExternalMemoryHandleDesc obj = ExternalMemoryHandleDesc.__new__(ExternalMemoryHandleDesc) if owner is None: - obj._ptr = _cyb_malloc(sizeof(cudlaExternalMemoryHandleDesc_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating ExternalMemoryHandleDesc") - _cyb_memcpy((obj._ptr), ptr, sizeof(cudlaExternalMemoryHandleDesc_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(cudlaExternalMemoryHandleDesc_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -275,26 +273,16 @@ cdef class ExternalSemaphoreHandleDesc: .. seealso:: `cudlaExternalSemaphoreHandleDesc_t` """ cdef: + cudlaExternalSemaphoreHandleDesc_t _data cudlaExternalSemaphoreHandleDesc_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(cudlaExternalSemaphoreHandleDesc_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating ExternalSemaphoreHandleDesc") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef cudlaExternalSemaphoreHandleDesc_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.ExternalSemaphoreHandleDesc object at {hex(id(self))}>" @@ -323,14 +311,22 @@ cdef class ExternalSemaphoreHandleDesc: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(cudlaExternalSemaphoreHandleDesc_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating ExternalSemaphoreHandleDesc") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(cudlaExternalSemaphoreHandleDesc_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This ExternalSemaphoreHandleDesc instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(cudlaExternalSemaphoreHandleDesc_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(cudlaExternalSemaphoreHandleDesc_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(cudlaExternalSemaphoreHandleDesc_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -372,16 +368,12 @@ cdef class ExternalSemaphoreHandleDesc: raise ValueError("ptr must not be null (0)") cdef ExternalSemaphoreHandleDesc obj = ExternalSemaphoreHandleDesc.__new__(ExternalSemaphoreHandleDesc) if owner is None: - obj._ptr = _cyb_malloc(sizeof(cudlaExternalSemaphoreHandleDesc_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating ExternalSemaphoreHandleDesc") - _cyb_memcpy((obj._ptr), ptr, sizeof(cudlaExternalSemaphoreHandleDesc_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(cudlaExternalSemaphoreHandleDesc_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -417,26 +409,16 @@ cdef class ModuleTensorDescriptor: .. seealso:: `cudlaModuleTensorDescriptor` """ cdef: + cudlaModuleTensorDescriptor _data cudlaModuleTensorDescriptor *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(cudlaModuleTensorDescriptor)) - if self._ptr == NULL: - raise MemoryError("Error allocating ModuleTensorDescriptor") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef cudlaModuleTensorDescriptor *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.ModuleTensorDescriptor object at {hex(id(self))}>" @@ -465,14 +447,22 @@ cdef class ModuleTensorDescriptor: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(cudlaModuleTensorDescriptor)) - if self._ptr == NULL: - raise MemoryError("Error allocating ModuleTensorDescriptor") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(cudlaModuleTensorDescriptor)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This ModuleTensorDescriptor instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(cudlaModuleTensorDescriptor): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(cudlaModuleTensorDescriptor), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(cudlaModuleTensorDescriptor)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -645,16 +635,12 @@ cdef class ModuleTensorDescriptor: raise ValueError("ptr must not be null (0)") cdef ModuleTensorDescriptor obj = ModuleTensorDescriptor.__new__(ModuleTensorDescriptor) if owner is None: - obj._ptr = _cyb_malloc(sizeof(cudlaModuleTensorDescriptor)) - if obj._ptr == NULL: - raise MemoryError("Error allocating ModuleTensorDescriptor") - _cyb_memcpy((obj._ptr), ptr, sizeof(cudlaModuleTensorDescriptor)) + _cyb_memcpy(&obj._data, ptr, sizeof(cudlaModuleTensorDescriptor)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -680,26 +666,16 @@ cdef class Fence: .. seealso:: `CudlaFence` """ cdef: + CudlaFence _data CudlaFence *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(CudlaFence)) - if self._ptr == NULL: - raise MemoryError("Error allocating Fence") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef CudlaFence *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.Fence object at {hex(id(self))}>" @@ -728,14 +704,22 @@ cdef class Fence: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(CudlaFence)) - if self._ptr == NULL: - raise MemoryError("Error allocating Fence") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(CudlaFence)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This Fence instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(CudlaFence): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(CudlaFence), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(CudlaFence)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -788,16 +772,12 @@ cdef class Fence: raise ValueError("ptr must not be null (0)") cdef Fence obj = Fence.__new__(Fence) if owner is None: - obj._ptr = _cyb_malloc(sizeof(CudlaFence)) - if obj._ptr == NULL: - raise MemoryError("Error allocating Fence") - _cyb_memcpy((obj._ptr), ptr, sizeof(CudlaFence)) + _cyb_memcpy(&obj._data, ptr, sizeof(CudlaFence)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -823,26 +803,16 @@ cdef class DevAttribute: .. seealso:: `cudlaDevAttribute` """ cdef: + cudlaDevAttribute _data cudlaDevAttribute *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(cudlaDevAttribute)) - if self._ptr == NULL: - raise MemoryError("Error allocating DevAttribute") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef cudlaDevAttribute *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.DevAttribute object at {hex(id(self))}>" @@ -871,14 +841,22 @@ cdef class DevAttribute: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(cudlaDevAttribute)) - if self._ptr == NULL: - raise MemoryError("Error allocating DevAttribute") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(cudlaDevAttribute)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This DevAttribute instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(cudlaDevAttribute): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(cudlaDevAttribute), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(cudlaDevAttribute)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -931,16 +909,12 @@ cdef class DevAttribute: raise ValueError("ptr must not be null (0)") cdef DevAttribute obj = DevAttribute.__new__(DevAttribute) if owner is None: - obj._ptr = _cyb_malloc(sizeof(cudlaDevAttribute)) - if obj._ptr == NULL: - raise MemoryError("Error allocating DevAttribute") - _cyb_memcpy((obj._ptr), ptr, sizeof(cudlaDevAttribute)) + _cyb_memcpy(&obj._data, ptr, sizeof(cudlaDevAttribute)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -968,26 +942,16 @@ cdef class ModuleAttribute: .. seealso:: `cudlaModuleAttribute` """ cdef: + cudlaModuleAttribute _data cudlaModuleAttribute *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(cudlaModuleAttribute)) - if self._ptr == NULL: - raise MemoryError("Error allocating ModuleAttribute") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef cudlaModuleAttribute *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.ModuleAttribute object at {hex(id(self))}>" @@ -1016,14 +980,22 @@ cdef class ModuleAttribute: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(cudlaModuleAttribute)) - if self._ptr == NULL: - raise MemoryError("Error allocating ModuleAttribute") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(cudlaModuleAttribute)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This ModuleAttribute instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(cudlaModuleAttribute): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(cudlaModuleAttribute), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(cudlaModuleAttribute)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -1098,16 +1070,12 @@ cdef class ModuleAttribute: raise ValueError("ptr must not be null (0)") cdef ModuleAttribute obj = ModuleAttribute.__new__(ModuleAttribute) if owner is None: - obj._ptr = _cyb_malloc(sizeof(cudlaModuleAttribute)) - if obj._ptr == NULL: - raise MemoryError("Error allocating ModuleAttribute") - _cyb_memcpy((obj._ptr), ptr, sizeof(cudlaModuleAttribute)) + _cyb_memcpy(&obj._data, ptr, sizeof(cudlaModuleAttribute)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -1133,28 +1101,18 @@ cdef class WaitEvents: .. seealso:: `cudlaWaitEvents` """ cdef: + cudlaWaitEvents _data cudlaWaitEvents *_ptr object _owner - bint _owned bint _readonly dict _refs def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(cudlaWaitEvents)) - if self._ptr == NULL: - raise MemoryError("Error allocating WaitEvents") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False self._refs = {} - def __dealloc__(self): - cdef cudlaWaitEvents *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.WaitEvents object at {hex(id(self))}>" @@ -1183,14 +1141,22 @@ cdef class WaitEvents: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(cudlaWaitEvents)) - if self._ptr == NULL: - raise MemoryError("Error allocating WaitEvents") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(cudlaWaitEvents)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This WaitEvents instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(cudlaWaitEvents): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(cudlaWaitEvents), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(cudlaWaitEvents)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -1242,16 +1208,12 @@ cdef class WaitEvents: raise ValueError("ptr must not be null (0)") cdef WaitEvents obj = WaitEvents.__new__(WaitEvents) if owner is None: - obj._ptr = _cyb_malloc(sizeof(cudlaWaitEvents)) - if obj._ptr == NULL: - raise MemoryError("Error allocating WaitEvents") - _cyb_memcpy((obj._ptr), ptr, sizeof(cudlaWaitEvents)) + _cyb_memcpy(&obj._data, ptr, sizeof(cudlaWaitEvents)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly obj._refs = {} return obj @@ -1279,28 +1241,18 @@ cdef class SignalEvents: .. seealso:: `cudlaSignalEvents` """ cdef: + cudlaSignalEvents _data cudlaSignalEvents *_ptr object _owner - bint _owned bint _readonly dict _refs def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(cudlaSignalEvents)) - if self._ptr == NULL: - raise MemoryError("Error allocating SignalEvents") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False self._refs = {} - def __dealloc__(self): - cdef cudlaSignalEvents *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.SignalEvents object at {hex(id(self))}>" @@ -1329,14 +1281,22 @@ cdef class SignalEvents: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(cudlaSignalEvents)) - if self._ptr == NULL: - raise MemoryError("Error allocating SignalEvents") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(cudlaSignalEvents)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This SignalEvents instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(cudlaSignalEvents): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(cudlaSignalEvents), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(cudlaSignalEvents)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -1413,16 +1373,12 @@ cdef class SignalEvents: raise ValueError("ptr must not be null (0)") cdef SignalEvents obj = SignalEvents.__new__(SignalEvents) if owner is None: - obj._ptr = _cyb_malloc(sizeof(cudlaSignalEvents)) - if obj._ptr == NULL: - raise MemoryError("Error allocating SignalEvents") - _cyb_memcpy((obj._ptr), ptr, sizeof(cudlaSignalEvents)) + _cyb_memcpy(&obj._data, ptr, sizeof(cudlaSignalEvents)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly obj._refs = {} return obj @@ -1454,28 +1410,18 @@ cdef class Task: .. seealso:: `cudlaTask` """ cdef: + cudlaTask _data cudlaTask *_ptr object _owner - bint _owned bint _readonly dict _refs def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(cudlaTask)) - if self._ptr == NULL: - raise MemoryError("Error allocating Task") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False self._refs = {} - def __dealloc__(self): - cdef cudlaTask *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.Task object at {hex(id(self))}>" @@ -1504,14 +1450,22 @@ cdef class Task: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(cudlaTask)) - if self._ptr == NULL: - raise MemoryError("Error allocating Task") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(cudlaTask)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This Task instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(cudlaTask): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(cudlaTask), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(cudlaTask)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -1625,16 +1579,12 @@ cdef class Task: raise ValueError("ptr must not be null (0)") cdef Task obj = Task.__new__(Task) if owner is None: - obj._ptr = _cyb_malloc(sizeof(cudlaTask)) - if obj._ptr == NULL: - raise MemoryError("Error allocating Task") - _cyb_memcpy((obj._ptr), ptr, sizeof(cudlaTask)) + _cyb_memcpy(&obj._data, ptr, sizeof(cudlaTask)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly obj._refs = {} return obj @@ -1695,23 +1645,30 @@ class FenceType(_cyb_IntEnum): """ See `cudlaFenceType`. """ - NVSCISYNC_FENCE = CUDLA_NVSCISYNC_FENCE - NVSCISYNC_FENCE_SOF = CUDLA_NVSCISYNC_FENCE_SOF + FENCE = CUDLA_NVSCISYNC_FENCE + NVSCISYNC_FENCE = FENCE # backward-compat alias + FENCE_SOF = CUDLA_NVSCISYNC_FENCE_SOF + NVSCISYNC_FENCE_SOF = FENCE_SOF # backward-compat alias class ModuleLoadFlags(_cyb_IntEnum): """ See `cudlaModuleLoadFlags`. """ - MODULE_DEFAULT = CUDLA_MODULE_DEFAULT - MODULE_ENABLE_FAULT_DIAGNOSTICS = CUDLA_MODULE_ENABLE_FAULT_DIAGNOSTICS + DEFAULT = CUDLA_MODULE_DEFAULT + MODULE_DEFAULT = DEFAULT # backward-compat alias + ENABLE_FAULT_DIAGNOSTICS = CUDLA_MODULE_ENABLE_FAULT_DIAGNOSTICS + MODULE_ENABLE_FAULT_DIAGNOSTICS = ENABLE_FAULT_DIAGNOSTICS # backward-compat alias class SubmissionFlags(_cyb_IntEnum): """ See `cudlaSubmissionFlags`. """ - SUBMIT_NOOP = CUDLA_SUBMIT_NOOP - SUBMIT_SKIP_LOCK_ACQUIRE = CUDLA_SUBMIT_SKIP_LOCK_ACQUIRE - SUBMIT_DIAGNOSTICS_TASK = CUDLA_SUBMIT_DIAGNOSTICS_TASK + NOOP = CUDLA_SUBMIT_NOOP + SUBMIT_NOOP = NOOP # backward-compat alias + SKIP_LOCK_ACQUIRE = CUDLA_SUBMIT_SKIP_LOCK_ACQUIRE + SUBMIT_SKIP_LOCK_ACQUIRE = SKIP_LOCK_ACQUIRE # backward-compat alias + DIAGNOSTICS_TASK = CUDLA_SUBMIT_DIAGNOSTICS_TASK + SUBMIT_DIAGNOSTICS_TASK = DIAGNOSTICS_TASK # backward-compat alias class AccessPermissionFlags(_cyb_IntEnum): """ @@ -1732,9 +1689,12 @@ class ScratchMemoryConfig(_cyb_IntEnum): """ See `cudlaScratchMemoryConfig`. """ - SCRATCH_MEMORY_DEFAULT = CUDLA_SCRATCH_MEMORY_DEFAULT - SCRATCH_MEMORY_SHARED_STATIC = CUDLA_SCRATCH_MEMORY_SHARED_STATIC - MAX = CUDLA_SCRATCH_MEMORY_CONFIG_MAX + DEFAULT = CUDLA_SCRATCH_MEMORY_DEFAULT + SCRATCH_MEMORY_DEFAULT = DEFAULT # backward-compat alias + SHARED_STATIC = CUDLA_SCRATCH_MEMORY_SHARED_STATIC + SCRATCH_MEMORY_SHARED_STATIC = SHARED_STATIC # backward-compat alias + CONFIG_MAX = CUDLA_SCRATCH_MEMORY_CONFIG_MAX + MAX = CONFIG_MAX # backward-compat alias ############################################################################### @@ -1812,9 +1772,10 @@ cpdef module_unload(intptr_t h_module, uint32_t flags): check_status(__status__) -cpdef submit_task(intptr_t dev_handle, intptr_t ptr_to_tasks, uint32_t num_tasks, intptr_t stream, uint32_t flags): +cpdef submit_task(intptr_t dev_handle, ptr_to_tasks, uint32_t num_tasks, intptr_t stream, uint32_t flags): + cdef intptr_t _ptr_to_tasks_ptr_ = int(ptr_to_tasks) with nogil: - __status__ = cudlaSubmitTask(dev_handle, ptr_to_tasks, num_tasks, stream, flags) + __status__ = cudlaSubmitTask(dev_handle, _ptr_to_tasks_ptr_, num_tasks, stream, flags) check_status(__status__) diff --git a/cuda_bindings/cuda/bindings/cufile.pxd b/cuda_bindings/cuda/bindings/cufile.pxd index 1970c4f614a..ac4a24851f5 100644 --- a/cuda_bindings/cuda/bindings/cufile.pxd +++ b/cuda_bindings/cuda/bindings/cufile.pxd @@ -3,7 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 # # This code was automatically generated across versions from 12.9.1 to 13.4.1. Do not modify it directly. -# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=616e51ad15aa071792eceba5db17a6fb2b845b219395e2fdcc6278d3621f52de +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=5b9d3a05eab53628d366c602ae3125fede0d25b2cc48137e2b1f7dcb29068650 @@ -53,7 +53,7 @@ ctypedef CUfileP2PFlags_t _P2PFlags # Functions ############################################################################### -cpdef intptr_t handle_register(intptr_t descr) except? 0 +cpdef intptr_t handle_register(descr) except? 0 cpdef void handle_deregister(intptr_t fh) except* cpdef buf_register(intptr_t buf_ptr_base, size_t length, int flags) cpdef buf_deregister(intptr_t buf_ptr_base) @@ -65,8 +65,8 @@ cpdef driver_set_max_direct_io_size(size_t max_direct_io_size) cpdef driver_set_max_cache_size(size_t max_cache_size) cpdef driver_set_max_pinned_mem_size(size_t max_pinned_size) cpdef intptr_t batch_io_set_up(unsigned nr) except? 0 -cpdef batch_io_submit(intptr_t batch_idp, unsigned nr, intptr_t iocbp, unsigned int flags) -cpdef batch_io_get_status(intptr_t batch_idp, unsigned min_nr, intptr_t nr, intptr_t iocbp, intptr_t timeout) +cpdef batch_io_submit(intptr_t batch_idp, unsigned nr, iocbp, unsigned int flags) +cpdef batch_io_get_status(intptr_t batch_idp, unsigned min_nr, intptr_t nr, iocbp, intptr_t timeout) cpdef batch_io_cancel(intptr_t batch_idp) cpdef void batch_io_destroy(intptr_t batch_idp) except* cpdef read_async(intptr_t fh, intptr_t buf_ptr_base, intptr_t size_p, intptr_t file_offset_p, intptr_t buf_ptr_offset_p, intptr_t bytes_read_p, intptr_t stream) @@ -86,9 +86,9 @@ cpdef int get_stats_level() except? 0 cpdef stats_start() cpdef stats_stop() cpdef stats_reset() -cpdef get_stats_l1(intptr_t stats) -cpdef get_stats_l2(intptr_t stats) -cpdef get_stats_l3(intptr_t stats) +cpdef get_stats_l1(stats) +cpdef get_stats_l2(stats) +cpdef get_stats_l3(stats) cpdef size_t get_bar_size_in_kb(int gpu_index) except? 0 cpdef set_parameter_posix_pool_slab_array(intptr_t size_values, intptr_t count_values, int len) cpdef get_parameter_posix_pool_slab_array(intptr_t size_values, intptr_t count_values, int len) diff --git a/cuda_bindings/cuda/bindings/cufile.pyx b/cuda_bindings/cuda/bindings/cufile.pyx index 7365ed4b62b..14587496690 100644 --- a/cuda_bindings/cuda/bindings/cufile.pyx +++ b/cuda_bindings/cuda/bindings/cufile.pyx @@ -3,13 +3,19 @@ # SPDX-License-Identifier: Apache-2.0 # # This code was automatically generated across versions from 12.9.1 to 13.4.1. Do not modify it directly. -# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=99d6a9660bb3015680d55d4d2da20861cecfd836de22a90892eeb64a480acafa +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=81d29d3c883454c4864665cd1027a72114cacd123e4bfdd997485faedb5a054a # <<<< PREAMBLE CONTENT >>>> cimport cpython as _cyb_cpython cimport cpython.buffer as _cyb_cpython_buffer +from cpython.buffer cimport ( + PyBUF_SIMPLE as _cyb_PyBUF_SIMPLE, + PyBuffer_Release as _cyb_PyBuffer_Release, + PyObject_GetBuffer as _cyb_PyObject_GetBuffer, + Py_buffer as _cyb_Py_buffer, +) cimport cpython.memoryview as _cyb_cpython_memoryview from cython cimport view as _cyb_view from libc.stdint cimport ( @@ -24,6 +30,7 @@ from libc.stdlib cimport ( from libc.string cimport ( memcmp as _cyb_memcmp, memcpy as _cyb_memcpy, + memmove as _cyb_memmove, ) from libcpp cimport bool as _cyb_bool @@ -53,7 +60,7 @@ cdef _cyb_from_buffer(buffer, size, lowpp_type): raise ValueError("buffer itemsize must be 1 byte") if view.len != size: raise ValueError(f"buffer length must be {size} bytes") - return lowpp_type.from_ptr(view.buf, not view.readonly, buffer) + return lowpp_type.from_ptr(view.buf, view.readonly != 0, buffer) finally: _cyb_cpython.PyBuffer_Release(&view) @@ -94,7 +101,7 @@ cdef _get__py_anon_pod1_dtype_offsets(): (&(pod.fd)) - (&pod), (&(pod.handle)) - (&pod), ], - 'itemsize': sizeof((NULL).handle), + 'itemsize': sizeof(cuda_bindings_cufile__anon_pod1), }) _py_anon_pod1_dtype = _get__py_anon_pod1_dtype_offsets() @@ -108,20 +115,20 @@ cdef class _py_anon_pod1: cdef: cuda_bindings_cufile__anon_pod1 *_ptr object _owner - bint _owned + bint _owns_ptr bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof((NULL).handle)) + self._ptr = _cyb_calloc(1, sizeof(cuda_bindings_cufile__anon_pod1)) if self._ptr == NULL: raise MemoryError("Error allocating _py_anon_pod1") + self._owns_ptr = True self._owner = None - self._owned = True self._readonly = False def __dealloc__(self): cdef cuda_bindings_cufile__anon_pod1 *ptr - if self._owned and self._ptr != NULL: + if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) @@ -145,23 +152,29 @@ cdef class _py_anon_pod1: if not isinstance(other, _py_anon_pod1): return False other_ = other - return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof((NULL).handle)) == 0) + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(cuda_bindings_cufile__anon_pod1)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): - _cyb___getbuffer(self, buffer, self._ptr, sizeof((NULL).handle), self._readonly) + _cyb___getbuffer(self, buffer, self._ptr, sizeof(cuda_bindings_cufile__anon_pod1), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof((NULL).handle)) - if self._ptr == NULL: - raise MemoryError("Error allocating _py_anon_pod1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof((NULL).handle)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This _py_anon_pod1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(cuda_bindings_cufile__anon_pod1): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(cuda_bindings_cufile__anon_pod1), view.len) + ) + _cyb_memmove(self._ptr, view.buf, sizeof(cuda_bindings_cufile__anon_pod1)) + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -190,7 +203,7 @@ cdef class _py_anon_pod1: @staticmethod def from_buffer(buffer): """Create an _py_anon_pod1 instance with the memory from the given buffer.""" - return _cyb_from_buffer(buffer, sizeof((NULL).handle), _py_anon_pod1) + return _cyb_from_buffer(buffer, sizeof(cuda_bindings_cufile__anon_pod1), _py_anon_pod1) @staticmethod def from_data(data): @@ -214,16 +227,16 @@ cdef class _py_anon_pod1: raise ValueError("ptr must not be null (0)") cdef _py_anon_pod1 obj = _py_anon_pod1.__new__(_py_anon_pod1) if owner is None: - obj._ptr = _cyb_malloc(sizeof((NULL).handle)) + obj._ptr = _cyb_malloc(sizeof(cuda_bindings_cufile__anon_pod1)) if obj._ptr == NULL: raise MemoryError("Error allocating _py_anon_pod1") - _cyb_memcpy((obj._ptr), ptr, sizeof((NULL).handle)) + _cyb_memcpy((obj._ptr), ptr, sizeof(cuda_bindings_cufile__anon_pod1)) + obj._owns_ptr = True obj._owner = None - obj._owned = True else: obj._ptr = ptr + obj._owns_ptr = False obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -239,7 +252,7 @@ cdef _get__py_anon_pod3_dtype_offsets(): (&(pod.devPtr_offset)) - (&pod), (&(pod.size)) - (&pod), ], - 'itemsize': sizeof((NULL).u.batch), + 'itemsize': sizeof(cuda_bindings_cufile__anon_pod3), }) _py_anon_pod3_dtype = _get__py_anon_pod3_dtype_offsets() @@ -253,20 +266,20 @@ cdef class _py_anon_pod3: cdef: cuda_bindings_cufile__anon_pod3 *_ptr object _owner - bint _owned + bint _owns_ptr bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof((NULL).u.batch)) + self._ptr = _cyb_calloc(1, sizeof(cuda_bindings_cufile__anon_pod3)) if self._ptr == NULL: raise MemoryError("Error allocating _py_anon_pod3") + self._owns_ptr = True self._owner = None - self._owned = True self._readonly = False def __dealloc__(self): cdef cuda_bindings_cufile__anon_pod3 *ptr - if self._owned and self._ptr != NULL: + if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) @@ -290,23 +303,29 @@ cdef class _py_anon_pod3: if not isinstance(other, _py_anon_pod3): return False other_ = other - return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof((NULL).u.batch)) == 0) + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(cuda_bindings_cufile__anon_pod3)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): - _cyb___getbuffer(self, buffer, self._ptr, sizeof((NULL).u.batch), self._readonly) + _cyb___getbuffer(self, buffer, self._ptr, sizeof(cuda_bindings_cufile__anon_pod3), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof((NULL).u.batch)) - if self._ptr == NULL: - raise MemoryError("Error allocating _py_anon_pod3") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof((NULL).u.batch)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This _py_anon_pod3 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(cuda_bindings_cufile__anon_pod3): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(cuda_bindings_cufile__anon_pod3), view.len) + ) + _cyb_memmove(self._ptr, view.buf, sizeof(cuda_bindings_cufile__anon_pod3)) + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -357,7 +376,7 @@ cdef class _py_anon_pod3: @staticmethod def from_buffer(buffer): """Create an _py_anon_pod3 instance with the memory from the given buffer.""" - return _cyb_from_buffer(buffer, sizeof((NULL).u.batch), _py_anon_pod3) + return _cyb_from_buffer(buffer, sizeof(cuda_bindings_cufile__anon_pod3), _py_anon_pod3) @staticmethod def from_data(data): @@ -381,16 +400,16 @@ cdef class _py_anon_pod3: raise ValueError("ptr must not be null (0)") cdef _py_anon_pod3 obj = _py_anon_pod3.__new__(_py_anon_pod3) if owner is None: - obj._ptr = _cyb_malloc(sizeof((NULL).u.batch)) + obj._ptr = _cyb_malloc(sizeof(cuda_bindings_cufile__anon_pod3)) if obj._ptr == NULL: raise MemoryError("Error allocating _py_anon_pod3") - _cyb_memcpy((obj._ptr), ptr, sizeof((NULL).u.batch)) + _cyb_memcpy((obj._ptr), ptr, sizeof(cuda_bindings_cufile__anon_pod3)) + obj._owns_ptr = True obj._owner = None - obj._owned = True else: obj._ptr = ptr + obj._owns_ptr = False obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -445,9 +464,10 @@ cdef class IOEvents: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -587,20 +607,20 @@ cdef class OpCounter: cdef: CUfileOpCounter_t *_ptr object _owner - bint _owned + bint _owns_ptr bint _readonly def __init__(self): self._ptr = _cyb_calloc(1, sizeof(CUfileOpCounter_t)) if self._ptr == NULL: raise MemoryError("Error allocating OpCounter") + self._owns_ptr = True self._owner = None - self._owned = True self._readonly = False def __dealloc__(self): cdef CUfileOpCounter_t *ptr - if self._owned and self._ptr != NULL: + if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) @@ -633,14 +653,20 @@ cdef class OpCounter: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(CUfileOpCounter_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating OpCounter") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(CUfileOpCounter_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This OpCounter instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(CUfileOpCounter_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(CUfileOpCounter_t), view.len) + ) + _cyb_memmove(self._ptr, view.buf, sizeof(CUfileOpCounter_t)) + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -697,12 +723,12 @@ cdef class OpCounter: if obj._ptr == NULL: raise MemoryError("Error allocating OpCounter") _cyb_memcpy((obj._ptr), ptr, sizeof(CUfileOpCounter_t)) + obj._owns_ptr = True obj._owner = None - obj._owned = True else: obj._ptr = ptr + obj._owns_ptr = False obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -784,9 +810,10 @@ cdef class PerGpuStats: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -1247,9 +1274,10 @@ cdef class IOVec: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -1405,9 +1433,10 @@ cdef class Descr: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -1530,7 +1559,7 @@ cdef _get__py_anon_pod2_dtype_offsets(): 'offsets': [ (&(pod.batch)) - (&pod), ], - 'itemsize': sizeof((NULL).u), + 'itemsize': sizeof(cuda_bindings_cufile__anon_pod2), }) _py_anon_pod2_dtype = _get__py_anon_pod2_dtype_offsets() @@ -1544,20 +1573,20 @@ cdef class _py_anon_pod2: cdef: cuda_bindings_cufile__anon_pod2 *_ptr object _owner - bint _owned + bint _owns_ptr bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof((NULL).u)) + self._ptr = _cyb_calloc(1, sizeof(cuda_bindings_cufile__anon_pod2)) if self._ptr == NULL: raise MemoryError("Error allocating _py_anon_pod2") + self._owns_ptr = True self._owner = None - self._owned = True self._readonly = False def __dealloc__(self): cdef cuda_bindings_cufile__anon_pod2 *ptr - if self._owned and self._ptr != NULL: + if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) @@ -1581,23 +1610,29 @@ cdef class _py_anon_pod2: if not isinstance(other, _py_anon_pod2): return False other_ = other - return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof((NULL).u)) == 0) + return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(cuda_bindings_cufile__anon_pod2)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): - _cyb___getbuffer(self, buffer, self._ptr, sizeof((NULL).u), self._readonly) + _cyb___getbuffer(self, buffer, self._ptr, sizeof(cuda_bindings_cufile__anon_pod2), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof((NULL).u)) - if self._ptr == NULL: - raise MemoryError("Error allocating _py_anon_pod2") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof((NULL).u)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This _py_anon_pod2 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(cuda_bindings_cufile__anon_pod2): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(cuda_bindings_cufile__anon_pod2), view.len) + ) + _cyb_memmove(self._ptr, view.buf, sizeof(cuda_bindings_cufile__anon_pod2)) + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -1620,7 +1655,7 @@ cdef class _py_anon_pod2: @staticmethod def from_buffer(buffer): """Create an _py_anon_pod2 instance with the memory from the given buffer.""" - return _cyb_from_buffer(buffer, sizeof((NULL).u), _py_anon_pod2) + return _cyb_from_buffer(buffer, sizeof(cuda_bindings_cufile__anon_pod2), _py_anon_pod2) @staticmethod def from_data(data): @@ -1644,16 +1679,16 @@ cdef class _py_anon_pod2: raise ValueError("ptr must not be null (0)") cdef _py_anon_pod2 obj = _py_anon_pod2.__new__(_py_anon_pod2) if owner is None: - obj._ptr = _cyb_malloc(sizeof((NULL).u)) + obj._ptr = _cyb_malloc(sizeof(cuda_bindings_cufile__anon_pod2)) if obj._ptr == NULL: raise MemoryError("Error allocating _py_anon_pod2") - _cyb_memcpy((obj._ptr), ptr, sizeof((NULL).u)) + _cyb_memcpy((obj._ptr), ptr, sizeof(cuda_bindings_cufile__anon_pod2)) + obj._owns_ptr = True obj._owner = None - obj._owned = True else: obj._ptr = ptr + obj._owns_ptr = False obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -1734,20 +1769,20 @@ cdef class StatsLevel1: cdef: CUfileStatsLevel1_t *_ptr object _owner - bint _owned + bint _owns_ptr bint _readonly def __init__(self): self._ptr = _cyb_calloc(1, sizeof(CUfileStatsLevel1_t)) if self._ptr == NULL: raise MemoryError("Error allocating StatsLevel1") + self._owns_ptr = True self._owner = None - self._owned = True self._readonly = False def __dealloc__(self): cdef CUfileStatsLevel1_t *ptr - if self._owned and self._ptr != NULL: + if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) @@ -1780,14 +1815,20 @@ cdef class StatsLevel1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(CUfileStatsLevel1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating StatsLevel1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(CUfileStatsLevel1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This StatsLevel1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(CUfileStatsLevel1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(CUfileStatsLevel1_t), view.len) + ) + _cyb_memmove(self._ptr, view.buf, sizeof(CUfileStatsLevel1_t)) + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -2542,12 +2583,12 @@ cdef class StatsLevel1: if obj._ptr == NULL: raise MemoryError("Error allocating StatsLevel1") _cyb_memcpy((obj._ptr), ptr, sizeof(CUfileStatsLevel1_t)) + obj._owns_ptr = True obj._owner = None - obj._owned = True else: obj._ptr = ptr + obj._owns_ptr = False obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -2604,9 +2645,10 @@ cdef class IOParams: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -2767,20 +2809,20 @@ cdef class StatsLevel2: cdef: CUfileStatsLevel2_t *_ptr object _owner - bint _owned + bint _owns_ptr bint _readonly def __init__(self): self._ptr = _cyb_calloc(1, sizeof(CUfileStatsLevel2_t)) if self._ptr == NULL: raise MemoryError("Error allocating StatsLevel2") + self._owns_ptr = True self._owner = None - self._owned = True self._readonly = False def __dealloc__(self): cdef CUfileStatsLevel2_t *ptr - if self._owned and self._ptr != NULL: + if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) @@ -2813,14 +2855,20 @@ cdef class StatsLevel2: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(CUfileStatsLevel2_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating StatsLevel2") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(CUfileStatsLevel2_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This StatsLevel2 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(CUfileStatsLevel2_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(CUfileStatsLevel2_t), view.len) + ) + _cyb_memmove(self._ptr, view.buf, sizeof(CUfileStatsLevel2_t)) + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -2905,12 +2953,12 @@ cdef class StatsLevel2: if obj._ptr == NULL: raise MemoryError("Error allocating StatsLevel2") _cyb_memcpy((obj._ptr), ptr, sizeof(CUfileStatsLevel2_t)) + obj._owns_ptr = True obj._owner = None - obj._owned = True else: obj._ptr = ptr + obj._owns_ptr = False obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -2937,26 +2985,16 @@ cdef class StatsLevel3: .. seealso:: `CUfileStatsLevel3_t` """ cdef: + CUfileStatsLevel3_t _data CUfileStatsLevel3_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(CUfileStatsLevel3_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating StatsLevel3") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef CUfileStatsLevel3_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.StatsLevel3 object at {hex(id(self))}>" @@ -2985,14 +3023,22 @@ cdef class StatsLevel3: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(CUfileStatsLevel3_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating StatsLevel3") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(CUfileStatsLevel3_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This StatsLevel3 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(CUfileStatsLevel3_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(CUfileStatsLevel3_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(CUfileStatsLevel3_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -3069,16 +3115,12 @@ cdef class StatsLevel3: raise ValueError("ptr must not be null (0)") cdef StatsLevel3 obj = StatsLevel3.__new__(StatsLevel3) if owner is None: - obj._ptr = _cyb_malloc(sizeof(CUfileStatsLevel3_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating StatsLevel3") - _cyb_memcpy((obj._ptr), ptr, sizeof(CUfileStatsLevel3_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(CUfileStatsLevel3_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -3324,22 +3366,28 @@ cdef int check_status(ReturnT status) except 1 nogil: # Wrapper functions ############################################################################### -cpdef intptr_t handle_register(intptr_t descr) except? 0: +cpdef intptr_t handle_register(descr) except? 0: """cuFileHandleRegister is required, and performs extra checking that is memoized to provide increased performance on later cuFile operations. + Description cuFileHandleRegister registers the open file descriptor for use + with cuFile IO operations. + This API will ensure that the file's descriptor is checked for GPUDirect + Storage support and returns a valid file handle on CU_FILE_SUCCESS. + Args: - descr (intptr_t): ``CUfileDescr_t`` file descriptor (OS - agnostic). + descr (intptr_t): ``CUfileDescr_t`` file descriptor (OS agnostic). Returns: - intptr_t: ``CUfileHandle_t`` opaque file handle for IO - operations. + intptr_t: ``CUfileHandle_t`` opaque file handle for IO operations. + .. note:: + the file needs to be opened in O_DIRECT mode to support GPUDirect Storage. .. seealso:: `cuFileHandleRegister` """ + cdef intptr_t _descr_ptr_ = int(descr) cdef Handle fh with nogil: - __status__ = cuFileHandleRegister(&fh, descr) + __status__ = cuFileHandleRegister(&fh, _descr_ptr_) check_status(__status__) return fh @@ -3347,6 +3395,7 @@ cpdef intptr_t handle_register(intptr_t descr) except? 0: cpdef void handle_deregister(intptr_t fh) except*: """releases a registered filehandle from cuFile. + Args: fh (intptr_t): ``CUfileHandle_t`` file handle. @@ -3359,12 +3408,19 @@ cpdef void handle_deregister(intptr_t fh) except*: cpdef buf_register(intptr_t buf_ptr_base, size_t length, int flags): """register an existing cudaMalloced memory with cuFile to pin for GPUDirect Storage access or register host allocated memory with cuFile. + Args: buf_ptr_base (intptr_t): buffer pointer allocated. - length (size_t): size of memory region from the above - specified bufPtr. + length (size_t): size of memory region from the above specified + bufPtr. flags (int): CU_FILE_RDMA_REGISTER. + .. note:: + This memory will be use to perform GPU direct DMA from the supported storage. + .. note:: + This API is intended for usecases where the memory is used as streaming buffer + that is reused across multiple cuFile IO operations before calling + ``cuFileBufDeregister``. .. seealso:: `cuFileBufRegister` """ with nogil: @@ -3375,6 +3431,7 @@ cpdef buf_register(intptr_t buf_ptr_base, size_t length, int flags): cpdef buf_deregister(intptr_t buf_ptr_base): """deregister an already registered device or host memory from cuFile. + Args: buf_ptr_base (intptr_t): buffer pointer to deregister. @@ -3388,6 +3445,7 @@ cpdef buf_deregister(intptr_t buf_ptr_base): cpdef driver_open(): """Initialize the cuFile library and open the nvidia-fs driver. + .. seealso:: `cuFileDriverOpen` """ with nogil: @@ -3398,6 +3456,7 @@ cpdef driver_open(): cpdef use_count(): """returns use count of cufile drivers at that moment by the process. + .. seealso:: `cuFileUseCount` """ with nogil: @@ -3408,6 +3467,7 @@ cpdef use_count(): cpdef driver_get_properties(intptr_t props): """Gets the Driver session properties If the driver is not opened, it will return the staged/default properties If the driver is opened, it will return the current properties. + Args: props (intptr_t): Properties to get. @@ -3421,12 +3481,15 @@ cpdef driver_get_properties(intptr_t props): cpdef driver_set_poll_mode(bint poll, size_t poll_threshold_size): """Sets whether the Read/Write APIs use polling to do IO operations This takes place before the driver is opened. No-op if driver is already open. + Args: - poll (bint): boolean to indicate whether to use poll mode or - not. - poll_threshold_size (size_t): max IO size to use for POLLING - mode in KB. + poll (bint): boolean to indicate whether to use poll mode or not. + poll_threshold_size (size_t): max IO size to use for POLLING mode + in KB. + .. note:: + This is an advanced command and should be tuned based on available system + memory. .. seealso:: `cuFileDriverSetPollMode` """ with nogil: @@ -3437,10 +3500,13 @@ cpdef driver_set_poll_mode(bint poll, size_t poll_threshold_size): cpdef driver_set_max_direct_io_size(size_t max_direct_io_size): """Control parameter to set max IO size(KB) used by the library to talk to nvidia-fs driver This takes place before the driver is opened. No-op if driver is already open. + Args: - max_direct_io_size (size_t): maximum allowed direct io size in - KB. + max_direct_io_size (size_t): maximum allowed direct io size in KB. + .. note:: + This is an advanced command and should be tuned based on available system + memory. .. seealso:: `cuFileDriverSetMaxDirectIOSize` """ with nogil: @@ -3451,10 +3517,13 @@ cpdef driver_set_max_direct_io_size(size_t max_direct_io_size): cpdef driver_set_max_cache_size(size_t max_cache_size): """Control parameter to set maximum GPU memory reserved per device by the library for internal buffering This takes place before the driver is opened. No-op if driver is already open. + Args: - max_cache_size (size_t): The maximum GPU buffer space per - device used for internal use in KB. + max_cache_size (size_t): The maximum GPU buffer space per device + used for internal use in KB. + .. note:: + This is an advanced command and should be tuned based on supported GPU memory. .. seealso:: `cuFileDriverSetMaxCacheSize` """ with nogil: @@ -3465,10 +3534,13 @@ cpdef driver_set_max_cache_size(size_t max_cache_size): cpdef driver_set_max_pinned_mem_size(size_t max_pinned_size): """Sets maximum buffer space that is pinned in KB for use by ``cuFileBufRegister`` This takes place before the driver is opened. No-op if driver is already open. + Args: - max_pinned_size (size_t): maximum buffer space that is pinned - in KB. + max_pinned_size (size_t): maximum buffer space that is pinned in + KB. + .. note:: + This is an advanced command and should be tuned based on supported GPU memory. .. seealso:: `cuFileDriverSetMaxPinnedMemSize` """ with nogil: @@ -3484,15 +3556,17 @@ cpdef intptr_t batch_io_set_up(unsigned nr) except? 0: return batch_idp -cpdef batch_io_submit(intptr_t batch_idp, unsigned nr, intptr_t iocbp, unsigned int flags): +cpdef batch_io_submit(intptr_t batch_idp, unsigned nr, iocbp, unsigned int flags): + cdef intptr_t _iocbp_ptr_ = int(iocbp) with nogil: - __status__ = cuFileBatchIOSubmit(batch_idp, nr, iocbp, flags) + __status__ = cuFileBatchIOSubmit(batch_idp, nr, _iocbp_ptr_, flags) check_status(__status__) -cpdef batch_io_get_status(intptr_t batch_idp, unsigned min_nr, intptr_t nr, intptr_t iocbp, intptr_t timeout): +cpdef batch_io_get_status(intptr_t batch_idp, unsigned min_nr, intptr_t nr, iocbp, intptr_t timeout): + cdef intptr_t _iocbp_ptr_ = int(iocbp) with nogil: - __status__ = cuFileBatchIOGetStatus(batch_idp, min_nr, nr, iocbp, timeout) + __status__ = cuFileBatchIOGetStatus(batch_idp, min_nr, nr, _iocbp_ptr_, timeout) check_status(__status__) @@ -3534,9 +3608,14 @@ cpdef stream_deregister(intptr_t stream): cpdef int get_version() except? 0: """Get the cuFile library version. + The version is returned as (1000 major + 10 minor). For example, CUFILE 1.7.0 + would be represented by 1070. + Returns: int: Pointer to an integer where the version will be stored. + .. note:: + This is useful for applications that need to inquire the library. .. seealso:: `cuFileGetVersion` """ cdef int version @@ -3592,13 +3671,13 @@ cpdef set_parameter_string(int param, intptr_t desc_str): cpdef tuple get_parameter_min_max_value(int param): """Get both the minimum and maximum settable values for a given size_t parameter in a single call. + Args: param (SizeTConfigParameter): CUfile SizeT configuration parameter. Returns: A 2-tuple containing: - - size_t: Pointer to store the minimum value. - size_t: Pointer to store the maximum value. @@ -3615,10 +3694,15 @@ cpdef tuple get_parameter_min_max_value(int param): cpdef set_stats_level(int level): """Set the level of statistics collection for cuFile operations. This will override the cufile.json settings for stats. + Args: level (int): Statistics level (0 = disabled, 1 = basic, 2 = detailed, 3 = verbose). + .. note:: + Higher stats levels may impact performance. Level 0 disables statistics. + .. note:: + Changes to stats level take effect for future operations. .. seealso:: `cuFileSetStatsLevel` """ with nogil: @@ -3629,6 +3713,7 @@ cpdef set_stats_level(int level): cpdef int get_stats_level() except? 0: """Get the current level of statistics collection for cuFile operations. + Returns: int: Pointer to store the current statistics level. @@ -3644,6 +3729,10 @@ cpdef int get_stats_level() except? 0: cpdef stats_start(): """Start collecting cuFile statistics. + + .. note:: + Statistics level must be set using cuFileSetStatsLevel before calling this + function. .. seealso:: `cuFileStatsStart` """ with nogil: @@ -3654,6 +3743,7 @@ cpdef stats_start(): cpdef stats_stop(): """Stop collecting cuFile statistics. + .. seealso:: `cuFileStatsStop` """ with nogil: @@ -3664,6 +3754,7 @@ cpdef stats_stop(): cpdef stats_reset(): """Reset all cuFile statistics counters. + .. seealso:: `cuFileStatsReset` """ with nogil: @@ -3671,45 +3762,51 @@ cpdef stats_reset(): check_status(__status__) -cpdef get_stats_l1(intptr_t stats): +cpdef get_stats_l1(stats): """Get Level 1 cuFile statistics. + Args: - stats (intptr_t): Pointer to ``CUfileStatsLevel1_t`` structure - to be filled. + stats (intptr_t): Pointer to ``CUfileStatsLevel1_t`` structure to + be filled. .. seealso:: `cuFileGetStatsL1` """ + cdef intptr_t _stats_ptr_ = int(stats) with nogil: - __status__ = cuFileGetStatsL1(stats) + __status__ = cuFileGetStatsL1(_stats_ptr_) check_status(__status__) -cpdef get_stats_l2(intptr_t stats): +cpdef get_stats_l2(stats): """Get Level 2 cuFile statistics. + Args: - stats (intptr_t): Pointer to ``CUfileStatsLevel2_t`` structure - to be filled. + stats (intptr_t): Pointer to ``CUfileStatsLevel2_t`` structure to + be filled. .. seealso:: `cuFileGetStatsL2` """ + cdef intptr_t _stats_ptr_ = int(stats) with nogil: - __status__ = cuFileGetStatsL2(stats) + __status__ = cuFileGetStatsL2(_stats_ptr_) check_status(__status__) -cpdef get_stats_l3(intptr_t stats): +cpdef get_stats_l3(stats): """Get Level 3 cuFile statistics. + Args: - stats (intptr_t): Pointer to ``CUfileStatsLevel3_t`` structure - to be filled. + stats (intptr_t): Pointer to ``CUfileStatsLevel3_t`` structure to + be filled. .. seealso:: `cuFileGetStatsL3` """ + cdef intptr_t _stats_ptr_ = int(stats) with nogil: - __status__ = cuFileGetStatsL3(stats) + __status__ = cuFileGetStatsL3(_stats_ptr_) check_status(__status__) @@ -3724,6 +3821,7 @@ cpdef size_t get_bar_size_in_kb(int gpu_index) except? 0: cpdef set_parameter_posix_pool_slab_array(intptr_t size_values, intptr_t count_values, int len): """Set both POSIX pool slab size and count parameters as a pair. + Args: size_values (intptr_t): Array of slab sizes in KB. count_values (intptr_t): Array of slab counts. @@ -3739,11 +3837,11 @@ cpdef set_parameter_posix_pool_slab_array(intptr_t size_values, intptr_t count_v cpdef get_parameter_posix_pool_slab_array(intptr_t size_values, intptr_t count_values, int len): """Get both POSIX pool slab size and count parameters as a pair. + Args: size_values (intptr_t): Buffer to receive slab sizes in KB. count_values (intptr_t): Buffer to receive slab counts. - len (int): Buffer size (must match the actual parameter - length). + len (int): Buffer size (must match the actual parameter length). .. seealso:: `cuFileGetParameterPosixPoolSlabArray` """ diff --git a/cuda_bindings/cuda/bindings/cycufile.pxd b/cuda_bindings/cuda/bindings/cycufile.pxd index 3196f6a5eab..a25708f54d6 100644 --- a/cuda_bindings/cuda/bindings/cycufile.pxd +++ b/cuda_bindings/cuda/bindings/cycufile.pxd @@ -3,11 +3,14 @@ # SPDX-License-Identifier: Apache-2.0 # # This code was automatically generated across versions from 12.9.1 to 13.4.1. Do not modify it directly. -# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=ee9acc9a7052fdb1b1eddc639c1fbe72ac5f3b2a9179cd832240c916edce8d74 +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=3162b8877d941d81077ca9b42527585c22ed7e727b87389f9649b3ebf22d6ec9 # <<<< PREAMBLE CONTENT >>>> +cdef extern from "": + pass + from libc.stdint cimport ( uint32_t, uint64_t, @@ -223,13 +226,14 @@ cdef extern from 'cufile.h': CUfileOpError err CUresult cu_err -cdef struct cuda_bindings_cufile__anon_pod0: - unsigned int major_version - unsigned int minor_version - size_t poll_thresh_size - size_t max_direct_io_size - unsigned int dstatusflags - unsigned int dcontrolflags +cdef extern from 'cufile.h': + ctypedef struct cuda_bindings_cufile__anon_pod0 "std::remove_all_extentsnvfs)>::type": + unsigned int major_version + unsigned int minor_version + size_t poll_thresh_size + size_t max_direct_io_size + unsigned int dstatusflags + unsigned int dcontrolflags cdef extern from 'cufile.h': ctypedef struct cufileRDMAInfo_t 'cufileRDMAInfo_t': @@ -245,15 +249,17 @@ cdef extern from 'cufile.h': ssize_t (*read)(const void*, char*, size_t, loff_t, const cufileRDMAInfo_t*) ssize_t (*write)(const void*, const char*, size_t, loff_t, const cufileRDMAInfo_t*) -cdef union cuda_bindings_cufile__anon_pod1: - int fd - void* handle +cdef extern from 'cufile.h': + ctypedef union cuda_bindings_cufile__anon_pod1 "std::remove_all_extentshandle)>::type": + int fd + void* handle -cdef struct cuda_bindings_cufile__anon_pod3: - void* devPtr_base - off_t file_offset - off_t devPtr_offset - size_t size +cdef extern from 'cufile.h': + ctypedef struct cuda_bindings_cufile__anon_pod3 "std::remove_all_extentsu.batch)>::type": + void* devPtr_base + off_t file_offset + off_t devPtr_offset + size_t size cdef extern from 'cufile.h': ctypedef struct CUfileIOEvents_t 'CUfileIOEvents_t': @@ -320,8 +326,9 @@ cdef extern from 'cufile.h': cuda_bindings_cufile__anon_pod1 handle CUfileFSOps_t* fs_ops -cdef union cuda_bindings_cufile__anon_pod2: - cuda_bindings_cufile__anon_pod3 batch +cdef extern from 'cufile.h': + ctypedef union cuda_bindings_cufile__anon_pod2 "std::remove_all_extentsu)>::type": + cuda_bindings_cufile__anon_pod3 batch cdef extern from 'cufile.h': ctypedef struct CUfileStatsLevel1_t 'CUfileStatsLevel1_t': diff --git a/cuda_bindings/cuda/bindings/cydriver.pxd b/cuda_bindings/cuda/bindings/cydriver.pxd index db2e3f3bdb4..0a4918ab8c5 100644 --- a/cuda_bindings/cuda/bindings/cydriver.pxd +++ b/cuda_bindings/cuda/bindings/cydriver.pxd @@ -3,11 +3,14 @@ # SPDX-License-Identifier: Apache-2.0 # # This code was automatically generated across versions from 12.9.0 to 13.4.1. Do not modify it directly. -# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=26d9c23bcf10595e40a03f65b7b7491e2fa5d7161458b6183c53353665bf6f52 +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=650abadba73a2c94411e41b2ae235092bef45e6db706202bb779d8e8dd118375 # <<<< PREAMBLE CONTENT >>>> +cdef extern from "": + pass + from libc.stdint cimport ( uint32_t, uint64_t, @@ -1985,17 +1988,18 @@ cdef extern from 'cuda.h': ctypedef CUuuid_st CUuuid cdef extern from 'cuda.h': - ctypedef struct CUstreamMemOpFlushRemoteWritesParams_st 'CUstreamMemOpFlushRemoteWritesParams_st': + ctypedef struct CUstreamMemOpFlushRemoteWritesParams_st "std::remove_all_extentsflushRemoteWrites)>::type": CUstreamBatchMemOpType operation unsigned int flags cdef extern from 'cuda.h': - ctypedef struct CUstreamMemOpMemoryBarrierParams_st 'CUstreamMemOpMemoryBarrierParams_st': + ctypedef struct CUstreamMemOpMemoryBarrierParams_st "std::remove_all_extentsmemoryBarrier)>::type": CUstreamBatchMemOpType operation unsigned int flags -cdef struct cuda_bindings_driver__anon_pod3: - unsigned long long bytesOverBudget +cdef extern from 'cuda.h': + ctypedef struct cuda_bindings_driver__anon_pod3 "std::remove_all_extentsinfo.overBudget)>::type": + unsigned long long bytesOverBudget cdef extern from 'cuda.h': ctypedef void (*CUhostFn 'CUhostFn')( @@ -2017,15 +2021,17 @@ cdef extern from 'cuda.h': unsigned char remote ctypedef CUlaunchMemSyncDomainMap_st CUlaunchMemSyncDomainMap -cdef struct cuda_bindings_driver__anon_pod5: - unsigned int x - unsigned int y - unsigned int z +cdef extern from 'cuda.h': + ctypedef struct cuda_bindings_driver__anon_pod5 "std::remove_all_extentsclusterDim)>::type": + unsigned int x + unsigned int y + unsigned int z -cdef struct cuda_bindings_driver__anon_pod8: - unsigned int x - unsigned int y - unsigned int z +cdef extern from 'cuda.h': + ctypedef struct cuda_bindings_driver__anon_pod8 "std::remove_all_extentspreferredClusterDim)>::type": + unsigned int x + unsigned int y + unsigned int z cdef extern from 'cuda.h': cdef struct CUctxCigParam_st: @@ -2041,67 +2047,81 @@ cdef extern from 'cuda.h': size_t dataWindowSize ctypedef CUlibraryHostUniversalFunctionAndDataTable_st CUlibraryHostUniversalFunctionAndDataTable -cdef struct cuda_bindings_driver__anon_pod11: - unsigned int width - unsigned int height - unsigned int depth +cdef extern from 'cuda.h': + ctypedef struct cuda_bindings_driver__anon_pod11 "std::remove_all_extentstileExtent)>::type": + unsigned int width + unsigned int height + unsigned int depth -cdef struct cuda_bindings_driver__anon_pod17: - int reserved[32] +cdef extern from 'cuda.h': + ctypedef struct cuda_bindings_driver__anon_pod17 "std::remove_all_extentsres.reserved)>::type": + int reserved[32] -cdef struct cuda_bindings_driver__anon_pod19: - void* handle - void* name +cdef extern from 'cuda.h': + ctypedef struct cuda_bindings_driver__anon_pod19 "std::remove_all_extentshandle.win32)>::type": + void* handle + void* name -cdef struct cuda_bindings_driver__anon_pod21: - void* handle - void* name +cdef extern from 'cuda.h': + ctypedef struct cuda_bindings_driver__anon_pod21 "std::remove_all_extentshandle.win32)>::type": + void* handle + void* name -cdef struct cuda_bindings_driver__anon_pod23: - unsigned long long value +cdef extern from 'cuda.h': + ctypedef struct cuda_bindings_driver__anon_pod23 "std::remove_all_extentsparams.fence)>::type": + unsigned long long value -cdef union cuda_bindings_driver__anon_pod24: - void* fence - unsigned long long reserved +cdef extern from 'cuda.h': + ctypedef union cuda_bindings_driver__anon_pod24 "std::remove_all_extentsparams.nvSciSync)>::type": + void* fence + unsigned long long reserved -cdef struct cuda_bindings_driver__anon_pod25: - unsigned long long key +cdef extern from 'cuda.h': + ctypedef struct cuda_bindings_driver__anon_pod25 "std::remove_all_extentsparams.keyedMutex)>::type": + unsigned long long key -cdef struct cuda_bindings_driver__anon_pod27: - unsigned long long value +cdef extern from 'cuda.h': + ctypedef struct cuda_bindings_driver__anon_pod27 "std::remove_all_extentsparams.fence)>::type": + unsigned long long value -cdef union cuda_bindings_driver__anon_pod28: - void* fence - unsigned long long reserved +cdef extern from 'cuda.h': + ctypedef union cuda_bindings_driver__anon_pod28 "std::remove_all_extentsparams.nvSciSync)>::type": + void* fence + unsigned long long reserved -cdef struct cuda_bindings_driver__anon_pod29: - unsigned long long key - unsigned int timeoutMs +cdef extern from 'cuda.h': + ctypedef struct cuda_bindings_driver__anon_pod29 "std::remove_all_extentsparams.keyedMutex)>::type": + unsigned long long key + unsigned int timeoutMs -cdef struct cuda_bindings_driver__anon_pod34: - unsigned int level - unsigned int layer - unsigned int offsetX - unsigned int offsetY - unsigned int offsetZ - unsigned int extentWidth - unsigned int extentHeight - unsigned int extentDepth +cdef extern from 'cuda.h': + ctypedef struct cuda_bindings_driver__anon_pod34 "std::remove_all_extentssubresource.sparseLevel)>::type": + unsigned int level + unsigned int layer + unsigned int offsetX + unsigned int offsetY + unsigned int offsetZ + unsigned int extentWidth + unsigned int extentHeight + unsigned int extentDepth -cdef struct cuda_bindings_driver__anon_pod35: - unsigned int layer - unsigned long long offset - unsigned long long size +cdef extern from 'cuda.h': + ctypedef struct cuda_bindings_driver__anon_pod35 "std::remove_all_extentssubresource.miptail)>::type": + unsigned int layer + unsigned long long offset + unsigned long long size -cdef struct cuda_bindings_driver__anon_pod38: - unsigned char deviceId - unsigned char localityDomainId +cdef extern from 'cuda.h': + ctypedef struct cuda_bindings_driver__anon_pod38 "std::remove_all_extentslocalized)>::type": + unsigned char deviceId + unsigned char localityDomainId -cdef struct cuda_bindings_driver__anon_pod39: - unsigned char compressionType - unsigned char gpuDirectRDMACapable - unsigned short usage - unsigned char reserved[4] +cdef extern from 'cuda.h': + ctypedef struct cuda_bindings_driver__anon_pod39 "std::remove_all_extentsallocFlags)>::type": + unsigned char compressionType + unsigned char gpuDirectRDMACapable + unsigned short usage + unsigned char reserved[4] cdef extern from 'cuda.h': cdef struct CUdevSmResource_st: @@ -2138,8 +2158,9 @@ cdef extern from 'cuda.h': unsigned char data[64] ctypedef CUlogicalEndpointFabricHandle_st CUlogicalEndpointFabricHandle -cdef struct cuda_bindings_driver__anon_pod48: - unsigned int numDevices +cdef extern from 'cuda.h': + ctypedef struct cuda_bindings_driver__anon_pod48 "std::remove_all_extentsmulticast)>::type": + unsigned int numDevices cdef extern from 'cuda.h': cdef struct CUcliqueInfo_st: @@ -2332,24 +2353,29 @@ cdef extern from 'cuda.h': CUcontext ctx ctypedef CUDA_KERNEL_NODE_PARAMS_v3_st CUDA_KERNEL_NODE_PARAMS_v3 -cdef struct cuda_bindings_driver__anon_pod13: - CUarray hArray +cdef extern from 'cuda.h': + ctypedef struct cuda_bindings_driver__anon_pod13 "std::remove_all_extentsres.array)>::type": + CUarray hArray -cdef struct cuda_bindings_driver__anon_pod14: - CUmipmappedArray hMipmappedArray +cdef extern from 'cuda.h': + ctypedef struct cuda_bindings_driver__anon_pod14 "std::remove_all_extentsres.mipmap)>::type": + CUmipmappedArray hMipmappedArray -cdef union cuda_bindings_driver__anon_pod32: - CUmipmappedArray mipmap - CUarray array +cdef extern from 'cuda.h': + ctypedef union cuda_bindings_driver__anon_pod32 "std::remove_all_extentsresource)>::type": + CUmipmappedArray mipmap + CUarray array -cdef struct cuda_bindings_driver__anon_pod6: - CUevent event - int flags - int triggerAtBlockStart +cdef extern from 'cuda.h': + ctypedef struct cuda_bindings_driver__anon_pod6 "std::remove_all_extentsprogrammaticEvent)>::type": + CUevent event + int flags + int triggerAtBlockStart -cdef struct cuda_bindings_driver__anon_pod7: - CUevent event - int flags +cdef extern from 'cuda.h': + ctypedef struct cuda_bindings_driver__anon_pod7 "std::remove_all_extentslaunchCompletionEvent)>::type": + CUevent event + int flags cdef extern from 'cuda.h': cdef struct CUDA_EVENT_WAIT_NODE_PARAMS_st: @@ -2399,9 +2425,10 @@ cdef extern from 'cuda.h': CUgraphNode errorFromNode ctypedef CUgraphExecUpdateResultInfo_st CUgraphExecUpdateResultInfo_v1 -cdef struct cuda_bindings_driver__anon_pod9: - int deviceUpdatable - CUgraphDeviceNode devNode +cdef extern from 'cuda.h': + ctypedef struct cuda_bindings_driver__anon_pod9 "std::remove_all_extentsdeviceUpdatableKernelNode)>::type": + int deviceUpdatable + CUgraphDeviceNode devNode cdef extern from 'cuda.h': cdef struct CUcheckpointGpuPair_st: @@ -2409,8 +2436,9 @@ cdef extern from 'cuda.h': CUuuid newUuid ctypedef CUcheckpointGpuPair_st CUcheckpointGpuPair -cdef union cuda_bindings_driver__anon_pod2: - cuda_bindings_driver__anon_pod3 overBudget +cdef extern from 'cuda.h': + ctypedef union cuda_bindings_driver__anon_pod2 "std::remove_all_extentsinfo)>::type": + cuda_bindings_driver__anon_pod3 overBudget cdef extern from 'cuda.h': cdef struct CUDA_HOST_NODE_PARAMS_st: @@ -2427,31 +2455,36 @@ cdef extern from 'cuda.h': unsigned int reserved[4] ctypedef CUDA_ARRAY_SPARSE_PROPERTIES_st CUDA_ARRAY_SPARSE_PROPERTIES_v1 -cdef union cuda_bindings_driver__anon_pod18: - int fd - cuda_bindings_driver__anon_pod19 win32 - void* nvSciBufObject +cdef extern from 'cuda.h': + ctypedef union cuda_bindings_driver__anon_pod18 "std::remove_all_extentshandle)>::type": + int fd + cuda_bindings_driver__anon_pod19 win32 + void* nvSciBufObject -cdef union cuda_bindings_driver__anon_pod20: - int fd - cuda_bindings_driver__anon_pod21 win32 - void* nvSciSyncObj +cdef extern from 'cuda.h': + ctypedef union cuda_bindings_driver__anon_pod20 "std::remove_all_extentshandle)>::type": + int fd + cuda_bindings_driver__anon_pod21 win32 + void* nvSciSyncObj -cdef struct cuda_bindings_driver__anon_pod22: - cuda_bindings_driver__anon_pod23 fence - cuda_bindings_driver__anon_pod24 nvSciSync - cuda_bindings_driver__anon_pod25 keyedMutex - unsigned int reserved[12] +cdef extern from 'cuda.h': + ctypedef struct cuda_bindings_driver__anon_pod22 "std::remove_all_extentsparams)>::type": + cuda_bindings_driver__anon_pod23 fence + cuda_bindings_driver__anon_pod24 nvSciSync + cuda_bindings_driver__anon_pod25 keyedMutex + unsigned int reserved[12] -cdef struct cuda_bindings_driver__anon_pod26: - cuda_bindings_driver__anon_pod27 fence - cuda_bindings_driver__anon_pod28 nvSciSync - cuda_bindings_driver__anon_pod29 keyedMutex - unsigned int reserved[10] +cdef extern from 'cuda.h': + ctypedef struct cuda_bindings_driver__anon_pod26 "std::remove_all_extentsparams)>::type": + cuda_bindings_driver__anon_pod27 fence + cuda_bindings_driver__anon_pod28 nvSciSync + cuda_bindings_driver__anon_pod29 keyedMutex + unsigned int reserved[10] -cdef union cuda_bindings_driver__anon_pod33: - cuda_bindings_driver__anon_pod34 sparseLevel - cuda_bindings_driver__anon_pod35 miptail +cdef extern from 'cuda.h': + ctypedef union cuda_bindings_driver__anon_pod33 "std::remove_all_extentssubresource)>::type": + cuda_bindings_driver__anon_pod34 sparseLevel + cuda_bindings_driver__anon_pod35 miptail cdef extern from 'cuda.h': cdef struct CUstreamCigCaptureParams_st: @@ -2467,7 +2500,7 @@ cdef extern from 'cuda.h': CUcontext ctx cdef extern from 'cuda.h': - ctypedef struct CUstreamMemOpWaitValueParams_st 'CUstreamMemOpWaitValueParams_st': + ctypedef struct CUstreamMemOpWaitValueParams_st "std::remove_all_extentswaitValue)>::type": CUstreamBatchMemOpType operation CUdeviceptr address cuuint32_t value @@ -2476,7 +2509,7 @@ cdef extern from 'cuda.h': CUdeviceptr alias cdef extern from 'cuda.h': - ctypedef struct CUstreamMemOpWriteValueParams_st 'CUstreamMemOpWriteValueParams_st': + ctypedef struct CUstreamMemOpWriteValueParams_st "std::remove_all_extentswriteValue)>::type": CUstreamBatchMemOpType operation CUdeviceptr address cuuint32_t value @@ -2485,7 +2518,7 @@ cdef extern from 'cuda.h': CUdeviceptr alias cdef extern from 'cuda.h': - ctypedef struct CUstreamMemOpAtomicReductionParams_st 'CUstreamMemOpAtomicReductionParams_st': + ctypedef struct CUstreamMemOpAtomicReductionParams_st "std::remove_all_extentsatomicReduction)>::type": CUstreamBatchMemOpType operation unsigned int flags CUstreamAtomicReductionOpType reductionOp @@ -2593,19 +2626,21 @@ cdef extern from 'cuda.h': size_t Depth ctypedef CUDA_MEMCPY3D_PEER_st CUDA_MEMCPY3D_PEER_v1 -cdef struct cuda_bindings_driver__anon_pod15: - CUdeviceptr devPtr - CUarray_format format - unsigned int numChannels - size_t sizeInBytes +cdef extern from 'cuda.h': + ctypedef struct cuda_bindings_driver__anon_pod15 "std::remove_all_extentsres.linear)>::type": + CUdeviceptr devPtr + CUarray_format format + unsigned int numChannels + size_t sizeInBytes -cdef struct cuda_bindings_driver__anon_pod16: - CUdeviceptr devPtr - CUarray_format format - unsigned int numChannels - size_t width - size_t height - size_t pitchInBytes +cdef extern from 'cuda.h': + ctypedef struct cuda_bindings_driver__anon_pod16 "std::remove_all_extentsres.pitch2D)>::type": + CUdeviceptr devPtr + CUarray_format format + unsigned int numChannels + size_t width + size_t height + size_t pitchInBytes cdef extern from 'cuda.h': cdef struct CUDA_MEM_FREE_NODE_PARAMS_st: @@ -2626,8 +2661,9 @@ cdef extern from 'cuda.h': CUdevWorkqueueConfigScope sharingScope ctypedef CUdevWorkqueueConfigResource_st CUdevWorkqueueConfigResource -cdef struct cuda_bindings_driver__anon_pod47: - CUdevice device +cdef extern from 'cuda.h': + ctypedef struct cuda_bindings_driver__anon_pod47 "std::remove_all_extentsunicast)>::type": + CUdevice device cdef extern from 'cuda.h': ctypedef void (*CUcoredumpStatusCallback 'CUcoredumpStatusCallback')( @@ -2637,8 +2673,9 @@ cdef extern from 'cuda.h': ) -cdef union cuda_bindings_driver__anon_pod10: - CUexecAffinitySmCount smCount +cdef extern from 'cuda.h': + ctypedef union cuda_bindings_driver__anon_pod10 "std::remove_all_extentsparam)>::type": + CUexecAffinitySmCount smCount cdef extern from 'cuda.h': cdef struct CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_st: @@ -2648,12 +2685,14 @@ cdef extern from 'cuda.h': unsigned int reserved[16] ctypedef CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_st CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_v1 -cdef union cuda_bindings_driver__anon_pod36: - CUmemGenericAllocationHandle memHandle +cdef extern from 'cuda.h': + ctypedef union cuda_bindings_driver__anon_pod36 "std::remove_all_extentsmemHandle)>::type": + CUmemGenericAllocationHandle memHandle -cdef struct cuda_bindings_driver__anon_pod42: - CUarray array - CUoffset3D offset +cdef extern from 'cuda.h': + ctypedef struct cuda_bindings_driver__anon_pod42 "std::remove_all_extentsop.array)>::type": + CUarray array + CUoffset3D offset cdef extern from 'cuda.h': ctypedef CUDA_KERNEL_NODE_PARAMS_v2 CUDA_KERNEL_NODE_PARAMS 'CUDA_KERNEL_NODE_PARAMS' @@ -2784,12 +2823,13 @@ cdef extern from 'cuda.h': ctypedef CUDA_MEMCPY3D_PEER_v1 CUDA_MEMCPY3D_PEER 'CUDA_MEMCPY3D_PEER' -cdef union cuda_bindings_driver__anon_pod12: - cuda_bindings_driver__anon_pod13 array - cuda_bindings_driver__anon_pod14 mipmap - cuda_bindings_driver__anon_pod15 linear - cuda_bindings_driver__anon_pod16 pitch2D - cuda_bindings_driver__anon_pod17 reserved +cdef extern from 'cuda.h': + ctypedef union cuda_bindings_driver__anon_pod12 "std::remove_all_extentsres)>::type": + cuda_bindings_driver__anon_pod13 array + cuda_bindings_driver__anon_pod14 mipmap + cuda_bindings_driver__anon_pod15 linear + cuda_bindings_driver__anon_pod16 pitch2D + cuda_bindings_driver__anon_pod17 reserved cdef extern from 'cuda.h': cdef struct CUcheckpointCustomStorageInfo_st: @@ -3017,11 +3057,12 @@ cdef extern from 'cuda.h': unsigned int flags ctypedef CUmemcpyAttributes_st CUmemcpyAttributes_v1 -cdef struct cuda_bindings_driver__anon_pod41: - CUdeviceptr ptr - size_t rowLength - size_t layerHeight - CUmemLocation locHint +cdef extern from 'cuda.h': + ctypedef struct cuda_bindings_driver__anon_pod41 "std::remove_all_extentsop.ptr)>::type": + CUdeviceptr ptr + size_t rowLength + size_t layerHeight + CUmemLocation locHint cdef extern from 'cuda.h': cdef struct CUDA_BATCH_MEM_OP_NODE_PARAMS_v1_st: @@ -3078,9 +3119,10 @@ cdef extern from 'cuda.h': ctypedef CUmemcpyAttributes_v1 CUmemcpyAttributes 'CUmemcpyAttributes' -cdef union cuda_bindings_driver__anon_pod40: - cuda_bindings_driver__anon_pod41 ptr - cuda_bindings_driver__anon_pod42 array +cdef extern from 'cuda.h': + ctypedef union cuda_bindings_driver__anon_pod40 "std::remove_all_extentsop)>::type": + cuda_bindings_driver__anon_pod41 ptr + cuda_bindings_driver__anon_pod42 array cdef extern from 'cuda.h': ctypedef CUDA_BATCH_MEM_OP_NODE_PARAMS_v1 CUDA_BATCH_MEM_OP_NODE_PARAMS 'CUDA_BATCH_MEM_OP_NODE_PARAMS' diff --git a/cuda_bindings/cuda/bindings/cyruntime.pxd b/cuda_bindings/cuda/bindings/cyruntime.pxd index 2d705a6be16..e094549ad95 100644 --- a/cuda_bindings/cuda/bindings/cyruntime.pxd +++ b/cuda_bindings/cuda/bindings/cyruntime.pxd @@ -3,8 +3,17 @@ # SPDX-License-Identifier: Apache-2.0 # # This code was automatically generated across versions from 12.9.0 to 13.4.1. Do not modify it directly. +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=f686e003b0aa5d1800d2f631b8927a9a6fe84f33dc46f1764070ad7480f2821c + + +# <<<< PREAMBLE CONTENT >>>> + +cdef extern from "": + pass + + +# <<<< END OF PREAMBLE CONTENT >>>> -# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=c3643e519b69bdb09b9c4c6ff3ecd3aebb180636d00e9a7bd2fe129cbed3eeb4 from libc.stdint cimport uint32_t, uint64_t @@ -1402,10 +1411,11 @@ cdef extern from 'driver_types.h': int w cudaChannelFormatKind f -cdef struct cuda_bindings_runtime__anon_pod0: - unsigned int width - unsigned int height - unsigned int depth +cdef extern from 'driver_types.h': + ctypedef struct cuda_bindings_runtime__anon_pod0 "std::remove_all_extentstileExtent)>::type": + unsigned int width + unsigned int height + unsigned int depth cdef extern from 'driver_types.h': cdef struct cudaArrayMemoryRequirements: @@ -1455,8 +1465,9 @@ cdef extern from 'driver_types.h': ) -cdef struct cuda_bindings_runtime__anon_pod6: - int reserved[32] +cdef extern from 'driver_types.h': + ctypedef struct cuda_bindings_runtime__anon_pod6 "std::remove_all_extentsres.reserved)>::type": + int reserved[32] cdef extern from 'driver_types.h': cdef struct cudaResourceViewDesc: @@ -1492,9 +1503,10 @@ cdef extern from 'driver_types.h': cudaSharedMemoryMode sharedMemoryMode int reserved[14] -cdef struct cuda_bindings_runtime__anon_pod9: - unsigned char deviceId - unsigned char localityDomainId +cdef extern from 'driver_types.h': + ctypedef struct cuda_bindings_runtime__anon_pod9 "std::remove_all_extentslocalized)>::type": + unsigned char deviceId + unsigned char localityDomainId cdef extern from 'driver_types.h': cdef struct cudaMemPoolPtrExportData: @@ -1621,9 +1633,10 @@ cdef extern from 'driver_types.h': char reserved[64] ctypedef cudaMemFabricHandle_st cudaMemFabricHandle_t -cdef struct cuda_bindings_runtime__anon_pod14: - void* handle - void* name +cdef extern from 'driver_types.h': + ctypedef struct cuda_bindings_runtime__anon_pod14 "std::remove_all_extentshandle.win32)>::type": + void* handle + void* name cdef extern from 'driver_types.h': cdef struct cudaExternalMemoryBufferDesc: @@ -1632,30 +1645,37 @@ cdef extern from 'driver_types.h': unsigned int flags unsigned int reserved[16] -cdef struct cuda_bindings_runtime__anon_pod16: - void* handle - void* name +cdef extern from 'driver_types.h': + ctypedef struct cuda_bindings_runtime__anon_pod16 "std::remove_all_extentshandle.win32)>::type": + void* handle + void* name -cdef struct cuda_bindings_runtime__anon_pod18: - unsigned long long value +cdef extern from 'driver_types.h': + ctypedef struct cuda_bindings_runtime__anon_pod18 "std::remove_all_extentsparams.fence)>::type": + unsigned long long value -cdef union cuda_bindings_runtime__anon_pod19: - void* fence - unsigned long long reserved +cdef extern from 'driver_types.h': + ctypedef union cuda_bindings_runtime__anon_pod19 "std::remove_all_extentsparams.nvSciSync)>::type": + void* fence + unsigned long long reserved -cdef struct cuda_bindings_runtime__anon_pod20: - unsigned long long key +cdef extern from 'driver_types.h': + ctypedef struct cuda_bindings_runtime__anon_pod20 "std::remove_all_extentsparams.keyedMutex)>::type": + unsigned long long key -cdef struct cuda_bindings_runtime__anon_pod22: - unsigned long long value +cdef extern from 'driver_types.h': + ctypedef struct cuda_bindings_runtime__anon_pod22 "std::remove_all_extentsparams.fence)>::type": + unsigned long long value -cdef union cuda_bindings_runtime__anon_pod23: - void* fence - unsigned long long reserved +cdef extern from 'driver_types.h': + ctypedef union cuda_bindings_runtime__anon_pod23 "std::remove_all_extentsparams.nvSciSync)>::type": + void* fence + unsigned long long reserved -cdef struct cuda_bindings_runtime__anon_pod24: - unsigned long long key - unsigned int timeoutMs +cdef extern from 'driver_types.h': + ctypedef struct cuda_bindings_runtime__anon_pod24 "std::remove_all_extentsparams.keyedMutex)>::type": + unsigned long long key + unsigned int timeoutMs cdef extern from 'driver_types.h': cdef struct cudaKernelNodeParams: @@ -1674,10 +1694,11 @@ cdef extern from 'driver_types.h': unsigned char reserved[5] ctypedef cudaGraphEdgeData_st cudaGraphEdgeData -cdef struct cuda_bindings_runtime__anon_pod28: - void* pValue - size_t offset - size_t size +cdef extern from 'driver_types.h': + ctypedef struct cuda_bindings_runtime__anon_pod28 "std::remove_all_extentsupdateData.param)>::type": + void* pValue + size_t offset + size_t size cdef extern from 'driver_types.h': cdef struct cudaLaunchMemSyncDomainMap_st: @@ -1685,18 +1706,21 @@ cdef extern from 'driver_types.h': unsigned char remote ctypedef cudaLaunchMemSyncDomainMap_st cudaLaunchMemSyncDomainMap -cdef struct cuda_bindings_runtime__anon_pod29: - unsigned int x - unsigned int y - unsigned int z +cdef extern from 'driver_types.h': + ctypedef struct cuda_bindings_runtime__anon_pod29 "std::remove_all_extentsclusterDim)>::type": + unsigned int x + unsigned int y + unsigned int z -cdef struct cuda_bindings_runtime__anon_pod31: - unsigned int x - unsigned int y - unsigned int z +cdef extern from 'driver_types.h': + ctypedef struct cuda_bindings_runtime__anon_pod31 "std::remove_all_extentspreferredClusterDim)>::type": + unsigned int x + unsigned int y + unsigned int z -cdef struct cuda_bindings_runtime__anon_pod35: - unsigned long long bytesOverBudget +cdef extern from 'driver_types.h': + ctypedef struct cuda_bindings_runtime__anon_pod35 "std::remove_all_extentsinfo.overBudget)>::type": + unsigned long long bytesOverBudget cdef extern from '': cdef struct cudaTextureDesc: @@ -1751,11 +1775,13 @@ cdef extern from 'cuda_runtime_api.h': ) -cdef struct cuda_bindings_runtime__anon_pod2: - cudaArray_t array +cdef extern from 'driver_types.h': + ctypedef struct cuda_bindings_runtime__anon_pod2 "std::remove_all_extentsres.array)>::type": + cudaArray_t array -cdef struct cuda_bindings_runtime__anon_pod3: - cudaMipmappedArray_t mipmap +cdef extern from 'driver_types.h': + ctypedef struct cuda_bindings_runtime__anon_pod3 "std::remove_all_extentsres.mipmap)>::type": + cudaMipmappedArray_t mipmap cdef extern from 'cuda_runtime_api.h': ctypedef void (*cudaStreamCallback_t 'cudaStreamCallback_t')( @@ -1769,14 +1795,16 @@ cdef extern from 'driver_types.h': cdef struct cudaEventWaitNodeParams: cudaEvent_t event -cdef struct cuda_bindings_runtime__anon_pod30: - cudaEvent_t event - int flags - int triggerAtBlockStart +cdef extern from 'driver_types.h': + ctypedef struct cuda_bindings_runtime__anon_pod30 "std::remove_all_extentsprogrammaticEvent)>::type": + cudaEvent_t event + int flags + int triggerAtBlockStart -cdef struct cuda_bindings_runtime__anon_pod32: - cudaEvent_t event - int flags +cdef extern from 'driver_types.h': + ctypedef struct cuda_bindings_runtime__anon_pod32 "std::remove_all_extentslaunchCompletionEvent)>::type": + cudaEvent_t event + int flags cdef extern from 'driver_types.h': cdef struct cudaChildGraphNodeParams: @@ -1798,9 +1826,10 @@ cdef extern from 'driver_types.h': cudaGraphNode_t errorFromNode ctypedef cudaGraphExecUpdateResultInfo_st cudaGraphExecUpdateResultInfo -cdef struct cuda_bindings_runtime__anon_pod33: - int deviceUpdatable - cudaGraphDeviceNode_t devNode +cdef extern from 'driver_types.h': + ctypedef struct cuda_bindings_runtime__anon_pod33 "std::remove_all_extentsdeviceUpdatableKernelNode)>::type": + int deviceUpdatable + cudaGraphDeviceNode_t devNode cdef extern from 'driver_types.h': cdef struct cudaMemsetParamsV2: @@ -1825,17 +1854,19 @@ cdef extern from 'driver_types.h': cudaEvent_t event cudaExecutionContext_t ctx -cdef struct cuda_bindings_runtime__anon_pod4: - void* devPtr - cudaChannelFormatDesc desc - size_t sizeInBytes +cdef extern from 'driver_types.h': + ctypedef struct cuda_bindings_runtime__anon_pod4 "std::remove_all_extentsres.linear)>::type": + void* devPtr + cudaChannelFormatDesc desc + size_t sizeInBytes -cdef struct cuda_bindings_runtime__anon_pod5: - void* devPtr - cudaChannelFormatDesc desc - size_t width - size_t height - size_t pitchInBytes +cdef extern from 'driver_types.h': + ctypedef struct cuda_bindings_runtime__anon_pod5 "std::remove_all_extentsres.pitch2D)>::type": + void* devPtr + cudaChannelFormatDesc desc + size_t width + size_t height + size_t pitchInBytes cdef struct cudaEglPlaneDesc_st: unsigned int width @@ -1913,39 +1944,46 @@ cdef extern from 'driver_types.h': long unused long reserved[7] -cdef struct cuda_bindings_runtime__anon_pod12: - cudaArray_t array - cudaOffset3D offset +cdef extern from 'driver_types.h': + ctypedef struct cuda_bindings_runtime__anon_pod12 "std::remove_all_extentsop.array)>::type": + cudaArray_t array + cudaOffset3D offset -cdef union cuda_bindings_runtime__anon_pod13: - int fd - cuda_bindings_runtime__anon_pod14 win32 - void* nvSciBufObject +cdef extern from 'driver_types.h': + ctypedef union cuda_bindings_runtime__anon_pod13 "std::remove_all_extentshandle)>::type": + int fd + cuda_bindings_runtime__anon_pod14 win32 + void* nvSciBufObject -cdef union cuda_bindings_runtime__anon_pod15: - int fd - cuda_bindings_runtime__anon_pod16 win32 - void* nvSciSyncObj +cdef extern from 'driver_types.h': + ctypedef union cuda_bindings_runtime__anon_pod15 "std::remove_all_extentshandle)>::type": + int fd + cuda_bindings_runtime__anon_pod16 win32 + void* nvSciSyncObj -cdef struct cuda_bindings_runtime__anon_pod17: - cuda_bindings_runtime__anon_pod18 fence - cuda_bindings_runtime__anon_pod19 nvSciSync - cuda_bindings_runtime__anon_pod20 keyedMutex - unsigned int reserved[12] +cdef extern from 'driver_types.h': + ctypedef struct cuda_bindings_runtime__anon_pod17 "std::remove_all_extentsparams)>::type": + cuda_bindings_runtime__anon_pod18 fence + cuda_bindings_runtime__anon_pod19 nvSciSync + cuda_bindings_runtime__anon_pod20 keyedMutex + unsigned int reserved[12] -cdef struct cuda_bindings_runtime__anon_pod21: - cuda_bindings_runtime__anon_pod22 fence - cuda_bindings_runtime__anon_pod23 nvSciSync - cuda_bindings_runtime__anon_pod24 keyedMutex - unsigned int reserved[10] +cdef extern from 'driver_types.h': + ctypedef struct cuda_bindings_runtime__anon_pod21 "std::remove_all_extentsparams)>::type": + cuda_bindings_runtime__anon_pod22 fence + cuda_bindings_runtime__anon_pod23 nvSciSync + cuda_bindings_runtime__anon_pod24 keyedMutex + unsigned int reserved[10] -cdef union cuda_bindings_runtime__anon_pod27: - dim3 gridDim - cuda_bindings_runtime__anon_pod28 param - unsigned int isEnabled +cdef extern from 'driver_types.h': + ctypedef union cuda_bindings_runtime__anon_pod27 "std::remove_all_extentsupdateData)>::type": + dim3 gridDim + cuda_bindings_runtime__anon_pod28 param + unsigned int isEnabled -cdef union cuda_bindings_runtime__anon_pod34: - cuda_bindings_runtime__anon_pod35 overBudget +cdef extern from 'driver_types.h': + ctypedef union cuda_bindings_runtime__anon_pod34 "std::remove_all_extentsinfo)>::type": + cuda_bindings_runtime__anon_pod35 overBudget cdef extern from 'driver_types.h': cdef struct cudaKernelNodeParamsV2: @@ -1981,12 +2019,13 @@ cdef extern from 'driver_types.h': cudaLaunchAttributePortableClusterMode portableClusterSizeMode cudaSharedMemoryMode sharedMemoryMode -cdef union cuda_bindings_runtime__anon_pod1: - cuda_bindings_runtime__anon_pod2 array - cuda_bindings_runtime__anon_pod3 mipmap - cuda_bindings_runtime__anon_pod4 linear - cuda_bindings_runtime__anon_pod5 pitch2D - cuda_bindings_runtime__anon_pod6 reserved +cdef extern from 'driver_types.h': + ctypedef union cuda_bindings_runtime__anon_pod1 "std::remove_all_extentsres)>::type": + cuda_bindings_runtime__anon_pod2 array + cuda_bindings_runtime__anon_pod3 mipmap + cuda_bindings_runtime__anon_pod4 linear + cuda_bindings_runtime__anon_pod5 pitch2D + cuda_bindings_runtime__anon_pod6 reserved cdef struct cudaEglFrame_st: cuda_bindings_runtime__anon_pod36 frame @@ -2087,11 +2126,12 @@ cdef extern from 'driver_types.h': cudaMemLocation dstLocHint unsigned int flags -cdef struct cuda_bindings_runtime__anon_pod11: - void* ptr - size_t rowLength - size_t layerHeight - cudaMemLocation locHint +cdef extern from 'driver_types.h': + ctypedef struct cuda_bindings_runtime__anon_pod11 "std::remove_all_extentsop.ptr)>::type": + void* ptr + size_t rowLength + size_t layerHeight + cudaMemLocation locHint cdef extern from 'driver_types.h': cdef struct cudaExternalSemaphoreSignalNodeParams: @@ -2135,9 +2175,10 @@ cdef extern from 'driver_types.h': size_t bytesize void* dptr -cdef union cuda_bindings_runtime__anon_pod10: - cuda_bindings_runtime__anon_pod11 ptr - cuda_bindings_runtime__anon_pod12 array +cdef extern from 'driver_types.h': + ctypedef union cuda_bindings_runtime__anon_pod10 "std::remove_all_extentsop)>::type": + cuda_bindings_runtime__anon_pod11 ptr + cuda_bindings_runtime__anon_pod12 array cdef extern from 'driver_types.h': cdef struct cudaMemcpy3DOperand: diff --git a/cuda_bindings/cuda/bindings/driver.pxd b/cuda_bindings/cuda/bindings/driver.pxd index 454c4cd7e59..6f328056ca1 100644 --- a/cuda_bindings/cuda/bindings/driver.pxd +++ b/cuda_bindings/cuda/bindings/driver.pxd @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 # This code was automatically generated with version 13.4.1. Do not modify it directly. -# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=4f3e3117475b43ef1ebbe0cd972d2aa6ef4dc5d449a43f1d9ad1d01625604c32 +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=335719e84ce1d6e1fcd12d7a0d627d5c7f8be1a80379cae902ebe72fa3b1a03f cimport cuda.bindings.cydriver as cydriver include "_lib/utils.pxd" @@ -530,6 +530,7 @@ cdef class CUuuid_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUuuid_st _pvt_val cdef cydriver.CUuuid_st* _pvt_ptr @@ -552,6 +553,7 @@ cdef class CUmemFabricHandle_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUmemFabricHandle_st _pvt_val cdef cydriver.CUmemFabricHandle_st* _pvt_ptr @@ -564,6 +566,7 @@ cdef class CUipcEventHandle_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUipcEventHandle_st _pvt_val cdef cydriver.CUipcEventHandle_st* _pvt_ptr @@ -576,6 +579,7 @@ cdef class CUipcMemHandle_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUipcMemHandle_st _pvt_val cdef cydriver.CUipcMemHandle_st* _pvt_ptr @@ -613,6 +617,7 @@ cdef class CUstreamMemOpWaitValueParams_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUstreamBatchMemOpParams_union* _pvt_ptr cdef CUdeviceptr _address @@ -661,6 +666,7 @@ cdef class CUstreamMemOpWriteValueParams_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUstreamBatchMemOpParams_union* _pvt_ptr cdef CUdeviceptr _address @@ -693,6 +699,7 @@ cdef class CUstreamMemOpFlushRemoteWritesParams_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUstreamBatchMemOpParams_union* _pvt_ptr cdef class CUstreamMemOpMemoryBarrierParams_st: @@ -713,6 +720,7 @@ cdef class CUstreamMemOpMemoryBarrierParams_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUstreamBatchMemOpParams_union* _pvt_ptr cdef class CUstreamMemOpAtomicReductionParams_st: @@ -753,6 +761,7 @@ cdef class CUstreamMemOpAtomicReductionParams_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUstreamBatchMemOpParams_union* _pvt_ptr cdef CUdeviceptr _address @@ -807,6 +816,7 @@ cdef class CUstreamBatchMemOpParams_union: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUstreamBatchMemOpParams_union _pvt_val cdef cydriver.CUstreamBatchMemOpParams_union* _pvt_ptr @@ -854,6 +864,7 @@ cdef class CUDA_BATCH_MEM_OP_NODE_PARAMS_v1_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_BATCH_MEM_OP_NODE_PARAMS_v1_st _pvt_val cdef cydriver.CUDA_BATCH_MEM_OP_NODE_PARAMS_v1_st* _pvt_ptr @@ -892,6 +903,7 @@ cdef class CUDA_BATCH_MEM_OP_NODE_PARAMS_v2_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_BATCH_MEM_OP_NODE_PARAMS_v2_st _pvt_val cdef cydriver.CUDA_BATCH_MEM_OP_NODE_PARAMS_v2_st* _pvt_ptr @@ -916,6 +928,7 @@ cdef class anon_struct0: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUasyncNotificationInfo_st* _pvt_ptr cdef class anon_union2: @@ -932,6 +945,7 @@ cdef class anon_union2: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUasyncNotificationInfo_st* _pvt_ptr cdef anon_struct0 _overBudget @@ -958,6 +972,7 @@ cdef class CUasyncNotificationInfo_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUasyncNotificationInfo_st* _val_ptr cdef cydriver.CUasyncNotificationInfo_st* _pvt_ptr @@ -1016,6 +1031,7 @@ cdef class CUdevprop_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUdevprop_st _pvt_val cdef cydriver.CUdevprop_st* _pvt_ptr @@ -1063,6 +1079,7 @@ cdef class CUaccessPolicyWindow_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUaccessPolicyWindow_st _pvt_val cdef cydriver.CUaccessPolicyWindow_st* _pvt_ptr @@ -1121,6 +1138,7 @@ cdef class CUDA_KERNEL_NODE_PARAMS_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_KERNEL_NODE_PARAMS_st _pvt_val cdef cydriver.CUDA_KERNEL_NODE_PARAMS_st* _pvt_ptr @@ -1192,6 +1210,7 @@ cdef class CUDA_KERNEL_NODE_PARAMS_v2_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_KERNEL_NODE_PARAMS_v2_st _pvt_val cdef cydriver.CUDA_KERNEL_NODE_PARAMS_v2_st* _pvt_ptr @@ -1269,6 +1288,7 @@ cdef class CUDA_KERNEL_NODE_PARAMS_v3_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_KERNEL_NODE_PARAMS_v3_st _pvt_val cdef cydriver.CUDA_KERNEL_NODE_PARAMS_v3_st* _pvt_ptr @@ -1320,6 +1340,7 @@ cdef class CUDA_MEMSET_NODE_PARAMS_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_MEMSET_NODE_PARAMS_st _pvt_val cdef cydriver.CUDA_MEMSET_NODE_PARAMS_st* _pvt_ptr @@ -1366,6 +1387,7 @@ cdef class CUDA_MEMSET_NODE_PARAMS_v2_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_MEMSET_NODE_PARAMS_v2_st _pvt_val cdef cydriver.CUDA_MEMSET_NODE_PARAMS_v2_st* _pvt_ptr @@ -1395,6 +1417,7 @@ cdef class CUDA_HOST_NODE_PARAMS_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_HOST_NODE_PARAMS_st _pvt_val cdef cydriver.CUDA_HOST_NODE_PARAMS_st* _pvt_ptr @@ -1436,6 +1459,7 @@ cdef class CUDA_HOST_NODE_PARAMS_v2_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_HOST_NODE_PARAMS_v2_st* _val_ptr cdef cydriver.CUDA_HOST_NODE_PARAMS_v2_st* _pvt_ptr @@ -1502,6 +1526,7 @@ cdef class CUDA_CONDITIONAL_NODE_PARAMS: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_CONDITIONAL_NODE_PARAMS _pvt_val cdef cydriver.CUDA_CONDITIONAL_NODE_PARAMS* _pvt_ptr @@ -1557,6 +1582,7 @@ cdef class CUgraphEdgeData_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUgraphEdgeData_st _pvt_val cdef cydriver.CUgraphEdgeData_st* _pvt_ptr @@ -1588,6 +1614,7 @@ cdef class CUDA_GRAPH_INSTANTIATE_PARAMS_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_GRAPH_INSTANTIATE_PARAMS_st _pvt_val cdef cydriver.CUDA_GRAPH_INSTANTIATE_PARAMS_st* _pvt_ptr @@ -1626,6 +1653,7 @@ cdef class CUlaunchMemSyncDomainMap_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUlaunchMemSyncDomainMap_st _pvt_val cdef cydriver.CUlaunchMemSyncDomainMap_st* _pvt_ptr @@ -1651,6 +1679,7 @@ cdef class anon_struct1: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUlaunchAttributeValue_union* _pvt_ptr cdef class anon_struct2: @@ -1675,6 +1704,7 @@ cdef class anon_struct2: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUlaunchAttributeValue_union* _pvt_ptr cdef CUevent _event @@ -1698,6 +1728,7 @@ cdef class anon_struct3: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUlaunchAttributeValue_union* _pvt_ptr cdef CUevent _event @@ -1725,6 +1756,7 @@ cdef class anon_struct4: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUlaunchAttributeValue_union* _pvt_ptr cdef class anon_struct5: @@ -1745,6 +1777,7 @@ cdef class anon_struct5: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUlaunchAttributeValue_union* _pvt_ptr cdef CUgraphDeviceNode _devNode @@ -1877,6 +1910,7 @@ cdef class CUlaunchAttributeValue_union: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUlaunchAttributeValue_union _pvt_val cdef cydriver.CUlaunchAttributeValue_union* _pvt_ptr @@ -1921,6 +1955,7 @@ cdef class CUlaunchAttribute_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUlaunchAttribute_st _pvt_val cdef cydriver.CUlaunchAttribute_st* _pvt_ptr @@ -1979,6 +2014,7 @@ cdef class CUlaunchConfig_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUlaunchConfig_st _pvt_val cdef cydriver.CUlaunchConfig_st* _pvt_ptr @@ -2005,6 +2041,7 @@ cdef class CUexecAffinitySmCount_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUexecAffinitySmCount_st _pvt_val cdef cydriver.CUexecAffinitySmCount_st* _pvt_ptr @@ -2022,6 +2059,7 @@ cdef class anon_union4: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUexecAffinityParam_st* _pvt_ptr cdef CUexecAffinitySmCount _smCount @@ -2047,6 +2085,7 @@ cdef class CUexecAffinityParam_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUexecAffinityParam_st* _val_ptr cdef cydriver.CUexecAffinityParam_st* _pvt_ptr @@ -2074,6 +2113,7 @@ cdef class CUctxCigParam_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUctxCigParam_st _pvt_val cdef cydriver.CUctxCigParam_st* _pvt_ptr @@ -2111,6 +2151,7 @@ cdef class CUctxCreateParams_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUctxCreateParams_st _pvt_val cdef cydriver.CUctxCreateParams_st* _pvt_ptr @@ -2143,6 +2184,7 @@ cdef class CUstreamCigParam_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUstreamCigParam_st _pvt_val cdef cydriver.CUstreamCigParam_st* _pvt_ptr @@ -2167,6 +2209,7 @@ cdef class CUstreamCigCaptureParams_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUstreamCigCaptureParams_st _pvt_val cdef cydriver.CUstreamCigCaptureParams_st* _pvt_ptr @@ -2200,6 +2243,7 @@ cdef class CUlibraryHostUniversalFunctionAndDataTable_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUlibraryHostUniversalFunctionAndDataTable_st _pvt_val cdef cydriver.CUlibraryHostUniversalFunctionAndDataTable_st* _pvt_ptr @@ -2285,6 +2329,7 @@ cdef class CUDA_MEMCPY2D_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_MEMCPY2D_st _pvt_val cdef cydriver.CUDA_MEMCPY2D_st* _pvt_ptr @@ -2411,6 +2456,7 @@ cdef class CUDA_MEMCPY3D_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_MEMCPY3D_st _pvt_val cdef cydriver.CUDA_MEMCPY3D_st* _pvt_ptr @@ -2546,6 +2592,7 @@ cdef class CUDA_MEMCPY3D_PEER_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_MEMCPY3D_PEER_st _pvt_val cdef cydriver.CUDA_MEMCPY3D_PEER_st* _pvt_ptr @@ -2597,6 +2644,7 @@ cdef class CUDA_MEMCPY_NODE_PARAMS_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_MEMCPY_NODE_PARAMS_st _pvt_val cdef cydriver.CUDA_MEMCPY_NODE_PARAMS_st* _pvt_ptr @@ -2634,6 +2682,7 @@ cdef class CUDA_ARRAY_DESCRIPTOR_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_ARRAY_DESCRIPTOR_st _pvt_val cdef cydriver.CUDA_ARRAY_DESCRIPTOR_st* _pvt_ptr @@ -2673,6 +2722,7 @@ cdef class CUDA_ARRAY3D_DESCRIPTOR_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_ARRAY3D_DESCRIPTOR_st _pvt_val cdef cydriver.CUDA_ARRAY3D_DESCRIPTOR_st* _pvt_ptr @@ -2698,6 +2748,7 @@ cdef class anon_struct6: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_ARRAY_SPARSE_PROPERTIES_st* _pvt_ptr cdef class CUDA_ARRAY_SPARSE_PROPERTIES_st: @@ -2729,6 +2780,7 @@ cdef class CUDA_ARRAY_SPARSE_PROPERTIES_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_ARRAY_SPARSE_PROPERTIES_st _pvt_val cdef cydriver.CUDA_ARRAY_SPARSE_PROPERTIES_st* _pvt_ptr @@ -2755,6 +2807,7 @@ cdef class CUDA_ARRAY_MEMORY_REQUIREMENTS_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_ARRAY_MEMORY_REQUIREMENTS_st _pvt_val cdef cydriver.CUDA_ARRAY_MEMORY_REQUIREMENTS_st* _pvt_ptr @@ -2772,6 +2825,7 @@ cdef class anon_struct7: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_RESOURCE_DESC_st* _pvt_ptr cdef CUarray _hArray @@ -2791,6 +2845,7 @@ cdef class anon_struct8: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_RESOURCE_DESC_st* _pvt_ptr cdef CUmipmappedArray _hMipmappedArray @@ -2822,6 +2877,7 @@ cdef class anon_struct9: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_RESOURCE_DESC_st* _pvt_ptr cdef CUdeviceptr _devPtr @@ -2861,6 +2917,7 @@ cdef class anon_struct10: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_RESOURCE_DESC_st* _pvt_ptr cdef CUdeviceptr _devPtr @@ -2873,6 +2930,7 @@ cdef class anon_struct11: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_RESOURCE_DESC_st* _pvt_ptr cdef class anon_union5: @@ -2901,6 +2959,7 @@ cdef class anon_union5: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_RESOURCE_DESC_st* _pvt_ptr cdef anon_struct7 _array @@ -2939,6 +2998,7 @@ cdef class CUDA_RESOURCE_DESC_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_RESOURCE_DESC_st* _val_ptr cdef cydriver.CUDA_RESOURCE_DESC_st* _pvt_ptr @@ -2993,6 +3053,7 @@ cdef class CUDA_TEXTURE_DESC_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_TEXTURE_DESC_st _pvt_val cdef cydriver.CUDA_TEXTURE_DESC_st* _pvt_ptr @@ -3040,6 +3101,7 @@ cdef class CUDA_RESOURCE_VIEW_DESC_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_RESOURCE_VIEW_DESC_st _pvt_val cdef cydriver.CUDA_RESOURCE_VIEW_DESC_st* _pvt_ptr @@ -3060,6 +3122,7 @@ cdef class CUtensorMap_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUtensorMap_st _pvt_val cdef cydriver.CUtensorMap_st* _pvt_ptr @@ -3083,6 +3146,7 @@ cdef class CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_st _pvt_val cdef cydriver.CUDA_POINTER_ATTRIBUTE_P2P_TOKENS_st* _pvt_ptr @@ -3138,6 +3202,7 @@ cdef class CUDA_LAUNCH_PARAMS_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_LAUNCH_PARAMS_st _pvt_val cdef cydriver.CUDA_LAUNCH_PARAMS_st* _pvt_ptr @@ -3168,6 +3233,7 @@ cdef class anon_struct12: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st* _pvt_ptr cdef _HelperInputVoidPtr _cyhandle @@ -3198,6 +3264,7 @@ cdef class anon_union6: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st* _pvt_ptr cdef anon_struct12 _win32 @@ -3234,6 +3301,7 @@ cdef class CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st* _val_ptr cdef cydriver.CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st* _pvt_ptr @@ -3264,6 +3332,7 @@ cdef class CUDA_EXTERNAL_MEMORY_BUFFER_DESC_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_EXTERNAL_MEMORY_BUFFER_DESC_st _pvt_val cdef cydriver.CUDA_EXTERNAL_MEMORY_BUFFER_DESC_st* _pvt_ptr @@ -3292,6 +3361,7 @@ cdef class CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_st _pvt_val cdef cydriver.CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_st* _pvt_ptr @@ -3316,6 +3386,7 @@ cdef class anon_struct13: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st* _pvt_ptr cdef _HelperInputVoidPtr _cyhandle @@ -3346,6 +3417,7 @@ cdef class anon_union7: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st* _pvt_ptr cdef anon_struct13 _win32 @@ -3378,6 +3450,7 @@ cdef class CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st* _val_ptr cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st* _pvt_ptr @@ -3398,6 +3471,7 @@ cdef class anon_struct14: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st* _pvt_ptr cdef class anon_union8: @@ -3414,6 +3488,7 @@ cdef class anon_union8: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st* _pvt_ptr cdef _HelperInputVoidPtr _cyfence @@ -3433,6 +3508,7 @@ cdef class anon_struct15: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st* _pvt_ptr cdef class anon_struct16: @@ -3457,6 +3533,7 @@ cdef class anon_struct16: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st* _pvt_ptr cdef anon_struct14 _fence @@ -3495,6 +3572,7 @@ cdef class CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st _pvt_val cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st* _pvt_ptr @@ -3515,6 +3593,7 @@ cdef class anon_struct17: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st* _pvt_ptr cdef class anon_union9: @@ -3531,6 +3610,7 @@ cdef class anon_union9: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st* _pvt_ptr cdef _HelperInputVoidPtr _cyfence @@ -3554,6 +3634,7 @@ cdef class anon_struct18: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st* _pvt_ptr cdef class anon_struct19: @@ -3578,6 +3659,7 @@ cdef class anon_struct19: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st* _pvt_ptr cdef anon_struct17 _fence @@ -3616,6 +3698,7 @@ cdef class CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st _pvt_val cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st* _pvt_ptr @@ -3647,6 +3730,7 @@ cdef class CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_st _pvt_val cdef cydriver.CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_st* _pvt_ptr @@ -3691,6 +3775,7 @@ cdef class CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2_st* _val_ptr cdef cydriver.CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2_st* _pvt_ptr @@ -3733,6 +3818,7 @@ cdef class CUDA_EXT_SEM_WAIT_NODE_PARAMS_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_EXT_SEM_WAIT_NODE_PARAMS_st _pvt_val cdef cydriver.CUDA_EXT_SEM_WAIT_NODE_PARAMS_st* _pvt_ptr @@ -3777,6 +3863,7 @@ cdef class CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2_st* _val_ptr cdef cydriver.CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2_st* _pvt_ptr @@ -3812,6 +3899,7 @@ cdef class anon_union12: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUarrayMapInfo_st* _pvt_ptr cdef CUmipmappedArray _mipmap @@ -3862,6 +3950,7 @@ cdef class anon_struct20: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUarrayMapInfo_st* _pvt_ptr cdef class anon_struct21: @@ -3886,6 +3975,7 @@ cdef class anon_struct21: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUarrayMapInfo_st* _pvt_ptr cdef class anon_union13: @@ -3906,6 +3996,7 @@ cdef class anon_union13: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUarrayMapInfo_st* _pvt_ptr cdef anon_struct20 _sparseLevel @@ -3928,6 +4019,7 @@ cdef class anon_union14: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUarrayMapInfo_st* _pvt_ptr cdef CUmemGenericAllocationHandle _memHandle @@ -3986,6 +4078,7 @@ cdef class CUarrayMapInfo_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUarrayMapInfo_st* _val_ptr cdef cydriver.CUarrayMapInfo_st* _pvt_ptr @@ -4016,6 +4109,7 @@ cdef class anon_struct22: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUmemLocation_st* _pvt_ptr cdef class CUmemLocation_st: @@ -4045,6 +4139,7 @@ cdef class CUmemLocation_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUmemLocation_st* _val_ptr cdef cydriver.CUmemLocation_st* _pvt_ptr @@ -4073,6 +4168,7 @@ cdef class anon_struct23: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUmemAllocationProp_st* _pvt_ptr cdef class CUmemAllocationProp_st: @@ -4111,6 +4207,7 @@ cdef class CUmemAllocationProp_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUmemAllocationProp_st _pvt_val cdef cydriver.CUmemAllocationProp_st* _pvt_ptr @@ -4154,6 +4251,7 @@ cdef class CUmulticastObjectProp_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUmulticastObjectProp_st _pvt_val cdef cydriver.CUmulticastObjectProp_st* _pvt_ptr @@ -4177,6 +4275,7 @@ cdef class CUmemAccessDesc_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUmemAccessDesc_st _pvt_val cdef cydriver.CUmemAccessDesc_st* _pvt_ptr @@ -4210,6 +4309,7 @@ cdef class CUgraphExecUpdateResultInfo_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUgraphExecUpdateResultInfo_st _pvt_val cdef cydriver.CUgraphExecUpdateResultInfo_st* _pvt_ptr @@ -4279,6 +4379,7 @@ cdef class CUmemPoolProps_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUmemPoolProps_st _pvt_val cdef cydriver.CUmemPoolProps_st* _pvt_ptr @@ -4297,6 +4398,7 @@ cdef class CUmemPoolPtrExportData_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUmemPoolPtrExportData_st _pvt_val cdef cydriver.CUmemPoolPtrExportData_st* _pvt_ptr @@ -4332,6 +4434,7 @@ cdef class CUmemcpyAttributes_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUmemcpyAttributes_st _pvt_val cdef cydriver.CUmemcpyAttributes_st* _pvt_ptr @@ -4365,6 +4468,7 @@ cdef class CUoffset3D_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUoffset3D_st _pvt_val cdef cydriver.CUoffset3D_st* _pvt_ptr @@ -4392,6 +4496,7 @@ cdef class CUextent3D_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUextent3D_st _pvt_val cdef cydriver.CUextent3D_st* _pvt_ptr @@ -4421,6 +4526,7 @@ cdef class anon_struct24: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUmemcpy3DOperand_st* _pvt_ptr cdef CUdeviceptr _ptr @@ -4447,6 +4553,7 @@ cdef class anon_struct25: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUmemcpy3DOperand_st* _pvt_ptr cdef CUarray _array @@ -4473,6 +4580,7 @@ cdef class anon_union16: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUmemcpy3DOperand_st* _pvt_ptr cdef anon_struct24 _ptr @@ -4501,6 +4609,7 @@ cdef class CUmemcpy3DOperand_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUmemcpy3DOperand_st* _val_ptr cdef cydriver.CUmemcpy3DOperand_st* _pvt_ptr @@ -4538,6 +4647,7 @@ cdef class CUDA_MEMCPY3D_BATCH_OP_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_MEMCPY3D_BATCH_OP_st _pvt_val cdef cydriver.CUDA_MEMCPY3D_BATCH_OP_st* _pvt_ptr @@ -4586,6 +4696,7 @@ cdef class CUDA_MEM_ALLOC_NODE_PARAMS_v1_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_MEM_ALLOC_NODE_PARAMS_v1_st _pvt_val cdef cydriver.CUDA_MEM_ALLOC_NODE_PARAMS_v1_st* _pvt_ptr @@ -4635,6 +4746,7 @@ cdef class CUDA_MEM_ALLOC_NODE_PARAMS_v2_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_MEM_ALLOC_NODE_PARAMS_v2_st _pvt_val cdef cydriver.CUDA_MEM_ALLOC_NODE_PARAMS_v2_st* _pvt_ptr @@ -4664,6 +4776,7 @@ cdef class CUDA_MEM_FREE_NODE_PARAMS_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_MEM_FREE_NODE_PARAMS_st _pvt_val cdef cydriver.CUDA_MEM_FREE_NODE_PARAMS_st* _pvt_ptr @@ -4694,6 +4807,7 @@ cdef class CUDA_CHILD_GRAPH_NODE_PARAMS_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_CHILD_GRAPH_NODE_PARAMS_st _pvt_val cdef cydriver.CUDA_CHILD_GRAPH_NODE_PARAMS_st* _pvt_ptr @@ -4724,6 +4838,7 @@ cdef class CUDA_EVENT_RECORD_NODE_PARAMS_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_EVENT_RECORD_NODE_PARAMS_st* _val_ptr cdef cydriver.CUDA_EVENT_RECORD_NODE_PARAMS_st* _pvt_ptr @@ -4752,6 +4867,7 @@ cdef class CUDA_EVENT_WAIT_NODE_PARAMS_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUDA_EVENT_WAIT_NODE_PARAMS_st _pvt_val cdef cydriver.CUDA_EVENT_WAIT_NODE_PARAMS_st* _pvt_ptr @@ -4830,6 +4946,7 @@ cdef class CUgraphNodeParams_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUgraphNodeParams_st* _val_ptr cdef cydriver.CUgraphNodeParams_st* _pvt_ptr @@ -4898,6 +5015,7 @@ cdef class CUcheckpointCustomStoragePerDeviceData_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUcheckpointCustomStoragePerDeviceData_st _pvt_val cdef cydriver.CUcheckpointCustomStoragePerDeviceData_st* _pvt_ptr @@ -4933,6 +5051,7 @@ cdef class CUcheckpointCustomStorageInfo_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUcheckpointCustomStorageInfo_st _pvt_val cdef cydriver.CUcheckpointCustomStorageInfo_st* _pvt_ptr @@ -4960,6 +5079,7 @@ cdef class CUcheckpointLockArgs_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUcheckpointLockArgs_st _pvt_val cdef cydriver.CUcheckpointLockArgs_st* _pvt_ptr @@ -4980,6 +5100,7 @@ cdef class CUcheckpointCheckpointArgs_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUcheckpointCheckpointArgs_st _pvt_val cdef cydriver.CUcheckpointCheckpointArgs_st* _pvt_ptr @@ -5003,6 +5124,7 @@ cdef class CUcheckpointGpuPair_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUcheckpointGpuPair_st _pvt_val cdef cydriver.CUcheckpointGpuPair_st* _pvt_ptr @@ -5037,6 +5159,7 @@ cdef class CUcheckpointRestoreArgs_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUcheckpointRestoreArgs_st _pvt_val cdef cydriver.CUcheckpointRestoreArgs_st* _pvt_ptr @@ -5053,6 +5176,7 @@ cdef class CUcheckpointUnlockArgs_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUcheckpointUnlockArgs_st _pvt_val cdef cydriver.CUcheckpointUnlockArgs_st* _pvt_ptr @@ -5102,9 +5226,14 @@ cdef class CUmemDecompressParams_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUmemDecompressParams_st _pvt_val cdef cydriver.CUmemDecompressParams_st* _pvt_ptr + cdef size_t _dstActBytes_length + cdef cydriver.cuuint32_t* _dstActBytes + + cdef _HelperInputVoidPtr _cysrc @@ -5131,6 +5260,7 @@ cdef class CUcliqueInfo_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUcliqueInfo_st _pvt_val cdef cydriver.CUcliqueInfo_st* _pvt_ptr @@ -5150,6 +5280,7 @@ cdef class CUlogicalEndpointFabricHandle_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUlogicalEndpointFabricHandle_st _pvt_val cdef cydriver.CUlogicalEndpointFabricHandle_st* _pvt_ptr @@ -5167,6 +5298,7 @@ cdef class anon_struct26: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUlogicalEndpointProp_struct* _pvt_ptr cdef CUdevice _device @@ -5186,6 +5318,7 @@ cdef class anon_struct27: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUlogicalEndpointProp_struct* _pvt_ptr cdef class CUlogicalEndpointProp_struct: @@ -5225,6 +5358,7 @@ cdef class CUlogicalEndpointProp_struct: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUlogicalEndpointProp_struct* _val_ptr cdef cydriver.CUlogicalEndpointProp_struct* _pvt_ptr @@ -5272,6 +5406,7 @@ cdef class CUdevSmResource_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUdevSmResource_st _pvt_val cdef cydriver.CUdevSmResource_st* _pvt_ptr @@ -5297,6 +5432,7 @@ cdef class CUdevWorkqueueConfigResource_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUdevWorkqueueConfigResource_st _pvt_val cdef cydriver.CUdevWorkqueueConfigResource_st* _pvt_ptr @@ -5310,6 +5446,7 @@ cdef class CUdevWorkqueueResource_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUdevWorkqueueResource_st _pvt_val cdef cydriver.CUdevWorkqueueResource_st* _pvt_ptr @@ -5347,6 +5484,7 @@ cdef class CU_DEV_SM_RESOURCE_GROUP_PARAMS_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CU_DEV_SM_RESOURCE_GROUP_PARAMS_st _pvt_val cdef cydriver.CU_DEV_SM_RESOURCE_GROUP_PARAMS_st* _pvt_ptr @@ -5390,6 +5528,7 @@ cdef class CUdevResource_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUdevResource_st* _val_ptr cdef cydriver.CUdevResource_st* _pvt_ptr @@ -5424,6 +5563,7 @@ cdef class anon_union21: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUeglFrame_st* _pvt_ptr cdef class CUeglFrame_st: @@ -5480,6 +5620,7 @@ cdef class CUeglFrame_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cydriver.CUeglFrame_st* _val_ptr cdef cydriver.CUeglFrame_st* _pvt_ptr diff --git a/cuda_bindings/cuda/bindings/driver.pyx b/cuda_bindings/cuda/bindings/driver.pyx index 781d040c1f7..0d7268422d9 100644 --- a/cuda_bindings/cuda/bindings/driver.pyx +++ b/cuda_bindings/cuda/bindings/driver.pyx @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 # This code was automatically generated with version 13.4.1. Do not modify it directly. -# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=79336857bd6bf7884714e40db0ea94f28275fb08b283efa6bae52b1e93529c14 +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=548b03ca3d3021957ab650d666fcd33a16d9af80a5004254c2733f807836679b from typing import Any, Optional import cython import ctypes @@ -10042,19 +10042,10 @@ cdef class CUstreamMemOpWaitValueParams_st: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._address = CUdeviceptr(_ptr=&self._pvt_ptr[0].waitValue.address) - - self._value = cuuint32_t(_ptr=&self._pvt_ptr[0].waitValue.value) - - self._value64 = cuuint64_t(_ptr=&self._pvt_ptr[0].waitValue.value64) - - self._alias = CUdeviceptr(_ptr=&self._pvt_ptr[0].waitValue.alias) - def __dealloc__(self): pass def getPtr(self): @@ -10228,19 +10219,10 @@ cdef class CUstreamMemOpWriteValueParams_st: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._address = CUdeviceptr(_ptr=&self._pvt_ptr[0].writeValue.address) - - self._value = cuuint32_t(_ptr=&self._pvt_ptr[0].writeValue.value) - - self._value64 = cuuint64_t(_ptr=&self._pvt_ptr[0].writeValue.value64) - - self._alias = CUdeviceptr(_ptr=&self._pvt_ptr[0].writeValue.alias) - def __dealloc__(self): pass def getPtr(self): @@ -10542,16 +10524,9 @@ cdef class CUstreamMemOpAtomicReductionParams_st: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._address = CUdeviceptr(_ptr=&self._pvt_ptr[0].atomicReduction.address) - - self._value = cuuint64_t(_ptr=&self._pvt_ptr[0].atomicReduction.value) - - self._alias = CUdeviceptr(_ptr=&self._pvt_ptr[0].atomicReduction.alias) - def __dealloc__(self): pass def getPtr(self): @@ -10740,24 +10715,22 @@ cdef class CUstreamBatchMemOpParams_union: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._waitValue = CUstreamMemOpWaitValueParams_st(_ptr=self._pvt_ptr) - - + self._waitValue._owner = self self._writeValue = CUstreamMemOpWriteValueParams_st(_ptr=self._pvt_ptr) - - + self._writeValue._owner = self self._flushRemoteWrites = CUstreamMemOpFlushRemoteWritesParams_st(_ptr=self._pvt_ptr) - - + self._flushRemoteWrites._owner = self self._memoryBarrier = CUstreamMemOpMemoryBarrierParams_st(_ptr=self._pvt_ptr) - - + self._memoryBarrier._owner = self self._atomicReduction = CUstreamMemOpAtomicReductionParams_st(_ptr=self._pvt_ptr) - + self._atomicReduction._owner = self def __dealloc__(self): - pass + self._waitValue = None + self._writeValue = None + self._flushRemoteWrites = None + self._memoryBarrier = None + self._atomicReduction = None def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -10901,17 +10874,11 @@ cdef class CUDA_BATCH_MEM_OP_NODE_PARAMS_v1_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._ctx = CUcontext(_ptr=&self._pvt_ptr[0].ctx) - def __dealloc__(self): - pass - if self._paramArray is not NULL: free(self._paramArray) self._pvt_ptr[0].paramArray = NULL - def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -10972,8 +10939,12 @@ cdef class CUDA_BATCH_MEM_OP_NODE_PARAMS_v1_st: @property def paramArray(self): - arrs = [self._pvt_ptr[0].paramArray + x*sizeof(cydriver.CUstreamBatchMemOpParams) for x in range(self._paramArray_length)] - return [CUstreamBatchMemOpParams(_ptr=arr) for arr in arrs] + if self._pvt_ptr[0].paramArray == NULL: + return [] + out_paramArray = [CUstreamBatchMemOpParams() for _idx in range(self._paramArray_length)] + for _idx in range(len(out_paramArray)): + string.memcpy(out_paramArray[_idx].getPtr(), &self._pvt_ptr[0].paramArray[_idx], sizeof(cydriver.CUstreamBatchMemOpParams)) + return out_paramArray @paramArray.setter def paramArray(self, val): cdef cydriver.CUstreamBatchMemOpParams* _paramArray_new @@ -10984,10 +10955,6 @@ cdef class CUDA_BATCH_MEM_OP_NODE_PARAMS_v1_st: self._pvt_ptr[0].paramArray = NULL else: if self._paramArray_length != len(val): - # Allocate and fill a new buffer before touching the - # live state so a failure leaves this object unchanged - # (strong exception guarantee); the old buffer is only - # freed once the resize is known to succeed. _paramArray_new = calloc(len(val), sizeof(cydriver.CUstreamBatchMemOpParams)) if _paramArray_new is NULL: raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cydriver.CUstreamBatchMemOpParams))) @@ -11002,7 +10969,6 @@ cdef class CUDA_BATCH_MEM_OP_NODE_PARAMS_v1_st: string.memcpy(&self._paramArray[idx], (val[idx])._pvt_ptr, sizeof(cydriver.CUstreamBatchMemOpParams)) - @property def flags(self): return self._pvt_ptr[0].flags @@ -11045,17 +11011,11 @@ cdef class CUDA_BATCH_MEM_OP_NODE_PARAMS_v2_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._ctx = CUcontext(_ptr=&self._pvt_ptr[0].ctx) - def __dealloc__(self): - pass - if self._paramArray is not NULL: free(self._paramArray) self._pvt_ptr[0].paramArray = NULL - def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -11116,8 +11076,12 @@ cdef class CUDA_BATCH_MEM_OP_NODE_PARAMS_v2_st: @property def paramArray(self): - arrs = [self._pvt_ptr[0].paramArray + x*sizeof(cydriver.CUstreamBatchMemOpParams) for x in range(self._paramArray_length)] - return [CUstreamBatchMemOpParams(_ptr=arr) for arr in arrs] + if self._pvt_ptr[0].paramArray == NULL: + return [] + out_paramArray = [CUstreamBatchMemOpParams() for _idx in range(self._paramArray_length)] + for _idx in range(len(out_paramArray)): + string.memcpy(out_paramArray[_idx].getPtr(), &self._pvt_ptr[0].paramArray[_idx], sizeof(cydriver.CUstreamBatchMemOpParams)) + return out_paramArray @paramArray.setter def paramArray(self, val): cdef cydriver.CUstreamBatchMemOpParams* _paramArray_new @@ -11128,10 +11092,6 @@ cdef class CUDA_BATCH_MEM_OP_NODE_PARAMS_v2_st: self._pvt_ptr[0].paramArray = NULL else: if self._paramArray_length != len(val): - # Allocate and fill a new buffer before touching the - # live state so a failure leaves this object unchanged - # (strong exception guarantee); the old buffer is only - # freed once the resize is known to succeed. _paramArray_new = calloc(len(val), sizeof(cydriver.CUstreamBatchMemOpParams)) if _paramArray_new is NULL: raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cydriver.CUstreamBatchMemOpParams))) @@ -11146,7 +11106,6 @@ cdef class CUDA_BATCH_MEM_OP_NODE_PARAMS_v2_st: string.memcpy(&self._paramArray[idx], (val[idx])._pvt_ptr, sizeof(cydriver.CUstreamBatchMemOpParams)) - @property def flags(self): return self._pvt_ptr[0].flags @@ -11217,12 +11176,10 @@ cdef class anon_union2: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._overBudget = anon_struct0(_ptr=self._pvt_ptr) - + self._overBudget._owner = self def __dealloc__(self): - pass + self._overBudget = None def getPtr(self): return &self._pvt_ptr[0].info def __repr__(self): @@ -11274,11 +11231,10 @@ cdef class CUasyncNotificationInfo_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._info = anon_union2(_ptr=self._pvt_ptr) - + self._info._owner = self def __dealloc__(self): + self._info = None if self._val_ptr is not NULL: free(self._val_ptr) def getPtr(self): @@ -11719,10 +11675,7 @@ cdef class CUDA_KERNEL_NODE_PARAMS_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._func = CUfunction(_ptr=&self._pvt_ptr[0].func) - def __dealloc__(self): pass def getPtr(self): @@ -11873,7 +11826,7 @@ cdef class CUDA_KERNEL_NODE_PARAMS_st: @kernelParams.setter def kernelParams(self, kernelParams): self._cykernelParams = _HelperKernelParams(kernelParams) - self._pvt_ptr[0].kernelParams = self._cykernelParams.ckernelParams + self._pvt_ptr[0].kernelParams = self._cykernelParams.ckernelParams @property @@ -11952,16 +11905,9 @@ cdef class CUDA_KERNEL_NODE_PARAMS_v2_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._func = CUfunction(_ptr=&self._pvt_ptr[0].func) - - self._kern = CUkernel(_ptr=&self._pvt_ptr[0].kern) - - self._ctx = CUcontext(_ptr=&self._pvt_ptr[0].ctx) - def __dealloc__(self): pass def getPtr(self): @@ -12124,7 +12070,7 @@ cdef class CUDA_KERNEL_NODE_PARAMS_v2_st: @kernelParams.setter def kernelParams(self, kernelParams): self._cykernelParams = _HelperKernelParams(kernelParams) - self._pvt_ptr[0].kernelParams = self._cykernelParams.ckernelParams + self._pvt_ptr[0].kernelParams = self._cykernelParams.ckernelParams @property @@ -12237,16 +12183,9 @@ cdef class CUDA_KERNEL_NODE_PARAMS_v3_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._func = CUfunction(_ptr=&self._pvt_ptr[0].func) - - self._kern = CUkernel(_ptr=&self._pvt_ptr[0].kern) - - self._ctx = CUcontext(_ptr=&self._pvt_ptr[0].ctx) - def __dealloc__(self): pass def getPtr(self): @@ -12409,7 +12348,7 @@ cdef class CUDA_KERNEL_NODE_PARAMS_v3_st: @kernelParams.setter def kernelParams(self, kernelParams): self._cykernelParams = _HelperKernelParams(kernelParams) - self._pvt_ptr[0].kernelParams = self._cykernelParams.ckernelParams + self._pvt_ptr[0].kernelParams = self._cykernelParams.ckernelParams @property @@ -12496,10 +12435,7 @@ cdef class CUDA_MEMSET_NODE_PARAMS_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._dst = CUdeviceptr(_ptr=&self._pvt_ptr[0].dst) - def __dealloc__(self): pass def getPtr(self): @@ -12651,13 +12587,8 @@ cdef class CUDA_MEMSET_NODE_PARAMS_v2_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._dst = CUdeviceptr(_ptr=&self._pvt_ptr[0].dst) - - self._ctx = CUcontext(_ptr=&self._pvt_ptr[0].ctx) - def __dealloc__(self): pass def getPtr(self): @@ -12812,10 +12743,7 @@ cdef class CUDA_HOST_NODE_PARAMS_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._fn = CUhostFn(_ptr=&self._pvt_ptr[0].fn) - def __dealloc__(self): pass def getPtr(self): @@ -12904,16 +12832,9 @@ cdef class CUDA_HOST_NODE_PARAMS_v2_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._fn = CUhostFn(_ptr=&self._pvt_ptr[0].fn) - - self._ctx = CUcontext(_ptr=&self._pvt_ptr[0].ctx) - - self._gCtx = CUgreenCtx(_ptr=&self._pvt_ptr[0].gCtx) - def __dealloc__(self): if self._val_ptr is not NULL: free(self._val_ptr) @@ -13081,13 +13002,8 @@ cdef class CUDA_CONDITIONAL_NODE_PARAMS: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._handle = CUgraphConditionalHandle(_ptr=&self._pvt_ptr[0].handle) - - self._ctx = CUcontext(_ptr=&self._pvt_ptr[0].ctx) - def __dealloc__(self): pass def getPtr(self): @@ -13322,16 +13238,9 @@ cdef class CUDA_GRAPH_INSTANTIATE_PARAMS_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._flags = cuuint64_t(_ptr=&self._pvt_ptr[0].flags) - - self._hUploadStream = CUstream(_ptr=&self._pvt_ptr[0].hUploadStream) - - self._hErrNode_out = CUgraphNode(_ptr=&self._pvt_ptr[0].hErrNode_out) - def __dealloc__(self): pass def getPtr(self): @@ -13605,10 +13514,7 @@ cdef class anon_struct2: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._event = CUevent(_ptr=&self._pvt_ptr[0].programmaticEvent.event) - def __dealloc__(self): pass def getPtr(self): @@ -13693,10 +13599,7 @@ cdef class anon_struct3: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._event = CUevent(_ptr=&self._pvt_ptr[0].launchCompletionEvent.event) - def __dealloc__(self): pass def getPtr(self): @@ -13847,10 +13750,7 @@ cdef class anon_struct5: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._devNode = CUgraphDeviceNode(_ptr=&self._pvt_ptr[0].deviceUpdatableKernelNode.devNode) - def __dealloc__(self): pass def getPtr(self): @@ -14032,30 +13932,28 @@ cdef class CUlaunchAttributeValue_union: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._accessPolicyWindow = CUaccessPolicyWindow(_ptr=&self._pvt_ptr[0].accessPolicyWindow) - - + self._accessPolicyWindow._owner = self self._clusterDim = anon_struct1(_ptr=self._pvt_ptr) - - + self._clusterDim._owner = self self._programmaticEvent = anon_struct2(_ptr=self._pvt_ptr) - - + self._programmaticEvent._owner = self self._launchCompletionEvent = anon_struct3(_ptr=self._pvt_ptr) - - + self._launchCompletionEvent._owner = self self._memSyncDomainMap = CUlaunchMemSyncDomainMap(_ptr=&self._pvt_ptr[0].memSyncDomainMap) - - + self._memSyncDomainMap._owner = self self._preferredClusterDim = anon_struct4(_ptr=self._pvt_ptr) - - + self._preferredClusterDim._owner = self self._deviceUpdatableKernelNode = anon_struct5(_ptr=self._pvt_ptr) - + self._deviceUpdatableKernelNode._owner = self def __dealloc__(self): - pass + self._accessPolicyWindow = None + self._clusterDim = None + self._programmaticEvent = None + self._launchCompletionEvent = None + self._memSyncDomainMap = None + self._preferredClusterDim = None + self._deviceUpdatableKernelNode = None def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -14354,12 +14252,10 @@ cdef class CUlaunchAttribute_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._value = CUlaunchAttributeValue(_ptr=&self._pvt_ptr[0].value) - + self._value._owner = self def __dealloc__(self): - pass + self._value = None def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -14455,17 +14351,11 @@ cdef class CUlaunchConfig_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._hStream = CUstream(_ptr=&self._pvt_ptr[0].hStream) - def __dealloc__(self): - pass - if self._attrs is not NULL: free(self._attrs) self._pvt_ptr[0].attrs = NULL - def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -14610,8 +14500,12 @@ cdef class CUlaunchConfig_st: @property def attrs(self): - arrs = [self._pvt_ptr[0].attrs + x*sizeof(cydriver.CUlaunchAttribute) for x in range(self._attrs_length)] - return [CUlaunchAttribute(_ptr=arr) for arr in arrs] + if self._pvt_ptr[0].attrs == NULL: + return [] + out_attrs = [CUlaunchAttribute() for _idx in range(self._attrs_length)] + for _idx in range(len(out_attrs)): + string.memcpy(out_attrs[_idx].getPtr(), &self._pvt_ptr[0].attrs[_idx], sizeof(cydriver.CUlaunchAttribute)) + return out_attrs @attrs.setter def attrs(self, val): cdef cydriver.CUlaunchAttribute* _attrs_new @@ -14622,10 +14516,6 @@ cdef class CUlaunchConfig_st: self._pvt_ptr[0].attrs = NULL else: if self._attrs_length != len(val): - # Allocate and fill a new buffer before touching the - # live state so a failure leaves this object unchanged - # (strong exception guarantee); the old buffer is only - # freed once the resize is known to succeed. _attrs_new = calloc(len(val), sizeof(cydriver.CUlaunchAttribute)) if _attrs_new is NULL: raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cydriver.CUlaunchAttribute))) @@ -14640,7 +14530,6 @@ cdef class CUlaunchConfig_st: string.memcpy(&self._attrs[idx], (val[idx])._pvt_ptr, sizeof(cydriver.CUlaunchAttribute)) - @property def numAttrs(self): return self._pvt_ptr[0].numAttrs @@ -14715,12 +14604,10 @@ cdef class anon_union4: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._smCount = CUexecAffinitySmCount(_ptr=&self._pvt_ptr[0].param.smCount) - + self._smCount._owner = self def __dealloc__(self): - pass + self._smCount = None def getPtr(self): return &self._pvt_ptr[0].param def __repr__(self): @@ -14771,11 +14658,10 @@ cdef class CUexecAffinityParam_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._param = anon_union4(_ptr=self._pvt_ptr) - + self._param._owner = self def __dealloc__(self): + self._param = None if self._val_ptr is not NULL: free(self._val_ptr) def getPtr(self): @@ -14922,17 +14808,12 @@ cdef class CUctxCreateParams_st: def __init__(self, void_ptr _ptr = 0): pass def __dealloc__(self): - pass - if self._execAffinityParams is not NULL: free(self._execAffinityParams) self._pvt_ptr[0].execAffinityParams = NULL - - if self._cigParams is not NULL: free(self._cigParams) self._pvt_ptr[0].cigParams = NULL - def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -14962,8 +14843,12 @@ cdef class CUctxCreateParams_st: @property def execAffinityParams(self): - arrs = [self._pvt_ptr[0].execAffinityParams + x*sizeof(cydriver.CUexecAffinityParam) for x in range(self._execAffinityParams_length)] - return [CUexecAffinityParam(_ptr=arr) for arr in arrs] + if self._pvt_ptr[0].execAffinityParams == NULL: + return [] + out_execAffinityParams = [CUexecAffinityParam() for _idx in range(self._execAffinityParams_length)] + for _idx in range(len(out_execAffinityParams)): + string.memcpy(out_execAffinityParams[_idx].getPtr(), &self._pvt_ptr[0].execAffinityParams[_idx], sizeof(cydriver.CUexecAffinityParam)) + return out_execAffinityParams @execAffinityParams.setter def execAffinityParams(self, val): cdef cydriver.CUexecAffinityParam* _execAffinityParams_new @@ -14974,10 +14859,6 @@ cdef class CUctxCreateParams_st: self._pvt_ptr[0].execAffinityParams = NULL else: if self._execAffinityParams_length != len(val): - # Allocate and fill a new buffer before touching the - # live state so a failure leaves this object unchanged - # (strong exception guarantee); the old buffer is only - # freed once the resize is known to succeed. _execAffinityParams_new = calloc(len(val), sizeof(cydriver.CUexecAffinityParam)) if _execAffinityParams_new is NULL: raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cydriver.CUexecAffinityParam))) @@ -14992,7 +14873,6 @@ cdef class CUctxCreateParams_st: string.memcpy(&self._execAffinityParams[idx], (val[idx])._pvt_ptr, sizeof(cydriver.CUexecAffinityParam)) - @property def numExecAffinityParams(self): return self._pvt_ptr[0].numExecAffinityParams @@ -15003,8 +14883,12 @@ cdef class CUctxCreateParams_st: @property def cigParams(self): - arrs = [self._pvt_ptr[0].cigParams + x*sizeof(cydriver.CUctxCigParam) for x in range(self._cigParams_length)] - return [CUctxCigParam(_ptr=arr) for arr in arrs] + if self._pvt_ptr[0].cigParams == NULL: + return [] + out_cigParams = [CUctxCigParam() for _idx in range(self._cigParams_length)] + for _idx in range(len(out_cigParams)): + string.memcpy(out_cigParams[_idx].getPtr(), &self._pvt_ptr[0].cigParams[_idx], sizeof(cydriver.CUctxCigParam)) + return out_cigParams @cigParams.setter def cigParams(self, val): cdef cydriver.CUctxCigParam* _cigParams_new @@ -15015,10 +14899,6 @@ cdef class CUctxCreateParams_st: self._pvt_ptr[0].cigParams = NULL else: if self._cigParams_length != len(val): - # Allocate and fill a new buffer before touching the - # live state so a failure leaves this object unchanged - # (strong exception guarantee); the old buffer is only - # freed once the resize is known to succeed. _cigParams_new = calloc(len(val), sizeof(cydriver.CUctxCigParam)) if _cigParams_new is NULL: raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cydriver.CUctxCigParam))) @@ -15033,7 +14913,6 @@ cdef class CUctxCreateParams_st: string.memcpy(&self._cigParams[idx], (val[idx])._pvt_ptr, sizeof(cydriver.CUctxCigParam)) - cdef class CUstreamCigParam_st: """ CIG Stream Capture Params @@ -15128,12 +15007,9 @@ cdef class CUstreamCigCaptureParams_st: def __init__(self, void_ptr _ptr = 0): pass def __dealloc__(self): - pass - if self._streamCigParams is not NULL: free(self._streamCigParams) self._pvt_ptr[0].streamCigParams = NULL - def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -15151,8 +15027,12 @@ cdef class CUstreamCigCaptureParams_st: @property def streamCigParams(self): - arrs = [self._pvt_ptr[0].streamCigParams + x*sizeof(cydriver.CUstreamCigParam) for x in range(self._streamCigParams_length)] - return [CUstreamCigParam(_ptr=arr) for arr in arrs] + if self._pvt_ptr[0].streamCigParams == NULL: + return [] + out_streamCigParams = [CUstreamCigParam() for _idx in range(self._streamCigParams_length)] + for _idx in range(len(out_streamCigParams)): + string.memcpy(out_streamCigParams[_idx].getPtr(), &self._pvt_ptr[0].streamCigParams[_idx], sizeof(cydriver.CUstreamCigParam)) + return out_streamCigParams @streamCigParams.setter def streamCigParams(self, val): cdef cydriver.CUstreamCigParam* _streamCigParams_new @@ -15163,10 +15043,6 @@ cdef class CUstreamCigCaptureParams_st: self._pvt_ptr[0].streamCigParams = NULL else: if self._streamCigParams_length != len(val): - # Allocate and fill a new buffer before touching the - # live state so a failure leaves this object unchanged - # (strong exception guarantee); the old buffer is only - # freed once the resize is known to succeed. _streamCigParams_new = calloc(len(val), sizeof(cydriver.CUstreamCigParam)) if _streamCigParams_new is NULL: raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cydriver.CUstreamCigParam))) @@ -15181,7 +15057,6 @@ cdef class CUstreamCigCaptureParams_st: string.memcpy(&self._streamCigParams[idx], (val[idx])._pvt_ptr, sizeof(cydriver.CUstreamCigParam)) - cdef class CUlibraryHostUniversalFunctionAndDataTable_st: """ Attributes @@ -15366,19 +15241,10 @@ cdef class CUDA_MEMCPY2D_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._srcDevice = CUdeviceptr(_ptr=&self._pvt_ptr[0].srcDevice) - - self._srcArray = CUarray(_ptr=&self._pvt_ptr[0].srcArray) - - self._dstDevice = CUdeviceptr(_ptr=&self._pvt_ptr[0].dstDevice) - - self._dstArray = CUarray(_ptr=&self._pvt_ptr[0].dstArray) - def __dealloc__(self): pass def getPtr(self): @@ -15765,19 +15631,10 @@ cdef class CUDA_MEMCPY3D_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._srcDevice = CUdeviceptr(_ptr=&self._pvt_ptr[0].srcDevice) - - self._srcArray = CUarray(_ptr=&self._pvt_ptr[0].srcArray) - - self._dstDevice = CUdeviceptr(_ptr=&self._pvt_ptr[0].dstDevice) - - self._dstArray = CUarray(_ptr=&self._pvt_ptr[0].dstArray) - def __dealloc__(self): pass def getPtr(self): @@ -16271,25 +16128,12 @@ cdef class CUDA_MEMCPY3D_PEER_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._srcDevice = CUdeviceptr(_ptr=&self._pvt_ptr[0].srcDevice) - - self._srcArray = CUarray(_ptr=&self._pvt_ptr[0].srcArray) - - self._srcContext = CUcontext(_ptr=&self._pvt_ptr[0].srcContext) - - self._dstDevice = CUdeviceptr(_ptr=&self._pvt_ptr[0].dstDevice) - - self._dstArray = CUarray(_ptr=&self._pvt_ptr[0].dstArray) - - self._dstContext = CUcontext(_ptr=&self._pvt_ptr[0].dstContext) - def __dealloc__(self): pass def getPtr(self): @@ -16739,15 +16583,11 @@ cdef class CUDA_MEMCPY_NODE_PARAMS_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._copyCtx = CUcontext(_ptr=&self._pvt_ptr[0].copyCtx) - - self._copyParams = CUDA_MEMCPY3D(_ptr=&self._pvt_ptr[0].copyParams) - + self._copyParams._owner = self def __dealloc__(self): - pass + self._copyParams = None def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -17163,12 +17003,10 @@ cdef class CUDA_ARRAY_SPARSE_PROPERTIES_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._tileExtent = anon_struct6(_ptr=self._pvt_ptr) - + self._tileExtent._owner = self def __dealloc__(self): - pass + self._tileExtent = None def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -17318,10 +17156,7 @@ cdef class anon_struct7: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._hArray = CUarray(_ptr=&self._pvt_ptr[0].res.array.hArray) - def __dealloc__(self): pass def getPtr(self): @@ -17374,10 +17209,7 @@ cdef class anon_struct8: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._hMipmappedArray = CUmipmappedArray(_ptr=&self._pvt_ptr[0].res.mipmap.hMipmappedArray) - def __dealloc__(self): pass def getPtr(self): @@ -17442,10 +17274,7 @@ cdef class anon_struct9: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._devPtr = CUdeviceptr(_ptr=&self._pvt_ptr[0].res.linear.devPtr) - def __dealloc__(self): pass def getPtr(self): @@ -17561,10 +17390,7 @@ cdef class anon_struct10: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._devPtr = CUdeviceptr(_ptr=&self._pvt_ptr[0].res.pitch2D.devPtr) - def __dealloc__(self): pass def getPtr(self): @@ -17724,21 +17550,19 @@ cdef class anon_union5: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._array = anon_struct7(_ptr=self._pvt_ptr) - - + self._array._owner = self self._mipmap = anon_struct8(_ptr=self._pvt_ptr) - - + self._mipmap._owner = self self._linear = anon_struct9(_ptr=self._pvt_ptr) - - + self._linear._owner = self self._pitch2D = anon_struct10(_ptr=self._pvt_ptr) - + self._pitch2D._owner = self def __dealloc__(self): - pass + self._array = None + self._mipmap = None + self._linear = None + self._pitch2D = None def getPtr(self): return &self._pvt_ptr[0].res def __repr__(self): @@ -17835,11 +17659,10 @@ cdef class CUDA_RESOURCE_DESC_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._res = anon_union5(_ptr=self._pvt_ptr) - + self._res._owner = self def __dealloc__(self): + self._res = None if self._val_ptr is not NULL: free(self._val_ptr) def getPtr(self): @@ -18433,13 +18256,8 @@ cdef class CUDA_LAUNCH_PARAMS_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._function = CUfunction(_ptr=&self._pvt_ptr[0].function) - - self._hStream = CUstream(_ptr=&self._pvt_ptr[0].hStream) - def __dealloc__(self): pass def getPtr(self): @@ -18607,7 +18425,7 @@ cdef class CUDA_LAUNCH_PARAMS_st: @kernelParams.setter def kernelParams(self, kernelParams): self._cykernelParams = _HelperKernelParams(kernelParams) - self._pvt_ptr[0].kernelParams = self._cykernelParams.ckernelParams + self._pvt_ptr[0].kernelParams = self._cykernelParams.ckernelParams cdef class anon_struct12: @@ -18700,12 +18518,10 @@ cdef class anon_union6: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._win32 = anon_struct12(_ptr=self._pvt_ptr) - + self._win32._owner = self def __dealloc__(self): - pass + self._win32 = None def getPtr(self): return &self._pvt_ptr[0].handle def __repr__(self): @@ -18793,11 +18609,10 @@ cdef class CUDA_EXTERNAL_MEMORY_HANDLE_DESC_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._handle = anon_union6(_ptr=self._pvt_ptr) - + self._handle._owner = self def __dealloc__(self): + self._handle = None if self._val_ptr is not NULL: free(self._val_ptr) def getPtr(self): @@ -18980,12 +18795,10 @@ cdef class CUDA_EXTERNAL_MEMORY_MIPMAPPED_ARRAY_DESC_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._arrayDesc = CUDA_ARRAY3D_DESCRIPTOR(_ptr=&self._pvt_ptr[0].arrayDesc) - + self._arrayDesc._owner = self def __dealloc__(self): - pass + self._arrayDesc = None def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -19127,12 +18940,10 @@ cdef class anon_union7: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._win32 = anon_struct13(_ptr=self._pvt_ptr) - + self._win32._owner = self def __dealloc__(self): - pass + self._win32 = None def getPtr(self): return &self._pvt_ptr[0].handle def __repr__(self): @@ -19216,11 +19027,10 @@ cdef class CUDA_EXTERNAL_SEMAPHORE_HANDLE_DESC_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._handle = anon_union7(_ptr=self._pvt_ptr) - + self._handle._owner = self def __dealloc__(self): + self._handle = None if self._val_ptr is not NULL: free(self._val_ptr) def getPtr(self): @@ -19433,18 +19243,16 @@ cdef class anon_struct16: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._fence = anon_struct14(_ptr=self._pvt_ptr) - - + self._fence._owner = self self._nvSciSync = anon_union8(_ptr=self._pvt_ptr) - - + self._nvSciSync._owner = self self._keyedMutex = anon_struct15(_ptr=self._pvt_ptr) - + self._keyedMutex._owner = self def __dealloc__(self): - pass + self._fence = None + self._nvSciSync = None + self._keyedMutex = None def getPtr(self): return &self._pvt_ptr[0].params def __repr__(self): @@ -19529,12 +19337,10 @@ cdef class CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._params = anon_struct16(_ptr=self._pvt_ptr) - + self._params._owner = self def __dealloc__(self): - pass + self._params = None def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -19749,18 +19555,16 @@ cdef class anon_struct19: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._fence = anon_struct17(_ptr=self._pvt_ptr) - - + self._fence._owner = self self._nvSciSync = anon_union9(_ptr=self._pvt_ptr) - - + self._nvSciSync._owner = self self._keyedMutex = anon_struct18(_ptr=self._pvt_ptr) - + self._keyedMutex._owner = self def __dealloc__(self): - pass + self._fence = None + self._nvSciSync = None + self._keyedMutex = None def getPtr(self): return &self._pvt_ptr[0].params def __repr__(self): @@ -19845,12 +19649,10 @@ cdef class CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._params = anon_struct19(_ptr=self._pvt_ptr) - + self._params._owner = self def __dealloc__(self): - pass + self._params = None def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -19921,17 +19723,12 @@ cdef class CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_st: def __init__(self, void_ptr _ptr = 0): pass def __dealloc__(self): - pass - if self._extSemArray is not NULL: free(self._extSemArray) self._pvt_ptr[0].extSemArray = NULL - - if self._paramsArray is not NULL: free(self._paramsArray) self._pvt_ptr[0].paramsArray = NULL - def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -19985,8 +19782,12 @@ cdef class CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_st: @property def paramsArray(self): - arrs = [self._pvt_ptr[0].paramsArray + x*sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS) for x in range(self._paramsArray_length)] - return [CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS(_ptr=arr) for arr in arrs] + if self._pvt_ptr[0].paramsArray == NULL: + return [] + out_paramsArray = [CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS() for _idx in range(self._paramsArray_length)] + for _idx in range(len(out_paramsArray)): + string.memcpy(out_paramsArray[_idx].getPtr(), &self._pvt_ptr[0].paramsArray[_idx], sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS)) + return out_paramsArray @paramsArray.setter def paramsArray(self, val): cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS* _paramsArray_new @@ -19997,10 +19798,6 @@ cdef class CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_st: self._pvt_ptr[0].paramsArray = NULL else: if self._paramsArray_length != len(val): - # Allocate and fill a new buffer before touching the - # live state so a failure leaves this object unchanged - # (strong exception guarantee); the old buffer is only - # freed once the resize is known to succeed. _paramsArray_new = calloc(len(val), sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS)) if _paramsArray_new is NULL: raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS))) @@ -20015,7 +19812,6 @@ cdef class CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_st: string.memcpy(&self._paramsArray[idx], (val[idx])._pvt_ptr, sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS)) - @property def numExtSems(self): return self._pvt_ptr[0].numExtSems @@ -20064,26 +19860,17 @@ cdef class CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._ctx = CUcontext(_ptr=&self._pvt_ptr[0].ctx) - - self._gCtx = CUgreenCtx(_ptr=&self._pvt_ptr[0].gCtx) - def __dealloc__(self): - if self._val_ptr is not NULL: - free(self._val_ptr) - if self._extSemArray is not NULL: free(self._extSemArray) self._pvt_ptr[0].extSemArray = NULL - - if self._paramsArray is not NULL: free(self._paramsArray) self._pvt_ptr[0].paramsArray = NULL - + if self._val_ptr is not NULL: + free(self._val_ptr) def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -20149,8 +19936,12 @@ cdef class CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2_st: @property def paramsArray(self): - arrs = [self._pvt_ptr[0].paramsArray + x*sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS) for x in range(self._paramsArray_length)] - return [CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS(_ptr=arr) for arr in arrs] + if self._pvt_ptr[0].paramsArray == NULL: + return [] + out_paramsArray = [CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS() for _idx in range(self._paramsArray_length)] + for _idx in range(len(out_paramsArray)): + string.memcpy(out_paramsArray[_idx].getPtr(), &self._pvt_ptr[0].paramsArray[_idx], sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS)) + return out_paramsArray @paramsArray.setter def paramsArray(self, val): cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS* _paramsArray_new @@ -20161,10 +19952,6 @@ cdef class CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2_st: self._pvt_ptr[0].paramsArray = NULL else: if self._paramsArray_length != len(val): - # Allocate and fill a new buffer before touching the - # live state so a failure leaves this object unchanged - # (strong exception guarantee); the old buffer is only - # freed once the resize is known to succeed. _paramsArray_new = calloc(len(val), sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS)) if _paramsArray_new is NULL: raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS))) @@ -20179,7 +19966,6 @@ cdef class CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2_st: string.memcpy(&self._paramsArray[idx], (val[idx])._pvt_ptr, sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_SIGNAL_PARAMS)) - @property def numExtSems(self): return self._pvt_ptr[0].numExtSems @@ -20255,17 +20041,12 @@ cdef class CUDA_EXT_SEM_WAIT_NODE_PARAMS_st: def __init__(self, void_ptr _ptr = 0): pass def __dealloc__(self): - pass - if self._extSemArray is not NULL: free(self._extSemArray) self._pvt_ptr[0].extSemArray = NULL - - if self._paramsArray is not NULL: free(self._paramsArray) self._pvt_ptr[0].paramsArray = NULL - def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -20319,8 +20100,12 @@ cdef class CUDA_EXT_SEM_WAIT_NODE_PARAMS_st: @property def paramsArray(self): - arrs = [self._pvt_ptr[0].paramsArray + x*sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS) for x in range(self._paramsArray_length)] - return [CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS(_ptr=arr) for arr in arrs] + if self._pvt_ptr[0].paramsArray == NULL: + return [] + out_paramsArray = [CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS() for _idx in range(self._paramsArray_length)] + for _idx in range(len(out_paramsArray)): + string.memcpy(out_paramsArray[_idx].getPtr(), &self._pvt_ptr[0].paramsArray[_idx], sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS)) + return out_paramsArray @paramsArray.setter def paramsArray(self, val): cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS* _paramsArray_new @@ -20331,10 +20116,6 @@ cdef class CUDA_EXT_SEM_WAIT_NODE_PARAMS_st: self._pvt_ptr[0].paramsArray = NULL else: if self._paramsArray_length != len(val): - # Allocate and fill a new buffer before touching the - # live state so a failure leaves this object unchanged - # (strong exception guarantee); the old buffer is only - # freed once the resize is known to succeed. _paramsArray_new = calloc(len(val), sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS)) if _paramsArray_new is NULL: raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS))) @@ -20349,7 +20130,6 @@ cdef class CUDA_EXT_SEM_WAIT_NODE_PARAMS_st: string.memcpy(&self._paramsArray[idx], (val[idx])._pvt_ptr, sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS)) - @property def numExtSems(self): return self._pvt_ptr[0].numExtSems @@ -20398,26 +20178,17 @@ cdef class CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._ctx = CUcontext(_ptr=&self._pvt_ptr[0].ctx) - - self._gCtx = CUgreenCtx(_ptr=&self._pvt_ptr[0].gCtx) - def __dealloc__(self): - if self._val_ptr is not NULL: - free(self._val_ptr) - if self._extSemArray is not NULL: free(self._extSemArray) self._pvt_ptr[0].extSemArray = NULL - - if self._paramsArray is not NULL: free(self._paramsArray) self._pvt_ptr[0].paramsArray = NULL - + if self._val_ptr is not NULL: + free(self._val_ptr) def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -20483,8 +20254,12 @@ cdef class CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2_st: @property def paramsArray(self): - arrs = [self._pvt_ptr[0].paramsArray + x*sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS) for x in range(self._paramsArray_length)] - return [CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS(_ptr=arr) for arr in arrs] + if self._pvt_ptr[0].paramsArray == NULL: + return [] + out_paramsArray = [CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS() for _idx in range(self._paramsArray_length)] + for _idx in range(len(out_paramsArray)): + string.memcpy(out_paramsArray[_idx].getPtr(), &self._pvt_ptr[0].paramsArray[_idx], sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS)) + return out_paramsArray @paramsArray.setter def paramsArray(self, val): cdef cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS* _paramsArray_new @@ -20495,10 +20270,6 @@ cdef class CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2_st: self._pvt_ptr[0].paramsArray = NULL else: if self._paramsArray_length != len(val): - # Allocate and fill a new buffer before touching the - # live state so a failure leaves this object unchanged - # (strong exception guarantee); the old buffer is only - # freed once the resize is known to succeed. _paramsArray_new = calloc(len(val), sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS)) if _paramsArray_new is NULL: raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS))) @@ -20513,7 +20284,6 @@ cdef class CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2_st: string.memcpy(&self._paramsArray[idx], (val[idx])._pvt_ptr, sizeof(cydriver.CUDA_EXTERNAL_SEMAPHORE_WAIT_PARAMS)) - @property def numExtSems(self): return self._pvt_ptr[0].numExtSems @@ -20578,13 +20348,8 @@ cdef class anon_union12: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._mipmap = CUmipmappedArray(_ptr=&self._pvt_ptr[0].resource.mipmap) - - self._array = CUarray(_ptr=&self._pvt_ptr[0].resource.array) - def __dealloc__(self): pass def getPtr(self): @@ -20914,15 +20679,13 @@ cdef class anon_union13: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._sparseLevel = anon_struct20(_ptr=self._pvt_ptr) - - + self._sparseLevel._owner = self self._miptail = anon_struct21(_ptr=self._pvt_ptr) - + self._miptail._owner = self def __dealloc__(self): - pass + self._sparseLevel = None + self._miptail = None def getPtr(self): return &self._pvt_ptr[0].subresource def __repr__(self): @@ -20978,10 +20741,7 @@ cdef class anon_union14: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._memHandle = CUmemGenericAllocationHandle(_ptr=&self._pvt_ptr[0].memHandle.memHandle) - def __dealloc__(self): pass def getPtr(self): @@ -21077,17 +20837,16 @@ cdef class CUarrayMapInfo_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._resource = anon_union12(_ptr=self._pvt_ptr) - - + self._resource._owner = self self._subresource = anon_union13(_ptr=self._pvt_ptr) - - + self._subresource._owner = self self._memHandle = anon_union14(_ptr=self._pvt_ptr) - + self._memHandle._owner = self def __dealloc__(self): + self._resource = None + self._subresource = None + self._memHandle = None if self._val_ptr is not NULL: free(self._val_ptr) def getPtr(self): @@ -21335,11 +21094,10 @@ cdef class CUmemLocation_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._localized = anon_struct22(_ptr=self._pvt_ptr) - + self._localized._owner = self def __dealloc__(self): + self._localized = None if self._val_ptr is not NULL: free(self._val_ptr) def getPtr(self): @@ -21515,15 +21273,13 @@ cdef class CUmemAllocationProp_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._location = CUmemLocation(_ptr=&self._pvt_ptr[0].location) - - + self._location._owner = self self._allocFlags = anon_struct23(_ptr=self._pvt_ptr) - + self._allocFlags._owner = self def __dealloc__(self): - pass + self._location = None + self._allocFlags = None def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -21735,12 +21491,10 @@ cdef class CUmemAccessDesc_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._location = CUmemLocation(_ptr=&self._pvt_ptr[0].location) - + self._location._owner = self def __dealloc__(self): - pass + self._location = None def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -21811,13 +21565,8 @@ cdef class CUgraphExecUpdateResultInfo_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._errorNode = CUgraphNode(_ptr=&self._pvt_ptr[0].errorNode) - - self._errorFromNode = CUgraphNode(_ptr=&self._pvt_ptr[0].errorFromNode) - def __dealloc__(self): pass def getPtr(self): @@ -21955,12 +21704,10 @@ cdef class CUmemPoolProps_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._location = CUmemLocation(_ptr=&self._pvt_ptr[0].location) - + self._location._owner = self def __dealloc__(self): - pass + self._location = None def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -22135,15 +21882,13 @@ cdef class CUmemcpyAttributes_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._srcLocHint = CUmemLocation(_ptr=&self._pvt_ptr[0].srcLocHint) - - + self._srcLocHint._owner = self self._dstLocHint = CUmemLocation(_ptr=&self._pvt_ptr[0].dstLocHint) - + self._dstLocHint._owner = self def __dealloc__(self): - pass + self._srcLocHint = None + self._dstLocHint = None def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -22407,15 +22152,11 @@ cdef class anon_struct24: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._ptr = CUdeviceptr(_ptr=&self._pvt_ptr[0].op.ptr.ptr) - - self._locHint = CUmemLocation(_ptr=&self._pvt_ptr[0].op.ptr.locHint) - + self._locHint._owner = self def __dealloc__(self): - pass + self._locHint = None def getPtr(self): return &self._pvt_ptr[0].op.ptr def __repr__(self): @@ -22513,15 +22254,11 @@ cdef class anon_struct25: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._array = CUarray(_ptr=&self._pvt_ptr[0].op.array.array) - - self._offset = CUoffset3D(_ptr=&self._pvt_ptr[0].op.array.offset) - + self._offset._owner = self def __dealloc__(self): - pass + self._offset = None def getPtr(self): return &self._pvt_ptr[0].op.array def __repr__(self): @@ -22590,15 +22327,13 @@ cdef class anon_union16: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._ptr = anon_struct24(_ptr=self._pvt_ptr) - - + self._ptr._owner = self self._array = anon_struct25(_ptr=self._pvt_ptr) - + self._array._owner = self def __dealloc__(self): - pass + self._ptr = None + self._array = None def getPtr(self): return &self._pvt_ptr[0].op def __repr__(self): @@ -22663,11 +22398,10 @@ cdef class CUmemcpy3DOperand_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._op = anon_union16(_ptr=self._pvt_ptr) - + self._op._owner = self def __dealloc__(self): + self._op = None if self._val_ptr is not NULL: free(self._val_ptr) def getPtr(self): @@ -22744,18 +22478,16 @@ cdef class CUDA_MEMCPY3D_BATCH_OP_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._src = CUmemcpy3DOperand(_ptr=&self._pvt_ptr[0].src) - - + self._src._owner = self self._dst = CUmemcpy3DOperand(_ptr=&self._pvt_ptr[0].dst) - - + self._dst._owner = self self._extent = CUextent3D(_ptr=&self._pvt_ptr[0].extent) - + self._extent._owner = self def __dealloc__(self): - pass + self._src = None + self._dst = None + self._extent = None def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -22877,20 +22609,14 @@ cdef class CUDA_MEM_ALLOC_NODE_PARAMS_v1_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._poolProps = CUmemPoolProps(_ptr=&self._pvt_ptr[0].poolProps) - - + self._poolProps._owner = self self._dptr = CUdeviceptr(_ptr=&self._pvt_ptr[0].dptr) - def __dealloc__(self): - pass - + self._poolProps = None if self._accessDescs is not NULL: free(self._accessDescs) self._pvt_ptr[0].accessDescs = NULL - def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -22940,8 +22666,12 @@ cdef class CUDA_MEM_ALLOC_NODE_PARAMS_v1_st: @property def accessDescs(self): - arrs = [self._pvt_ptr[0].accessDescs + x*sizeof(cydriver.CUmemAccessDesc) for x in range(self._accessDescs_length)] - return [CUmemAccessDesc(_ptr=arr) for arr in arrs] + if self._pvt_ptr[0].accessDescs == NULL: + return [] + out_accessDescs = [CUmemAccessDesc() for _idx in range(self._accessDescs_length)] + for _idx in range(len(out_accessDescs)): + string.memcpy(out_accessDescs[_idx].getPtr(), &self._pvt_ptr[0].accessDescs[_idx], sizeof(cydriver.CUmemAccessDesc)) + return out_accessDescs @accessDescs.setter def accessDescs(self, val): cdef cydriver.CUmemAccessDesc* _accessDescs_new @@ -22952,10 +22682,6 @@ cdef class CUDA_MEM_ALLOC_NODE_PARAMS_v1_st: self._pvt_ptr[0].accessDescs = NULL else: if self._accessDescs_length != len(val): - # Allocate and fill a new buffer before touching the - # live state so a failure leaves this object unchanged - # (strong exception guarantee); the old buffer is only - # freed once the resize is known to succeed. _accessDescs_new = calloc(len(val), sizeof(cydriver.CUmemAccessDesc)) if _accessDescs_new is NULL: raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cydriver.CUmemAccessDesc))) @@ -22970,7 +22696,6 @@ cdef class CUDA_MEM_ALLOC_NODE_PARAMS_v1_st: string.memcpy(&self._accessDescs[idx], (val[idx])._pvt_ptr, sizeof(cydriver.CUmemAccessDesc)) - @property def accessDescCount(self): return self._pvt_ptr[0].accessDescCount @@ -23047,20 +22772,14 @@ cdef class CUDA_MEM_ALLOC_NODE_PARAMS_v2_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._poolProps = CUmemPoolProps(_ptr=&self._pvt_ptr[0].poolProps) - - + self._poolProps._owner = self self._dptr = CUdeviceptr(_ptr=&self._pvt_ptr[0].dptr) - def __dealloc__(self): - pass - + self._poolProps = None if self._accessDescs is not NULL: free(self._accessDescs) self._pvt_ptr[0].accessDescs = NULL - def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -23110,8 +22829,12 @@ cdef class CUDA_MEM_ALLOC_NODE_PARAMS_v2_st: @property def accessDescs(self): - arrs = [self._pvt_ptr[0].accessDescs + x*sizeof(cydriver.CUmemAccessDesc) for x in range(self._accessDescs_length)] - return [CUmemAccessDesc(_ptr=arr) for arr in arrs] + if self._pvt_ptr[0].accessDescs == NULL: + return [] + out_accessDescs = [CUmemAccessDesc() for _idx in range(self._accessDescs_length)] + for _idx in range(len(out_accessDescs)): + string.memcpy(out_accessDescs[_idx].getPtr(), &self._pvt_ptr[0].accessDescs[_idx], sizeof(cydriver.CUmemAccessDesc)) + return out_accessDescs @accessDescs.setter def accessDescs(self, val): cdef cydriver.CUmemAccessDesc* _accessDescs_new @@ -23122,10 +22845,6 @@ cdef class CUDA_MEM_ALLOC_NODE_PARAMS_v2_st: self._pvt_ptr[0].accessDescs = NULL else: if self._accessDescs_length != len(val): - # Allocate and fill a new buffer before touching the - # live state so a failure leaves this object unchanged - # (strong exception guarantee); the old buffer is only - # freed once the resize is known to succeed. _accessDescs_new = calloc(len(val), sizeof(cydriver.CUmemAccessDesc)) if _accessDescs_new is NULL: raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cydriver.CUmemAccessDesc))) @@ -23140,7 +22859,6 @@ cdef class CUDA_MEM_ALLOC_NODE_PARAMS_v2_st: string.memcpy(&self._accessDescs[idx], (val[idx])._pvt_ptr, sizeof(cydriver.CUmemAccessDesc)) - @property def accessDescCount(self): return self._pvt_ptr[0].accessDescCount @@ -23197,10 +22915,7 @@ cdef class CUDA_MEM_FREE_NODE_PARAMS_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._dptr = CUdeviceptr(_ptr=&self._pvt_ptr[0].dptr) - def __dealloc__(self): pass def getPtr(self): @@ -23266,10 +22981,7 @@ cdef class CUDA_CHILD_GRAPH_NODE_PARAMS_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._graph = CUgraph(_ptr=&self._pvt_ptr[0].graph) - def __dealloc__(self): pass def getPtr(self): @@ -23349,16 +23061,9 @@ cdef class CUDA_EVENT_RECORD_NODE_PARAMS_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._event = CUevent(_ptr=&self._pvt_ptr[0].event) - - self._ctx = CUcontext(_ptr=&self._pvt_ptr[0].ctx) - - self._gCtx = CUgreenCtx(_ptr=&self._pvt_ptr[0].gCtx) - def __dealloc__(self): if self._val_ptr is not NULL: free(self._val_ptr) @@ -23462,10 +23167,7 @@ cdef class CUDA_EVENT_WAIT_NODE_PARAMS_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._event = CUevent(_ptr=&self._pvt_ptr[0].event) - def __dealloc__(self): pass def getPtr(self): @@ -23579,47 +23281,46 @@ cdef class CUgraphNodeParams_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._kernel = CUDA_KERNEL_NODE_PARAMS_v3(_ptr=&self._pvt_ptr[0].kernel) - - + self._kernel._owner = self self._memcpy = CUDA_MEMCPY_NODE_PARAMS(_ptr=&self._pvt_ptr[0].memcpy) - - + self._memcpy._owner = self self._memset = CUDA_MEMSET_NODE_PARAMS_v2(_ptr=&self._pvt_ptr[0].memset) - - + self._memset._owner = self self._host = CUDA_HOST_NODE_PARAMS_v2(_ptr=&self._pvt_ptr[0].host) - - + self._host._owner = self self._graph = CUDA_CHILD_GRAPH_NODE_PARAMS(_ptr=&self._pvt_ptr[0].graph) - - + self._graph._owner = self self._eventWait = CUDA_EVENT_WAIT_NODE_PARAMS(_ptr=&self._pvt_ptr[0].eventWait) - - + self._eventWait._owner = self self._eventRecord = CUDA_EVENT_RECORD_NODE_PARAMS(_ptr=&self._pvt_ptr[0].eventRecord) - - + self._eventRecord._owner = self self._extSemSignal = CUDA_EXT_SEM_SIGNAL_NODE_PARAMS_v2(_ptr=&self._pvt_ptr[0].extSemSignal) - - + self._extSemSignal._owner = self self._extSemWait = CUDA_EXT_SEM_WAIT_NODE_PARAMS_v2(_ptr=&self._pvt_ptr[0].extSemWait) - - + self._extSemWait._owner = self self._alloc = CUDA_MEM_ALLOC_NODE_PARAMS_v2(_ptr=&self._pvt_ptr[0].alloc) - - + self._alloc._owner = self self._free = CUDA_MEM_FREE_NODE_PARAMS(_ptr=&self._pvt_ptr[0].free) - - + self._free._owner = self self._memOp = CUDA_BATCH_MEM_OP_NODE_PARAMS_v2(_ptr=&self._pvt_ptr[0].memOp) - - + self._memOp._owner = self self._conditional = CUDA_CONDITIONAL_NODE_PARAMS(_ptr=&self._pvt_ptr[0].conditional) - + self._conditional._owner = self def __dealloc__(self): + self._kernel = None + self._memcpy = None + self._memset = None + self._host = None + self._graph = None + self._eventWait = None + self._eventRecord = None + self._extSemSignal = None + self._extSemWait = None + self._alloc = None + self._free = None + self._memOp = None + self._conditional = None if self._val_ptr is not NULL: free(self._val_ptr) def getPtr(self): @@ -23884,13 +23585,8 @@ cdef class CUcheckpointCustomStoragePerDeviceData_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._devPtr = CUdeviceptr(_ptr=&self._pvt_ptr[0].devPtr) - - self._stream = CUstream(_ptr=&self._pvt_ptr[0].stream) - def __dealloc__(self): pass def getPtr(self): @@ -23995,17 +23691,11 @@ cdef class CUcheckpointCustomStorageInfo_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._handle = CUcheckpointOperationHandle(_ptr=&self._pvt_ptr[0].handle) - def __dealloc__(self): - pass - if self._perDeviceData is not NULL: free(self._perDeviceData) self._pvt_ptr[0].perDeviceData = NULL - def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -24052,8 +23742,12 @@ cdef class CUcheckpointCustomStorageInfo_st: @property def perDeviceData(self): - arrs = [self._pvt_ptr[0].perDeviceData + x*sizeof(cydriver.CUcheckpointCustomStoragePerDeviceData) for x in range(self._perDeviceData_length)] - return [CUcheckpointCustomStoragePerDeviceData(_ptr=arr) for arr in arrs] + if self._pvt_ptr[0].perDeviceData == NULL: + return [] + out_perDeviceData = [CUcheckpointCustomStoragePerDeviceData() for _idx in range(self._perDeviceData_length)] + for _idx in range(len(out_perDeviceData)): + string.memcpy(out_perDeviceData[_idx].getPtr(), &self._pvt_ptr[0].perDeviceData[_idx], sizeof(cydriver.CUcheckpointCustomStoragePerDeviceData)) + return out_perDeviceData @perDeviceData.setter def perDeviceData(self, val): cdef cydriver.CUcheckpointCustomStoragePerDeviceData* _perDeviceData_new @@ -24064,10 +23758,6 @@ cdef class CUcheckpointCustomStorageInfo_st: self._pvt_ptr[0].perDeviceData = NULL else: if self._perDeviceData_length != len(val): - # Allocate and fill a new buffer before touching the - # live state so a failure leaves this object unchanged - # (strong exception guarantee); the old buffer is only - # freed once the resize is known to succeed. _perDeviceData_new = calloc(len(val), sizeof(cydriver.CUcheckpointCustomStoragePerDeviceData)) if _perDeviceData_new is NULL: raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cydriver.CUcheckpointCustomStoragePerDeviceData))) @@ -24082,7 +23772,6 @@ cdef class CUcheckpointCustomStorageInfo_st: string.memcpy(&self._perDeviceData[idx], (val[idx])._pvt_ptr, sizeof(cydriver.CUcheckpointCustomStoragePerDeviceData)) - @property def deviceCount(self): return self._pvt_ptr[0].deviceCount @@ -24215,15 +23904,13 @@ cdef class CUcheckpointGpuPair_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._oldUuid = CUuuid(_ptr=&self._pvt_ptr[0].oldUuid) - - + self._oldUuid._owner = self self._newUuid = CUuuid(_ptr=&self._pvt_ptr[0].newUuid) - + self._newUuid._owner = self def __dealloc__(self): - pass + self._oldUuid = None + self._newUuid = None def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -24294,12 +23981,9 @@ cdef class CUcheckpointRestoreArgs_st: def __init__(self, void_ptr _ptr = 0): pass def __dealloc__(self): - pass - if self._gpuPairs is not NULL: free(self._gpuPairs) self._pvt_ptr[0].gpuPairs = NULL - def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -24329,8 +24013,12 @@ cdef class CUcheckpointRestoreArgs_st: @property def gpuPairs(self): - arrs = [self._pvt_ptr[0].gpuPairs + x*sizeof(cydriver.CUcheckpointGpuPair) for x in range(self._gpuPairs_length)] - return [CUcheckpointGpuPair(_ptr=arr) for arr in arrs] + if self._pvt_ptr[0].gpuPairs == NULL: + return [] + out_gpuPairs = [CUcheckpointGpuPair() for _idx in range(self._gpuPairs_length)] + for _idx in range(len(out_gpuPairs)): + string.memcpy(out_gpuPairs[_idx].getPtr(), &self._pvt_ptr[0].gpuPairs[_idx], sizeof(cydriver.CUcheckpointGpuPair)) + return out_gpuPairs @gpuPairs.setter def gpuPairs(self, val): cdef cydriver.CUcheckpointGpuPair* _gpuPairs_new @@ -24341,10 +24029,6 @@ cdef class CUcheckpointRestoreArgs_st: self._pvt_ptr[0].gpuPairs = NULL else: if self._gpuPairs_length != len(val): - # Allocate and fill a new buffer before touching the - # live state so a failure leaves this object unchanged - # (strong exception guarantee); the old buffer is only - # freed once the resize is known to succeed. _gpuPairs_new = calloc(len(val), sizeof(cydriver.CUcheckpointGpuPair)) if _gpuPairs_new is NULL: raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cydriver.CUcheckpointGpuPair))) @@ -24359,7 +24043,6 @@ cdef class CUcheckpointRestoreArgs_st: string.memcpy(&self._gpuPairs[idx], (val[idx])._pvt_ptr, sizeof(cydriver.CUcheckpointGpuPair)) - @property def gpuPairsCount(self): return self._pvt_ptr[0].gpuPairsCount @@ -24686,10 +24369,7 @@ cdef class anon_struct26: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._device = CUdevice(_ptr=&self._pvt_ptr[0].unicast.device) - def __dealloc__(self): pass def getPtr(self): @@ -24813,14 +24493,13 @@ cdef class CUlogicalEndpointProp_struct: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._unicast = anon_struct26(_ptr=self._pvt_ptr) - - + self._unicast._owner = self self._multicast = anon_struct27(_ptr=self._pvt_ptr) - + self._multicast._owner = self def __dealloc__(self): + self._unicast = None + self._multicast = None if self._val_ptr is not NULL: free(self._val_ptr) def getPtr(self): @@ -25070,10 +24749,7 @@ cdef class CUdevWorkqueueConfigResource_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._device = CUdevice(_ptr=&self._pvt_ptr[0].device) - def __dealloc__(self): pass def getPtr(self): @@ -25332,24 +25008,21 @@ cdef class CUdevResource_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._sm = CUdevSmResource(_ptr=&self._pvt_ptr[0].sm) - - + self._sm._owner = self self._wqConfig = CUdevWorkqueueConfigResource(_ptr=&self._pvt_ptr[0].wqConfig) - - + self._wqConfig._owner = self self._wq = CUdevWorkqueueResource(_ptr=&self._pvt_ptr[0].wq) - + self._wq._owner = self def __dealloc__(self): - if self._val_ptr is not NULL: - free(self._val_ptr) - + self._sm = None + self._wqConfig = None + self._wq = None if self._nextResource is not NULL: free(self._nextResource) self._pvt_ptr[0].nextResource = NULL - + if self._val_ptr is not NULL: + free(self._val_ptr) def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -25457,8 +25130,12 @@ cdef class CUdevResource_st: @property def nextResource(self): - arrs = [self._pvt_ptr[0].nextResource + x*sizeof(cydriver.CUdevResource_st) for x in range(self._nextResource_length)] - return [CUdevResource_st(_ptr=arr) for arr in arrs] + if self._pvt_ptr[0].nextResource == NULL: + return [] + out_nextResource = [CUdevResource_st() for _idx in range(self._nextResource_length)] + for _idx in range(len(out_nextResource)): + string.memcpy(out_nextResource[_idx].getPtr(), &self._pvt_ptr[0].nextResource[_idx], sizeof(cydriver.CUdevResource_st)) + return out_nextResource @nextResource.setter def nextResource(self, val): cdef cydriver.CUdevResource_st* _nextResource_new @@ -25469,10 +25146,6 @@ cdef class CUdevResource_st: self._pvt_ptr[0].nextResource = NULL else: if self._nextResource_length != len(val): - # Allocate and fill a new buffer before touching the - # live state so a failure leaves this object unchanged - # (strong exception guarantee); the old buffer is only - # freed once the resize is known to succeed. _nextResource_new = calloc(len(val), sizeof(cydriver.CUdevResource_st)) if _nextResource_new is NULL: raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cydriver.CUdevResource_st))) @@ -25487,7 +25160,6 @@ cdef class CUdevResource_st: string.memcpy(&self._nextResource[idx], (val[idx])._pvt_ptr, sizeof(cydriver.CUdevResource_st)) - cdef class anon_union21: """ Attributes @@ -25620,11 +25292,10 @@ cdef class CUeglFrame_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._frame = anon_union21(_ptr=self._pvt_ptr) - + self._frame._owner = self def __dealloc__(self): + self._frame = None if self._val_ptr is not NULL: free(self._val_ptr) def getPtr(self): @@ -36431,16 +36102,24 @@ def cuMemPoolGetAttribute(pool, attr not None : CUmemPool_attribute): Parameters ---------- pool : :py:obj:`~.CUmemoryPool` or :py:obj:`~.cudaMemPool_t` - None + The memory pool to get attributes of attr : :py:obj:`~.CUmemPool_attribute` - None + The attribute to get Returns ------- CUresult - + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE` value : Any - None + Retrieved value + + See Also + -------- + :py:obj:`~.cuMemAllocAsync`, :py:obj:`~.cuMemFreeAsync`, :py:obj:`~.cuDeviceGetDefaultMemPool`, :py:obj:`~.cuDeviceGetMemPool`, :py:obj:`~.cuMemPoolCreate` + + Notes + ----- + On devices with a single locality domain, mempools created with :py:obj:`~.CU_MEM_LOCATION_TYPE_DEVICE_LOCALITY_DOMAIN` and localityDomainId 0 are equivalent to full-device mempools created with :py:obj:`~.CU_MEM_LOCATION_TYPE_DEVICE`. The value of this attribute will be -1 for such mempools. """ cdef cydriver.CUmemoryPool cypool if pool is None: @@ -43782,8 +43461,8 @@ def cuLaunchKernel(f, unsigned int gridDimX, unsigned int gridDimY, unsigned int else: pf = int(CUfunction(f)) cyf = pf - cykernelParams = _HelperKernelParams(kernelParams) - cdef void** cykernelParams_ptr = cykernelParams.ckernelParams + cdef _HelperKernelParams cykernelParams = _HelperKernelParams(kernelParams) + cdef void** cykernelParams_ptr = cykernelParams.ckernelParams with nogil: err = cydriver.cuLaunchKernel(cyf, gridDimX, gridDimY, gridDimZ, blockDimX, blockDimY, blockDimZ, sharedMemBytes, cyhStream, cykernelParams_ptr, extra) return (_CUresult(err),) @@ -44020,8 +43699,8 @@ def cuLaunchKernelEx(config : Optional[CUlaunchConfig], f, kernelParams, void_pt pf = int(CUfunction(f)) cyf = pf cdef cydriver.CUlaunchConfig* cyconfig_ptr = config._pvt_ptr if config is not None else NULL - cykernelParams = _HelperKernelParams(kernelParams) - cdef void** cykernelParams_ptr = cykernelParams.ckernelParams + cdef _HelperKernelParams cykernelParams = _HelperKernelParams(kernelParams) + cdef void** cykernelParams_ptr = cykernelParams.ckernelParams with nogil: err = cydriver.cuLaunchKernelEx(cyconfig_ptr, cyf, cykernelParams_ptr, extra) return (_CUresult(err),) @@ -44130,25 +43809,12 @@ def cuLaunchCooperativeKernel(f, unsigned int gridDimX, unsigned int gridDimY, u else: pf = int(CUfunction(f)) cyf = pf - cykernelParams = _HelperKernelParams(kernelParams) - cdef void** cykernelParams_ptr = cykernelParams.ckernelParams + cdef _HelperKernelParams cykernelParams = _HelperKernelParams(kernelParams) + cdef void** cykernelParams_ptr = cykernelParams.ckernelParams with nogil: err = cydriver.cuLaunchCooperativeKernel(cyf, gridDimX, gridDimY, gridDimZ, blockDimX, blockDimY, blockDimZ, sharedMemBytes, cyhStream, cykernelParams_ptr) return (_CUresult(err),) -ctypedef struct cuHostCallbackData_st: - cydriver.CUhostFn callback - void *userData - -ctypedef cuHostCallbackData_st cuHostCallbackData - -@cython.show_performance_hints(False) -cdef void cuHostCallbackWrapper(void *data) nogil: - cdef cuHostCallbackData *cbData = data - with gil: - cbData.callback(cbData.userData) - free(cbData) - @cython.embedsignature(True) def cuLaunchHostFunc(hStream, fn, userData): """ Enqueues a host function call in a stream. @@ -44228,18 +43894,8 @@ def cuLaunchHostFunc(hStream, fn, userData): cyhStream = phStream cdef _HelperInputVoidPtrStruct cyuserDataHelper cdef void* cyuserData = _helper_input_void_ptr(userData, &cyuserDataHelper) - - cdef cuHostCallbackData *cbData = NULL - cbData = malloc(sizeof(cbData[0])) - if cbData == NULL: - return (CUresult.CUDA_ERROR_OUT_OF_MEMORY,) - cbData.callback = cyfn - cbData.userData = cyuserData - with nogil: - err = cydriver.cuLaunchHostFunc(cyhStream, cuHostCallbackWrapper, cbData) - if err != cydriver.CUDA_SUCCESS: - free(cbData) + err = cydriver.cuLaunchHostFunc(cyhStream, cyfn, cyuserData) _helper_input_void_ptr_free(&cyuserDataHelper) return (_CUresult(err),) @@ -47294,7 +46950,7 @@ def cuGraphNodeGetContainingGraph(hNode): ------- CUresult :py:obj:`~.CUDA_SUCCESS` :py:obj:`~.CUDA_ERROR_INVALID_VALUE` - *phGraph : :py:obj:`~.CUgraph` + phGraph : :py:obj:`~.CUgraph` Pointer to return the containing graph See Also @@ -47368,7 +47024,7 @@ def cuGraphNodeGetToolsId(hNode): ------- CUresult :py:obj:`~.CUDA_SUCCESS` :py:obj:`~.CUDA_ERROR_INVALID_VALUE` - *toolsNodeId : unsigned long long + toolsNodeId : unsigned long long Pointer to return the id used by tools See Also @@ -47406,7 +47062,7 @@ def cuGraphGetId(hGraph): ------- CUresult :py:obj:`~.CUDA_SUCCESS` :py:obj:`~.CUDA_ERROR_INVALID_VALUE` - *graphId : unsigned int + graphId : unsigned int Pointer to return the graphId See Also @@ -47444,7 +47100,7 @@ def cuGraphExecGetId(hGraphExec): ------- CUresult :py:obj:`~.CUDA_SUCCESS` :py:obj:`~.CUDA_ERROR_INVALID_VALUE` - *graphId : unsigned int + graphId : unsigned int Pointer to return the graphId See Also @@ -53936,7 +53592,7 @@ def cuGraphicsResourceGetMappedPointer(resource): Returns in `*pDevPtr` a pointer through which the mapped graphics resource `resource` may be accessed. Returns in `pSize` the size of the memory in bytes which may be accessed from that pointer. The value set - in `pPointer` may change every time that `resource` is mapped. + in `pDevPtr` may change every time that `resource` is mapped. If `resource` is not a buffer then it cannot be accessed via a pointer and :py:obj:`~.CUDA_ERROR_NOT_MAPPED_AS_POINTER` is returned. If @@ -53946,16 +53602,20 @@ def cuGraphicsResourceGetMappedPointer(resource): Parameters ---------- resource : :py:obj:`~.CUgraphicsResource` - None + Mapped resource to access Returns ------- CUresult - + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_INVALID_HANDLE`, :py:obj:`~.CUDA_ERROR_NOT_MAPPED`, :py:obj:`~.CUDA_ERROR_NOT_MAPPED_AS_POINTER` pDevPtr : :py:obj:`~.CUdeviceptr` - None + Returned pointer through which `resource` may be accessed pSize : int - None + Returned size of the buffer accessible starting at `*pDevPtr` + + See Also + -------- + :py:obj:`~.cuGraphicsMapResources`, :py:obj:`~.cuGraphicsSubResourceGetMappedArray`, :py:obj:`~.cudaGraphicsResourceGetMappedPointer` """ cdef cydriver.CUgraphicsResource cyresource if resource is None: @@ -57168,18 +56828,22 @@ def cuGraphicsResourceGetMappedEglFrame(resource, unsigned int index, unsigned i Parameters ---------- resource : :py:obj:`~.CUgraphicsResource` - None + Registered resource to access. index : unsigned int - None + Index for cubemap surfaces. mipLevel : unsigned int - None + Mipmap level for the subresource to access. Returns ------- CUresult - + :py:obj:`~.CUDA_SUCCESS`, :py:obj:`~.CUDA_ERROR_DEINITIALIZED`, :py:obj:`~.CUDA_ERROR_NOT_INITIALIZED`, :py:obj:`~.CUDA_ERROR_INVALID_CONTEXT`, :py:obj:`~.CUDA_ERROR_INVALID_VALUE`, :py:obj:`~.CUDA_ERROR_INVALID_HANDLE`, :py:obj:`~.CUDA_ERROR_NOT_MAPPED` eglFrame : :py:obj:`~.CUeglFrame` - None + Returned eglFrame. + + See Also + -------- + :py:obj:`~.cuGraphicsMapResources`, :py:obj:`~.cuGraphicsSubResourceGetMappedArray`, :py:obj:`~.cuGraphicsResourceGetMappedPointer`, :py:obj:`~.cudaGraphicsResourceGetMappedEglFrame` """ cdef cydriver.CUgraphicsResource cyresource if resource is None: diff --git a/cuda_bindings/cuda/bindings/nvfatbin.pyx b/cuda_bindings/cuda/bindings/nvfatbin.pyx index 477026d721e..be8b01f3db4 100644 --- a/cuda_bindings/cuda/bindings/nvfatbin.pyx +++ b/cuda_bindings/cuda/bindings/nvfatbin.pyx @@ -3,7 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 # # This code was automatically generated across versions from 12.4.1 to 13.4.1. Do not modify it directly. -# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=a696e744ee4520d7a8db8937f28c9ae9b92ff208900c1aba6b3dcf866a960e64 +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=a7028b3fc77724f1ea7c5c49302cfe8524b85554b73eaf754231ac9bfc26c0f7 # <<<< PREAMBLE CONTENT >>>> @@ -20,7 +20,9 @@ cdef intptr_t _cyb_get_buffer_pointer(buf, Py_ssize_t size, readonly=True) excep flags |= _cyb_cpython.PyBUF_WRITABLE cdef int status = -1 cdef _cyb_cpython.Py_buffer view - if isinstance(buf, int): + if buf is None: + ptr = 0 + elif isinstance(buf, int): ptr = buf else: try: @@ -31,7 +33,7 @@ cdef intptr_t _cyb_get_buffer_pointer(buf, Py_ssize_t size, readonly=True) excep except Exception as e: adj = "writable " if not readonly else "" raise ValueError( - "buf must be either a Python int representing the pointer " + "buf must be None, a Python int representing the pointer " f"address to a valid buffer, or a 1D contiguous {adj}" f"buffer, of size {size}" ) from e @@ -149,14 +151,13 @@ cpdef intptr_t create(options, size_t options_count) except -1: """nvFatbinCreate creates a new handle. Args: - options (object): An array of strings, each containing a - single option. It can be: + options (object): An array of strings, each containing a single + option. It can be: - an :class:`int` as the pointer address to the nested sequence, or - a Python sequence of :class:`int`\s, each of which is a pointer address to a valid sequence of 'char', or - a nested Python sequence of ``str``. - options_count (size_t): Number of options. Returns: @@ -180,8 +181,8 @@ cpdef add_ptx(intptr_t handle, code, size_t size, arch, identifier, options_cmd_ handle (intptr_t): nvFatbin handle. code (bytes): The PTX code. size (size_t): The size of the PTX code. - arch (str): The numerical architecture that this PTX is for - (the XX of any sm_XX, lto_XX, or compute_XX). + arch (str): The numerical architecture that this PTX is for (the + XX of any sm_XX, lto_XX, or compute_XX). identifier (str): Name of the PTX, useful when extracting the fatbin with tools like cuobjdump. options_cmd_line (str): Options used during JIT compilation. @@ -213,10 +214,10 @@ cpdef add_cubin(intptr_t handle, code, size_t size, arch, identifier): handle (intptr_t): nvFatbin handle. code (bytes): The cubin. size (size_t): The size of the cubin. - arch (str): The numerical architecture that this cubin is for - (the XX of any sm_XX, lto_XX, or compute_XX). - identifier (str): Name of the cubin, useful when extracting - the fatbin with tools like cuobjdump. + arch (str): The numerical architecture that this cubin is for (the + XX of any sm_XX, lto_XX, or compute_XX). + identifier (str): Name of the cubin, useful when extracting the + fatbin with tools like cuobjdump. .. seealso:: `nvFatbinAddCubin` """ @@ -241,10 +242,10 @@ cpdef add_ltoir(intptr_t handle, code, size_t size, arch, identifier, options_cm handle (intptr_t): nvFatbin handle. code (bytes): The LTOIR code. size (size_t): The size of the LTOIR code. - arch (str): The numerical architecture that this LTOIR is for - (the XX of any sm_XX, lto_XX, or compute_XX). - identifier (str): Name of the LTOIR, useful when extracting - the fatbin with tools like cuobjdump. + arch (str): The numerical architecture that this LTOIR is for (the + XX of any sm_XX, lto_XX, or compute_XX). + identifier (str): Name of the LTOIR, useful when extracting the + fatbin with tools like cuobjdump. options_cmd_line (str): Options used during JIT compilation. .. seealso:: `nvFatbinAddLTOIR` @@ -305,7 +306,6 @@ cpdef tuple version(): Returns: A 2-tuple containing: - - unsigned int: The major version. - unsigned int: The minor version. @@ -320,6 +320,17 @@ cpdef tuple version(): cpdef add_index(intptr_t handle, code, size_t size, identifier): + """nvFatbinAddIndex adds an index file to the fatbinary. + + Args: + handle (intptr_t): nvFatbin handle. + code (bytes): The index. + size (size_t): The size of the index. + identifier (str): Name of the index, useful when extracting the + fatbin with tools like cuobjdump. + + .. seealso:: `nvFatbinAddIndex` + """ cdef void* _code_ = _cyb_get_buffer_pointer(code, size, readonly=True) if not isinstance(identifier, str): raise TypeError("identifier must be a Python str") @@ -353,8 +364,8 @@ cpdef add_tile_ir(intptr_t handle, code, size_t size, identifier, options_cmd_li handle (intptr_t): nvFatbin handle. code (bytes): The Tile IR. size (size_t): The size of the Tile IR. - identifier (str): Name of the Tile IR, useful when extracting - the fatbin with tools like cuobjdump. + identifier (str): Name of the Tile IR, useful when extracting the + fatbin with tools like cuobjdump. options_cmd_line (str): Options used during JIT compilation. .. seealso:: `nvFatbinAddTileIR` diff --git a/cuda_bindings/cuda/bindings/nvjitlink.pyx b/cuda_bindings/cuda/bindings/nvjitlink.pyx index 5476ab63c89..475f48dcd98 100644 --- a/cuda_bindings/cuda/bindings/nvjitlink.pyx +++ b/cuda_bindings/cuda/bindings/nvjitlink.pyx @@ -3,7 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 # # This code was automatically generated across versions from 12.0.1 to 13.4.1. Do not modify it directly. -# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=930ba914df7615926a16dd5224f9250eb512e83c1b85e8282470f252706359a8 +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=d783bc46a513ae0becbc9385c3be40ba64809b0fd834e5ed3189b94bd287436d # <<<< PREAMBLE CONTENT >>>> @@ -23,7 +23,9 @@ cdef intptr_t _cyb_get_buffer_pointer(buf, Py_ssize_t size, readonly=True) excep flags |= _cyb_cpython.PyBUF_WRITABLE cdef int status = -1 cdef _cyb_cpython.Py_buffer view - if isinstance(buf, int): + if buf is None: + ptr = 0 + elif isinstance(buf, int): ptr = buf else: try: @@ -34,7 +36,7 @@ cdef intptr_t _cyb_get_buffer_pointer(buf, Py_ssize_t size, readonly=True) excep except Exception as e: adj = "writable " if not readonly else "" raise ValueError( - "buf must be either a Python int representing the pointer " + "buf must be None, a Python int representing the pointer " f"address to a valid buffer, or a 1D contiguous {adj}" f"buffer, of size {size}" ) from e @@ -150,17 +152,17 @@ cpdef destroy(intptr_t handle): cpdef intptr_t create(uint32_t num_options, options) except -1: """nvJitLinkCreate creates an instance of ``nvJitLinkHandle`` with the given input options, and sets the output parameter ``handle``. + It supports options listed in ``Supported Link Options``. + Args: num_options (uint32_t): Number of options passed. - options (object): Array of size ``num_options`` of option - strings. It can be: + options (object): Array of size ``num_options`` of option strings. It can be: - an :class:`int` as the pointer address to the nested sequence, or - a Python sequence of :class:`int`\s, each of which is a pointer address to a valid sequence of 'char', or - a nested Python sequence of ``str``. - Returns: intptr_t: Address of nvJitLink handle. @@ -178,6 +180,7 @@ cpdef intptr_t create(uint32_t num_options, options) except -1: cpdef add_data(intptr_t handle, int input_type, data, size_t size, name): """nvJitLinkAddData adds data image to the link. + Args: handle (intptr_t): nvJitLink handle. input_type (InputType): kind of input. @@ -200,6 +203,7 @@ cpdef add_data(intptr_t handle, int input_type, data, size_t size, name): cpdef add_file(intptr_t handle, int input_type, file_name): """nvJitLinkAddFile reads data from file and links it in. + Args: handle (intptr_t): nvJitLink handle. input_type (InputType): kind of input. @@ -219,6 +223,7 @@ cpdef add_file(intptr_t handle, int input_type, file_name): cpdef complete(intptr_t handle): """nvJitLinkComplete does the actual link. + Args: handle (intptr_t): nvJitLink handle. @@ -232,6 +237,7 @@ cpdef complete(intptr_t handle): cpdef size_t get_linked_cubin_size(intptr_t handle) except? 0: """nvJitLinkGetLinkedCubinSize gets the size of the linked cubin. + Args: handle (intptr_t): nvJitLink handle. @@ -250,6 +256,8 @@ cpdef size_t get_linked_cubin_size(intptr_t handle) except? 0: cpdef get_linked_cubin(intptr_t handle, cubin): """nvJitLinkGetLinkedCubin gets the linked cubin. + User is responsible for allocating enough space to hold the ``cubin``. + Args: handle (intptr_t): nvJitLink handle. cubin (bytes): The linked cubin. @@ -265,6 +273,8 @@ cpdef get_linked_cubin(intptr_t handle, cubin): cpdef size_t get_linked_ptx_size(intptr_t handle) except? 0: """nvJitLinkGetLinkedPtxSize gets the size of the linked ptx. + Linked PTX is only available when using the ``-lto`` option. + Args: handle (intptr_t): nvJitLink handle. @@ -283,6 +293,9 @@ cpdef size_t get_linked_ptx_size(intptr_t handle) except? 0: cpdef get_linked_ptx(intptr_t handle, ptx): """nvJitLinkGetLinkedPtx gets the linked ptx. + Linked PTX is only available when using the ``-lto`` option. User is + responsible for allocating enough space to hold the ``ptx``. + Args: handle (intptr_t): nvJitLink handle. ptx (bytes): The linked PTX. @@ -298,6 +311,7 @@ cpdef get_linked_ptx(intptr_t handle, ptx): cpdef size_t get_error_log_size(intptr_t handle) except? 0: """nvJitLinkGetErrorLogSize gets the size of the error log. + Args: handle (intptr_t): nvJitLink handle. @@ -316,6 +330,8 @@ cpdef size_t get_error_log_size(intptr_t handle) except? 0: cpdef get_error_log(intptr_t handle, log): """nvJitLinkGetErrorLog puts any error messages in the log. + User is responsible for allocating enough space to hold the ``log``. + Args: handle (intptr_t): nvJitLink handle. log (bytes): The error log. @@ -331,6 +347,7 @@ cpdef get_error_log(intptr_t handle, log): cpdef size_t get_info_log_size(intptr_t handle) except? 0: """nvJitLinkGetInfoLogSize gets the size of the info log. + Args: handle (intptr_t): nvJitLink handle. @@ -349,6 +366,8 @@ cpdef size_t get_info_log_size(intptr_t handle) except? 0: cpdef get_info_log(intptr_t handle, log): """nvJitLinkGetInfoLog puts any info messages in the log. + User is responsible for allocating enough space to hold the ``log``. + Args: handle (intptr_t): nvJitLink handle. log (bytes): The info log. @@ -364,9 +383,9 @@ cpdef get_info_log(intptr_t handle, log): cpdef tuple version(): """nvJitLinkVersion returns the current version of nvJitLink. + Returns: A 2-tuple containing: - - unsigned int: The major version. - unsigned int: The minor version. @@ -383,6 +402,9 @@ cpdef tuple version(): cpdef size_t get_linked_ltoir_size(intptr_t handle) except? 0: """nvJitLinkGetLinkedLTOIRSize gets the size of the linked LTOIR. + Linked LTOIR is only available when using the ``-lto`` option. The returned + data is in LTOIR Container format (not raw bitcode). + Args: handle (intptr_t): nvJitLink handle. @@ -401,6 +423,10 @@ cpdef size_t get_linked_ltoir_size(intptr_t handle) except? 0: cpdef get_linked_ltoir(intptr_t handle, ltoir): """nvJitLinkGetLinkedLTOIR gets the linked LTOIR. + Linked LTOIR is only available when using the ``-lto`` option. User is + responsible for allocating enough space to hold the ``ltoir``. The returned + data is in LTOIR Container format (not raw bitcode). + Args: handle (intptr_t): nvJitLink handle. ltoir (bytes): The linked LTOIR in Container format. diff --git a/cuda_bindings/cuda/bindings/nvml.pxd b/cuda_bindings/cuda/bindings/nvml.pxd index 6f35132912f..cfda90b966a 100644 --- a/cuda_bindings/cuda/bindings/nvml.pxd +++ b/cuda_bindings/cuda/bindings/nvml.pxd @@ -3,7 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 # # This code was automatically generated across versions from 12.9.1 to 13.4.1. Do not modify it directly. -# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=635b329217b9c57fce06de4ffd743372a120b5039eb247f49205bd4d2baf663c +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=8d1afafeb9369977927ce07c70187f6f0927eb5f556b6f4e3569d6ce58980e7a @@ -62,7 +62,6 @@ ctypedef nvmlUnrepairableMemoryStatus_v1_t UnrepairableMemoryStatus_v1 ctypedef nvmlRusdSettings_v1_t RusdSettings_v1 ctypedef nvmlPowerValue_v2_t PowerValue_v2 ctypedef nvmlVgpuTypeMaxInstance_v1_t VgpuTypeMaxInstance_v1 -ctypedef nvmlVgpuProcessUtilizationSample_t VgpuProcessUtilizationSample ctypedef nvmlGpuFabricInfo_t GpuFabricInfo ctypedef nvmlSystemEventSetCreateRequest_v1_t SystemEventSetCreateRequest_v1 ctypedef nvmlSystemEventSetFreeRequest_v1_t SystemEventSetFreeRequest_v1 @@ -168,6 +167,7 @@ cpdef int system_get_cuda_driver_version() except * cpdef int system_get_cuda_driver_version_v2() except 0 cpdef str system_get_process_name(unsigned int pid) cpdef object system_get_hic_version() +cpdef object system_get_topology_gpu_set(unsigned int cpu_number) cpdef unsigned int unit_get_count() except? 0 cpdef intptr_t unit_get_handle_by_index(unsigned int index) except? 0 cpdef object unit_get_unit_info(intptr_t unit) @@ -175,6 +175,7 @@ cpdef object unit_get_led_state(intptr_t unit) cpdef object unit_get_psu_info(intptr_t unit) cpdef unsigned int unit_get_temperature(intptr_t unit, unsigned int type) except? 0 cpdef object unit_get_fan_speed_info(intptr_t unit) +cpdef object unit_get_devices(intptr_t unit) cpdef unsigned int device_get_count_v2() except? 0 cpdef object device_get_attributes_v2(intptr_t device) cpdef intptr_t device_get_handle_by_index_v2(unsigned int index) except? 0 @@ -194,6 +195,7 @@ cpdef device_set_cpu_affinity(intptr_t device) cpdef device_clear_cpu_affinity(intptr_t device) cpdef unsigned int device_get_numa_node_id(intptr_t device) except? 0 cpdef int device_get_topology_common_ancestor(intptr_t device1, intptr_t device2) except? -1 +cpdef object device_get_topology_nearest_gpus(intptr_t device, int level) cpdef int device_get_p2p_status(intptr_t device1, intptr_t device2, int p2p_index) except? -1 cpdef str device_get_uuid(intptr_t device) cpdef unsigned int device_get_minor_number(intptr_t device) except? 0 @@ -241,7 +243,7 @@ cpdef int device_get_mem_clk_vf_offset(intptr_t device) except? 0 cpdef tuple device_get_min_max_clock_of_p_state(intptr_t device, int type, int pstate) cpdef tuple device_get_gpc_clk_min_max_vf_offset(intptr_t device) cpdef tuple device_get_mem_clk_min_max_vf_offset(intptr_t device) -cpdef device_set_clock_offsets(intptr_t device, intptr_t info) +cpdef device_set_clock_offsets(intptr_t device, info) cpdef unsigned int device_get_power_management_limit(intptr_t device) except? 0 cpdef tuple device_get_power_management_limit_constraints(intptr_t device) cpdef unsigned int device_get_power_management_default_limit(intptr_t device) except? 0 @@ -276,6 +278,7 @@ cpdef object device_get_graphics_running_processes_v3(intptr_t device) cpdef object device_get_mps_compute_running_processes_v3(intptr_t device) cpdef int device_on_same_board(intptr_t device1, intptr_t device2) except? 0 cpdef int device_get_api_restriction(intptr_t device, int api_type) except? -1 +cpdef tuple device_get_samples(intptr_t device, int type, unsigned long long last_seen_time_stamp) cpdef object device_get_bar1_memory_info(intptr_t device) cpdef unsigned int device_get_irq_num(intptr_t device) except? 0 cpdef unsigned int device_get_num_gpu_cores(intptr_t device) except? 0 @@ -302,6 +305,7 @@ cpdef object device_get_accounting_stats(intptr_t device, unsigned int pid) cpdef object device_get_accounting_pids(intptr_t device) cpdef unsigned int device_get_accounting_buffer_size(intptr_t device) except? 0 cpdef object device_get_retired_pages(intptr_t device, int cause) +cpdef tuple device_get_retired_pages_v2(intptr_t device, int cause) cpdef int device_get_retired_pages_pending_status(intptr_t device) except? -1 cpdef tuple device_get_remapped_rows(intptr_t device) cpdef object device_get_row_remapper_histogram(intptr_t device) @@ -338,16 +342,16 @@ cpdef system_set_nvlink_bw_mode(unsigned int nvlink_bw_mode) cpdef unsigned int system_get_nvlink_bw_mode() except? 0 cpdef object device_get_nvlink_supported_bw_modes(intptr_t device) cpdef object device_get_nvlink_bw_mode(intptr_t device) -cpdef device_set_nvlink_bw_mode(intptr_t device, intptr_t set_bw_mode) +cpdef device_set_nvlink_bw_mode(intptr_t device, set_bw_mode) cpdef intptr_t event_set_create() except? 0 cpdef device_register_events(intptr_t device, unsigned long long event_types, intptr_t set) cpdef unsigned long long device_get_supported_event_types(intptr_t device) except? 0 cpdef object event_set_wait_v2(intptr_t set, unsigned int timeoutms) cpdef event_set_free(intptr_t set) -cpdef device_modify_drain_state(intptr_t pci_info, int new_state) -cpdef int device_query_drain_state(intptr_t pci_info) except? -1 -cpdef device_remove_gpu_v2(intptr_t pci_info, int gpu_state, int link_state) -cpdef device_discover_gpus(intptr_t pci_info) +cpdef device_modify_drain_state(pci_info, int new_state) +cpdef int device_query_drain_state(pci_info) except? -1 +cpdef device_remove_gpu_v2(pci_info, int gpu_state, int link_state) +cpdef device_discover_gpus(pci_info) cpdef int device_get_virtualization_mode(intptr_t device) except? -1 cpdef int device_get_host_vgpu_mode(intptr_t device) except? -1 cpdef device_set_virtualization_mode(intptr_t device, int virtual_mode) @@ -357,6 +361,8 @@ cpdef device_set_vgpu_capabilities(intptr_t device, int capability, int state) cpdef object device_get_grid_licensable_features_v4(intptr_t device) cpdef unsigned int get_vgpu_driver_capabilities(int capability) except? 0 cpdef unsigned int device_get_vgpu_capabilities(intptr_t device, int capability) except? 0 +cpdef object device_get_supported_vgpus(intptr_t device) +cpdef object device_get_creatable_vgpus(intptr_t device) cpdef str vgpu_type_get_class(unsigned int vgpu_type_id) cpdef unsigned int vgpu_type_get_gpu_instance_profile_id(unsigned int vgpu_type_id) except? 0 cpdef tuple vgpu_type_get_device_id(unsigned int vgpu_type_id) @@ -368,6 +374,8 @@ cpdef unsigned int vgpu_type_get_frame_rate_limit(unsigned int vgpu_type_id) exc cpdef unsigned int vgpu_type_get_max_instances(intptr_t device, unsigned int vgpu_type_id) except? 0 cpdef unsigned int vgpu_type_get_max_instances_per_vm(unsigned int vgpu_type_id) except? 0 cpdef object vgpu_type_get_bar1_info(unsigned int vgpu_type_id) +cpdef object device_get_active_vgpus(intptr_t device) +cpdef tuple vgpu_instance_get_vm_id(unsigned int vgpu_instance) cpdef str vgpu_instance_get_uuid(unsigned int vgpu_instance) cpdef str vgpu_instance_get_vm_driver_version(unsigned int vgpu_instance) cpdef unsigned long long vgpu_instance_get_fb_usage(unsigned int vgpu_instance) except? 0 @@ -385,7 +393,7 @@ cpdef unsigned int vgpu_instance_get_gpu_instance_id(unsigned int vgpu_instance) cpdef str vgpu_instance_get_gpu_pci_id(unsigned int vgpu_instance) cpdef unsigned int vgpu_type_get_capabilities(unsigned int vgpu_type_id, int capability) except? 0 cpdef str vgpu_instance_get_mdev_uuid(unsigned int vgpu_instance) -cpdef gpu_instance_set_vgpu_scheduler_state(intptr_t gpu_instance, intptr_t p_scheduler) +cpdef gpu_instance_set_vgpu_scheduler_state(intptr_t gpu_instance, p_scheduler) cpdef object gpu_instance_get_vgpu_scheduler_state(intptr_t gpu_instance) cpdef object gpu_instance_get_vgpu_scheduler_log(intptr_t gpu_instance) cpdef str device_get_pgpu_metadata_string(intptr_t device) @@ -393,8 +401,10 @@ cpdef object device_get_vgpu_scheduler_log(intptr_t device) cpdef object device_get_vgpu_scheduler_state(intptr_t device) cpdef object device_get_vgpu_scheduler_capabilities(intptr_t device) cpdef device_set_vgpu_scheduler_state(intptr_t device, intptr_t p_scheduler_state) -cpdef set_vgpu_version(intptr_t vgpu_version) -cpdef tuple device_get_vgpu_process_utilization(intptr_t device, unsigned long long last_seen_time_stamp) +cpdef tuple get_vgpu_version() +cpdef set_vgpu_version(vgpu_version) +cpdef tuple device_get_vgpu_utilization(intptr_t device, unsigned long long last_seen_time_stamp) +cpdef object device_get_vgpu_process_utilization(intptr_t device, unsigned long long last_seen_time_stamp) cpdef int vgpu_instance_get_accounting_mode(unsigned int vgpu_instance) except? -1 cpdef object vgpu_instance_get_accounting_pids(unsigned int vgpu_instance) cpdef object vgpu_instance_get_accounting_stats(unsigned int vgpu_instance, unsigned int pid) @@ -407,7 +417,7 @@ cpdef tuple device_get_mig_mode(intptr_t device) cpdef object device_get_gpu_instance_possible_placements_v2(intptr_t device, unsigned int profile_id) cpdef unsigned int device_get_gpu_instance_remaining_capacity(intptr_t device, unsigned int profile_id) except? 0 cpdef intptr_t device_create_gpu_instance(intptr_t device, unsigned int profile_id) except? 0 -cpdef intptr_t device_create_gpu_instance_with_placement(intptr_t device, unsigned int profile_id, intptr_t placement) except? 0 +cpdef intptr_t device_create_gpu_instance_with_placement(intptr_t device, unsigned int profile_id, placement) except? 0 cpdef gpu_instance_destroy(intptr_t gpu_instance) cpdef intptr_t device_get_gpu_instance_by_id(intptr_t device, unsigned int id) except? 0 cpdef object gpu_instance_get_info(intptr_t gpu_instance) @@ -415,7 +425,7 @@ cpdef object gpu_instance_get_compute_instance_profile_info_v(intptr_t gpu_insta cpdef unsigned int gpu_instance_get_compute_instance_remaining_capacity(intptr_t gpu_instance, unsigned int profile_id) except? 0 cpdef object gpu_instance_get_compute_instance_possible_placements(intptr_t gpu_instance, unsigned int profile_id) cpdef intptr_t gpu_instance_create_compute_instance(intptr_t gpu_instance, unsigned int profile_id) except? 0 -cpdef intptr_t gpu_instance_create_compute_instance_with_placement(intptr_t gpu_instance, unsigned int profile_id, intptr_t placement) except? 0 +cpdef intptr_t gpu_instance_create_compute_instance_with_placement(intptr_t gpu_instance, unsigned int profile_id, placement) except? 0 cpdef compute_instance_destroy(intptr_t compute_instance) cpdef intptr_t gpu_instance_get_compute_instance_by_id(intptr_t gpu_instance, unsigned int id) except? 0 cpdef object compute_instance_get_info_v2(intptr_t compute_instance) @@ -431,26 +441,26 @@ cpdef device_power_smoothing_set_state(intptr_t device, intptr_t state) cpdef object device_get_addressing_mode(intptr_t device) cpdef object device_get_repair_status(intptr_t device) cpdef object device_get_power_mizer_mode_v1(intptr_t device) -cpdef device_set_power_mizer_mode_v1(intptr_t device, intptr_t power_mizer_mode) +cpdef device_set_power_mizer_mode_v1(intptr_t device, power_mizer_mode) cpdef device_vgpu_force_gsp_unload(intptr_t device) cpdef object device_get_vgpu_scheduler_state_v2(intptr_t device) cpdef object gpu_instance_get_vgpu_scheduler_state_v2(intptr_t gpu_instance) cpdef object device_get_vgpu_scheduler_log_v2(intptr_t device) cpdef object gpu_instance_get_vgpu_scheduler_log_v2(intptr_t gpu_instance) -cpdef device_set_vgpu_scheduler_state_v2(intptr_t device, intptr_t p_scheduler_state) -cpdef gpu_instance_set_vgpu_scheduler_state_v2(intptr_t gpu_instance, intptr_t p_scheduler_state) +cpdef device_set_vgpu_scheduler_state_v2(intptr_t device, p_scheduler_state) +cpdef gpu_instance_set_vgpu_scheduler_state_v2(intptr_t gpu_instance, p_scheduler_state) cpdef object system_get_cper_v1() cpdef object device_get_bbx_time_data_v1(intptr_t device) cpdef object device_get_accounting_stats_v2(intptr_t device) cpdef object device_get_remapped_rows_v2(intptr_t device) cpdef device_set_adaptive_tgp_mode_v1(intptr_t device, int mode) cpdef object device_get_adaptive_tgp_mode_info_v1(intptr_t device) -cpdef device_set_memory_limits_v1(intptr_t device, intptr_t limits) +cpdef device_set_memory_limits_v1(intptr_t device, limits) cpdef object device_get_memory_limits_v1(intptr_t device) cpdef object device_get_gpu_fabric_info_v4(intptr_t device) cpdef object device_perf_metrics_get_samples_v1(intptr_t device) cpdef object device_set_nvlink_bw_mode_async_v1(intptr_t device) cpdef object device_get_nv_link_telemetry_samples_v1(intptr_t device) -cpdef event_set_register_gpu_operational_events_v1(intptr_t event_set, intptr_t config) +cpdef event_set_register_gpu_operational_events_v1(intptr_t event_set, config) cpdef object event_set_get_context_count_v1(intptr_t set) cpdef object device_get_bank_remapper_status_v1(intptr_t device) diff --git a/cuda_bindings/cuda/bindings/nvml.pyx b/cuda_bindings/cuda/bindings/nvml.pyx index 9f0d104abba..4a3c2ca260b 100644 --- a/cuda_bindings/cuda/bindings/nvml.pyx +++ b/cuda_bindings/cuda/bindings/nvml.pyx @@ -3,13 +3,19 @@ # SPDX-License-Identifier: Apache-2.0 # # This code was automatically generated across versions from 12.9.1 to 13.4.1. Do not modify it directly. -# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=7447d022b0937ff32b98e8a8a6f0a3e0564884c4a217b51e9312290015c7a406 +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=341606be9fe4e6d759ff42b1ac1e10ac2e68e9412f550de5781e57183e218297 # <<<< PREAMBLE CONTENT >>>> cimport cpython as _cyb_cpython cimport cpython.buffer as _cyb_cpython_buffer +from cpython.buffer cimport ( + PyBUF_SIMPLE as _cyb_PyBUF_SIMPLE, + PyBuffer_Release as _cyb_PyBuffer_Release, + PyObject_GetBuffer as _cyb_PyObject_GetBuffer, + Py_buffer as _cyb_Py_buffer, +) cimport cpython.memoryview as _cyb_cpython_memoryview from cython cimport view as _cyb_view from libc.stdint cimport intptr_t @@ -21,6 +27,7 @@ from libc.stdlib cimport ( from libc.string cimport ( memcmp as _cyb_memcmp, memcpy as _cyb_memcpy, + memmove as _cyb_memmove, ) from cuda.bindings._internal._fast_enum import FastEnum as _cyb_FastEnum @@ -49,7 +56,7 @@ cdef _cyb_from_buffer(buffer, size, lowpp_type): raise ValueError("buffer itemsize must be 1 byte") if view.len != size: raise ValueError(f"buffer length must be {size} bytes") - return lowpp_type.from_ptr(view.buf, not view.readonly, buffer) + return lowpp_type.from_ptr(view.buf, view.readonly != 0, buffer) finally: _cyb_cpython.PyBuffer_Release(&view) @@ -95,8 +102,10 @@ class BridgeChipType(_cyb_FastEnum): See `nvmlBridgeChipType_t`. """ - BRIDGE_CHIP_PLX = NVML_BRIDGE_CHIP_PLX - BRIDGE_CHIP_BRO4 = NVML_BRIDGE_CHIP_BRO4 + PLX = NVML_BRIDGE_CHIP_PLX + BRIDGE_CHIP_PLX = PLX # backward-compat alias + BRO4 = NVML_BRIDGE_CHIP_BRO4 + BRIDGE_CHIP_BRO4 = BRO4 # backward-compat alias class NvLinkUtilizationCountUnits(_cyb_FastEnum): """ @@ -104,11 +113,16 @@ class NvLinkUtilizationCountUnits(_cyb_FastEnum): See `nvmlNvLinkUtilizationCountUnits_t`. """ - NVLINK_COUNTER_UNIT_CYCLES = NVML_NVLINK_COUNTER_UNIT_CYCLES - NVLINK_COUNTER_UNIT_PACKETS = NVML_NVLINK_COUNTER_UNIT_PACKETS - NVLINK_COUNTER_UNIT_BYTES = NVML_NVLINK_COUNTER_UNIT_BYTES - NVLINK_COUNTER_UNIT_RESERVED = NVML_NVLINK_COUNTER_UNIT_RESERVED - NVLINK_COUNTER_UNIT_COUNT = NVML_NVLINK_COUNTER_UNIT_COUNT + CYCLES = NVML_NVLINK_COUNTER_UNIT_CYCLES + NVLINK_COUNTER_UNIT_CYCLES = CYCLES # backward-compat alias + PACKETS = NVML_NVLINK_COUNTER_UNIT_PACKETS + NVLINK_COUNTER_UNIT_PACKETS = PACKETS # backward-compat alias + BYTES = NVML_NVLINK_COUNTER_UNIT_BYTES + NVLINK_COUNTER_UNIT_BYTES = BYTES # backward-compat alias + RESERVED = NVML_NVLINK_COUNTER_UNIT_RESERVED + NVLINK_COUNTER_UNIT_RESERVED = RESERVED # backward-compat alias + COUNT = NVML_NVLINK_COUNTER_UNIT_COUNT + NVLINK_COUNTER_UNIT_COUNT = COUNT # backward-compat alias class NvLinkUtilizationCountPktTypes(_cyb_FastEnum): """ @@ -119,15 +133,24 @@ class NvLinkUtilizationCountPktTypes(_cyb_FastEnum): See `nvmlNvLinkUtilizationCountPktTypes_t`. """ - NVLINK_COUNTER_PKTFILTER_NOP = NVML_NVLINK_COUNTER_PKTFILTER_NOP - NVLINK_COUNTER_PKTFILTER_READ = NVML_NVLINK_COUNTER_PKTFILTER_READ - NVLINK_COUNTER_PKTFILTER_WRITE = NVML_NVLINK_COUNTER_PKTFILTER_WRITE - NVLINK_COUNTER_PKTFILTER_RATOM = NVML_NVLINK_COUNTER_PKTFILTER_RATOM - NVLINK_COUNTER_PKTFILTER_NRATOM = NVML_NVLINK_COUNTER_PKTFILTER_NRATOM - NVLINK_COUNTER_PKTFILTER_FLUSH = NVML_NVLINK_COUNTER_PKTFILTER_FLUSH - NVLINK_COUNTER_PKTFILTER_RESPDATA = NVML_NVLINK_COUNTER_PKTFILTER_RESPDATA - NVLINK_COUNTER_PKTFILTER_RESPNODATA = NVML_NVLINK_COUNTER_PKTFILTER_RESPNODATA - NVLINK_COUNTER_PKTFILTER_ALL = NVML_NVLINK_COUNTER_PKTFILTER_ALL + NOP = NVML_NVLINK_COUNTER_PKTFILTER_NOP + NVLINK_COUNTER_PKTFILTER_NOP = NOP # backward-compat alias + READ = NVML_NVLINK_COUNTER_PKTFILTER_READ + NVLINK_COUNTER_PKTFILTER_READ = READ # backward-compat alias + WRITE = NVML_NVLINK_COUNTER_PKTFILTER_WRITE + NVLINK_COUNTER_PKTFILTER_WRITE = WRITE # backward-compat alias + RATOM = NVML_NVLINK_COUNTER_PKTFILTER_RATOM + NVLINK_COUNTER_PKTFILTER_RATOM = RATOM # backward-compat alias + NRATOM = NVML_NVLINK_COUNTER_PKTFILTER_NRATOM + NVLINK_COUNTER_PKTFILTER_NRATOM = NRATOM # backward-compat alias + FLUSH = NVML_NVLINK_COUNTER_PKTFILTER_FLUSH + NVLINK_COUNTER_PKTFILTER_FLUSH = FLUSH # backward-compat alias + RESPDATA = NVML_NVLINK_COUNTER_PKTFILTER_RESPDATA + NVLINK_COUNTER_PKTFILTER_RESPDATA = RESPDATA # backward-compat alias + RESPNODATA = NVML_NVLINK_COUNTER_PKTFILTER_RESPNODATA + NVLINK_COUNTER_PKTFILTER_RESPNODATA = RESPNODATA # backward-compat alias + ALL = NVML_NVLINK_COUNTER_PKTFILTER_ALL + NVLINK_COUNTER_PKTFILTER_ALL = ALL # backward-compat alias class NvLinkCapability(_cyb_FastEnum): """ @@ -135,13 +158,20 @@ class NvLinkCapability(_cyb_FastEnum): See `nvmlNvLinkCapability_t`. """ - NVLINK_CAP_P2P_SUPPORTED = NVML_NVLINK_CAP_P2P_SUPPORTED - NVLINK_CAP_SYSMEM_ACCESS = NVML_NVLINK_CAP_SYSMEM_ACCESS - NVLINK_CAP_P2P_ATOMICS = NVML_NVLINK_CAP_P2P_ATOMICS - NVLINK_CAP_SYSMEM_ATOMICS = NVML_NVLINK_CAP_SYSMEM_ATOMICS - NVLINK_CAP_SLI_BRIDGE = NVML_NVLINK_CAP_SLI_BRIDGE - NVLINK_CAP_VALID = NVML_NVLINK_CAP_VALID - NVLINK_CAP_COUNT = NVML_NVLINK_CAP_COUNT + P2P_SUPPORTED = NVML_NVLINK_CAP_P2P_SUPPORTED + NVLINK_CAP_P2P_SUPPORTED = P2P_SUPPORTED # backward-compat alias + SYSMEM_ACCESS = NVML_NVLINK_CAP_SYSMEM_ACCESS + NVLINK_CAP_SYSMEM_ACCESS = SYSMEM_ACCESS # backward-compat alias + P2P_ATOMICS = NVML_NVLINK_CAP_P2P_ATOMICS + NVLINK_CAP_P2P_ATOMICS = P2P_ATOMICS # backward-compat alias + SYSMEM_ATOMICS = NVML_NVLINK_CAP_SYSMEM_ATOMICS + NVLINK_CAP_SYSMEM_ATOMICS = SYSMEM_ATOMICS # backward-compat alias + SLI_BRIDGE = NVML_NVLINK_CAP_SLI_BRIDGE + NVLINK_CAP_SLI_BRIDGE = SLI_BRIDGE # backward-compat alias + VALID = NVML_NVLINK_CAP_VALID + NVLINK_CAP_VALID = VALID # backward-compat alias + COUNT = NVML_NVLINK_CAP_COUNT + NVLINK_CAP_COUNT = COUNT # backward-compat alias class NvLinkErrorCounter(_cyb_FastEnum): """ @@ -149,12 +179,18 @@ class NvLinkErrorCounter(_cyb_FastEnum): See `nvmlNvLinkErrorCounter_t`. """ - NVLINK_ERROR_DL_REPLAY = NVML_NVLINK_ERROR_DL_REPLAY - NVLINK_ERROR_DL_RECOVERY = NVML_NVLINK_ERROR_DL_RECOVERY - NVLINK_ERROR_DL_CRC_FLIT = NVML_NVLINK_ERROR_DL_CRC_FLIT - NVLINK_ERROR_DL_CRC_DATA = NVML_NVLINK_ERROR_DL_CRC_DATA - NVLINK_ERROR_DL_ECC_DATA = NVML_NVLINK_ERROR_DL_ECC_DATA - NVLINK_ERROR_COUNT = NVML_NVLINK_ERROR_COUNT + DL_REPLAY = NVML_NVLINK_ERROR_DL_REPLAY + NVLINK_ERROR_DL_REPLAY = DL_REPLAY # backward-compat alias + DL_RECOVERY = NVML_NVLINK_ERROR_DL_RECOVERY + NVLINK_ERROR_DL_RECOVERY = DL_RECOVERY # backward-compat alias + DL_CRC_FLIT = NVML_NVLINK_ERROR_DL_CRC_FLIT + NVLINK_ERROR_DL_CRC_FLIT = DL_CRC_FLIT # backward-compat alias + DL_CRC_DATA = NVML_NVLINK_ERROR_DL_CRC_DATA + NVLINK_ERROR_DL_CRC_DATA = DL_CRC_DATA # backward-compat alias + DL_ECC_DATA = NVML_NVLINK_ERROR_DL_ECC_DATA + NVLINK_ERROR_DL_ECC_DATA = DL_ECC_DATA # backward-compat alias + COUNT = NVML_NVLINK_ERROR_COUNT + NVLINK_ERROR_COUNT = COUNT # backward-compat alias class IntNvLinkDeviceType(_cyb_FastEnum): """ @@ -162,10 +198,14 @@ class IntNvLinkDeviceType(_cyb_FastEnum): See `nvmlIntNvLinkDeviceType_t`. """ - NVLINK_DEVICE_TYPE_GPU = NVML_NVLINK_DEVICE_TYPE_GPU - NVLINK_DEVICE_TYPE_IBMNPU = NVML_NVLINK_DEVICE_TYPE_IBMNPU - NVLINK_DEVICE_TYPE_SWITCH = NVML_NVLINK_DEVICE_TYPE_SWITCH - NVLINK_DEVICE_TYPE_UNKNOWN = NVML_NVLINK_DEVICE_TYPE_UNKNOWN + GPU = NVML_NVLINK_DEVICE_TYPE_GPU + NVLINK_DEVICE_TYPE_GPU = GPU # backward-compat alias + IBMNPU = NVML_NVLINK_DEVICE_TYPE_IBMNPU + NVLINK_DEVICE_TYPE_IBMNPU = IBMNPU # backward-compat alias + SWITCH = NVML_NVLINK_DEVICE_TYPE_SWITCH + NVLINK_DEVICE_TYPE_SWITCH = SWITCH # backward-compat alias + UNKNOWN = NVML_NVLINK_DEVICE_TYPE_UNKNOWN + NVLINK_DEVICE_TYPE_UNKNOWN = UNKNOWN # backward-compat alias class GpuTopologyLevel(_cyb_FastEnum): """ @@ -174,37 +214,58 @@ class GpuTopologyLevel(_cyb_FastEnum): See `nvmlGpuTopologyLevel_t`. """ - TOPOLOGY_INTERNAL = NVML_TOPOLOGY_INTERNAL - TOPOLOGY_SINGLE = NVML_TOPOLOGY_SINGLE - TOPOLOGY_MULTIPLE = NVML_TOPOLOGY_MULTIPLE - TOPOLOGY_HOSTBRIDGE = NVML_TOPOLOGY_HOSTBRIDGE - TOPOLOGY_NODE = NVML_TOPOLOGY_NODE - TOPOLOGY_SYSTEM = NVML_TOPOLOGY_SYSTEM + INTERNAL = NVML_TOPOLOGY_INTERNAL + TOPOLOGY_INTERNAL = INTERNAL # backward-compat alias + SINGLE = NVML_TOPOLOGY_SINGLE + TOPOLOGY_SINGLE = SINGLE # backward-compat alias + MULTIPLE = NVML_TOPOLOGY_MULTIPLE + TOPOLOGY_MULTIPLE = MULTIPLE # backward-compat alias + HOSTBRIDGE = NVML_TOPOLOGY_HOSTBRIDGE + TOPOLOGY_HOSTBRIDGE = HOSTBRIDGE # backward-compat alias + NODE = NVML_TOPOLOGY_NODE + TOPOLOGY_NODE = NODE # backward-compat alias + SYSTEM = NVML_TOPOLOGY_SYSTEM + TOPOLOGY_SYSTEM = SYSTEM # backward-compat alias class GpuP2PStatus(_cyb_FastEnum): """ See `nvmlGpuP2PStatus_t`. """ - P2P_STATUS_OK = NVML_P2P_STATUS_OK - P2P_STATUS_CHIPSET_NOT_SUPPORED = NVML_P2P_STATUS_CHIPSET_NOT_SUPPORED - P2P_STATUS_CHIPSET_NOT_SUPPORTED = NVML_P2P_STATUS_CHIPSET_NOT_SUPPORTED - P2P_STATUS_GPU_NOT_SUPPORTED = NVML_P2P_STATUS_GPU_NOT_SUPPORTED - P2P_STATUS_IOH_TOPOLOGY_NOT_SUPPORTED = NVML_P2P_STATUS_IOH_TOPOLOGY_NOT_SUPPORTED - P2P_STATUS_DISABLED_BY_REGKEY = NVML_P2P_STATUS_DISABLED_BY_REGKEY - P2P_STATUS_NOT_SUPPORTED = NVML_P2P_STATUS_NOT_SUPPORTED - P2P_STATUS_UNKNOWN = NVML_P2P_STATUS_UNKNOWN + OK = NVML_P2P_STATUS_OK + P2P_STATUS_OK = OK # backward-compat alias + CHIPSET_NOT_SUPPORED = NVML_P2P_STATUS_CHIPSET_NOT_SUPPORED + P2P_STATUS_CHIPSET_NOT_SUPPORED = CHIPSET_NOT_SUPPORED # backward-compat alias + CHIPSET_NOT_SUPPORTED = NVML_P2P_STATUS_CHIPSET_NOT_SUPPORTED + P2P_STATUS_CHIPSET_NOT_SUPPORTED = CHIPSET_NOT_SUPPORTED # backward-compat alias + GPU_NOT_SUPPORTED = NVML_P2P_STATUS_GPU_NOT_SUPPORTED + P2P_STATUS_GPU_NOT_SUPPORTED = GPU_NOT_SUPPORTED # backward-compat alias + IOH_TOPOLOGY_NOT_SUPPORTED = NVML_P2P_STATUS_IOH_TOPOLOGY_NOT_SUPPORTED + P2P_STATUS_IOH_TOPOLOGY_NOT_SUPPORTED = IOH_TOPOLOGY_NOT_SUPPORTED # backward-compat alias + DISABLED_BY_REGKEY = NVML_P2P_STATUS_DISABLED_BY_REGKEY + P2P_STATUS_DISABLED_BY_REGKEY = DISABLED_BY_REGKEY # backward-compat alias + NOT_SUPPORTED = NVML_P2P_STATUS_NOT_SUPPORTED + P2P_STATUS_NOT_SUPPORTED = NOT_SUPPORTED # backward-compat alias + UNKNOWN = NVML_P2P_STATUS_UNKNOWN + P2P_STATUS_UNKNOWN = UNKNOWN # backward-compat alias class GpuP2PCapsIndex(_cyb_FastEnum): """ See `nvmlGpuP2PCapsIndex_t`. """ - P2P_CAPS_INDEX_READ = NVML_P2P_CAPS_INDEX_READ - P2P_CAPS_INDEX_WRITE = NVML_P2P_CAPS_INDEX_WRITE - P2P_CAPS_INDEX_NVLINK = NVML_P2P_CAPS_INDEX_NVLINK - P2P_CAPS_INDEX_ATOMICS = NVML_P2P_CAPS_INDEX_ATOMICS - P2P_CAPS_INDEX_PCI = NVML_P2P_CAPS_INDEX_PCI - P2P_CAPS_INDEX_PROP = NVML_P2P_CAPS_INDEX_PROP - P2P_CAPS_INDEX_UNKNOWN = NVML_P2P_CAPS_INDEX_UNKNOWN + READ = NVML_P2P_CAPS_INDEX_READ + P2P_CAPS_INDEX_READ = READ # backward-compat alias + WRITE = NVML_P2P_CAPS_INDEX_WRITE + P2P_CAPS_INDEX_WRITE = WRITE # backward-compat alias + NVLINK = NVML_P2P_CAPS_INDEX_NVLINK + P2P_CAPS_INDEX_NVLINK = NVLINK # backward-compat alias + ATOMICS = NVML_P2P_CAPS_INDEX_ATOMICS + P2P_CAPS_INDEX_ATOMICS = ATOMICS # backward-compat alias + PCI = NVML_P2P_CAPS_INDEX_PCI + P2P_CAPS_INDEX_PCI = PCI # backward-compat alias + PROP = NVML_P2P_CAPS_INDEX_PROP + P2P_CAPS_INDEX_PROP = PROP # backward-compat alias + UNKNOWN = NVML_P2P_CAPS_INDEX_UNKNOWN + P2P_CAPS_INDEX_UNKNOWN = UNKNOWN # backward-compat alias class SamplingType(_cyb_FastEnum): """ @@ -230,9 +291,12 @@ class PcieUtilCounter(_cyb_FastEnum): See `nvmlPcieUtilCounter_t`. """ - PCIE_UTIL_TX_BYTES = NVML_PCIE_UTIL_TX_BYTES - PCIE_UTIL_RX_BYTES = NVML_PCIE_UTIL_RX_BYTES - PCIE_UTIL_COUNT = NVML_PCIE_UTIL_COUNT + TX_BYTES = NVML_PCIE_UTIL_TX_BYTES + PCIE_UTIL_TX_BYTES = TX_BYTES # backward-compat alias + RX_BYTES = NVML_PCIE_UTIL_RX_BYTES + PCIE_UTIL_RX_BYTES = RX_BYTES # backward-compat alias + COUNT = NVML_PCIE_UTIL_COUNT + PCIE_UTIL_COUNT = COUNT # backward-compat alias class ValueType(_cyb_FastEnum): """ @@ -255,15 +319,24 @@ class PerfPolicyType(_cyb_FastEnum): See `nvmlPerfPolicyType_t`. """ - PERF_POLICY_POWER = (NVML_PERF_POLICY_POWER, 'How long did power violations cause the GPU to be below application clocks.') - PERF_POLICY_THERMAL = (NVML_PERF_POLICY_THERMAL, 'How long did thermal violations cause the GPU to be below application clocks.') - PERF_POLICY_SYNC_BOOST = (NVML_PERF_POLICY_SYNC_BOOST, 'How long did sync boost cause the GPU to be below application clocks.') - PERF_POLICY_BOARD_LIMIT = (NVML_PERF_POLICY_BOARD_LIMIT, 'How long did the board limit cause the GPU to be below application clocks.') - PERF_POLICY_LOW_UTILIZATION = (NVML_PERF_POLICY_LOW_UTILIZATION, 'How long did low utilization cause the GPU to be below application clocks.') - PERF_POLICY_RELIABILITY = (NVML_PERF_POLICY_RELIABILITY, 'How long did the board reliability limit cause the GPU to be below application clocks.') - PERF_POLICY_TOTAL_APP_CLOCKS = (NVML_PERF_POLICY_TOTAL_APP_CLOCKS, 'Total time the GPU was held below application clocks by any limiter (0 - 5 above).') - PERF_POLICY_TOTAL_BASE_CLOCKS = (NVML_PERF_POLICY_TOTAL_BASE_CLOCKS, 'Total time the GPU was held below base clocks.') - PERF_POLICY_COUNT = NVML_PERF_POLICY_COUNT + POWER = (NVML_PERF_POLICY_POWER, 'How long did power violations cause the GPU to be below application clocks.') + PERF_POLICY_POWER = POWER # backward-compat alias + THERMAL = (NVML_PERF_POLICY_THERMAL, 'How long did thermal violations cause the GPU to be below application clocks.') + PERF_POLICY_THERMAL = THERMAL # backward-compat alias + SYNC_BOOST = (NVML_PERF_POLICY_SYNC_BOOST, 'How long did sync boost cause the GPU to be below application clocks.') + PERF_POLICY_SYNC_BOOST = SYNC_BOOST # backward-compat alias + BOARD_LIMIT = (NVML_PERF_POLICY_BOARD_LIMIT, 'How long did the board limit cause the GPU to be below application clocks.') + PERF_POLICY_BOARD_LIMIT = BOARD_LIMIT # backward-compat alias + LOW_UTILIZATION = (NVML_PERF_POLICY_LOW_UTILIZATION, 'How long did low utilization cause the GPU to be below application clocks.') + PERF_POLICY_LOW_UTILIZATION = LOW_UTILIZATION # backward-compat alias + RELIABILITY = (NVML_PERF_POLICY_RELIABILITY, 'How long did the board reliability limit cause the GPU to be below application clocks.') + PERF_POLICY_RELIABILITY = RELIABILITY # backward-compat alias + TOTAL_APP_CLOCKS = (NVML_PERF_POLICY_TOTAL_APP_CLOCKS, 'Total time the GPU was held below application clocks by any limiter (0 - 5 above).') + PERF_POLICY_TOTAL_APP_CLOCKS = TOTAL_APP_CLOCKS # backward-compat alias + TOTAL_BASE_CLOCKS = (NVML_PERF_POLICY_TOTAL_BASE_CLOCKS, 'Total time the GPU was held below base clocks.') + PERF_POLICY_TOTAL_BASE_CLOCKS = TOTAL_BASE_CLOCKS # backward-compat alias + COUNT = NVML_PERF_POLICY_COUNT + PERF_POLICY_COUNT = COUNT # backward-compat alias class ThermalTarget(_cyb_FastEnum): """ @@ -314,10 +387,14 @@ class CoolerControl(_cyb_FastEnum): See `nvmlCoolerControl_t`. """ - THERMAL_COOLER_SIGNAL_NONE = (NVML_THERMAL_COOLER_SIGNAL_NONE, 'This cooler has no control signal.') - THERMAL_COOLER_SIGNAL_TOGGLE = (NVML_THERMAL_COOLER_SIGNAL_TOGGLE, 'This cooler can only be toggled either ON or OFF (eg a switch).') - THERMAL_COOLER_SIGNAL_VARIABLE = (NVML_THERMAL_COOLER_SIGNAL_VARIABLE, "This cooler's level can be adjusted from some minimum to some maximum (eg a knob).") - THERMAL_COOLER_SIGNAL_COUNT = NVML_THERMAL_COOLER_SIGNAL_COUNT + NONE = (NVML_THERMAL_COOLER_SIGNAL_NONE, 'This cooler has no control signal.') + THERMAL_COOLER_SIGNAL_NONE = NONE # backward-compat alias + TOGGLE = (NVML_THERMAL_COOLER_SIGNAL_TOGGLE, 'This cooler can only be toggled either ON or OFF (eg a switch).') + THERMAL_COOLER_SIGNAL_TOGGLE = TOGGLE # backward-compat alias + VARIABLE = (NVML_THERMAL_COOLER_SIGNAL_VARIABLE, "This cooler's level can be adjusted from some minimum to some maximum (eg a knob).") + THERMAL_COOLER_SIGNAL_VARIABLE = VARIABLE # backward-compat alias + COUNT = NVML_THERMAL_COOLER_SIGNAL_COUNT + THERMAL_COOLER_SIGNAL_COUNT = COUNT # backward-compat alias class CoolerTarget(_cyb_FastEnum): """ @@ -325,11 +402,16 @@ class CoolerTarget(_cyb_FastEnum): See `nvmlCoolerTarget_t`. """ - THERMAL_NONE = (NVML_THERMAL_COOLER_TARGET_NONE, 'This cooler cools nothing.') - THERMAL_GPU = (NVML_THERMAL_COOLER_TARGET_GPU, 'This cooler can cool the GPU.') - THERMAL_MEMORY = (NVML_THERMAL_COOLER_TARGET_MEMORY, 'This cooler can cool the memory.') - THERMAL_POWER_SUPPLY = (NVML_THERMAL_COOLER_TARGET_POWER_SUPPLY, 'This cooler can cool the power supply.') - THERMAL_GPU_RELATED = (NVML_THERMAL_COOLER_TARGET_GPU_RELATED, 'This cooler cools all of the components related to its target gpu. GPU_RELATED = GPU | MEMORY | POWER_SUPPLY.') + NONE = (NVML_THERMAL_COOLER_TARGET_NONE, 'This cooler cools nothing.') + THERMAL_NONE = NONE # backward-compat alias + GPU = (NVML_THERMAL_COOLER_TARGET_GPU, 'This cooler can cool the GPU.') + THERMAL_GPU = GPU # backward-compat alias + MEMORY = (NVML_THERMAL_COOLER_TARGET_MEMORY, 'This cooler can cool the memory.') + THERMAL_MEMORY = MEMORY # backward-compat alias + POWER_SUPPLY = (NVML_THERMAL_COOLER_TARGET_POWER_SUPPLY, 'This cooler can cool the power supply.') + THERMAL_POWER_SUPPLY = POWER_SUPPLY # backward-compat alias + GPU_RELATED = (NVML_THERMAL_COOLER_TARGET_GPU_RELATED, 'This cooler cools all of the components related to its target gpu. GPU_RELATED = GPU | MEMORY | POWER_SUPPLY.') + THERMAL_GPU_RELATED = GPU_RELATED # backward-compat alias class UUIDType(_cyb_FastEnum): """ @@ -347,8 +429,10 @@ class EnableState(_cyb_FastEnum): See `nvmlEnableState_t`. """ - FEATURE_DISABLED = (NVML_FEATURE_DISABLED, 'Feature disabled.') - FEATURE_ENABLED = (NVML_FEATURE_ENABLED, 'Feature enabled.') + DISABLED = (NVML_FEATURE_DISABLED, 'Feature disabled.') + FEATURE_DISABLED = DISABLED # backward-compat alias + ENABLED = (NVML_FEATURE_ENABLED, 'Feature enabled.') + FEATURE_ENABLED = ENABLED # backward-compat alias class BrandType(_cyb_FastEnum): """ @@ -356,28 +440,50 @@ class BrandType(_cyb_FastEnum): See `nvmlBrandType_t`. """ - BRAND_UNKNOWN = NVML_BRAND_UNKNOWN - BRAND_QUADRO = NVML_BRAND_QUADRO - BRAND_TESLA = NVML_BRAND_TESLA - BRAND_NVS = NVML_BRAND_NVS - BRAND_GRID = NVML_BRAND_GRID - BRAND_GEFORCE = NVML_BRAND_GEFORCE - BRAND_TITAN = NVML_BRAND_TITAN - BRAND_NVIDIA_VAPPS = NVML_BRAND_NVIDIA_VAPPS - BRAND_NVIDIA_VPC = NVML_BRAND_NVIDIA_VPC - BRAND_NVIDIA_VCS = NVML_BRAND_NVIDIA_VCS - BRAND_NVIDIA_VWS = NVML_BRAND_NVIDIA_VWS - BRAND_NVIDIA_CLOUD_GAMING = NVML_BRAND_NVIDIA_CLOUD_GAMING - BRAND_NVIDIA_VGAMING = NVML_BRAND_NVIDIA_VGAMING - BRAND_QUADRO_RTX = NVML_BRAND_QUADRO_RTX - BRAND_NVIDIA_RTX = NVML_BRAND_NVIDIA_RTX - BRAND_NVIDIA = NVML_BRAND_NVIDIA - BRAND_GEFORCE_RTX = NVML_BRAND_GEFORCE_RTX - BRAND_TITAN_RTX = NVML_BRAND_TITAN_RTX - BRAND_NVIDIA_DLA = NVML_BRAND_NVIDIA_DLA - BRAND_NVIDIA_VGAMEDEV = NVML_BRAND_NVIDIA_VGAMEDEV - BRAND_NVIDIA_NPU = NVML_BRAND_NVIDIA_NPU - BRAND_COUNT = NVML_BRAND_COUNT + UNKNOWN = NVML_BRAND_UNKNOWN + BRAND_UNKNOWN = UNKNOWN # backward-compat alias + QUADRO = NVML_BRAND_QUADRO + BRAND_QUADRO = QUADRO # backward-compat alias + TESLA = NVML_BRAND_TESLA + BRAND_TESLA = TESLA # backward-compat alias + NVS = NVML_BRAND_NVS + BRAND_NVS = NVS # backward-compat alias + GRID = NVML_BRAND_GRID + BRAND_GRID = GRID # backward-compat alias + GEFORCE = NVML_BRAND_GEFORCE + BRAND_GEFORCE = GEFORCE # backward-compat alias + TITAN = NVML_BRAND_TITAN + BRAND_TITAN = TITAN # backward-compat alias + NVIDIA_VAPPS = NVML_BRAND_NVIDIA_VAPPS + BRAND_NVIDIA_VAPPS = NVIDIA_VAPPS # backward-compat alias + NVIDIA_VPC = NVML_BRAND_NVIDIA_VPC + BRAND_NVIDIA_VPC = NVIDIA_VPC # backward-compat alias + NVIDIA_VCS = NVML_BRAND_NVIDIA_VCS + BRAND_NVIDIA_VCS = NVIDIA_VCS # backward-compat alias + NVIDIA_VWS = NVML_BRAND_NVIDIA_VWS + BRAND_NVIDIA_VWS = NVIDIA_VWS # backward-compat alias + NVIDIA_CLOUD_GAMING = NVML_BRAND_NVIDIA_CLOUD_GAMING + BRAND_NVIDIA_CLOUD_GAMING = NVIDIA_CLOUD_GAMING # backward-compat alias + NVIDIA_VGAMING = NVML_BRAND_NVIDIA_VGAMING + BRAND_NVIDIA_VGAMING = NVIDIA_VGAMING # backward-compat alias + QUADRO_RTX = NVML_BRAND_QUADRO_RTX + BRAND_QUADRO_RTX = QUADRO_RTX # backward-compat alias + NVIDIA_RTX = NVML_BRAND_NVIDIA_RTX + BRAND_NVIDIA_RTX = NVIDIA_RTX # backward-compat alias + NVIDIA = NVML_BRAND_NVIDIA + BRAND_NVIDIA = NVIDIA # backward-compat alias + GEFORCE_RTX = NVML_BRAND_GEFORCE_RTX + BRAND_GEFORCE_RTX = GEFORCE_RTX # backward-compat alias + TITAN_RTX = NVML_BRAND_TITAN_RTX + BRAND_TITAN_RTX = TITAN_RTX # backward-compat alias + NVIDIA_DLA = NVML_BRAND_NVIDIA_DLA + BRAND_NVIDIA_DLA = NVIDIA_DLA # backward-compat alias + NVIDIA_VGAMEDEV = NVML_BRAND_NVIDIA_VGAMEDEV + BRAND_NVIDIA_VGAMEDEV = NVIDIA_VGAMEDEV # backward-compat alias + NVIDIA_NPU = NVML_BRAND_NVIDIA_NPU + BRAND_NVIDIA_NPU = NVIDIA_NPU # backward-compat alias + COUNT = NVML_BRAND_COUNT + BRAND_COUNT = COUNT # backward-compat alias class TemperatureThresholds(_cyb_FastEnum): """ @@ -385,15 +491,24 @@ class TemperatureThresholds(_cyb_FastEnum): See `nvmlTemperatureThresholds_t`. """ - TEMPERATURE_THRESHOLD_SHUTDOWN = (NVML_TEMPERATURE_THRESHOLD_SHUTDOWN, 'Temperature at which the GPU will shut down for HW protection') - TEMPERATURE_THRESHOLD_SLOWDOWN = (NVML_TEMPERATURE_THRESHOLD_SLOWDOWN, 'Temperature at which the GPU will begin HW slowdown') - TEMPERATURE_THRESHOLD_MEM_MAX = (NVML_TEMPERATURE_THRESHOLD_MEM_MAX, 'Memory Temperature at which the GPU will begin SW slowdown') - TEMPERATURE_THRESHOLD_GPU_MAX = (NVML_TEMPERATURE_THRESHOLD_GPU_MAX, 'GPU Temperature at which the GPU can be throttled below base clock') - TEMPERATURE_THRESHOLD_ACOUSTIC_MIN = (NVML_TEMPERATURE_THRESHOLD_ACOUSTIC_MIN, 'Minimum GPU Temperature that can be set as acoustic threshold') - TEMPERATURE_THRESHOLD_ACOUSTIC_CURR = (NVML_TEMPERATURE_THRESHOLD_ACOUSTIC_CURR, 'Current temperature that is set as acoustic threshold.') - TEMPERATURE_THRESHOLD_ACOUSTIC_MAX = (NVML_TEMPERATURE_THRESHOLD_ACOUSTIC_MAX, 'Maximum GPU temperature that can be set as acoustic threshold.') - TEMPERATURE_THRESHOLD_GPS_CURR = (NVML_TEMPERATURE_THRESHOLD_GPS_CURR, 'Current temperature that is set as gps threshold.') - TEMPERATURE_THRESHOLD_COUNT = NVML_TEMPERATURE_THRESHOLD_COUNT + SHUTDOWN = (NVML_TEMPERATURE_THRESHOLD_SHUTDOWN, 'Temperature at which the GPU will shut down for HW protection') + TEMPERATURE_THRESHOLD_SHUTDOWN = SHUTDOWN # backward-compat alias + SLOWDOWN = (NVML_TEMPERATURE_THRESHOLD_SLOWDOWN, 'Temperature at which the GPU will begin HW slowdown') + TEMPERATURE_THRESHOLD_SLOWDOWN = SLOWDOWN # backward-compat alias + MEM_MAX = (NVML_TEMPERATURE_THRESHOLD_MEM_MAX, 'Memory Temperature at which the GPU will begin SW slowdown') + TEMPERATURE_THRESHOLD_MEM_MAX = MEM_MAX # backward-compat alias + GPU_MAX = (NVML_TEMPERATURE_THRESHOLD_GPU_MAX, 'GPU Temperature at which the GPU can be throttled below base clock') + TEMPERATURE_THRESHOLD_GPU_MAX = GPU_MAX # backward-compat alias + ACOUSTIC_MIN = (NVML_TEMPERATURE_THRESHOLD_ACOUSTIC_MIN, 'Minimum GPU Temperature that can be set as acoustic threshold') + TEMPERATURE_THRESHOLD_ACOUSTIC_MIN = ACOUSTIC_MIN # backward-compat alias + ACOUSTIC_CURR = (NVML_TEMPERATURE_THRESHOLD_ACOUSTIC_CURR, 'Current temperature that is set as acoustic threshold.') + TEMPERATURE_THRESHOLD_ACOUSTIC_CURR = ACOUSTIC_CURR # backward-compat alias + ACOUSTIC_MAX = (NVML_TEMPERATURE_THRESHOLD_ACOUSTIC_MAX, 'Maximum GPU temperature that can be set as acoustic threshold.') + TEMPERATURE_THRESHOLD_ACOUSTIC_MAX = ACOUSTIC_MAX # backward-compat alias + GPS_CURR = (NVML_TEMPERATURE_THRESHOLD_GPS_CURR, 'Current temperature that is set as gps threshold.') + TEMPERATURE_THRESHOLD_GPS_CURR = GPS_CURR # backward-compat alias + COUNT = NVML_TEMPERATURE_THRESHOLD_COUNT + TEMPERATURE_THRESHOLD_COUNT = COUNT # backward-compat alias class TemperatureSensors(_cyb_FastEnum): """ @@ -401,9 +516,12 @@ class TemperatureSensors(_cyb_FastEnum): See `nvmlTemperatureSensors_t`. """ - TEMPERATURE_GPU = (NVML_TEMPERATURE_GPU, 'Temperature sensor for the GPU die.') - TEMPERATURE_GPU_MAX = (NVML_TEMPERATURE_GPU_MAX, 'Temperature from the hottest part of the GPU die.') - TEMPERATURE_COUNT = NVML_TEMPERATURE_COUNT + GPU = (NVML_TEMPERATURE_GPU, 'Temperature sensor for the GPU die.') + TEMPERATURE_GPU = GPU # backward-compat alias + GPU_MAX = (NVML_TEMPERATURE_GPU_MAX, 'Temperature from the hottest part of the GPU die.') + TEMPERATURE_GPU_MAX = GPU_MAX # backward-compat alias + COUNT = NVML_TEMPERATURE_COUNT + TEMPERATURE_COUNT = COUNT # backward-compat alias class ComputeMode(_cyb_FastEnum): """ @@ -413,11 +531,16 @@ class ComputeMode(_cyb_FastEnum): See `nvmlComputeMode_t`. """ - COMPUTEMODE_DEFAULT = (NVML_COMPUTEMODE_DEFAULT, 'Default compute mode -- multiple contexts per device.') - COMPUTEMODE_EXCLUSIVE_THREAD = (NVML_COMPUTEMODE_EXCLUSIVE_THREAD, 'Support Removed.') - COMPUTEMODE_PROHIBITED = (NVML_COMPUTEMODE_PROHIBITED, 'Compute-prohibited mode -- no contexts per device.') - COMPUTEMODE_EXCLUSIVE_PROCESS = (NVML_COMPUTEMODE_EXCLUSIVE_PROCESS, 'Compute-exclusive-process mode -- only one context per device, usable from multiple threads at a time.') - COMPUTEMODE_COUNT = NVML_COMPUTEMODE_COUNT + DEFAULT = (NVML_COMPUTEMODE_DEFAULT, 'Default compute mode -- multiple contexts per device.') + COMPUTEMODE_DEFAULT = DEFAULT # backward-compat alias + EXCLUSIVE_THREAD = (NVML_COMPUTEMODE_EXCLUSIVE_THREAD, 'Support Removed.') + COMPUTEMODE_EXCLUSIVE_THREAD = EXCLUSIVE_THREAD # backward-compat alias + PROHIBITED = (NVML_COMPUTEMODE_PROHIBITED, 'Compute-prohibited mode -- no contexts per device.') + COMPUTEMODE_PROHIBITED = PROHIBITED # backward-compat alias + EXCLUSIVE_PROCESS = (NVML_COMPUTEMODE_EXCLUSIVE_PROCESS, 'Compute-exclusive-process mode -- only one context per device, usable from multiple threads at a time.') + COMPUTEMODE_EXCLUSIVE_PROCESS = EXCLUSIVE_PROCESS # backward-compat alias + COUNT = NVML_COMPUTEMODE_COUNT + COMPUTEMODE_COUNT = COUNT # backward-compat alias class MemoryErrorType(_cyb_FastEnum): """ @@ -435,15 +558,24 @@ class NvlinkVersion(_cyb_FastEnum): See `nvmlNvlinkVersion_t`. """ - VERSION_INVALID = (NVML_NVLINK_VERSION_INVALID, 'NVLink version is invalid.') - VERSION_1_0 = (NVML_NVLINK_VERSION_1_0, 'NVLink Version 1.0.') - VERSION_2_0 = (NVML_NVLINK_VERSION_2_0, 'NVLink Version 2.0.') - VERSION_2_2 = (NVML_NVLINK_VERSION_2_2, 'NVLink Version 2.2.') - VERSION_3_0 = (NVML_NVLINK_VERSION_3_0, 'NVLink Version 3.0.') - VERSION_3_1 = (NVML_NVLINK_VERSION_3_1, 'NVLink Version 3.1.') - VERSION_4_0 = (NVML_NVLINK_VERSION_4_0, 'NVLink Version 4.0.') - VERSION_5_0 = (NVML_NVLINK_VERSION_5_0, 'NVLink Version 5.0.') - VERSION_6_0 = (NVML_NVLINK_VERSION_6_0, 'NVLink Version 6.0.') + NVLINK_VERSION_INVALID = (NVML_NVLINK_VERSION_INVALID, 'NVLink version is invalid.') + VERSION_INVALID = NVLINK_VERSION_INVALID # backward-compat alias + NVLINK_VERSION_1_0 = (NVML_NVLINK_VERSION_1_0, 'NVLink Version 1.0.') + VERSION_1_0 = NVLINK_VERSION_1_0 # backward-compat alias + NVLINK_VERSION_2_0 = (NVML_NVLINK_VERSION_2_0, 'NVLink Version 2.0.') + VERSION_2_0 = NVLINK_VERSION_2_0 # backward-compat alias + NVLINK_VERSION_2_2 = (NVML_NVLINK_VERSION_2_2, 'NVLink Version 2.2.') + VERSION_2_2 = NVLINK_VERSION_2_2 # backward-compat alias + NVLINK_VERSION_3_0 = (NVML_NVLINK_VERSION_3_0, 'NVLink Version 3.0.') + VERSION_3_0 = NVLINK_VERSION_3_0 # backward-compat alias + NVLINK_VERSION_3_1 = (NVML_NVLINK_VERSION_3_1, 'NVLink Version 3.1.') + VERSION_3_1 = NVLINK_VERSION_3_1 # backward-compat alias + NVLINK_VERSION_4_0 = (NVML_NVLINK_VERSION_4_0, 'NVLink Version 4.0.') + VERSION_4_0 = NVLINK_VERSION_4_0 # backward-compat alias + NVLINK_VERSION_5_0 = (NVML_NVLINK_VERSION_5_0, 'NVLink Version 5.0.') + VERSION_5_0 = NVLINK_VERSION_5_0 # backward-compat alias + NVLINK_VERSION_6_0 = (NVML_NVLINK_VERSION_6_0, 'NVLink Version 6.0.') + VERSION_6_0 = NVLINK_VERSION_6_0 # backward-compat alias class EccCounterType(_cyb_FastEnum): """ @@ -458,7 +590,8 @@ class EccCounterType(_cyb_FastEnum): """ VOLATILE_ECC = (NVML_VOLATILE_ECC, 'Volatile counts are reset each time the driver loads.') AGGREGATE_ECC = (NVML_AGGREGATE_ECC, 'Aggregate counts persist across reboots (i.e. for the lifetime of the device).') - COUNT = (NVML_ECC_COUNTER_TYPE_COUNT, 'Count of memory counter types.') + ECC_COUNTER_TYPE_COUNT = (NVML_ECC_COUNTER_TYPE_COUNT, 'Count of memory counter types.') + COUNT = ECC_COUNTER_TYPE_COUNT # backward-compat alias class ClockType(_cyb_FastEnum): """ @@ -466,11 +599,16 @@ class ClockType(_cyb_FastEnum): See `nvmlClockType_t`. """ - CLOCK_GRAPHICS = (NVML_CLOCK_GRAPHICS, 'Graphics clock domain.') - CLOCK_SM = (NVML_CLOCK_SM, 'SM clock domain.') - CLOCK_MEM = (NVML_CLOCK_MEM, 'Memory clock domain.') - CLOCK_VIDEO = (NVML_CLOCK_VIDEO, 'Video encoder/decoder clock domain.') - CLOCK_COUNT = (NVML_CLOCK_COUNT, 'Count of clock types.') + GRAPHICS = (NVML_CLOCK_GRAPHICS, 'Graphics clock domain.') + CLOCK_GRAPHICS = GRAPHICS # backward-compat alias + SM = (NVML_CLOCK_SM, 'SM clock domain.') + CLOCK_SM = SM # backward-compat alias + MEM = (NVML_CLOCK_MEM, 'Memory clock domain.') + CLOCK_MEM = MEM # backward-compat alias + VIDEO = (NVML_CLOCK_VIDEO, 'Video encoder/decoder clock domain.') + CLOCK_VIDEO = VIDEO # backward-compat alias + COUNT = (NVML_CLOCK_COUNT, 'Count of clock types.') + CLOCK_COUNT = COUNT # backward-compat alias class ClockId(_cyb_FastEnum): """ @@ -491,9 +629,12 @@ class DriverModel(_cyb_FastEnum): See `nvmlDriverModel_t`. """ - DRIVER_WDDM = (NVML_DRIVER_WDDM, 'WDDM driver model -- GPU treated as a display device.') - DRIVER_WDM = (NVML_DRIVER_WDM, 'WDM (TCC) model (deprecated) -- GPU treated as a generic compute device.') - DRIVER_MCDM = (NVML_DRIVER_MCDM, 'MCDM driver model -- GPU treated as a Microsoft compute device.') + WDDM = (NVML_DRIVER_WDDM, 'WDDM driver model -- GPU treated as a display device.') + DRIVER_WDDM = WDDM # backward-compat alias + WDM = (NVML_DRIVER_WDM, 'WDM (TCC) model (deprecated) -- GPU treated as a generic compute device.') + DRIVER_WDM = WDM # backward-compat alias + MCDM = (NVML_DRIVER_MCDM, 'MCDM driver model -- GPU treated as a Microsoft compute device.') + DRIVER_MCDM = MCDM # backward-compat alias class Pstates(_cyb_FastEnum): """ @@ -527,9 +668,12 @@ class GpuOperationMode(_cyb_FastEnum): See `nvmlGpuOperationMode_t`. """ - GOM_ALL_ON = (NVML_GOM_ALL_ON, 'Everything is enabled and running at full speed.') - GOM_COMPUTE = (NVML_GOM_COMPUTE, 'Designed for running only compute tasks. Graphics operations are not allowed') - GOM_LOW_DP = (NVML_GOM_LOW_DP, "Designed for running graphics applications that don't require high bandwidth double precision") + ALL_ON = (NVML_GOM_ALL_ON, 'Everything is enabled and running at full speed.') + GOM_ALL_ON = ALL_ON # backward-compat alias + COMPUTE = (NVML_GOM_COMPUTE, 'Designed for running only compute tasks. Graphics operations are not allowed') + GOM_COMPUTE = COMPUTE # backward-compat alias + LOW_DP = (NVML_GOM_LOW_DP, "Designed for running graphics applications that don't require high bandwidth double precision") + GOM_LOW_DP = LOW_DP # backward-compat alias class InforomObject(_cyb_FastEnum): """ @@ -537,11 +681,16 @@ class InforomObject(_cyb_FastEnum): See `nvmlInforomObject_t`. """ - INFOROM_OEM = (NVML_INFOROM_OEM, 'An object defined by OEM.') - INFOROM_ECC = (NVML_INFOROM_ECC, 'The ECC object determining the level of ECC support.') - INFOROM_POWER = (NVML_INFOROM_POWER, 'The power management object.') - INFOROM_DEN = (NVML_INFOROM_DEN, 'DRAM Encryption object.') - INFOROM_COUNT = (NVML_INFOROM_COUNT, 'This counts the number of infoROM objects the driver knows about.') + OEM = (NVML_INFOROM_OEM, 'An object defined by OEM.') + INFOROM_OEM = OEM # backward-compat alias + ECC = (NVML_INFOROM_ECC, 'The ECC object determining the level of ECC support.') + INFOROM_ECC = ECC # backward-compat alias + POWER = (NVML_INFOROM_POWER, 'The power management object.') + INFOROM_POWER = POWER # backward-compat alias + DEN = (NVML_INFOROM_DEN, 'DRAM Encryption object.') + INFOROM_DEN = DEN # backward-compat alias + COUNT = (NVML_INFOROM_COUNT, 'This counts the number of infoROM objects the driver knows about.') + INFOROM_COUNT = COUNT # backward-compat alias class Return(_cyb_FastEnum): """ @@ -625,10 +774,14 @@ class GpuUtilizationDomainId(_cyb_FastEnum): See `nvmlGpuUtilizationDomainId_t`. """ - GPU_UTILIZATION_DOMAIN_GPU = (NVML_GPU_UTILIZATION_DOMAIN_GPU, 'Graphics engine domain.') - GPU_UTILIZATION_DOMAIN_FB = (NVML_GPU_UTILIZATION_DOMAIN_FB, 'Frame buffer domain.') - GPU_UTILIZATION_DOMAIN_VID = (NVML_GPU_UTILIZATION_DOMAIN_VID, 'Video engine domain.') - GPU_UTILIZATION_DOMAIN_BUS = (NVML_GPU_UTILIZATION_DOMAIN_BUS, 'Bus interface domain.') + GPU = (NVML_GPU_UTILIZATION_DOMAIN_GPU, 'Graphics engine domain.') + GPU_UTILIZATION_DOMAIN_GPU = GPU # backward-compat alias + FB = (NVML_GPU_UTILIZATION_DOMAIN_FB, 'Frame buffer domain.') + GPU_UTILIZATION_DOMAIN_FB = FB # backward-compat alias + VID = (NVML_GPU_UTILIZATION_DOMAIN_VID, 'Video engine domain.') + GPU_UTILIZATION_DOMAIN_VID = VID # backward-compat alias + BUS = (NVML_GPU_UTILIZATION_DOMAIN_BUS, 'Bus interface domain.') + GPU_UTILIZATION_DOMAIN_BUS = BUS # backward-compat alias class GpuVirtualizationMode(_cyb_FastEnum): """ @@ -657,8 +810,10 @@ class VgpuVmIdType(_cyb_FastEnum): See `nvmlVgpuVmIdType_t`. """ - VGPU_VM_ID_DOMAIN_ID = (NVML_VGPU_VM_ID_DOMAIN_ID, 'VM ID represents DOMAIN ID.') - VGPU_VM_ID_UUID = (NVML_VGPU_VM_ID_UUID, 'VM ID represents UUID.') + DOMAIN_ID = (NVML_VGPU_VM_ID_DOMAIN_ID, 'VM ID represents DOMAIN ID.') + VGPU_VM_ID_DOMAIN_ID = DOMAIN_ID # backward-compat alias + UUID = (NVML_VGPU_VM_ID_UUID, 'VM ID represents UUID.') + VGPU_VM_ID_UUID = UUID # backward-compat alias class VgpuGuestInfoState(_cyb_FastEnum): """ @@ -666,8 +821,10 @@ class VgpuGuestInfoState(_cyb_FastEnum): See `nvmlVgpuGuestInfoState_t`. """ - VGPU_INSTANCE_GUEST_INFO_STATE_UNINITIALIZED = (NVML_VGPU_INSTANCE_GUEST_INFO_STATE_UNINITIALIZED, 'Guest-dependent fields uninitialized.') - VGPU_INSTANCE_GUEST_INFO_STATE_INITIALIZED = (NVML_VGPU_INSTANCE_GUEST_INFO_STATE_INITIALIZED, 'Guest-dependent fields initialized.') + UNINITIALIZED = (NVML_VGPU_INSTANCE_GUEST_INFO_STATE_UNINITIALIZED, 'Guest-dependent fields uninitialized.') + VGPU_INSTANCE_GUEST_INFO_STATE_UNINITIALIZED = UNINITIALIZED # backward-compat alias + INITIALIZED = (NVML_VGPU_INSTANCE_GUEST_INFO_STATE_INITIALIZED, 'Guest-dependent fields initialized.') + VGPU_INSTANCE_GUEST_INFO_STATE_INITIALIZED = INITIALIZED # backward-compat alias class GridLicenseFeatureCode(_cyb_FastEnum): """ @@ -689,12 +846,18 @@ class VgpuCapability(_cyb_FastEnum): See `nvmlVgpuCapability_t`. """ - VGPU_CAP_NVLINK_P2P = (NVML_VGPU_CAP_NVLINK_P2P, 'P2P over NVLink is supported.') - VGPU_CAP_GPUDIRECT = (NVML_VGPU_CAP_GPUDIRECT, 'GPUDirect capability is supported.') - VGPU_CAP_MULTI_VGPU_EXCLUSIVE = (NVML_VGPU_CAP_MULTI_VGPU_EXCLUSIVE, 'vGPU profile cannot be mixed with other vGPU profiles in same VM') - VGPU_CAP_EXCLUSIVE_TYPE = (NVML_VGPU_CAP_EXCLUSIVE_TYPE, 'vGPU profile cannot run on a GPU alongside other profiles of different type') - VGPU_CAP_EXCLUSIVE_SIZE = (NVML_VGPU_CAP_EXCLUSIVE_SIZE, 'vGPU profile cannot run on a GPU alongside other profiles of different size') - VGPU_CAP_COUNT = NVML_VGPU_CAP_COUNT + NVLINK_P2P = (NVML_VGPU_CAP_NVLINK_P2P, 'P2P over NVLink is supported.') + VGPU_CAP_NVLINK_P2P = NVLINK_P2P # backward-compat alias + GPUDIRECT = (NVML_VGPU_CAP_GPUDIRECT, 'GPUDirect capability is supported.') + VGPU_CAP_GPUDIRECT = GPUDIRECT # backward-compat alias + MULTI_VGPU_EXCLUSIVE = (NVML_VGPU_CAP_MULTI_VGPU_EXCLUSIVE, 'vGPU profile cannot be mixed with other vGPU profiles in same VM') + VGPU_CAP_MULTI_VGPU_EXCLUSIVE = MULTI_VGPU_EXCLUSIVE # backward-compat alias + EXCLUSIVE_TYPE = (NVML_VGPU_CAP_EXCLUSIVE_TYPE, 'vGPU profile cannot run on a GPU alongside other profiles of different type') + VGPU_CAP_EXCLUSIVE_TYPE = EXCLUSIVE_TYPE # backward-compat alias + EXCLUSIVE_SIZE = (NVML_VGPU_CAP_EXCLUSIVE_SIZE, 'vGPU profile cannot run on a GPU alongside other profiles of different size') + VGPU_CAP_EXCLUSIVE_SIZE = EXCLUSIVE_SIZE # backward-compat alias + COUNT = NVML_VGPU_CAP_COUNT + VGPU_CAP_COUNT = COUNT # backward-compat alias class VgpuDriverCapability(_cyb_FastEnum): """ @@ -702,9 +865,12 @@ class VgpuDriverCapability(_cyb_FastEnum): See `nvmlVgpuDriverCapability_t`. """ - VGPU_DRIVER_CAP_HETEROGENEOUS_MULTI_VGPU = (NVML_VGPU_DRIVER_CAP_HETEROGENEOUS_MULTI_VGPU, 'Supports mixing of different vGPU profiles within one guest VM.') - VGPU_DRIVER_CAP_WARM_UPDATE = (NVML_VGPU_DRIVER_CAP_WARM_UPDATE, 'Supports FSR and warm update of vGPU host driver without terminating the running guest VM.') - VGPU_DRIVER_CAP_COUNT = NVML_VGPU_DRIVER_CAP_COUNT + HETEROGENEOUS_MULTI_VGPU = (NVML_VGPU_DRIVER_CAP_HETEROGENEOUS_MULTI_VGPU, 'Supports mixing of different vGPU profiles within one guest VM.') + VGPU_DRIVER_CAP_HETEROGENEOUS_MULTI_VGPU = HETEROGENEOUS_MULTI_VGPU # backward-compat alias + WARM_UPDATE = (NVML_VGPU_DRIVER_CAP_WARM_UPDATE, 'Supports FSR and warm update of vGPU host driver without terminating the running guest VM.') + VGPU_DRIVER_CAP_WARM_UPDATE = WARM_UPDATE # backward-compat alias + COUNT = NVML_VGPU_DRIVER_CAP_COUNT + VGPU_DRIVER_CAP_COUNT = COUNT # backward-compat alias class DeviceVgpuCapability(_cyb_FastEnum): """ @@ -712,19 +878,32 @@ class DeviceVgpuCapability(_cyb_FastEnum): See `nvmlDeviceVgpuCapability_t`. """ - DEVICE_VGPU_CAP_FRACTIONAL_MULTI_VGPU = (NVML_DEVICE_VGPU_CAP_FRACTIONAL_MULTI_VGPU, 'Query whether the fractional vGPU profiles on this GPU can be used in multi-vGPU configurations.') - DEVICE_VGPU_CAP_HETEROGENEOUS_TIMESLICE_PROFILES = (NVML_DEVICE_VGPU_CAP_HETEROGENEOUS_TIMESLICE_PROFILES, 'Query whether the GPU support concurrent execution of timesliced vGPU profiles of differing types.') - DEVICE_VGPU_CAP_HETEROGENEOUS_TIMESLICE_SIZES = (NVML_DEVICE_VGPU_CAP_HETEROGENEOUS_TIMESLICE_SIZES, 'Query whether the GPU support concurrent execution of timesliced vGPU profiles of differing framebuffer sizes.') - DEVICE_VGPU_CAP_READ_DEVICE_BUFFER_BW = (NVML_DEVICE_VGPU_CAP_READ_DEVICE_BUFFER_BW, "Query the GPU's read_device_buffer expected bandwidth capacity in megabytes per second.") - DEVICE_VGPU_CAP_WRITE_DEVICE_BUFFER_BW = (NVML_DEVICE_VGPU_CAP_WRITE_DEVICE_BUFFER_BW, "Query the GPU's write_device_buffer expected bandwidth capacity in megabytes per second.") - DEVICE_VGPU_CAP_DEVICE_STREAMING = (NVML_DEVICE_VGPU_CAP_DEVICE_STREAMING, 'Query whether the vGPU profiles on the GPU supports migration data streaming.') - DEVICE_VGPU_CAP_MINI_QUARTER_GPU = (NVML_DEVICE_VGPU_CAP_MINI_QUARTER_GPU, 'Set/Get support for mini-quarter vGPU profiles.') - DEVICE_VGPU_CAP_COMPUTE_MEDIA_ENGINE_GPU = (NVML_DEVICE_VGPU_CAP_COMPUTE_MEDIA_ENGINE_GPU, 'Set/Get support for compute media engine vGPU profiles.') - DEVICE_VGPU_CAP_WARM_UPDATE = (NVML_DEVICE_VGPU_CAP_WARM_UPDATE, 'Query whether the GPU supports FSR and warm update.') - DEVICE_VGPU_CAP_HOMOGENEOUS_PLACEMENTS = (NVML_DEVICE_VGPU_CAP_HOMOGENEOUS_PLACEMENTS, 'Query whether the GPU supports reporting of placements of timesliced vGPU profiles with identical framebuffer sizes.') - DEVICE_VGPU_CAP_MIG_TIMESLICING_SUPPORTED = (NVML_DEVICE_VGPU_CAP_MIG_TIMESLICING_SUPPORTED, 'Query whether the GPU supports timesliced vGPU on MIG.') - DEVICE_VGPU_CAP_MIG_TIMESLICING_ENABLED = (NVML_DEVICE_VGPU_CAP_MIG_TIMESLICING_ENABLED, 'Set/Get MIG timesliced mode reporting, without impacting the underlying functionality.') - DEVICE_VGPU_CAP_COUNT = NVML_DEVICE_VGPU_CAP_COUNT + FRACTIONAL_MULTI_VGPU = (NVML_DEVICE_VGPU_CAP_FRACTIONAL_MULTI_VGPU, 'Query whether the fractional vGPU profiles on this GPU can be used in multi-vGPU configurations.') + DEVICE_VGPU_CAP_FRACTIONAL_MULTI_VGPU = FRACTIONAL_MULTI_VGPU # backward-compat alias + HETEROGENEOUS_TIMESLICE_PROFILES = (NVML_DEVICE_VGPU_CAP_HETEROGENEOUS_TIMESLICE_PROFILES, 'Query whether the GPU support concurrent execution of timesliced vGPU profiles of differing types.') + DEVICE_VGPU_CAP_HETEROGENEOUS_TIMESLICE_PROFILES = HETEROGENEOUS_TIMESLICE_PROFILES # backward-compat alias + HETEROGENEOUS_TIMESLICE_SIZES = (NVML_DEVICE_VGPU_CAP_HETEROGENEOUS_TIMESLICE_SIZES, 'Query whether the GPU support concurrent execution of timesliced vGPU profiles of differing framebuffer sizes.') + DEVICE_VGPU_CAP_HETEROGENEOUS_TIMESLICE_SIZES = HETEROGENEOUS_TIMESLICE_SIZES # backward-compat alias + READ_DEVICE_BUFFER_BW = (NVML_DEVICE_VGPU_CAP_READ_DEVICE_BUFFER_BW, "Query the GPU's read_device_buffer expected bandwidth capacity in megabytes per second.") + DEVICE_VGPU_CAP_READ_DEVICE_BUFFER_BW = READ_DEVICE_BUFFER_BW # backward-compat alias + WRITE_DEVICE_BUFFER_BW = (NVML_DEVICE_VGPU_CAP_WRITE_DEVICE_BUFFER_BW, "Query the GPU's write_device_buffer expected bandwidth capacity in megabytes per second.") + DEVICE_VGPU_CAP_WRITE_DEVICE_BUFFER_BW = WRITE_DEVICE_BUFFER_BW # backward-compat alias + DEVICE_STREAMING = (NVML_DEVICE_VGPU_CAP_DEVICE_STREAMING, 'Query whether the vGPU profiles on the GPU supports migration data streaming.') + DEVICE_VGPU_CAP_DEVICE_STREAMING = DEVICE_STREAMING # backward-compat alias + MINI_QUARTER_GPU = (NVML_DEVICE_VGPU_CAP_MINI_QUARTER_GPU, 'Set/Get support for mini-quarter vGPU profiles.') + DEVICE_VGPU_CAP_MINI_QUARTER_GPU = MINI_QUARTER_GPU # backward-compat alias + COMPUTE_MEDIA_ENGINE_GPU = (NVML_DEVICE_VGPU_CAP_COMPUTE_MEDIA_ENGINE_GPU, 'Set/Get support for compute media engine vGPU profiles.') + DEVICE_VGPU_CAP_COMPUTE_MEDIA_ENGINE_GPU = COMPUTE_MEDIA_ENGINE_GPU # backward-compat alias + WARM_UPDATE = (NVML_DEVICE_VGPU_CAP_WARM_UPDATE, 'Query whether the GPU supports FSR and warm update.') + DEVICE_VGPU_CAP_WARM_UPDATE = WARM_UPDATE # backward-compat alias + HOMOGENEOUS_PLACEMENTS = (NVML_DEVICE_VGPU_CAP_HOMOGENEOUS_PLACEMENTS, 'Query whether the GPU supports reporting of placements of timesliced vGPU profiles with identical framebuffer sizes.') + DEVICE_VGPU_CAP_HOMOGENEOUS_PLACEMENTS = HOMOGENEOUS_PLACEMENTS # backward-compat alias + MIG_TIMESLICING_SUPPORTED = (NVML_DEVICE_VGPU_CAP_MIG_TIMESLICING_SUPPORTED, 'Query whether the GPU supports timesliced vGPU on MIG.') + DEVICE_VGPU_CAP_MIG_TIMESLICING_SUPPORTED = MIG_TIMESLICING_SUPPORTED # backward-compat alias + MIG_TIMESLICING_ENABLED = (NVML_DEVICE_VGPU_CAP_MIG_TIMESLICING_ENABLED, 'Set/Get MIG timesliced mode reporting, without impacting the underlying functionality.') + DEVICE_VGPU_CAP_MIG_TIMESLICING_ENABLED = MIG_TIMESLICING_ENABLED # backward-compat alias + COUNT = NVML_DEVICE_VGPU_CAP_COUNT + DEVICE_VGPU_CAP_COUNT = COUNT # backward-compat alias class DeviceGpuRecoveryAction(_cyb_FastEnum): """ @@ -732,14 +911,22 @@ class DeviceGpuRecoveryAction(_cyb_FastEnum): See `nvmlDeviceGpuRecoveryAction_t`. """ - GPU_RECOVERY_ACTION_NONE = (NVML_GPU_RECOVERY_ACTION_NONE, 'No action needed.') - GPU_RECOVERY_ACTION_GPU_RESET = (NVML_GPU_RECOVERY_ACTION_GPU_RESET, 'Reset Gpu.') - GPU_RECOVERY_ACTION_NODE_REBOOT = (NVML_GPU_RECOVERY_ACTION_NODE_REBOOT, 'Reboot Node.') - GPU_RECOVERY_ACTION_DRAIN_P2P = (NVML_GPU_RECOVERY_ACTION_DRAIN_P2P, 'Drain P2P.') - GPU_RECOVERY_ACTION_DRAIN_AND_RESET = (NVML_GPU_RECOVERY_ACTION_DRAIN_AND_RESET, 'Drain P2P and Reset Gpu.') - GPU_RECOVERY_ACTION_RECOVER_IMEX_DOMAIN = (NVML_GPU_RECOVERY_ACTION_RECOVER_IMEX_DOMAIN, 'Recover IMEX Domain.') - GPU_RECOVERY_ACTION_BUS_RESET = (NVML_GPU_RECOVERY_ACTION_BUS_RESET, "Reset the GPU's PCIe bus.") - GPU_RECOVERY_ACTION_SYSTEM_REBOOT = (NVML_GPU_RECOVERY_ACTION_SYSTEM_REBOOT, 'Reboot the system.') + NONE = (NVML_GPU_RECOVERY_ACTION_NONE, 'No action needed.') + GPU_RECOVERY_ACTION_NONE = NONE # backward-compat alias + GPU_RESET = (NVML_GPU_RECOVERY_ACTION_GPU_RESET, 'Reset Gpu.') + GPU_RECOVERY_ACTION_GPU_RESET = GPU_RESET # backward-compat alias + NODE_REBOOT = (NVML_GPU_RECOVERY_ACTION_NODE_REBOOT, 'Reboot Node.') + GPU_RECOVERY_ACTION_NODE_REBOOT = NODE_REBOOT # backward-compat alias + DRAIN_P2P = (NVML_GPU_RECOVERY_ACTION_DRAIN_P2P, 'Drain P2P.') + GPU_RECOVERY_ACTION_DRAIN_P2P = DRAIN_P2P # backward-compat alias + DRAIN_AND_RESET = (NVML_GPU_RECOVERY_ACTION_DRAIN_AND_RESET, 'Drain P2P and Reset Gpu.') + GPU_RECOVERY_ACTION_DRAIN_AND_RESET = DRAIN_AND_RESET # backward-compat alias + RECOVER_IMEX_DOMAIN = (NVML_GPU_RECOVERY_ACTION_RECOVER_IMEX_DOMAIN, 'Recover IMEX Domain.') + GPU_RECOVERY_ACTION_RECOVER_IMEX_DOMAIN = RECOVER_IMEX_DOMAIN # backward-compat alias + BUS_RESET = (NVML_GPU_RECOVERY_ACTION_BUS_RESET, "Reset the GPU's PCIe bus.") + GPU_RECOVERY_ACTION_BUS_RESET = BUS_RESET # backward-compat alias + SYSTEM_REBOOT = (NVML_GPU_RECOVERY_ACTION_SYSTEM_REBOOT, 'Reboot the system.') + GPU_RECOVERY_ACTION_SYSTEM_REBOOT = SYSTEM_REBOOT # backward-compat alias class FanState(_cyb_FastEnum): """ @@ -747,8 +934,10 @@ class FanState(_cyb_FastEnum): See `nvmlFanState_t`. """ - FAN_NORMAL = (NVML_FAN_NORMAL, 'Fan is working properly.') - FAN_FAILED = (NVML_FAN_FAILED, 'Fan has failed.') + NORMAL = (NVML_FAN_NORMAL, 'Fan is working properly.') + FAN_NORMAL = NORMAL # backward-compat alias + FAILED = (NVML_FAN_FAILED, 'Fan has failed.') + FAN_FAILED = FAILED # backward-compat alias class LedColor(_cyb_FastEnum): """ @@ -765,10 +954,14 @@ class EncoderType(_cyb_FastEnum): See `nvmlEncoderType_t`. """ - ENCODER_QUERY_H264 = (NVML_ENCODER_QUERY_H264, 'H264 encoder.') - ENCODER_QUERY_HEVC = (NVML_ENCODER_QUERY_HEVC, 'HEVC encoder.') - ENCODER_QUERY_AV1 = (NVML_ENCODER_QUERY_AV1, 'AV1 encoder.') - ENCODER_QUERY_UNKNOWN = (NVML_ENCODER_QUERY_UNKNOWN, 'Unknown encoder.') + H264 = (NVML_ENCODER_QUERY_H264, 'H264 encoder.') + ENCODER_QUERY_H264 = H264 # backward-compat alias + HEVC = (NVML_ENCODER_QUERY_HEVC, 'HEVC encoder.') + ENCODER_QUERY_HEVC = HEVC # backward-compat alias + AV1 = (NVML_ENCODER_QUERY_AV1, 'AV1 encoder.') + ENCODER_QUERY_AV1 = AV1 # backward-compat alias + UNKNOWN = (NVML_ENCODER_QUERY_UNKNOWN, 'Unknown encoder.') + ENCODER_QUERY_UNKNOWN = UNKNOWN # backward-compat alias class FBCSessionType(_cyb_FastEnum): """ @@ -789,8 +982,10 @@ class DetachGpuState(_cyb_FastEnum): See `nvmlDetachGpuState_t`. """ - DETACH_GPU_KEEP = NVML_DETACH_GPU_KEEP - DETACH_GPU_REMOVE = NVML_DETACH_GPU_REMOVE + KEEP = NVML_DETACH_GPU_KEEP + DETACH_GPU_KEEP = KEEP # backward-compat alias + REMOVE = NVML_DETACH_GPU_REMOVE + DETACH_GPU_REMOVE = REMOVE # backward-compat alias class PcieLinkState(_cyb_FastEnum): """ @@ -798,8 +993,10 @@ class PcieLinkState(_cyb_FastEnum): See `nvmlPcieLinkState_t`. """ - PCIE_LINK_KEEP = NVML_PCIE_LINK_KEEP - PCIE_LINK_SHUT_DOWN = NVML_PCIE_LINK_SHUT_DOWN + KEEP = NVML_PCIE_LINK_KEEP + PCIE_LINK_KEEP = KEEP # backward-compat alias + SHUT_DOWN = NVML_PCIE_LINK_SHUT_DOWN + PCIE_LINK_SHUT_DOWN = SHUT_DOWN # backward-compat alias class ClockLimitId(_cyb_FastEnum): """ @@ -827,11 +1024,16 @@ class VgpuPgpuCompatibilityLimitCode(_cyb_FastEnum): See `nvmlVgpuPgpuCompatibilityLimitCode_t`. """ - VGPU_COMPATIBILITY_LIMIT_NONE = (NVML_VGPU_COMPATIBILITY_LIMIT_NONE, 'Compatibility is not limited.') - VGPU_COMPATIBILITY_LIMIT_HOST_DRIVER = (NVML_VGPU_COMPATIBILITY_LIMIT_HOST_DRIVER, 'ompatibility is limited by host driver version.') - VGPU_COMPATIBILITY_LIMIT_GUEST_DRIVER = (NVML_VGPU_COMPATIBILITY_LIMIT_GUEST_DRIVER, 'Compatibility is limited by guest driver version.') - VGPU_COMPATIBILITY_LIMIT_GPU = (NVML_VGPU_COMPATIBILITY_LIMIT_GPU, 'Compatibility is limited by GPU hardware.') - VGPU_COMPATIBILITY_LIMIT_OTHER = (NVML_VGPU_COMPATIBILITY_LIMIT_OTHER, 'Compatibility is limited by an undefined factor.') + NONE = (NVML_VGPU_COMPATIBILITY_LIMIT_NONE, 'Compatibility is not limited.') + VGPU_COMPATIBILITY_LIMIT_NONE = NONE # backward-compat alias + HOST_DRIVER = (NVML_VGPU_COMPATIBILITY_LIMIT_HOST_DRIVER, 'ompatibility is limited by host driver version.') + VGPU_COMPATIBILITY_LIMIT_HOST_DRIVER = HOST_DRIVER # backward-compat alias + GUEST_DRIVER = (NVML_VGPU_COMPATIBILITY_LIMIT_GUEST_DRIVER, 'Compatibility is limited by guest driver version.') + VGPU_COMPATIBILITY_LIMIT_GUEST_DRIVER = GUEST_DRIVER # backward-compat alias + GPU = (NVML_VGPU_COMPATIBILITY_LIMIT_GPU, 'Compatibility is limited by GPU hardware.') + VGPU_COMPATIBILITY_LIMIT_GPU = GPU # backward-compat alias + OTHER = (NVML_VGPU_COMPATIBILITY_LIMIT_OTHER, 'Compatibility is limited by an undefined factor.') + VGPU_COMPATIBILITY_LIMIT_OTHER = OTHER # backward-compat alias class GpmMetricId(_cyb_FastEnum): """ @@ -839,484 +1041,957 @@ class GpmMetricId(_cyb_FastEnum): See `nvmlGpmMetricId_t`. """ - GPM_METRIC_GRAPHICS_UTIL = (NVML_GPM_METRIC_GRAPHICS_UTIL, 'Percentage of time any compute/graphics app was active on the GPU. 0.0 - 100.0.') - GPM_METRIC_SM_UTIL = (NVML_GPM_METRIC_SM_UTIL, 'Percentage of SMs that were busy. 0.0 - 100.0.') - GPM_METRIC_SM_OCCUPANCY = (NVML_GPM_METRIC_SM_OCCUPANCY, 'Percentage of warps that were active vs theoretical maximum. 0.0 - 100.0.') - GPM_METRIC_INTEGER_UTIL = (NVML_GPM_METRIC_INTEGER_UTIL, "Percentage of time the GPU's SMs were doing integer operations. 0.0 - 100.0.") - GPM_METRIC_ANY_TENSOR_UTIL = (NVML_GPM_METRIC_ANY_TENSOR_UTIL, "Percentage of time the GPU's SMs were doing ANY tensor operations. 0.0 - 100.0.") - GPM_METRIC_DFMA_TENSOR_UTIL = (NVML_GPM_METRIC_DFMA_TENSOR_UTIL, "Percentage of time the GPU's SMs were doing DFMA tensor operations. 0.0 - 100.0.") - GPM_METRIC_HMMA_TENSOR_UTIL = (NVML_GPM_METRIC_HMMA_TENSOR_UTIL, "Percentage of time the GPU's SMs were doing HMMA tensor operations. 0.0 - 100.0.") - GPM_METRIC_DMMA_TENSOR_UTIL = (NVML_GPM_METRIC_DMMA_TENSOR_UTIL, "Percentage of time the GPU's SMs were doing DMMA tensor operations. 0.0 - 100.0.") - GPM_METRIC_IMMA_TENSOR_UTIL = (NVML_GPM_METRIC_IMMA_TENSOR_UTIL, "Percentage of time the GPU's SMs were doing IMMA tensor operations. 0.0 - 100.0.") - GPM_METRIC_DRAM_BW_UTIL = (NVML_GPM_METRIC_DRAM_BW_UTIL, 'Percentage of DRAM bw used vs theoretical maximum. `0.0 - 100.0 */`.') - GPM_METRIC_FP64_UTIL = (NVML_GPM_METRIC_FP64_UTIL, "Percentage of time the GPU's SMs were doing non-tensor FP64 math. 0.0 - 100.0.") - GPM_METRIC_FP32_UTIL = (NVML_GPM_METRIC_FP32_UTIL, "Percentage of time the GPU's SMs were doing non-tensor FP32 math. 0.0 - 100.0.") - GPM_METRIC_FP16_UTIL = (NVML_GPM_METRIC_FP16_UTIL, "Percentage of time the GPU's SMs were doing non-tensor FP16 math. 0.0 - 100.0.") - GPM_METRIC_PCIE_TX_PER_SEC = (NVML_GPM_METRIC_PCIE_TX_PER_SEC, 'PCIe traffic from this GPU in MiB/sec.') - GPM_METRIC_PCIE_RX_PER_SEC = (NVML_GPM_METRIC_PCIE_RX_PER_SEC, 'PCIe traffic to this GPU in MiB/sec.') - GPM_METRIC_NVDEC_0_UTIL = (NVML_GPM_METRIC_NVDEC_0_UTIL, 'Percent utilization of NVDEC 0. 0.0 - 100.0.') - GPM_METRIC_NVDEC_1_UTIL = (NVML_GPM_METRIC_NVDEC_1_UTIL, 'Percent utilization of NVDEC 1. 0.0 - 100.0.') - GPM_METRIC_NVDEC_2_UTIL = (NVML_GPM_METRIC_NVDEC_2_UTIL, 'Percent utilization of NVDEC 2. 0.0 - 100.0.') - GPM_METRIC_NVDEC_3_UTIL = (NVML_GPM_METRIC_NVDEC_3_UTIL, 'Percent utilization of NVDEC 3. 0.0 - 100.0.') - GPM_METRIC_NVDEC_4_UTIL = (NVML_GPM_METRIC_NVDEC_4_UTIL, 'Percent utilization of NVDEC 4. 0.0 - 100.0.') - GPM_METRIC_NVDEC_5_UTIL = (NVML_GPM_METRIC_NVDEC_5_UTIL, 'Percent utilization of NVDEC 5. 0.0 - 100.0.') - GPM_METRIC_NVDEC_6_UTIL = (NVML_GPM_METRIC_NVDEC_6_UTIL, 'Percent utilization of NVDEC 6. 0.0 - 100.0.') - GPM_METRIC_NVDEC_7_UTIL = (NVML_GPM_METRIC_NVDEC_7_UTIL, 'Percent utilization of NVDEC 7. 0.0 - 100.0.') - GPM_METRIC_NVJPG_0_UTIL = (NVML_GPM_METRIC_NVJPG_0_UTIL, 'Percent utilization of NVJPG 0. 0.0 - 100.0.') - GPM_METRIC_NVJPG_1_UTIL = (NVML_GPM_METRIC_NVJPG_1_UTIL, 'Percent utilization of NVJPG 1. 0.0 - 100.0.') - GPM_METRIC_NVJPG_2_UTIL = (NVML_GPM_METRIC_NVJPG_2_UTIL, 'Percent utilization of NVJPG 2. 0.0 - 100.0.') - GPM_METRIC_NVJPG_3_UTIL = (NVML_GPM_METRIC_NVJPG_3_UTIL, 'Percent utilization of NVJPG 3. 0.0 - 100.0.') - GPM_METRIC_NVJPG_4_UTIL = (NVML_GPM_METRIC_NVJPG_4_UTIL, 'Percent utilization of NVJPG 4. 0.0 - 100.0.') - GPM_METRIC_NVJPG_5_UTIL = (NVML_GPM_METRIC_NVJPG_5_UTIL, 'Percent utilization of NVJPG 5. 0.0 - 100.0.') - GPM_METRIC_NVJPG_6_UTIL = (NVML_GPM_METRIC_NVJPG_6_UTIL, 'Percent utilization of NVJPG 6. 0.0 - 100.0.') - GPM_METRIC_NVJPG_7_UTIL = (NVML_GPM_METRIC_NVJPG_7_UTIL, 'Percent utilization of NVJPG 7. 0.0 - 100.0.') - GPM_METRIC_NVOFA_0_UTIL = (NVML_GPM_METRIC_NVOFA_0_UTIL, 'Percent utilization of NVOFA 0. 0.0 - 100.0.') - GPM_METRIC_NVOFA_1_UTIL = (NVML_GPM_METRIC_NVOFA_1_UTIL, 'Percent utilization of NVOFA 1. 0.0 - 100.0.') - GPM_METRIC_NVLINK_TOTAL_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_TOTAL_RX_PER_SEC, 'NvLink read bandwidth for all links in MiB/sec.') - GPM_METRIC_NVLINK_TOTAL_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_TOTAL_TX_PER_SEC, 'NvLink write bandwidth for all links in MiB/sec.') - GPM_METRIC_NVLINK_L0_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L0_RX_PER_SEC, 'NvLink read bandwidth for link 0 in MiB/sec.') - GPM_METRIC_NVLINK_L0_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L0_TX_PER_SEC, 'NvLink write bandwidth for link 0 in MiB/sec.') - GPM_METRIC_NVLINK_L1_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L1_RX_PER_SEC, 'NvLink read bandwidth for link 1 in MiB/sec.') - GPM_METRIC_NVLINK_L1_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L1_TX_PER_SEC, 'NvLink write bandwidth for link 1 in MiB/sec.') - GPM_METRIC_NVLINK_L2_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L2_RX_PER_SEC, 'NvLink read bandwidth for link 2 in MiB/sec.') - GPM_METRIC_NVLINK_L2_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L2_TX_PER_SEC, 'NvLink write bandwidth for link 2 in MiB/sec.') - GPM_METRIC_NVLINK_L3_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L3_RX_PER_SEC, 'NvLink read bandwidth for link 3 in MiB/sec.') - GPM_METRIC_NVLINK_L3_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L3_TX_PER_SEC, 'NvLink write bandwidth for link 3 in MiB/sec.') - GPM_METRIC_NVLINK_L4_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L4_RX_PER_SEC, 'NvLink read bandwidth for link 4 in MiB/sec.') - GPM_METRIC_NVLINK_L4_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L4_TX_PER_SEC, 'NvLink write bandwidth for link 4 in MiB/sec.') - GPM_METRIC_NVLINK_L5_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L5_RX_PER_SEC, 'NvLink read bandwidth for link 5 in MiB/sec.') - GPM_METRIC_NVLINK_L5_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L5_TX_PER_SEC, 'NvLink write bandwidth for link 5 in MiB/sec.') - GPM_METRIC_NVLINK_L6_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L6_RX_PER_SEC, 'NvLink read bandwidth for link 6 in MiB/sec.') - GPM_METRIC_NVLINK_L6_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L6_TX_PER_SEC, 'NvLink write bandwidth for link 6 in MiB/sec.') - GPM_METRIC_NVLINK_L7_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L7_RX_PER_SEC, 'NvLink read bandwidth for link 7 in MiB/sec.') - GPM_METRIC_NVLINK_L7_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L7_TX_PER_SEC, 'NvLink write bandwidth for link 7 in MiB/sec.') - GPM_METRIC_NVLINK_L8_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L8_RX_PER_SEC, 'NvLink read bandwidth for link 8 in MiB/sec.') - GPM_METRIC_NVLINK_L8_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L8_TX_PER_SEC, 'NvLink write bandwidth for link 8 in MiB/sec.') - GPM_METRIC_NVLINK_L9_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L9_RX_PER_SEC, 'NvLink read bandwidth for link 9 in MiB/sec.') - GPM_METRIC_NVLINK_L9_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L9_TX_PER_SEC, 'NvLink write bandwidth for link 9 in MiB/sec.') - GPM_METRIC_NVLINK_L10_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L10_RX_PER_SEC, 'NvLink read bandwidth for link 10 in MiB/sec.') - GPM_METRIC_NVLINK_L10_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L10_TX_PER_SEC, 'NvLink write bandwidth for link 10 in MiB/sec.') - GPM_METRIC_NVLINK_L11_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L11_RX_PER_SEC, 'NvLink read bandwidth for link 11 in MiB/sec.') - GPM_METRIC_NVLINK_L11_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L11_TX_PER_SEC, 'NvLink write bandwidth for link 11 in MiB/sec.') - GPM_METRIC_NVLINK_L12_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L12_RX_PER_SEC, 'NvLink read bandwidth for link 12 in MiB/sec.') - GPM_METRIC_NVLINK_L12_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L12_TX_PER_SEC, 'NvLink write bandwidth for link 12 in MiB/sec.') - GPM_METRIC_NVLINK_L13_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L13_RX_PER_SEC, 'NvLink read bandwidth for link 13 in MiB/sec.') - GPM_METRIC_NVLINK_L13_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L13_TX_PER_SEC, 'NvLink write bandwidth for link 13 in MiB/sec.') - GPM_METRIC_NVLINK_L14_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L14_RX_PER_SEC, 'NvLink read bandwidth for link 14 in MiB/sec.') - GPM_METRIC_NVLINK_L14_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L14_TX_PER_SEC, 'NvLink write bandwidth for link 14 in MiB/sec.') - GPM_METRIC_NVLINK_L15_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L15_RX_PER_SEC, 'NvLink read bandwidth for link 15 in MiB/sec.') - GPM_METRIC_NVLINK_L15_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L15_TX_PER_SEC, 'NvLink write bandwidth for link 15 in MiB/sec.') - GPM_METRIC_NVLINK_L16_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L16_RX_PER_SEC, 'NvLink read bandwidth for link 16 in MiB/sec.') - GPM_METRIC_NVLINK_L16_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L16_TX_PER_SEC, 'NvLink write bandwidth for link 16 in MiB/sec.') - GPM_METRIC_NVLINK_L17_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L17_RX_PER_SEC, 'NvLink read bandwidth for link 17 in MiB/sec.') - GPM_METRIC_NVLINK_L17_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L17_TX_PER_SEC, 'NvLink write bandwidth for link 17 in MiB/sec.') - GPM_METRIC_C2C_TOTAL_TX_PER_SEC = (NVML_GPM_METRIC_C2C_TOTAL_TX_PER_SEC, 'C2C total transmit bandwidth in MiB/sec.') - GPM_METRIC_C2C_TOTAL_RX_PER_SEC = (NVML_GPM_METRIC_C2C_TOTAL_RX_PER_SEC, 'C2C total receive bandwidth in MiB/sec.') - GPM_METRIC_C2C_DATA_TX_PER_SEC = (NVML_GPM_METRIC_C2C_DATA_TX_PER_SEC, 'C2C data transmit bandwidth in MiB/sec.') - GPM_METRIC_C2C_DATA_RX_PER_SEC = (NVML_GPM_METRIC_C2C_DATA_RX_PER_SEC, 'C2C data receive bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK0_TOTAL_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK0_TOTAL_TX_PER_SEC, 'C2C link 0 total transmit bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK0_TOTAL_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK0_TOTAL_RX_PER_SEC, 'C2C link 0 total receive bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK0_DATA_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK0_DATA_TX_PER_SEC, 'C2C link 0 data transmit bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK0_DATA_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK0_DATA_RX_PER_SEC, 'C2C link 0 data receive bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK1_TOTAL_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK1_TOTAL_TX_PER_SEC, 'C2C link 1 total transmit bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK1_TOTAL_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK1_TOTAL_RX_PER_SEC, 'C2C link 1 total receive bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK1_DATA_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK1_DATA_TX_PER_SEC, 'C2C link 1 data transmit bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK1_DATA_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK1_DATA_RX_PER_SEC, 'C2C link 1 data receive bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK2_TOTAL_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK2_TOTAL_TX_PER_SEC, 'C2C link 2 total transmit bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK2_TOTAL_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK2_TOTAL_RX_PER_SEC, 'C2C link 2 total receive bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK2_DATA_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK2_DATA_TX_PER_SEC, 'C2C link 2 data transmit bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK2_DATA_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK2_DATA_RX_PER_SEC, 'C2C link 2 data receive bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK3_TOTAL_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK3_TOTAL_TX_PER_SEC, 'C2C link 3 total transmit bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK3_TOTAL_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK3_TOTAL_RX_PER_SEC, 'C2C link 3 total receive bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK3_DATA_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK3_DATA_TX_PER_SEC, 'C2C link 3 data transmit bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK3_DATA_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK3_DATA_RX_PER_SEC, 'C2C link 3 data receive bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK4_TOTAL_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK4_TOTAL_TX_PER_SEC, 'C2C link 4 total transmit bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK4_TOTAL_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK4_TOTAL_RX_PER_SEC, 'C2C link 4 total receive bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK4_DATA_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK4_DATA_TX_PER_SEC, 'C2C link 4 data transmit bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK4_DATA_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK4_DATA_RX_PER_SEC, 'C2C link 4 data receive bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK5_TOTAL_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK5_TOTAL_TX_PER_SEC, 'C2C link 5 total transmit bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK5_TOTAL_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK5_TOTAL_RX_PER_SEC, 'C2C link 5 total receive bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK5_DATA_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK5_DATA_TX_PER_SEC, 'C2C link 5 data transmit bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK5_DATA_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK5_DATA_RX_PER_SEC, 'C2C link 5 data receive bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK6_TOTAL_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK6_TOTAL_TX_PER_SEC, 'C2C link 6 total transmit bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK6_TOTAL_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK6_TOTAL_RX_PER_SEC, 'C2C link 6 total receive bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK6_DATA_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK6_DATA_TX_PER_SEC, 'C2C link 6 data transmit bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK6_DATA_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK6_DATA_RX_PER_SEC, 'C2C link 6 data receive bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK7_TOTAL_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK7_TOTAL_TX_PER_SEC, 'C2C link 7 total transmit bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK7_TOTAL_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK7_TOTAL_RX_PER_SEC, 'C2C link 7 total receive bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK7_DATA_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK7_DATA_TX_PER_SEC, 'C2C link 7 data transmit bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK7_DATA_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK7_DATA_RX_PER_SEC, 'C2C link 7 data receive bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK8_TOTAL_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK8_TOTAL_TX_PER_SEC, 'C2C link 8 total transmit bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK8_TOTAL_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK8_TOTAL_RX_PER_SEC, 'C2C link 8 total receive bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK8_DATA_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK8_DATA_TX_PER_SEC, 'C2C link 8 data transmit bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK8_DATA_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK8_DATA_RX_PER_SEC, 'C2C link 8 data receive bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK9_TOTAL_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK9_TOTAL_TX_PER_SEC, 'C2C link 9 total transmit bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK9_TOTAL_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK9_TOTAL_RX_PER_SEC, 'C2C link 9 total receive bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK9_DATA_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK9_DATA_TX_PER_SEC, 'C2C link 9 data transmit bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK9_DATA_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK9_DATA_RX_PER_SEC, 'C2C link 9 data receive bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK10_TOTAL_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK10_TOTAL_TX_PER_SEC, 'C2C link 10 total transmit bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK10_TOTAL_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK10_TOTAL_RX_PER_SEC, 'C2C link 10 total receive bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK10_DATA_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK10_DATA_TX_PER_SEC, 'C2C link 10 data transmit bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK10_DATA_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK10_DATA_RX_PER_SEC, 'C2C link 10 data receive bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK11_TOTAL_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK11_TOTAL_TX_PER_SEC, 'C2C link 11 total transmit bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK11_TOTAL_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK11_TOTAL_RX_PER_SEC, 'C2C link 11 total receive bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK11_DATA_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK11_DATA_TX_PER_SEC, 'C2C link 11 data transmit bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK11_DATA_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK11_DATA_RX_PER_SEC, 'C2C link 11 data receive bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK12_TOTAL_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK12_TOTAL_TX_PER_SEC, 'C2C link 12 total transmit bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK12_TOTAL_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK12_TOTAL_RX_PER_SEC, 'C2C link 12 total receive bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK12_DATA_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK12_DATA_TX_PER_SEC, 'C2C link 12 data transmit bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK12_DATA_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK12_DATA_RX_PER_SEC, 'C2C link 12 data receive bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK13_TOTAL_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK13_TOTAL_TX_PER_SEC, 'C2C link 13 total transmit bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK13_TOTAL_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK13_TOTAL_RX_PER_SEC, 'C2C link 13 total receive bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK13_DATA_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK13_DATA_TX_PER_SEC, 'C2C link 13 data transmit bandwidth in MiB/sec.') - GPM_METRIC_C2C_LINK13_DATA_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK13_DATA_RX_PER_SEC, 'C2C link 13 data receive bandwidth in MiB/sec.') - GPM_METRIC_HOSTMEM_CACHE_HIT = (NVML_GPM_METRIC_HOSTMEM_CACHE_HIT, 'Percentage of host memory cache hits. 0.0 - 100.0.') - GPM_METRIC_HOSTMEM_CACHE_MISS = (NVML_GPM_METRIC_HOSTMEM_CACHE_MISS, 'Percentage of host memory cache misses. 0.0 - 100.0.') - GPM_METRIC_PEERMEM_CACHE_HIT = (NVML_GPM_METRIC_PEERMEM_CACHE_HIT, 'Percentage of peer memory cache hits. 0.0 - 100.0.') - GPM_METRIC_PEERMEM_CACHE_MISS = (NVML_GPM_METRIC_PEERMEM_CACHE_MISS, 'Percentage of peer memory cache misses. 0.0 - 100.0.') - GPM_METRIC_DRAM_CACHE_HIT = (NVML_GPM_METRIC_DRAM_CACHE_HIT, 'Percentage of DRAM cache hits. 0.0 - 100.0.') - GPM_METRIC_DRAM_CACHE_MISS = (NVML_GPM_METRIC_DRAM_CACHE_MISS, 'Percentage of DRAM cache misses. 0.0 - 100.0.') - GPM_METRIC_NVENC_0_UTIL = (NVML_GPM_METRIC_NVENC_0_UTIL, 'Percent utilization of NVENC 0. 0.0 - 100.0.') - GPM_METRIC_NVENC_1_UTIL = (NVML_GPM_METRIC_NVENC_1_UTIL, 'Percent utilization of NVENC 1. 0.0 - 100.0.') - GPM_METRIC_NVENC_2_UTIL = (NVML_GPM_METRIC_NVENC_2_UTIL, 'Percent utilization of NVENC 2. 0.0 - 100.0.') - GPM_METRIC_NVENC_3_UTIL = (NVML_GPM_METRIC_NVENC_3_UTIL, 'Percent utilization of NVENC 3. 0.0 - 100.0.') - GPM_METRIC_GR0_CTXSW_CYCLES_ELAPSED = (NVML_GPM_METRIC_GR0_CTXSW_CYCLES_ELAPSED, 'Total context switch cycles elapsed for GR engine 0.') - GPM_METRIC_GR0_CTXSW_CYCLES_ACTIVE = (NVML_GPM_METRIC_GR0_CTXSW_CYCLES_ACTIVE, 'Active context switch cycles for GR engine 0.') - GPM_METRIC_GR0_CTXSW_REQUESTS = (NVML_GPM_METRIC_GR0_CTXSW_REQUESTS, 'Number of context switch requests for GR engine 0.') - GPM_METRIC_GR0_CTXSW_CYCLES_PER_REQ = (NVML_GPM_METRIC_GR0_CTXSW_CYCLES_PER_REQ, 'Average context switch cycles per request for GR engine 0.') - GPM_METRIC_GR0_CTXSW_ACTIVE_PCT = (NVML_GPM_METRIC_GR0_CTXSW_ACTIVE_PCT, 'Percentage of time GR engine 0 context switches were active. 0.0 - 100.0.') - GPM_METRIC_GR1_CTXSW_CYCLES_ELAPSED = (NVML_GPM_METRIC_GR1_CTXSW_CYCLES_ELAPSED, 'Total context switch cycles elapsed for GR engine 1.') - GPM_METRIC_GR1_CTXSW_CYCLES_ACTIVE = (NVML_GPM_METRIC_GR1_CTXSW_CYCLES_ACTIVE, 'Active context switch cycles for GR engine 1.') - GPM_METRIC_GR1_CTXSW_REQUESTS = (NVML_GPM_METRIC_GR1_CTXSW_REQUESTS, 'Number of context switch requests for GR engine 1.') - GPM_METRIC_GR1_CTXSW_CYCLES_PER_REQ = (NVML_GPM_METRIC_GR1_CTXSW_CYCLES_PER_REQ, 'Average context switch cycles per request for GR engine 1.') - GPM_METRIC_GR1_CTXSW_ACTIVE_PCT = (NVML_GPM_METRIC_GR1_CTXSW_ACTIVE_PCT, 'Percentage of time GR engine 1 context switches were active. 0.0 - 100.0.') - GPM_METRIC_GR2_CTXSW_CYCLES_ELAPSED = (NVML_GPM_METRIC_GR2_CTXSW_CYCLES_ELAPSED, 'Total context switch cycles elapsed for GR engine 2.') - GPM_METRIC_GR2_CTXSW_CYCLES_ACTIVE = (NVML_GPM_METRIC_GR2_CTXSW_CYCLES_ACTIVE, 'Active context switch cycles for GR engine 2.') - GPM_METRIC_GR2_CTXSW_REQUESTS = (NVML_GPM_METRIC_GR2_CTXSW_REQUESTS, 'Number of context switch requests for GR engine 2.') - GPM_METRIC_GR2_CTXSW_CYCLES_PER_REQ = (NVML_GPM_METRIC_GR2_CTXSW_CYCLES_PER_REQ, 'Average context switch cycles per request for GR engine 2.') - GPM_METRIC_GR2_CTXSW_ACTIVE_PCT = (NVML_GPM_METRIC_GR2_CTXSW_ACTIVE_PCT, 'Percentage of time GR engine 2 context switches were active. 0.0 - 100.0.') - GPM_METRIC_GR3_CTXSW_CYCLES_ELAPSED = (NVML_GPM_METRIC_GR3_CTXSW_CYCLES_ELAPSED, 'Total context switch cycles elapsed for GR engine 3.') - GPM_METRIC_GR3_CTXSW_CYCLES_ACTIVE = (NVML_GPM_METRIC_GR3_CTXSW_CYCLES_ACTIVE, 'Active context switch cycles for GR engine 3.') - GPM_METRIC_GR3_CTXSW_REQUESTS = (NVML_GPM_METRIC_GR3_CTXSW_REQUESTS, 'Number of context switch requests for GR engine 3.') - GPM_METRIC_GR3_CTXSW_CYCLES_PER_REQ = (NVML_GPM_METRIC_GR3_CTXSW_CYCLES_PER_REQ, 'Average context switch cycles per request for GR engine 3.') - GPM_METRIC_GR3_CTXSW_ACTIVE_PCT = (NVML_GPM_METRIC_GR3_CTXSW_ACTIVE_PCT, 'Percentage of time GR engine 3 context switches were active. 0.0 - 100.0.') - GPM_METRIC_GR4_CTXSW_CYCLES_ELAPSED = (NVML_GPM_METRIC_GR4_CTXSW_CYCLES_ELAPSED, 'Total context switch cycles elapsed for GR engine 4.') - GPM_METRIC_GR4_CTXSW_CYCLES_ACTIVE = (NVML_GPM_METRIC_GR4_CTXSW_CYCLES_ACTIVE, 'Active context switch cycles for GR engine 4.') - GPM_METRIC_GR4_CTXSW_REQUESTS = (NVML_GPM_METRIC_GR4_CTXSW_REQUESTS, 'Number of context switch requests for GR engine 4.') - GPM_METRIC_GR4_CTXSW_CYCLES_PER_REQ = (NVML_GPM_METRIC_GR4_CTXSW_CYCLES_PER_REQ, 'Average context switch cycles per request for GR engine 4.') - GPM_METRIC_GR4_CTXSW_ACTIVE_PCT = (NVML_GPM_METRIC_GR4_CTXSW_ACTIVE_PCT, 'Percentage of time GR engine 4 context switches were active. 0.0 - 100.0.') - GPM_METRIC_GR5_CTXSW_CYCLES_ELAPSED = (NVML_GPM_METRIC_GR5_CTXSW_CYCLES_ELAPSED, 'Total context switch cycles elapsed for GR engine 5.') - GPM_METRIC_GR5_CTXSW_CYCLES_ACTIVE = (NVML_GPM_METRIC_GR5_CTXSW_CYCLES_ACTIVE, 'Active context switch cycles for GR engine 5.') - GPM_METRIC_GR5_CTXSW_REQUESTS = (NVML_GPM_METRIC_GR5_CTXSW_REQUESTS, 'Number of context switch requests for GR engine 5.') - GPM_METRIC_GR5_CTXSW_CYCLES_PER_REQ = (NVML_GPM_METRIC_GR5_CTXSW_CYCLES_PER_REQ, 'Average context switch cycles per request for GR engine 5.') - GPM_METRIC_GR5_CTXSW_ACTIVE_PCT = (NVML_GPM_METRIC_GR5_CTXSW_ACTIVE_PCT, 'Percentage of time GR engine 5 context switches were active. 0.0 - 100.0.') - GPM_METRIC_GR6_CTXSW_CYCLES_ELAPSED = (NVML_GPM_METRIC_GR6_CTXSW_CYCLES_ELAPSED, 'Total context switch cycles elapsed for GR engine 6.') - GPM_METRIC_GR6_CTXSW_CYCLES_ACTIVE = (NVML_GPM_METRIC_GR6_CTXSW_CYCLES_ACTIVE, 'Active context switch cycles for GR engine 6.') - GPM_METRIC_GR6_CTXSW_REQUESTS = (NVML_GPM_METRIC_GR6_CTXSW_REQUESTS, 'Number of context switch requests for GR engine 6.') - GPM_METRIC_GR6_CTXSW_CYCLES_PER_REQ = (NVML_GPM_METRIC_GR6_CTXSW_CYCLES_PER_REQ, 'Average context switch cycles per request for GR engine 6.') - GPM_METRIC_GR6_CTXSW_ACTIVE_PCT = (NVML_GPM_METRIC_GR6_CTXSW_ACTIVE_PCT, 'Percentage of time GR engine 6 context switches were active. 0.0 - 100.0.') - GPM_METRIC_GR7_CTXSW_CYCLES_ELAPSED = (NVML_GPM_METRIC_GR7_CTXSW_CYCLES_ELAPSED, 'Total context switch cycles elapsed for GR engine 7.') - GPM_METRIC_GR7_CTXSW_CYCLES_ACTIVE = (NVML_GPM_METRIC_GR7_CTXSW_CYCLES_ACTIVE, 'Active context switch cycles for GR engine 7.') - GPM_METRIC_GR7_CTXSW_REQUESTS = (NVML_GPM_METRIC_GR7_CTXSW_REQUESTS, 'Number of context switch requests for GR engine 7.') - GPM_METRIC_GR7_CTXSW_CYCLES_PER_REQ = (NVML_GPM_METRIC_GR7_CTXSW_CYCLES_PER_REQ, 'Average context switch cycles per request for GR engine 7.') - GPM_METRIC_GR7_CTXSW_ACTIVE_PCT = (NVML_GPM_METRIC_GR7_CTXSW_ACTIVE_PCT, 'Percentage of time GR engine 7 context switches were active. 0.0 - 100.0.') - GPM_METRIC_NVLINK_L18_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L18_RX_PER_SEC, 'NvLink read bandwidth for link 18 in MiB/sec.') - GPM_METRIC_NVLINK_L18_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L18_TX_PER_SEC, 'NvLink write bandwidth for link 18 in MiB/sec.') - GPM_METRIC_NVLINK_L19_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L19_RX_PER_SEC, 'NvLink read bandwidth for link 19 in MiB/sec.') - GPM_METRIC_NVLINK_L19_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L19_TX_PER_SEC, 'NvLink write bandwidth for link 19 in MiB/sec.') - GPM_METRIC_NVLINK_L20_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L20_RX_PER_SEC, 'NvLink read bandwidth for link 20 in MiB/sec.') - GPM_METRIC_NVLINK_L20_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L20_TX_PER_SEC, 'NvLink write bandwidth for link 20 in MiB/sec.') - GPM_METRIC_NVLINK_L21_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L21_RX_PER_SEC, 'NvLink read bandwidth for link 21 in MiB/sec.') - GPM_METRIC_NVLINK_L21_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L21_TX_PER_SEC, 'NvLink write bandwidth for link 21 in MiB/sec.') - GPM_METRIC_NVLINK_L22_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L22_RX_PER_SEC, 'NvLink read bandwidth for link 22 in MiB/sec.') - GPM_METRIC_NVLINK_L22_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L22_TX_PER_SEC, 'NvLink write bandwidth for link 22 in MiB/sec.') - GPM_METRIC_NVLINK_L23_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L23_RX_PER_SEC, 'NvLink read bandwidth for link 23 in MiB/sec.') - GPM_METRIC_NVLINK_L23_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L23_TX_PER_SEC, 'NvLink write bandwidth for link 23 in MiB/sec.') - GPM_METRIC_NVLINK_L24_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L24_RX_PER_SEC, 'NvLink read bandwidth for link 24 in MiB/sec.') - GPM_METRIC_NVLINK_L24_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L24_TX_PER_SEC, 'NvLink write bandwidth for link 24 in MiB/sec.') - GPM_METRIC_NVLINK_L25_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L25_RX_PER_SEC, 'NvLink read bandwidth for link 25 in MiB/sec.') - GPM_METRIC_NVLINK_L25_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L25_TX_PER_SEC, 'NvLink write bandwidth for link 25 in MiB/sec.') - GPM_METRIC_NVLINK_L26_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L26_RX_PER_SEC, 'NvLink read bandwidth for link 26 in MiB/sec.') - GPM_METRIC_NVLINK_L26_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L26_TX_PER_SEC, 'NvLink write bandwidth for link 26 in MiB/sec.') - GPM_METRIC_NVLINK_L27_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L27_RX_PER_SEC, 'NvLink read bandwidth for link 27 in MiB/sec.') - GPM_METRIC_NVLINK_L27_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L27_TX_PER_SEC, 'NvLink write bandwidth for link 27 in MiB/sec.') - GPM_METRIC_NVLINK_L28_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L28_RX_PER_SEC, 'NvLink read bandwidth for link 28 in MiB/sec.') - GPM_METRIC_NVLINK_L28_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L28_TX_PER_SEC, 'NvLink write bandwidth for link 28 in MiB/sec.') - GPM_METRIC_NVLINK_L29_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L29_RX_PER_SEC, 'NvLink read bandwidth for link 29 in MiB/sec.') - GPM_METRIC_NVLINK_L29_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L29_TX_PER_SEC, 'NvLink write bandwidth for link 29 in MiB/sec.') - GPM_METRIC_NVLINK_L30_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L30_RX_PER_SEC, 'NvLink read bandwidth for link 30 in MiB/sec.') - GPM_METRIC_NVLINK_L30_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L30_TX_PER_SEC, 'NvLink write bandwidth for link 30 in MiB/sec.') - GPM_METRIC_NVLINK_L31_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L31_RX_PER_SEC, 'NvLink read bandwidth for link 31 in MiB/sec.') - GPM_METRIC_NVLINK_L31_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L31_TX_PER_SEC, 'NvLink write bandwidth for link 31 in MiB/sec.') - GPM_METRIC_NVLINK_L32_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L32_RX_PER_SEC, 'NvLink read bandwidth for link 32 in MiB/sec.') - GPM_METRIC_NVLINK_L32_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L32_TX_PER_SEC, 'NvLink write bandwidth for link 32 in MiB/sec.') - GPM_METRIC_NVLINK_L33_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L33_RX_PER_SEC, 'NvLink read bandwidth for link 33 in MiB/sec.') - GPM_METRIC_NVLINK_L33_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L33_TX_PER_SEC, 'NvLink write bandwidth for link 33 in MiB/sec.') - GPM_METRIC_NVLINK_L34_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L34_RX_PER_SEC, 'NvLink read bandwidth for link 34 in MiB/sec.') - GPM_METRIC_NVLINK_L34_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L34_TX_PER_SEC, 'NvLink write bandwidth for link 34 in MiB/sec.') - GPM_METRIC_NVLINK_L35_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L35_RX_PER_SEC, 'NvLink read bandwidth for link 35 in MiB/sec.') - GPM_METRIC_NVLINK_L35_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L35_TX_PER_SEC, 'NvLink write bandwidth for link 35 in MiB/sec.') - GPM_METRIC_SM_CYCLES_ELAPSED = (NVML_GPM_METRIC_SM_CYCLES_ELAPSED, "The GPU's SM cycles elapsed since reboot.") - GPM_METRIC_SM_CYCLES_ACTIVE = (NVML_GPM_METRIC_SM_CYCLES_ACTIVE, "The GPU's SM activity since reboot.") - GPM_METRIC_MMA_CYCLES_ACTIVE = (NVML_GPM_METRIC_MMA_CYCLES_ACTIVE, "The GPU's SM MMA tensor activity since reboot.") - GPM_METRIC_DMMA_CYCLES_ACTIVE = (NVML_GPM_METRIC_DMMA_CYCLES_ACTIVE, "The GPU's SM DMMA tensor activity since reboot.") - GPM_METRIC_HMMA_CYCLES_ACTIVE = (NVML_GPM_METRIC_HMMA_CYCLES_ACTIVE, "The GPU's SM HMMA tensor activity since reboot.") - GPM_METRIC_IMMA_CYCLES_ACTIVE = (NVML_GPM_METRIC_IMMA_CYCLES_ACTIVE, "The GPU's SM IMMA tensor activity since reboot.") - GPM_METRIC_DFMA_CYCLES_ACTIVE = (NVML_GPM_METRIC_DFMA_CYCLES_ACTIVE, "The GPU's SM DFMA tensor activity since reboot.") - GPM_METRIC_PCIE_TX = (NVML_GPM_METRIC_PCIE_TX, 'The PCIe TX traffic since reboot.') - GPM_METRIC_PCIE_RX = (NVML_GPM_METRIC_PCIE_RX, 'The PCIe RX traffic since reboot.') - GPM_METRIC_INTEGER_CYCLES_ACTIVE = (NVML_GPM_METRIC_INTEGER_CYCLES_ACTIVE, "The GPU's SM integer activity since reboot.") - GPM_METRIC_FP64_CYCLES_ACTIVE = (NVML_GPM_METRIC_FP64_CYCLES_ACTIVE, "The GPU's SM FP64 activity since reboot.") - GPM_METRIC_FP32_CYCLES_ACTIVE = (NVML_GPM_METRIC_FP32_CYCLES_ACTIVE, "The GPU's SM FP32 activity since reboot.") - GPM_METRIC_FP16_CYCLES_ACTIVE = (NVML_GPM_METRIC_FP16_CYCLES_ACTIVE, "The GPU's SM FP16 activity since reboot.") - GPM_METRIC_NVLINK_L0_RX = (NVML_GPM_METRIC_NVLINK_L0_RX, 'NvLink read for link 0 in bytes since reboot.') - GPM_METRIC_NVLINK_L0_TX = (NVML_GPM_METRIC_NVLINK_L0_TX, 'NvLink write for link 0 in bytes since reboot.') - GPM_METRIC_NVLINK_L1_RX = (NVML_GPM_METRIC_NVLINK_L1_RX, 'NvLink read for link 1 in bytes since reboot.') - GPM_METRIC_NVLINK_L1_TX = (NVML_GPM_METRIC_NVLINK_L1_TX, 'NvLink write for link 1 in bytes since reboot.') - GPM_METRIC_NVLINK_L2_RX = (NVML_GPM_METRIC_NVLINK_L2_RX, 'NvLink read for link 2 in bytes since reboot.') - GPM_METRIC_NVLINK_L2_TX = (NVML_GPM_METRIC_NVLINK_L2_TX, 'NvLink write for link 2 in bytes since reboot.') - GPM_METRIC_NVLINK_L3_RX = (NVML_GPM_METRIC_NVLINK_L3_RX, 'NvLink read for link 3 in bytes since reboot.') - GPM_METRIC_NVLINK_L3_TX = (NVML_GPM_METRIC_NVLINK_L3_TX, 'NvLink write for link 3 in bytes since reboot.') - GPM_METRIC_NVLINK_L4_RX = (NVML_GPM_METRIC_NVLINK_L4_RX, 'NvLink read for link 4 in bytes since reboot.') - GPM_METRIC_NVLINK_L4_TX = (NVML_GPM_METRIC_NVLINK_L4_TX, 'NvLink write for link 4 in bytes since reboot.') - GPM_METRIC_NVLINK_L5_RX = (NVML_GPM_METRIC_NVLINK_L5_RX, 'NvLink read for link 5 in bytes since reboot.') - GPM_METRIC_NVLINK_L5_TX = (NVML_GPM_METRIC_NVLINK_L5_TX, 'NvLink write for link 5 in bytes since reboot.') - GPM_METRIC_NVLINK_L6_RX = (NVML_GPM_METRIC_NVLINK_L6_RX, 'NvLink read for link 6 in bytes since reboot.') - GPM_METRIC_NVLINK_L6_TX = (NVML_GPM_METRIC_NVLINK_L6_TX, 'NvLink write for link 6 in bytes since reboot.') - GPM_METRIC_NVLINK_L7_RX = (NVML_GPM_METRIC_NVLINK_L7_RX, 'NvLink read for link 7 in bytes since reboot.') - GPM_METRIC_NVLINK_L7_TX = (NVML_GPM_METRIC_NVLINK_L7_TX, 'NvLink write for link 7 in bytes since reboot.') - GPM_METRIC_NVLINK_L8_RX = (NVML_GPM_METRIC_NVLINK_L8_RX, 'NvLink read for link 8 in bytes since reboot.') - GPM_METRIC_NVLINK_L8_TX = (NVML_GPM_METRIC_NVLINK_L8_TX, 'NvLink write for link 8 in bytes since reboot.') - GPM_METRIC_NVLINK_L9_RX = (NVML_GPM_METRIC_NVLINK_L9_RX, 'NvLink read for link 9 in bytes since reboot.') - GPM_METRIC_NVLINK_L9_TX = (NVML_GPM_METRIC_NVLINK_L9_TX, 'NvLink write for link 9 in bytes since reboot.') - GPM_METRIC_NVLINK_L10_RX = (NVML_GPM_METRIC_NVLINK_L10_RX, 'NvLink read for link 10 in bytes since reboot.') - GPM_METRIC_NVLINK_L10_TX = (NVML_GPM_METRIC_NVLINK_L10_TX, 'NvLink write for link 10 in bytes since reboot.') - GPM_METRIC_NVLINK_L11_RX = (NVML_GPM_METRIC_NVLINK_L11_RX, 'NvLink read for link 11 in bytes since reboot.') - GPM_METRIC_NVLINK_L11_TX = (NVML_GPM_METRIC_NVLINK_L11_TX, 'NvLink write for link 11 in bytes since reboot.') - GPM_METRIC_NVLINK_L12_RX = (NVML_GPM_METRIC_NVLINK_L12_RX, 'NvLink read for link 12 in bytes since reboot.') - GPM_METRIC_NVLINK_L12_TX = (NVML_GPM_METRIC_NVLINK_L12_TX, 'NvLink write for link 12 in bytes since reboot.') - GPM_METRIC_NVLINK_L13_RX = (NVML_GPM_METRIC_NVLINK_L13_RX, 'NvLink read for link 13 in bytes since reboot.') - GPM_METRIC_NVLINK_L13_TX = (NVML_GPM_METRIC_NVLINK_L13_TX, 'NvLink write for link 13 in bytes since reboot.') - GPM_METRIC_NVLINK_L14_RX = (NVML_GPM_METRIC_NVLINK_L14_RX, 'NvLink read for link 14 in bytes since reboot.') - GPM_METRIC_NVLINK_L14_TX = (NVML_GPM_METRIC_NVLINK_L14_TX, 'NvLink write for link 14 in bytes since reboot.') - GPM_METRIC_NVLINK_L15_RX = (NVML_GPM_METRIC_NVLINK_L15_RX, 'NvLink read for link 15 in bytes since reboot.') - GPM_METRIC_NVLINK_L15_TX = (NVML_GPM_METRIC_NVLINK_L15_TX, 'NvLink write for link 15 in bytes since reboot.') - GPM_METRIC_NVLINK_L16_RX = (NVML_GPM_METRIC_NVLINK_L16_RX, 'NvLink read for link 16 in bytes since reboot.') - GPM_METRIC_NVLINK_L16_TX = (NVML_GPM_METRIC_NVLINK_L16_TX, 'NvLink write for link 16 in bytes since reboot.') - GPM_METRIC_NVLINK_L17_RX = (NVML_GPM_METRIC_NVLINK_L17_RX, 'NvLink read for link 17 in bytes since reboot.') - GPM_METRIC_NVLINK_L17_TX = (NVML_GPM_METRIC_NVLINK_L17_TX, 'NvLink write for link 17 in bytes since reboot.') - GPM_METRIC_NVLINK_L18_RX = (NVML_GPM_METRIC_NVLINK_L18_RX, 'NvLink read for link 18 in bytes since reboot.') - GPM_METRIC_NVLINK_L18_TX = (NVML_GPM_METRIC_NVLINK_L18_TX, 'NvLink write for link 18 in bytes since reboot.') - GPM_METRIC_NVLINK_L19_RX = (NVML_GPM_METRIC_NVLINK_L19_RX, 'NvLink read for link 19 in bytes since reboot.') - GPM_METRIC_NVLINK_L19_TX = (NVML_GPM_METRIC_NVLINK_L19_TX, 'NvLink write for link 19 in bytes since reboot.') - GPM_METRIC_NVLINK_L20_RX = (NVML_GPM_METRIC_NVLINK_L20_RX, 'NvLink read for link 20 in bytes since reboot.') - GPM_METRIC_NVLINK_L20_TX = (NVML_GPM_METRIC_NVLINK_L20_TX, 'NvLink write for link 20 in bytes since reboot.') - GPM_METRIC_NVLINK_L21_RX = (NVML_GPM_METRIC_NVLINK_L21_RX, 'NvLink read for link 21 in bytes since reboot.') - GPM_METRIC_NVLINK_L21_TX = (NVML_GPM_METRIC_NVLINK_L21_TX, 'NvLink write for link 21 in bytes since reboot.') - GPM_METRIC_NVLINK_L22_RX = (NVML_GPM_METRIC_NVLINK_L22_RX, 'NvLink read for link 22 in bytes since reboot.') - GPM_METRIC_NVLINK_L22_TX = (NVML_GPM_METRIC_NVLINK_L22_TX, 'NvLink write for link 22 in bytes since reboot.') - GPM_METRIC_NVLINK_L23_RX = (NVML_GPM_METRIC_NVLINK_L23_RX, 'NvLink read for link 23 in bytes since reboot.') - GPM_METRIC_NVLINK_L23_TX = (NVML_GPM_METRIC_NVLINK_L23_TX, 'NvLink write for link 23 in bytes since reboot.') - GPM_METRIC_NVLINK_L24_RX = (NVML_GPM_METRIC_NVLINK_L24_RX, 'NvLink read for link 24 in bytes since reboot.') - GPM_METRIC_NVLINK_L24_TX = (NVML_GPM_METRIC_NVLINK_L24_TX, 'NvLink write for link 24 in bytes since reboot.') - GPM_METRIC_NVLINK_L25_RX = (NVML_GPM_METRIC_NVLINK_L25_RX, 'NvLink read for link 25 in bytes since reboot.') - GPM_METRIC_NVLINK_L25_TX = (NVML_GPM_METRIC_NVLINK_L25_TX, 'NvLink write for link 25 in bytes since reboot.') - GPM_METRIC_NVLINK_L26_RX = (NVML_GPM_METRIC_NVLINK_L26_RX, 'NvLink read for link 26 in bytes since reboot.') - GPM_METRIC_NVLINK_L26_TX = (NVML_GPM_METRIC_NVLINK_L26_TX, 'NvLink write for link 26 in bytes since reboot.') - GPM_METRIC_NVLINK_L27_RX = (NVML_GPM_METRIC_NVLINK_L27_RX, 'NvLink read for link 27 in bytes since reboot.') - GPM_METRIC_NVLINK_L27_TX = (NVML_GPM_METRIC_NVLINK_L27_TX, 'NvLink write for link 27 in bytes since reboot.') - GPM_METRIC_NVLINK_L28_RX = (NVML_GPM_METRIC_NVLINK_L28_RX, 'NvLink read for link 28 in bytes since reboot.') - GPM_METRIC_NVLINK_L28_TX = (NVML_GPM_METRIC_NVLINK_L28_TX, 'NvLink write for link 28 in bytes since reboot.') - GPM_METRIC_NVLINK_L29_RX = (NVML_GPM_METRIC_NVLINK_L29_RX, 'NvLink read for link 29 in bytes since reboot.') - GPM_METRIC_NVLINK_L29_TX = (NVML_GPM_METRIC_NVLINK_L29_TX, 'NvLink write for link 29 in bytes since reboot.') - GPM_METRIC_NVLINK_L30_RX = (NVML_GPM_METRIC_NVLINK_L30_RX, 'NvLink read for link 30 in bytes since reboot.') - GPM_METRIC_NVLINK_L30_TX = (NVML_GPM_METRIC_NVLINK_L30_TX, 'NvLink write for link 30 in bytes since reboot.') - GPM_METRIC_NVLINK_L31_RX = (NVML_GPM_METRIC_NVLINK_L31_RX, 'NvLink read for link 31 in bytes since reboot.') - GPM_METRIC_NVLINK_L31_TX = (NVML_GPM_METRIC_NVLINK_L31_TX, 'NvLink write for link 31 in bytes since reboot.') - GPM_METRIC_NVLINK_L32_RX = (NVML_GPM_METRIC_NVLINK_L32_RX, 'NvLink read for link 32 in bytes since reboot.') - GPM_METRIC_NVLINK_L32_TX = (NVML_GPM_METRIC_NVLINK_L32_TX, 'NvLink write for link 32 in bytes since reboot.') - GPM_METRIC_NVLINK_L33_RX = (NVML_GPM_METRIC_NVLINK_L33_RX, 'NvLink read for link 33 in bytes since reboot.') - GPM_METRIC_NVLINK_L33_TX = (NVML_GPM_METRIC_NVLINK_L33_TX, 'NvLink write for link 33 in bytes since reboot.') - GPM_METRIC_NVLINK_L34_RX = (NVML_GPM_METRIC_NVLINK_L34_RX, 'NvLink read for link 34 in bytes since reboot.') - GPM_METRIC_NVLINK_L34_TX = (NVML_GPM_METRIC_NVLINK_L34_TX, 'NvLink write for link 34 in bytes since reboot.') - GPM_METRIC_NVLINK_L35_RX = (NVML_GPM_METRIC_NVLINK_L35_RX, 'NvLink read for link 35 in bytes since reboot.') - GPM_METRIC_NVLINK_L35_TX = (NVML_GPM_METRIC_NVLINK_L35_TX, 'NvLink write for link 35 in bytes since reboot.') - GPM_METRIC_NVLINK_L36_RX = (NVML_GPM_METRIC_NVLINK_L36_RX, 'NvLink read for link 36 in bytes since reboot.') - GPM_METRIC_NVLINK_L36_TX = (NVML_GPM_METRIC_NVLINK_L36_TX, 'NvLink write for link 36 in bytes since reboot.') - GPM_METRIC_NVLINK_L37_RX = (NVML_GPM_METRIC_NVLINK_L37_RX, 'NvLink read for link 37 in bytes since reboot.') - GPM_METRIC_NVLINK_L37_TX = (NVML_GPM_METRIC_NVLINK_L37_TX, 'NvLink write for link 37 in bytes since reboot.') - GPM_METRIC_NVLINK_L38_RX = (NVML_GPM_METRIC_NVLINK_L38_RX, 'NvLink read for link 38 in bytes since reboot.') - GPM_METRIC_NVLINK_L38_TX = (NVML_GPM_METRIC_NVLINK_L38_TX, 'NvLink write for link 38 in bytes since reboot.') - GPM_METRIC_NVLINK_L39_RX = (NVML_GPM_METRIC_NVLINK_L39_RX, 'NvLink read for link 39 in bytes since reboot.') - GPM_METRIC_NVLINK_L39_TX = (NVML_GPM_METRIC_NVLINK_L39_TX, 'NvLink write for link 39 in bytes since reboot.') - GPM_METRIC_NVLINK_L40_RX = (NVML_GPM_METRIC_NVLINK_L40_RX, 'NvLink read for link 40 in bytes since reboot.') - GPM_METRIC_NVLINK_L40_TX = (NVML_GPM_METRIC_NVLINK_L40_TX, 'NvLink write for link 40 in bytes since reboot.') - GPM_METRIC_NVLINK_L41_RX = (NVML_GPM_METRIC_NVLINK_L41_RX, 'NvLink read for link 41 in bytes since reboot.') - GPM_METRIC_NVLINK_L41_TX = (NVML_GPM_METRIC_NVLINK_L41_TX, 'NvLink write for link 41 in bytes since reboot.') - GPM_METRIC_NVLINK_L42_RX = (NVML_GPM_METRIC_NVLINK_L42_RX, 'NvLink read for link 42 in bytes since reboot.') - GPM_METRIC_NVLINK_L42_TX = (NVML_GPM_METRIC_NVLINK_L42_TX, 'NvLink write for link 42 in bytes since reboot.') - GPM_METRIC_NVLINK_L43_RX = (NVML_GPM_METRIC_NVLINK_L43_RX, 'NvLink read for link 43 in bytes since reboot.') - GPM_METRIC_NVLINK_L43_TX = (NVML_GPM_METRIC_NVLINK_L43_TX, 'NvLink write for link 43 in bytes since reboot.') - GPM_METRIC_NVLINK_L44_RX = (NVML_GPM_METRIC_NVLINK_L44_RX, 'NvLink read for link 44 in bytes since reboot.') - GPM_METRIC_NVLINK_L44_TX = (NVML_GPM_METRIC_NVLINK_L44_TX, 'NvLink write for link 44 in bytes since reboot.') - GPM_METRIC_NVLINK_L45_RX = (NVML_GPM_METRIC_NVLINK_L45_RX, 'NvLink read for link 45 in bytes since reboot.') - GPM_METRIC_NVLINK_L45_TX = (NVML_GPM_METRIC_NVLINK_L45_TX, 'NvLink write for link 45 in bytes since reboot.') - GPM_METRIC_NVLINK_L46_RX = (NVML_GPM_METRIC_NVLINK_L46_RX, 'NvLink read for link 46 in bytes since reboot.') - GPM_METRIC_NVLINK_L46_TX = (NVML_GPM_METRIC_NVLINK_L46_TX, 'NvLink write for link 46 in bytes since reboot.') - GPM_METRIC_NVLINK_L47_RX = (NVML_GPM_METRIC_NVLINK_L47_RX, 'NvLink read for link 47 in bytes since reboot.') - GPM_METRIC_NVLINK_L47_TX = (NVML_GPM_METRIC_NVLINK_L47_TX, 'NvLink write for link 47 in bytes since reboot.') - GPM_METRIC_NVLINK_L48_RX = (NVML_GPM_METRIC_NVLINK_L48_RX, 'NvLink read for link 48 in bytes since reboot.') - GPM_METRIC_NVLINK_L48_TX = (NVML_GPM_METRIC_NVLINK_L48_TX, 'NvLink write for link 48 in bytes since reboot.') - GPM_METRIC_NVLINK_L49_RX = (NVML_GPM_METRIC_NVLINK_L49_RX, 'NvLink read for link 49 in bytes since reboot.') - GPM_METRIC_NVLINK_L49_TX = (NVML_GPM_METRIC_NVLINK_L49_TX, 'NvLink write for link 49 in bytes since reboot.') - GPM_METRIC_NVLINK_L50_RX = (NVML_GPM_METRIC_NVLINK_L50_RX, 'NvLink read for link 50 in bytes since reboot.') - GPM_METRIC_NVLINK_L50_TX = (NVML_GPM_METRIC_NVLINK_L50_TX, 'NvLink write for link 50 in bytes since reboot.') - GPM_METRIC_NVLINK_L51_RX = (NVML_GPM_METRIC_NVLINK_L51_RX, 'NvLink read for link 51 in bytes since reboot.') - GPM_METRIC_NVLINK_L51_TX = (NVML_GPM_METRIC_NVLINK_L51_TX, 'NvLink write for link 51 in bytes since reboot.') - GPM_METRIC_NVLINK_L52_RX = (NVML_GPM_METRIC_NVLINK_L52_RX, 'NvLink read for link 52 in bytes since reboot.') - GPM_METRIC_NVLINK_L52_TX = (NVML_GPM_METRIC_NVLINK_L52_TX, 'NvLink write for link 52 in bytes since reboot.') - GPM_METRIC_NVLINK_L53_RX = (NVML_GPM_METRIC_NVLINK_L53_RX, 'NvLink read for link 53 in bytes since reboot.') - GPM_METRIC_NVLINK_L53_TX = (NVML_GPM_METRIC_NVLINK_L53_TX, 'NvLink write for link 53 in bytes since reboot.') - GPM_METRIC_NVLINK_L54_RX = (NVML_GPM_METRIC_NVLINK_L54_RX, 'NvLink read for link 54 in bytes since reboot.') - GPM_METRIC_NVLINK_L54_TX = (NVML_GPM_METRIC_NVLINK_L54_TX, 'NvLink write for link 54 in bytes since reboot.') - GPM_METRIC_NVLINK_L55_RX = (NVML_GPM_METRIC_NVLINK_L55_RX, 'NvLink read for link 55 in bytes since reboot.') - GPM_METRIC_NVLINK_L55_TX = (NVML_GPM_METRIC_NVLINK_L55_TX, 'NvLink write for link 55 in bytes since reboot.') - GPM_METRIC_NVLINK_L56_RX = (NVML_GPM_METRIC_NVLINK_L56_RX, 'NvLink read for link 56 in bytes since reboot.') - GPM_METRIC_NVLINK_L56_TX = (NVML_GPM_METRIC_NVLINK_L56_TX, 'NvLink write for link 56 in bytes since reboot.') - GPM_METRIC_NVLINK_L57_RX = (NVML_GPM_METRIC_NVLINK_L57_RX, 'NvLink read for link 57 in bytes since reboot.') - GPM_METRIC_NVLINK_L57_TX = (NVML_GPM_METRIC_NVLINK_L57_TX, 'NvLink write for link 57 in bytes since reboot.') - GPM_METRIC_NVLINK_L58_RX = (NVML_GPM_METRIC_NVLINK_L58_RX, 'NvLink read for link 58 in bytes since reboot.') - GPM_METRIC_NVLINK_L58_TX = (NVML_GPM_METRIC_NVLINK_L58_TX, 'NvLink write for link 58 in bytes since reboot.') - GPM_METRIC_NVLINK_L59_RX = (NVML_GPM_METRIC_NVLINK_L59_RX, 'NvLink read for link 59 in bytes since reboot.') - GPM_METRIC_NVLINK_L59_TX = (NVML_GPM_METRIC_NVLINK_L59_TX, 'NvLink write for link 59 in bytes since reboot.') - GPM_METRIC_NVLINK_L60_RX = (NVML_GPM_METRIC_NVLINK_L60_RX, 'NvLink read for link 60 in bytes since reboot.') - GPM_METRIC_NVLINK_L60_TX = (NVML_GPM_METRIC_NVLINK_L60_TX, 'NvLink write for link 60 in bytes since reboot.') - GPM_METRIC_NVLINK_L61_RX = (NVML_GPM_METRIC_NVLINK_L61_RX, 'NvLink read for link 61 in bytes since reboot.') - GPM_METRIC_NVLINK_L61_TX = (NVML_GPM_METRIC_NVLINK_L61_TX, 'NvLink write for link 61 in bytes since reboot.') - GPM_METRIC_NVLINK_L62_RX = (NVML_GPM_METRIC_NVLINK_L62_RX, 'NvLink read for link 62 in bytes since reboot.') - GPM_METRIC_NVLINK_L62_TX = (NVML_GPM_METRIC_NVLINK_L62_TX, 'NvLink write for link 62 in bytes since reboot.') - GPM_METRIC_NVLINK_L63_RX = (NVML_GPM_METRIC_NVLINK_L63_RX, 'NvLink read for link 63 in bytes since reboot.') - GPM_METRIC_NVLINK_L63_TX = (NVML_GPM_METRIC_NVLINK_L63_TX, 'NvLink write for link 63 in bytes since reboot.') - GPM_METRIC_NVLINK_L64_RX = (NVML_GPM_METRIC_NVLINK_L64_RX, 'NvLink read for link 64 in bytes since reboot.') - GPM_METRIC_NVLINK_L64_TX = (NVML_GPM_METRIC_NVLINK_L64_TX, 'NvLink write for link 64 in bytes since reboot.') - GPM_METRIC_NVLINK_L65_RX = (NVML_GPM_METRIC_NVLINK_L65_RX, 'NvLink read for link 65 in bytes since reboot.') - GPM_METRIC_NVLINK_L65_TX = (NVML_GPM_METRIC_NVLINK_L65_TX, 'NvLink write for link 65 in bytes since reboot.') - GPM_METRIC_NVLINK_L66_RX = (NVML_GPM_METRIC_NVLINK_L66_RX, 'NvLink read for link 66 in bytes since reboot.') - GPM_METRIC_NVLINK_L66_TX = (NVML_GPM_METRIC_NVLINK_L66_TX, 'NvLink write for link 66 in bytes since reboot.') - GPM_METRIC_NVLINK_L67_RX = (NVML_GPM_METRIC_NVLINK_L67_RX, 'NvLink read for link 67 in bytes since reboot.') - GPM_METRIC_NVLINK_L67_TX = (NVML_GPM_METRIC_NVLINK_L67_TX, 'NvLink write for link 67 in bytes since reboot.') - GPM_METRIC_NVLINK_L68_RX = (NVML_GPM_METRIC_NVLINK_L68_RX, 'NvLink read for link 68 in bytes since reboot.') - GPM_METRIC_NVLINK_L68_TX = (NVML_GPM_METRIC_NVLINK_L68_TX, 'NvLink write for link 68 in bytes since reboot.') - GPM_METRIC_NVLINK_L69_RX = (NVML_GPM_METRIC_NVLINK_L69_RX, 'NvLink read for link 69 in bytes since reboot.') - GPM_METRIC_NVLINK_L69_TX = (NVML_GPM_METRIC_NVLINK_L69_TX, 'NvLink write for link 69 in bytes since reboot.') - GPM_METRIC_NVLINK_L70_RX = (NVML_GPM_METRIC_NVLINK_L70_RX, 'NvLink read for link 70 in bytes since reboot.') - GPM_METRIC_NVLINK_L70_TX = (NVML_GPM_METRIC_NVLINK_L70_TX, 'NvLink write for link 70 in bytes since reboot.') - GPM_METRIC_NVLINK_L71_RX = (NVML_GPM_METRIC_NVLINK_L71_RX, 'NvLink read for link 71 in bytes since reboot.') - GPM_METRIC_NVLINK_L71_TX = (NVML_GPM_METRIC_NVLINK_L71_TX, 'NvLink write for link 71 in bytes since reboot.') - GPM_METRIC_NVLINK_L36_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L36_RX_PER_SEC, 'NvLink read bandwidth for link 36 in MiB/sec.') - GPM_METRIC_NVLINK_L36_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L36_TX_PER_SEC, 'NvLink write bandwidth for link 36 in MiB/sec.') - GPM_METRIC_NVLINK_L37_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L37_RX_PER_SEC, 'NvLink read bandwidth for link 37 in MiB/sec.') - GPM_METRIC_NVLINK_L37_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L37_TX_PER_SEC, 'NvLink write bandwidth for link 37 in MiB/sec.') - GPM_METRIC_NVLINK_L38_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L38_RX_PER_SEC, 'NvLink read bandwidth for link 38 in MiB/sec.') - GPM_METRIC_NVLINK_L38_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L38_TX_PER_SEC, 'NvLink write bandwidth for link 38 in MiB/sec.') - GPM_METRIC_NVLINK_L39_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L39_RX_PER_SEC, 'NvLink read bandwidth for link 39 in MiB/sec.') - GPM_METRIC_NVLINK_L39_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L39_TX_PER_SEC, 'NvLink write bandwidth for link 39 in MiB/sec.') - GPM_METRIC_NVLINK_L40_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L40_RX_PER_SEC, 'NvLink read bandwidth for link 40 in MiB/sec.') - GPM_METRIC_NVLINK_L40_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L40_TX_PER_SEC, 'NvLink write bandwidth for link 40 in MiB/sec.') - GPM_METRIC_NVLINK_L41_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L41_RX_PER_SEC, 'NvLink read bandwidth for link 41 in MiB/sec.') - GPM_METRIC_NVLINK_L41_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L41_TX_PER_SEC, 'NvLink write bandwidth for link 41 in MiB/sec.') - GPM_METRIC_NVLINK_L42_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L42_RX_PER_SEC, 'NvLink read bandwidth for link 42 in MiB/sec.') - GPM_METRIC_NVLINK_L42_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L42_TX_PER_SEC, 'NvLink write bandwidth for link 42 in MiB/sec.') - GPM_METRIC_NVLINK_L43_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L43_RX_PER_SEC, 'NvLink read bandwidth for link 43 in MiB/sec.') - GPM_METRIC_NVLINK_L43_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L43_TX_PER_SEC, 'NvLink write bandwidth for link 43 in MiB/sec.') - GPM_METRIC_NVLINK_L44_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L44_RX_PER_SEC, 'NvLink read bandwidth for link 44 in MiB/sec.') - GPM_METRIC_NVLINK_L44_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L44_TX_PER_SEC, 'NvLink write bandwidth for link 44 in MiB/sec.') - GPM_METRIC_NVLINK_L45_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L45_RX_PER_SEC, 'NvLink read bandwidth for link 45 in MiB/sec.') - GPM_METRIC_NVLINK_L45_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L45_TX_PER_SEC, 'NvLink write bandwidth for link 45 in MiB/sec.') - GPM_METRIC_NVLINK_L46_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L46_RX_PER_SEC, 'NvLink read bandwidth for link 46 in MiB/sec.') - GPM_METRIC_NVLINK_L46_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L46_TX_PER_SEC, 'NvLink write bandwidth for link 46 in MiB/sec.') - GPM_METRIC_NVLINK_L47_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L47_RX_PER_SEC, 'NvLink read bandwidth for link 47 in MiB/sec.') - GPM_METRIC_NVLINK_L47_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L47_TX_PER_SEC, 'NvLink write bandwidth for link 47 in MiB/sec.') - GPM_METRIC_NVLINK_L48_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L48_RX_PER_SEC, 'NvLink read bandwidth for link 48 in MiB/sec.') - GPM_METRIC_NVLINK_L48_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L48_TX_PER_SEC, 'NvLink write bandwidth for link 48 in MiB/sec.') - GPM_METRIC_NVLINK_L49_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L49_RX_PER_SEC, 'NvLink read bandwidth for link 49 in MiB/sec.') - GPM_METRIC_NVLINK_L49_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L49_TX_PER_SEC, 'NvLink write bandwidth for link 49 in MiB/sec.') - GPM_METRIC_NVLINK_L50_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L50_RX_PER_SEC, 'NvLink read bandwidth for link 50 in MiB/sec.') - GPM_METRIC_NVLINK_L50_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L50_TX_PER_SEC, 'NvLink write bandwidth for link 50 in MiB/sec.') - GPM_METRIC_NVLINK_L51_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L51_RX_PER_SEC, 'NvLink read bandwidth for link 51 in MiB/sec.') - GPM_METRIC_NVLINK_L51_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L51_TX_PER_SEC, 'NvLink write bandwidth for link 51 in MiB/sec.') - GPM_METRIC_NVLINK_L52_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L52_RX_PER_SEC, 'NvLink read bandwidth for link 52 in MiB/sec.') - GPM_METRIC_NVLINK_L52_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L52_TX_PER_SEC, 'NvLink write bandwidth for link 52 in MiB/sec.') - GPM_METRIC_NVLINK_L53_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L53_RX_PER_SEC, 'NvLink read bandwidth for link 53 in MiB/sec.') - GPM_METRIC_NVLINK_L53_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L53_TX_PER_SEC, 'NvLink write bandwidth for link 53 in MiB/sec.') - GPM_METRIC_NVLINK_L54_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L54_RX_PER_SEC, 'NvLink read bandwidth for link 54 in MiB/sec.') - GPM_METRIC_NVLINK_L54_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L54_TX_PER_SEC, 'NvLink write bandwidth for link 54 in MiB/sec.') - GPM_METRIC_NVLINK_L55_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L55_RX_PER_SEC, 'NvLink read bandwidth for link 55 in MiB/sec.') - GPM_METRIC_NVLINK_L55_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L55_TX_PER_SEC, 'NvLink write bandwidth for link 55 in MiB/sec.') - GPM_METRIC_NVLINK_L56_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L56_RX_PER_SEC, 'NvLink read bandwidth for link 56 in MiB/sec.') - GPM_METRIC_NVLINK_L56_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L56_TX_PER_SEC, 'NvLink write bandwidth for link 56 in MiB/sec.') - GPM_METRIC_NVLINK_L57_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L57_RX_PER_SEC, 'NvLink read bandwidth for link 57 in MiB/sec.') - GPM_METRIC_NVLINK_L57_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L57_TX_PER_SEC, 'NvLink write bandwidth for link 57 in MiB/sec.') - GPM_METRIC_NVLINK_L58_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L58_RX_PER_SEC, 'NvLink read bandwidth for link 58 in MiB/sec.') - GPM_METRIC_NVLINK_L58_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L58_TX_PER_SEC, 'NvLink write bandwidth for link 58 in MiB/sec.') - GPM_METRIC_NVLINK_L59_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L59_RX_PER_SEC, 'NvLink read bandwidth for link 59 in MiB/sec.') - GPM_METRIC_NVLINK_L59_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L59_TX_PER_SEC, 'NvLink write bandwidth for link 59 in MiB/sec.') - GPM_METRIC_NVLINK_L60_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L60_RX_PER_SEC, 'NvLink read bandwidth for link 60 in MiB/sec.') - GPM_METRIC_NVLINK_L60_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L60_TX_PER_SEC, 'NvLink write bandwidth for link 60 in MiB/sec.') - GPM_METRIC_NVLINK_L61_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L61_RX_PER_SEC, 'NvLink read bandwidth for link 61 in MiB/sec.') - GPM_METRIC_NVLINK_L61_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L61_TX_PER_SEC, 'NvLink write bandwidth for link 61 in MiB/sec.') - GPM_METRIC_NVLINK_L62_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L62_RX_PER_SEC, 'NvLink read bandwidth for link 62 in MiB/sec.') - GPM_METRIC_NVLINK_L62_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L62_TX_PER_SEC, 'NvLink write bandwidth for link 62 in MiB/sec.') - GPM_METRIC_NVLINK_L63_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L63_RX_PER_SEC, 'NvLink read bandwidth for link 63 in MiB/sec.') - GPM_METRIC_NVLINK_L63_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L63_TX_PER_SEC, 'NvLink write bandwidth for link 63 in MiB/sec.') - GPM_METRIC_NVLINK_L64_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L64_RX_PER_SEC, 'NvLink read bandwidth for link 64 in MiB/sec.') - GPM_METRIC_NVLINK_L64_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L64_TX_PER_SEC, 'NvLink write bandwidth for link 64 in MiB/sec.') - GPM_METRIC_NVLINK_L65_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L65_RX_PER_SEC, 'NvLink read bandwidth for link 65 in MiB/sec.') - GPM_METRIC_NVLINK_L65_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L65_TX_PER_SEC, 'NvLink write bandwidth for link 65 in MiB/sec.') - GPM_METRIC_NVLINK_L66_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L66_RX_PER_SEC, 'NvLink read bandwidth for link 66 in MiB/sec.') - GPM_METRIC_NVLINK_L66_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L66_TX_PER_SEC, 'NvLink write bandwidth for link 66 in MiB/sec.') - GPM_METRIC_NVLINK_L67_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L67_RX_PER_SEC, 'NvLink read bandwidth for link 67 in MiB/sec.') - GPM_METRIC_NVLINK_L67_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L67_TX_PER_SEC, 'NvLink write bandwidth for link 67 in MiB/sec.') - GPM_METRIC_NVLINK_L68_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L68_RX_PER_SEC, 'NvLink read bandwidth for link 68 in MiB/sec.') - GPM_METRIC_NVLINK_L68_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L68_TX_PER_SEC, 'NvLink write bandwidth for link 68 in MiB/sec.') - GPM_METRIC_NVLINK_L69_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L69_RX_PER_SEC, 'NvLink read bandwidth for link 69 in MiB/sec.') - GPM_METRIC_NVLINK_L69_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L69_TX_PER_SEC, 'NvLink write bandwidth for link 69 in MiB/sec.') - GPM_METRIC_NVLINK_L70_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L70_RX_PER_SEC, 'NvLink read bandwidth for link 70 in MiB/sec.') - GPM_METRIC_NVLINK_L70_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L70_TX_PER_SEC, 'NvLink write bandwidth for link 70 in MiB/sec.') - GPM_METRIC_NVLINK_L71_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L71_RX_PER_SEC, 'NvLink read bandwidth for link 71 in MiB/sec.') - GPM_METRIC_NVLINK_L71_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L71_TX_PER_SEC, 'NvLink write bandwidth for link 71 in MiB/sec.') - GPM_METRIC_MAX = (NVML_GPM_METRIC_MAX, 'Maximum value above +1.') + GRAPHICS_UTIL = (NVML_GPM_METRIC_GRAPHICS_UTIL, 'Percentage of time any compute/graphics app was active on the GPU. 0.0 - 100.0.') + GPM_METRIC_GRAPHICS_UTIL = GRAPHICS_UTIL # backward-compat alias + SM_UTIL = (NVML_GPM_METRIC_SM_UTIL, 'Percentage of SMs that were busy. 0.0 - 100.0.') + GPM_METRIC_SM_UTIL = SM_UTIL # backward-compat alias + SM_OCCUPANCY = (NVML_GPM_METRIC_SM_OCCUPANCY, 'Percentage of warps that were active vs theoretical maximum. 0.0 - 100.0.') + GPM_METRIC_SM_OCCUPANCY = SM_OCCUPANCY # backward-compat alias + INTEGER_UTIL = (NVML_GPM_METRIC_INTEGER_UTIL, "Percentage of time the GPU's SMs were doing integer operations. 0.0 - 100.0.") + GPM_METRIC_INTEGER_UTIL = INTEGER_UTIL # backward-compat alias + ANY_TENSOR_UTIL = (NVML_GPM_METRIC_ANY_TENSOR_UTIL, "Percentage of time the GPU's SMs were doing ANY tensor operations. 0.0 - 100.0.") + GPM_METRIC_ANY_TENSOR_UTIL = ANY_TENSOR_UTIL # backward-compat alias + DFMA_TENSOR_UTIL = (NVML_GPM_METRIC_DFMA_TENSOR_UTIL, "Percentage of time the GPU's SMs were doing DFMA tensor operations. 0.0 - 100.0.") + GPM_METRIC_DFMA_TENSOR_UTIL = DFMA_TENSOR_UTIL # backward-compat alias + HMMA_TENSOR_UTIL = (NVML_GPM_METRIC_HMMA_TENSOR_UTIL, "Percentage of time the GPU's SMs were doing HMMA tensor operations. 0.0 - 100.0.") + GPM_METRIC_HMMA_TENSOR_UTIL = HMMA_TENSOR_UTIL # backward-compat alias + DMMA_TENSOR_UTIL = (NVML_GPM_METRIC_DMMA_TENSOR_UTIL, "Percentage of time the GPU's SMs were doing DMMA tensor operations. 0.0 - 100.0.") + GPM_METRIC_DMMA_TENSOR_UTIL = DMMA_TENSOR_UTIL # backward-compat alias + IMMA_TENSOR_UTIL = (NVML_GPM_METRIC_IMMA_TENSOR_UTIL, "Percentage of time the GPU's SMs were doing IMMA tensor operations. 0.0 - 100.0.") + GPM_METRIC_IMMA_TENSOR_UTIL = IMMA_TENSOR_UTIL # backward-compat alias + DRAM_BW_UTIL = (NVML_GPM_METRIC_DRAM_BW_UTIL, 'Percentage of DRAM bw used vs theoretical maximum. `0.0 - 100.0`.') + GPM_METRIC_DRAM_BW_UTIL = DRAM_BW_UTIL # backward-compat alias + FP64_UTIL = (NVML_GPM_METRIC_FP64_UTIL, "Percentage of time the GPU's SMs were doing non-tensor FP64 math. 0.0 - 100.0.") + GPM_METRIC_FP64_UTIL = FP64_UTIL # backward-compat alias + FP32_UTIL = (NVML_GPM_METRIC_FP32_UTIL, "Percentage of time the GPU's SMs were doing non-tensor FP32 math. 0.0 - 100.0.") + GPM_METRIC_FP32_UTIL = FP32_UTIL # backward-compat alias + FP16_UTIL = (NVML_GPM_METRIC_FP16_UTIL, "Percentage of time the GPU's SMs were doing non-tensor FP16 math. 0.0 - 100.0.") + GPM_METRIC_FP16_UTIL = FP16_UTIL # backward-compat alias + PCIE_TX_PER_SEC = (NVML_GPM_METRIC_PCIE_TX_PER_SEC, 'PCIe traffic from this GPU in MiB/sec.') + GPM_METRIC_PCIE_TX_PER_SEC = PCIE_TX_PER_SEC # backward-compat alias + PCIE_RX_PER_SEC = (NVML_GPM_METRIC_PCIE_RX_PER_SEC, 'PCIe traffic to this GPU in MiB/sec.') + GPM_METRIC_PCIE_RX_PER_SEC = PCIE_RX_PER_SEC # backward-compat alias + NVDEC_0_UTIL = (NVML_GPM_METRIC_NVDEC_0_UTIL, 'Percent utilization of NVDEC 0. 0.0 - 100.0.') + GPM_METRIC_NVDEC_0_UTIL = NVDEC_0_UTIL # backward-compat alias + NVDEC_1_UTIL = (NVML_GPM_METRIC_NVDEC_1_UTIL, 'Percent utilization of NVDEC 1. 0.0 - 100.0.') + GPM_METRIC_NVDEC_1_UTIL = NVDEC_1_UTIL # backward-compat alias + NVDEC_2_UTIL = (NVML_GPM_METRIC_NVDEC_2_UTIL, 'Percent utilization of NVDEC 2. 0.0 - 100.0.') + GPM_METRIC_NVDEC_2_UTIL = NVDEC_2_UTIL # backward-compat alias + NVDEC_3_UTIL = (NVML_GPM_METRIC_NVDEC_3_UTIL, 'Percent utilization of NVDEC 3. 0.0 - 100.0.') + GPM_METRIC_NVDEC_3_UTIL = NVDEC_3_UTIL # backward-compat alias + NVDEC_4_UTIL = (NVML_GPM_METRIC_NVDEC_4_UTIL, 'Percent utilization of NVDEC 4. 0.0 - 100.0.') + GPM_METRIC_NVDEC_4_UTIL = NVDEC_4_UTIL # backward-compat alias + NVDEC_5_UTIL = (NVML_GPM_METRIC_NVDEC_5_UTIL, 'Percent utilization of NVDEC 5. 0.0 - 100.0.') + GPM_METRIC_NVDEC_5_UTIL = NVDEC_5_UTIL # backward-compat alias + NVDEC_6_UTIL = (NVML_GPM_METRIC_NVDEC_6_UTIL, 'Percent utilization of NVDEC 6. 0.0 - 100.0.') + GPM_METRIC_NVDEC_6_UTIL = NVDEC_6_UTIL # backward-compat alias + NVDEC_7_UTIL = (NVML_GPM_METRIC_NVDEC_7_UTIL, 'Percent utilization of NVDEC 7. 0.0 - 100.0.') + GPM_METRIC_NVDEC_7_UTIL = NVDEC_7_UTIL # backward-compat alias + NVJPG_0_UTIL = (NVML_GPM_METRIC_NVJPG_0_UTIL, 'Percent utilization of NVJPG 0. 0.0 - 100.0.') + GPM_METRIC_NVJPG_0_UTIL = NVJPG_0_UTIL # backward-compat alias + NVJPG_1_UTIL = (NVML_GPM_METRIC_NVJPG_1_UTIL, 'Percent utilization of NVJPG 1. 0.0 - 100.0.') + GPM_METRIC_NVJPG_1_UTIL = NVJPG_1_UTIL # backward-compat alias + NVJPG_2_UTIL = (NVML_GPM_METRIC_NVJPG_2_UTIL, 'Percent utilization of NVJPG 2. 0.0 - 100.0.') + GPM_METRIC_NVJPG_2_UTIL = NVJPG_2_UTIL # backward-compat alias + NVJPG_3_UTIL = (NVML_GPM_METRIC_NVJPG_3_UTIL, 'Percent utilization of NVJPG 3. 0.0 - 100.0.') + GPM_METRIC_NVJPG_3_UTIL = NVJPG_3_UTIL # backward-compat alias + NVJPG_4_UTIL = (NVML_GPM_METRIC_NVJPG_4_UTIL, 'Percent utilization of NVJPG 4. 0.0 - 100.0.') + GPM_METRIC_NVJPG_4_UTIL = NVJPG_4_UTIL # backward-compat alias + NVJPG_5_UTIL = (NVML_GPM_METRIC_NVJPG_5_UTIL, 'Percent utilization of NVJPG 5. 0.0 - 100.0.') + GPM_METRIC_NVJPG_5_UTIL = NVJPG_5_UTIL # backward-compat alias + NVJPG_6_UTIL = (NVML_GPM_METRIC_NVJPG_6_UTIL, 'Percent utilization of NVJPG 6. 0.0 - 100.0.') + GPM_METRIC_NVJPG_6_UTIL = NVJPG_6_UTIL # backward-compat alias + NVJPG_7_UTIL = (NVML_GPM_METRIC_NVJPG_7_UTIL, 'Percent utilization of NVJPG 7. 0.0 - 100.0.') + GPM_METRIC_NVJPG_7_UTIL = NVJPG_7_UTIL # backward-compat alias + NVOFA_0_UTIL = (NVML_GPM_METRIC_NVOFA_0_UTIL, 'Percent utilization of NVOFA 0. 0.0 - 100.0.') + GPM_METRIC_NVOFA_0_UTIL = NVOFA_0_UTIL # backward-compat alias + NVOFA_1_UTIL = (NVML_GPM_METRIC_NVOFA_1_UTIL, 'Percent utilization of NVOFA 1. 0.0 - 100.0.') + GPM_METRIC_NVOFA_1_UTIL = NVOFA_1_UTIL # backward-compat alias + NVLINK_TOTAL_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_TOTAL_RX_PER_SEC, 'NvLink read bandwidth for all links in MiB/sec.') + GPM_METRIC_NVLINK_TOTAL_RX_PER_SEC = NVLINK_TOTAL_RX_PER_SEC # backward-compat alias + NVLINK_TOTAL_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_TOTAL_TX_PER_SEC, 'NvLink write bandwidth for all links in MiB/sec.') + GPM_METRIC_NVLINK_TOTAL_TX_PER_SEC = NVLINK_TOTAL_TX_PER_SEC # backward-compat alias + NVLINK_L0_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L0_RX_PER_SEC, 'NvLink read bandwidth for link 0 in MiB/sec.') + GPM_METRIC_NVLINK_L0_RX_PER_SEC = NVLINK_L0_RX_PER_SEC # backward-compat alias + NVLINK_L0_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L0_TX_PER_SEC, 'NvLink write bandwidth for link 0 in MiB/sec.') + GPM_METRIC_NVLINK_L0_TX_PER_SEC = NVLINK_L0_TX_PER_SEC # backward-compat alias + NVLINK_L1_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L1_RX_PER_SEC, 'NvLink read bandwidth for link 1 in MiB/sec.') + GPM_METRIC_NVLINK_L1_RX_PER_SEC = NVLINK_L1_RX_PER_SEC # backward-compat alias + NVLINK_L1_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L1_TX_PER_SEC, 'NvLink write bandwidth for link 1 in MiB/sec.') + GPM_METRIC_NVLINK_L1_TX_PER_SEC = NVLINK_L1_TX_PER_SEC # backward-compat alias + NVLINK_L2_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L2_RX_PER_SEC, 'NvLink read bandwidth for link 2 in MiB/sec.') + GPM_METRIC_NVLINK_L2_RX_PER_SEC = NVLINK_L2_RX_PER_SEC # backward-compat alias + NVLINK_L2_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L2_TX_PER_SEC, 'NvLink write bandwidth for link 2 in MiB/sec.') + GPM_METRIC_NVLINK_L2_TX_PER_SEC = NVLINK_L2_TX_PER_SEC # backward-compat alias + NVLINK_L3_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L3_RX_PER_SEC, 'NvLink read bandwidth for link 3 in MiB/sec.') + GPM_METRIC_NVLINK_L3_RX_PER_SEC = NVLINK_L3_RX_PER_SEC # backward-compat alias + NVLINK_L3_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L3_TX_PER_SEC, 'NvLink write bandwidth for link 3 in MiB/sec.') + GPM_METRIC_NVLINK_L3_TX_PER_SEC = NVLINK_L3_TX_PER_SEC # backward-compat alias + NVLINK_L4_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L4_RX_PER_SEC, 'NvLink read bandwidth for link 4 in MiB/sec.') + GPM_METRIC_NVLINK_L4_RX_PER_SEC = NVLINK_L4_RX_PER_SEC # backward-compat alias + NVLINK_L4_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L4_TX_PER_SEC, 'NvLink write bandwidth for link 4 in MiB/sec.') + GPM_METRIC_NVLINK_L4_TX_PER_SEC = NVLINK_L4_TX_PER_SEC # backward-compat alias + NVLINK_L5_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L5_RX_PER_SEC, 'NvLink read bandwidth for link 5 in MiB/sec.') + GPM_METRIC_NVLINK_L5_RX_PER_SEC = NVLINK_L5_RX_PER_SEC # backward-compat alias + NVLINK_L5_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L5_TX_PER_SEC, 'NvLink write bandwidth for link 5 in MiB/sec.') + GPM_METRIC_NVLINK_L5_TX_PER_SEC = NVLINK_L5_TX_PER_SEC # backward-compat alias + NVLINK_L6_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L6_RX_PER_SEC, 'NvLink read bandwidth for link 6 in MiB/sec.') + GPM_METRIC_NVLINK_L6_RX_PER_SEC = NVLINK_L6_RX_PER_SEC # backward-compat alias + NVLINK_L6_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L6_TX_PER_SEC, 'NvLink write bandwidth for link 6 in MiB/sec.') + GPM_METRIC_NVLINK_L6_TX_PER_SEC = NVLINK_L6_TX_PER_SEC # backward-compat alias + NVLINK_L7_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L7_RX_PER_SEC, 'NvLink read bandwidth for link 7 in MiB/sec.') + GPM_METRIC_NVLINK_L7_RX_PER_SEC = NVLINK_L7_RX_PER_SEC # backward-compat alias + NVLINK_L7_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L7_TX_PER_SEC, 'NvLink write bandwidth for link 7 in MiB/sec.') + GPM_METRIC_NVLINK_L7_TX_PER_SEC = NVLINK_L7_TX_PER_SEC # backward-compat alias + NVLINK_L8_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L8_RX_PER_SEC, 'NvLink read bandwidth for link 8 in MiB/sec.') + GPM_METRIC_NVLINK_L8_RX_PER_SEC = NVLINK_L8_RX_PER_SEC # backward-compat alias + NVLINK_L8_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L8_TX_PER_SEC, 'NvLink write bandwidth for link 8 in MiB/sec.') + GPM_METRIC_NVLINK_L8_TX_PER_SEC = NVLINK_L8_TX_PER_SEC # backward-compat alias + NVLINK_L9_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L9_RX_PER_SEC, 'NvLink read bandwidth for link 9 in MiB/sec.') + GPM_METRIC_NVLINK_L9_RX_PER_SEC = NVLINK_L9_RX_PER_SEC # backward-compat alias + NVLINK_L9_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L9_TX_PER_SEC, 'NvLink write bandwidth for link 9 in MiB/sec.') + GPM_METRIC_NVLINK_L9_TX_PER_SEC = NVLINK_L9_TX_PER_SEC # backward-compat alias + NVLINK_L10_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L10_RX_PER_SEC, 'NvLink read bandwidth for link 10 in MiB/sec.') + GPM_METRIC_NVLINK_L10_RX_PER_SEC = NVLINK_L10_RX_PER_SEC # backward-compat alias + NVLINK_L10_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L10_TX_PER_SEC, 'NvLink write bandwidth for link 10 in MiB/sec.') + GPM_METRIC_NVLINK_L10_TX_PER_SEC = NVLINK_L10_TX_PER_SEC # backward-compat alias + NVLINK_L11_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L11_RX_PER_SEC, 'NvLink read bandwidth for link 11 in MiB/sec.') + GPM_METRIC_NVLINK_L11_RX_PER_SEC = NVLINK_L11_RX_PER_SEC # backward-compat alias + NVLINK_L11_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L11_TX_PER_SEC, 'NvLink write bandwidth for link 11 in MiB/sec.') + GPM_METRIC_NVLINK_L11_TX_PER_SEC = NVLINK_L11_TX_PER_SEC # backward-compat alias + NVLINK_L12_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L12_RX_PER_SEC, 'NvLink read bandwidth for link 12 in MiB/sec.') + GPM_METRIC_NVLINK_L12_RX_PER_SEC = NVLINK_L12_RX_PER_SEC # backward-compat alias + NVLINK_L12_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L12_TX_PER_SEC, 'NvLink write bandwidth for link 12 in MiB/sec.') + GPM_METRIC_NVLINK_L12_TX_PER_SEC = NVLINK_L12_TX_PER_SEC # backward-compat alias + NVLINK_L13_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L13_RX_PER_SEC, 'NvLink read bandwidth for link 13 in MiB/sec.') + GPM_METRIC_NVLINK_L13_RX_PER_SEC = NVLINK_L13_RX_PER_SEC # backward-compat alias + NVLINK_L13_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L13_TX_PER_SEC, 'NvLink write bandwidth for link 13 in MiB/sec.') + GPM_METRIC_NVLINK_L13_TX_PER_SEC = NVLINK_L13_TX_PER_SEC # backward-compat alias + NVLINK_L14_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L14_RX_PER_SEC, 'NvLink read bandwidth for link 14 in MiB/sec.') + GPM_METRIC_NVLINK_L14_RX_PER_SEC = NVLINK_L14_RX_PER_SEC # backward-compat alias + NVLINK_L14_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L14_TX_PER_SEC, 'NvLink write bandwidth for link 14 in MiB/sec.') + GPM_METRIC_NVLINK_L14_TX_PER_SEC = NVLINK_L14_TX_PER_SEC # backward-compat alias + NVLINK_L15_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L15_RX_PER_SEC, 'NvLink read bandwidth for link 15 in MiB/sec.') + GPM_METRIC_NVLINK_L15_RX_PER_SEC = NVLINK_L15_RX_PER_SEC # backward-compat alias + NVLINK_L15_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L15_TX_PER_SEC, 'NvLink write bandwidth for link 15 in MiB/sec.') + GPM_METRIC_NVLINK_L15_TX_PER_SEC = NVLINK_L15_TX_PER_SEC # backward-compat alias + NVLINK_L16_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L16_RX_PER_SEC, 'NvLink read bandwidth for link 16 in MiB/sec.') + GPM_METRIC_NVLINK_L16_RX_PER_SEC = NVLINK_L16_RX_PER_SEC # backward-compat alias + NVLINK_L16_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L16_TX_PER_SEC, 'NvLink write bandwidth for link 16 in MiB/sec.') + GPM_METRIC_NVLINK_L16_TX_PER_SEC = NVLINK_L16_TX_PER_SEC # backward-compat alias + NVLINK_L17_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L17_RX_PER_SEC, 'NvLink read bandwidth for link 17 in MiB/sec.') + GPM_METRIC_NVLINK_L17_RX_PER_SEC = NVLINK_L17_RX_PER_SEC # backward-compat alias + NVLINK_L17_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L17_TX_PER_SEC, 'NvLink write bandwidth for link 17 in MiB/sec.') + GPM_METRIC_NVLINK_L17_TX_PER_SEC = NVLINK_L17_TX_PER_SEC # backward-compat alias + C2C_TOTAL_TX_PER_SEC = (NVML_GPM_METRIC_C2C_TOTAL_TX_PER_SEC, 'C2C total transmit bandwidth in MiB/sec.') + GPM_METRIC_C2C_TOTAL_TX_PER_SEC = C2C_TOTAL_TX_PER_SEC # backward-compat alias + C2C_TOTAL_RX_PER_SEC = (NVML_GPM_METRIC_C2C_TOTAL_RX_PER_SEC, 'C2C total receive bandwidth in MiB/sec.') + GPM_METRIC_C2C_TOTAL_RX_PER_SEC = C2C_TOTAL_RX_PER_SEC # backward-compat alias + C2C_DATA_TX_PER_SEC = (NVML_GPM_METRIC_C2C_DATA_TX_PER_SEC, 'C2C data transmit bandwidth in MiB/sec.') + GPM_METRIC_C2C_DATA_TX_PER_SEC = C2C_DATA_TX_PER_SEC # backward-compat alias + C2C_DATA_RX_PER_SEC = (NVML_GPM_METRIC_C2C_DATA_RX_PER_SEC, 'C2C data receive bandwidth in MiB/sec.') + GPM_METRIC_C2C_DATA_RX_PER_SEC = C2C_DATA_RX_PER_SEC # backward-compat alias + C2C_LINK0_TOTAL_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK0_TOTAL_TX_PER_SEC, 'C2C link 0 total transmit bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK0_TOTAL_TX_PER_SEC = C2C_LINK0_TOTAL_TX_PER_SEC # backward-compat alias + C2C_LINK0_TOTAL_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK0_TOTAL_RX_PER_SEC, 'C2C link 0 total receive bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK0_TOTAL_RX_PER_SEC = C2C_LINK0_TOTAL_RX_PER_SEC # backward-compat alias + C2C_LINK0_DATA_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK0_DATA_TX_PER_SEC, 'C2C link 0 data transmit bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK0_DATA_TX_PER_SEC = C2C_LINK0_DATA_TX_PER_SEC # backward-compat alias + C2C_LINK0_DATA_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK0_DATA_RX_PER_SEC, 'C2C link 0 data receive bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK0_DATA_RX_PER_SEC = C2C_LINK0_DATA_RX_PER_SEC # backward-compat alias + C2C_LINK1_TOTAL_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK1_TOTAL_TX_PER_SEC, 'C2C link 1 total transmit bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK1_TOTAL_TX_PER_SEC = C2C_LINK1_TOTAL_TX_PER_SEC # backward-compat alias + C2C_LINK1_TOTAL_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK1_TOTAL_RX_PER_SEC, 'C2C link 1 total receive bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK1_TOTAL_RX_PER_SEC = C2C_LINK1_TOTAL_RX_PER_SEC # backward-compat alias + C2C_LINK1_DATA_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK1_DATA_TX_PER_SEC, 'C2C link 1 data transmit bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK1_DATA_TX_PER_SEC = C2C_LINK1_DATA_TX_PER_SEC # backward-compat alias + C2C_LINK1_DATA_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK1_DATA_RX_PER_SEC, 'C2C link 1 data receive bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK1_DATA_RX_PER_SEC = C2C_LINK1_DATA_RX_PER_SEC # backward-compat alias + C2C_LINK2_TOTAL_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK2_TOTAL_TX_PER_SEC, 'C2C link 2 total transmit bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK2_TOTAL_TX_PER_SEC = C2C_LINK2_TOTAL_TX_PER_SEC # backward-compat alias + C2C_LINK2_TOTAL_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK2_TOTAL_RX_PER_SEC, 'C2C link 2 total receive bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK2_TOTAL_RX_PER_SEC = C2C_LINK2_TOTAL_RX_PER_SEC # backward-compat alias + C2C_LINK2_DATA_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK2_DATA_TX_PER_SEC, 'C2C link 2 data transmit bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK2_DATA_TX_PER_SEC = C2C_LINK2_DATA_TX_PER_SEC # backward-compat alias + C2C_LINK2_DATA_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK2_DATA_RX_PER_SEC, 'C2C link 2 data receive bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK2_DATA_RX_PER_SEC = C2C_LINK2_DATA_RX_PER_SEC # backward-compat alias + C2C_LINK3_TOTAL_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK3_TOTAL_TX_PER_SEC, 'C2C link 3 total transmit bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK3_TOTAL_TX_PER_SEC = C2C_LINK3_TOTAL_TX_PER_SEC # backward-compat alias + C2C_LINK3_TOTAL_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK3_TOTAL_RX_PER_SEC, 'C2C link 3 total receive bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK3_TOTAL_RX_PER_SEC = C2C_LINK3_TOTAL_RX_PER_SEC # backward-compat alias + C2C_LINK3_DATA_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK3_DATA_TX_PER_SEC, 'C2C link 3 data transmit bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK3_DATA_TX_PER_SEC = C2C_LINK3_DATA_TX_PER_SEC # backward-compat alias + C2C_LINK3_DATA_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK3_DATA_RX_PER_SEC, 'C2C link 3 data receive bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK3_DATA_RX_PER_SEC = C2C_LINK3_DATA_RX_PER_SEC # backward-compat alias + C2C_LINK4_TOTAL_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK4_TOTAL_TX_PER_SEC, 'C2C link 4 total transmit bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK4_TOTAL_TX_PER_SEC = C2C_LINK4_TOTAL_TX_PER_SEC # backward-compat alias + C2C_LINK4_TOTAL_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK4_TOTAL_RX_PER_SEC, 'C2C link 4 total receive bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK4_TOTAL_RX_PER_SEC = C2C_LINK4_TOTAL_RX_PER_SEC # backward-compat alias + C2C_LINK4_DATA_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK4_DATA_TX_PER_SEC, 'C2C link 4 data transmit bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK4_DATA_TX_PER_SEC = C2C_LINK4_DATA_TX_PER_SEC # backward-compat alias + C2C_LINK4_DATA_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK4_DATA_RX_PER_SEC, 'C2C link 4 data receive bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK4_DATA_RX_PER_SEC = C2C_LINK4_DATA_RX_PER_SEC # backward-compat alias + C2C_LINK5_TOTAL_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK5_TOTAL_TX_PER_SEC, 'C2C link 5 total transmit bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK5_TOTAL_TX_PER_SEC = C2C_LINK5_TOTAL_TX_PER_SEC # backward-compat alias + C2C_LINK5_TOTAL_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK5_TOTAL_RX_PER_SEC, 'C2C link 5 total receive bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK5_TOTAL_RX_PER_SEC = C2C_LINK5_TOTAL_RX_PER_SEC # backward-compat alias + C2C_LINK5_DATA_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK5_DATA_TX_PER_SEC, 'C2C link 5 data transmit bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK5_DATA_TX_PER_SEC = C2C_LINK5_DATA_TX_PER_SEC # backward-compat alias + C2C_LINK5_DATA_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK5_DATA_RX_PER_SEC, 'C2C link 5 data receive bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK5_DATA_RX_PER_SEC = C2C_LINK5_DATA_RX_PER_SEC # backward-compat alias + C2C_LINK6_TOTAL_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK6_TOTAL_TX_PER_SEC, 'C2C link 6 total transmit bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK6_TOTAL_TX_PER_SEC = C2C_LINK6_TOTAL_TX_PER_SEC # backward-compat alias + C2C_LINK6_TOTAL_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK6_TOTAL_RX_PER_SEC, 'C2C link 6 total receive bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK6_TOTAL_RX_PER_SEC = C2C_LINK6_TOTAL_RX_PER_SEC # backward-compat alias + C2C_LINK6_DATA_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK6_DATA_TX_PER_SEC, 'C2C link 6 data transmit bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK6_DATA_TX_PER_SEC = C2C_LINK6_DATA_TX_PER_SEC # backward-compat alias + C2C_LINK6_DATA_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK6_DATA_RX_PER_SEC, 'C2C link 6 data receive bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK6_DATA_RX_PER_SEC = C2C_LINK6_DATA_RX_PER_SEC # backward-compat alias + C2C_LINK7_TOTAL_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK7_TOTAL_TX_PER_SEC, 'C2C link 7 total transmit bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK7_TOTAL_TX_PER_SEC = C2C_LINK7_TOTAL_TX_PER_SEC # backward-compat alias + C2C_LINK7_TOTAL_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK7_TOTAL_RX_PER_SEC, 'C2C link 7 total receive bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK7_TOTAL_RX_PER_SEC = C2C_LINK7_TOTAL_RX_PER_SEC # backward-compat alias + C2C_LINK7_DATA_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK7_DATA_TX_PER_SEC, 'C2C link 7 data transmit bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK7_DATA_TX_PER_SEC = C2C_LINK7_DATA_TX_PER_SEC # backward-compat alias + C2C_LINK7_DATA_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK7_DATA_RX_PER_SEC, 'C2C link 7 data receive bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK7_DATA_RX_PER_SEC = C2C_LINK7_DATA_RX_PER_SEC # backward-compat alias + C2C_LINK8_TOTAL_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK8_TOTAL_TX_PER_SEC, 'C2C link 8 total transmit bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK8_TOTAL_TX_PER_SEC = C2C_LINK8_TOTAL_TX_PER_SEC # backward-compat alias + C2C_LINK8_TOTAL_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK8_TOTAL_RX_PER_SEC, 'C2C link 8 total receive bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK8_TOTAL_RX_PER_SEC = C2C_LINK8_TOTAL_RX_PER_SEC # backward-compat alias + C2C_LINK8_DATA_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK8_DATA_TX_PER_SEC, 'C2C link 8 data transmit bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK8_DATA_TX_PER_SEC = C2C_LINK8_DATA_TX_PER_SEC # backward-compat alias + C2C_LINK8_DATA_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK8_DATA_RX_PER_SEC, 'C2C link 8 data receive bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK8_DATA_RX_PER_SEC = C2C_LINK8_DATA_RX_PER_SEC # backward-compat alias + C2C_LINK9_TOTAL_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK9_TOTAL_TX_PER_SEC, 'C2C link 9 total transmit bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK9_TOTAL_TX_PER_SEC = C2C_LINK9_TOTAL_TX_PER_SEC # backward-compat alias + C2C_LINK9_TOTAL_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK9_TOTAL_RX_PER_SEC, 'C2C link 9 total receive bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK9_TOTAL_RX_PER_SEC = C2C_LINK9_TOTAL_RX_PER_SEC # backward-compat alias + C2C_LINK9_DATA_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK9_DATA_TX_PER_SEC, 'C2C link 9 data transmit bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK9_DATA_TX_PER_SEC = C2C_LINK9_DATA_TX_PER_SEC # backward-compat alias + C2C_LINK9_DATA_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK9_DATA_RX_PER_SEC, 'C2C link 9 data receive bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK9_DATA_RX_PER_SEC = C2C_LINK9_DATA_RX_PER_SEC # backward-compat alias + C2C_LINK10_TOTAL_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK10_TOTAL_TX_PER_SEC, 'C2C link 10 total transmit bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK10_TOTAL_TX_PER_SEC = C2C_LINK10_TOTAL_TX_PER_SEC # backward-compat alias + C2C_LINK10_TOTAL_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK10_TOTAL_RX_PER_SEC, 'C2C link 10 total receive bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK10_TOTAL_RX_PER_SEC = C2C_LINK10_TOTAL_RX_PER_SEC # backward-compat alias + C2C_LINK10_DATA_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK10_DATA_TX_PER_SEC, 'C2C link 10 data transmit bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK10_DATA_TX_PER_SEC = C2C_LINK10_DATA_TX_PER_SEC # backward-compat alias + C2C_LINK10_DATA_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK10_DATA_RX_PER_SEC, 'C2C link 10 data receive bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK10_DATA_RX_PER_SEC = C2C_LINK10_DATA_RX_PER_SEC # backward-compat alias + C2C_LINK11_TOTAL_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK11_TOTAL_TX_PER_SEC, 'C2C link 11 total transmit bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK11_TOTAL_TX_PER_SEC = C2C_LINK11_TOTAL_TX_PER_SEC # backward-compat alias + C2C_LINK11_TOTAL_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK11_TOTAL_RX_PER_SEC, 'C2C link 11 total receive bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK11_TOTAL_RX_PER_SEC = C2C_LINK11_TOTAL_RX_PER_SEC # backward-compat alias + C2C_LINK11_DATA_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK11_DATA_TX_PER_SEC, 'C2C link 11 data transmit bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK11_DATA_TX_PER_SEC = C2C_LINK11_DATA_TX_PER_SEC # backward-compat alias + C2C_LINK11_DATA_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK11_DATA_RX_PER_SEC, 'C2C link 11 data receive bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK11_DATA_RX_PER_SEC = C2C_LINK11_DATA_RX_PER_SEC # backward-compat alias + C2C_LINK12_TOTAL_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK12_TOTAL_TX_PER_SEC, 'C2C link 12 total transmit bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK12_TOTAL_TX_PER_SEC = C2C_LINK12_TOTAL_TX_PER_SEC # backward-compat alias + C2C_LINK12_TOTAL_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK12_TOTAL_RX_PER_SEC, 'C2C link 12 total receive bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK12_TOTAL_RX_PER_SEC = C2C_LINK12_TOTAL_RX_PER_SEC # backward-compat alias + C2C_LINK12_DATA_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK12_DATA_TX_PER_SEC, 'C2C link 12 data transmit bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK12_DATA_TX_PER_SEC = C2C_LINK12_DATA_TX_PER_SEC # backward-compat alias + C2C_LINK12_DATA_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK12_DATA_RX_PER_SEC, 'C2C link 12 data receive bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK12_DATA_RX_PER_SEC = C2C_LINK12_DATA_RX_PER_SEC # backward-compat alias + C2C_LINK13_TOTAL_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK13_TOTAL_TX_PER_SEC, 'C2C link 13 total transmit bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK13_TOTAL_TX_PER_SEC = C2C_LINK13_TOTAL_TX_PER_SEC # backward-compat alias + C2C_LINK13_TOTAL_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK13_TOTAL_RX_PER_SEC, 'C2C link 13 total receive bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK13_TOTAL_RX_PER_SEC = C2C_LINK13_TOTAL_RX_PER_SEC # backward-compat alias + C2C_LINK13_DATA_TX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK13_DATA_TX_PER_SEC, 'C2C link 13 data transmit bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK13_DATA_TX_PER_SEC = C2C_LINK13_DATA_TX_PER_SEC # backward-compat alias + C2C_LINK13_DATA_RX_PER_SEC = (NVML_GPM_METRIC_C2C_LINK13_DATA_RX_PER_SEC, 'C2C link 13 data receive bandwidth in MiB/sec.') + GPM_METRIC_C2C_LINK13_DATA_RX_PER_SEC = C2C_LINK13_DATA_RX_PER_SEC # backward-compat alias + HOSTMEM_CACHE_HIT = (NVML_GPM_METRIC_HOSTMEM_CACHE_HIT, 'Percentage of host memory cache hits. 0.0 - 100.0.') + GPM_METRIC_HOSTMEM_CACHE_HIT = HOSTMEM_CACHE_HIT # backward-compat alias + HOSTMEM_CACHE_MISS = (NVML_GPM_METRIC_HOSTMEM_CACHE_MISS, 'Percentage of host memory cache misses. 0.0 - 100.0.') + GPM_METRIC_HOSTMEM_CACHE_MISS = HOSTMEM_CACHE_MISS # backward-compat alias + PEERMEM_CACHE_HIT = (NVML_GPM_METRIC_PEERMEM_CACHE_HIT, 'Percentage of peer memory cache hits. 0.0 - 100.0.') + GPM_METRIC_PEERMEM_CACHE_HIT = PEERMEM_CACHE_HIT # backward-compat alias + PEERMEM_CACHE_MISS = (NVML_GPM_METRIC_PEERMEM_CACHE_MISS, 'Percentage of peer memory cache misses. 0.0 - 100.0.') + GPM_METRIC_PEERMEM_CACHE_MISS = PEERMEM_CACHE_MISS # backward-compat alias + DRAM_CACHE_HIT = (NVML_GPM_METRIC_DRAM_CACHE_HIT, 'Percentage of DRAM cache hits. 0.0 - 100.0.') + GPM_METRIC_DRAM_CACHE_HIT = DRAM_CACHE_HIT # backward-compat alias + DRAM_CACHE_MISS = (NVML_GPM_METRIC_DRAM_CACHE_MISS, 'Percentage of DRAM cache misses. 0.0 - 100.0.') + GPM_METRIC_DRAM_CACHE_MISS = DRAM_CACHE_MISS # backward-compat alias + NVENC_0_UTIL = (NVML_GPM_METRIC_NVENC_0_UTIL, 'Percent utilization of NVENC 0. 0.0 - 100.0.') + GPM_METRIC_NVENC_0_UTIL = NVENC_0_UTIL # backward-compat alias + NVENC_1_UTIL = (NVML_GPM_METRIC_NVENC_1_UTIL, 'Percent utilization of NVENC 1. 0.0 - 100.0.') + GPM_METRIC_NVENC_1_UTIL = NVENC_1_UTIL # backward-compat alias + NVENC_2_UTIL = (NVML_GPM_METRIC_NVENC_2_UTIL, 'Percent utilization of NVENC 2. 0.0 - 100.0.') + GPM_METRIC_NVENC_2_UTIL = NVENC_2_UTIL # backward-compat alias + NVENC_3_UTIL = (NVML_GPM_METRIC_NVENC_3_UTIL, 'Percent utilization of NVENC 3. 0.0 - 100.0.') + GPM_METRIC_NVENC_3_UTIL = NVENC_3_UTIL # backward-compat alias + GR0_CTXSW_CYCLES_ELAPSED = (NVML_GPM_METRIC_GR0_CTXSW_CYCLES_ELAPSED, 'Total context switch cycles elapsed for GR engine 0.') + GPM_METRIC_GR0_CTXSW_CYCLES_ELAPSED = GR0_CTXSW_CYCLES_ELAPSED # backward-compat alias + GR0_CTXSW_CYCLES_ACTIVE = (NVML_GPM_METRIC_GR0_CTXSW_CYCLES_ACTIVE, 'Active context switch cycles for GR engine 0.') + GPM_METRIC_GR0_CTXSW_CYCLES_ACTIVE = GR0_CTXSW_CYCLES_ACTIVE # backward-compat alias + GR0_CTXSW_REQUESTS = (NVML_GPM_METRIC_GR0_CTXSW_REQUESTS, 'Number of context switch requests for GR engine 0.') + GPM_METRIC_GR0_CTXSW_REQUESTS = GR0_CTXSW_REQUESTS # backward-compat alias + GR0_CTXSW_CYCLES_PER_REQ = (NVML_GPM_METRIC_GR0_CTXSW_CYCLES_PER_REQ, 'Average context switch cycles per request for GR engine 0.') + GPM_METRIC_GR0_CTXSW_CYCLES_PER_REQ = GR0_CTXSW_CYCLES_PER_REQ # backward-compat alias + GR0_CTXSW_ACTIVE_PCT = (NVML_GPM_METRIC_GR0_CTXSW_ACTIVE_PCT, 'Percentage of time GR engine 0 context switches were active. 0.0 - 100.0.') + GPM_METRIC_GR0_CTXSW_ACTIVE_PCT = GR0_CTXSW_ACTIVE_PCT # backward-compat alias + GR1_CTXSW_CYCLES_ELAPSED = (NVML_GPM_METRIC_GR1_CTXSW_CYCLES_ELAPSED, 'Total context switch cycles elapsed for GR engine 1.') + GPM_METRIC_GR1_CTXSW_CYCLES_ELAPSED = GR1_CTXSW_CYCLES_ELAPSED # backward-compat alias + GR1_CTXSW_CYCLES_ACTIVE = (NVML_GPM_METRIC_GR1_CTXSW_CYCLES_ACTIVE, 'Active context switch cycles for GR engine 1.') + GPM_METRIC_GR1_CTXSW_CYCLES_ACTIVE = GR1_CTXSW_CYCLES_ACTIVE # backward-compat alias + GR1_CTXSW_REQUESTS = (NVML_GPM_METRIC_GR1_CTXSW_REQUESTS, 'Number of context switch requests for GR engine 1.') + GPM_METRIC_GR1_CTXSW_REQUESTS = GR1_CTXSW_REQUESTS # backward-compat alias + GR1_CTXSW_CYCLES_PER_REQ = (NVML_GPM_METRIC_GR1_CTXSW_CYCLES_PER_REQ, 'Average context switch cycles per request for GR engine 1.') + GPM_METRIC_GR1_CTXSW_CYCLES_PER_REQ = GR1_CTXSW_CYCLES_PER_REQ # backward-compat alias + GR1_CTXSW_ACTIVE_PCT = (NVML_GPM_METRIC_GR1_CTXSW_ACTIVE_PCT, 'Percentage of time GR engine 1 context switches were active. 0.0 - 100.0.') + GPM_METRIC_GR1_CTXSW_ACTIVE_PCT = GR1_CTXSW_ACTIVE_PCT # backward-compat alias + GR2_CTXSW_CYCLES_ELAPSED = (NVML_GPM_METRIC_GR2_CTXSW_CYCLES_ELAPSED, 'Total context switch cycles elapsed for GR engine 2.') + GPM_METRIC_GR2_CTXSW_CYCLES_ELAPSED = GR2_CTXSW_CYCLES_ELAPSED # backward-compat alias + GR2_CTXSW_CYCLES_ACTIVE = (NVML_GPM_METRIC_GR2_CTXSW_CYCLES_ACTIVE, 'Active context switch cycles for GR engine 2.') + GPM_METRIC_GR2_CTXSW_CYCLES_ACTIVE = GR2_CTXSW_CYCLES_ACTIVE # backward-compat alias + GR2_CTXSW_REQUESTS = (NVML_GPM_METRIC_GR2_CTXSW_REQUESTS, 'Number of context switch requests for GR engine 2.') + GPM_METRIC_GR2_CTXSW_REQUESTS = GR2_CTXSW_REQUESTS # backward-compat alias + GR2_CTXSW_CYCLES_PER_REQ = (NVML_GPM_METRIC_GR2_CTXSW_CYCLES_PER_REQ, 'Average context switch cycles per request for GR engine 2.') + GPM_METRIC_GR2_CTXSW_CYCLES_PER_REQ = GR2_CTXSW_CYCLES_PER_REQ # backward-compat alias + GR2_CTXSW_ACTIVE_PCT = (NVML_GPM_METRIC_GR2_CTXSW_ACTIVE_PCT, 'Percentage of time GR engine 2 context switches were active. 0.0 - 100.0.') + GPM_METRIC_GR2_CTXSW_ACTIVE_PCT = GR2_CTXSW_ACTIVE_PCT # backward-compat alias + GR3_CTXSW_CYCLES_ELAPSED = (NVML_GPM_METRIC_GR3_CTXSW_CYCLES_ELAPSED, 'Total context switch cycles elapsed for GR engine 3.') + GPM_METRIC_GR3_CTXSW_CYCLES_ELAPSED = GR3_CTXSW_CYCLES_ELAPSED # backward-compat alias + GR3_CTXSW_CYCLES_ACTIVE = (NVML_GPM_METRIC_GR3_CTXSW_CYCLES_ACTIVE, 'Active context switch cycles for GR engine 3.') + GPM_METRIC_GR3_CTXSW_CYCLES_ACTIVE = GR3_CTXSW_CYCLES_ACTIVE # backward-compat alias + GR3_CTXSW_REQUESTS = (NVML_GPM_METRIC_GR3_CTXSW_REQUESTS, 'Number of context switch requests for GR engine 3.') + GPM_METRIC_GR3_CTXSW_REQUESTS = GR3_CTXSW_REQUESTS # backward-compat alias + GR3_CTXSW_CYCLES_PER_REQ = (NVML_GPM_METRIC_GR3_CTXSW_CYCLES_PER_REQ, 'Average context switch cycles per request for GR engine 3.') + GPM_METRIC_GR3_CTXSW_CYCLES_PER_REQ = GR3_CTXSW_CYCLES_PER_REQ # backward-compat alias + GR3_CTXSW_ACTIVE_PCT = (NVML_GPM_METRIC_GR3_CTXSW_ACTIVE_PCT, 'Percentage of time GR engine 3 context switches were active. 0.0 - 100.0.') + GPM_METRIC_GR3_CTXSW_ACTIVE_PCT = GR3_CTXSW_ACTIVE_PCT # backward-compat alias + GR4_CTXSW_CYCLES_ELAPSED = (NVML_GPM_METRIC_GR4_CTXSW_CYCLES_ELAPSED, 'Total context switch cycles elapsed for GR engine 4.') + GPM_METRIC_GR4_CTXSW_CYCLES_ELAPSED = GR4_CTXSW_CYCLES_ELAPSED # backward-compat alias + GR4_CTXSW_CYCLES_ACTIVE = (NVML_GPM_METRIC_GR4_CTXSW_CYCLES_ACTIVE, 'Active context switch cycles for GR engine 4.') + GPM_METRIC_GR4_CTXSW_CYCLES_ACTIVE = GR4_CTXSW_CYCLES_ACTIVE # backward-compat alias + GR4_CTXSW_REQUESTS = (NVML_GPM_METRIC_GR4_CTXSW_REQUESTS, 'Number of context switch requests for GR engine 4.') + GPM_METRIC_GR4_CTXSW_REQUESTS = GR4_CTXSW_REQUESTS # backward-compat alias + GR4_CTXSW_CYCLES_PER_REQ = (NVML_GPM_METRIC_GR4_CTXSW_CYCLES_PER_REQ, 'Average context switch cycles per request for GR engine 4.') + GPM_METRIC_GR4_CTXSW_CYCLES_PER_REQ = GR4_CTXSW_CYCLES_PER_REQ # backward-compat alias + GR4_CTXSW_ACTIVE_PCT = (NVML_GPM_METRIC_GR4_CTXSW_ACTIVE_PCT, 'Percentage of time GR engine 4 context switches were active. 0.0 - 100.0.') + GPM_METRIC_GR4_CTXSW_ACTIVE_PCT = GR4_CTXSW_ACTIVE_PCT # backward-compat alias + GR5_CTXSW_CYCLES_ELAPSED = (NVML_GPM_METRIC_GR5_CTXSW_CYCLES_ELAPSED, 'Total context switch cycles elapsed for GR engine 5.') + GPM_METRIC_GR5_CTXSW_CYCLES_ELAPSED = GR5_CTXSW_CYCLES_ELAPSED # backward-compat alias + GR5_CTXSW_CYCLES_ACTIVE = (NVML_GPM_METRIC_GR5_CTXSW_CYCLES_ACTIVE, 'Active context switch cycles for GR engine 5.') + GPM_METRIC_GR5_CTXSW_CYCLES_ACTIVE = GR5_CTXSW_CYCLES_ACTIVE # backward-compat alias + GR5_CTXSW_REQUESTS = (NVML_GPM_METRIC_GR5_CTXSW_REQUESTS, 'Number of context switch requests for GR engine 5.') + GPM_METRIC_GR5_CTXSW_REQUESTS = GR5_CTXSW_REQUESTS # backward-compat alias + GR5_CTXSW_CYCLES_PER_REQ = (NVML_GPM_METRIC_GR5_CTXSW_CYCLES_PER_REQ, 'Average context switch cycles per request for GR engine 5.') + GPM_METRIC_GR5_CTXSW_CYCLES_PER_REQ = GR5_CTXSW_CYCLES_PER_REQ # backward-compat alias + GR5_CTXSW_ACTIVE_PCT = (NVML_GPM_METRIC_GR5_CTXSW_ACTIVE_PCT, 'Percentage of time GR engine 5 context switches were active. 0.0 - 100.0.') + GPM_METRIC_GR5_CTXSW_ACTIVE_PCT = GR5_CTXSW_ACTIVE_PCT # backward-compat alias + GR6_CTXSW_CYCLES_ELAPSED = (NVML_GPM_METRIC_GR6_CTXSW_CYCLES_ELAPSED, 'Total context switch cycles elapsed for GR engine 6.') + GPM_METRIC_GR6_CTXSW_CYCLES_ELAPSED = GR6_CTXSW_CYCLES_ELAPSED # backward-compat alias + GR6_CTXSW_CYCLES_ACTIVE = (NVML_GPM_METRIC_GR6_CTXSW_CYCLES_ACTIVE, 'Active context switch cycles for GR engine 6.') + GPM_METRIC_GR6_CTXSW_CYCLES_ACTIVE = GR6_CTXSW_CYCLES_ACTIVE # backward-compat alias + GR6_CTXSW_REQUESTS = (NVML_GPM_METRIC_GR6_CTXSW_REQUESTS, 'Number of context switch requests for GR engine 6.') + GPM_METRIC_GR6_CTXSW_REQUESTS = GR6_CTXSW_REQUESTS # backward-compat alias + GR6_CTXSW_CYCLES_PER_REQ = (NVML_GPM_METRIC_GR6_CTXSW_CYCLES_PER_REQ, 'Average context switch cycles per request for GR engine 6.') + GPM_METRIC_GR6_CTXSW_CYCLES_PER_REQ = GR6_CTXSW_CYCLES_PER_REQ # backward-compat alias + GR6_CTXSW_ACTIVE_PCT = (NVML_GPM_METRIC_GR6_CTXSW_ACTIVE_PCT, 'Percentage of time GR engine 6 context switches were active. 0.0 - 100.0.') + GPM_METRIC_GR6_CTXSW_ACTIVE_PCT = GR6_CTXSW_ACTIVE_PCT # backward-compat alias + GR7_CTXSW_CYCLES_ELAPSED = (NVML_GPM_METRIC_GR7_CTXSW_CYCLES_ELAPSED, 'Total context switch cycles elapsed for GR engine 7.') + GPM_METRIC_GR7_CTXSW_CYCLES_ELAPSED = GR7_CTXSW_CYCLES_ELAPSED # backward-compat alias + GR7_CTXSW_CYCLES_ACTIVE = (NVML_GPM_METRIC_GR7_CTXSW_CYCLES_ACTIVE, 'Active context switch cycles for GR engine 7.') + GPM_METRIC_GR7_CTXSW_CYCLES_ACTIVE = GR7_CTXSW_CYCLES_ACTIVE # backward-compat alias + GR7_CTXSW_REQUESTS = (NVML_GPM_METRIC_GR7_CTXSW_REQUESTS, 'Number of context switch requests for GR engine 7.') + GPM_METRIC_GR7_CTXSW_REQUESTS = GR7_CTXSW_REQUESTS # backward-compat alias + GR7_CTXSW_CYCLES_PER_REQ = (NVML_GPM_METRIC_GR7_CTXSW_CYCLES_PER_REQ, 'Average context switch cycles per request for GR engine 7.') + GPM_METRIC_GR7_CTXSW_CYCLES_PER_REQ = GR7_CTXSW_CYCLES_PER_REQ # backward-compat alias + GR7_CTXSW_ACTIVE_PCT = (NVML_GPM_METRIC_GR7_CTXSW_ACTIVE_PCT, 'Percentage of time GR engine 7 context switches were active. 0.0 - 100.0.') + GPM_METRIC_GR7_CTXSW_ACTIVE_PCT = GR7_CTXSW_ACTIVE_PCT # backward-compat alias + NVLINK_L18_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L18_RX_PER_SEC, 'NvLink read bandwidth for link 18 in MiB/sec.') + GPM_METRIC_NVLINK_L18_RX_PER_SEC = NVLINK_L18_RX_PER_SEC # backward-compat alias + NVLINK_L18_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L18_TX_PER_SEC, 'NvLink write bandwidth for link 18 in MiB/sec.') + GPM_METRIC_NVLINK_L18_TX_PER_SEC = NVLINK_L18_TX_PER_SEC # backward-compat alias + NVLINK_L19_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L19_RX_PER_SEC, 'NvLink read bandwidth for link 19 in MiB/sec.') + GPM_METRIC_NVLINK_L19_RX_PER_SEC = NVLINK_L19_RX_PER_SEC # backward-compat alias + NVLINK_L19_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L19_TX_PER_SEC, 'NvLink write bandwidth for link 19 in MiB/sec.') + GPM_METRIC_NVLINK_L19_TX_PER_SEC = NVLINK_L19_TX_PER_SEC # backward-compat alias + NVLINK_L20_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L20_RX_PER_SEC, 'NvLink read bandwidth for link 20 in MiB/sec.') + GPM_METRIC_NVLINK_L20_RX_PER_SEC = NVLINK_L20_RX_PER_SEC # backward-compat alias + NVLINK_L20_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L20_TX_PER_SEC, 'NvLink write bandwidth for link 20 in MiB/sec.') + GPM_METRIC_NVLINK_L20_TX_PER_SEC = NVLINK_L20_TX_PER_SEC # backward-compat alias + NVLINK_L21_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L21_RX_PER_SEC, 'NvLink read bandwidth for link 21 in MiB/sec.') + GPM_METRIC_NVLINK_L21_RX_PER_SEC = NVLINK_L21_RX_PER_SEC # backward-compat alias + NVLINK_L21_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L21_TX_PER_SEC, 'NvLink write bandwidth for link 21 in MiB/sec.') + GPM_METRIC_NVLINK_L21_TX_PER_SEC = NVLINK_L21_TX_PER_SEC # backward-compat alias + NVLINK_L22_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L22_RX_PER_SEC, 'NvLink read bandwidth for link 22 in MiB/sec.') + GPM_METRIC_NVLINK_L22_RX_PER_SEC = NVLINK_L22_RX_PER_SEC # backward-compat alias + NVLINK_L22_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L22_TX_PER_SEC, 'NvLink write bandwidth for link 22 in MiB/sec.') + GPM_METRIC_NVLINK_L22_TX_PER_SEC = NVLINK_L22_TX_PER_SEC # backward-compat alias + NVLINK_L23_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L23_RX_PER_SEC, 'NvLink read bandwidth for link 23 in MiB/sec.') + GPM_METRIC_NVLINK_L23_RX_PER_SEC = NVLINK_L23_RX_PER_SEC # backward-compat alias + NVLINK_L23_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L23_TX_PER_SEC, 'NvLink write bandwidth for link 23 in MiB/sec.') + GPM_METRIC_NVLINK_L23_TX_PER_SEC = NVLINK_L23_TX_PER_SEC # backward-compat alias + NVLINK_L24_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L24_RX_PER_SEC, 'NvLink read bandwidth for link 24 in MiB/sec.') + GPM_METRIC_NVLINK_L24_RX_PER_SEC = NVLINK_L24_RX_PER_SEC # backward-compat alias + NVLINK_L24_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L24_TX_PER_SEC, 'NvLink write bandwidth for link 24 in MiB/sec.') + GPM_METRIC_NVLINK_L24_TX_PER_SEC = NVLINK_L24_TX_PER_SEC # backward-compat alias + NVLINK_L25_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L25_RX_PER_SEC, 'NvLink read bandwidth for link 25 in MiB/sec.') + GPM_METRIC_NVLINK_L25_RX_PER_SEC = NVLINK_L25_RX_PER_SEC # backward-compat alias + NVLINK_L25_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L25_TX_PER_SEC, 'NvLink write bandwidth for link 25 in MiB/sec.') + GPM_METRIC_NVLINK_L25_TX_PER_SEC = NVLINK_L25_TX_PER_SEC # backward-compat alias + NVLINK_L26_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L26_RX_PER_SEC, 'NvLink read bandwidth for link 26 in MiB/sec.') + GPM_METRIC_NVLINK_L26_RX_PER_SEC = NVLINK_L26_RX_PER_SEC # backward-compat alias + NVLINK_L26_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L26_TX_PER_SEC, 'NvLink write bandwidth for link 26 in MiB/sec.') + GPM_METRIC_NVLINK_L26_TX_PER_SEC = NVLINK_L26_TX_PER_SEC # backward-compat alias + NVLINK_L27_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L27_RX_PER_SEC, 'NvLink read bandwidth for link 27 in MiB/sec.') + GPM_METRIC_NVLINK_L27_RX_PER_SEC = NVLINK_L27_RX_PER_SEC # backward-compat alias + NVLINK_L27_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L27_TX_PER_SEC, 'NvLink write bandwidth for link 27 in MiB/sec.') + GPM_METRIC_NVLINK_L27_TX_PER_SEC = NVLINK_L27_TX_PER_SEC # backward-compat alias + NVLINK_L28_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L28_RX_PER_SEC, 'NvLink read bandwidth for link 28 in MiB/sec.') + GPM_METRIC_NVLINK_L28_RX_PER_SEC = NVLINK_L28_RX_PER_SEC # backward-compat alias + NVLINK_L28_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L28_TX_PER_SEC, 'NvLink write bandwidth for link 28 in MiB/sec.') + GPM_METRIC_NVLINK_L28_TX_PER_SEC = NVLINK_L28_TX_PER_SEC # backward-compat alias + NVLINK_L29_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L29_RX_PER_SEC, 'NvLink read bandwidth for link 29 in MiB/sec.') + GPM_METRIC_NVLINK_L29_RX_PER_SEC = NVLINK_L29_RX_PER_SEC # backward-compat alias + NVLINK_L29_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L29_TX_PER_SEC, 'NvLink write bandwidth for link 29 in MiB/sec.') + GPM_METRIC_NVLINK_L29_TX_PER_SEC = NVLINK_L29_TX_PER_SEC # backward-compat alias + NVLINK_L30_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L30_RX_PER_SEC, 'NvLink read bandwidth for link 30 in MiB/sec.') + GPM_METRIC_NVLINK_L30_RX_PER_SEC = NVLINK_L30_RX_PER_SEC # backward-compat alias + NVLINK_L30_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L30_TX_PER_SEC, 'NvLink write bandwidth for link 30 in MiB/sec.') + GPM_METRIC_NVLINK_L30_TX_PER_SEC = NVLINK_L30_TX_PER_SEC # backward-compat alias + NVLINK_L31_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L31_RX_PER_SEC, 'NvLink read bandwidth for link 31 in MiB/sec.') + GPM_METRIC_NVLINK_L31_RX_PER_SEC = NVLINK_L31_RX_PER_SEC # backward-compat alias + NVLINK_L31_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L31_TX_PER_SEC, 'NvLink write bandwidth for link 31 in MiB/sec.') + GPM_METRIC_NVLINK_L31_TX_PER_SEC = NVLINK_L31_TX_PER_SEC # backward-compat alias + NVLINK_L32_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L32_RX_PER_SEC, 'NvLink read bandwidth for link 32 in MiB/sec.') + GPM_METRIC_NVLINK_L32_RX_PER_SEC = NVLINK_L32_RX_PER_SEC # backward-compat alias + NVLINK_L32_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L32_TX_PER_SEC, 'NvLink write bandwidth for link 32 in MiB/sec.') + GPM_METRIC_NVLINK_L32_TX_PER_SEC = NVLINK_L32_TX_PER_SEC # backward-compat alias + NVLINK_L33_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L33_RX_PER_SEC, 'NvLink read bandwidth for link 33 in MiB/sec.') + GPM_METRIC_NVLINK_L33_RX_PER_SEC = NVLINK_L33_RX_PER_SEC # backward-compat alias + NVLINK_L33_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L33_TX_PER_SEC, 'NvLink write bandwidth for link 33 in MiB/sec.') + GPM_METRIC_NVLINK_L33_TX_PER_SEC = NVLINK_L33_TX_PER_SEC # backward-compat alias + NVLINK_L34_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L34_RX_PER_SEC, 'NvLink read bandwidth for link 34 in MiB/sec.') + GPM_METRIC_NVLINK_L34_RX_PER_SEC = NVLINK_L34_RX_PER_SEC # backward-compat alias + NVLINK_L34_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L34_TX_PER_SEC, 'NvLink write bandwidth for link 34 in MiB/sec.') + GPM_METRIC_NVLINK_L34_TX_PER_SEC = NVLINK_L34_TX_PER_SEC # backward-compat alias + NVLINK_L35_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L35_RX_PER_SEC, 'NvLink read bandwidth for link 35 in MiB/sec.') + GPM_METRIC_NVLINK_L35_RX_PER_SEC = NVLINK_L35_RX_PER_SEC # backward-compat alias + NVLINK_L35_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L35_TX_PER_SEC, 'NvLink write bandwidth for link 35 in MiB/sec.') + GPM_METRIC_NVLINK_L35_TX_PER_SEC = NVLINK_L35_TX_PER_SEC # backward-compat alias + SM_CYCLES_ELAPSED = (NVML_GPM_METRIC_SM_CYCLES_ELAPSED, "The GPU's SM cycles elapsed since reboot.") + GPM_METRIC_SM_CYCLES_ELAPSED = SM_CYCLES_ELAPSED # backward-compat alias + SM_CYCLES_ACTIVE = (NVML_GPM_METRIC_SM_CYCLES_ACTIVE, "The GPU's SM activity since reboot.") + GPM_METRIC_SM_CYCLES_ACTIVE = SM_CYCLES_ACTIVE # backward-compat alias + MMA_CYCLES_ACTIVE = (NVML_GPM_METRIC_MMA_CYCLES_ACTIVE, "The GPU's SM MMA tensor activity since reboot.") + GPM_METRIC_MMA_CYCLES_ACTIVE = MMA_CYCLES_ACTIVE # backward-compat alias + DMMA_CYCLES_ACTIVE = (NVML_GPM_METRIC_DMMA_CYCLES_ACTIVE, "The GPU's SM DMMA tensor activity since reboot.") + GPM_METRIC_DMMA_CYCLES_ACTIVE = DMMA_CYCLES_ACTIVE # backward-compat alias + HMMA_CYCLES_ACTIVE = (NVML_GPM_METRIC_HMMA_CYCLES_ACTIVE, "The GPU's SM HMMA tensor activity since reboot.") + GPM_METRIC_HMMA_CYCLES_ACTIVE = HMMA_CYCLES_ACTIVE # backward-compat alias + IMMA_CYCLES_ACTIVE = (NVML_GPM_METRIC_IMMA_CYCLES_ACTIVE, "The GPU's SM IMMA tensor activity since reboot.") + GPM_METRIC_IMMA_CYCLES_ACTIVE = IMMA_CYCLES_ACTIVE # backward-compat alias + DFMA_CYCLES_ACTIVE = (NVML_GPM_METRIC_DFMA_CYCLES_ACTIVE, "The GPU's SM DFMA tensor activity since reboot.") + GPM_METRIC_DFMA_CYCLES_ACTIVE = DFMA_CYCLES_ACTIVE # backward-compat alias + PCIE_TX = (NVML_GPM_METRIC_PCIE_TX, 'The PCIe TX traffic since reboot.') + GPM_METRIC_PCIE_TX = PCIE_TX # backward-compat alias + PCIE_RX = (NVML_GPM_METRIC_PCIE_RX, 'The PCIe RX traffic since reboot.') + GPM_METRIC_PCIE_RX = PCIE_RX # backward-compat alias + INTEGER_CYCLES_ACTIVE = (NVML_GPM_METRIC_INTEGER_CYCLES_ACTIVE, "The GPU's SM integer activity since reboot.") + GPM_METRIC_INTEGER_CYCLES_ACTIVE = INTEGER_CYCLES_ACTIVE # backward-compat alias + FP64_CYCLES_ACTIVE = (NVML_GPM_METRIC_FP64_CYCLES_ACTIVE, "The GPU's SM FP64 activity since reboot.") + GPM_METRIC_FP64_CYCLES_ACTIVE = FP64_CYCLES_ACTIVE # backward-compat alias + FP32_CYCLES_ACTIVE = (NVML_GPM_METRIC_FP32_CYCLES_ACTIVE, "The GPU's SM FP32 activity since reboot.") + GPM_METRIC_FP32_CYCLES_ACTIVE = FP32_CYCLES_ACTIVE # backward-compat alias + FP16_CYCLES_ACTIVE = (NVML_GPM_METRIC_FP16_CYCLES_ACTIVE, "The GPU's SM FP16 activity since reboot.") + GPM_METRIC_FP16_CYCLES_ACTIVE = FP16_CYCLES_ACTIVE # backward-compat alias + NVLINK_L0_RX = (NVML_GPM_METRIC_NVLINK_L0_RX, 'NvLink read for link 0 in bytes since reboot.') + GPM_METRIC_NVLINK_L0_RX = NVLINK_L0_RX # backward-compat alias + NVLINK_L0_TX = (NVML_GPM_METRIC_NVLINK_L0_TX, 'NvLink write for link 0 in bytes since reboot.') + GPM_METRIC_NVLINK_L0_TX = NVLINK_L0_TX # backward-compat alias + NVLINK_L1_RX = (NVML_GPM_METRIC_NVLINK_L1_RX, 'NvLink read for link 1 in bytes since reboot.') + GPM_METRIC_NVLINK_L1_RX = NVLINK_L1_RX # backward-compat alias + NVLINK_L1_TX = (NVML_GPM_METRIC_NVLINK_L1_TX, 'NvLink write for link 1 in bytes since reboot.') + GPM_METRIC_NVLINK_L1_TX = NVLINK_L1_TX # backward-compat alias + NVLINK_L2_RX = (NVML_GPM_METRIC_NVLINK_L2_RX, 'NvLink read for link 2 in bytes since reboot.') + GPM_METRIC_NVLINK_L2_RX = NVLINK_L2_RX # backward-compat alias + NVLINK_L2_TX = (NVML_GPM_METRIC_NVLINK_L2_TX, 'NvLink write for link 2 in bytes since reboot.') + GPM_METRIC_NVLINK_L2_TX = NVLINK_L2_TX # backward-compat alias + NVLINK_L3_RX = (NVML_GPM_METRIC_NVLINK_L3_RX, 'NvLink read for link 3 in bytes since reboot.') + GPM_METRIC_NVLINK_L3_RX = NVLINK_L3_RX # backward-compat alias + NVLINK_L3_TX = (NVML_GPM_METRIC_NVLINK_L3_TX, 'NvLink write for link 3 in bytes since reboot.') + GPM_METRIC_NVLINK_L3_TX = NVLINK_L3_TX # backward-compat alias + NVLINK_L4_RX = (NVML_GPM_METRIC_NVLINK_L4_RX, 'NvLink read for link 4 in bytes since reboot.') + GPM_METRIC_NVLINK_L4_RX = NVLINK_L4_RX # backward-compat alias + NVLINK_L4_TX = (NVML_GPM_METRIC_NVLINK_L4_TX, 'NvLink write for link 4 in bytes since reboot.') + GPM_METRIC_NVLINK_L4_TX = NVLINK_L4_TX # backward-compat alias + NVLINK_L5_RX = (NVML_GPM_METRIC_NVLINK_L5_RX, 'NvLink read for link 5 in bytes since reboot.') + GPM_METRIC_NVLINK_L5_RX = NVLINK_L5_RX # backward-compat alias + NVLINK_L5_TX = (NVML_GPM_METRIC_NVLINK_L5_TX, 'NvLink write for link 5 in bytes since reboot.') + GPM_METRIC_NVLINK_L5_TX = NVLINK_L5_TX # backward-compat alias + NVLINK_L6_RX = (NVML_GPM_METRIC_NVLINK_L6_RX, 'NvLink read for link 6 in bytes since reboot.') + GPM_METRIC_NVLINK_L6_RX = NVLINK_L6_RX # backward-compat alias + NVLINK_L6_TX = (NVML_GPM_METRIC_NVLINK_L6_TX, 'NvLink write for link 6 in bytes since reboot.') + GPM_METRIC_NVLINK_L6_TX = NVLINK_L6_TX # backward-compat alias + NVLINK_L7_RX = (NVML_GPM_METRIC_NVLINK_L7_RX, 'NvLink read for link 7 in bytes since reboot.') + GPM_METRIC_NVLINK_L7_RX = NVLINK_L7_RX # backward-compat alias + NVLINK_L7_TX = (NVML_GPM_METRIC_NVLINK_L7_TX, 'NvLink write for link 7 in bytes since reboot.') + GPM_METRIC_NVLINK_L7_TX = NVLINK_L7_TX # backward-compat alias + NVLINK_L8_RX = (NVML_GPM_METRIC_NVLINK_L8_RX, 'NvLink read for link 8 in bytes since reboot.') + GPM_METRIC_NVLINK_L8_RX = NVLINK_L8_RX # backward-compat alias + NVLINK_L8_TX = (NVML_GPM_METRIC_NVLINK_L8_TX, 'NvLink write for link 8 in bytes since reboot.') + GPM_METRIC_NVLINK_L8_TX = NVLINK_L8_TX # backward-compat alias + NVLINK_L9_RX = (NVML_GPM_METRIC_NVLINK_L9_RX, 'NvLink read for link 9 in bytes since reboot.') + GPM_METRIC_NVLINK_L9_RX = NVLINK_L9_RX # backward-compat alias + NVLINK_L9_TX = (NVML_GPM_METRIC_NVLINK_L9_TX, 'NvLink write for link 9 in bytes since reboot.') + GPM_METRIC_NVLINK_L9_TX = NVLINK_L9_TX # backward-compat alias + NVLINK_L10_RX = (NVML_GPM_METRIC_NVLINK_L10_RX, 'NvLink read for link 10 in bytes since reboot.') + GPM_METRIC_NVLINK_L10_RX = NVLINK_L10_RX # backward-compat alias + NVLINK_L10_TX = (NVML_GPM_METRIC_NVLINK_L10_TX, 'NvLink write for link 10 in bytes since reboot.') + GPM_METRIC_NVLINK_L10_TX = NVLINK_L10_TX # backward-compat alias + NVLINK_L11_RX = (NVML_GPM_METRIC_NVLINK_L11_RX, 'NvLink read for link 11 in bytes since reboot.') + GPM_METRIC_NVLINK_L11_RX = NVLINK_L11_RX # backward-compat alias + NVLINK_L11_TX = (NVML_GPM_METRIC_NVLINK_L11_TX, 'NvLink write for link 11 in bytes since reboot.') + GPM_METRIC_NVLINK_L11_TX = NVLINK_L11_TX # backward-compat alias + NVLINK_L12_RX = (NVML_GPM_METRIC_NVLINK_L12_RX, 'NvLink read for link 12 in bytes since reboot.') + GPM_METRIC_NVLINK_L12_RX = NVLINK_L12_RX # backward-compat alias + NVLINK_L12_TX = (NVML_GPM_METRIC_NVLINK_L12_TX, 'NvLink write for link 12 in bytes since reboot.') + GPM_METRIC_NVLINK_L12_TX = NVLINK_L12_TX # backward-compat alias + NVLINK_L13_RX = (NVML_GPM_METRIC_NVLINK_L13_RX, 'NvLink read for link 13 in bytes since reboot.') + GPM_METRIC_NVLINK_L13_RX = NVLINK_L13_RX # backward-compat alias + NVLINK_L13_TX = (NVML_GPM_METRIC_NVLINK_L13_TX, 'NvLink write for link 13 in bytes since reboot.') + GPM_METRIC_NVLINK_L13_TX = NVLINK_L13_TX # backward-compat alias + NVLINK_L14_RX = (NVML_GPM_METRIC_NVLINK_L14_RX, 'NvLink read for link 14 in bytes since reboot.') + GPM_METRIC_NVLINK_L14_RX = NVLINK_L14_RX # backward-compat alias + NVLINK_L14_TX = (NVML_GPM_METRIC_NVLINK_L14_TX, 'NvLink write for link 14 in bytes since reboot.') + GPM_METRIC_NVLINK_L14_TX = NVLINK_L14_TX # backward-compat alias + NVLINK_L15_RX = (NVML_GPM_METRIC_NVLINK_L15_RX, 'NvLink read for link 15 in bytes since reboot.') + GPM_METRIC_NVLINK_L15_RX = NVLINK_L15_RX # backward-compat alias + NVLINK_L15_TX = (NVML_GPM_METRIC_NVLINK_L15_TX, 'NvLink write for link 15 in bytes since reboot.') + GPM_METRIC_NVLINK_L15_TX = NVLINK_L15_TX # backward-compat alias + NVLINK_L16_RX = (NVML_GPM_METRIC_NVLINK_L16_RX, 'NvLink read for link 16 in bytes since reboot.') + GPM_METRIC_NVLINK_L16_RX = NVLINK_L16_RX # backward-compat alias + NVLINK_L16_TX = (NVML_GPM_METRIC_NVLINK_L16_TX, 'NvLink write for link 16 in bytes since reboot.') + GPM_METRIC_NVLINK_L16_TX = NVLINK_L16_TX # backward-compat alias + NVLINK_L17_RX = (NVML_GPM_METRIC_NVLINK_L17_RX, 'NvLink read for link 17 in bytes since reboot.') + GPM_METRIC_NVLINK_L17_RX = NVLINK_L17_RX # backward-compat alias + NVLINK_L17_TX = (NVML_GPM_METRIC_NVLINK_L17_TX, 'NvLink write for link 17 in bytes since reboot.') + GPM_METRIC_NVLINK_L17_TX = NVLINK_L17_TX # backward-compat alias + NVLINK_L18_RX = (NVML_GPM_METRIC_NVLINK_L18_RX, 'NvLink read for link 18 in bytes since reboot.') + GPM_METRIC_NVLINK_L18_RX = NVLINK_L18_RX # backward-compat alias + NVLINK_L18_TX = (NVML_GPM_METRIC_NVLINK_L18_TX, 'NvLink write for link 18 in bytes since reboot.') + GPM_METRIC_NVLINK_L18_TX = NVLINK_L18_TX # backward-compat alias + NVLINK_L19_RX = (NVML_GPM_METRIC_NVLINK_L19_RX, 'NvLink read for link 19 in bytes since reboot.') + GPM_METRIC_NVLINK_L19_RX = NVLINK_L19_RX # backward-compat alias + NVLINK_L19_TX = (NVML_GPM_METRIC_NVLINK_L19_TX, 'NvLink write for link 19 in bytes since reboot.') + GPM_METRIC_NVLINK_L19_TX = NVLINK_L19_TX # backward-compat alias + NVLINK_L20_RX = (NVML_GPM_METRIC_NVLINK_L20_RX, 'NvLink read for link 20 in bytes since reboot.') + GPM_METRIC_NVLINK_L20_RX = NVLINK_L20_RX # backward-compat alias + NVLINK_L20_TX = (NVML_GPM_METRIC_NVLINK_L20_TX, 'NvLink write for link 20 in bytes since reboot.') + GPM_METRIC_NVLINK_L20_TX = NVLINK_L20_TX # backward-compat alias + NVLINK_L21_RX = (NVML_GPM_METRIC_NVLINK_L21_RX, 'NvLink read for link 21 in bytes since reboot.') + GPM_METRIC_NVLINK_L21_RX = NVLINK_L21_RX # backward-compat alias + NVLINK_L21_TX = (NVML_GPM_METRIC_NVLINK_L21_TX, 'NvLink write for link 21 in bytes since reboot.') + GPM_METRIC_NVLINK_L21_TX = NVLINK_L21_TX # backward-compat alias + NVLINK_L22_RX = (NVML_GPM_METRIC_NVLINK_L22_RX, 'NvLink read for link 22 in bytes since reboot.') + GPM_METRIC_NVLINK_L22_RX = NVLINK_L22_RX # backward-compat alias + NVLINK_L22_TX = (NVML_GPM_METRIC_NVLINK_L22_TX, 'NvLink write for link 22 in bytes since reboot.') + GPM_METRIC_NVLINK_L22_TX = NVLINK_L22_TX # backward-compat alias + NVLINK_L23_RX = (NVML_GPM_METRIC_NVLINK_L23_RX, 'NvLink read for link 23 in bytes since reboot.') + GPM_METRIC_NVLINK_L23_RX = NVLINK_L23_RX # backward-compat alias + NVLINK_L23_TX = (NVML_GPM_METRIC_NVLINK_L23_TX, 'NvLink write for link 23 in bytes since reboot.') + GPM_METRIC_NVLINK_L23_TX = NVLINK_L23_TX # backward-compat alias + NVLINK_L24_RX = (NVML_GPM_METRIC_NVLINK_L24_RX, 'NvLink read for link 24 in bytes since reboot.') + GPM_METRIC_NVLINK_L24_RX = NVLINK_L24_RX # backward-compat alias + NVLINK_L24_TX = (NVML_GPM_METRIC_NVLINK_L24_TX, 'NvLink write for link 24 in bytes since reboot.') + GPM_METRIC_NVLINK_L24_TX = NVLINK_L24_TX # backward-compat alias + NVLINK_L25_RX = (NVML_GPM_METRIC_NVLINK_L25_RX, 'NvLink read for link 25 in bytes since reboot.') + GPM_METRIC_NVLINK_L25_RX = NVLINK_L25_RX # backward-compat alias + NVLINK_L25_TX = (NVML_GPM_METRIC_NVLINK_L25_TX, 'NvLink write for link 25 in bytes since reboot.') + GPM_METRIC_NVLINK_L25_TX = NVLINK_L25_TX # backward-compat alias + NVLINK_L26_RX = (NVML_GPM_METRIC_NVLINK_L26_RX, 'NvLink read for link 26 in bytes since reboot.') + GPM_METRIC_NVLINK_L26_RX = NVLINK_L26_RX # backward-compat alias + NVLINK_L26_TX = (NVML_GPM_METRIC_NVLINK_L26_TX, 'NvLink write for link 26 in bytes since reboot.') + GPM_METRIC_NVLINK_L26_TX = NVLINK_L26_TX # backward-compat alias + NVLINK_L27_RX = (NVML_GPM_METRIC_NVLINK_L27_RX, 'NvLink read for link 27 in bytes since reboot.') + GPM_METRIC_NVLINK_L27_RX = NVLINK_L27_RX # backward-compat alias + NVLINK_L27_TX = (NVML_GPM_METRIC_NVLINK_L27_TX, 'NvLink write for link 27 in bytes since reboot.') + GPM_METRIC_NVLINK_L27_TX = NVLINK_L27_TX # backward-compat alias + NVLINK_L28_RX = (NVML_GPM_METRIC_NVLINK_L28_RX, 'NvLink read for link 28 in bytes since reboot.') + GPM_METRIC_NVLINK_L28_RX = NVLINK_L28_RX # backward-compat alias + NVLINK_L28_TX = (NVML_GPM_METRIC_NVLINK_L28_TX, 'NvLink write for link 28 in bytes since reboot.') + GPM_METRIC_NVLINK_L28_TX = NVLINK_L28_TX # backward-compat alias + NVLINK_L29_RX = (NVML_GPM_METRIC_NVLINK_L29_RX, 'NvLink read for link 29 in bytes since reboot.') + GPM_METRIC_NVLINK_L29_RX = NVLINK_L29_RX # backward-compat alias + NVLINK_L29_TX = (NVML_GPM_METRIC_NVLINK_L29_TX, 'NvLink write for link 29 in bytes since reboot.') + GPM_METRIC_NVLINK_L29_TX = NVLINK_L29_TX # backward-compat alias + NVLINK_L30_RX = (NVML_GPM_METRIC_NVLINK_L30_RX, 'NvLink read for link 30 in bytes since reboot.') + GPM_METRIC_NVLINK_L30_RX = NVLINK_L30_RX # backward-compat alias + NVLINK_L30_TX = (NVML_GPM_METRIC_NVLINK_L30_TX, 'NvLink write for link 30 in bytes since reboot.') + GPM_METRIC_NVLINK_L30_TX = NVLINK_L30_TX # backward-compat alias + NVLINK_L31_RX = (NVML_GPM_METRIC_NVLINK_L31_RX, 'NvLink read for link 31 in bytes since reboot.') + GPM_METRIC_NVLINK_L31_RX = NVLINK_L31_RX # backward-compat alias + NVLINK_L31_TX = (NVML_GPM_METRIC_NVLINK_L31_TX, 'NvLink write for link 31 in bytes since reboot.') + GPM_METRIC_NVLINK_L31_TX = NVLINK_L31_TX # backward-compat alias + NVLINK_L32_RX = (NVML_GPM_METRIC_NVLINK_L32_RX, 'NvLink read for link 32 in bytes since reboot.') + GPM_METRIC_NVLINK_L32_RX = NVLINK_L32_RX # backward-compat alias + NVLINK_L32_TX = (NVML_GPM_METRIC_NVLINK_L32_TX, 'NvLink write for link 32 in bytes since reboot.') + GPM_METRIC_NVLINK_L32_TX = NVLINK_L32_TX # backward-compat alias + NVLINK_L33_RX = (NVML_GPM_METRIC_NVLINK_L33_RX, 'NvLink read for link 33 in bytes since reboot.') + GPM_METRIC_NVLINK_L33_RX = NVLINK_L33_RX # backward-compat alias + NVLINK_L33_TX = (NVML_GPM_METRIC_NVLINK_L33_TX, 'NvLink write for link 33 in bytes since reboot.') + GPM_METRIC_NVLINK_L33_TX = NVLINK_L33_TX # backward-compat alias + NVLINK_L34_RX = (NVML_GPM_METRIC_NVLINK_L34_RX, 'NvLink read for link 34 in bytes since reboot.') + GPM_METRIC_NVLINK_L34_RX = NVLINK_L34_RX # backward-compat alias + NVLINK_L34_TX = (NVML_GPM_METRIC_NVLINK_L34_TX, 'NvLink write for link 34 in bytes since reboot.') + GPM_METRIC_NVLINK_L34_TX = NVLINK_L34_TX # backward-compat alias + NVLINK_L35_RX = (NVML_GPM_METRIC_NVLINK_L35_RX, 'NvLink read for link 35 in bytes since reboot.') + GPM_METRIC_NVLINK_L35_RX = NVLINK_L35_RX # backward-compat alias + NVLINK_L35_TX = (NVML_GPM_METRIC_NVLINK_L35_TX, 'NvLink write for link 35 in bytes since reboot.') + GPM_METRIC_NVLINK_L35_TX = NVLINK_L35_TX # backward-compat alias + NVLINK_L36_RX = (NVML_GPM_METRIC_NVLINK_L36_RX, 'NvLink read for link 36 in bytes since reboot.') + GPM_METRIC_NVLINK_L36_RX = NVLINK_L36_RX # backward-compat alias + NVLINK_L36_TX = (NVML_GPM_METRIC_NVLINK_L36_TX, 'NvLink write for link 36 in bytes since reboot.') + GPM_METRIC_NVLINK_L36_TX = NVLINK_L36_TX # backward-compat alias + NVLINK_L37_RX = (NVML_GPM_METRIC_NVLINK_L37_RX, 'NvLink read for link 37 in bytes since reboot.') + GPM_METRIC_NVLINK_L37_RX = NVLINK_L37_RX # backward-compat alias + NVLINK_L37_TX = (NVML_GPM_METRIC_NVLINK_L37_TX, 'NvLink write for link 37 in bytes since reboot.') + GPM_METRIC_NVLINK_L37_TX = NVLINK_L37_TX # backward-compat alias + NVLINK_L38_RX = (NVML_GPM_METRIC_NVLINK_L38_RX, 'NvLink read for link 38 in bytes since reboot.') + GPM_METRIC_NVLINK_L38_RX = NVLINK_L38_RX # backward-compat alias + NVLINK_L38_TX = (NVML_GPM_METRIC_NVLINK_L38_TX, 'NvLink write for link 38 in bytes since reboot.') + GPM_METRIC_NVLINK_L38_TX = NVLINK_L38_TX # backward-compat alias + NVLINK_L39_RX = (NVML_GPM_METRIC_NVLINK_L39_RX, 'NvLink read for link 39 in bytes since reboot.') + GPM_METRIC_NVLINK_L39_RX = NVLINK_L39_RX # backward-compat alias + NVLINK_L39_TX = (NVML_GPM_METRIC_NVLINK_L39_TX, 'NvLink write for link 39 in bytes since reboot.') + GPM_METRIC_NVLINK_L39_TX = NVLINK_L39_TX # backward-compat alias + NVLINK_L40_RX = (NVML_GPM_METRIC_NVLINK_L40_RX, 'NvLink read for link 40 in bytes since reboot.') + GPM_METRIC_NVLINK_L40_RX = NVLINK_L40_RX # backward-compat alias + NVLINK_L40_TX = (NVML_GPM_METRIC_NVLINK_L40_TX, 'NvLink write for link 40 in bytes since reboot.') + GPM_METRIC_NVLINK_L40_TX = NVLINK_L40_TX # backward-compat alias + NVLINK_L41_RX = (NVML_GPM_METRIC_NVLINK_L41_RX, 'NvLink read for link 41 in bytes since reboot.') + GPM_METRIC_NVLINK_L41_RX = NVLINK_L41_RX # backward-compat alias + NVLINK_L41_TX = (NVML_GPM_METRIC_NVLINK_L41_TX, 'NvLink write for link 41 in bytes since reboot.') + GPM_METRIC_NVLINK_L41_TX = NVLINK_L41_TX # backward-compat alias + NVLINK_L42_RX = (NVML_GPM_METRIC_NVLINK_L42_RX, 'NvLink read for link 42 in bytes since reboot.') + GPM_METRIC_NVLINK_L42_RX = NVLINK_L42_RX # backward-compat alias + NVLINK_L42_TX = (NVML_GPM_METRIC_NVLINK_L42_TX, 'NvLink write for link 42 in bytes since reboot.') + GPM_METRIC_NVLINK_L42_TX = NVLINK_L42_TX # backward-compat alias + NVLINK_L43_RX = (NVML_GPM_METRIC_NVLINK_L43_RX, 'NvLink read for link 43 in bytes since reboot.') + GPM_METRIC_NVLINK_L43_RX = NVLINK_L43_RX # backward-compat alias + NVLINK_L43_TX = (NVML_GPM_METRIC_NVLINK_L43_TX, 'NvLink write for link 43 in bytes since reboot.') + GPM_METRIC_NVLINK_L43_TX = NVLINK_L43_TX # backward-compat alias + NVLINK_L44_RX = (NVML_GPM_METRIC_NVLINK_L44_RX, 'NvLink read for link 44 in bytes since reboot.') + GPM_METRIC_NVLINK_L44_RX = NVLINK_L44_RX # backward-compat alias + NVLINK_L44_TX = (NVML_GPM_METRIC_NVLINK_L44_TX, 'NvLink write for link 44 in bytes since reboot.') + GPM_METRIC_NVLINK_L44_TX = NVLINK_L44_TX # backward-compat alias + NVLINK_L45_RX = (NVML_GPM_METRIC_NVLINK_L45_RX, 'NvLink read for link 45 in bytes since reboot.') + GPM_METRIC_NVLINK_L45_RX = NVLINK_L45_RX # backward-compat alias + NVLINK_L45_TX = (NVML_GPM_METRIC_NVLINK_L45_TX, 'NvLink write for link 45 in bytes since reboot.') + GPM_METRIC_NVLINK_L45_TX = NVLINK_L45_TX # backward-compat alias + NVLINK_L46_RX = (NVML_GPM_METRIC_NVLINK_L46_RX, 'NvLink read for link 46 in bytes since reboot.') + GPM_METRIC_NVLINK_L46_RX = NVLINK_L46_RX # backward-compat alias + NVLINK_L46_TX = (NVML_GPM_METRIC_NVLINK_L46_TX, 'NvLink write for link 46 in bytes since reboot.') + GPM_METRIC_NVLINK_L46_TX = NVLINK_L46_TX # backward-compat alias + NVLINK_L47_RX = (NVML_GPM_METRIC_NVLINK_L47_RX, 'NvLink read for link 47 in bytes since reboot.') + GPM_METRIC_NVLINK_L47_RX = NVLINK_L47_RX # backward-compat alias + NVLINK_L47_TX = (NVML_GPM_METRIC_NVLINK_L47_TX, 'NvLink write for link 47 in bytes since reboot.') + GPM_METRIC_NVLINK_L47_TX = NVLINK_L47_TX # backward-compat alias + NVLINK_L48_RX = (NVML_GPM_METRIC_NVLINK_L48_RX, 'NvLink read for link 48 in bytes since reboot.') + GPM_METRIC_NVLINK_L48_RX = NVLINK_L48_RX # backward-compat alias + NVLINK_L48_TX = (NVML_GPM_METRIC_NVLINK_L48_TX, 'NvLink write for link 48 in bytes since reboot.') + GPM_METRIC_NVLINK_L48_TX = NVLINK_L48_TX # backward-compat alias + NVLINK_L49_RX = (NVML_GPM_METRIC_NVLINK_L49_RX, 'NvLink read for link 49 in bytes since reboot.') + GPM_METRIC_NVLINK_L49_RX = NVLINK_L49_RX # backward-compat alias + NVLINK_L49_TX = (NVML_GPM_METRIC_NVLINK_L49_TX, 'NvLink write for link 49 in bytes since reboot.') + GPM_METRIC_NVLINK_L49_TX = NVLINK_L49_TX # backward-compat alias + NVLINK_L50_RX = (NVML_GPM_METRIC_NVLINK_L50_RX, 'NvLink read for link 50 in bytes since reboot.') + GPM_METRIC_NVLINK_L50_RX = NVLINK_L50_RX # backward-compat alias + NVLINK_L50_TX = (NVML_GPM_METRIC_NVLINK_L50_TX, 'NvLink write for link 50 in bytes since reboot.') + GPM_METRIC_NVLINK_L50_TX = NVLINK_L50_TX # backward-compat alias + NVLINK_L51_RX = (NVML_GPM_METRIC_NVLINK_L51_RX, 'NvLink read for link 51 in bytes since reboot.') + GPM_METRIC_NVLINK_L51_RX = NVLINK_L51_RX # backward-compat alias + NVLINK_L51_TX = (NVML_GPM_METRIC_NVLINK_L51_TX, 'NvLink write for link 51 in bytes since reboot.') + GPM_METRIC_NVLINK_L51_TX = NVLINK_L51_TX # backward-compat alias + NVLINK_L52_RX = (NVML_GPM_METRIC_NVLINK_L52_RX, 'NvLink read for link 52 in bytes since reboot.') + GPM_METRIC_NVLINK_L52_RX = NVLINK_L52_RX # backward-compat alias + NVLINK_L52_TX = (NVML_GPM_METRIC_NVLINK_L52_TX, 'NvLink write for link 52 in bytes since reboot.') + GPM_METRIC_NVLINK_L52_TX = NVLINK_L52_TX # backward-compat alias + NVLINK_L53_RX = (NVML_GPM_METRIC_NVLINK_L53_RX, 'NvLink read for link 53 in bytes since reboot.') + GPM_METRIC_NVLINK_L53_RX = NVLINK_L53_RX # backward-compat alias + NVLINK_L53_TX = (NVML_GPM_METRIC_NVLINK_L53_TX, 'NvLink write for link 53 in bytes since reboot.') + GPM_METRIC_NVLINK_L53_TX = NVLINK_L53_TX # backward-compat alias + NVLINK_L54_RX = (NVML_GPM_METRIC_NVLINK_L54_RX, 'NvLink read for link 54 in bytes since reboot.') + GPM_METRIC_NVLINK_L54_RX = NVLINK_L54_RX # backward-compat alias + NVLINK_L54_TX = (NVML_GPM_METRIC_NVLINK_L54_TX, 'NvLink write for link 54 in bytes since reboot.') + GPM_METRIC_NVLINK_L54_TX = NVLINK_L54_TX # backward-compat alias + NVLINK_L55_RX = (NVML_GPM_METRIC_NVLINK_L55_RX, 'NvLink read for link 55 in bytes since reboot.') + GPM_METRIC_NVLINK_L55_RX = NVLINK_L55_RX # backward-compat alias + NVLINK_L55_TX = (NVML_GPM_METRIC_NVLINK_L55_TX, 'NvLink write for link 55 in bytes since reboot.') + GPM_METRIC_NVLINK_L55_TX = NVLINK_L55_TX # backward-compat alias + NVLINK_L56_RX = (NVML_GPM_METRIC_NVLINK_L56_RX, 'NvLink read for link 56 in bytes since reboot.') + GPM_METRIC_NVLINK_L56_RX = NVLINK_L56_RX # backward-compat alias + NVLINK_L56_TX = (NVML_GPM_METRIC_NVLINK_L56_TX, 'NvLink write for link 56 in bytes since reboot.') + GPM_METRIC_NVLINK_L56_TX = NVLINK_L56_TX # backward-compat alias + NVLINK_L57_RX = (NVML_GPM_METRIC_NVLINK_L57_RX, 'NvLink read for link 57 in bytes since reboot.') + GPM_METRIC_NVLINK_L57_RX = NVLINK_L57_RX # backward-compat alias + NVLINK_L57_TX = (NVML_GPM_METRIC_NVLINK_L57_TX, 'NvLink write for link 57 in bytes since reboot.') + GPM_METRIC_NVLINK_L57_TX = NVLINK_L57_TX # backward-compat alias + NVLINK_L58_RX = (NVML_GPM_METRIC_NVLINK_L58_RX, 'NvLink read for link 58 in bytes since reboot.') + GPM_METRIC_NVLINK_L58_RX = NVLINK_L58_RX # backward-compat alias + NVLINK_L58_TX = (NVML_GPM_METRIC_NVLINK_L58_TX, 'NvLink write for link 58 in bytes since reboot.') + GPM_METRIC_NVLINK_L58_TX = NVLINK_L58_TX # backward-compat alias + NVLINK_L59_RX = (NVML_GPM_METRIC_NVLINK_L59_RX, 'NvLink read for link 59 in bytes since reboot.') + GPM_METRIC_NVLINK_L59_RX = NVLINK_L59_RX # backward-compat alias + NVLINK_L59_TX = (NVML_GPM_METRIC_NVLINK_L59_TX, 'NvLink write for link 59 in bytes since reboot.') + GPM_METRIC_NVLINK_L59_TX = NVLINK_L59_TX # backward-compat alias + NVLINK_L60_RX = (NVML_GPM_METRIC_NVLINK_L60_RX, 'NvLink read for link 60 in bytes since reboot.') + GPM_METRIC_NVLINK_L60_RX = NVLINK_L60_RX # backward-compat alias + NVLINK_L60_TX = (NVML_GPM_METRIC_NVLINK_L60_TX, 'NvLink write for link 60 in bytes since reboot.') + GPM_METRIC_NVLINK_L60_TX = NVLINK_L60_TX # backward-compat alias + NVLINK_L61_RX = (NVML_GPM_METRIC_NVLINK_L61_RX, 'NvLink read for link 61 in bytes since reboot.') + GPM_METRIC_NVLINK_L61_RX = NVLINK_L61_RX # backward-compat alias + NVLINK_L61_TX = (NVML_GPM_METRIC_NVLINK_L61_TX, 'NvLink write for link 61 in bytes since reboot.') + GPM_METRIC_NVLINK_L61_TX = NVLINK_L61_TX # backward-compat alias + NVLINK_L62_RX = (NVML_GPM_METRIC_NVLINK_L62_RX, 'NvLink read for link 62 in bytes since reboot.') + GPM_METRIC_NVLINK_L62_RX = NVLINK_L62_RX # backward-compat alias + NVLINK_L62_TX = (NVML_GPM_METRIC_NVLINK_L62_TX, 'NvLink write for link 62 in bytes since reboot.') + GPM_METRIC_NVLINK_L62_TX = NVLINK_L62_TX # backward-compat alias + NVLINK_L63_RX = (NVML_GPM_METRIC_NVLINK_L63_RX, 'NvLink read for link 63 in bytes since reboot.') + GPM_METRIC_NVLINK_L63_RX = NVLINK_L63_RX # backward-compat alias + NVLINK_L63_TX = (NVML_GPM_METRIC_NVLINK_L63_TX, 'NvLink write for link 63 in bytes since reboot.') + GPM_METRIC_NVLINK_L63_TX = NVLINK_L63_TX # backward-compat alias + NVLINK_L64_RX = (NVML_GPM_METRIC_NVLINK_L64_RX, 'NvLink read for link 64 in bytes since reboot.') + GPM_METRIC_NVLINK_L64_RX = NVLINK_L64_RX # backward-compat alias + NVLINK_L64_TX = (NVML_GPM_METRIC_NVLINK_L64_TX, 'NvLink write for link 64 in bytes since reboot.') + GPM_METRIC_NVLINK_L64_TX = NVLINK_L64_TX # backward-compat alias + NVLINK_L65_RX = (NVML_GPM_METRIC_NVLINK_L65_RX, 'NvLink read for link 65 in bytes since reboot.') + GPM_METRIC_NVLINK_L65_RX = NVLINK_L65_RX # backward-compat alias + NVLINK_L65_TX = (NVML_GPM_METRIC_NVLINK_L65_TX, 'NvLink write for link 65 in bytes since reboot.') + GPM_METRIC_NVLINK_L65_TX = NVLINK_L65_TX # backward-compat alias + NVLINK_L66_RX = (NVML_GPM_METRIC_NVLINK_L66_RX, 'NvLink read for link 66 in bytes since reboot.') + GPM_METRIC_NVLINK_L66_RX = NVLINK_L66_RX # backward-compat alias + NVLINK_L66_TX = (NVML_GPM_METRIC_NVLINK_L66_TX, 'NvLink write for link 66 in bytes since reboot.') + GPM_METRIC_NVLINK_L66_TX = NVLINK_L66_TX # backward-compat alias + NVLINK_L67_RX = (NVML_GPM_METRIC_NVLINK_L67_RX, 'NvLink read for link 67 in bytes since reboot.') + GPM_METRIC_NVLINK_L67_RX = NVLINK_L67_RX # backward-compat alias + NVLINK_L67_TX = (NVML_GPM_METRIC_NVLINK_L67_TX, 'NvLink write for link 67 in bytes since reboot.') + GPM_METRIC_NVLINK_L67_TX = NVLINK_L67_TX # backward-compat alias + NVLINK_L68_RX = (NVML_GPM_METRIC_NVLINK_L68_RX, 'NvLink read for link 68 in bytes since reboot.') + GPM_METRIC_NVLINK_L68_RX = NVLINK_L68_RX # backward-compat alias + NVLINK_L68_TX = (NVML_GPM_METRIC_NVLINK_L68_TX, 'NvLink write for link 68 in bytes since reboot.') + GPM_METRIC_NVLINK_L68_TX = NVLINK_L68_TX # backward-compat alias + NVLINK_L69_RX = (NVML_GPM_METRIC_NVLINK_L69_RX, 'NvLink read for link 69 in bytes since reboot.') + GPM_METRIC_NVLINK_L69_RX = NVLINK_L69_RX # backward-compat alias + NVLINK_L69_TX = (NVML_GPM_METRIC_NVLINK_L69_TX, 'NvLink write for link 69 in bytes since reboot.') + GPM_METRIC_NVLINK_L69_TX = NVLINK_L69_TX # backward-compat alias + NVLINK_L70_RX = (NVML_GPM_METRIC_NVLINK_L70_RX, 'NvLink read for link 70 in bytes since reboot.') + GPM_METRIC_NVLINK_L70_RX = NVLINK_L70_RX # backward-compat alias + NVLINK_L70_TX = (NVML_GPM_METRIC_NVLINK_L70_TX, 'NvLink write for link 70 in bytes since reboot.') + GPM_METRIC_NVLINK_L70_TX = NVLINK_L70_TX # backward-compat alias + NVLINK_L71_RX = (NVML_GPM_METRIC_NVLINK_L71_RX, 'NvLink read for link 71 in bytes since reboot.') + GPM_METRIC_NVLINK_L71_RX = NVLINK_L71_RX # backward-compat alias + NVLINK_L71_TX = (NVML_GPM_METRIC_NVLINK_L71_TX, 'NvLink write for link 71 in bytes since reboot.') + GPM_METRIC_NVLINK_L71_TX = NVLINK_L71_TX # backward-compat alias + NVLINK_L36_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L36_RX_PER_SEC, 'NvLink read bandwidth for link 36 in MiB/sec.') + GPM_METRIC_NVLINK_L36_RX_PER_SEC = NVLINK_L36_RX_PER_SEC # backward-compat alias + NVLINK_L36_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L36_TX_PER_SEC, 'NvLink write bandwidth for link 36 in MiB/sec.') + GPM_METRIC_NVLINK_L36_TX_PER_SEC = NVLINK_L36_TX_PER_SEC # backward-compat alias + NVLINK_L37_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L37_RX_PER_SEC, 'NvLink read bandwidth for link 37 in MiB/sec.') + GPM_METRIC_NVLINK_L37_RX_PER_SEC = NVLINK_L37_RX_PER_SEC # backward-compat alias + NVLINK_L37_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L37_TX_PER_SEC, 'NvLink write bandwidth for link 37 in MiB/sec.') + GPM_METRIC_NVLINK_L37_TX_PER_SEC = NVLINK_L37_TX_PER_SEC # backward-compat alias + NVLINK_L38_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L38_RX_PER_SEC, 'NvLink read bandwidth for link 38 in MiB/sec.') + GPM_METRIC_NVLINK_L38_RX_PER_SEC = NVLINK_L38_RX_PER_SEC # backward-compat alias + NVLINK_L38_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L38_TX_PER_SEC, 'NvLink write bandwidth for link 38 in MiB/sec.') + GPM_METRIC_NVLINK_L38_TX_PER_SEC = NVLINK_L38_TX_PER_SEC # backward-compat alias + NVLINK_L39_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L39_RX_PER_SEC, 'NvLink read bandwidth for link 39 in MiB/sec.') + GPM_METRIC_NVLINK_L39_RX_PER_SEC = NVLINK_L39_RX_PER_SEC # backward-compat alias + NVLINK_L39_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L39_TX_PER_SEC, 'NvLink write bandwidth for link 39 in MiB/sec.') + GPM_METRIC_NVLINK_L39_TX_PER_SEC = NVLINK_L39_TX_PER_SEC # backward-compat alias + NVLINK_L40_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L40_RX_PER_SEC, 'NvLink read bandwidth for link 40 in MiB/sec.') + GPM_METRIC_NVLINK_L40_RX_PER_SEC = NVLINK_L40_RX_PER_SEC # backward-compat alias + NVLINK_L40_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L40_TX_PER_SEC, 'NvLink write bandwidth for link 40 in MiB/sec.') + GPM_METRIC_NVLINK_L40_TX_PER_SEC = NVLINK_L40_TX_PER_SEC # backward-compat alias + NVLINK_L41_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L41_RX_PER_SEC, 'NvLink read bandwidth for link 41 in MiB/sec.') + GPM_METRIC_NVLINK_L41_RX_PER_SEC = NVLINK_L41_RX_PER_SEC # backward-compat alias + NVLINK_L41_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L41_TX_PER_SEC, 'NvLink write bandwidth for link 41 in MiB/sec.') + GPM_METRIC_NVLINK_L41_TX_PER_SEC = NVLINK_L41_TX_PER_SEC # backward-compat alias + NVLINK_L42_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L42_RX_PER_SEC, 'NvLink read bandwidth for link 42 in MiB/sec.') + GPM_METRIC_NVLINK_L42_RX_PER_SEC = NVLINK_L42_RX_PER_SEC # backward-compat alias + NVLINK_L42_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L42_TX_PER_SEC, 'NvLink write bandwidth for link 42 in MiB/sec.') + GPM_METRIC_NVLINK_L42_TX_PER_SEC = NVLINK_L42_TX_PER_SEC # backward-compat alias + NVLINK_L43_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L43_RX_PER_SEC, 'NvLink read bandwidth for link 43 in MiB/sec.') + GPM_METRIC_NVLINK_L43_RX_PER_SEC = NVLINK_L43_RX_PER_SEC # backward-compat alias + NVLINK_L43_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L43_TX_PER_SEC, 'NvLink write bandwidth for link 43 in MiB/sec.') + GPM_METRIC_NVLINK_L43_TX_PER_SEC = NVLINK_L43_TX_PER_SEC # backward-compat alias + NVLINK_L44_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L44_RX_PER_SEC, 'NvLink read bandwidth for link 44 in MiB/sec.') + GPM_METRIC_NVLINK_L44_RX_PER_SEC = NVLINK_L44_RX_PER_SEC # backward-compat alias + NVLINK_L44_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L44_TX_PER_SEC, 'NvLink write bandwidth for link 44 in MiB/sec.') + GPM_METRIC_NVLINK_L44_TX_PER_SEC = NVLINK_L44_TX_PER_SEC # backward-compat alias + NVLINK_L45_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L45_RX_PER_SEC, 'NvLink read bandwidth for link 45 in MiB/sec.') + GPM_METRIC_NVLINK_L45_RX_PER_SEC = NVLINK_L45_RX_PER_SEC # backward-compat alias + NVLINK_L45_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L45_TX_PER_SEC, 'NvLink write bandwidth for link 45 in MiB/sec.') + GPM_METRIC_NVLINK_L45_TX_PER_SEC = NVLINK_L45_TX_PER_SEC # backward-compat alias + NVLINK_L46_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L46_RX_PER_SEC, 'NvLink read bandwidth for link 46 in MiB/sec.') + GPM_METRIC_NVLINK_L46_RX_PER_SEC = NVLINK_L46_RX_PER_SEC # backward-compat alias + NVLINK_L46_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L46_TX_PER_SEC, 'NvLink write bandwidth for link 46 in MiB/sec.') + GPM_METRIC_NVLINK_L46_TX_PER_SEC = NVLINK_L46_TX_PER_SEC # backward-compat alias + NVLINK_L47_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L47_RX_PER_SEC, 'NvLink read bandwidth for link 47 in MiB/sec.') + GPM_METRIC_NVLINK_L47_RX_PER_SEC = NVLINK_L47_RX_PER_SEC # backward-compat alias + NVLINK_L47_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L47_TX_PER_SEC, 'NvLink write bandwidth for link 47 in MiB/sec.') + GPM_METRIC_NVLINK_L47_TX_PER_SEC = NVLINK_L47_TX_PER_SEC # backward-compat alias + NVLINK_L48_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L48_RX_PER_SEC, 'NvLink read bandwidth for link 48 in MiB/sec.') + GPM_METRIC_NVLINK_L48_RX_PER_SEC = NVLINK_L48_RX_PER_SEC # backward-compat alias + NVLINK_L48_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L48_TX_PER_SEC, 'NvLink write bandwidth for link 48 in MiB/sec.') + GPM_METRIC_NVLINK_L48_TX_PER_SEC = NVLINK_L48_TX_PER_SEC # backward-compat alias + NVLINK_L49_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L49_RX_PER_SEC, 'NvLink read bandwidth for link 49 in MiB/sec.') + GPM_METRIC_NVLINK_L49_RX_PER_SEC = NVLINK_L49_RX_PER_SEC # backward-compat alias + NVLINK_L49_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L49_TX_PER_SEC, 'NvLink write bandwidth for link 49 in MiB/sec.') + GPM_METRIC_NVLINK_L49_TX_PER_SEC = NVLINK_L49_TX_PER_SEC # backward-compat alias + NVLINK_L50_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L50_RX_PER_SEC, 'NvLink read bandwidth for link 50 in MiB/sec.') + GPM_METRIC_NVLINK_L50_RX_PER_SEC = NVLINK_L50_RX_PER_SEC # backward-compat alias + NVLINK_L50_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L50_TX_PER_SEC, 'NvLink write bandwidth for link 50 in MiB/sec.') + GPM_METRIC_NVLINK_L50_TX_PER_SEC = NVLINK_L50_TX_PER_SEC # backward-compat alias + NVLINK_L51_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L51_RX_PER_SEC, 'NvLink read bandwidth for link 51 in MiB/sec.') + GPM_METRIC_NVLINK_L51_RX_PER_SEC = NVLINK_L51_RX_PER_SEC # backward-compat alias + NVLINK_L51_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L51_TX_PER_SEC, 'NvLink write bandwidth for link 51 in MiB/sec.') + GPM_METRIC_NVLINK_L51_TX_PER_SEC = NVLINK_L51_TX_PER_SEC # backward-compat alias + NVLINK_L52_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L52_RX_PER_SEC, 'NvLink read bandwidth for link 52 in MiB/sec.') + GPM_METRIC_NVLINK_L52_RX_PER_SEC = NVLINK_L52_RX_PER_SEC # backward-compat alias + NVLINK_L52_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L52_TX_PER_SEC, 'NvLink write bandwidth for link 52 in MiB/sec.') + GPM_METRIC_NVLINK_L52_TX_PER_SEC = NVLINK_L52_TX_PER_SEC # backward-compat alias + NVLINK_L53_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L53_RX_PER_SEC, 'NvLink read bandwidth for link 53 in MiB/sec.') + GPM_METRIC_NVLINK_L53_RX_PER_SEC = NVLINK_L53_RX_PER_SEC # backward-compat alias + NVLINK_L53_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L53_TX_PER_SEC, 'NvLink write bandwidth for link 53 in MiB/sec.') + GPM_METRIC_NVLINK_L53_TX_PER_SEC = NVLINK_L53_TX_PER_SEC # backward-compat alias + NVLINK_L54_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L54_RX_PER_SEC, 'NvLink read bandwidth for link 54 in MiB/sec.') + GPM_METRIC_NVLINK_L54_RX_PER_SEC = NVLINK_L54_RX_PER_SEC # backward-compat alias + NVLINK_L54_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L54_TX_PER_SEC, 'NvLink write bandwidth for link 54 in MiB/sec.') + GPM_METRIC_NVLINK_L54_TX_PER_SEC = NVLINK_L54_TX_PER_SEC # backward-compat alias + NVLINK_L55_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L55_RX_PER_SEC, 'NvLink read bandwidth for link 55 in MiB/sec.') + GPM_METRIC_NVLINK_L55_RX_PER_SEC = NVLINK_L55_RX_PER_SEC # backward-compat alias + NVLINK_L55_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L55_TX_PER_SEC, 'NvLink write bandwidth for link 55 in MiB/sec.') + GPM_METRIC_NVLINK_L55_TX_PER_SEC = NVLINK_L55_TX_PER_SEC # backward-compat alias + NVLINK_L56_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L56_RX_PER_SEC, 'NvLink read bandwidth for link 56 in MiB/sec.') + GPM_METRIC_NVLINK_L56_RX_PER_SEC = NVLINK_L56_RX_PER_SEC # backward-compat alias + NVLINK_L56_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L56_TX_PER_SEC, 'NvLink write bandwidth for link 56 in MiB/sec.') + GPM_METRIC_NVLINK_L56_TX_PER_SEC = NVLINK_L56_TX_PER_SEC # backward-compat alias + NVLINK_L57_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L57_RX_PER_SEC, 'NvLink read bandwidth for link 57 in MiB/sec.') + GPM_METRIC_NVLINK_L57_RX_PER_SEC = NVLINK_L57_RX_PER_SEC # backward-compat alias + NVLINK_L57_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L57_TX_PER_SEC, 'NvLink write bandwidth for link 57 in MiB/sec.') + GPM_METRIC_NVLINK_L57_TX_PER_SEC = NVLINK_L57_TX_PER_SEC # backward-compat alias + NVLINK_L58_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L58_RX_PER_SEC, 'NvLink read bandwidth for link 58 in MiB/sec.') + GPM_METRIC_NVLINK_L58_RX_PER_SEC = NVLINK_L58_RX_PER_SEC # backward-compat alias + NVLINK_L58_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L58_TX_PER_SEC, 'NvLink write bandwidth for link 58 in MiB/sec.') + GPM_METRIC_NVLINK_L58_TX_PER_SEC = NVLINK_L58_TX_PER_SEC # backward-compat alias + NVLINK_L59_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L59_RX_PER_SEC, 'NvLink read bandwidth for link 59 in MiB/sec.') + GPM_METRIC_NVLINK_L59_RX_PER_SEC = NVLINK_L59_RX_PER_SEC # backward-compat alias + NVLINK_L59_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L59_TX_PER_SEC, 'NvLink write bandwidth for link 59 in MiB/sec.') + GPM_METRIC_NVLINK_L59_TX_PER_SEC = NVLINK_L59_TX_PER_SEC # backward-compat alias + NVLINK_L60_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L60_RX_PER_SEC, 'NvLink read bandwidth for link 60 in MiB/sec.') + GPM_METRIC_NVLINK_L60_RX_PER_SEC = NVLINK_L60_RX_PER_SEC # backward-compat alias + NVLINK_L60_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L60_TX_PER_SEC, 'NvLink write bandwidth for link 60 in MiB/sec.') + GPM_METRIC_NVLINK_L60_TX_PER_SEC = NVLINK_L60_TX_PER_SEC # backward-compat alias + NVLINK_L61_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L61_RX_PER_SEC, 'NvLink read bandwidth for link 61 in MiB/sec.') + GPM_METRIC_NVLINK_L61_RX_PER_SEC = NVLINK_L61_RX_PER_SEC # backward-compat alias + NVLINK_L61_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L61_TX_PER_SEC, 'NvLink write bandwidth for link 61 in MiB/sec.') + GPM_METRIC_NVLINK_L61_TX_PER_SEC = NVLINK_L61_TX_PER_SEC # backward-compat alias + NVLINK_L62_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L62_RX_PER_SEC, 'NvLink read bandwidth for link 62 in MiB/sec.') + GPM_METRIC_NVLINK_L62_RX_PER_SEC = NVLINK_L62_RX_PER_SEC # backward-compat alias + NVLINK_L62_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L62_TX_PER_SEC, 'NvLink write bandwidth for link 62 in MiB/sec.') + GPM_METRIC_NVLINK_L62_TX_PER_SEC = NVLINK_L62_TX_PER_SEC # backward-compat alias + NVLINK_L63_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L63_RX_PER_SEC, 'NvLink read bandwidth for link 63 in MiB/sec.') + GPM_METRIC_NVLINK_L63_RX_PER_SEC = NVLINK_L63_RX_PER_SEC # backward-compat alias + NVLINK_L63_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L63_TX_PER_SEC, 'NvLink write bandwidth for link 63 in MiB/sec.') + GPM_METRIC_NVLINK_L63_TX_PER_SEC = NVLINK_L63_TX_PER_SEC # backward-compat alias + NVLINK_L64_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L64_RX_PER_SEC, 'NvLink read bandwidth for link 64 in MiB/sec.') + GPM_METRIC_NVLINK_L64_RX_PER_SEC = NVLINK_L64_RX_PER_SEC # backward-compat alias + NVLINK_L64_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L64_TX_PER_SEC, 'NvLink write bandwidth for link 64 in MiB/sec.') + GPM_METRIC_NVLINK_L64_TX_PER_SEC = NVLINK_L64_TX_PER_SEC # backward-compat alias + NVLINK_L65_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L65_RX_PER_SEC, 'NvLink read bandwidth for link 65 in MiB/sec.') + GPM_METRIC_NVLINK_L65_RX_PER_SEC = NVLINK_L65_RX_PER_SEC # backward-compat alias + NVLINK_L65_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L65_TX_PER_SEC, 'NvLink write bandwidth for link 65 in MiB/sec.') + GPM_METRIC_NVLINK_L65_TX_PER_SEC = NVLINK_L65_TX_PER_SEC # backward-compat alias + NVLINK_L66_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L66_RX_PER_SEC, 'NvLink read bandwidth for link 66 in MiB/sec.') + GPM_METRIC_NVLINK_L66_RX_PER_SEC = NVLINK_L66_RX_PER_SEC # backward-compat alias + NVLINK_L66_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L66_TX_PER_SEC, 'NvLink write bandwidth for link 66 in MiB/sec.') + GPM_METRIC_NVLINK_L66_TX_PER_SEC = NVLINK_L66_TX_PER_SEC # backward-compat alias + NVLINK_L67_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L67_RX_PER_SEC, 'NvLink read bandwidth for link 67 in MiB/sec.') + GPM_METRIC_NVLINK_L67_RX_PER_SEC = NVLINK_L67_RX_PER_SEC # backward-compat alias + NVLINK_L67_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L67_TX_PER_SEC, 'NvLink write bandwidth for link 67 in MiB/sec.') + GPM_METRIC_NVLINK_L67_TX_PER_SEC = NVLINK_L67_TX_PER_SEC # backward-compat alias + NVLINK_L68_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L68_RX_PER_SEC, 'NvLink read bandwidth for link 68 in MiB/sec.') + GPM_METRIC_NVLINK_L68_RX_PER_SEC = NVLINK_L68_RX_PER_SEC # backward-compat alias + NVLINK_L68_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L68_TX_PER_SEC, 'NvLink write bandwidth for link 68 in MiB/sec.') + GPM_METRIC_NVLINK_L68_TX_PER_SEC = NVLINK_L68_TX_PER_SEC # backward-compat alias + NVLINK_L69_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L69_RX_PER_SEC, 'NvLink read bandwidth for link 69 in MiB/sec.') + GPM_METRIC_NVLINK_L69_RX_PER_SEC = NVLINK_L69_RX_PER_SEC # backward-compat alias + NVLINK_L69_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L69_TX_PER_SEC, 'NvLink write bandwidth for link 69 in MiB/sec.') + GPM_METRIC_NVLINK_L69_TX_PER_SEC = NVLINK_L69_TX_PER_SEC # backward-compat alias + NVLINK_L70_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L70_RX_PER_SEC, 'NvLink read bandwidth for link 70 in MiB/sec.') + GPM_METRIC_NVLINK_L70_RX_PER_SEC = NVLINK_L70_RX_PER_SEC # backward-compat alias + NVLINK_L70_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L70_TX_PER_SEC, 'NvLink write bandwidth for link 70 in MiB/sec.') + GPM_METRIC_NVLINK_L70_TX_PER_SEC = NVLINK_L70_TX_PER_SEC # backward-compat alias + NVLINK_L71_RX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L71_RX_PER_SEC, 'NvLink read bandwidth for link 71 in MiB/sec.') + GPM_METRIC_NVLINK_L71_RX_PER_SEC = NVLINK_L71_RX_PER_SEC # backward-compat alias + NVLINK_L71_TX_PER_SEC = (NVML_GPM_METRIC_NVLINK_L71_TX_PER_SEC, 'NvLink write bandwidth for link 71 in MiB/sec.') + GPM_METRIC_NVLINK_L71_TX_PER_SEC = NVLINK_L71_TX_PER_SEC # backward-compat alias + MAX = (NVML_GPM_METRIC_MAX, 'Maximum value above +1.') + GPM_METRIC_MAX = MAX # backward-compat alias class PowerProfileType(_cyb_FastEnum): """ See `nvmlPowerProfileType_t`. """ - POWER_PROFILE_MAX_P = NVML_POWER_PROFILE_MAX_P - POWER_PROFILE_MAX_Q = NVML_POWER_PROFILE_MAX_Q - POWER_PROFILE_COMPUTE = NVML_POWER_PROFILE_COMPUTE - POWER_PROFILE_MEMORY_BOUND = NVML_POWER_PROFILE_MEMORY_BOUND - POWER_PROFILE_NETWORK = NVML_POWER_PROFILE_NETWORK - POWER_PROFILE_BALANCED = NVML_POWER_PROFILE_BALANCED - POWER_PROFILE_LLM_INFERENCE = NVML_POWER_PROFILE_LLM_INFERENCE - POWER_PROFILE_LLM_TRAINING = NVML_POWER_PROFILE_LLM_TRAINING - POWER_PROFILE_RBM = NVML_POWER_PROFILE_RBM - POWER_PROFILE_DCPCIE = NVML_POWER_PROFILE_DCPCIE - POWER_PROFILE_HMMA_SPARSE = NVML_POWER_PROFILE_HMMA_SPARSE - POWER_PROFILE_HMMA_DENSE = NVML_POWER_PROFILE_HMMA_DENSE - POWER_PROFILE_SYNC_BALANCED = NVML_POWER_PROFILE_SYNC_BALANCED - POWER_PROFILE_HPC = NVML_POWER_PROFILE_HPC - POWER_PROFILE_MIG = NVML_POWER_PROFILE_MIG - POWER_PROFILE_MAX_Q_1 = NVML_POWER_PROFILE_MAX_Q_1 - POWER_PROFILE_NETWORK_BOUND = NVML_POWER_PROFILE_NETWORK_BOUND - POWER_PROFILE_HIGH_THROUGHPUT_INFERENCE = NVML_POWER_PROFILE_HIGH_THROUGHPUT_INFERENCE - POWER_PROFILE_MEDIUM_THROUGHPUT_INFERENCE = NVML_POWER_PROFILE_MEDIUM_THROUGHPUT_INFERENCE - POWER_PROFILE_LOW_LATENCY_INFERENCE = NVML_POWER_PROFILE_LOW_LATENCY_INFERENCE - POWER_PROFILE_TRAINING = NVML_POWER_PROFILE_TRAINING - POWER_PROFILE_INFERENCE = NVML_POWER_PROFILE_INFERENCE - POWER_PROFILE_MAX_Q_2 = NVML_POWER_PROFILE_MAX_Q_2 - POWER_PROFILE_MAX_Q_3 = NVML_POWER_PROFILE_MAX_Q_3 - POWER_PROFILE_LOW_PRIORITY_BACKGROUND = NVML_POWER_PROFILE_LOW_PRIORITY_BACKGROUND - POWER_PROFILE_MAX = NVML_POWER_PROFILE_MAX + MAX_P = NVML_POWER_PROFILE_MAX_P + POWER_PROFILE_MAX_P = MAX_P # backward-compat alias + MAX_Q = NVML_POWER_PROFILE_MAX_Q + POWER_PROFILE_MAX_Q = MAX_Q # backward-compat alias + COMPUTE = NVML_POWER_PROFILE_COMPUTE + POWER_PROFILE_COMPUTE = COMPUTE # backward-compat alias + MEMORY_BOUND = NVML_POWER_PROFILE_MEMORY_BOUND + POWER_PROFILE_MEMORY_BOUND = MEMORY_BOUND # backward-compat alias + NETWORK = NVML_POWER_PROFILE_NETWORK + POWER_PROFILE_NETWORK = NETWORK # backward-compat alias + BALANCED = NVML_POWER_PROFILE_BALANCED + POWER_PROFILE_BALANCED = BALANCED # backward-compat alias + LLM_INFERENCE = NVML_POWER_PROFILE_LLM_INFERENCE + POWER_PROFILE_LLM_INFERENCE = LLM_INFERENCE # backward-compat alias + LLM_TRAINING = NVML_POWER_PROFILE_LLM_TRAINING + POWER_PROFILE_LLM_TRAINING = LLM_TRAINING # backward-compat alias + RBM = NVML_POWER_PROFILE_RBM + POWER_PROFILE_RBM = RBM # backward-compat alias + DCPCIE = NVML_POWER_PROFILE_DCPCIE + POWER_PROFILE_DCPCIE = DCPCIE # backward-compat alias + HMMA_SPARSE = NVML_POWER_PROFILE_HMMA_SPARSE + POWER_PROFILE_HMMA_SPARSE = HMMA_SPARSE # backward-compat alias + HMMA_DENSE = NVML_POWER_PROFILE_HMMA_DENSE + POWER_PROFILE_HMMA_DENSE = HMMA_DENSE # backward-compat alias + SYNC_BALANCED = NVML_POWER_PROFILE_SYNC_BALANCED + POWER_PROFILE_SYNC_BALANCED = SYNC_BALANCED # backward-compat alias + HPC = NVML_POWER_PROFILE_HPC + POWER_PROFILE_HPC = HPC # backward-compat alias + MIG = NVML_POWER_PROFILE_MIG + POWER_PROFILE_MIG = MIG # backward-compat alias + MAX_Q_1 = NVML_POWER_PROFILE_MAX_Q_1 + POWER_PROFILE_MAX_Q_1 = MAX_Q_1 # backward-compat alias + NETWORK_BOUND = NVML_POWER_PROFILE_NETWORK_BOUND + POWER_PROFILE_NETWORK_BOUND = NETWORK_BOUND # backward-compat alias + HIGH_THROUGHPUT_INFERENCE = NVML_POWER_PROFILE_HIGH_THROUGHPUT_INFERENCE + POWER_PROFILE_HIGH_THROUGHPUT_INFERENCE = HIGH_THROUGHPUT_INFERENCE # backward-compat alias + MEDIUM_THROUGHPUT_INFERENCE = NVML_POWER_PROFILE_MEDIUM_THROUGHPUT_INFERENCE + POWER_PROFILE_MEDIUM_THROUGHPUT_INFERENCE = MEDIUM_THROUGHPUT_INFERENCE # backward-compat alias + LOW_LATENCY_INFERENCE = NVML_POWER_PROFILE_LOW_LATENCY_INFERENCE + POWER_PROFILE_LOW_LATENCY_INFERENCE = LOW_LATENCY_INFERENCE # backward-compat alias + TRAINING = NVML_POWER_PROFILE_TRAINING + POWER_PROFILE_TRAINING = TRAINING # backward-compat alias + INFERENCE = NVML_POWER_PROFILE_INFERENCE + POWER_PROFILE_INFERENCE = INFERENCE # backward-compat alias + MAX_Q_2 = NVML_POWER_PROFILE_MAX_Q_2 + POWER_PROFILE_MAX_Q_2 = MAX_Q_2 # backward-compat alias + MAX_Q_3 = NVML_POWER_PROFILE_MAX_Q_3 + POWER_PROFILE_MAX_Q_3 = MAX_Q_3 # backward-compat alias + LOW_PRIORITY_BACKGROUND = NVML_POWER_PROFILE_LOW_PRIORITY_BACKGROUND + POWER_PROFILE_LOW_PRIORITY_BACKGROUND = LOW_PRIORITY_BACKGROUND # backward-compat alias + MAX = NVML_POWER_PROFILE_MAX + POWER_PROFILE_MAX = MAX # backward-compat alias class DeviceAddressingModeType(_cyb_FastEnum): """ @@ -1324,9 +1999,12 @@ class DeviceAddressingModeType(_cyb_FastEnum): See `nvmlDeviceAddressingModeType_t`. """ - DEVICE_ADDRESSING_MODE_NONE = (NVML_DEVICE_ADDRESSING_MODE_NONE, 'No active mode.') - DEVICE_ADDRESSING_MODE_HMM = (NVML_DEVICE_ADDRESSING_MODE_HMM, 'Heterogeneous Memory Management mode.') - DEVICE_ADDRESSING_MODE_ATS = (NVML_DEVICE_ADDRESSING_MODE_ATS, 'Address Translation Services mode.') + NONE = (NVML_DEVICE_ADDRESSING_MODE_NONE, 'No active mode.') + DEVICE_ADDRESSING_MODE_NONE = NONE # backward-compat alias + HMM = (NVML_DEVICE_ADDRESSING_MODE_HMM, 'Heterogeneous Memory Management mode.') + DEVICE_ADDRESSING_MODE_HMM = HMM # backward-compat alias + ATS = (NVML_DEVICE_ADDRESSING_MODE_ATS, 'Address Translation Services mode.') + DEVICE_ADDRESSING_MODE_ATS = ATS # backward-compat alias class PRMCounterId(_cyb_FastEnum): """ @@ -1435,7 +2113,8 @@ class EventDataType(_cyb_FastEnum): See `nvmlEventDataType_t`. """ - EVENT = (NVML_EVENT_DATA_TYPE_NVML_EVENT, 'NVML event-bit data. `eventType` contains an NVML event bit.') + NVML_EVENT = (NVML_EVENT_DATA_TYPE_NVML_EVENT, 'NVML event-bit data. `eventType` contains an NVML event bit.') + EVENT = NVML_EVENT # backward-compat alias GPU_OPERATIONAL_EVENT = (NVML_EVENT_DATA_TYPE_GPU_OPERATIONAL_EVENT, 'Structured GPU Operational Event data.') class GpuOperationalEventContextType(_cyb_FastEnum): @@ -2440,26 +3119,16 @@ cdef class PciInfoExt_v1: .. seealso:: `nvmlPciInfoExt_v1_t` """ cdef: + nvmlPciInfoExt_v1_t _data nvmlPciInfoExt_v1_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlPciInfoExt_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating PciInfoExt_v1") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlPciInfoExt_v1_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.PciInfoExt_v1 object at {hex(id(self))}>" @@ -2488,14 +3157,22 @@ cdef class PciInfoExt_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlPciInfoExt_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating PciInfoExt_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlPciInfoExt_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This PciInfoExt_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlPciInfoExt_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlPciInfoExt_v1_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlPciInfoExt_v1_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -2629,16 +3306,12 @@ cdef class PciInfoExt_v1: raise ValueError("ptr must not be null (0)") cdef PciInfoExt_v1 obj = PciInfoExt_v1.__new__(PciInfoExt_v1) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlPciInfoExt_v1_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating PciInfoExt_v1") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlPciInfoExt_v1_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlPciInfoExt_v1_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -2671,20 +3344,20 @@ cdef class PciInfo: cdef: nvmlPciInfo_t *_ptr object _owner - bint _owned + bint _owns_ptr bint _readonly def __init__(self): self._ptr = _cyb_calloc(1, sizeof(nvmlPciInfo_t)) if self._ptr == NULL: raise MemoryError("Error allocating PciInfo") + self._owns_ptr = True self._owner = None - self._owned = True self._readonly = False def __dealloc__(self): cdef nvmlPciInfo_t *ptr - if self._owned and self._ptr != NULL: + if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) @@ -2717,14 +3390,20 @@ cdef class PciInfo: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlPciInfo_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating PciInfo") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlPciInfo_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This PciInfo instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlPciInfo_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlPciInfo_t), view.len) + ) + _cyb_memmove(self._ptr, view.buf, sizeof(nvmlPciInfo_t)) + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -2844,12 +3523,12 @@ cdef class PciInfo: if obj._ptr == NULL: raise MemoryError("Error allocating PciInfo") _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlPciInfo_t)) + obj._owns_ptr = True obj._owner = None - obj._owned = True else: obj._ptr = ptr + obj._owns_ptr = False obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -2875,26 +3554,16 @@ cdef class Utilization: .. seealso:: `nvmlUtilization_t` """ cdef: + nvmlUtilization_t _data nvmlUtilization_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlUtilization_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating Utilization") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlUtilization_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.Utilization object at {hex(id(self))}>" @@ -2923,14 +3592,22 @@ cdef class Utilization: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlUtilization_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating Utilization") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlUtilization_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This Utilization instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlUtilization_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlUtilization_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlUtilization_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -2983,16 +3660,12 @@ cdef class Utilization: raise ValueError("ptr must not be null (0)") cdef Utilization obj = Utilization.__new__(Utilization) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlUtilization_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating Utilization") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlUtilization_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlUtilization_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -3019,26 +3692,16 @@ cdef class Memory: .. seealso:: `nvmlMemory_t` """ cdef: + nvmlMemory_t _data nvmlMemory_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlMemory_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating Memory") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlMemory_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.Memory object at {hex(id(self))}>" @@ -3067,14 +3730,22 @@ cdef class Memory: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlMemory_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating Memory") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlMemory_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This Memory instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlMemory_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlMemory_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlMemory_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -3138,16 +3809,12 @@ cdef class Memory: raise ValueError("ptr must not be null (0)") cdef Memory obj = Memory.__new__(Memory) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlMemory_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating Memory") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlMemory_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlMemory_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -3176,26 +3843,16 @@ cdef class Memory_v2: .. seealso:: `nvmlMemory_v2_t` """ cdef: + nvmlMemory_v2_t _data nvmlMemory_v2_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlMemory_v2_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating Memory_v2") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlMemory_v2_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.Memory_v2 object at {hex(id(self))}>" @@ -3224,14 +3881,22 @@ cdef class Memory_v2: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlMemory_v2_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating Memory_v2") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlMemory_v2_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This Memory_v2 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlMemory_v2_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlMemory_v2_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlMemory_v2_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -3317,16 +3982,12 @@ cdef class Memory_v2: raise ValueError("ptr must not be null (0)") cdef Memory_v2 obj = Memory_v2.__new__(Memory_v2) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlMemory_v2_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating Memory_v2") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlMemory_v2_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlMemory_v2_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -3353,26 +4014,16 @@ cdef class BAR1Memory: .. seealso:: `nvmlBAR1Memory_t` """ cdef: + nvmlBAR1Memory_t _data nvmlBAR1Memory_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlBAR1Memory_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating BAR1Memory") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlBAR1Memory_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.BAR1Memory object at {hex(id(self))}>" @@ -3401,14 +4052,22 @@ cdef class BAR1Memory: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlBAR1Memory_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating BAR1Memory") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlBAR1Memory_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This BAR1Memory instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlBAR1Memory_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlBAR1Memory_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlBAR1Memory_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -3472,16 +4131,12 @@ cdef class BAR1Memory: raise ValueError("ptr must not be null (0)") cdef BAR1Memory obj = BAR1Memory.__new__(BAR1Memory) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlBAR1Memory_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating BAR1Memory") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlBAR1Memory_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlBAR1Memory_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -3537,9 +4192,10 @@ cdef class ProcessInfo: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -3719,9 +4375,10 @@ cdef class ProcessDetail_v1: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -3888,26 +4545,16 @@ cdef class DeviceAttributes: .. seealso:: `nvmlDeviceAttributes_t` """ cdef: + nvmlDeviceAttributes_t _data nvmlDeviceAttributes_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlDeviceAttributes_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating DeviceAttributes") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlDeviceAttributes_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.DeviceAttributes object at {hex(id(self))}>" @@ -3936,14 +4583,22 @@ cdef class DeviceAttributes: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlDeviceAttributes_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating DeviceAttributes") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlDeviceAttributes_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This DeviceAttributes instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlDeviceAttributes_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlDeviceAttributes_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlDeviceAttributes_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -4073,16 +4728,12 @@ cdef class DeviceAttributes: raise ValueError("ptr must not be null (0)") cdef DeviceAttributes obj = DeviceAttributes.__new__(DeviceAttributes) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlDeviceAttributes_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating DeviceAttributes") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlDeviceAttributes_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlDeviceAttributes_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -4107,26 +4758,16 @@ cdef class C2cModeInfo_v1: .. seealso:: `nvmlC2cModeInfo_v1_t` """ cdef: + nvmlC2cModeInfo_v1_t _data nvmlC2cModeInfo_v1_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlC2cModeInfo_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating C2cModeInfo_v1") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlC2cModeInfo_v1_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.C2cModeInfo_v1 object at {hex(id(self))}>" @@ -4155,14 +4796,22 @@ cdef class C2cModeInfo_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlC2cModeInfo_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating C2cModeInfo_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlC2cModeInfo_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This C2cModeInfo_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlC2cModeInfo_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlC2cModeInfo_v1_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlC2cModeInfo_v1_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -4204,16 +4853,12 @@ cdef class C2cModeInfo_v1: raise ValueError("ptr must not be null (0)") cdef C2cModeInfo_v1 obj = C2cModeInfo_v1.__new__(C2cModeInfo_v1) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlC2cModeInfo_v1_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating C2cModeInfo_v1") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlC2cModeInfo_v1_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlC2cModeInfo_v1_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -4242,26 +4887,16 @@ cdef class RowRemapperHistogramValues: .. seealso:: `nvmlRowRemapperHistogramValues_t` """ cdef: + nvmlRowRemapperHistogramValues_t _data nvmlRowRemapperHistogramValues_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlRowRemapperHistogramValues_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating RowRemapperHistogramValues") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlRowRemapperHistogramValues_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.RowRemapperHistogramValues object at {hex(id(self))}>" @@ -4290,14 +4925,22 @@ cdef class RowRemapperHistogramValues: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlRowRemapperHistogramValues_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating RowRemapperHistogramValues") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlRowRemapperHistogramValues_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This RowRemapperHistogramValues instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlRowRemapperHistogramValues_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlRowRemapperHistogramValues_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlRowRemapperHistogramValues_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -4383,16 +5026,12 @@ cdef class RowRemapperHistogramValues: raise ValueError("ptr must not be null (0)") cdef RowRemapperHistogramValues obj = RowRemapperHistogramValues.__new__(RowRemapperHistogramValues) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlRowRemapperHistogramValues_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating RowRemapperHistogramValues") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlRowRemapperHistogramValues_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlRowRemapperHistogramValues_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -4446,9 +5085,10 @@ cdef class BridgeChipInfo: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -4582,20 +5222,20 @@ cdef class Value: cdef: nvmlValue_t *_ptr object _owner - bint _owned + bint _owns_ptr bint _readonly def __init__(self): self._ptr = _cyb_calloc(1, sizeof(nvmlValue_t)) if self._ptr == NULL: raise MemoryError("Error allocating Value") + self._owns_ptr = True self._owner = None - self._owned = True self._readonly = False def __dealloc__(self): cdef nvmlValue_t *ptr - if self._owned and self._ptr != NULL: + if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) @@ -4628,14 +5268,20 @@ cdef class Value: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlValue_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating Value") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlValue_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This Value instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlValue_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlValue_t), view.len) + ) + _cyb_memmove(self._ptr, view.buf, sizeof(nvmlValue_t)) + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -4747,12 +5393,12 @@ cdef class Value: if obj._ptr == NULL: raise MemoryError("Error allocating Value") _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlValue_t)) + obj._owns_ptr = True obj._owner = None - obj._owned = True else: obj._ptr = ptr + obj._owns_ptr = False obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -4809,9 +5455,10 @@ cdef class _py_anon_pod0: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -4973,26 +5620,16 @@ cdef class CoolerInfo_v1: .. seealso:: `nvmlCoolerInfo_v1_t` """ cdef: + nvmlCoolerInfo_v1_t _data nvmlCoolerInfo_v1_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlCoolerInfo_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating CoolerInfo_v1") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlCoolerInfo_v1_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.CoolerInfo_v1 object at {hex(id(self))}>" @@ -5021,14 +5658,22 @@ cdef class CoolerInfo_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlCoolerInfo_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating CoolerInfo_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlCoolerInfo_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This CoolerInfo_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlCoolerInfo_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlCoolerInfo_v1_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlCoolerInfo_v1_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -5103,16 +5748,12 @@ cdef class CoolerInfo_v1: raise ValueError("ptr must not be null (0)") cdef CoolerInfo_v1 obj = CoolerInfo_v1.__new__(CoolerInfo_v1) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlCoolerInfo_v1_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating CoolerInfo_v1") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlCoolerInfo_v1_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlCoolerInfo_v1_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -5166,9 +5807,10 @@ cdef class ClkMonFaultInfo: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -5299,26 +5941,16 @@ cdef class ClockOffset_v1: .. seealso:: `nvmlClockOffset_v1_t` """ cdef: + nvmlClockOffset_v1_t _data nvmlClockOffset_v1_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlClockOffset_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating ClockOffset_v1") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlClockOffset_v1_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.ClockOffset_v1 object at {hex(id(self))}>" @@ -5347,14 +5979,22 @@ cdef class ClockOffset_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlClockOffset_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating ClockOffset_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlClockOffset_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This ClockOffset_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlClockOffset_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlClockOffset_v1_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlClockOffset_v1_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -5451,16 +6091,12 @@ cdef class ClockOffset_v1: raise ValueError("ptr must not be null (0)") cdef ClockOffset_v1 obj = ClockOffset_v1.__new__(ClockOffset_v1) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlClockOffset_v1_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating ClockOffset_v1") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlClockOffset_v1_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlClockOffset_v1_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -5518,9 +6154,10 @@ cdef class ProcessUtilizationSample: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -5725,9 +6362,10 @@ cdef class ProcessUtilizationInfo_v1: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -5931,26 +6569,16 @@ cdef class EccSramErrorStatus_v1: .. seealso:: `nvmlEccSramErrorStatus_v1_t` """ cdef: + nvmlEccSramErrorStatus_v1_t _data nvmlEccSramErrorStatus_v1_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlEccSramErrorStatus_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating EccSramErrorStatus_v1") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlEccSramErrorStatus_v1_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.EccSramErrorStatus_v1 object at {hex(id(self))}>" @@ -5979,14 +6607,22 @@ cdef class EccSramErrorStatus_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlEccSramErrorStatus_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating EccSramErrorStatus_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlEccSramErrorStatus_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This EccSramErrorStatus_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlEccSramErrorStatus_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlEccSramErrorStatus_v1_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlEccSramErrorStatus_v1_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -6160,16 +6796,12 @@ cdef class EccSramErrorStatus_v1: raise ValueError("ptr must not be null (0)") cdef EccSramErrorStatus_v1 obj = EccSramErrorStatus_v1.__new__(EccSramErrorStatus_v1) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlEccSramErrorStatus_v1_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating EccSramErrorStatus_v1") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlEccSramErrorStatus_v1_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlEccSramErrorStatus_v1_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -6201,26 +6833,16 @@ cdef class PlatformInfo_v1: .. seealso:: `nvmlPlatformInfo_v1_t` """ cdef: + nvmlPlatformInfo_v1_t _data nvmlPlatformInfo_v1_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlPlatformInfo_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating PlatformInfo_v1") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlPlatformInfo_v1_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.PlatformInfo_v1 object at {hex(id(self))}>" @@ -6249,14 +6871,22 @@ cdef class PlatformInfo_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlPlatformInfo_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating PlatformInfo_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlPlatformInfo_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This PlatformInfo_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlPlatformInfo_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlPlatformInfo_v1_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlPlatformInfo_v1_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -6387,16 +7017,12 @@ cdef class PlatformInfo_v1: raise ValueError("ptr must not be null (0)") cdef PlatformInfo_v1 obj = PlatformInfo_v1.__new__(PlatformInfo_v1) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlPlatformInfo_v1_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating PlatformInfo_v1") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlPlatformInfo_v1_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlPlatformInfo_v1_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -6428,26 +7054,16 @@ cdef class PlatformInfo_v2: .. seealso:: `nvmlPlatformInfo_v2_t` """ cdef: + nvmlPlatformInfo_v2_t _data nvmlPlatformInfo_v2_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlPlatformInfo_v2_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating PlatformInfo_v2") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlPlatformInfo_v2_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.PlatformInfo_v2 object at {hex(id(self))}>" @@ -6476,14 +7092,22 @@ cdef class PlatformInfo_v2: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlPlatformInfo_v2_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating PlatformInfo_v2") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlPlatformInfo_v2_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This PlatformInfo_v2 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlPlatformInfo_v2_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlPlatformInfo_v2_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlPlatformInfo_v2_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -6614,16 +7238,12 @@ cdef class PlatformInfo_v2: raise ValueError("ptr must not be null (0)") cdef PlatformInfo_v2 obj = PlatformInfo_v2.__new__(PlatformInfo_v2) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlPlatformInfo_v2_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating PlatformInfo_v2") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlPlatformInfo_v2_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlPlatformInfo_v2_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -6679,9 +7299,10 @@ cdef class _py_anon_pod1: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -6833,28 +7454,18 @@ cdef class VgpuPlacementList_v2: .. seealso:: `nvmlVgpuPlacementList_v2_t` """ cdef: + nvmlVgpuPlacementList_v2_t _data nvmlVgpuPlacementList_v2_t *_ptr object _owner - bint _owned bint _readonly dict _refs def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuPlacementList_v2_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuPlacementList_v2") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False self._refs = {} - def __dealloc__(self): - cdef nvmlVgpuPlacementList_v2_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.VgpuPlacementList_v2 object at {hex(id(self))}>" @@ -6883,14 +7494,22 @@ cdef class VgpuPlacementList_v2: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlVgpuPlacementList_v2_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuPlacementList_v2") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuPlacementList_v2_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This VgpuPlacementList_v2 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlVgpuPlacementList_v2_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlVgpuPlacementList_v2_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlVgpuPlacementList_v2_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -6973,16 +7592,12 @@ cdef class VgpuPlacementList_v2: raise ValueError("ptr must not be null (0)") cdef VgpuPlacementList_v2 obj = VgpuPlacementList_v2.__new__(VgpuPlacementList_v2) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlVgpuPlacementList_v2_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating VgpuPlacementList_v2") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuPlacementList_v2_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlVgpuPlacementList_v2_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly obj._refs = {} return obj @@ -7009,26 +7624,16 @@ cdef class VgpuTypeBar1Info_v1: .. seealso:: `nvmlVgpuTypeBar1Info_v1_t` """ cdef: + nvmlVgpuTypeBar1Info_v1_t _data nvmlVgpuTypeBar1Info_v1_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuTypeBar1Info_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuTypeBar1Info_v1") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlVgpuTypeBar1Info_v1_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.VgpuTypeBar1Info_v1 object at {hex(id(self))}>" @@ -7057,14 +7662,22 @@ cdef class VgpuTypeBar1Info_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlVgpuTypeBar1Info_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuTypeBar1Info_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuTypeBar1Info_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This VgpuTypeBar1Info_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlVgpuTypeBar1Info_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlVgpuTypeBar1Info_v1_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlVgpuTypeBar1Info_v1_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -7117,67 +7730,61 @@ cdef class VgpuTypeBar1Info_v1: raise ValueError("ptr must not be null (0)") cdef VgpuTypeBar1Info_v1 obj = VgpuTypeBar1Info_v1.__new__(VgpuTypeBar1Info_v1) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlVgpuTypeBar1Info_v1_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating VgpuTypeBar1Info_v1") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuTypeBar1Info_v1_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlVgpuTypeBar1Info_v1_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj -cdef _get_vgpu_process_utilization_info_v1_dtype_offsets(): - cdef nvmlVgpuProcessUtilizationInfo_v1_t pod +cdef _get_vgpu_process_utilization_sample_dtype_offsets(): + cdef nvmlVgpuProcessUtilizationSample_t pod return _numpy.dtype({ - 'names': ['process_name', 'time_stamp', 'vgpu_instance', 'pid', 'sm_util', 'mem_util', 'enc_util', 'dec_util', 'jpg_util', 'ofa_util'], - 'formats': [(_numpy.int8, 64), _numpy.uint64, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32], + 'names': ['vgpu_instance', 'pid', 'process_name', 'time_stamp', 'sm_util', 'mem_util', 'enc_util', 'dec_util'], + 'formats': [_numpy.uint32, _numpy.uint32, (_numpy.int8, 64), _numpy.uint64, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32], 'offsets': [ - (&(pod.processName)) - (&pod), - (&(pod.timeStamp)) - (&pod), (&(pod.vgpuInstance)) - (&pod), (&(pod.pid)) - (&pod), + (&(pod.processName)) - (&pod), + (&(pod.timeStamp)) - (&pod), (&(pod.smUtil)) - (&pod), (&(pod.memUtil)) - (&pod), (&(pod.encUtil)) - (&pod), (&(pod.decUtil)) - (&pod), - (&(pod.jpgUtil)) - (&pod), - (&(pod.ofaUtil)) - (&pod), ], - 'itemsize': sizeof(nvmlVgpuProcessUtilizationInfo_v1_t), + 'itemsize': sizeof(nvmlVgpuProcessUtilizationSample_t), }) -vgpu_process_utilization_info_v1_dtype = _get_vgpu_process_utilization_info_v1_dtype_offsets() +vgpu_process_utilization_sample_dtype = _get_vgpu_process_utilization_sample_dtype_offsets() -cdef class VgpuProcessUtilizationInfo_v1: - """Empty-initialize an array of `nvmlVgpuProcessUtilizationInfo_v1_t`. - The resulting object is of length `size` and of dtype `vgpu_process_utilization_info_v1_dtype`. +cdef class VgpuProcessUtilizationSample: + """Empty-initialize an array of `nvmlVgpuProcessUtilizationSample_t`. + The resulting object is of length `size` and of dtype `vgpu_process_utilization_sample_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. - .. seealso:: `nvmlVgpuProcessUtilizationInfo_v1_t` + .. seealso:: `nvmlVgpuProcessUtilizationSample_t` """ cdef: readonly object _data object _owner def __init__(self, size=1): - arr = _numpy.empty(size, dtype=vgpu_process_utilization_info_v1_dtype) + arr = _numpy.empty(size, dtype=vgpu_process_utilization_sample_dtype) self._data = arr.view(_numpy.recarray) - assert self._data.itemsize == sizeof(nvmlVgpuProcessUtilizationInfo_v1_t), \ - f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlVgpuProcessUtilizationInfo_v1_t) }" + assert self._data.itemsize == sizeof(nvmlVgpuProcessUtilizationSample_t), \ + f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlVgpuProcessUtilizationSample_t) }" def __repr__(self): if self._data.size > 1: - return f"<{__name__}.VgpuProcessUtilizationInfo_v1_Array_{self._data.size} object at {hex(id(self))}>" + return f"<{__name__}.VgpuProcessUtilizationSample_Array_{self._data.size} object at {hex(id(self))}>" else: - return f"<{__name__}.VgpuProcessUtilizationInfo_v1 object at {hex(id(self))}>" + return f"<{__name__}.VgpuProcessUtilizationSample object at {hex(id(self))}>" @property def ptr(self): @@ -7188,9 +7795,10 @@ cdef class VgpuProcessUtilizationInfo_v1: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -7198,7 +7806,7 @@ cdef class VgpuProcessUtilizationInfo_v1: def __eq__(self, other): cdef object self_data = self._data - if (not isinstance(other, VgpuProcessUtilizationInfo_v1)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + if (not isinstance(other, VgpuProcessUtilizationSample)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: return False return bool((self_data == other._data).all()) @@ -7208,29 +7816,9 @@ cdef class VgpuProcessUtilizationInfo_v1: def __releasebuffer__(self, Py_buffer *buffer): _cyb_cpython.PyBuffer_Release(buffer) - @property - def process_name(self): - """~_numpy.int8: (array of length 64).Name of process running within the vGPU VM.""" - return self._data.process_name - - @process_name.setter - def process_name(self, val): - self._data.process_name = val - - @property - def time_stamp(self): - """Union[~_numpy.uint64, int]: CPU Timestamp in microseconds.""" - if self._data.size == 1: - return int(self._data.time_stamp[0]) - return self._data.time_stamp - - @time_stamp.setter - def time_stamp(self, val): - self._data.time_stamp = val - @property def vgpu_instance(self): - """Union[~_numpy.uint32, int]: vGPU Instance""" + """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data.vgpu_instance[0]) return self._data.vgpu_instance @@ -7241,7 +7829,7 @@ cdef class VgpuProcessUtilizationInfo_v1: @property def pid(self): - """Union[~_numpy.uint32, int]: PID of process running within the vGPU VM.""" + """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data.pid[0]) return self._data.pid @@ -7250,9 +7838,29 @@ cdef class VgpuProcessUtilizationInfo_v1: def pid(self, val): self._data.pid = val + @property + def process_name(self): + """~_numpy.int8: (array of length 64).""" + return self._data.process_name + + @process_name.setter + def process_name(self, val): + self._data.process_name = val + + @property + def time_stamp(self): + """Union[~_numpy.uint64, int]: """ + if self._data.size == 1: + return int(self._data.time_stamp[0]) + return self._data.time_stamp + + @time_stamp.setter + def time_stamp(self, val): + self._data.time_stamp = val + @property def sm_util(self): - """Union[~_numpy.uint32, int]: SM (3D/Compute) Util Value.""" + """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data.sm_util[0]) return self._data.sm_util @@ -7263,7 +7871,7 @@ cdef class VgpuProcessUtilizationInfo_v1: @property def mem_util(self): - """Union[~_numpy.uint32, int]: Frame Buffer Memory Util Value.""" + """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data.mem_util[0]) return self._data.mem_util @@ -7274,7 +7882,7 @@ cdef class VgpuProcessUtilizationInfo_v1: @property def enc_util(self): - """Union[~_numpy.uint32, int]: Encoder Util Value.""" + """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data.enc_util[0]) return self._data.enc_util @@ -7285,7 +7893,7 @@ cdef class VgpuProcessUtilizationInfo_v1: @property def dec_util(self): - """Union[~_numpy.uint32, int]: Decoder Util Value.""" + """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data.dec_util[0]) return self._data.dec_util @@ -7294,28 +7902,6 @@ cdef class VgpuProcessUtilizationInfo_v1: def dec_util(self, val): self._data.dec_util = val - @property - def jpg_util(self): - """Union[~_numpy.uint32, int]: Jpeg Util Value.""" - if self._data.size == 1: - return int(self._data.jpg_util[0]) - return self._data.jpg_util - - @jpg_util.setter - def jpg_util(self, val): - self._data.jpg_util = val - - @property - def ofa_util(self): - """Union[~_numpy.uint32, int]: Ofa Util Value.""" - if self._data.size == 1: - return int(self._data.ofa_util[0]) - return self._data.ofa_util - - @ofa_util.setter - def ofa_util(self, val): - self._data.ofa_util = val - def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size @@ -7326,10 +7912,10 @@ cdef class VgpuProcessUtilizationInfo_v1: raise IndexError("index is out of bounds") if key_ < 0: key_ += size - return VgpuProcessUtilizationInfo_v1.from_data(self._data[key_:key_+1]) + return VgpuProcessUtilizationSample.from_data(self._data[key_:key_+1]) out = self._data[key] - if isinstance(out, _numpy.recarray) and out.dtype == vgpu_process_utilization_info_v1_dtype: - return VgpuProcessUtilizationInfo_v1.from_data(out) + if isinstance(out, _numpy.recarray) and out.dtype == vgpu_process_utilization_sample_dtype: + return VgpuProcessUtilizationSample.from_data(out) return out def __setitem__(self, key, val): @@ -7337,30 +7923,30 @@ cdef class VgpuProcessUtilizationInfo_v1: @staticmethod def from_buffer(buffer): - """Create an VgpuProcessUtilizationInfo_v1 instance with the memory from the given buffer.""" - return VgpuProcessUtilizationInfo_v1.from_data(_numpy.frombuffer(buffer, dtype=vgpu_process_utilization_info_v1_dtype)) + """Create an VgpuProcessUtilizationSample instance with the memory from the given buffer.""" + return VgpuProcessUtilizationSample.from_data(_numpy.frombuffer(buffer, dtype=vgpu_process_utilization_sample_dtype)) @staticmethod def from_data(data): - """Create an VgpuProcessUtilizationInfo_v1 instance wrapping the given NumPy array. + """Create an VgpuProcessUtilizationSample instance wrapping the given NumPy array. Args: - data (_numpy.ndarray): a 1D array of dtype `vgpu_process_utilization_info_v1_dtype` holding the data. + data (_numpy.ndarray): a 1D array of dtype `vgpu_process_utilization_sample_dtype` holding the data. """ - cdef VgpuProcessUtilizationInfo_v1 obj = VgpuProcessUtilizationInfo_v1.__new__(VgpuProcessUtilizationInfo_v1) + cdef VgpuProcessUtilizationSample obj = VgpuProcessUtilizationSample.__new__(VgpuProcessUtilizationSample) if not isinstance(data, _numpy.ndarray): raise TypeError("data argument must be a NumPy ndarray") if data.ndim != 1: raise ValueError("data array must be 1D") - if data.dtype != vgpu_process_utilization_info_v1_dtype: - raise ValueError("data array must be of dtype vgpu_process_utilization_info_v1_dtype") + if data.dtype != vgpu_process_utilization_sample_dtype: + raise ValueError("data array must be of dtype vgpu_process_utilization_sample_dtype") obj._data = data.view(_numpy.recarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): - """Create an VgpuProcessUtilizationInfo_v1 instance wrapping the given pointer. + """Create an VgpuProcessUtilizationSample instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. @@ -7371,33 +7957,285 @@ cdef class VgpuProcessUtilizationInfo_v1: """ if ptr == 0: raise ValueError("ptr must not be null (0)") - cdef VgpuProcessUtilizationInfo_v1 obj = VgpuProcessUtilizationInfo_v1.__new__(VgpuProcessUtilizationInfo_v1) + cdef VgpuProcessUtilizationSample obj = VgpuProcessUtilizationSample.__new__(VgpuProcessUtilizationSample) cdef flag = _cyb_cpython_buffer.PyBUF_READ if readonly else _cyb_cpython_buffer.PyBUF_WRITE cdef object buf = _cyb_cpython_memoryview.PyMemoryView_FromMemory( - ptr, sizeof(nvmlVgpuProcessUtilizationInfo_v1_t) * size, flag) - data = _numpy.ndarray(size, buffer=buf, dtype=vgpu_process_utilization_info_v1_dtype) + ptr, sizeof(nvmlVgpuProcessUtilizationSample_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=vgpu_process_utilization_sample_dtype) obj._data = data.view(_numpy.recarray) obj._owner = owner return obj -cdef _get__py_anon_pod2_dtype_offsets(): - cdef cuda_bindings_nvml__anon_pod2 pod +cdef _get_vgpu_process_utilization_info_v1_dtype_offsets(): + cdef nvmlVgpuProcessUtilizationInfo_v1_t pod return _numpy.dtype({ - 'names': ['avg_factor', 'timeslice'], - 'formats': [_numpy.uint32, _numpy.uint32], + 'names': ['process_name', 'time_stamp', 'vgpu_instance', 'pid', 'sm_util', 'mem_util', 'enc_util', 'dec_util', 'jpg_util', 'ofa_util'], + 'formats': [(_numpy.int8, 64), _numpy.uint64, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32], 'offsets': [ - (&(pod.avgFactor)) - (&pod), - (&(pod.timeslice)) - (&pod), + (&(pod.processName)) - (&pod), + (&(pod.timeStamp)) - (&pod), + (&(pod.vgpuInstance)) - (&pod), + (&(pod.pid)) - (&pod), + (&(pod.smUtil)) - (&pod), + (&(pod.memUtil)) - (&pod), + (&(pod.encUtil)) - (&pod), + (&(pod.decUtil)) - (&pod), + (&(pod.jpgUtil)) - (&pod), + (&(pod.ofaUtil)) - (&pod), ], - 'itemsize': sizeof(cuda_bindings_nvml__anon_pod2), + 'itemsize': sizeof(nvmlVgpuProcessUtilizationInfo_v1_t), }) -_py_anon_pod2_dtype = _get__py_anon_pod2_dtype_offsets() +vgpu_process_utilization_info_v1_dtype = _get_vgpu_process_utilization_info_v1_dtype_offsets() -cdef class _py_anon_pod2: - """Empty-initialize an instance of `cuda_bindings_nvml__anon_pod2`. +cdef class VgpuProcessUtilizationInfo_v1: + """Empty-initialize an array of `nvmlVgpuProcessUtilizationInfo_v1_t`. + The resulting object is of length `size` and of dtype `vgpu_process_utilization_info_v1_dtype`. + If default-constructed, the instance represents a single struct. + + Args: + size (int): number of structs, default=1. + + .. seealso:: `nvmlVgpuProcessUtilizationInfo_v1_t` + """ + cdef: + readonly object _data + object _owner + + def __init__(self, size=1): + arr = _numpy.empty(size, dtype=vgpu_process_utilization_info_v1_dtype) + self._data = arr.view(_numpy.recarray) + assert self._data.itemsize == sizeof(nvmlVgpuProcessUtilizationInfo_v1_t), \ + f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlVgpuProcessUtilizationInfo_v1_t) }" + + def __repr__(self): + if self._data.size > 1: + return f"<{__name__}.VgpuProcessUtilizationInfo_v1_Array_{self._data.size} object at {hex(id(self))}>" + else: + return f"<{__name__}.VgpuProcessUtilizationInfo_v1 object at {hex(id(self))}>" + + @property + def ptr(self): + """Get the pointer address to the data as Python :class:`int`.""" + return self._data.ctypes.data + + cdef intptr_t _get_ptr(self): + return self._data.ctypes.data + + def __int__(self): + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") + return self._data.ctypes.data + + def __len__(self): + return self._data.size + + def __eq__(self, other): + cdef object self_data = self._data + if (not isinstance(other, VgpuProcessUtilizationInfo_v1)) or self_data.size != other._data.size or self_data.dtype != other._data.dtype: + return False + return bool((self_data == other._data).all()) + + def __getbuffer__(self, Py_buffer *buffer, int flags): + _cyb_cpython.PyObject_GetBuffer(self._data, buffer, flags) + + def __releasebuffer__(self, Py_buffer *buffer): + _cyb_cpython.PyBuffer_Release(buffer) + + @property + def process_name(self): + """~_numpy.int8: (array of length 64).Name of process running within the vGPU VM.""" + return self._data.process_name + + @process_name.setter + def process_name(self, val): + self._data.process_name = val + + @property + def time_stamp(self): + """Union[~_numpy.uint64, int]: CPU Timestamp in microseconds.""" + if self._data.size == 1: + return int(self._data.time_stamp[0]) + return self._data.time_stamp + + @time_stamp.setter + def time_stamp(self, val): + self._data.time_stamp = val + + @property + def vgpu_instance(self): + """Union[~_numpy.uint32, int]: vGPU Instance""" + if self._data.size == 1: + return int(self._data.vgpu_instance[0]) + return self._data.vgpu_instance + + @vgpu_instance.setter + def vgpu_instance(self, val): + self._data.vgpu_instance = val + + @property + def pid(self): + """Union[~_numpy.uint32, int]: PID of process running within the vGPU VM.""" + if self._data.size == 1: + return int(self._data.pid[0]) + return self._data.pid + + @pid.setter + def pid(self, val): + self._data.pid = val + + @property + def sm_util(self): + """Union[~_numpy.uint32, int]: SM (3D/Compute) Util Value.""" + if self._data.size == 1: + return int(self._data.sm_util[0]) + return self._data.sm_util + + @sm_util.setter + def sm_util(self, val): + self._data.sm_util = val + + @property + def mem_util(self): + """Union[~_numpy.uint32, int]: Frame Buffer Memory Util Value.""" + if self._data.size == 1: + return int(self._data.mem_util[0]) + return self._data.mem_util + + @mem_util.setter + def mem_util(self, val): + self._data.mem_util = val + + @property + def enc_util(self): + """Union[~_numpy.uint32, int]: Encoder Util Value.""" + if self._data.size == 1: + return int(self._data.enc_util[0]) + return self._data.enc_util + + @enc_util.setter + def enc_util(self, val): + self._data.enc_util = val + + @property + def dec_util(self): + """Union[~_numpy.uint32, int]: Decoder Util Value.""" + if self._data.size == 1: + return int(self._data.dec_util[0]) + return self._data.dec_util + + @dec_util.setter + def dec_util(self, val): + self._data.dec_util = val + + @property + def jpg_util(self): + """Union[~_numpy.uint32, int]: Jpeg Util Value.""" + if self._data.size == 1: + return int(self._data.jpg_util[0]) + return self._data.jpg_util + + @jpg_util.setter + def jpg_util(self, val): + self._data.jpg_util = val + + @property + def ofa_util(self): + """Union[~_numpy.uint32, int]: Ofa Util Value.""" + if self._data.size == 1: + return int(self._data.ofa_util[0]) + return self._data.ofa_util + + @ofa_util.setter + def ofa_util(self, val): + self._data.ofa_util = val + + def __getitem__(self, key): + cdef ssize_t key_ + cdef ssize_t size + if isinstance(key, int): + key_ = key + size = self._data.size + if key_ >= size or key_ <= -(size+1): + raise IndexError("index is out of bounds") + if key_ < 0: + key_ += size + return VgpuProcessUtilizationInfo_v1.from_data(self._data[key_:key_+1]) + out = self._data[key] + if isinstance(out, _numpy.recarray) and out.dtype == vgpu_process_utilization_info_v1_dtype: + return VgpuProcessUtilizationInfo_v1.from_data(out) + return out + + def __setitem__(self, key, val): + self._data[key] = val + + @staticmethod + def from_buffer(buffer): + """Create an VgpuProcessUtilizationInfo_v1 instance with the memory from the given buffer.""" + return VgpuProcessUtilizationInfo_v1.from_data(_numpy.frombuffer(buffer, dtype=vgpu_process_utilization_info_v1_dtype)) + + @staticmethod + def from_data(data): + """Create an VgpuProcessUtilizationInfo_v1 instance wrapping the given NumPy array. + + Args: + data (_numpy.ndarray): a 1D array of dtype `vgpu_process_utilization_info_v1_dtype` holding the data. + """ + cdef VgpuProcessUtilizationInfo_v1 obj = VgpuProcessUtilizationInfo_v1.__new__(VgpuProcessUtilizationInfo_v1) + if not isinstance(data, _numpy.ndarray): + raise TypeError("data argument must be a NumPy ndarray") + if data.ndim != 1: + raise ValueError("data array must be 1D") + if data.dtype != vgpu_process_utilization_info_v1_dtype: + raise ValueError("data array must be of dtype vgpu_process_utilization_info_v1_dtype") + obj._data = data.view(_numpy.recarray) + + return obj + + @staticmethod + def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): + """Create an VgpuProcessUtilizationInfo_v1 instance wrapping the given pointer. + + Args: + ptr (intptr_t): pointer address as Python :class:`int` to the data. + size (int): number of structs, default=1. + readonly (bool): whether the data is read-only (to the user). default is `False`. + owner (object): object that owns the memory at *ptr*. A strong reference is + kept so the backing storage outlives this wrapper. + """ + if ptr == 0: + raise ValueError("ptr must not be null (0)") + cdef VgpuProcessUtilizationInfo_v1 obj = VgpuProcessUtilizationInfo_v1.__new__(VgpuProcessUtilizationInfo_v1) + cdef flag = _cyb_cpython_buffer.PyBUF_READ if readonly else _cyb_cpython_buffer.PyBUF_WRITE + cdef object buf = _cyb_cpython_memoryview.PyMemoryView_FromMemory( + ptr, sizeof(nvmlVgpuProcessUtilizationInfo_v1_t) * size, flag) + data = _numpy.ndarray(size, buffer=buf, dtype=vgpu_process_utilization_info_v1_dtype) + obj._data = data.view(_numpy.recarray) + obj._owner = owner + + return obj + + +cdef _get__py_anon_pod2_dtype_offsets(): + cdef cuda_bindings_nvml__anon_pod2 pod + return _numpy.dtype({ + 'names': ['avg_factor', 'timeslice'], + 'formats': [_numpy.uint32, _numpy.uint32], + 'offsets': [ + (&(pod.avgFactor)) - (&pod), + (&(pod.timeslice)) - (&pod), + ], + 'itemsize': sizeof(cuda_bindings_nvml__anon_pod2), + }) + +_py_anon_pod2_dtype = _get__py_anon_pod2_dtype_offsets() + +cdef class _py_anon_pod2: + """Empty-initialize an instance of `cuda_bindings_nvml__anon_pod2`. .. seealso:: `cuda_bindings_nvml__anon_pod2` @@ -7405,20 +8243,20 @@ cdef class _py_anon_pod2: cdef: cuda_bindings_nvml__anon_pod2 *_ptr object _owner - bint _owned + bint _owns_ptr bint _readonly def __init__(self): self._ptr = _cyb_calloc(1, sizeof(cuda_bindings_nvml__anon_pod2)) if self._ptr == NULL: raise MemoryError("Error allocating _py_anon_pod2") + self._owns_ptr = True self._owner = None - self._owned = True self._readonly = False def __dealloc__(self): cdef cuda_bindings_nvml__anon_pod2 *ptr - if self._owned and self._ptr != NULL: + if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) @@ -7451,14 +8289,20 @@ cdef class _py_anon_pod2: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(cuda_bindings_nvml__anon_pod2)) - if self._ptr == NULL: - raise MemoryError("Error allocating _py_anon_pod2") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(cuda_bindings_nvml__anon_pod2)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This _py_anon_pod2 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(cuda_bindings_nvml__anon_pod2): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(cuda_bindings_nvml__anon_pod2), view.len) + ) + _cyb_memmove(self._ptr, view.buf, sizeof(cuda_bindings_nvml__anon_pod2)) + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -7515,12 +8359,12 @@ cdef class _py_anon_pod2: if obj._ptr == NULL: raise MemoryError("Error allocating _py_anon_pod2") _cyb_memcpy((obj._ptr), ptr, sizeof(cuda_bindings_nvml__anon_pod2)) + obj._owns_ptr = True obj._owner = None - obj._owned = True else: obj._ptr = ptr + obj._owns_ptr = False obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -7547,20 +8391,20 @@ cdef class _py_anon_pod3: cdef: cuda_bindings_nvml__anon_pod3 *_ptr object _owner - bint _owned + bint _owns_ptr bint _readonly def __init__(self): self._ptr = _cyb_calloc(1, sizeof(cuda_bindings_nvml__anon_pod3)) if self._ptr == NULL: raise MemoryError("Error allocating _py_anon_pod3") + self._owns_ptr = True self._owner = None - self._owned = True self._readonly = False def __dealloc__(self): cdef cuda_bindings_nvml__anon_pod3 *ptr - if self._owned and self._ptr != NULL: + if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) @@ -7593,14 +8437,20 @@ cdef class _py_anon_pod3: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(cuda_bindings_nvml__anon_pod3)) - if self._ptr == NULL: - raise MemoryError("Error allocating _py_anon_pod3") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(cuda_bindings_nvml__anon_pod3)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This _py_anon_pod3 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(cuda_bindings_nvml__anon_pod3): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(cuda_bindings_nvml__anon_pod3), view.len) + ) + _cyb_memmove(self._ptr, view.buf, sizeof(cuda_bindings_nvml__anon_pod3)) + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -7646,12 +8496,12 @@ cdef class _py_anon_pod3: if obj._ptr == NULL: raise MemoryError("Error allocating _py_anon_pod3") _cyb_memcpy((obj._ptr), ptr, sizeof(cuda_bindings_nvml__anon_pod3)) + obj._owns_ptr = True obj._owner = None - obj._owned = True else: obj._ptr = ptr + obj._owns_ptr = False obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -7709,9 +8559,10 @@ cdef class VgpuSchedulerLogEntry: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -7884,20 +8735,20 @@ cdef class _py_anon_pod4: cdef: cuda_bindings_nvml__anon_pod4 *_ptr object _owner - bint _owned + bint _owns_ptr bint _readonly def __init__(self): self._ptr = _cyb_calloc(1, sizeof(cuda_bindings_nvml__anon_pod4)) if self._ptr == NULL: raise MemoryError("Error allocating _py_anon_pod4") + self._owns_ptr = True self._owner = None - self._owned = True self._readonly = False def __dealloc__(self): cdef cuda_bindings_nvml__anon_pod4 *ptr - if self._owned and self._ptr != NULL: + if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) @@ -7930,14 +8781,20 @@ cdef class _py_anon_pod4: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(cuda_bindings_nvml__anon_pod4)) - if self._ptr == NULL: - raise MemoryError("Error allocating _py_anon_pod4") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(cuda_bindings_nvml__anon_pod4)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This _py_anon_pod4 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(cuda_bindings_nvml__anon_pod4): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(cuda_bindings_nvml__anon_pod4), view.len) + ) + _cyb_memmove(self._ptr, view.buf, sizeof(cuda_bindings_nvml__anon_pod4)) + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -7994,12 +8851,12 @@ cdef class _py_anon_pod4: if obj._ptr == NULL: raise MemoryError("Error allocating _py_anon_pod4") _cyb_memcpy((obj._ptr), ptr, sizeof(cuda_bindings_nvml__anon_pod4)) + obj._owns_ptr = True obj._owner = None - obj._owned = True else: obj._ptr = ptr + obj._owns_ptr = False obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -8026,20 +8883,20 @@ cdef class _py_anon_pod5: cdef: cuda_bindings_nvml__anon_pod5 *_ptr object _owner - bint _owned + bint _owns_ptr bint _readonly def __init__(self): self._ptr = _cyb_calloc(1, sizeof(cuda_bindings_nvml__anon_pod5)) if self._ptr == NULL: raise MemoryError("Error allocating _py_anon_pod5") + self._owns_ptr = True self._owner = None - self._owned = True self._readonly = False def __dealloc__(self): cdef cuda_bindings_nvml__anon_pod5 *ptr - if self._owned and self._ptr != NULL: + if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) @@ -8072,14 +8929,20 @@ cdef class _py_anon_pod5: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(cuda_bindings_nvml__anon_pod5)) - if self._ptr == NULL: - raise MemoryError("Error allocating _py_anon_pod5") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(cuda_bindings_nvml__anon_pod5)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This _py_anon_pod5 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(cuda_bindings_nvml__anon_pod5): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(cuda_bindings_nvml__anon_pod5), view.len) + ) + _cyb_memmove(self._ptr, view.buf, sizeof(cuda_bindings_nvml__anon_pod5)) + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -8125,12 +8988,12 @@ cdef class _py_anon_pod5: if obj._ptr == NULL: raise MemoryError("Error allocating _py_anon_pod5") _cyb_memcpy((obj._ptr), ptr, sizeof(cuda_bindings_nvml__anon_pod5)) + obj._owns_ptr = True obj._owner = None - obj._owned = True else: obj._ptr = ptr + obj._owns_ptr = False obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -8162,26 +9025,16 @@ cdef class VgpuSchedulerCapabilities: .. seealso:: `nvmlVgpuSchedulerCapabilities_t` """ cdef: + nvmlVgpuSchedulerCapabilities_t _data nvmlVgpuSchedulerCapabilities_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuSchedulerCapabilities_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuSchedulerCapabilities") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlVgpuSchedulerCapabilities_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.VgpuSchedulerCapabilities object at {hex(id(self))}>" @@ -8210,14 +9063,22 @@ cdef class VgpuSchedulerCapabilities: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerCapabilities_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuSchedulerCapabilities") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuSchedulerCapabilities_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This VgpuSchedulerCapabilities instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlVgpuSchedulerCapabilities_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlVgpuSchedulerCapabilities_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlVgpuSchedulerCapabilities_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -8342,16 +9203,12 @@ cdef class VgpuSchedulerCapabilities: raise ValueError("ptr must not be null (0)") cdef VgpuSchedulerCapabilities obj = VgpuSchedulerCapabilities.__new__(VgpuSchedulerCapabilities) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerCapabilities_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating VgpuSchedulerCapabilities") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerCapabilities_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlVgpuSchedulerCapabilities_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -8384,20 +9241,20 @@ cdef class VgpuLicenseExpiry: cdef: nvmlVgpuLicenseExpiry_t *_ptr object _owner - bint _owned + bint _owns_ptr bint _readonly def __init__(self): self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuLicenseExpiry_t)) if self._ptr == NULL: raise MemoryError("Error allocating VgpuLicenseExpiry") + self._owns_ptr = True self._owner = None - self._owned = True self._readonly = False def __dealloc__(self): cdef nvmlVgpuLicenseExpiry_t *ptr - if self._owned and self._ptr != NULL: + if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) @@ -8430,14 +9287,20 @@ cdef class VgpuLicenseExpiry: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlVgpuLicenseExpiry_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuLicenseExpiry") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuLicenseExpiry_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This VgpuLicenseExpiry instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlVgpuLicenseExpiry_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlVgpuLicenseExpiry_t), view.len) + ) + _cyb_memmove(self._ptr, view.buf, sizeof(nvmlVgpuLicenseExpiry_t)) + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -8549,12 +9412,12 @@ cdef class VgpuLicenseExpiry: if obj._ptr == NULL: raise MemoryError("Error allocating VgpuLicenseExpiry") _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuLicenseExpiry_t)) + obj._owns_ptr = True obj._owner = None - obj._owned = True else: obj._ptr = ptr + obj._owns_ptr = False obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -8587,20 +9450,20 @@ cdef class GridLicenseExpiry: cdef: nvmlGridLicenseExpiry_t *_ptr object _owner - bint _owned + bint _owns_ptr bint _readonly def __init__(self): self._ptr = _cyb_calloc(1, sizeof(nvmlGridLicenseExpiry_t)) if self._ptr == NULL: raise MemoryError("Error allocating GridLicenseExpiry") + self._owns_ptr = True self._owner = None - self._owned = True self._readonly = False def __dealloc__(self): cdef nvmlGridLicenseExpiry_t *ptr - if self._owned and self._ptr != NULL: + if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) @@ -8633,14 +9496,20 @@ cdef class GridLicenseExpiry: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlGridLicenseExpiry_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating GridLicenseExpiry") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlGridLicenseExpiry_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This GridLicenseExpiry instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlGridLicenseExpiry_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlGridLicenseExpiry_t), view.len) + ) + _cyb_memmove(self._ptr, view.buf, sizeof(nvmlGridLicenseExpiry_t)) + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -8752,12 +9621,12 @@ cdef class GridLicenseExpiry: if obj._ptr == NULL: raise MemoryError("Error allocating GridLicenseExpiry") _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlGridLicenseExpiry_t)) + obj._owns_ptr = True obj._owner = None - obj._owned = True else: obj._ptr = ptr + obj._owns_ptr = False obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -8784,28 +9653,18 @@ cdef class VgpuTypeIdInfo_v1: .. seealso:: `nvmlVgpuTypeIdInfo_v1_t` """ cdef: + nvmlVgpuTypeIdInfo_v1_t _data nvmlVgpuTypeIdInfo_v1_t *_ptr object _owner - bint _owned bint _readonly dict _refs def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuTypeIdInfo_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuTypeIdInfo_v1") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False self._refs = {} - def __dealloc__(self): - cdef nvmlVgpuTypeIdInfo_v1_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.VgpuTypeIdInfo_v1 object at {hex(id(self))}>" @@ -8834,14 +9693,22 @@ cdef class VgpuTypeIdInfo_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlVgpuTypeIdInfo_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuTypeIdInfo_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuTypeIdInfo_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This VgpuTypeIdInfo_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlVgpuTypeIdInfo_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlVgpuTypeIdInfo_v1_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlVgpuTypeIdInfo_v1_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -8902,16 +9769,12 @@ cdef class VgpuTypeIdInfo_v1: raise ValueError("ptr must not be null (0)") cdef VgpuTypeIdInfo_v1 obj = VgpuTypeIdInfo_v1.__new__(VgpuTypeIdInfo_v1) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlVgpuTypeIdInfo_v1_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating VgpuTypeIdInfo_v1") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuTypeIdInfo_v1_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlVgpuTypeIdInfo_v1_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly obj._refs = {} return obj @@ -8939,28 +9802,18 @@ cdef class ActiveVgpuInstanceInfo_v1: .. seealso:: `nvmlActiveVgpuInstanceInfo_v1_t` """ cdef: + nvmlActiveVgpuInstanceInfo_v1_t _data nvmlActiveVgpuInstanceInfo_v1_t *_ptr object _owner - bint _owned bint _readonly dict _refs def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlActiveVgpuInstanceInfo_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating ActiveVgpuInstanceInfo_v1") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False self._refs = {} - def __dealloc__(self): - cdef nvmlActiveVgpuInstanceInfo_v1_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.ActiveVgpuInstanceInfo_v1 object at {hex(id(self))}>" @@ -8989,14 +9842,22 @@ cdef class ActiveVgpuInstanceInfo_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlActiveVgpuInstanceInfo_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating ActiveVgpuInstanceInfo_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlActiveVgpuInstanceInfo_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This ActiveVgpuInstanceInfo_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlActiveVgpuInstanceInfo_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlActiveVgpuInstanceInfo_v1_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlActiveVgpuInstanceInfo_v1_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -9057,16 +9918,12 @@ cdef class ActiveVgpuInstanceInfo_v1: raise ValueError("ptr must not be null (0)") cdef ActiveVgpuInstanceInfo_v1 obj = ActiveVgpuInstanceInfo_v1.__new__(ActiveVgpuInstanceInfo_v1) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlActiveVgpuInstanceInfo_v1_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating ActiveVgpuInstanceInfo_v1") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlActiveVgpuInstanceInfo_v1_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlActiveVgpuInstanceInfo_v1_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly obj._refs = {} return obj @@ -9096,28 +9953,18 @@ cdef class VgpuCreatablePlacementInfo_v1: .. seealso:: `nvmlVgpuCreatablePlacementInfo_v1_t` """ cdef: + nvmlVgpuCreatablePlacementInfo_v1_t _data nvmlVgpuCreatablePlacementInfo_v1_t *_ptr object _owner - bint _owned bint _readonly dict _refs def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuCreatablePlacementInfo_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuCreatablePlacementInfo_v1") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False self._refs = {} - def __dealloc__(self): - cdef nvmlVgpuCreatablePlacementInfo_v1_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.VgpuCreatablePlacementInfo_v1 object at {hex(id(self))}>" @@ -9146,14 +9993,22 @@ cdef class VgpuCreatablePlacementInfo_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlVgpuCreatablePlacementInfo_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuCreatablePlacementInfo_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuCreatablePlacementInfo_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This VgpuCreatablePlacementInfo_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlVgpuCreatablePlacementInfo_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlVgpuCreatablePlacementInfo_v1_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlVgpuCreatablePlacementInfo_v1_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -9236,16 +10091,12 @@ cdef class VgpuCreatablePlacementInfo_v1: raise ValueError("ptr must not be null (0)") cdef VgpuCreatablePlacementInfo_v1 obj = VgpuCreatablePlacementInfo_v1.__new__(VgpuCreatablePlacementInfo_v1) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlVgpuCreatablePlacementInfo_v1_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating VgpuCreatablePlacementInfo_v1") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuCreatablePlacementInfo_v1_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlVgpuCreatablePlacementInfo_v1_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly obj._refs = {} return obj @@ -9300,9 +10151,10 @@ cdef class HwbcEntry: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -9427,26 +10279,16 @@ cdef class LedState: .. seealso:: `nvmlLedState_t` """ cdef: + nvmlLedState_t _data nvmlLedState_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlLedState_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating LedState") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlLedState_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.LedState object at {hex(id(self))}>" @@ -9475,14 +10317,22 @@ cdef class LedState: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlLedState_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating LedState") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlLedState_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This LedState instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlLedState_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlLedState_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlLedState_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -9539,16 +10389,12 @@ cdef class LedState: raise ValueError("ptr must not be null (0)") cdef LedState obj = LedState.__new__(LedState) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlLedState_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating LedState") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlLedState_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlLedState_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -9576,26 +10422,16 @@ cdef class UnitInfo: .. seealso:: `nvmlUnitInfo_t` """ cdef: + nvmlUnitInfo_t _data nvmlUnitInfo_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlUnitInfo_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating UnitInfo") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlUnitInfo_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.UnitInfo object at {hex(id(self))}>" @@ -9624,14 +10460,22 @@ cdef class UnitInfo: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlUnitInfo_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating UnitInfo") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlUnitInfo_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This UnitInfo instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlUnitInfo_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlUnitInfo_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlUnitInfo_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -9722,16 +10566,12 @@ cdef class UnitInfo: raise ValueError("ptr must not be null (0)") cdef UnitInfo obj = UnitInfo.__new__(UnitInfo) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlUnitInfo_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating UnitInfo") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlUnitInfo_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlUnitInfo_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -9759,26 +10599,16 @@ cdef class PSUInfo: .. seealso:: `nvmlPSUInfo_t` """ cdef: + nvmlPSUInfo_t _data nvmlPSUInfo_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlPSUInfo_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating PSUInfo") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlPSUInfo_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.PSUInfo object at {hex(id(self))}>" @@ -9807,14 +10637,22 @@ cdef class PSUInfo: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlPSUInfo_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating PSUInfo") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlPSUInfo_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This PSUInfo instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlPSUInfo_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlPSUInfo_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlPSUInfo_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -9893,16 +10731,12 @@ cdef class PSUInfo: raise ValueError("ptr must not be null (0)") cdef PSUInfo obj = PSUInfo.__new__(PSUInfo) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlPSUInfo_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating PSUInfo") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlPSUInfo_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlPSUInfo_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -9956,9 +10790,10 @@ cdef class UnitFanInfo: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -10088,26 +10923,16 @@ cdef class EventData: .. seealso:: `nvmlEventData_t` """ cdef: + nvmlEventData_t _data nvmlEventData_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlEventData_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating EventData") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlEventData_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.EventData object at {hex(id(self))}>" @@ -10136,14 +10961,22 @@ cdef class EventData: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlEventData_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating EventData") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlEventData_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This EventData instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlEventData_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlEventData_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlEventData_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -10229,16 +11062,12 @@ cdef class EventData: raise ValueError("ptr must not be null (0)") cdef EventData obj = EventData.__new__(EventData) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlEventData_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating EventData") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlEventData_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlEventData_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -10292,9 +11121,10 @@ cdef class SystemEventData_v1: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -10426,26 +11256,16 @@ cdef class AccountingStats: .. seealso:: `nvmlAccountingStats_t` """ cdef: + nvmlAccountingStats_t _data nvmlAccountingStats_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlAccountingStats_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating AccountingStats") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlAccountingStats_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.AccountingStats object at {hex(id(self))}>" @@ -10474,14 +11294,22 @@ cdef class AccountingStats: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlAccountingStats_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating AccountingStats") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlAccountingStats_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This AccountingStats instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlAccountingStats_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlAccountingStats_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlAccountingStats_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -10578,16 +11406,12 @@ cdef class AccountingStats: raise ValueError("ptr must not be null (0)") cdef AccountingStats obj = AccountingStats.__new__(AccountingStats) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlAccountingStats_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating AccountingStats") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlAccountingStats_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlAccountingStats_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -10647,9 +11471,10 @@ cdef class EncoderSessionInfo: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -10843,26 +11668,16 @@ cdef class FBCStats: .. seealso:: `nvmlFBCStats_t` """ cdef: + nvmlFBCStats_t _data nvmlFBCStats_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlFBCStats_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating FBCStats") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlFBCStats_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.FBCStats object at {hex(id(self))}>" @@ -10891,14 +11706,22 @@ cdef class FBCStats: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlFBCStats_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating FBCStats") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlFBCStats_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This FBCStats instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlFBCStats_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlFBCStats_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlFBCStats_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -10962,16 +11785,12 @@ cdef class FBCStats: raise ValueError("ptr must not be null (0)") cdef FBCStats obj = FBCStats.__new__(FBCStats) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlFBCStats_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating FBCStats") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlFBCStats_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlFBCStats_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -11035,9 +11854,10 @@ cdef class FBCSessionInfo: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -11274,26 +12094,16 @@ cdef class ConfComputeSystemCaps: .. seealso:: `nvmlConfComputeSystemCaps_t` """ cdef: + nvmlConfComputeSystemCaps_t _data nvmlConfComputeSystemCaps_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlConfComputeSystemCaps_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating ConfComputeSystemCaps") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlConfComputeSystemCaps_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.ConfComputeSystemCaps object at {hex(id(self))}>" @@ -11322,14 +12132,22 @@ cdef class ConfComputeSystemCaps: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlConfComputeSystemCaps_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating ConfComputeSystemCaps") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlConfComputeSystemCaps_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This ConfComputeSystemCaps instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlConfComputeSystemCaps_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlConfComputeSystemCaps_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlConfComputeSystemCaps_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -11382,16 +12200,12 @@ cdef class ConfComputeSystemCaps: raise ValueError("ptr must not be null (0)") cdef ConfComputeSystemCaps obj = ConfComputeSystemCaps.__new__(ConfComputeSystemCaps) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlConfComputeSystemCaps_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating ConfComputeSystemCaps") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlConfComputeSystemCaps_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlConfComputeSystemCaps_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -11418,26 +12232,16 @@ cdef class ConfComputeSystemState: .. seealso:: `nvmlConfComputeSystemState_t` """ cdef: + nvmlConfComputeSystemState_t _data nvmlConfComputeSystemState_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlConfComputeSystemState_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating ConfComputeSystemState") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlConfComputeSystemState_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.ConfComputeSystemState object at {hex(id(self))}>" @@ -11466,14 +12270,22 @@ cdef class ConfComputeSystemState: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlConfComputeSystemState_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating ConfComputeSystemState") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlConfComputeSystemState_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This ConfComputeSystemState instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlConfComputeSystemState_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlConfComputeSystemState_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlConfComputeSystemState_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -11537,16 +12349,12 @@ cdef class ConfComputeSystemState: raise ValueError("ptr must not be null (0)") cdef ConfComputeSystemState obj = ConfComputeSystemState.__new__(ConfComputeSystemState) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlConfComputeSystemState_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating ConfComputeSystemState") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlConfComputeSystemState_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlConfComputeSystemState_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -11575,26 +12383,16 @@ cdef class SystemConfComputeSettings_v1: .. seealso:: `nvmlSystemConfComputeSettings_v1_t` """ cdef: + nvmlSystemConfComputeSettings_v1_t _data nvmlSystemConfComputeSettings_v1_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlSystemConfComputeSettings_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating SystemConfComputeSettings_v1") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlSystemConfComputeSettings_v1_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.SystemConfComputeSettings_v1 object at {hex(id(self))}>" @@ -11623,14 +12421,22 @@ cdef class SystemConfComputeSettings_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlSystemConfComputeSettings_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating SystemConfComputeSettings_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlSystemConfComputeSettings_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This SystemConfComputeSettings_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlSystemConfComputeSettings_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlSystemConfComputeSettings_v1_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlSystemConfComputeSettings_v1_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -11716,16 +12522,12 @@ cdef class SystemConfComputeSettings_v1: raise ValueError("ptr must not be null (0)") cdef SystemConfComputeSettings_v1 obj = SystemConfComputeSettings_v1.__new__(SystemConfComputeSettings_v1) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlSystemConfComputeSettings_v1_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating SystemConfComputeSettings_v1") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlSystemConfComputeSettings_v1_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlSystemConfComputeSettings_v1_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -11751,26 +12553,16 @@ cdef class ConfComputeMemSizeInfo: .. seealso:: `nvmlConfComputeMemSizeInfo_t` """ cdef: + nvmlConfComputeMemSizeInfo_t _data nvmlConfComputeMemSizeInfo_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlConfComputeMemSizeInfo_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating ConfComputeMemSizeInfo") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlConfComputeMemSizeInfo_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.ConfComputeMemSizeInfo object at {hex(id(self))}>" @@ -11799,14 +12591,22 @@ cdef class ConfComputeMemSizeInfo: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlConfComputeMemSizeInfo_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating ConfComputeMemSizeInfo") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlConfComputeMemSizeInfo_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This ConfComputeMemSizeInfo instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlConfComputeMemSizeInfo_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlConfComputeMemSizeInfo_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlConfComputeMemSizeInfo_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -11859,16 +12659,12 @@ cdef class ConfComputeMemSizeInfo: raise ValueError("ptr must not be null (0)") cdef ConfComputeMemSizeInfo obj = ConfComputeMemSizeInfo.__new__(ConfComputeMemSizeInfo) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlConfComputeMemSizeInfo_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating ConfComputeMemSizeInfo") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlConfComputeMemSizeInfo_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlConfComputeMemSizeInfo_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -11896,26 +12692,16 @@ cdef class ConfComputeGpuCertificate: .. seealso:: `nvmlConfComputeGpuCertificate_t` """ cdef: + nvmlConfComputeGpuCertificate_t _data nvmlConfComputeGpuCertificate_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlConfComputeGpuCertificate_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating ConfComputeGpuCertificate") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlConfComputeGpuCertificate_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.ConfComputeGpuCertificate object at {hex(id(self))}>" @@ -11944,14 +12730,22 @@ cdef class ConfComputeGpuCertificate: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlConfComputeGpuCertificate_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating ConfComputeGpuCertificate") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlConfComputeGpuCertificate_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This ConfComputeGpuCertificate instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlConfComputeGpuCertificate_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlConfComputeGpuCertificate_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlConfComputeGpuCertificate_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -12026,16 +12820,12 @@ cdef class ConfComputeGpuCertificate: raise ValueError("ptr must not be null (0)") cdef ConfComputeGpuCertificate obj = ConfComputeGpuCertificate.__new__(ConfComputeGpuCertificate) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlConfComputeGpuCertificate_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating ConfComputeGpuCertificate") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlConfComputeGpuCertificate_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlConfComputeGpuCertificate_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -12065,26 +12855,16 @@ cdef class ConfComputeGpuAttestationReport: .. seealso:: `nvmlConfComputeGpuAttestationReport_t` """ cdef: + nvmlConfComputeGpuAttestationReport_t _data nvmlConfComputeGpuAttestationReport_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlConfComputeGpuAttestationReport_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating ConfComputeGpuAttestationReport") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlConfComputeGpuAttestationReport_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.ConfComputeGpuAttestationReport object at {hex(id(self))}>" @@ -12113,14 +12893,22 @@ cdef class ConfComputeGpuAttestationReport: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlConfComputeGpuAttestationReport_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating ConfComputeGpuAttestationReport") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlConfComputeGpuAttestationReport_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This ConfComputeGpuAttestationReport instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlConfComputeGpuAttestationReport_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlConfComputeGpuAttestationReport_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlConfComputeGpuAttestationReport_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -12223,16 +13011,12 @@ cdef class ConfComputeGpuAttestationReport: raise ValueError("ptr must not be null (0)") cdef ConfComputeGpuAttestationReport obj = ConfComputeGpuAttestationReport.__new__(ConfComputeGpuAttestationReport) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlConfComputeGpuAttestationReport_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating ConfComputeGpuAttestationReport") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlConfComputeGpuAttestationReport_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlConfComputeGpuAttestationReport_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -12262,26 +13046,16 @@ cdef class GpuFabricInfo_v2: .. seealso:: `nvmlGpuFabricInfo_v2_t` """ cdef: + nvmlGpuFabricInfo_v2_t _data nvmlGpuFabricInfo_v2_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlGpuFabricInfo_v2_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating GpuFabricInfo_v2") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlGpuFabricInfo_v2_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.GpuFabricInfo_v2 object at {hex(id(self))}>" @@ -12310,14 +13084,22 @@ cdef class GpuFabricInfo_v2: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlGpuFabricInfo_v2_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating GpuFabricInfo_v2") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlGpuFabricInfo_v2_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This GpuFabricInfo_v2 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlGpuFabricInfo_v2_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlGpuFabricInfo_v2_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlGpuFabricInfo_v2_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -12420,16 +13202,12 @@ cdef class GpuFabricInfo_v2: raise ValueError("ptr must not be null (0)") cdef GpuFabricInfo_v2 obj = GpuFabricInfo_v2.__new__(GpuFabricInfo_v2) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlGpuFabricInfo_v2_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating GpuFabricInfo_v2") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlGpuFabricInfo_v2_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlGpuFabricInfo_v2_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -12456,26 +13234,16 @@ cdef class NvlinkSupportedBwModes_v1: .. seealso:: `nvmlNvlinkSupportedBwModes_v1_t` """ cdef: + nvmlNvlinkSupportedBwModes_v1_t _data nvmlNvlinkSupportedBwModes_v1_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlNvlinkSupportedBwModes_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating NvlinkSupportedBwModes_v1") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlNvlinkSupportedBwModes_v1_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.NvlinkSupportedBwModes_v1 object at {hex(id(self))}>" @@ -12504,14 +13272,22 @@ cdef class NvlinkSupportedBwModes_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlNvlinkSupportedBwModes_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating NvlinkSupportedBwModes_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlNvlinkSupportedBwModes_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This NvlinkSupportedBwModes_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlNvlinkSupportedBwModes_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlNvlinkSupportedBwModes_v1_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlNvlinkSupportedBwModes_v1_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -12575,16 +13351,12 @@ cdef class NvlinkSupportedBwModes_v1: raise ValueError("ptr must not be null (0)") cdef NvlinkSupportedBwModes_v1 obj = NvlinkSupportedBwModes_v1.__new__(NvlinkSupportedBwModes_v1) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlNvlinkSupportedBwModes_v1_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating NvlinkSupportedBwModes_v1") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlNvlinkSupportedBwModes_v1_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlNvlinkSupportedBwModes_v1_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -12611,26 +13383,16 @@ cdef class NvlinkGetBwMode_v1: .. seealso:: `nvmlNvlinkGetBwMode_v1_t` """ cdef: + nvmlNvlinkGetBwMode_v1_t _data nvmlNvlinkGetBwMode_v1_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlNvlinkGetBwMode_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating NvlinkGetBwMode_v1") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlNvlinkGetBwMode_v1_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.NvlinkGetBwMode_v1 object at {hex(id(self))}>" @@ -12659,14 +13421,22 @@ cdef class NvlinkGetBwMode_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlNvlinkGetBwMode_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating NvlinkGetBwMode_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlNvlinkGetBwMode_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This NvlinkGetBwMode_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlNvlinkGetBwMode_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlNvlinkGetBwMode_v1_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlNvlinkGetBwMode_v1_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -12730,16 +13500,12 @@ cdef class NvlinkGetBwMode_v1: raise ValueError("ptr must not be null (0)") cdef NvlinkGetBwMode_v1 obj = NvlinkGetBwMode_v1.__new__(NvlinkGetBwMode_v1) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlNvlinkGetBwMode_v1_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating NvlinkGetBwMode_v1") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlNvlinkGetBwMode_v1_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlNvlinkGetBwMode_v1_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -12766,26 +13532,16 @@ cdef class NvlinkSetBwMode_v1: .. seealso:: `nvmlNvlinkSetBwMode_v1_t` """ cdef: + nvmlNvlinkSetBwMode_v1_t _data nvmlNvlinkSetBwMode_v1_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlNvlinkSetBwMode_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating NvlinkSetBwMode_v1") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlNvlinkSetBwMode_v1_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.NvlinkSetBwMode_v1 object at {hex(id(self))}>" @@ -12814,14 +13570,22 @@ cdef class NvlinkSetBwMode_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlNvlinkSetBwMode_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating NvlinkSetBwMode_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlNvlinkSetBwMode_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This NvlinkSetBwMode_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlNvlinkSetBwMode_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlNvlinkSetBwMode_v1_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlNvlinkSetBwMode_v1_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -12885,16 +13649,12 @@ cdef class NvlinkSetBwMode_v1: raise ValueError("ptr must not be null (0)") cdef NvlinkSetBwMode_v1 obj = NvlinkSetBwMode_v1.__new__(NvlinkSetBwMode_v1) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlNvlinkSetBwMode_v1_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating NvlinkSetBwMode_v1") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlNvlinkSetBwMode_v1_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlNvlinkSetBwMode_v1_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -12922,20 +13682,20 @@ cdef class VgpuVersion: cdef: nvmlVgpuVersion_t *_ptr object _owner - bint _owned + bint _owns_ptr bint _readonly def __init__(self): self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuVersion_t)) if self._ptr == NULL: raise MemoryError("Error allocating VgpuVersion") + self._owns_ptr = True self._owner = None - self._owned = True self._readonly = False def __dealloc__(self): cdef nvmlVgpuVersion_t *ptr - if self._owned and self._ptr != NULL: + if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) @@ -12968,14 +13728,20 @@ cdef class VgpuVersion: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlVgpuVersion_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuVersion") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuVersion_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This VgpuVersion instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlVgpuVersion_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlVgpuVersion_t), view.len) + ) + _cyb_memmove(self._ptr, view.buf, sizeof(nvmlVgpuVersion_t)) + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -13032,12 +13798,12 @@ cdef class VgpuVersion: if obj._ptr == NULL: raise MemoryError("Error allocating VgpuVersion") _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuVersion_t)) + obj._owns_ptr = True obj._owner = None - obj._owned = True else: obj._ptr = ptr + obj._owns_ptr = False obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -13071,26 +13837,16 @@ cdef class VgpuMetadata: .. seealso:: `nvmlVgpuMetadata_t` """ cdef: + nvmlVgpuMetadata_t _data nvmlVgpuMetadata_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuMetadata_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuMetadata") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlVgpuMetadata_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.VgpuMetadata object at {hex(id(self))}>" @@ -13119,14 +13875,22 @@ cdef class VgpuMetadata: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlVgpuMetadata_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuMetadata") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuMetadata_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This VgpuMetadata instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlVgpuMetadata_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlVgpuMetadata_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlVgpuMetadata_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -13268,16 +14032,12 @@ cdef class VgpuMetadata: raise ValueError("ptr must not be null (0)") cdef VgpuMetadata obj = VgpuMetadata.__new__(VgpuMetadata) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlVgpuMetadata_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating VgpuMetadata") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuMetadata_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlVgpuMetadata_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -13303,26 +14063,16 @@ cdef class VgpuPgpuCompatibility: .. seealso:: `nvmlVgpuPgpuCompatibility_t` """ cdef: + nvmlVgpuPgpuCompatibility_t _data nvmlVgpuPgpuCompatibility_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuPgpuCompatibility_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuPgpuCompatibility") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlVgpuPgpuCompatibility_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.VgpuPgpuCompatibility object at {hex(id(self))}>" @@ -13351,14 +14101,22 @@ cdef class VgpuPgpuCompatibility: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlVgpuPgpuCompatibility_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuPgpuCompatibility") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuPgpuCompatibility_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This VgpuPgpuCompatibility instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlVgpuPgpuCompatibility_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlVgpuPgpuCompatibility_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlVgpuPgpuCompatibility_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -13411,16 +14169,12 @@ cdef class VgpuPgpuCompatibility: raise ValueError("ptr must not be null (0)") cdef VgpuPgpuCompatibility obj = VgpuPgpuCompatibility.__new__(VgpuPgpuCompatibility) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlVgpuPgpuCompatibility_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating VgpuPgpuCompatibility") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuPgpuCompatibility_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlVgpuPgpuCompatibility_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -13474,9 +14228,10 @@ cdef class GpuInstancePlacement: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -13614,26 +14369,16 @@ cdef class GpuInstanceProfileInfo_v3: .. seealso:: `nvmlGpuInstanceProfileInfo_v3_t` """ cdef: + nvmlGpuInstanceProfileInfo_v3_t _data nvmlGpuInstanceProfileInfo_v3_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlGpuInstanceProfileInfo_v3_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating GpuInstanceProfileInfo_v3") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlGpuInstanceProfileInfo_v3_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.GpuInstanceProfileInfo_v3 object at {hex(id(self))}>" @@ -13662,14 +14407,22 @@ cdef class GpuInstanceProfileInfo_v3: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlGpuInstanceProfileInfo_v3_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating GpuInstanceProfileInfo_v3") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlGpuInstanceProfileInfo_v3_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlGpuInstanceProfileInfo_v3_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlGpuInstanceProfileInfo_v3_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlGpuInstanceProfileInfo_v3_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -13847,16 +14600,12 @@ cdef class GpuInstanceProfileInfo_v3: raise ValueError("ptr must not be null (0)") cdef GpuInstanceProfileInfo_v3 obj = GpuInstanceProfileInfo_v3.__new__(GpuInstanceProfileInfo_v3) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlGpuInstanceProfileInfo_v3_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating GpuInstanceProfileInfo_v3") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlGpuInstanceProfileInfo_v3_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlGpuInstanceProfileInfo_v3_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -13910,9 +14659,10 @@ cdef class ComputeInstancePlacement: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -14048,26 +14798,16 @@ cdef class ComputeInstanceProfileInfo_v2: .. seealso:: `nvmlComputeInstanceProfileInfo_v2_t` """ cdef: + nvmlComputeInstanceProfileInfo_v2_t _data nvmlComputeInstanceProfileInfo_v2_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlComputeInstanceProfileInfo_v2_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating ComputeInstanceProfileInfo_v2") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlComputeInstanceProfileInfo_v2_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.ComputeInstanceProfileInfo_v2 object at {hex(id(self))}>" @@ -14096,14 +14836,22 @@ cdef class ComputeInstanceProfileInfo_v2: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlComputeInstanceProfileInfo_v2_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating ComputeInstanceProfileInfo_v2") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlComputeInstanceProfileInfo_v2_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This ComputeInstanceProfileInfo_v2 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlComputeInstanceProfileInfo_v2_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlComputeInstanceProfileInfo_v2_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlComputeInstanceProfileInfo_v2_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -14259,16 +15007,12 @@ cdef class ComputeInstanceProfileInfo_v2: raise ValueError("ptr must not be null (0)") cdef ComputeInstanceProfileInfo_v2 obj = ComputeInstanceProfileInfo_v2.__new__(ComputeInstanceProfileInfo_v2) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlComputeInstanceProfileInfo_v2_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating ComputeInstanceProfileInfo_v2") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlComputeInstanceProfileInfo_v2_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlComputeInstanceProfileInfo_v2_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -14304,26 +15048,16 @@ cdef class ComputeInstanceProfileInfo_v3: .. seealso:: `nvmlComputeInstanceProfileInfo_v3_t` """ cdef: + nvmlComputeInstanceProfileInfo_v3_t _data nvmlComputeInstanceProfileInfo_v3_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlComputeInstanceProfileInfo_v3_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating ComputeInstanceProfileInfo_v3") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlComputeInstanceProfileInfo_v3_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.ComputeInstanceProfileInfo_v3 object at {hex(id(self))}>" @@ -14352,14 +15086,22 @@ cdef class ComputeInstanceProfileInfo_v3: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlComputeInstanceProfileInfo_v3_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating ComputeInstanceProfileInfo_v3") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlComputeInstanceProfileInfo_v3_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This ComputeInstanceProfileInfo_v3 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlComputeInstanceProfileInfo_v3_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlComputeInstanceProfileInfo_v3_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlComputeInstanceProfileInfo_v3_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -14526,16 +15268,12 @@ cdef class ComputeInstanceProfileInfo_v3: raise ValueError("ptr must not be null (0)") cdef ComputeInstanceProfileInfo_v3 obj = ComputeInstanceProfileInfo_v3.__new__(ComputeInstanceProfileInfo_v3) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlComputeInstanceProfileInfo_v3_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating ComputeInstanceProfileInfo_v3") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlComputeInstanceProfileInfo_v3_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlComputeInstanceProfileInfo_v3_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -14561,26 +15299,16 @@ cdef class DeviceAddressingMode_v1: .. seealso:: `nvmlDeviceAddressingMode_v1_t` """ cdef: + nvmlDeviceAddressingMode_v1_t _data nvmlDeviceAddressingMode_v1_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlDeviceAddressingMode_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating DeviceAddressingMode_v1") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlDeviceAddressingMode_v1_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.DeviceAddressingMode_v1 object at {hex(id(self))}>" @@ -14609,14 +15337,22 @@ cdef class DeviceAddressingMode_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlDeviceAddressingMode_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating DeviceAddressingMode_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlDeviceAddressingMode_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This DeviceAddressingMode_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlDeviceAddressingMode_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlDeviceAddressingMode_v1_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlDeviceAddressingMode_v1_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -14669,16 +15405,12 @@ cdef class DeviceAddressingMode_v1: raise ValueError("ptr must not be null (0)") cdef DeviceAddressingMode_v1 obj = DeviceAddressingMode_v1.__new__(DeviceAddressingMode_v1) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlDeviceAddressingMode_v1_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating DeviceAddressingMode_v1") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlDeviceAddressingMode_v1_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlDeviceAddressingMode_v1_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -14705,26 +15437,16 @@ cdef class RepairStatus_v1: .. seealso:: `nvmlRepairStatus_v1_t` """ cdef: + nvmlRepairStatus_v1_t _data nvmlRepairStatus_v1_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlRepairStatus_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating RepairStatus_v1") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlRepairStatus_v1_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.RepairStatus_v1 object at {hex(id(self))}>" @@ -14753,14 +15475,22 @@ cdef class RepairStatus_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlRepairStatus_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating RepairStatus_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlRepairStatus_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This RepairStatus_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlRepairStatus_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlRepairStatus_v1_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlRepairStatus_v1_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -14824,16 +15554,12 @@ cdef class RepairStatus_v1: raise ValueError("ptr must not be null (0)") cdef RepairStatus_v1 obj = RepairStatus_v1.__new__(RepairStatus_v1) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlRepairStatus_v1_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating RepairStatus_v1") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlRepairStatus_v1_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlRepairStatus_v1_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -14860,26 +15586,16 @@ cdef class DevicePowerMizerModes_v1: .. seealso:: `nvmlDevicePowerMizerModes_v1_t` """ cdef: + nvmlDevicePowerMizerModes_v1_t _data nvmlDevicePowerMizerModes_v1_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlDevicePowerMizerModes_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating DevicePowerMizerModes_v1") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlDevicePowerMizerModes_v1_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.DevicePowerMizerModes_v1 object at {hex(id(self))}>" @@ -14908,14 +15624,22 @@ cdef class DevicePowerMizerModes_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlDevicePowerMizerModes_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating DevicePowerMizerModes_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlDevicePowerMizerModes_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This DevicePowerMizerModes_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlDevicePowerMizerModes_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlDevicePowerMizerModes_v1_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlDevicePowerMizerModes_v1_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -14979,16 +15703,12 @@ cdef class DevicePowerMizerModes_v1: raise ValueError("ptr must not be null (0)") cdef DevicePowerMizerModes_v1 obj = DevicePowerMizerModes_v1.__new__(DevicePowerMizerModes_v1) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlDevicePowerMizerModes_v1_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating DevicePowerMizerModes_v1") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlDevicePowerMizerModes_v1_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlDevicePowerMizerModes_v1_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -15047,9 +15767,10 @@ cdef class EccSramUniqueUncorrectedErrorEntry_v1: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -15236,26 +15957,16 @@ cdef class GpuFabricInfo_v3: .. seealso:: `nvmlGpuFabricInfo_v3_t` """ cdef: + nvmlGpuFabricInfo_v3_t _data nvmlGpuFabricInfo_v3_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlGpuFabricInfo_v3_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating GpuFabricInfo_v3") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlGpuFabricInfo_v3_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.GpuFabricInfo_v3 object at {hex(id(self))}>" @@ -15284,14 +15995,22 @@ cdef class GpuFabricInfo_v3: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlGpuFabricInfo_v3_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating GpuFabricInfo_v3") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlGpuFabricInfo_v3_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This GpuFabricInfo_v3 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlGpuFabricInfo_v3_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlGpuFabricInfo_v3_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlGpuFabricInfo_v3_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -15405,16 +16124,12 @@ cdef class GpuFabricInfo_v3: raise ValueError("ptr must not be null (0)") cdef GpuFabricInfo_v3 obj = GpuFabricInfo_v3.__new__(GpuFabricInfo_v3) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlGpuFabricInfo_v3_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating GpuFabricInfo_v3") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlGpuFabricInfo_v3_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlGpuFabricInfo_v3_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -15440,26 +16155,16 @@ cdef class NvLinkInfo_v1: .. seealso:: `nvmlNvLinkInfo_v1_t` """ cdef: + nvmlNvLinkInfo_v1_t _data nvmlNvLinkInfo_v1_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlNvLinkInfo_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating NvLinkInfo_v1") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlNvLinkInfo_v1_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.NvLinkInfo_v1 object at {hex(id(self))}>" @@ -15488,14 +16193,22 @@ cdef class NvLinkInfo_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlNvLinkInfo_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating NvLinkInfo_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlNvLinkInfo_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This NvLinkInfo_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlNvLinkInfo_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlNvLinkInfo_v1_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlNvLinkInfo_v1_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -15548,16 +16261,12 @@ cdef class NvLinkInfo_v1: raise ValueError("ptr must not be null (0)") cdef NvLinkInfo_v1 obj = NvLinkInfo_v1.__new__(NvLinkInfo_v1) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlNvLinkInfo_v1_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating NvLinkInfo_v1") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlNvLinkInfo_v1_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlNvLinkInfo_v1_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -15613,9 +16322,10 @@ cdef class NvlinkFirmwareVersion: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -15765,20 +16475,20 @@ cdef class PRMCounterInput_v1: cdef: nvmlPRMCounterInput_v1_t *_ptr object _owner - bint _owned + bint _owns_ptr bint _readonly def __init__(self): self._ptr = _cyb_calloc(1, sizeof(nvmlPRMCounterInput_v1_t)) if self._ptr == NULL: raise MemoryError("Error allocating PRMCounterInput_v1") + self._owns_ptr = True self._owner = None - self._owned = True self._readonly = False def __dealloc__(self): cdef nvmlPRMCounterInput_v1_t *ptr - if self._owned and self._ptr != NULL: + if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) @@ -15811,14 +16521,20 @@ cdef class PRMCounterInput_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlPRMCounterInput_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating PRMCounterInput_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlPRMCounterInput_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This PRMCounterInput_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlPRMCounterInput_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlPRMCounterInput_v1_t), view.len) + ) + _cyb_memmove(self._ptr, view.buf, sizeof(nvmlPRMCounterInput_v1_t)) + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -15864,12 +16580,12 @@ cdef class PRMCounterInput_v1: if obj._ptr == NULL: raise MemoryError("Error allocating PRMCounterInput_v1") _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlPRMCounterInput_v1_t)) + obj._owns_ptr = True obj._owner = None - obj._owned = True else: obj._ptr = ptr + obj._owns_ptr = False obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -15897,26 +16613,16 @@ cdef class VgpuSchedulerStateInfo_v2: .. seealso:: `nvmlVgpuSchedulerStateInfo_v2_t` """ cdef: + nvmlVgpuSchedulerStateInfo_v2_t _data nvmlVgpuSchedulerStateInfo_v2_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuSchedulerStateInfo_v2_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuSchedulerStateInfo_v2") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlVgpuSchedulerStateInfo_v2_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.VgpuSchedulerStateInfo_v2 object at {hex(id(self))}>" @@ -15945,14 +16651,22 @@ cdef class VgpuSchedulerStateInfo_v2: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerStateInfo_v2_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuSchedulerStateInfo_v2") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuSchedulerStateInfo_v2_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This VgpuSchedulerStateInfo_v2 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlVgpuSchedulerStateInfo_v2_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlVgpuSchedulerStateInfo_v2_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlVgpuSchedulerStateInfo_v2_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -16027,16 +16741,12 @@ cdef class VgpuSchedulerStateInfo_v2: raise ValueError("ptr must not be null (0)") cdef VgpuSchedulerStateInfo_v2 obj = VgpuSchedulerStateInfo_v2.__new__(VgpuSchedulerStateInfo_v2) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerStateInfo_v2_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating VgpuSchedulerStateInfo_v2") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerStateInfo_v2_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlVgpuSchedulerStateInfo_v2_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -16095,9 +16805,10 @@ cdef class VgpuSchedulerLogEntry_v2: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -16281,26 +16992,16 @@ cdef class VgpuSchedulerState_v2: .. seealso:: `nvmlVgpuSchedulerState_v2_t` """ cdef: + nvmlVgpuSchedulerState_v2_t _data nvmlVgpuSchedulerState_v2_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuSchedulerState_v2_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuSchedulerState_v2") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlVgpuSchedulerState_v2_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.VgpuSchedulerState_v2 object at {hex(id(self))}>" @@ -16329,14 +17030,22 @@ cdef class VgpuSchedulerState_v2: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerState_v2_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuSchedulerState_v2") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuSchedulerState_v2_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This VgpuSchedulerState_v2 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlVgpuSchedulerState_v2_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlVgpuSchedulerState_v2_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlVgpuSchedulerState_v2_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -16411,16 +17120,12 @@ cdef class VgpuSchedulerState_v2: raise ValueError("ptr must not be null (0)") cdef VgpuSchedulerState_v2 obj = VgpuSchedulerState_v2.__new__(VgpuSchedulerState_v2) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerState_v2_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating VgpuSchedulerState_v2") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerState_v2_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlVgpuSchedulerState_v2_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -16445,26 +17150,16 @@ cdef class BBXTimeData_v1: .. seealso:: `nvmlBBXTimeData_v1_t` """ cdef: + nvmlBBXTimeData_v1_t _data nvmlBBXTimeData_v1_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlBBXTimeData_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating BBXTimeData_v1") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlBBXTimeData_v1_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.BBXTimeData_v1 object at {hex(id(self))}>" @@ -16493,14 +17188,22 @@ cdef class BBXTimeData_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlBBXTimeData_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating BBXTimeData_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlBBXTimeData_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This BBXTimeData_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlBBXTimeData_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlBBXTimeData_v1_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlBBXTimeData_v1_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -16542,16 +17245,12 @@ cdef class BBXTimeData_v1: raise ValueError("ptr must not be null (0)") cdef BBXTimeData_v1 obj = BBXTimeData_v1.__new__(BBXTimeData_v1) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlBBXTimeData_v1_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating BBXTimeData_v1") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlBBXTimeData_v1_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlBBXTimeData_v1_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -16581,26 +17280,16 @@ cdef class RemappedRowsInfo_v2: .. seealso:: `nvmlRemappedRowsInfo_v2_t` """ cdef: + nvmlRemappedRowsInfo_v2_t _data nvmlRemappedRowsInfo_v2_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlRemappedRowsInfo_v2_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating RemappedRowsInfo_v2") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlRemappedRowsInfo_v2_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.RemappedRowsInfo_v2 object at {hex(id(self))}>" @@ -16629,14 +17318,22 @@ cdef class RemappedRowsInfo_v2: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlRemappedRowsInfo_v2_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating RemappedRowsInfo_v2") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlRemappedRowsInfo_v2_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This RemappedRowsInfo_v2 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlRemappedRowsInfo_v2_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlRemappedRowsInfo_v2_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlRemappedRowsInfo_v2_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -16733,16 +17430,12 @@ cdef class RemappedRowsInfo_v2: raise ValueError("ptr must not be null (0)") cdef RemappedRowsInfo_v2 obj = RemappedRowsInfo_v2.__new__(RemappedRowsInfo_v2) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlRemappedRowsInfo_v2_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating RemappedRowsInfo_v2") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlRemappedRowsInfo_v2_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlRemappedRowsInfo_v2_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -16776,26 +17469,16 @@ cdef class AccountingStats_v2: .. seealso:: `nvmlAccountingStats_v2_t` """ cdef: + nvmlAccountingStats_v2_t _data nvmlAccountingStats_v2_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlAccountingStats_v2_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating AccountingStats_v2") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlAccountingStats_v2_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.AccountingStats_v2 object at {hex(id(self))}>" @@ -16824,14 +17507,22 @@ cdef class AccountingStats_v2: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlAccountingStats_v2_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating AccountingStats_v2") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlAccountingStats_v2_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This AccountingStats_v2 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlAccountingStats_v2_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlAccountingStats_v2_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlAccountingStats_v2_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -16972,16 +17663,12 @@ cdef class AccountingStats_v2: raise ValueError("ptr must not be null (0)") cdef AccountingStats_v2 obj = AccountingStats_v2.__new__(AccountingStats_v2) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlAccountingStats_v2_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating AccountingStats_v2") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlAccountingStats_v2_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlAccountingStats_v2_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -17010,20 +17697,20 @@ cdef class CPERCursor_v1: cdef: nvmlCPERCursor_v1_t *_ptr object _owner - bint _owned + bint _owns_ptr bint _readonly def __init__(self): self._ptr = _cyb_calloc(1, sizeof(nvmlCPERCursor_v1_t)) if self._ptr == NULL: raise MemoryError("Error allocating CPERCursor_v1") + self._owns_ptr = True self._owner = None - self._owned = True self._readonly = False def __dealloc__(self): cdef nvmlCPERCursor_v1_t *ptr - if self._owned and self._ptr != NULL: + if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) @@ -17056,14 +17743,20 @@ cdef class CPERCursor_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlCPERCursor_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating CPERCursor_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlCPERCursor_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This CPERCursor_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlCPERCursor_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlCPERCursor_v1_t), view.len) + ) + _cyb_memmove(self._ptr, view.buf, sizeof(nvmlCPERCursor_v1_t)) + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -17135,12 +17828,12 @@ cdef class CPERCursor_v1: if obj._ptr == NULL: raise MemoryError("Error allocating CPERCursor_v1") _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlCPERCursor_v1_t)) + obj._owns_ptr = True obj._owner = None - obj._owned = True else: obj._ptr = ptr + obj._owns_ptr = False obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -17167,28 +17860,18 @@ cdef class SetMemoryLimits_v1: .. seealso:: `nvmlSetMemoryLimits_v1_t` """ cdef: + nvmlSetMemoryLimits_v1_t _data nvmlSetMemoryLimits_v1_t *_ptr object _owner - bint _owned bint _readonly dict _refs def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlSetMemoryLimits_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating SetMemoryLimits_v1") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False self._refs = {} - def __dealloc__(self): - cdef nvmlSetMemoryLimits_v1_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.SetMemoryLimits_v1 object at {hex(id(self))}>" @@ -17217,14 +17900,22 @@ cdef class SetMemoryLimits_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlSetMemoryLimits_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating SetMemoryLimits_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlSetMemoryLimits_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This SetMemoryLimits_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlSetMemoryLimits_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlSetMemoryLimits_v1_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlSetMemoryLimits_v1_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -17294,16 +17985,12 @@ cdef class SetMemoryLimits_v1: raise ValueError("ptr must not be null (0)") cdef SetMemoryLimits_v1 obj = SetMemoryLimits_v1.__new__(SetMemoryLimits_v1) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlSetMemoryLimits_v1_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating SetMemoryLimits_v1") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlSetMemoryLimits_v1_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlSetMemoryLimits_v1_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly obj._refs = {} return obj @@ -17332,28 +18019,18 @@ cdef class GetMemoryLimits_v1: .. seealso:: `nvmlGetMemoryLimits_v1_t` """ cdef: + nvmlGetMemoryLimits_v1_t _data nvmlGetMemoryLimits_v1_t *_ptr object _owner - bint _owned bint _readonly dict _refs def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlGetMemoryLimits_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating GetMemoryLimits_v1") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False self._refs = {} - def __dealloc__(self): - cdef nvmlGetMemoryLimits_v1_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.GetMemoryLimits_v1 object at {hex(id(self))}>" @@ -17382,14 +18059,22 @@ cdef class GetMemoryLimits_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlGetMemoryLimits_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating GetMemoryLimits_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlGetMemoryLimits_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This GetMemoryLimits_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlGetMemoryLimits_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlGetMemoryLimits_v1_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlGetMemoryLimits_v1_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -17470,16 +18155,12 @@ cdef class GetMemoryLimits_v1: raise ValueError("ptr must not be null (0)") cdef GetMemoryLimits_v1 obj = GetMemoryLimits_v1.__new__(GetMemoryLimits_v1) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlGetMemoryLimits_v1_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating GetMemoryLimits_v1") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlGetMemoryLimits_v1_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlGetMemoryLimits_v1_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly obj._refs = {} return obj @@ -17533,9 +18214,10 @@ cdef class PmgrPwrTuple: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -17679,9 +18361,10 @@ cdef class RailMetrics: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -17835,9 +18518,10 @@ cdef class PwrModelMetricsDlppm1xPerf: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -17981,9 +18665,10 @@ cdef class PwrModelMetricsSamplePfpp1x: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -18136,9 +18821,10 @@ cdef class PwrModelOperatingPointPfpp1x: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -18268,26 +18954,16 @@ cdef class AdaptiveTgpModeInfo_v1: .. seealso:: `nvmlAdaptiveTgpModeInfo_v1_t` """ cdef: + nvmlAdaptiveTgpModeInfo_v1_t _data nvmlAdaptiveTgpModeInfo_v1_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlAdaptiveTgpModeInfo_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating AdaptiveTgpModeInfo_v1") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlAdaptiveTgpModeInfo_v1_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.AdaptiveTgpModeInfo_v1 object at {hex(id(self))}>" @@ -18316,14 +18992,22 @@ cdef class AdaptiveTgpModeInfo_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlAdaptiveTgpModeInfo_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating AdaptiveTgpModeInfo_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlAdaptiveTgpModeInfo_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This AdaptiveTgpModeInfo_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlAdaptiveTgpModeInfo_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlAdaptiveTgpModeInfo_v1_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlAdaptiveTgpModeInfo_v1_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -18409,16 +19093,12 @@ cdef class AdaptiveTgpModeInfo_v1: raise ValueError("ptr must not be null (0)") cdef AdaptiveTgpModeInfo_v1 obj = AdaptiveTgpModeInfo_v1.__new__(AdaptiveTgpModeInfo_v1) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlAdaptiveTgpModeInfo_v1_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating AdaptiveTgpModeInfo_v1") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlAdaptiveTgpModeInfo_v1_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlAdaptiveTgpModeInfo_v1_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -18443,26 +19123,16 @@ cdef class EventSetGetContextCount_v1: .. seealso:: `nvmlEventSetGetContextCount_v1_t` """ cdef: + nvmlEventSetGetContextCount_v1_t _data nvmlEventSetGetContextCount_v1_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlEventSetGetContextCount_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating EventSetGetContextCount_v1") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlEventSetGetContextCount_v1_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.EventSetGetContextCount_v1 object at {hex(id(self))}>" @@ -18491,14 +19161,22 @@ cdef class EventSetGetContextCount_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlEventSetGetContextCount_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating EventSetGetContextCount_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlEventSetGetContextCount_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This EventSetGetContextCount_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlEventSetGetContextCount_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlEventSetGetContextCount_v1_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlEventSetGetContextCount_v1_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -18540,16 +19218,12 @@ cdef class EventSetGetContextCount_v1: raise ValueError("ptr must not be null (0)") cdef EventSetGetContextCount_v1 obj = EventSetGetContextCount_v1.__new__(EventSetGetContextCount_v1) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlEventSetGetContextCount_v1_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating EventSetGetContextCount_v1") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlEventSetGetContextCount_v1_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlEventSetGetContextCount_v1_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -18578,26 +19252,16 @@ cdef class EventSetGetContextInfo_v1: .. seealso:: `nvmlEventSetGetContextInfo_v1_t` """ cdef: + nvmlEventSetGetContextInfo_v1_t _data nvmlEventSetGetContextInfo_v1_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlEventSetGetContextInfo_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating EventSetGetContextInfo_v1") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlEventSetGetContextInfo_v1_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.EventSetGetContextInfo_v1 object at {hex(id(self))}>" @@ -18626,14 +19290,22 @@ cdef class EventSetGetContextInfo_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlEventSetGetContextInfo_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating EventSetGetContextInfo_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlEventSetGetContextInfo_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This EventSetGetContextInfo_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlEventSetGetContextInfo_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlEventSetGetContextInfo_v1_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlEventSetGetContextInfo_v1_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -18719,16 +19391,12 @@ cdef class EventSetGetContextInfo_v1: raise ValueError("ptr must not be null (0)") cdef EventSetGetContextInfo_v1 obj = EventSetGetContextInfo_v1.__new__(EventSetGetContextInfo_v1) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlEventSetGetContextInfo_v1_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating EventSetGetContextInfo_v1") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlEventSetGetContextInfo_v1_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlEventSetGetContextInfo_v1_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -18754,26 +19422,16 @@ cdef class EventSetGetGpuOperationalEventContextLegacyXid_v1: .. seealso:: `nvmlEventSetGetGpuOperationalEventContextLegacyXid_v1_t` """ cdef: + nvmlEventSetGetGpuOperationalEventContextLegacyXid_v1_t _data nvmlEventSetGetGpuOperationalEventContextLegacyXid_v1_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlEventSetGetGpuOperationalEventContextLegacyXid_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating EventSetGetGpuOperationalEventContextLegacyXid_v1") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlEventSetGetGpuOperationalEventContextLegacyXid_v1_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.EventSetGetGpuOperationalEventContextLegacyXid_v1 object at {hex(id(self))}>" @@ -18802,14 +19460,22 @@ cdef class EventSetGetGpuOperationalEventContextLegacyXid_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlEventSetGetGpuOperationalEventContextLegacyXid_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating EventSetGetGpuOperationalEventContextLegacyXid_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlEventSetGetGpuOperationalEventContextLegacyXid_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This EventSetGetGpuOperationalEventContextLegacyXid_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlEventSetGetGpuOperationalEventContextLegacyXid_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlEventSetGetGpuOperationalEventContextLegacyXid_v1_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlEventSetGetGpuOperationalEventContextLegacyXid_v1_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -18862,16 +19528,12 @@ cdef class EventSetGetGpuOperationalEventContextLegacyXid_v1: raise ValueError("ptr must not be null (0)") cdef EventSetGetGpuOperationalEventContextLegacyXid_v1 obj = EventSetGetGpuOperationalEventContextLegacyXid_v1.__new__(EventSetGetGpuOperationalEventContextLegacyXid_v1) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlEventSetGetGpuOperationalEventContextLegacyXid_v1_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating EventSetGetGpuOperationalEventContextLegacyXid_v1") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlEventSetGetGpuOperationalEventContextLegacyXid_v1_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlEventSetGetGpuOperationalEventContextLegacyXid_v1_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -18899,20 +19561,20 @@ cdef class GpuFabricClique_v1: cdef: nvmlGpuFabricClique_v1_t *_ptr object _owner - bint _owned + bint _owns_ptr bint _readonly def __init__(self): self._ptr = _cyb_calloc(1, sizeof(nvmlGpuFabricClique_v1_t)) if self._ptr == NULL: raise MemoryError("Error allocating GpuFabricClique_v1") + self._owns_ptr = True self._owner = None - self._owned = True self._readonly = False def __dealloc__(self): cdef nvmlGpuFabricClique_v1_t *ptr - if self._owned and self._ptr != NULL: + if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) @@ -18945,14 +19607,20 @@ cdef class GpuFabricClique_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlGpuFabricClique_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating GpuFabricClique_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlGpuFabricClique_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This GpuFabricClique_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlGpuFabricClique_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlGpuFabricClique_v1_t), view.len) + ) + _cyb_memmove(self._ptr, view.buf, sizeof(nvmlGpuFabricClique_v1_t)) + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -19009,12 +19677,12 @@ cdef class GpuFabricClique_v1: if obj._ptr == NULL: raise MemoryError("Error allocating GpuFabricClique_v1") _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlGpuFabricClique_v1_t)) + obj._owns_ptr = True obj._owner = None - obj._owned = True else: obj._ptr = ptr + obj._owns_ptr = False obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -19041,26 +19709,16 @@ cdef class GpuOperationalEventConfig_v1: .. seealso:: `nvmlGpuOperationalEventConfig_v1_t` """ cdef: + nvmlGpuOperationalEventConfig_v1_t _data nvmlGpuOperationalEventConfig_v1_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlGpuOperationalEventConfig_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating GpuOperationalEventConfig_v1") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlGpuOperationalEventConfig_v1_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.GpuOperationalEventConfig_v1 object at {hex(id(self))}>" @@ -19089,14 +19747,22 @@ cdef class GpuOperationalEventConfig_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlGpuOperationalEventConfig_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating GpuOperationalEventConfig_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlGpuOperationalEventConfig_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This GpuOperationalEventConfig_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlGpuOperationalEventConfig_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlGpuOperationalEventConfig_v1_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlGpuOperationalEventConfig_v1_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -19164,16 +19830,12 @@ cdef class GpuOperationalEventConfig_v1: raise ValueError("ptr must not be null (0)") cdef GpuOperationalEventConfig_v1 obj = GpuOperationalEventConfig_v1.__new__(GpuOperationalEventConfig_v1) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlGpuOperationalEventConfig_v1_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating GpuOperationalEventConfig_v1") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlGpuOperationalEventConfig_v1_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlGpuOperationalEventConfig_v1_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -19222,26 +19884,16 @@ cdef class EventSetWait_v3: .. seealso:: `nvmlEventSetWait_v3_t` """ cdef: + nvmlEventSetWait_v3_t _data nvmlEventSetWait_v3_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlEventSetWait_v3_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating EventSetWait_v3") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlEventSetWait_v3_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.EventSetWait_v3 object at {hex(id(self))}>" @@ -19270,14 +19922,22 @@ cdef class EventSetWait_v3: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlEventSetWait_v3_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating EventSetWait_v3") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlEventSetWait_v3_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This EventSetWait_v3 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlEventSetWait_v3_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlEventSetWait_v3_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlEventSetWait_v3_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -19591,16 +20251,12 @@ cdef class EventSetWait_v3: raise ValueError("ptr must not be null (0)") cdef EventSetWait_v3 obj = EventSetWait_v3.__new__(EventSetWait_v3) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlEventSetWait_v3_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating EventSetWait_v3") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlEventSetWait_v3_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlEventSetWait_v3_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -19627,26 +20283,16 @@ cdef class NvlinkSetBwModeAsync_v1: .. seealso:: `nvmlNvlinkSetBwModeAsync_v1_t` """ cdef: + nvmlNvlinkSetBwModeAsync_v1_t _data nvmlNvlinkSetBwModeAsync_v1_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlNvlinkSetBwModeAsync_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating NvlinkSetBwModeAsync_v1") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlNvlinkSetBwModeAsync_v1_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.NvlinkSetBwModeAsync_v1 object at {hex(id(self))}>" @@ -19675,14 +20321,22 @@ cdef class NvlinkSetBwModeAsync_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlNvlinkSetBwModeAsync_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating NvlinkSetBwModeAsync_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlNvlinkSetBwModeAsync_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This NvlinkSetBwModeAsync_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlNvlinkSetBwModeAsync_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlNvlinkSetBwModeAsync_v1_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlNvlinkSetBwModeAsync_v1_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -19746,16 +20400,12 @@ cdef class NvlinkSetBwModeAsync_v1: raise ValueError("ptr must not be null (0)") cdef NvlinkSetBwModeAsync_v1 obj = NvlinkSetBwModeAsync_v1.__new__(NvlinkSetBwModeAsync_v1) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlNvlinkSetBwModeAsync_v1_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating NvlinkSetBwModeAsync_v1") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlNvlinkSetBwModeAsync_v1_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlNvlinkSetBwModeAsync_v1_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -19812,9 +20462,10 @@ cdef class NvlinkTelemetrySample_v1: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -19976,20 +20627,20 @@ cdef class EccBankRemapperHistogram_v1: cdef: nvmlEccBankRemapperHistogram_v1_t *_ptr object _owner - bint _owned + bint _owns_ptr bint _readonly def __init__(self): self._ptr = _cyb_calloc(1, sizeof(nvmlEccBankRemapperHistogram_v1_t)) if self._ptr == NULL: raise MemoryError("Error allocating EccBankRemapperHistogram_v1") + self._owns_ptr = True self._owner = None - self._owned = True self._readonly = False def __dealloc__(self): cdef nvmlEccBankRemapperHistogram_v1_t *ptr - if self._owned and self._ptr != NULL: + if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) @@ -20022,14 +20673,20 @@ cdef class EccBankRemapperHistogram_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlEccBankRemapperHistogram_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating EccBankRemapperHistogram_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlEccBankRemapperHistogram_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This EccBankRemapperHistogram_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlEccBankRemapperHistogram_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlEccBankRemapperHistogram_v1_t), view.len) + ) + _cyb_memmove(self._ptr, view.buf, sizeof(nvmlEccBankRemapperHistogram_v1_t)) + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -20086,12 +20743,12 @@ cdef class EccBankRemapperHistogram_v1: if obj._ptr == NULL: raise MemoryError("Error allocating EccBankRemapperHistogram_v1") _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlEccBankRemapperHistogram_v1_t)) + obj._owns_ptr = True obj._owner = None - obj._owned = True else: obj._ptr = ptr + obj._owns_ptr = False obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -20117,26 +20774,16 @@ cdef class ExcludedDeviceInfo: .. seealso:: `nvmlExcludedDeviceInfo_t` """ cdef: + nvmlExcludedDeviceInfo_t _data nvmlExcludedDeviceInfo_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlExcludedDeviceInfo_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating ExcludedDeviceInfo") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlExcludedDeviceInfo_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.ExcludedDeviceInfo object at {hex(id(self))}>" @@ -20165,14 +20812,22 @@ cdef class ExcludedDeviceInfo: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlExcludedDeviceInfo_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating ExcludedDeviceInfo") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlExcludedDeviceInfo_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This ExcludedDeviceInfo instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlExcludedDeviceInfo_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlExcludedDeviceInfo_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlExcludedDeviceInfo_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -20234,16 +20889,12 @@ cdef class ExcludedDeviceInfo: raise ValueError("ptr must not be null (0)") cdef ExcludedDeviceInfo obj = ExcludedDeviceInfo.__new__(ExcludedDeviceInfo) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlExcludedDeviceInfo_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating ExcludedDeviceInfo") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlExcludedDeviceInfo_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlExcludedDeviceInfo_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -20271,28 +20922,18 @@ cdef class ProcessDetailList_v1: .. seealso:: `nvmlProcessDetailList_v1_t` """ cdef: + nvmlProcessDetailList_v1_t _data nvmlProcessDetailList_v1_t *_ptr object _owner - bint _owned bint _readonly dict _refs def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlProcessDetailList_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating ProcessDetailList_v1") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False self._refs = {} - def __dealloc__(self): - cdef nvmlProcessDetailList_v1_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.ProcessDetailList_v1 object at {hex(id(self))}>" @@ -20321,14 +20962,22 @@ cdef class ProcessDetailList_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlProcessDetailList_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating ProcessDetailList_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlProcessDetailList_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This ProcessDetailList_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlProcessDetailList_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlProcessDetailList_v1_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlProcessDetailList_v1_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -20402,16 +21051,12 @@ cdef class ProcessDetailList_v1: raise ValueError("ptr must not be null (0)") cdef ProcessDetailList_v1 obj = ProcessDetailList_v1.__new__(ProcessDetailList_v1) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlProcessDetailList_v1_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating ProcessDetailList_v1") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlProcessDetailList_v1_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlProcessDetailList_v1_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly obj._refs = {} return obj @@ -20438,26 +21083,16 @@ cdef class BridgeChipHierarchy: .. seealso:: `nvmlBridgeChipHierarchy_t` """ cdef: + nvmlBridgeChipHierarchy_t _data nvmlBridgeChipHierarchy_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlBridgeChipHierarchy_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating BridgeChipHierarchy") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlBridgeChipHierarchy_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.BridgeChipHierarchy object at {hex(id(self))}>" @@ -20486,14 +21121,22 @@ cdef class BridgeChipHierarchy: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlBridgeChipHierarchy_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating BridgeChipHierarchy") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlBridgeChipHierarchy_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This BridgeChipHierarchy instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlBridgeChipHierarchy_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlBridgeChipHierarchy_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlBridgeChipHierarchy_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -20546,16 +21189,12 @@ cdef class BridgeChipHierarchy: raise ValueError("ptr must not be null (0)") cdef BridgeChipHierarchy obj = BridgeChipHierarchy.__new__(BridgeChipHierarchy) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlBridgeChipHierarchy_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating BridgeChipHierarchy") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlBridgeChipHierarchy_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlBridgeChipHierarchy_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -20609,9 +21248,10 @@ cdef class Sample: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -20768,9 +21408,10 @@ cdef class VgpuInstanceUtilizationSample: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -20967,9 +21608,10 @@ cdef class VgpuInstanceUtilizationInfo_v1: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -21183,9 +21825,10 @@ cdef class FieldValue: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -21368,20 +22011,20 @@ cdef class PRMCounterValue_v1: cdef: nvmlPRMCounterValue_v1_t *_ptr object _owner - bint _owned + bint _owns_ptr bint _readonly def __init__(self): self._ptr = _cyb_calloc(1, sizeof(nvmlPRMCounterValue_v1_t)) if self._ptr == NULL: raise MemoryError("Error allocating PRMCounterValue_v1") + self._owns_ptr = True self._owner = None - self._owned = True self._readonly = False def __dealloc__(self): cdef nvmlPRMCounterValue_v1_t *ptr - if self._owned and self._ptr != NULL: + if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) @@ -21414,14 +22057,20 @@ cdef class PRMCounterValue_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlPRMCounterValue_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating PRMCounterValue_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlPRMCounterValue_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This PRMCounterValue_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlPRMCounterValue_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlPRMCounterValue_v1_t), view.len) + ) + _cyb_memmove(self._ptr, view.buf, sizeof(nvmlPRMCounterValue_v1_t)) + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -21494,12 +22143,12 @@ cdef class PRMCounterValue_v1: if obj._ptr == NULL: raise MemoryError("Error allocating PRMCounterValue_v1") _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlPRMCounterValue_v1_t)) + obj._owns_ptr = True obj._owner = None - obj._owned = True else: obj._ptr = ptr + obj._owns_ptr = False obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -21525,26 +22174,16 @@ cdef class GpuThermalSettings: .. seealso:: `nvmlGpuThermalSettings_t` """ cdef: + nvmlGpuThermalSettings_t _data nvmlGpuThermalSettings_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlGpuThermalSettings_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating GpuThermalSettings") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlGpuThermalSettings_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.GpuThermalSettings object at {hex(id(self))}>" @@ -21573,14 +22212,22 @@ cdef class GpuThermalSettings: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlGpuThermalSettings_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating GpuThermalSettings") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlGpuThermalSettings_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This GpuThermalSettings instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlGpuThermalSettings_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlGpuThermalSettings_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlGpuThermalSettings_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -21641,16 +22288,12 @@ cdef class GpuThermalSettings: raise ValueError("ptr must not be null (0)") cdef GpuThermalSettings obj = GpuThermalSettings.__new__(GpuThermalSettings) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlGpuThermalSettings_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating GpuThermalSettings") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlGpuThermalSettings_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlGpuThermalSettings_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -21677,26 +22320,16 @@ cdef class ClkMonStatus: .. seealso:: `nvmlClkMonStatus_t` """ cdef: + nvmlClkMonStatus_t _data nvmlClkMonStatus_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlClkMonStatus_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating ClkMonStatus") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlClkMonStatus_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.ClkMonStatus object at {hex(id(self))}>" @@ -21725,14 +22358,22 @@ cdef class ClkMonStatus: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlClkMonStatus_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating ClkMonStatus") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlClkMonStatus_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This ClkMonStatus instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlClkMonStatus_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlClkMonStatus_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlClkMonStatus_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -21796,16 +22437,12 @@ cdef class ClkMonStatus: raise ValueError("ptr must not be null (0)") cdef ClkMonStatus obj = ClkMonStatus.__new__(ClkMonStatus) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlClkMonStatus_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating ClkMonStatus") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlClkMonStatus_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlClkMonStatus_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -21833,28 +22470,18 @@ cdef class ProcessesUtilizationInfo_v1: .. seealso:: `nvmlProcessesUtilizationInfo_v1_t` """ cdef: + nvmlProcessesUtilizationInfo_v1_t _data nvmlProcessesUtilizationInfo_v1_t *_ptr object _owner - bint _owned bint _readonly dict _refs def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlProcessesUtilizationInfo_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating ProcessesUtilizationInfo_v1") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False self._refs = {} - def __dealloc__(self): - cdef nvmlProcessesUtilizationInfo_v1_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.ProcessesUtilizationInfo_v1 object at {hex(id(self))}>" @@ -21883,14 +22510,22 @@ cdef class ProcessesUtilizationInfo_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlProcessesUtilizationInfo_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating ProcessesUtilizationInfo_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlProcessesUtilizationInfo_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This ProcessesUtilizationInfo_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlProcessesUtilizationInfo_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlProcessesUtilizationInfo_v1_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlProcessesUtilizationInfo_v1_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -21964,16 +22599,12 @@ cdef class ProcessesUtilizationInfo_v1: raise ValueError("ptr must not be null (0)") cdef ProcessesUtilizationInfo_v1 obj = ProcessesUtilizationInfo_v1.__new__(ProcessesUtilizationInfo_v1) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlProcessesUtilizationInfo_v1_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating ProcessesUtilizationInfo_v1") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlProcessesUtilizationInfo_v1_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlProcessesUtilizationInfo_v1_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly obj._refs = {} return obj @@ -22000,26 +22631,16 @@ cdef class GpuDynamicPstatesInfo: .. seealso:: `nvmlGpuDynamicPstatesInfo_t` """ cdef: + nvmlGpuDynamicPstatesInfo_t _data nvmlGpuDynamicPstatesInfo_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlGpuDynamicPstatesInfo_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating GpuDynamicPstatesInfo") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlGpuDynamicPstatesInfo_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.GpuDynamicPstatesInfo object at {hex(id(self))}>" @@ -22048,14 +22669,22 @@ cdef class GpuDynamicPstatesInfo: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlGpuDynamicPstatesInfo_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating GpuDynamicPstatesInfo") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlGpuDynamicPstatesInfo_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This GpuDynamicPstatesInfo instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlGpuDynamicPstatesInfo_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlGpuDynamicPstatesInfo_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlGpuDynamicPstatesInfo_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -22116,16 +22745,12 @@ cdef class GpuDynamicPstatesInfo: raise ValueError("ptr must not be null (0)") cdef GpuDynamicPstatesInfo obj = GpuDynamicPstatesInfo.__new__(GpuDynamicPstatesInfo) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlGpuDynamicPstatesInfo_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating GpuDynamicPstatesInfo") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlGpuDynamicPstatesInfo_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlGpuDynamicPstatesInfo_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -22153,28 +22778,18 @@ cdef class VgpuProcessesUtilizationInfo_v1: .. seealso:: `nvmlVgpuProcessesUtilizationInfo_v1_t` """ cdef: + nvmlVgpuProcessesUtilizationInfo_v1_t _data nvmlVgpuProcessesUtilizationInfo_v1_t *_ptr object _owner - bint _owned bint _readonly dict _refs def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuProcessesUtilizationInfo_v1") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False self._refs = {} - def __dealloc__(self): - cdef nvmlVgpuProcessesUtilizationInfo_v1_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.VgpuProcessesUtilizationInfo_v1 object at {hex(id(self))}>" @@ -22203,14 +22818,22 @@ cdef class VgpuProcessesUtilizationInfo_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuProcessesUtilizationInfo_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This VgpuProcessesUtilizationInfo_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -22284,16 +22907,12 @@ cdef class VgpuProcessesUtilizationInfo_v1: raise ValueError("ptr must not be null (0)") cdef VgpuProcessesUtilizationInfo_v1 obj = VgpuProcessesUtilizationInfo_v1.__new__(VgpuProcessesUtilizationInfo_v1) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating VgpuProcessesUtilizationInfo_v1") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly obj._refs = {} return obj @@ -22322,20 +22941,20 @@ cdef class VgpuSchedulerParams: cdef: nvmlVgpuSchedulerParams_t *_ptr object _owner - bint _owned + bint _owns_ptr bint _readonly def __init__(self): self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuSchedulerParams_t)) if self._ptr == NULL: raise MemoryError("Error allocating VgpuSchedulerParams") + self._owns_ptr = True self._owner = None - self._owned = True self._readonly = False def __dealloc__(self): cdef nvmlVgpuSchedulerParams_t *ptr - if self._owned and self._ptr != NULL: + if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) @@ -22368,14 +22987,20 @@ cdef class VgpuSchedulerParams: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerParams_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuSchedulerParams") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuSchedulerParams_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This VgpuSchedulerParams instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlVgpuSchedulerParams_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlVgpuSchedulerParams_t), view.len) + ) + _cyb_memmove(self._ptr, view.buf, sizeof(nvmlVgpuSchedulerParams_t)) + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -22442,12 +23067,12 @@ cdef class VgpuSchedulerParams: if obj._ptr == NULL: raise MemoryError("Error allocating VgpuSchedulerParams") _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerParams_t)) + obj._owns_ptr = True obj._owner = None - obj._owned = True else: obj._ptr = ptr + obj._owns_ptr = False obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -22475,20 +23100,20 @@ cdef class VgpuSchedulerSetParams: cdef: nvmlVgpuSchedulerSetParams_t *_ptr object _owner - bint _owned + bint _owns_ptr bint _readonly def __init__(self): self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuSchedulerSetParams_t)) if self._ptr == NULL: raise MemoryError("Error allocating VgpuSchedulerSetParams") + self._owns_ptr = True self._owner = None - self._owned = True self._readonly = False def __dealloc__(self): cdef nvmlVgpuSchedulerSetParams_t *ptr - if self._owned and self._ptr != NULL: + if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) @@ -22521,14 +23146,20 @@ cdef class VgpuSchedulerSetParams: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerSetParams_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuSchedulerSetParams") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuSchedulerSetParams_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This VgpuSchedulerSetParams instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlVgpuSchedulerSetParams_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlVgpuSchedulerSetParams_t), view.len) + ) + _cyb_memmove(self._ptr, view.buf, sizeof(nvmlVgpuSchedulerSetParams_t)) + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -22595,12 +23226,12 @@ cdef class VgpuSchedulerSetParams: if obj._ptr == NULL: raise MemoryError("Error allocating VgpuSchedulerSetParams") _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerSetParams_t)) + obj._owns_ptr = True obj._owner = None - obj._owned = True else: obj._ptr = ptr + obj._owns_ptr = False obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -22627,26 +23258,16 @@ cdef class VgpuLicenseInfo: .. seealso:: `nvmlVgpuLicenseInfo_t` """ cdef: + nvmlVgpuLicenseInfo_t _data nvmlVgpuLicenseInfo_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuLicenseInfo_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuLicenseInfo") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlVgpuLicenseInfo_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.VgpuLicenseInfo object at {hex(id(self))}>" @@ -22675,14 +23296,22 @@ cdef class VgpuLicenseInfo: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlVgpuLicenseInfo_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuLicenseInfo") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuLicenseInfo_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This VgpuLicenseInfo instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlVgpuLicenseInfo_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlVgpuLicenseInfo_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlVgpuLicenseInfo_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -22751,16 +23380,12 @@ cdef class VgpuLicenseInfo: raise ValueError("ptr must not be null (0)") cdef VgpuLicenseInfo obj = VgpuLicenseInfo.__new__(VgpuLicenseInfo) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlVgpuLicenseInfo_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating VgpuLicenseInfo") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuLicenseInfo_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlVgpuLicenseInfo_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -22818,9 +23443,10 @@ cdef class GridLicensableFeature: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -22985,26 +23611,16 @@ cdef class UnitFanSpeeds: .. seealso:: `nvmlUnitFanSpeeds_t` """ cdef: + nvmlUnitFanSpeeds_t _data nvmlUnitFanSpeeds_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlUnitFanSpeeds_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating UnitFanSpeeds") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlUnitFanSpeeds_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.UnitFanSpeeds object at {hex(id(self))}>" @@ -23033,14 +23649,22 @@ cdef class UnitFanSpeeds: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlUnitFanSpeeds_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating UnitFanSpeeds") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlUnitFanSpeeds_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This UnitFanSpeeds instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlUnitFanSpeeds_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlUnitFanSpeeds_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlUnitFanSpeeds_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -23101,16 +23725,12 @@ cdef class UnitFanSpeeds: raise ValueError("ptr must not be null (0)") cdef UnitFanSpeeds obj = UnitFanSpeeds.__new__(UnitFanSpeeds) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlUnitFanSpeeds_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating UnitFanSpeeds") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlUnitFanSpeeds_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlUnitFanSpeeds_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -23142,26 +23762,16 @@ cdef class VgpuPgpuMetadata: .. seealso:: `nvmlVgpuPgpuMetadata_t` """ cdef: + nvmlVgpuPgpuMetadata_t _data nvmlVgpuPgpuMetadata_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuPgpuMetadata_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuPgpuMetadata") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlVgpuPgpuMetadata_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.VgpuPgpuMetadata object at {hex(id(self))}>" @@ -23190,14 +23800,22 @@ cdef class VgpuPgpuMetadata: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlVgpuPgpuMetadata_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuPgpuMetadata") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuPgpuMetadata_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This VgpuPgpuMetadata instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlVgpuPgpuMetadata_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlVgpuPgpuMetadata_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlVgpuPgpuMetadata_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -23318,16 +23936,12 @@ cdef class VgpuPgpuMetadata: raise ValueError("ptr must not be null (0)") cdef VgpuPgpuMetadata obj = VgpuPgpuMetadata.__new__(VgpuPgpuMetadata) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlVgpuPgpuMetadata_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating VgpuPgpuMetadata") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuPgpuMetadata_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlVgpuPgpuMetadata_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -23355,26 +23969,16 @@ cdef class GpuInstanceInfo: .. seealso:: `nvmlGpuInstanceInfo_t` """ cdef: + nvmlGpuInstanceInfo_t _data nvmlGpuInstanceInfo_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlGpuInstanceInfo_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating GpuInstanceInfo") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlGpuInstanceInfo_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.GpuInstanceInfo object at {hex(id(self))}>" @@ -23403,14 +24007,22 @@ cdef class GpuInstanceInfo: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlGpuInstanceInfo_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating GpuInstanceInfo") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlGpuInstanceInfo_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This GpuInstanceInfo instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlGpuInstanceInfo_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlGpuInstanceInfo_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlGpuInstanceInfo_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -23491,16 +24103,12 @@ cdef class GpuInstanceInfo: raise ValueError("ptr must not be null (0)") cdef GpuInstanceInfo obj = GpuInstanceInfo.__new__(GpuInstanceInfo) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlGpuInstanceInfo_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating GpuInstanceInfo") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlGpuInstanceInfo_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlGpuInstanceInfo_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -23529,26 +24137,16 @@ cdef class ComputeInstanceInfo: .. seealso:: `nvmlComputeInstanceInfo_t` """ cdef: + nvmlComputeInstanceInfo_t _data nvmlComputeInstanceInfo_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlComputeInstanceInfo_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating ComputeInstanceInfo") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlComputeInstanceInfo_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.ComputeInstanceInfo object at {hex(id(self))}>" @@ -23577,14 +24175,22 @@ cdef class ComputeInstanceInfo: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlComputeInstanceInfo_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating ComputeInstanceInfo") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlComputeInstanceInfo_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This ComputeInstanceInfo instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlComputeInstanceInfo_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlComputeInstanceInfo_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlComputeInstanceInfo_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -23676,16 +24282,12 @@ cdef class ComputeInstanceInfo: raise ValueError("ptr must not be null (0)") cdef ComputeInstanceInfo obj = ComputeInstanceInfo.__new__(ComputeInstanceInfo) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlComputeInstanceInfo_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating ComputeInstanceInfo") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlComputeInstanceInfo_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlComputeInstanceInfo_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -23712,28 +24314,18 @@ cdef class EccSramUniqueUncorrectedErrorCounts_v1: .. seealso:: `nvmlEccSramUniqueUncorrectedErrorCounts_v1_t` """ cdef: + nvmlEccSramUniqueUncorrectedErrorCounts_v1_t _data nvmlEccSramUniqueUncorrectedErrorCounts_v1_t *_ptr object _owner - bint _owned bint _readonly dict _refs def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating EccSramUniqueUncorrectedErrorCounts_v1") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False self._refs = {} - def __dealloc__(self): - cdef nvmlEccSramUniqueUncorrectedErrorCounts_v1_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.EccSramUniqueUncorrectedErrorCounts_v1 object at {hex(id(self))}>" @@ -23762,14 +24354,22 @@ cdef class EccSramUniqueUncorrectedErrorCounts_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating EccSramUniqueUncorrectedErrorCounts_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This EccSramUniqueUncorrectedErrorCounts_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -23832,16 +24432,12 @@ cdef class EccSramUniqueUncorrectedErrorCounts_v1: raise ValueError("ptr must not be null (0)") cdef EccSramUniqueUncorrectedErrorCounts_v1 obj = EccSramUniqueUncorrectedErrorCounts_v1.__new__(EccSramUniqueUncorrectedErrorCounts_v1) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating EccSramUniqueUncorrectedErrorCounts_v1") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly obj._refs = {} return obj @@ -23870,20 +24466,20 @@ cdef class NvlinkFirmwareInfo: cdef: nvmlNvlinkFirmwareInfo_t *_ptr object _owner - bint _owned + bint _owns_ptr bint _readonly def __init__(self): self._ptr = _cyb_calloc(1, sizeof(nvmlNvlinkFirmwareInfo_t)) if self._ptr == NULL: raise MemoryError("Error allocating NvlinkFirmwareInfo") + self._owns_ptr = True self._owner = None - self._owned = True self._readonly = False def __dealloc__(self): cdef nvmlNvlinkFirmwareInfo_t *ptr - if self._owned and self._ptr != NULL: + if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) @@ -23916,14 +24512,20 @@ cdef class NvlinkFirmwareInfo: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlNvlinkFirmwareInfo_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating NvlinkFirmwareInfo") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlNvlinkFirmwareInfo_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This NvlinkFirmwareInfo instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlNvlinkFirmwareInfo_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlNvlinkFirmwareInfo_t), view.len) + ) + _cyb_memmove(self._ptr, view.buf, sizeof(nvmlNvlinkFirmwareInfo_t)) + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -23932,7 +24534,7 @@ cdef class NvlinkFirmwareInfo: """NvlinkFirmwareVersion: OUT - NVLINK firmware version.""" return NvlinkFirmwareVersion.from_ptr( &(self._ptr[0].firmwareVersion), - 100, + self._ptr[0].numValidEntries, readonly=self._readonly, owner=self, ) @@ -23942,20 +24544,12 @@ cdef class NvlinkFirmwareInfo: if self._readonly: raise ValueError("This NvlinkFirmwareInfo instance is read-only") cdef NvlinkFirmwareVersion val_ = val - if len(val) != 100: - raise ValueError(f"Expected length { 100 } for field firmware_version, got {len(val)}") - _cyb_memcpy(&(self._ptr[0].firmwareVersion), (val_._get_ptr()), sizeof(nvmlNvlinkFirmwareVersion_t) * 100) - - @property - def num_valid_entries(self): - """int: OUT - Number of valid firmware entries.""" - return self._ptr[0].numValidEntries - - @num_valid_entries.setter - def num_valid_entries(self, val): - if self._readonly: - raise ValueError("This NvlinkFirmwareInfo instance is read-only") - self._ptr[0].numValidEntries = val + if len(val) > 100: + raise ValueError(f"Expected length < 100 for field firmware_version, got {len(val)}") + self._ptr[0].numValidEntries = len(val) + if len(val) == 0: + return + _cyb_memcpy(&(self._ptr[0].firmwareVersion), (val_._get_ptr()), sizeof(nvmlNvlinkFirmwareVersion_t) * self._ptr[0].numValidEntries) @staticmethod def from_buffer(buffer): @@ -23988,12 +24582,12 @@ cdef class NvlinkFirmwareInfo: if obj._ptr == NULL: raise MemoryError("Error allocating NvlinkFirmwareInfo") _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlNvlinkFirmwareInfo_t)) + obj._owns_ptr = True obj._owner = None - obj._owned = True else: obj._ptr = ptr + obj._owns_ptr = False obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -24023,26 +24617,16 @@ cdef class VgpuSchedulerLogInfo_v2: .. seealso:: `nvmlVgpuSchedulerLogInfo_v2_t` """ cdef: + nvmlVgpuSchedulerLogInfo_v2_t _data nvmlVgpuSchedulerLogInfo_v2_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuSchedulerLogInfo_v2_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuSchedulerLogInfo_v2") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlVgpuSchedulerLogInfo_v2_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.VgpuSchedulerLogInfo_v2 object at {hex(id(self))}>" @@ -24071,14 +24655,22 @@ cdef class VgpuSchedulerLogInfo_v2: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerLogInfo_v2_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuSchedulerLogInfo_v2") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuSchedulerLogInfo_v2_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This VgpuSchedulerLogInfo_v2 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlVgpuSchedulerLogInfo_v2_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlVgpuSchedulerLogInfo_v2_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlVgpuSchedulerLogInfo_v2_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -24183,16 +24775,12 @@ cdef class VgpuSchedulerLogInfo_v2: raise ValueError("ptr must not be null (0)") cdef VgpuSchedulerLogInfo_v2 obj = VgpuSchedulerLogInfo_v2.__new__(VgpuSchedulerLogInfo_v2) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerLogInfo_v2_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating VgpuSchedulerLogInfo_v2") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerLogInfo_v2_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlVgpuSchedulerLogInfo_v2_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -24219,26 +24807,16 @@ cdef class GetCPER_v1: .. seealso:: `nvmlGetCPER_v1_t` """ cdef: + nvmlGetCPER_v1_t _data nvmlGetCPER_v1_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlGetCPER_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating GetCPER_v1") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlGetCPER_v1_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.GetCPER_v1 object at {hex(id(self))}>" @@ -24267,14 +24845,22 @@ cdef class GetCPER_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlGetCPER_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating GetCPER_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlGetCPER_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This GetCPER_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlGetCPER_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlGetCPER_v1_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlGetCPER_v1_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -24343,16 +24929,12 @@ cdef class GetCPER_v1: raise ValueError("ptr must not be null (0)") cdef GetCPER_v1 obj = GetCPER_v1.__new__(GetCPER_v1) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlGetCPER_v1_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating GetCPER_v1") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlGetCPER_v1_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlGetCPER_v1_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -24405,9 +24987,10 @@ cdef class CoreRailMetrics: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -24554,9 +25137,10 @@ cdef class PwrModelMetricsPfpp1x: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -24661,13 +25245,13 @@ cdef class PwrModelMetricsPfpp1x: raise ValueError("data array must be of dtype pwr_model_metrics_pfpp1x_dtype") obj._data = data.view(_numpy.recarray) - estimatedMetrics_list = list() + estimated_metrics_list = list() for i in range(obj._data.size): - addr = obj._data.estimatedMetrics[i].__array_interface__['data'][0] + addr = obj._data.estimated_metrics[i].__array_interface__['data'][0] n = int(obj._data.num_vf_points[i]) - estimatedMetrics_obj = PwrModelMetricsSamplePfpp1x.from_ptr(addr, n, owner=obj, readonly=False) - estimatedMetrics_list.append(estimatedMetrics_obj) - obj._estimatedMetrics = tuple(estimatedMetrics_list) + estimated_metrics_obj = PwrModelMetricsSamplePfpp1x.from_ptr(addr, n, owner=obj, readonly=False) + estimated_metrics_list.append(estimated_metrics_obj) + obj._estimated_metrics = tuple(estimated_metrics_list) return obj @staticmethod @@ -24691,13 +25275,13 @@ cdef class PwrModelMetricsPfpp1x: obj._data = data.view(_numpy.recarray) obj._owner = owner - estimatedMetrics_list = list() + estimated_metrics_list = list() for i in range(obj._data.size): - addr = obj._data.estimatedMetrics[i].__array_interface__['data'][0] + addr = obj._data.estimated_metrics[i].__array_interface__['data'][0] n = int(obj._data.num_vf_points[i]) - estimatedMetrics_obj = PwrModelMetricsSamplePfpp1x.from_ptr(addr, n, owner=obj, readonly=readonly) - estimatedMetrics_list.append(estimatedMetrics_obj) - obj._estimatedMetrics = tuple(estimatedMetrics_list) + estimated_metrics_obj = PwrModelMetricsSamplePfpp1x.from_ptr(addr, n, owner=obj, readonly=readonly) + estimated_metrics_list.append(estimated_metrics_obj) + obj._estimated_metrics = tuple(estimated_metrics_list) return obj @@ -24727,26 +25311,16 @@ cdef class GpuFabricInfo_v4: .. seealso:: `nvmlGpuFabricInfo_v4_t` """ cdef: + nvmlGpuFabricInfo_v4_t _data nvmlGpuFabricInfo_v4_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlGpuFabricInfo_v4_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating GpuFabricInfo_v4") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlGpuFabricInfo_v4_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.GpuFabricInfo_v4 object at {hex(id(self))}>" @@ -24775,14 +25349,22 @@ cdef class GpuFabricInfo_v4: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlGpuFabricInfo_v4_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating GpuFabricInfo_v4") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlGpuFabricInfo_v4_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This GpuFabricInfo_v4 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlGpuFabricInfo_v4_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlGpuFabricInfo_v4_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlGpuFabricInfo_v4_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -24903,16 +25485,12 @@ cdef class GpuFabricInfo_v4: raise ValueError("ptr must not be null (0)") cdef GpuFabricInfo_v4 obj = GpuFabricInfo_v4.__new__(GpuFabricInfo_v4) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlGpuFabricInfo_v4_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating GpuFabricInfo_v4") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlGpuFabricInfo_v4_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlGpuFabricInfo_v4_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -24938,28 +25516,18 @@ cdef class NvlinkTelemetrySamples_v1: .. seealso:: `nvmlNvlinkTelemetrySamples_v1_t` """ cdef: + nvmlNvlinkTelemetrySamples_v1_t _data nvmlNvlinkTelemetrySamples_v1_t *_ptr object _owner - bint _owned bint _readonly dict _refs def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlNvlinkTelemetrySamples_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating NvlinkTelemetrySamples_v1") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False self._refs = {} - def __dealloc__(self): - cdef nvmlNvlinkTelemetrySamples_v1_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.NvlinkTelemetrySamples_v1 object at {hex(id(self))}>" @@ -24988,14 +25556,22 @@ cdef class NvlinkTelemetrySamples_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlNvlinkTelemetrySamples_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating NvlinkTelemetrySamples_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlNvlinkTelemetrySamples_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This NvlinkTelemetrySamples_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlNvlinkTelemetrySamples_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlNvlinkTelemetrySamples_v1_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlNvlinkTelemetrySamples_v1_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -25047,16 +25623,12 @@ cdef class NvlinkTelemetrySamples_v1: raise ValueError("ptr must not be null (0)") cdef NvlinkTelemetrySamples_v1 obj = NvlinkTelemetrySamples_v1.__new__(NvlinkTelemetrySamples_v1) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlNvlinkTelemetrySamples_v1_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating NvlinkTelemetrySamples_v1") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlNvlinkTelemetrySamples_v1_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlNvlinkTelemetrySamples_v1_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly obj._refs = {} return obj @@ -25085,26 +25657,16 @@ cdef class EccBankRemapperStatus_v1: .. seealso:: `nvmlEccBankRemapperStatus_v1_t` """ cdef: + nvmlEccBankRemapperStatus_v1_t _data nvmlEccBankRemapperStatus_v1_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlEccBankRemapperStatus_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating EccBankRemapperStatus_v1") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlEccBankRemapperStatus_v1_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.EccBankRemapperStatus_v1 object at {hex(id(self))}>" @@ -25133,14 +25695,22 @@ cdef class EccBankRemapperStatus_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlEccBankRemapperStatus_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating EccBankRemapperStatus_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlEccBankRemapperStatus_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This EccBankRemapperStatus_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlEccBankRemapperStatus_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlEccBankRemapperStatus_v1_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlEccBankRemapperStatus_v1_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -25220,16 +25790,12 @@ cdef class EccBankRemapperStatus_v1: raise ValueError("ptr must not be null (0)") cdef EccBankRemapperStatus_v1 obj = EccBankRemapperStatus_v1.__new__(EccBankRemapperStatus_v1) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlEccBankRemapperStatus_v1_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating EccBankRemapperStatus_v1") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlEccBankRemapperStatus_v1_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlEccBankRemapperStatus_v1_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -25258,28 +25824,18 @@ cdef class VgpuInstancesUtilizationInfo_v1: .. seealso:: `nvmlVgpuInstancesUtilizationInfo_v1_t` """ cdef: + nvmlVgpuInstancesUtilizationInfo_v1_t _data nvmlVgpuInstancesUtilizationInfo_v1_t *_ptr object _owner - bint _owned bint _readonly dict _refs def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuInstancesUtilizationInfo_v1") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False self._refs = {} - def __dealloc__(self): - cdef nvmlVgpuInstancesUtilizationInfo_v1_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.VgpuInstancesUtilizationInfo_v1 object at {hex(id(self))}>" @@ -25308,14 +25864,22 @@ cdef class VgpuInstancesUtilizationInfo_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuInstancesUtilizationInfo_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This VgpuInstancesUtilizationInfo_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -25400,16 +25964,12 @@ cdef class VgpuInstancesUtilizationInfo_v1: raise ValueError("ptr must not be null (0)") cdef VgpuInstancesUtilizationInfo_v1 obj = VgpuInstancesUtilizationInfo_v1.__new__(VgpuInstancesUtilizationInfo_v1) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating VgpuInstancesUtilizationInfo_v1") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly obj._refs = {} return obj @@ -25465,9 +26025,10 @@ cdef class PRMCounter_v1: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -25605,26 +26166,16 @@ cdef class VgpuSchedulerLog: .. seealso:: `nvmlVgpuSchedulerLog_t` """ cdef: + nvmlVgpuSchedulerLog_t _data nvmlVgpuSchedulerLog_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuSchedulerLog_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuSchedulerLog") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlVgpuSchedulerLog_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.VgpuSchedulerLog object at {hex(id(self))}>" @@ -25653,14 +26204,22 @@ cdef class VgpuSchedulerLog: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerLog_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuSchedulerLog") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuSchedulerLog_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This VgpuSchedulerLog instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlVgpuSchedulerLog_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlVgpuSchedulerLog_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlVgpuSchedulerLog_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -25770,16 +26329,12 @@ cdef class VgpuSchedulerLog: raise ValueError("ptr must not be null (0)") cdef VgpuSchedulerLog obj = VgpuSchedulerLog.__new__(VgpuSchedulerLog) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerLog_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating VgpuSchedulerLog") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerLog_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlVgpuSchedulerLog_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -25806,26 +26361,16 @@ cdef class VgpuSchedulerGetState: .. seealso:: `nvmlVgpuSchedulerGetState_t` """ cdef: + nvmlVgpuSchedulerGetState_t _data nvmlVgpuSchedulerGetState_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuSchedulerGetState_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuSchedulerGetState") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlVgpuSchedulerGetState_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.VgpuSchedulerGetState object at {hex(id(self))}>" @@ -25854,14 +26399,22 @@ cdef class VgpuSchedulerGetState: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerGetState_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuSchedulerGetState") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuSchedulerGetState_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This VgpuSchedulerGetState instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlVgpuSchedulerGetState_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlVgpuSchedulerGetState_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlVgpuSchedulerGetState_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -25930,16 +26483,12 @@ cdef class VgpuSchedulerGetState: raise ValueError("ptr must not be null (0)") cdef VgpuSchedulerGetState obj = VgpuSchedulerGetState.__new__(VgpuSchedulerGetState) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerGetState_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating VgpuSchedulerGetState") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerGetState_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlVgpuSchedulerGetState_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -25968,26 +26517,16 @@ cdef class VgpuSchedulerStateInfo_v1: .. seealso:: `nvmlVgpuSchedulerStateInfo_v1_t` """ cdef: + nvmlVgpuSchedulerStateInfo_v1_t _data nvmlVgpuSchedulerStateInfo_v1_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuSchedulerStateInfo_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuSchedulerStateInfo_v1") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlVgpuSchedulerStateInfo_v1_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.VgpuSchedulerStateInfo_v1 object at {hex(id(self))}>" @@ -26016,14 +26555,22 @@ cdef class VgpuSchedulerStateInfo_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerStateInfo_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuSchedulerStateInfo_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuSchedulerStateInfo_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This VgpuSchedulerStateInfo_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlVgpuSchedulerStateInfo_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlVgpuSchedulerStateInfo_v1_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlVgpuSchedulerStateInfo_v1_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -26114,16 +26661,12 @@ cdef class VgpuSchedulerStateInfo_v1: raise ValueError("ptr must not be null (0)") cdef VgpuSchedulerStateInfo_v1 obj = VgpuSchedulerStateInfo_v1.__new__(VgpuSchedulerStateInfo_v1) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerStateInfo_v1_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating VgpuSchedulerStateInfo_v1") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerStateInfo_v1_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlVgpuSchedulerStateInfo_v1_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -26154,26 +26697,16 @@ cdef class VgpuSchedulerLogInfo_v1: .. seealso:: `nvmlVgpuSchedulerLogInfo_v1_t` """ cdef: + nvmlVgpuSchedulerLogInfo_v1_t _data nvmlVgpuSchedulerLogInfo_v1_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuSchedulerLogInfo_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuSchedulerLogInfo_v1") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlVgpuSchedulerLogInfo_v1_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.VgpuSchedulerLogInfo_v1 object at {hex(id(self))}>" @@ -26202,14 +26735,22 @@ cdef class VgpuSchedulerLogInfo_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerLogInfo_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuSchedulerLogInfo_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuSchedulerLogInfo_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This VgpuSchedulerLogInfo_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlVgpuSchedulerLogInfo_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlVgpuSchedulerLogInfo_v1_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlVgpuSchedulerLogInfo_v1_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -26330,16 +26871,12 @@ cdef class VgpuSchedulerLogInfo_v1: raise ValueError("ptr must not be null (0)") cdef VgpuSchedulerLogInfo_v1 obj = VgpuSchedulerLogInfo_v1.__new__(VgpuSchedulerLogInfo_v1) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerLogInfo_v1_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating VgpuSchedulerLogInfo_v1") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerLogInfo_v1_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlVgpuSchedulerLogInfo_v1_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -26368,26 +26905,16 @@ cdef class VgpuSchedulerState_v1: .. seealso:: `nvmlVgpuSchedulerState_v1_t` """ cdef: + nvmlVgpuSchedulerState_v1_t _data nvmlVgpuSchedulerState_v1_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlVgpuSchedulerState_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuSchedulerState_v1") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlVgpuSchedulerState_v1_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.VgpuSchedulerState_v1 object at {hex(id(self))}>" @@ -26416,14 +26943,22 @@ cdef class VgpuSchedulerState_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerState_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating VgpuSchedulerState_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlVgpuSchedulerState_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This VgpuSchedulerState_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlVgpuSchedulerState_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlVgpuSchedulerState_v1_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlVgpuSchedulerState_v1_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -26514,16 +27049,12 @@ cdef class VgpuSchedulerState_v1: raise ValueError("ptr must not be null (0)") cdef VgpuSchedulerState_v1 obj = VgpuSchedulerState_v1.__new__(VgpuSchedulerState_v1) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerState_v1_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating VgpuSchedulerState_v1") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerState_v1_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlVgpuSchedulerState_v1_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -26550,26 +27081,16 @@ cdef class GridLicensableFeatures: .. seealso:: `nvmlGridLicensableFeatures_t` """ cdef: + nvmlGridLicensableFeatures_t _data nvmlGridLicensableFeatures_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlGridLicensableFeatures_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating GridLicensableFeatures") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlGridLicensableFeatures_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.GridLicensableFeatures object at {hex(id(self))}>" @@ -26598,14 +27119,22 @@ cdef class GridLicensableFeatures: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlGridLicensableFeatures_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating GridLicensableFeatures") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlGridLicensableFeatures_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This GridLicensableFeatures instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlGridLicensableFeatures_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlGridLicensableFeatures_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlGridLicensableFeatures_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -26669,16 +27198,12 @@ cdef class GridLicensableFeatures: raise ValueError("ptr must not be null (0)") cdef GridLicensableFeatures obj = GridLicensableFeatures.__new__(GridLicensableFeatures) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlGridLicensableFeatures_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating GridLicensableFeatures") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlGridLicensableFeatures_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlGridLicensableFeatures_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -26705,26 +27230,16 @@ cdef class NvLinkInfo_v2: .. seealso:: `nvmlNvLinkInfo_v2_t` """ cdef: + nvmlNvLinkInfo_v2_t _data nvmlNvLinkInfo_v2_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlNvLinkInfo_v2_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating NvLinkInfo_v2") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlNvLinkInfo_v2_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.NvLinkInfo_v2 object at {hex(id(self))}>" @@ -26753,14 +27268,22 @@ cdef class NvLinkInfo_v2: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlNvLinkInfo_v2_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating NvLinkInfo_v2") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlNvLinkInfo_v2_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This NvLinkInfo_v2 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlNvLinkInfo_v2_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlNvLinkInfo_v2_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlNvLinkInfo_v2_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -26829,16 +27352,12 @@ cdef class NvLinkInfo_v2: raise ValueError("ptr must not be null (0)") cdef NvLinkInfo_v2 obj = NvLinkInfo_v2.__new__(NvLinkInfo_v2) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlNvLinkInfo_v2_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating NvLinkInfo_v2") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlNvLinkInfo_v2_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlNvLinkInfo_v2_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -26895,9 +27414,10 @@ cdef class PwrModelMetricsDlppm1x: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -27076,9 +27596,10 @@ cdef class PerfMetricsPfpp1xSample: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -27221,9 +27742,10 @@ cdef class PwrModelMetricsDlppm1xDramclkEstimates: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -27288,13 +27810,13 @@ cdef class PwrModelMetricsDlppm1xDramclkEstimates: raise ValueError("data array must be of dtype pwr_model_metrics_dlppm1x_dramclk_estimates_dtype") obj._data = data.view(_numpy.recarray) - estimatedMetrics_list = list() + estimated_metrics_list = list() for i in range(obj._data.size): - addr = obj._data.estimatedMetrics[i].__array_interface__['data'][0] + addr = obj._data.estimated_metrics[i].__array_interface__['data'][0] n = int(obj._data.num_estimated_metrics[i]) - estimatedMetrics_obj = PwrModelMetricsDlppm1x.from_ptr(addr, n, owner=obj, readonly=False) - estimatedMetrics_list.append(estimatedMetrics_obj) - obj._estimatedMetrics = tuple(estimatedMetrics_list) + estimated_metrics_obj = PwrModelMetricsDlppm1x.from_ptr(addr, n, owner=obj, readonly=False) + estimated_metrics_list.append(estimated_metrics_obj) + obj._estimated_metrics = tuple(estimated_metrics_list) return obj @staticmethod @@ -27318,13 +27840,13 @@ cdef class PwrModelMetricsDlppm1xDramclkEstimates: obj._data = data.view(_numpy.recarray) obj._owner = owner - estimatedMetrics_list = list() + estimated_metrics_list = list() for i in range(obj._data.size): - addr = obj._data.estimatedMetrics[i].__array_interface__['data'][0] + addr = obj._data.estimated_metrics[i].__array_interface__['data'][0] n = int(obj._data.num_estimated_metrics[i]) - estimatedMetrics_obj = PwrModelMetricsDlppm1x.from_ptr(addr, n, owner=obj, readonly=readonly) - estimatedMetrics_list.append(estimatedMetrics_obj) - obj._estimatedMetrics = tuple(estimatedMetrics_list) + estimated_metrics_obj = PwrModelMetricsDlppm1x.from_ptr(addr, n, owner=obj, readonly=readonly) + estimated_metrics_list.append(estimated_metrics_obj) + obj._estimated_metrics = tuple(estimated_metrics_list) return obj @@ -27381,9 +27903,10 @@ cdef class ObservedMetrics: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -27571,9 +28094,10 @@ cdef class PerfMetricsDlppc2xSample: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -27689,20 +28213,20 @@ cdef class _py_anon_pod8: cdef: cuda_bindings_nvml__anon_pod8 *_ptr object _owner - bint _owned + bint _owns_ptr bint _readonly def __init__(self): self._ptr = _cyb_calloc(1, sizeof(cuda_bindings_nvml__anon_pod8)) if self._ptr == NULL: raise MemoryError("Error allocating _py_anon_pod8") + self._owns_ptr = True self._owner = None - self._owned = True self._readonly = False def __dealloc__(self): cdef cuda_bindings_nvml__anon_pod8 *ptr - if self._owned and self._ptr != NULL: + if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) @@ -27735,14 +28259,20 @@ cdef class _py_anon_pod8: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(cuda_bindings_nvml__anon_pod8)) - if self._ptr == NULL: - raise MemoryError("Error allocating _py_anon_pod8") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(cuda_bindings_nvml__anon_pod8)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This _py_anon_pod8 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(cuda_bindings_nvml__anon_pod8): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(cuda_bindings_nvml__anon_pod8), view.len) + ) + _cyb_memmove(self._ptr, view.buf, sizeof(cuda_bindings_nvml__anon_pod8)) + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -27811,12 +28341,12 @@ cdef class _py_anon_pod8: if obj._ptr == NULL: raise MemoryError("Error allocating _py_anon_pod8") _cyb_memcpy((obj._ptr), ptr, sizeof(cuda_bindings_nvml__anon_pod8)) + obj._owns_ptr = True obj._owner = None - obj._owned = True else: obj._ptr = ptr + obj._owns_ptr = False obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -27870,9 +28400,10 @@ cdef class PerfMetricControllerSample: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -28026,9 +28557,10 @@ cdef class PerfMetricsSample: return self._data.ctypes.data def __int__(self): - if self._data.size > 1: - raise TypeError("int() argument must be a bytes-like object of size 1. " - "To get the pointer address of an array, use .ptr") + if self._data.size > 1 and not self._data.flags["C_CONTIGUOUS"]: + raise TypeError("int() argument must be a bytes-like object of size 1, or a " + "C-contiguous array. To get the pointer address of a " + "non-contiguous array, use .ptr") return self._data.ctypes.data def __len__(self): @@ -28093,13 +28625,13 @@ cdef class PerfMetricsSample: raise ValueError("data array must be of dtype perf_metrics_sample_dtype") obj._data = data.view(_numpy.recarray) - controllerData_list = list() + controller_data_list = list() for i in range(obj._data.size): - addr = obj._data.controllerData[i].__array_interface__['data'][0] + addr = obj._data.controller_data[i].__array_interface__['data'][0] n = int(obj._data.num_controller_data[i]) - controllerData_obj = PerfMetricControllerSample.from_ptr(addr, n, owner=obj, readonly=False) - controllerData_list.append(controllerData_obj) - obj._controllerData = tuple(controllerData_list) + controller_data_obj = PerfMetricControllerSample.from_ptr(addr, n, owner=obj, readonly=False) + controller_data_list.append(controller_data_obj) + obj._controller_data = tuple(controller_data_list) return obj @staticmethod @@ -28123,13 +28655,13 @@ cdef class PerfMetricsSample: obj._data = data.view(_numpy.recarray) obj._owner = owner - controllerData_list = list() + controller_data_list = list() for i in range(obj._data.size): - addr = obj._data.controllerData[i].__array_interface__['data'][0] + addr = obj._data.controller_data[i].__array_interface__['data'][0] n = int(obj._data.num_controller_data[i]) - controllerData_obj = PerfMetricControllerSample.from_ptr(addr, n, owner=obj, readonly=readonly) - controllerData_list.append(controllerData_obj) - obj._controllerData = tuple(controllerData_list) + controller_data_obj = PerfMetricControllerSample.from_ptr(addr, n, owner=obj, readonly=readonly) + controller_data_list.append(controller_data_obj) + obj._controller_data = tuple(controller_data_list) return obj @@ -28154,26 +28686,16 @@ cdef class PerfMetricsSamples_v1: .. seealso:: `nvmlPerfMetricsSamples_v1_t` """ cdef: + nvmlPerfMetricsSamples_v1_t _data nvmlPerfMetricsSamples_v1_t *_ptr object _owner - bint _owned bint _readonly def __init__(self): - self._ptr = _cyb_calloc(1, sizeof(nvmlPerfMetricsSamples_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating PerfMetricsSamples_v1") + self._ptr = &self._data self._owner = None - self._owned = True self._readonly = False - def __dealloc__(self): - cdef nvmlPerfMetricsSamples_v1_t *ptr - if self._owned and self._ptr != NULL: - ptr = self._ptr - self._ptr = NULL - _cyb_free(ptr) - def __repr__(self): return f"<{__name__}.PerfMetricsSamples_v1 object at {hex(id(self))}>" @@ -28202,14 +28724,22 @@ cdef class PerfMetricsSamples_v1: pass def __setitem__(self, key, val): - if key == 0 and isinstance(val, _numpy.ndarray): - self._ptr = _cyb_malloc(sizeof(nvmlPerfMetricsSamples_v1_t)) - if self._ptr == NULL: - raise MemoryError("Error allocating PerfMetricsSamples_v1") - _cyb_memcpy(self._ptr, val.ctypes.data, sizeof(nvmlPerfMetricsSamples_v1_t)) - self._owner = None - self._owned = True - self._readonly = not val.flags.writeable + cdef _cyb_Py_buffer view + if key == 0: + if self._readonly: + raise ValueError("This PerfMetricsSamples_v1 instance is read-only") + _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) + try: + if view.len < sizeof(nvmlPerfMetricsSamples_v1_t): + raise ValueError( + "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlPerfMetricsSamples_v1_t), view.len) + ) + _cyb_memmove(&self._data, view.buf, sizeof(nvmlPerfMetricsSamples_v1_t)) + self._ptr = &self._data + self._owner = None + self._readonly = view.readonly != 0 + finally: + _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @@ -28262,16 +28792,12 @@ cdef class PerfMetricsSamples_v1: raise ValueError("ptr must not be null (0)") cdef PerfMetricsSamples_v1 obj = PerfMetricsSamples_v1.__new__(PerfMetricsSamples_v1) if owner is None: - obj._ptr = _cyb_malloc(sizeof(nvmlPerfMetricsSamples_v1_t)) - if obj._ptr == NULL: - raise MemoryError("Error allocating PerfMetricsSamples_v1") - _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlPerfMetricsSamples_v1_t)) + _cyb_memcpy(&obj._data, ptr, sizeof(nvmlPerfMetricsSamples_v1_t)) + obj._ptr = &obj._data obj._owner = None - obj._owned = True else: obj._ptr = ptr obj._owner = owner - obj._owned = False obj._readonly = readonly return obj @@ -28279,6 +28805,18 @@ cdef class PerfMetricsSamples_v1: cpdef init_v2(): """Initialize the NVML Library lazily, without allocating any device state. + This will initialize the NVML Library state without enumerating any discovered + devices. This will allow NVML to communicate with a device, even if other + devices are in an unstable or bad state. Enumeration of a device can be done by + obtaining the device handle via the nvmlDeviceGetHandleBy* class of APIs. + This method needs to be called once before any usage of NVML Library APIs. + For all products. + + .. note:: + A reference count of the number of initializations is maintained, and a + corresponding call to :func:`shutdown` needs to be issued once usage of the + NVML Library is complete. Shutdown will only occur after the reference count + reaches zero. .. seealso:: `nvmlInit_v2` """ with nogil: @@ -28289,10 +28827,24 @@ cpdef init_v2(): cpdef init_with_flags(unsigned int flags): """Initialize the NVML Library lazily, without allocating any device state, with additional init flags. + A variant of :func:`init_v2`, this will initialize the NVML Library state + without enumerating any discovered devices. An option to pass in additional + flags is provided to modify the behavior of NVML Library init. The usage of + these flags can be obtained from NVML_INIT_FLAG_*. These flags can be combined + together. + Other than the "flags" parameter, this method is completely identical to + :func:`init_v2`. + For all products. + Args: - flags (unsigned int): NVML_INIT_FLAG_* flags that can modify - NVML Init behavior. + flags (unsigned int): NVML_INIT_FLAG_* flags that can modify NVML + Init behavior. + .. note:: + A reference count of the number of initializations is maintained, and a + corresponding call to :func:`shutdown` needs to be issued once usage of the + NVML Library is complete. Shutdown will only occur after the reference count + reaches zero. .. seealso:: `nvmlInitWithFlags` """ with nogil: @@ -28303,6 +28855,15 @@ cpdef init_with_flags(unsigned int flags): cpdef shutdown(): """Shut down and cleanup NVML Library state. + This will shut down and cleanup NVML Library state by releasing all device and + library resources previously allocated with :func:`init_v2` or + :func:`init_with_flags`. This should be called after all NVML work is done, and + once for each call to :func:`init_v2` or :func:`init_with_flags`. + Complete shutdown will only occur when the reference count of all prior NVML + initializations reaches zero. No error will be reported if this is called more + times than :func:`init_v2` or :func:`init_with_flags`. + For all products. + .. seealso:: `nvmlShutdown` """ with nogil: @@ -28313,6 +28874,8 @@ cpdef shutdown(): cpdef str error_string(int result): """Helper method for converting NVML error codes into readable strings. + For all products. + Args: result (Return): NVML error code to convert. @@ -28329,6 +28892,11 @@ cpdef str error_string(int result): cpdef str system_get_driver_version(): """Retrieves the version of the system's graphics driver. + For all products. + The version identifier is an alphanumeric string. It will not exceed 80 + characters in length (including the NULL terminator). See + nvmlConstants::NVML_SYSTEM_DRIVER_VERSION_BUFFER_SIZE. + Returns: char: Reference in which to return the version identifier. @@ -28345,6 +28913,11 @@ cpdef str system_get_driver_version(): cpdef str system_get_nvml_version(): """Retrieves the version of the NVML library. + For all products. + The version identifier is an alphanumeric string. It will not exceed 80 + characters in length (including the NULL terminator). See + nvmlConstants::NVML_SYSTEM_NVML_VERSION_BUFFER_SIZE. + Returns: char: Reference in which to return the version identifier. @@ -28361,6 +28934,11 @@ cpdef str system_get_nvml_version(): cpdef int system_get_cuda_driver_version() except *: """Retrieves the version of the CUDA driver. + For all products. + The CUDA driver version returned will be retreived from the currently installed + version of CUDA. If the cuda library is not found, this function will return a + known supported version number. + Returns: int: Reference in which to return the version identifier. @@ -28376,6 +28954,9 @@ cpdef int system_get_cuda_driver_version() except *: cpdef int system_get_cuda_driver_version_v2() except 0: """Retrieves the version of the CUDA driver from the shared library. + For all products. + The returned CUDA driver version by calling cuDriverGetVersion(). + Returns: int: Reference in which to return the version identifier. @@ -28391,6 +28972,10 @@ cpdef int system_get_cuda_driver_version_v2() except 0: cpdef str system_get_process_name(unsigned int pid): """Gets name of the process with provided process id. + For all products. + Returned process name is cropped to provided length. name string is encoded in + ANSI. + Args: pid (unsigned int): The identifier of the process. @@ -28410,6 +28995,11 @@ cpdef str system_get_process_name(unsigned int pid): cpdef object system_get_hic_version(): """Retrieves the IDs and firmware versions for any Host Interface Cards (HICs) in the system. + For S-class products. + The ``hwbc_count`` argument is expected to be set to the size of the input + ``hwbc_entries`` array. The HIC must be connected to an S-class system for it + to be reported by this function. + Returns: nvmlHwbcEntry_t: Array holding information about hwbc. @@ -28421,20 +29011,47 @@ cpdef object system_get_hic_version(): check_status_size(__status__) cdef HwbcEntry hwbc_entries = HwbcEntry(hwbc_count[0]) cdef nvmlHwbcEntry_t *hwbc_entries_ptr = (hwbc_entries._get_ptr()) - if hwbc_count[0] == 0: - return hwbc_entries + if hwbc_count[0] != 0: + with nogil: + __status__ = nvmlSystemGetHicVersion(hwbc_count, hwbc_entries_ptr) + check_status(__status__) + return hwbc_entries[:hwbc_count[0]] + + +cpdef object system_get_topology_gpu_set(unsigned int cpu_number): + """Retrieve the set of GPUs that have a CPU affinity with the given CPU number For all products. Supported on Linux only. + + + Args: + cpu_number (unsigned int): The CPU number. + + Returns: + intptr_t: An array of device handles for GPUs found with affinity + to ``cpu_number``. + + .. seealso:: `nvmlSystemGetTopologyGpuSet` + """ + cdef unsigned int[1] count = [0] with nogil: - __status__ = nvmlSystemGetHicVersion(hwbc_count, hwbc_entries_ptr) - check_status(__status__) - return hwbc_entries + __status__ = nvmlSystemGetTopologyGpuSet(cpu_number, count, NULL) + check_status_size(__status__) + cdef _cyb_view.array _device_array_alloc_ = _cyb_view.array(shape=(max(count[0], 1),), itemsize=sizeof(intptr_t), format="q", mode="c") + cdef intptr_t *device_array_ptr = (_device_array_alloc_.data) + cdef object device_array = _device_array_alloc_[:count[0]] + if count[0] != 0: + with nogil: + __status__ = nvmlSystemGetTopologyGpuSet(cpu_number, count, device_array_ptr) + check_status(__status__) + return device_array[:count[0]] cpdef unsigned int unit_get_count() except? 0: """Retrieves the number of units in the system. + For S-class products. + Returns: - unsigned int: Reference in which to return the number of - units. + unsigned int: Reference in which to return the number of units. .. seealso:: `nvmlUnitGetCount` """ @@ -28448,6 +29065,13 @@ cpdef unsigned int unit_get_count() except? 0: cpdef intptr_t unit_get_handle_by_index(unsigned int index) except? 0: """Acquire the handle for a particular unit, based on its index. + For S-class products. + Valid indices are derived from the ``unitCount`` returned by + :func:`unit_get_count`. For example, if ``unitCount`` is 2 the valid indices + are 0 and 1, corresponding to UNIT 0 and UNIT 1. + The order in which NVML enumerates units has no guarantees of consistency + between reboots. + Args: index (unsigned int): The index of the target unit, >= 0 and < ``unitCount``. @@ -28467,12 +29091,14 @@ cpdef intptr_t unit_get_handle_by_index(unsigned int index) except? 0: cpdef object unit_get_unit_info(intptr_t unit): """Retrieves the static information associated with a unit. + For S-class products. + See ``nvmlUnitInfo_t`` for details on available unit info. + Args: unit (intptr_t): The identifier of the target unit. Returns: - nvmlUnitInfo_t: Reference in which to return the unit - information. + nvmlUnitInfo_t: Reference in which to return the unit information. .. seealso:: `nvmlUnitGetUnitInfo` """ @@ -28487,6 +29113,9 @@ cpdef object unit_get_unit_info(intptr_t unit): cpdef object unit_get_led_state(intptr_t unit): """Retrieves the LED state associated with this unit. + For S-class products. + See ``nvmlLedState_t`` for details on allowed states. + Args: unit (intptr_t): The identifier of the target unit. @@ -28507,12 +29136,14 @@ cpdef object unit_get_led_state(intptr_t unit): cpdef object unit_get_psu_info(intptr_t unit): """Retrieves the PSU stats for the unit. + For S-class products. + See ``nvmlPSUInfo_t`` for details on available PSU info. + Args: unit (intptr_t): The identifier of the target unit. Returns: - nvmlPSUInfo_t: Reference in which to return the PSU - information. + nvmlPSUInfo_t: Reference in which to return the PSU information. .. seealso:: `nvmlUnitGetPsuInfo` """ @@ -28527,13 +29158,16 @@ cpdef object unit_get_psu_info(intptr_t unit): cpdef unsigned int unit_get_temperature(intptr_t unit, unsigned int type) except? 0: """Retrieves the temperature readings for the unit, in degrees C. + For S-class products. + Depending on the product, readings may be available for intake (type=0), + exhaust (type=1) and board (type=2). + Args: unit (intptr_t): The identifier of the target unit. type (unsigned int): The type of reading to take. Returns: - unsigned int: Reference in which to return the intake - temperature. + unsigned int: Reference in which to return the intake temperature. .. seealso:: `nvmlUnitGetTemperature` """ @@ -28547,12 +29181,15 @@ cpdef unsigned int unit_get_temperature(intptr_t unit, unsigned int type) except cpdef object unit_get_fan_speed_info(intptr_t unit): """Retrieves the fan speed readings for the unit. + For S-class products. + See ``nvmlUnitFanSpeeds_t`` for details on available fan speed info. + Args: unit (intptr_t): The identifier of the target unit. Returns: - nvmlUnitFanSpeeds_t: Reference in which to return the fan - speed information. + nvmlUnitFanSpeeds_t: Reference in which to return the fan speed + information. .. seealso:: `nvmlUnitGetFanSpeedInfo` """ @@ -28564,9 +29201,48 @@ cpdef object unit_get_fan_speed_info(intptr_t unit): return fan_speeds_py +cpdef object unit_get_devices(intptr_t unit): + """Retrieves the set of GPU devices that are attached to the specified unit. + + For S-class products. + The ``device_count`` argument is expected to be set to the size of the input + ``devices`` array. + + Args: + unit (intptr_t): The identifier of the target unit. + + Returns: + intptr_t: Reference in which to return the references to the + attached GPU devices. + + .. seealso:: `nvmlUnitGetDevices` + """ + cdef unsigned int[1] device_count = [0] + with nogil: + __status__ = nvmlUnitGetDevices(unit, device_count, NULL) + check_status_size(__status__) + cdef _cyb_view.array _devices_alloc_ = _cyb_view.array(shape=(max(device_count[0], 1),), itemsize=sizeof(intptr_t), format="q", mode="c") + cdef intptr_t *devices_ptr = (_devices_alloc_.data) + cdef object devices = _devices_alloc_[:device_count[0]] + if device_count[0] != 0: + with nogil: + __status__ = nvmlUnitGetDevices(unit, device_count, devices_ptr) + check_status(__status__) + return devices[:device_count[0]] + + cpdef unsigned int device_get_count_v2() except? 0: """Retrieves the number of compute devices in the system. A compute device is a single GPU. + For all products. + Note: New nvmlDeviceGetCount_v2 (default in NVML 5.319) returns count of all + devices in the system even if nvmlDeviceGetHandleByIndex_v2 returns + NVML_ERROR_NO_PERMISSION for such device. Update your code to handle this + error, or use NVML 4.304 or older nvml header file. For backward binary + compatibility reasons _v1 version of the API is still present in the shared + library. Old _v1 version of nvmlDeviceGetCount doesn't count devices that NVML + has no permission to talk to. + Returns: unsigned int: Reference in which to return the number of accessible devices. @@ -28583,12 +29259,16 @@ cpdef unsigned int device_get_count_v2() except? 0: cpdef object device_get_attributes_v2(intptr_t device): """Get attributes (engine counts etc.) for the given NVML device handle. + For Ampere ™️ or newer fully supported devices. Supported on Linux only. + Args: device (intptr_t): NVML device handle. Returns: nvmlDeviceAttributes_t: Device attributes. + .. note:: + This API currently only supports MIG device handles. .. seealso:: `nvmlDeviceGetAttributes_v2` """ cdef DeviceAttributes attributes_py = DeviceAttributes() @@ -28602,6 +29282,33 @@ cpdef object device_get_attributes_v2(intptr_t device): cpdef intptr_t device_get_handle_by_index_v2(unsigned int index) except? 0: """Acquire the handle for a particular device, based on its index. + For all products. + Valid indices are derived from the ``accessibleDevices`` count returned by + :func:`device_get_count_v2`. For example, if ``accessibleDevices`` is 2 the + valid indices are 0 and 1, corresponding to GPU 0 and GPU 1. + The order in which NVML enumerates devices has no guarantees of consistency + between reboots. For that reason it is recommended that devices be looked up by + their PCI ids or UUID. See :func:`device_get_handle_by_uuid` and + :func:`device_get_handle_by_pci_bus_id_v2`. + Note: The NVML index may not correlate with other APIs, such as the CUDA device + index. + Starting from NVML 5, this API causes NVML to initialize the target GPU NVML + may initialize additional GPUs if:. + + - The target GPU is an SLI slave. + + Note: New nvmlDeviceGetCount_v2 (default in NVML 5.319) returns count of all + devices in the system even if nvmlDeviceGetHandleByIndex_v2 returns + NVML_ERROR_NO_PERMISSION for such device. Update your code to handle this + error, or use NVML 4.304 or older nvml header file. For backward binary + compatibility reasons _v1 version of the API is still present in the shared + library. Old _v1 version of nvmlDeviceGetCount doesn't count devices that NVML + has no permission to talk to. + This means that nvmlDeviceGetHandleByIndex_v2 and _v1 can return different + devices for the same index. If you don't touch macros that map old (_v1) + versions to _v2 versions at the top of the file you don't need to worry about + that. + Args: index (unsigned int): The index of the target GPU, >= 0 and < ``accessibleDevices``. @@ -28621,6 +29328,13 @@ cpdef intptr_t device_get_handle_by_index_v2(unsigned int index) except? 0: cpdef intptr_t device_get_handle_by_serial(serial) except? 0: """Acquire the handle for a particular device, based on its board serial number. + For Fermi ™️ or newer fully supported devices. + This number corresponds to the value printed directly on the board, and to the + value returned by :func:`device_get_serial`. + [Deprecated]. + Starting from NVML 5, this API causes NVML to initialize the target GPU NVML + may initialize additional GPUs as it searches for the target GPU. + Args: serial (str): The board serial number of the target GPU. @@ -28643,12 +29357,16 @@ cpdef intptr_t device_get_handle_by_serial(serial) except? 0: cpdef intptr_t device_get_handle_by_uuid(uuid) except? 0: """Acquire the handle for a particular device, based on its globally unique immutable UUID (in ASCII format) associated with each device. + For all products. + Starting from NVML 5, this API causes NVML to initialize the target GPU NVML + may initialize additional GPUs as it searches for the target GPU. + Args: uuid (str): The UUID of the target GPU or MIG instance. Returns: - intptr_t: Reference in which to return the device handle or - MIG device handle. + intptr_t: Reference in which to return the device handle or MIG + device handle. .. seealso:: `nvmlDeviceGetHandleByUUID` """ @@ -28666,16 +29384,26 @@ cpdef intptr_t device_get_handle_by_uuid(uuid) except? 0: cpdef intptr_t device_get_handle_by_pci_bus_id_v2(pci_bus_id) except? 0: """Acquire the handle for a particular device, based on its PCI bus id. + For all products. + This value corresponds to the ``nvmlPciInfo_t.busId`` returned by + :func:`device_get_pci_info_v3`. + Starting from NVML 5, this API causes NVML to initialize the target GPU NVML + may initialize additional GPUs if:. + + - The target GPU is an SLI slave. + Args: pci_bus_id (str): The PCI bus id of the target GPU Accept the following formats (all numbers in hexadecimal): - domain:bus:device.function in format x:x:x.x - domain:bus:device in format x:x:x bus:device.function in - format x:x.x. + domain:bus:device.function in format x:x:x.x domain:bus:device + in format x:x:x bus:device.function in format x:x.x. Returns: intptr_t: Reference in which to return the device handle. + .. note:: + NVML 4.304 and older version of nvmlDeviceGetHandleByPciBusId"_v1" returns + NVML_ERROR_NOT_FOUND instead of NVML_ERROR_NO_PERMISSION. .. seealso:: `nvmlDeviceGetHandleByPciBusId_v2` """ if not isinstance(pci_bus_id, str): @@ -28692,6 +29420,13 @@ cpdef intptr_t device_get_handle_by_pci_bus_id_v2(pci_bus_id) except? 0: cpdef str device_get_name(intptr_t device): """Retrieves the name of this device. + For all products. + The name is an alphanumeric string that denotes a particular product, e.g. + Tesla ™️ C2070. It will not exceed 96 characters in length (including the NULL + terminator). See nvmlConstants::NVML_DEVICE_NAME_V2_BUFFER_SIZE. + When used with MIG device handles the API returns MIG device names which can be + used to identify devices based on their attributes. + Args: device (intptr_t): The identifier of the target device. @@ -28711,6 +29446,9 @@ cpdef str device_get_name(intptr_t device): cpdef int device_get_brand(intptr_t device) except? -1: """Retrieves the brand of this device. + For all products. + The type is a member of ``nvmlBrandType_t`` defined above. + Args: device (intptr_t): The identifier of the target device. @@ -28729,12 +29467,26 @@ cpdef int device_get_brand(intptr_t device) except? -1: cpdef unsigned int device_get_index(intptr_t device) except? 0: """Retrieves the NVML index of this device. + For all products. + Valid indices are derived from the ``accessibleDevices`` count returned by + :func:`device_get_count_v2`. For example, if ``accessibleDevices`` is 2 the + valid indices are 0 and 1, corresponding to GPU 0 and GPU 1. + The order in which NVML enumerates devices has no guarantees of consistency + between reboots. For that reason it is recommended that devices be looked up by + their PCI ids or GPU UUID. See :func:`device_get_handle_by_pci_bus_id_v2` and + :func:`device_get_handle_by_uuid`. + When used with MIG device handles this API returns indices that can be passed + to ``nvmlDeviceGetMigDeviceHandleByIndex`` to retrieve an identical handle. MIG + device indices are unique within a device. + Note: The NVML index may not correlate with other APIs, such as the CUDA device + index. + Args: device (intptr_t): The identifier of the target device. Returns: - unsigned int: Reference in which to return the NVML index of - the device. + unsigned int: Reference in which to return the NVML index of the + device. .. seealso:: `nvmlDeviceGetIndex` """ @@ -28748,12 +29500,17 @@ cpdef unsigned int device_get_index(intptr_t device) except? 0: cpdef str device_get_serial(intptr_t device): """Retrieves the globally unique board serial number associated with this device's board. + For all products with an inforom. + The serial number is an alphanumeric string that will not exceed 30 characters + (including the NULL terminator). This number matches the serial number tag that + is physically attached to the board. See + nvmlConstants::NVML_DEVICE_SERIAL_BUFFER_SIZE. + Args: device (intptr_t): The identifier of the target device. Returns: - char: Reference in which to return the board/module serial - number. + char: Reference in which to return the board/module serial number. .. seealso:: `nvmlDeviceGetSerial` """ @@ -28768,6 +29525,9 @@ cpdef str device_get_serial(intptr_t device): cpdef unsigned int device_get_module_id(intptr_t device) except? 0: """Get a unique identifier for the device module on the baseboard. + This API retrieves a unique identifier for each GPU module that exists on a + given baseboard. For non-baseboard products, this ID would always be 0. + Args: device (intptr_t): The identifier of the target device. @@ -28786,12 +29546,13 @@ cpdef unsigned int device_get_module_id(intptr_t device) except? 0: cpdef object device_get_c2c_mode_info_v(intptr_t device): """Retrieves the Device's C2C Mode information. + Args: device (intptr_t): The identifier of the target device. Returns: - nvmlC2cModeInfo_v1_t: Output struct containing the device's - C2C Mode info. + nvmlC2cModeInfo_v1_t: Output struct containing the device's C2C + Mode info. .. seealso:: `nvmlDeviceGetC2cModeInfoV` """ @@ -28806,23 +29567,28 @@ cpdef object device_get_c2c_mode_info_v(intptr_t device): cpdef object device_get_memory_affinity(intptr_t device, unsigned int node_set_size, unsigned int scope): """Retrieves an array of unsigned ints (sized to node_set_size) of bitmasks with the ideal memory affinity within node or socket for the device. For example, if NUMA node 0, 1 are ideal within the socket for the device and node_set_size == 1, result[0] = 0x3. + For Kepler ™️ or newer fully supported devices. Supported on Linux only. + Args: device (intptr_t): The identifier of the target device. - node_set_size (unsigned int): The size of the node_set array - that is safe to access. + node_set_size (unsigned int): The size of the node_set array that + is safe to access. scope (unsigned int): Scope that change the default behavior. Returns: unsigned long: Array reference in which to return a bitmask of - NODEs, 64 NODEs per unsigned long on 64-bit machines, 32 - on 32-bit machines. + NODEs, 64 NODEs per unsigned long on 64-bit machines, 32 on + 32-bit machines. + .. note:: + If requested scope is not applicable to the target topology, the API will fall + back to reporting the memory affinity for the immediate non-I/O ancestor of the + device. .. seealso:: `nvmlDeviceGetMemoryAffinity` """ - if node_set_size == 0: - return _cyb_view.array(shape=(1,), itemsize=sizeof(unsigned long), format="L", mode="c")[:0] - cdef _cyb_view.array node_set = _cyb_view.array(shape=(node_set_size,), itemsize=sizeof(unsigned long), format="L", mode="c") - cdef unsigned long *node_set_ptr = (node_set.data) + cdef _cyb_view.array _node_set_alloc_ = _cyb_view.array(shape=(max(node_set_size, 1),), itemsize=sizeof(unsigned long), format="L", mode="c") + cdef unsigned long *node_set_ptr = (_node_set_alloc_.data) + cdef object node_set = _node_set_alloc_[:node_set_size] with nogil: __status__ = nvmlDeviceGetMemoryAffinity(device, node_set_size, node_set_ptr, scope) check_status(__status__) @@ -28832,10 +29598,12 @@ cpdef object device_get_memory_affinity(intptr_t device, unsigned int node_set_s cpdef object device_get_cpu_affinity_within_scope(intptr_t device, unsigned int cpu_set_size, unsigned int scope): """Retrieves an array of unsigned ints (sized to cpu_set_size) of bitmasks with the ideal CPU affinity within node or socket for the device. For example, if processors 0, 1, 32, and 33 are ideal for the device and cpu_set_size == 2, result[0] = 0x3, result[1] = 0x3. + For Kepler ™️ or newer fully supported devices. Supported on Linux only. + Args: device (intptr_t): The identifier of the target device. - cpu_set_size (unsigned int): The size of the cpu_set array - that is safe to access. + cpu_set_size (unsigned int): The size of the cpu_set array that is + safe to access. scope (unsigned int): Scope that change the default behavior. Returns: @@ -28843,12 +29611,15 @@ cpdef object device_get_cpu_affinity_within_scope(intptr_t device, unsigned int CPUs, 64 CPUs per unsigned long on 64-bit machines, 32 on 32-bit machines. + .. note:: + If requested scope is not applicable to the target topology, the API will fall + back to reporting the CPU affinity for the immediate non-I/O ancestor of the + device. .. seealso:: `nvmlDeviceGetCpuAffinityWithinScope` """ - if cpu_set_size == 0: - return _cyb_view.array(shape=(1,), itemsize=sizeof(unsigned long), format="L", mode="c")[:0] - cdef _cyb_view.array cpu_set = _cyb_view.array(shape=(cpu_set_size,), itemsize=sizeof(unsigned long), format="L", mode="c") - cdef unsigned long *cpu_set_ptr = (cpu_set.data) + cdef _cyb_view.array _cpu_set_alloc_ = _cyb_view.array(shape=(max(cpu_set_size, 1),), itemsize=sizeof(unsigned long), format="L", mode="c") + cdef unsigned long *cpu_set_ptr = (_cpu_set_alloc_.data) + cdef object cpu_set = _cpu_set_alloc_[:cpu_set_size] with nogil: __status__ = nvmlDeviceGetCpuAffinityWithinScope(device, cpu_set_size, cpu_set_ptr, scope) check_status(__status__) @@ -28858,10 +29629,12 @@ cpdef object device_get_cpu_affinity_within_scope(intptr_t device, unsigned int cpdef object device_get_cpu_affinity(intptr_t device, unsigned int cpu_set_size): """Retrieves an array of unsigned ints (sized to cpu_set_size) of bitmasks with the ideal CPU affinity for the device For example, if processors 0, 1, 32, and 33 are ideal for the device and cpu_set_size == 2, result[0] = 0x3, result[1] = 0x3 This is equivalent to calling ``nvmlDeviceGetCpuAffinityWithinScope`` with ``NVML_AFFINITY_SCOPE_NODE``. + For Kepler ™️ or newer fully supported devices. Supported on Linux only. + Args: device (intptr_t): The identifier of the target device. - cpu_set_size (unsigned int): The size of the cpu_set array - that is safe to access. + cpu_set_size (unsigned int): The size of the cpu_set array that is + safe to access. Returns: unsigned long: Array reference in which to return a bitmask of @@ -28870,10 +29643,9 @@ cpdef object device_get_cpu_affinity(intptr_t device, unsigned int cpu_set_size) .. seealso:: `nvmlDeviceGetCpuAffinity` """ - if cpu_set_size == 0: - return _cyb_view.array(shape=(1,), itemsize=sizeof(unsigned long), format="L", mode="c")[:0] - cdef _cyb_view.array cpu_set = _cyb_view.array(shape=(cpu_set_size,), itemsize=sizeof(unsigned long), format="L", mode="c") - cdef unsigned long *cpu_set_ptr = (cpu_set.data) + cdef _cyb_view.array _cpu_set_alloc_ = _cyb_view.array(shape=(max(cpu_set_size, 1),), itemsize=sizeof(unsigned long), format="L", mode="c") + cdef unsigned long *cpu_set_ptr = (_cpu_set_alloc_.data) + cdef object cpu_set = _cpu_set_alloc_[:cpu_set_size] with nogil: __status__ = nvmlDeviceGetCpuAffinity(device, cpu_set_size, cpu_set_ptr) check_status(__status__) @@ -28883,6 +29655,8 @@ cpdef object device_get_cpu_affinity(intptr_t device, unsigned int cpu_set_size) cpdef device_set_cpu_affinity(intptr_t device): """Sets the ideal affinity for the calling thread and device using the guidelines given in :func:`device_get_cpu_affinity`. Note, this is a change as of version 8.0. Older versions set the affinity for a calling process and all children. Currently supports up to 1024 processors. + For Kepler ™️ or newer fully supported devices. Supported on Linux only. + Args: device (intptr_t): The identifier of the target device. @@ -28896,6 +29670,8 @@ cpdef device_set_cpu_affinity(intptr_t device): cpdef device_clear_cpu_affinity(intptr_t device): """Clear all affinity bindings for the calling thread. Note, this is a change as of version 8.0 as older versions cleared the affinity for a calling process and all children. + For Kepler ™️ or newer fully supported devices. Supported on Linux only. + Args: device (intptr_t): The identifier of the target device. @@ -28909,6 +29685,7 @@ cpdef device_clear_cpu_affinity(intptr_t device): cpdef unsigned int device_get_numa_node_id(intptr_t device) except? 0: """Get the NUMA node of the given GPU device. This only applies to platforms where the GPUs are NUMA nodes. + Args: device (intptr_t): The device handle. @@ -28927,6 +29704,7 @@ cpdef unsigned int device_get_numa_node_id(intptr_t device) except? 0: cpdef int device_get_topology_common_ancestor(intptr_t device1, intptr_t device2) except? -1: """Retrieve the common ancestor for two devices For all products. Supported on Linux only. + Args: device1 (intptr_t): The identifier of the first device. device2 (intptr_t): The identifier of the second device. @@ -28943,18 +29721,47 @@ cpdef int device_get_topology_common_ancestor(intptr_t device1, intptr_t device2 return path_info +cpdef object device_get_topology_nearest_gpus(intptr_t device, int level): + """Retrieve the set of GPUs that are nearest to a given device at a specific interconnectivity level For all products. Supported on Linux only. + + + Args: + device (intptr_t): The identifier of the first device. + level (GpuTopologyLevel): The ``nvmlGpuTopologyLevel_t`` level to + search for other GPUs. + + Returns: + intptr_t: An array of device handles for GPUs found at ``level``. + + .. seealso:: `nvmlDeviceGetTopologyNearestGpus` + """ + cdef unsigned int[1] count = [0] + with nogil: + __status__ = nvmlDeviceGetTopologyNearestGpus(device, <_GpuTopologyLevel>level, count, NULL) + check_status_size(__status__) + cdef _cyb_view.array _device_array_alloc_ = _cyb_view.array(shape=(max(count[0], 1),), itemsize=sizeof(intptr_t), format="q", mode="c") + cdef intptr_t *device_array_ptr = (_device_array_alloc_.data) + cdef object device_array = _device_array_alloc_[:count[0]] + if count[0] != 0: + with nogil: + __status__ = nvmlDeviceGetTopologyNearestGpus(device, <_GpuTopologyLevel>level, count, device_array_ptr) + check_status(__status__) + return device_array[:count[0]] + + cpdef int device_get_p2p_status(intptr_t device1, intptr_t device2, int p2p_index) except? -1: """Retrieve the status for a given p2p capability index between a given pair of GPU. + Args: device1 (intptr_t): The first device. device2 (intptr_t): The second device. - p2p_index (GpuP2PCapsIndex): p2p Capability Index being looked - for between ``device1`` and ``device2``. + p2p_index (GpuP2PCapsIndex): p2p Capability Index being looked for + between ``device1`` and ``device2``. Returns: - int: Reference in which to return the status of the - ``p2p_index`` between ``device1`` and ``device2``. + int: Reference in which to return the status of the ``p2p_index`` + between ``device1`` and ``device2``. .. seealso:: `nvmlDeviceGetP2PStatus` """ @@ -28968,6 +29775,15 @@ cpdef int device_get_p2p_status(intptr_t device1, intptr_t device2, int p2p_inde cpdef str device_get_uuid(intptr_t device): """Retrieves the globally unique immutable UUID associated with this device, as a 5 part hexadecimal string, that augments the immutable, board serial identifier. + For all products. + The UUID is a globally unique identifier. It is the only available identifier + for pre-Fermi-architecture products. It does NOT correspond to any identifier + printed on the board. It will not exceed 96 characters in length (including the + NULL terminator). See nvmlConstants::NVML_DEVICE_UUID_V2_BUFFER_SIZE. + When used with MIG device handles the API returns globally unique UUIDs which + can be used to identify MIG devices across both GPU and MIG devices. UUIDs are + immutable for the lifetime of a MIG device. + Args: device (intptr_t): The identifier of the target device. @@ -28987,12 +29803,14 @@ cpdef str device_get_uuid(intptr_t device): cpdef unsigned int device_get_minor_number(intptr_t device) except? 0: """Retrieves minor number for the device. The minor number for the device is such that the Nvidia device node file for each GPU will have the form /dev/nvidia[minor number]. + For all products. Supported only for Linux. + Args: device (intptr_t): The identifier of the target device. Returns: - unsigned int: Reference in which to return the minor number - for the device. + unsigned int: Reference in which to return the minor number for + the device. .. seealso:: `nvmlDeviceGetMinorNumber` """ @@ -29006,6 +29824,8 @@ cpdef unsigned int device_get_minor_number(intptr_t device) except? 0: cpdef str device_get_board_part_number(intptr_t device): """Retrieves the the device board part number which is programmed into the board's InfoROM. + For all products. + Args: device (intptr_t): Identifier of the target device. @@ -29025,6 +29845,14 @@ cpdef str device_get_board_part_number(intptr_t device): cpdef str device_get_inforom_version(intptr_t device, int object): """Retrieves the version information for the device's infoROM object. + For all products with an inforom. + Fermi and higher parts have non-volatile on-board memory for persisting device + info, such as aggregate ECC counts. The version of the data structures in this + memory may change from time to time. It will not exceed 16 characters in length + (including the NULL terminator). See + nvmlConstants::NVML_DEVICE_INFOROM_VERSION_BUFFER_SIZE. + See ``nvmlInforomObject_t`` for details on the available infoROM objects. + Args: device (intptr_t): The identifier of the target device. object (InforomObject): The target infoROM object. @@ -29045,6 +29873,13 @@ cpdef str device_get_inforom_version(intptr_t device, int object): cpdef str device_get_inforom_image_version(intptr_t device): """Retrieves the global infoROM image version. + For all products with an inforom. + Image version just like VBIOS version uniquely describes the exact version of + the infoROM flashed on the board in contrast to infoROM object version which is + only an indicator of supported features. Version string will not exceed 16 + characters in length (including the NULL terminator). See + nvmlConstants::NVML_DEVICE_INFOROM_VERSION_BUFFER_SIZE. + Args: device (intptr_t): The identifier of the target device. @@ -29064,6 +29899,12 @@ cpdef str device_get_inforom_image_version(intptr_t device): cpdef unsigned int device_get_inforom_configuration_checksum(intptr_t device) except? 0: """Retrieves the checksum of the configuration stored in the device's infoROM. + For all products with an inforom. + Can be used to make sure that two GPUs have the exact same configuration. + Current checksum takes into account configuration stored in PWR and ECC infoROM + objects. Checksum can change between driver releases or when user changes + configuration (e.g. disable/enable ECC). + Args: device (intptr_t): The identifier of the target device. @@ -29083,6 +29924,8 @@ cpdef unsigned int device_get_inforom_configuration_checksum(intptr_t device) ex cpdef device_validate_inforom(intptr_t device): """Reads the infoROM from the flash and verifies the checksums. + For all products with an inforom. + Args: device (intptr_t): The identifier of the target device. @@ -29096,12 +29939,13 @@ cpdef device_validate_inforom(intptr_t device): cpdef tuple device_get_last_bbx_flush_time(intptr_t device): """Retrieves the timestamp and the duration of the last flush of the BBX (blackbox) infoROM object during the current run. + For all products with an inforom. + Args: device (intptr_t): The identifier of the target device. Returns: A 2-tuple containing: - - unsigned long long: The start timestamp of the last BBX Flush. - unsigned long: The duration (us) of the last BBX Flush. @@ -29118,6 +29962,11 @@ cpdef tuple device_get_last_bbx_flush_time(intptr_t device): cpdef int device_get_display_mode(intptr_t device) except? -1: """Retrieves the display mode for the device. + For all products. + This method indicates whether a physical display (e.g. monitor) is currently + connected to any of the device's connectors. + See ``nvmlEnableState_t`` for details on allowed modes. + Args: device (intptr_t): The identifier of the target device. @@ -29136,6 +29985,13 @@ cpdef int device_get_display_mode(intptr_t device) except? -1: cpdef int device_get_display_active(intptr_t device) except? -1: """Retrieves the display active state for the device. + For all products. + This method indicates whether a display is initialized on the device. For + example whether X Server is attached to this device and has allocated memory + for the screen. + Display can be active even when no monitor is physically attached. + See ``nvmlEnableState_t`` for details on allowed modes. + Args: device (intptr_t): The identifier of the target device. @@ -29154,12 +30010,17 @@ cpdef int device_get_display_active(intptr_t device) except? -1: cpdef int device_get_persistence_mode(intptr_t device) except? -1: """Retrieves the persistence mode associated with this device. + For all products. For Linux only. + When driver persistence mode is enabled the driver software state is not torn + down when the last client disconnects. By default this feature is disabled. + See ``nvmlEnableState_t`` for details on allowed modes. + Args: device (intptr_t): The identifier of the target device. Returns: - int: Reference in which to return the current driver - persistence mode. + int: Reference in which to return the current driver persistence + mode. .. seealso:: `nvmlDeviceGetPersistenceMode` """ @@ -29173,12 +30034,14 @@ cpdef int device_get_persistence_mode(intptr_t device) except? -1: cpdef object device_get_pci_info_ext(intptr_t device): """Retrieves PCI attributes of this device. + For all products. + See ``nvmlPciInfoExt_v1_t`` for details on the available PCI info. + Args: device (intptr_t): The identifier of the target device. Returns: - nvmlPciInfoExt_v1_t: Reference in which to return the PCI - info. + nvmlPciInfoExt_v1_t: Reference in which to return the PCI info. .. seealso:: `nvmlDeviceGetPciInfoExt` """ @@ -29194,6 +30057,9 @@ cpdef object device_get_pci_info_ext(intptr_t device): cpdef object device_get_pci_info_v3(intptr_t device): """Retrieves the PCI attributes of this device. + For all products. + See ``nvmlPciInfo_t`` for details on the available PCI info. + Args: device (intptr_t): The identifier of the target device. @@ -29213,6 +30079,10 @@ cpdef object device_get_pci_info_v3(intptr_t device): cpdef unsigned int device_get_max_pcie_link_generation(intptr_t device) except? 0: """Retrieves the maximum PCIe link generation possible with this device and system. + I.E. for a generation 2 PCIe device attached to a generation 1 PCIe bus the max + link generation this function will report is generation 1. + For Fermi ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. @@ -29232,6 +30102,8 @@ cpdef unsigned int device_get_max_pcie_link_generation(intptr_t device) except? cpdef unsigned int device_get_gpu_max_pcie_link_generation(intptr_t device) except? 0: """Retrieves the maximum PCIe link generation supported by this device. + For Fermi ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. @@ -29251,6 +30123,10 @@ cpdef unsigned int device_get_gpu_max_pcie_link_generation(intptr_t device) exce cpdef unsigned int device_get_max_pcie_link_width(intptr_t device) except? 0: """Retrieves the maximum PCIe link width possible with this device and system. + I.E. for a device with a 16x PCIe bus width attached to a 8x PCIe system bus + this function will report a max link width of 8. + For Fermi ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. @@ -29270,12 +30146,14 @@ cpdef unsigned int device_get_max_pcie_link_width(intptr_t device) except? 0: cpdef unsigned int device_get_curr_pcie_link_generation(intptr_t device) except? 0: """Retrieves the current PCIe link generation. + For Fermi ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. Returns: - unsigned int: Reference in which to return the current PCIe - link generation. + unsigned int: Reference in which to return the current PCIe link + generation. .. seealso:: `nvmlDeviceGetCurrPcieLinkGeneration` """ @@ -29289,12 +30167,14 @@ cpdef unsigned int device_get_curr_pcie_link_generation(intptr_t device) except? cpdef unsigned int device_get_curr_pcie_link_width(intptr_t device) except? 0: """Retrieves the current PCIe link width. + For Fermi ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. Returns: - unsigned int: Reference in which to return the current PCIe - link generation. + unsigned int: Reference in which to return the current PCIe link + generation. .. seealso:: `nvmlDeviceGetCurrPcieLinkWidth` """ @@ -29308,6 +30188,9 @@ cpdef unsigned int device_get_curr_pcie_link_width(intptr_t device) except? 0: cpdef unsigned int device_get_pcie_throughput(intptr_t device, int counter) except? 0: """Retrieve PCIe utilization information. This function is querying a byte counter over a 20ms interval and thus is the PCIe throughput over that interval. + For Maxwell ™️ or newer fully supported devices. + This method is not supported in virtual machines running virtual GPU (vGPU). + Args: device (intptr_t): The identifier of the target device. counter (PcieUtilCounter): The specific counter that should be @@ -29328,12 +30211,13 @@ cpdef unsigned int device_get_pcie_throughput(intptr_t device, int counter) exce cpdef unsigned int device_get_pcie_replay_counter(intptr_t device) except? 0: """Retrieve the PCIe replay counter. + For Kepler ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. Returns: - unsigned int: Reference in which to return the counter's - value. + unsigned int: Reference in which to return the counter's value. .. seealso:: `nvmlDeviceGetPcieReplayCounter` """ @@ -29347,13 +30231,15 @@ cpdef unsigned int device_get_pcie_replay_counter(intptr_t device) except? 0: cpdef unsigned int device_get_clock_info(intptr_t device, int type) except? 0: """Retrieves the current clock speeds for the device. + For Fermi ™️ or newer fully supported devices. + See ``nvmlClockType_t`` for details on available clock information. + Args: device (intptr_t): The identifier of the target device. type (ClockType): Identify which clock domain to query. Returns: - unsigned int: Reference in which to return the clock speed in - MHz. + unsigned int: Reference in which to return the clock speed in MHz. .. seealso:: `nvmlDeviceGetClockInfo` """ @@ -29367,14 +30253,19 @@ cpdef unsigned int device_get_clock_info(intptr_t device, int type) except? 0: cpdef unsigned int device_get_max_clock_info(intptr_t device, int type) except? 0: """Retrieves the maximum clock speeds for the device. + For Fermi ™️ or newer fully supported devices. + See ``nvmlClockType_t`` for details on available clock information. + Args: device (intptr_t): The identifier of the target device. type (ClockType): Identify which clock domain to query. Returns: - unsigned int: Reference in which to return the clock speed in - MHz. + unsigned int: Reference in which to return the clock speed in MHz. + .. note:: + Current P0 clocks (reported by ``nvmlDeviceGetClockInfo``) can differ from max + clocks by a few MHz. .. seealso:: `nvmlDeviceGetMaxClockInfo` """ cdef unsigned int clock @@ -29387,6 +30278,7 @@ cpdef unsigned int device_get_max_clock_info(intptr_t device, int type) except? cpdef int device_get_gpc_clk_vf_offset(intptr_t device) except? 0: """Retrieve the GPCCLK VF offset value. + Args: device (intptr_t): The identifier of the target device. @@ -29405,11 +30297,12 @@ cpdef int device_get_gpc_clk_vf_offset(intptr_t device) except? 0: cpdef unsigned int device_get_clock(intptr_t device, int clock_type, int clock_id) except? 0: """Retrieves the clock speed for the clock specified by the clock type and clock ID. + For Kepler ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. clock_type (ClockType): Identify which clock domain to query. - clock_id (ClockId): Identify which clock in the domain to - query. + clock_id (ClockId): Identify which clock in the domain to query. Returns: unsigned int: Reference in which to return the clock in MHz. @@ -29426,6 +30319,8 @@ cpdef unsigned int device_get_clock(intptr_t device, int clock_type, int clock_i cpdef unsigned int device_get_max_customer_boost_clock(intptr_t device, int clock_type) except? 0: """Retrieves the customer defined maximum boost clock speed specified by the given clock type. + For Pascal ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. clock_type (ClockType): Identify which clock domain to query. @@ -29445,6 +30340,8 @@ cpdef unsigned int device_get_max_customer_boost_clock(intptr_t device, int cloc cpdef object device_get_supported_memory_clocks(intptr_t device): """Retrieves the list of possible memory clocks that can be used as an argument for ``nvmlDeviceSetMemoryLockedClocks``. + For Kepler ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. @@ -29457,23 +30354,25 @@ cpdef object device_get_supported_memory_clocks(intptr_t device): with nogil: __status__ = nvmlDeviceGetSupportedMemoryClocks(device, count, NULL) check_status_size(__status__) - if count[0] == 0: - return _cyb_view.array(shape=(1,), itemsize=sizeof(unsigned int), format="I", mode="c")[:0] - cdef _cyb_view.array clocks_m_hz = _cyb_view.array(shape=(count[0],), itemsize=sizeof(unsigned int), format="I", mode="c") - cdef unsigned int *clocks_m_hz_ptr = (clocks_m_hz.data) - with nogil: - __status__ = nvmlDeviceGetSupportedMemoryClocks(device, count, clocks_m_hz_ptr) - check_status(__status__) - return clocks_m_hz + cdef _cyb_view.array _clocks_m_hz_alloc_ = _cyb_view.array(shape=(max(count[0], 1),), itemsize=sizeof(unsigned int), format="I", mode="c") + cdef unsigned int *clocks_m_hz_ptr = (_clocks_m_hz_alloc_.data) + cdef object clocks_m_hz = _clocks_m_hz_alloc_[:count[0]] + if count[0] != 0: + with nogil: + __status__ = nvmlDeviceGetSupportedMemoryClocks(device, count, clocks_m_hz_ptr) + check_status(__status__) + return clocks_m_hz[:count[0]] cpdef object device_get_supported_graphics_clocks(intptr_t device, unsigned int memory_clock_m_hz): """Retrieves the list of possible graphics clocks that can be used as an argument for ``nvmlDeviceSetGpuLockedClocks``. + For Kepler ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. - memory_clock_m_hz (unsigned int): Memory clock for which to - return possible graphics clocks. + memory_clock_m_hz (unsigned int): Memory clock for which to return + possible graphics clocks. Returns: unsigned int: Reference in which to return the clocks in MHz. @@ -29484,30 +30383,36 @@ cpdef object device_get_supported_graphics_clocks(intptr_t device, unsigned int with nogil: __status__ = nvmlDeviceGetSupportedGraphicsClocks(device, memory_clock_m_hz, count, NULL) check_status_size(__status__) - if count[0] == 0: - return _cyb_view.array(shape=(1,), itemsize=sizeof(unsigned int), format="I", mode="c")[:0] - cdef _cyb_view.array clocks_m_hz = _cyb_view.array(shape=(count[0],), itemsize=sizeof(unsigned int), format="I", mode="c") - cdef unsigned int *clocks_m_hz_ptr = (clocks_m_hz.data) - with nogil: - __status__ = nvmlDeviceGetSupportedGraphicsClocks(device, memory_clock_m_hz, count, clocks_m_hz_ptr) - check_status(__status__) - return clocks_m_hz + cdef _cyb_view.array _clocks_m_hz_alloc_ = _cyb_view.array(shape=(max(count[0], 1),), itemsize=sizeof(unsigned int), format="I", mode="c") + cdef unsigned int *clocks_m_hz_ptr = (_clocks_m_hz_alloc_.data) + cdef object clocks_m_hz = _clocks_m_hz_alloc_[:count[0]] + if count[0] != 0: + with nogil: + __status__ = nvmlDeviceGetSupportedGraphicsClocks(device, memory_clock_m_hz, count, clocks_m_hz_ptr) + check_status(__status__) + return clocks_m_hz[:count[0]] cpdef tuple device_get_auto_boosted_clocks_enabled(intptr_t device): """Retrieve the current state of Auto Boosted clocks on a device and store it in ``is_enabled``. + For Kepler ™️ or newer fully supported devices. + Auto Boosted clocks are enabled by default on some hardware, allowing the GPU + to run at higher clock rates to maximize performance as thermal limits allow. + On Pascal and newer hardware, Auto Aoosted clocks are controlled through + application clocks. Use nvmlDeviceSetApplicationsClocks and + nvmlDeviceResetApplicationsClocks to control Auto Boost behavior. + Args: device (intptr_t): The identifier of the target device. Returns: A 2-tuple containing: - - - int: Where to store the current state of Auto Boosted clocks - of the target device. - - int: Where to store the default Auto Boosted clocks behavior - of the target device that the device will revert to when - no applications are using the GPU. + - int: Where to store the current state of Auto Boosted clocks of + the target device. + - int: Where to store the default Auto Boosted clocks behavior of + the target device that the device will revert to when no + applications are using the GPU. .. seealso:: `nvmlDeviceGetAutoBoostedClocksEnabled` """ @@ -29522,6 +30427,12 @@ cpdef tuple device_get_auto_boosted_clocks_enabled(intptr_t device): cpdef unsigned int device_get_fan_speed(intptr_t device) except? 0: """Retrieves the intended operating speed of the device's fan. + Note: The reported speed is the intended fan speed. If the fan is physically + blocked and unable to spin, the output will not match the actual fan speed. + For all discrete products with dedicated fans. + The fan speed is expressed as a percentage of the product's maximum noise + tolerance fan speed. This value may exceed 100% in certain cases. + Args: device (intptr_t): The identifier of the target device. @@ -29541,6 +30452,12 @@ cpdef unsigned int device_get_fan_speed(intptr_t device) except? 0: cpdef unsigned int device_get_fan_speed_v2(intptr_t device, unsigned int fan) except? 0: """Retrieves the intended operating speed of the device's specified fan. + Note: The reported speed is the intended fan speed. If the fan is physically + blocked and unable to spin, the output will not match the actual fan speed. + For all discrete products with dedicated fans. + The fan speed is expressed as a percentage of the product's maximum noise + tolerance fan speed. This value may exceed 100% in certain cases. + Args: device (intptr_t): The identifier of the target device. fan (unsigned int): The index of the target fan, zero indexed. @@ -29561,6 +30478,14 @@ cpdef unsigned int device_get_fan_speed_v2(intptr_t device, unsigned int fan) ex cpdef unsigned int device_get_target_fan_speed(intptr_t device, unsigned int fan) except? 0: """Retrieves the intended target speed of the device's specified fan. + Normally, the driver dynamically adjusts the fan based on the needs of the GPU. + But when user set fan speed using nvmlDeviceSetFanSpeed_v2, the driver will + attempt to make the fan achieve the setting in nvmlDeviceSetFanSpeed_v2. The + actual current speed of the fan is reported in nvmlDeviceGetFanSpeed_v2. + For all discrete products with dedicated fans. + The fan speed is expressed as a percentage of the product's maximum noise + tolerance fan speed. This value may exceed 100% in certain cases. + Args: device (intptr_t): The identifier of the target device. fan (unsigned int): The index of the target fan, zero indexed. @@ -29581,12 +30506,13 @@ cpdef unsigned int device_get_target_fan_speed(intptr_t device, unsigned int fan cpdef tuple device_get_min_max_fan_speed(intptr_t device): """Retrieves the min and max fan speed that user can set for the GPU fan. + For all cuda-capable discrete products with fans. + Args: device (intptr_t): The identifier of the target device. Returns: A 2-tuple containing: - - unsigned int: The minimum speed allowed to set. - unsigned int: The maximum speed allowed to set. @@ -29603,6 +30529,9 @@ cpdef tuple device_get_min_max_fan_speed(intptr_t device): cpdef unsigned int device_get_fan_control_policy_v2(intptr_t device, unsigned int fan) except *: """Gets current fan control policy. + For Maxwell ™️ or newer fully supported devices. + For all cuda-capable discrete products with fans. + Args: device (intptr_t): The identifier of the target ``device``. fan (unsigned int): The index of the target fan, zero indexed. @@ -29623,6 +30552,8 @@ cpdef unsigned int device_get_fan_control_policy_v2(intptr_t device, unsigned in cpdef unsigned int device_get_num_fans(intptr_t device) except? 0: """Retrieves the number of fans on the device. + For all discrete products with dedicated fans. + Args: device (intptr_t): The identifier of the target device. @@ -29641,13 +30572,16 @@ cpdef unsigned int device_get_num_fans(intptr_t device) except? 0: cpdef object device_get_cooler_info(intptr_t device): """Retrieves the cooler's information. Returns a cooler's control signal characteristics. The possible types are restricted, Variable and Toggle. See ``nvmlCoolerControl_t`` for details on available signal types. Returns objects that cooler cools. Targets may be GPU, Memory, Power Supply or All of these. See ``nvmlCoolerTarget_t`` for details on available targets. + For Maxwell ™️ or newer fully supported devices. + For all discrete products with dedicated fans. + Args: device (intptr_t): The identifier of the target device. Returns: nvmlCoolerInfo_v1_t: Structure specifying the cooler's control - signal characteristics (out) and the target that cooler - cools (out). + signal characteristics (out) and the target that cooler cools + (out). .. seealso:: `nvmlDeviceGetCoolerInfo` """ @@ -29663,6 +30597,18 @@ cpdef object device_get_cooler_info(intptr_t device): cpdef unsigned int device_get_temperature_threshold(intptr_t device, int threshold_type) except? 0: """Retrieves the temperature threshold for the GPU with the specified threshold type in degrees C. + For Kepler ™️ or newer fully supported devices. + See ``nvmlTemperatureThresholds_t`` for details on available temperature + thresholds. + Note: This API is no longer the preferred interface for retrieving the + following temperature thresholds on Ada and later architectures: + NVML_TEMPERATURE_THRESHOLD_SHUTDOWN, NVML_TEMPERATURE_THRESHOLD_SLOWDOWN, + NVML_TEMPERATURE_THRESHOLD_MEM_MAX and NVML_TEMPERATURE_THRESHOLD_GPU_MAX. + Support for reading these temperature thresholds for Ada and later + architectures would be removed from this API in future releases. Please use + ``nvmlDeviceGetFieldValues`` with NVML_FI_DEV_TEMPERATURE_* fields to retrieve + temperature thresholds on these architectures. + Args: device (intptr_t): The identifier of the target device. threshold_type (TemperatureThresholds): The type of threshold @@ -29684,13 +30630,14 @@ cpdef unsigned int device_get_temperature_threshold(intptr_t device, int thresho cpdef object device_get_thermal_settings(intptr_t device, unsigned int sensor_index): """Used to execute a list of thermal system instructions. + Args: device (intptr_t): The identifier of the target device. sensor_index (unsigned int): The index of the thermal sensor. Returns: - nvmlGpuThermalSettings_t: Reference in which to return the - thermal sensor information. + nvmlGpuThermalSettings_t: Reference in which to return the thermal + sensor information. .. seealso:: `nvmlDeviceGetThermalSettings` """ @@ -29705,12 +30652,14 @@ cpdef object device_get_thermal_settings(intptr_t device, unsigned int sensor_in cpdef int device_get_performance_state(intptr_t device) except? -1: """Retrieves the current performance state for the device. + For Fermi ™️ or newer fully supported devices. + See ``nvmlPstates_t`` for details on allowed performance states. + Args: device (intptr_t): The identifier of the target device. Returns: - int: Reference in which to return the performance state - reading. + int: Reference in which to return the performance state reading. .. seealso:: `nvmlDeviceGetPerformanceState` """ @@ -29724,13 +30673,18 @@ cpdef int device_get_performance_state(intptr_t device) except? -1: cpdef unsigned long long device_get_current_clocks_event_reasons(intptr_t device) except? 0: """Retrieves current clocks event reasons. + For all fully supported products. + Args: device (intptr_t): The identifier of the target device. Returns: - unsigned long long: Reference in which to return bitmask of - active clocks event reasons. + unsigned long long: Reference in which to return bitmask of active + clocks event reasons. + .. note:: + More than one bit can be enabled at the same time. Multiple reasons can be + affecting clocks at once. .. seealso:: `nvmlDeviceGetCurrentClocksEventReasons` """ cdef unsigned long long clocks_event_reasons @@ -29743,6 +30697,9 @@ cpdef unsigned long long device_get_current_clocks_event_reasons(intptr_t device cpdef unsigned long long device_get_supported_clocks_event_reasons(intptr_t device) except? 0: """Retrieves bitmask of supported clocks event reasons that can be returned by ``nvmlDeviceGetCurrentClocksEventReasons``. + For all fully supported products. + This method is not supported in virtual machines running virtual GPU (vGPU). + Args: device (intptr_t): The identifier of the target device. @@ -29762,12 +30719,15 @@ cpdef unsigned long long device_get_supported_clocks_event_reasons(intptr_t devi cpdef int device_get_power_state(intptr_t device) except? -1: """Deprecated: Use ``nvmlDeviceGetPerformanceState``. This function exposes an incorrect generalization. + Retrieve the current performance state for the device. + For Fermi ™️ or newer fully supported devices. + See ``nvmlPstates_t`` for details on allowed performance states. + Args: device (intptr_t): The identifier of the target device. Returns: - int: Reference in which to return the performance state - reading. + int: Reference in which to return the performance state reading. .. seealso:: `nvmlDeviceGetPowerState` """ @@ -29781,6 +30741,7 @@ cpdef int device_get_power_state(intptr_t device) except? -1: cpdef object device_get_dynamic_pstates_info(intptr_t device): """Retrieve performance monitor samples from the associated subdevice. + Args: device (intptr_t): . @@ -29800,6 +30761,7 @@ cpdef object device_get_dynamic_pstates_info(intptr_t device): cpdef int device_get_mem_clk_vf_offset(intptr_t device) except? 0: """Retrieve the MemClk (Memory Clock) VF offset value. + Args: device (intptr_t): The identifier of the target device. @@ -29818,6 +30780,7 @@ cpdef int device_get_mem_clk_vf_offset(intptr_t device) except? 0: cpdef tuple device_get_min_max_clock_of_p_state(intptr_t device, int type, int pstate): """Retrieve min and max clocks of some clock domain for a given PState. + Args: device (intptr_t): The identifier of the target device. type (ClockType): Clock domain. @@ -29825,11 +30788,8 @@ cpdef tuple device_get_min_max_clock_of_p_state(intptr_t device, int type, int p Returns: A 2-tuple containing: - - - unsigned int: Reference in which to return min clock - frequency. - - unsigned int: Reference in which to return max clock - frequency. + - unsigned int: Reference in which to return min clock frequency. + - unsigned int: Reference in which to return max clock frequency. .. seealso:: `nvmlDeviceGetMinMaxClockOfPState` """ @@ -29844,12 +30804,12 @@ cpdef tuple device_get_min_max_clock_of_p_state(intptr_t device, int type, int p cpdef tuple device_get_gpc_clk_min_max_vf_offset(intptr_t device): """Retrieve the GPCCLK min max VF offset value. + Args: device (intptr_t): The identifier of the target device. Returns: A 2-tuple containing: - - int: The retrieved GPCCLK VF min offset value. - int: The retrieved GPCCLK VF max offset value. @@ -29866,12 +30826,12 @@ cpdef tuple device_get_gpc_clk_min_max_vf_offset(intptr_t device): cpdef tuple device_get_mem_clk_min_max_vf_offset(intptr_t device): """Retrieve the MemClk (Memory Clock) min max VF offset value. + Args: device (intptr_t): The identifier of the target device. Returns: A 2-tuple containing: - - int: The retrieved MemClk VF min offset value. - int: The retrieved MemClk VF max offset value. @@ -29885,30 +30845,41 @@ cpdef tuple device_get_mem_clk_min_max_vf_offset(intptr_t device): return (min_offset, max_offset) -cpdef device_set_clock_offsets(intptr_t device, intptr_t info): +cpdef device_set_clock_offsets(intptr_t device, info): """Control current clock offset of some clock domain for a given PState. + For Maxwell ™️ or newer fully supported devices. + Requires privileged user. + Args: device (intptr_t): The identifier of the target device. - info (intptr_t): Structure specifying the clock type (input), - the pstate (input) and clock offset value (input). + info (intptr_t): Structure specifying the clock type (input), the + pstate (input) and clock offset value (input). .. seealso:: `nvmlDeviceSetClockOffsets` """ + cdef intptr_t _info_ptr_ = int(info) with nogil: - __status__ = nvmlDeviceSetClockOffsets(device, info) + __status__ = nvmlDeviceSetClockOffsets(device, _info_ptr_) check_status(__status__) cpdef unsigned int device_get_power_management_limit(intptr_t device) except? 0: """Retrieves the power management limit associated with this device. + For Fermi ™️ or newer fully supported devices. + The power limit defines the upper boundary for the card's power draw. If the + card's total power draw reaches this limit the power management algorithm kicks + in. + This reading is only available if power management mode is supported. See + nvmlDeviceGetPowerManagementMode. + Args: device (intptr_t): The identifier of the target device. Returns: - unsigned int: Reference in which to return the power - management limit in milliwatts. + unsigned int: Reference in which to return the power management + limit in milliwatts. .. seealso:: `nvmlDeviceGetPowerManagementLimit` """ @@ -29922,16 +30893,17 @@ cpdef unsigned int device_get_power_management_limit(intptr_t device) except? 0: cpdef tuple device_get_power_management_limit_constraints(intptr_t device): """Retrieves information about possible values of power management limits on this device. + For Kepler ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. Returns: A 2-tuple containing: - - unsigned int: Reference in which to return the minimum power - management limit in milliwatts. + management limit in milliwatts. - unsigned int: Reference in which to return the maximum power - management limit in milliwatts. + management limit in milliwatts. .. seealso:: `nvmlDeviceGetPowerManagementLimitConstraints` """ @@ -29946,6 +30918,8 @@ cpdef tuple device_get_power_management_limit_constraints(intptr_t device): cpdef unsigned int device_get_power_management_default_limit(intptr_t device) except? 0: """Retrieves default power management limit on this device, in milliwatts. Default power management limit is a power management limit that the device boots with. + For Kepler ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. @@ -29965,6 +30939,16 @@ cpdef unsigned int device_get_power_management_default_limit(intptr_t device) ex cpdef unsigned int device_get_power_usage(intptr_t device) except? 0: """Retrieves power usage for this GPU in milliwatts and its associated circuitry (e.g. memory). + For Fermi ™️ or newer fully supported devices. + On Fermi and Kepler GPUs the reading is accurate to within +/- 5% of current + power draw. On Ampere (except GA100) or newer GPUs, the API returns power + averaged over 1 sec interval. On GA100 and older architectures, instantaneous + power is returned. + See ``NVML_FI_DEV_POWER_AVERAGE`` and ``NVML_FI_DEV_POWER_INSTANT`` to query + specific power values. + It is only available if power management mode is supported. See + nvmlDeviceGetPowerManagementMode. + Args: device (intptr_t): The identifier of the target device. @@ -29984,6 +30968,8 @@ cpdef unsigned int device_get_power_usage(intptr_t device) except? 0: cpdef unsigned long long device_get_total_energy_consumption(intptr_t device) except? 0: """Retrieves total energy consumption for this GPU in millijoules (mJ) since the driver was last reloaded. + For Volta ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. @@ -30003,12 +30989,17 @@ cpdef unsigned long long device_get_total_energy_consumption(intptr_t device) ex cpdef unsigned int device_get_enforced_power_limit(intptr_t device) except? 0: """Get the effective power limit that the driver enforces after taking into account all limiters. + Note: This can be different from the ``nvmlDeviceGetPowerManagementLimit`` if + other limits are set elsewhere This includes the out of band power limit + interface. + For Kepler ™️ or newer fully supported devices. + Args: device (intptr_t): The device to communicate with. Returns: - unsigned int: Reference in which to return the power - management limit in milliwatts. + unsigned int: Reference in which to return the power management + limit in milliwatts. .. seealso:: `nvmlDeviceGetEnforcedPowerLimit` """ @@ -30022,12 +31013,15 @@ cpdef unsigned int device_get_enforced_power_limit(intptr_t device) except? 0: cpdef tuple device_get_gpu_operation_mode(intptr_t device): """Retrieves the current GOM and pending GOM (the one that GPU will switch to after reboot). + For GK110 M-class and X-class Tesla ™️ products from the Kepler family. Modes + ``NVML_GOM_LOW_DP`` and ``NVML_GOM_ALL_ON`` are supported on fully supported + GeForce products. Not supported on Quadro ®️ and Tesla ™️ C-class products. + Args: device (intptr_t): The identifier of the target device. Returns: A 2-tuple containing: - - int: Reference in which to return the current GOM. - int: Reference in which to return the pending GOM. @@ -30044,6 +31038,13 @@ cpdef tuple device_get_gpu_operation_mode(intptr_t device): cpdef object device_get_memory_info_v2(intptr_t device): """Retrieves the amount of used, free, reserved and total memory available on the device, in bytes. nvmlDeviceGetMemoryInfo_v2 accounts separately for reserved memory and includes it in the used memory amount. + For all products. + Enabling ECC reduces the amount of total available memory, due to the extra + required parity bits. Under WDDM most device memory is allocated and managed on + startup by Windows. + Under Linux and Windows TCC, the reported amount of used memory is equal to the + sum of memory allocated by all active channels on the device. + Args: device (intptr_t): The identifier of the target device. @@ -30051,6 +31052,23 @@ cpdef object device_get_memory_info_v2(intptr_t device): nvmlMemory_v2_t: Reference in which to return the memory information. + .. note:: + In MIG mode, if device handle is provided, the API returns aggregate + information, only if the caller has appropriate privileges. Per-instance + information can be queried by using specific MIG device handles. + .. note:: + On systems where GPUs are NUMA nodes, the accuracy of FB memory utilization + provided by this API depends on the memory accounting of the operating system. + This is because FB memory is managed by the operating system instead of the + NVIDIA GPU driver. Typically, pages allocated from FB memory are not released + even after the process terminates to enhance performance. In scenarios where + the operating system is under memory pressure, it may resort to utilizing FB + memory. Such actions can result in discrepancies in the accuracy of memory + reporting. + .. note:: + On certain SOC platforms, the integrated GPU (iGPU) does not use a dedicated + framebuffer but instead shares memory with the system. As a result, + ``NVML_ERROR_NOT_SUPPORTED`` will be returned in this case. .. seealso:: `nvmlDeviceGetMemoryInfo_v2` """ cdef Memory_v2 memory_py = Memory_v2() @@ -30065,13 +31083,18 @@ cpdef object device_get_memory_info_v2(intptr_t device): cpdef int device_get_compute_mode(intptr_t device) except? -1: """Retrieves the current compute mode for the device or MIG device. + For all products. + See ``nvmlComputeMode_t`` for details on allowed compute modes. + Args: - device (intptr_t): The identifier of the target device handle - or MIG device handle. + device (intptr_t): The identifier of the target device handle or + MIG device handle. Returns: int: Reference in which to return the current compute mode. + .. note:: + If MIG is enabled on a GPU, device must be MIG device handle. .. seealso:: `nvmlDeviceGetComputeMode` """ cdef _ComputeMode mode @@ -30084,16 +31107,22 @@ cpdef int device_get_compute_mode(intptr_t device) except? -1: cpdef tuple device_get_cuda_compute_capability(intptr_t device): """Retrieves the CUDA compute capability of the device. + For all products. + Returns the major and minor compute capability version numbers of the device. + The major and minor versions are equivalent to the + CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MINOR and + CU_DEVICE_ATTRIBUTE_COMPUTE_CAPABILITY_MAJOR attributes that would be returned + by CUDA's cuDeviceGetAttribute(). + Args: device (intptr_t): The identifier of the target device. Returns: A 2-tuple containing: - - int: Reference in which to return the major CUDA compute - capability. + capability. - int: Reference in which to return the minor CUDA compute - capability. + capability. .. seealso:: `nvmlDeviceGetCudaComputeCapability` """ @@ -30108,12 +31137,17 @@ cpdef tuple device_get_cuda_compute_capability(intptr_t device): cpdef tuple device_get_ecc_mode(intptr_t device): """Retrieves the current and pending ECC modes for the device. + For Fermi ™️ or newer fully supported devices. Only applicable to devices with + ECC. Requires ``NVML_INFOROM_ECC`` version 1.0 or higher. + Changing ECC modes requires a reboot. The "pending" ECC mode refers to the + target mode following the next reboot. + See ``nvmlEnableState_t`` for details on allowed modes. + Args: device (intptr_t): The identifier of the target device. Returns: A 2-tuple containing: - - int: Reference in which to return the current ECC mode. - int: Reference in which to return the pending ECC mode. @@ -30130,6 +31164,10 @@ cpdef tuple device_get_ecc_mode(intptr_t device): cpdef int device_get_default_ecc_mode(intptr_t device) except? -1: """Retrieves the default ECC modes for the device. + For Fermi ™️ or newer fully supported devices. Only applicable to devices with + ECC. Requires ``NVML_INFOROM_ECC`` version 1.0 or higher. + See ``nvmlEnableState_t`` for details on allowed modes. + Args: device (intptr_t): The identifier of the target device. @@ -30148,12 +31186,13 @@ cpdef int device_get_default_ecc_mode(intptr_t device) except? -1: cpdef unsigned int device_get_board_id(intptr_t device) except? 0: """Retrieves the device board_id from 0-N. Devices with the same board_id indicate GPUs connected to the same PLX. Use in conjunction with :func:`device_get_multi_gpu_board` to decide if they are on the same board as well. The board_id returned is a unique ID for the current configuration. Uniqueness and ordering across reboots and system configurations is not guaranteed (i.e. if a Tesla K40c returns 0x100 and the two GPUs on a Tesla K10 in the same system returns 0x200 it is not guaranteed they will always return those values but they will always be different from each other). + For Fermi ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. Returns: - unsigned int: Reference in which to return the device's board - ID. + unsigned int: Reference in which to return the device's board ID. .. seealso:: `nvmlDeviceGetBoardId` """ @@ -30167,13 +31206,14 @@ cpdef unsigned int device_get_board_id(intptr_t device) except? 0: cpdef unsigned int device_get_multi_gpu_board(intptr_t device) except? 0: """Retrieves whether the device is on a Multi-GPU Board Devices that are on multi-GPU boards will set ``multi_gpu_bool`` to a non-zero value. + For Fermi ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. Returns: unsigned int: Reference in which to return a zero or non-zero - value to indicate whether the device is on a multi GPU - board. + value to indicate whether the device is on a multi GPU board. .. seealso:: `nvmlDeviceGetMultiGpuBoard` """ @@ -30187,16 +31227,24 @@ cpdef unsigned int device_get_multi_gpu_board(intptr_t device) except? 0: cpdef unsigned long long device_get_total_ecc_errors(intptr_t device, int error_type, int counter_type) except? 0: """Retrieves the total ECC error counts for the device. + For Fermi ™️ or newer fully supported devices. Only applicable to devices with + ECC. Requires ``NVML_INFOROM_ECC`` version 1.0 or higher. Requires ECC Mode to + be enabled. + The total error count is the sum of errors across each of the separate memory + systems, i.e. the total set of errors across the entire device. + See ``nvmlMemoryErrorType_t`` for a description of available error types. See + ``nvmlEccCounterType_t`` for a description of available counter types. + Args: device (intptr_t): The identifier of the target device. - error_type (MemoryErrorType): Flag that specifies the type of - the errors. - counter_type (EccCounterType): Flag that specifies the - counter-type of the errors. + error_type (MemoryErrorType): Flag that specifies the type of the + errors. + counter_type (EccCounterType): Flag that specifies the counter- + type of the errors. Returns: - unsigned long long: Reference in which to return the specified - ECC errors. + unsigned long long: Reference in which to return the specified ECC + errors. .. seealso:: `nvmlDeviceGetTotalEccErrors` """ @@ -30210,19 +31258,34 @@ cpdef unsigned long long device_get_total_ecc_errors(intptr_t device, int error_ cpdef unsigned long long device_get_memory_error_counter(intptr_t device, int error_type, int counter_type, int location_type) except? 0: """Retrieves the requested memory error counter for the device. + For Fermi ™️ or newer fully supported devices. Requires ``NVML_INFOROM_ECC`` + version 2.0 or higher to report aggregate location-based memory error counts. + Requires ``NVML_INFOROM_ECC`` version 1.0 or higher to report all other memory + error counts. + Only applicable to devices with ECC. + Requires ECC Mode to be enabled. + See ``nvmlMemoryErrorType_t`` for a description of available memory error + types. See ``nvmlEccCounterType_t`` for a description of available counter + types. See ``nvmlMemoryLocation_t`` for a description of available counter + locations. + Args: device (intptr_t): The identifier of the target device. error_type (MemoryErrorType): Flag that specifies the type of error. - counter_type (EccCounterType): Flag that specifies the - counter-type of the errors. + counter_type (EccCounterType): Flag that specifies the counter- + type of the errors. location_type (MemoryLocation): Specifies the location of the counter. Returns: - unsigned long long: Reference in which to return the ECC - counter. + unsigned long long: Reference in which to return the ECC counter. + .. note:: + On MIG-enabled GPUs, per instance information can be queried using specific MIG + device handles. Per instance information is currently only supported for non- + DRAM uncorrectable volatile errors. Querying volatile errors using device + handles is currently not supported. .. seealso:: `nvmlDeviceGetMemoryErrorCounter` """ cdef unsigned long long count @@ -30235,13 +31298,23 @@ cpdef unsigned long long device_get_memory_error_counter(intptr_t device, int er cpdef object device_get_utilization_rates(intptr_t device): """Retrieves the current utilization rates for the device's major subsystems. + For Fermi ™️ or newer fully supported devices. + See ``nvmlUtilization_t`` for details on available utilization rates. + Args: device (intptr_t): The identifier of the target device. Returns: - nvmlUtilization_t: Reference in which to return the - utilization information. + nvmlUtilization_t: Reference in which to return the utilization + information. + .. note:: + During driver initialization when ECC is enabled one can see high GPU and + Memory Utilization readings. This is caused by ECC Memory Scrubbing mechanism + that is performed during driver initialization. + .. note:: + On MIG-enabled GPUs, querying device utilization rates is not currently + supported. .. seealso:: `nvmlDeviceGetUtilizationRates` """ cdef Utilization utilization_py = Utilization() @@ -30255,17 +31328,20 @@ cpdef object device_get_utilization_rates(intptr_t device): cpdef tuple device_get_encoder_utilization(intptr_t device): """Retrieves the current utilization and sampling size in microseconds for the Encoder. + For Kepler ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. Returns: A 2-tuple containing: + - unsigned int: Reference to an unsigned int for encoder utilization + info. + - unsigned int: Reference to an unsigned int for the sampling period + in US. - - unsigned int: Reference to an unsigned int for encoder - utilization info. - - unsigned int: Reference to an unsigned int for the sampling - period in US. - + .. note:: + On MIG-enabled GPUs, querying encoder utilization is not currently supported. .. seealso:: `nvmlDeviceGetEncoderUtilization` """ cdef unsigned int utilization @@ -30279,6 +31355,8 @@ cpdef tuple device_get_encoder_utilization(intptr_t device): cpdef unsigned int device_get_encoder_capacity(intptr_t device, int encoder_query_type) except? 0: """Retrieves the current capacity of the device's encoder, as a percentage of maximum encoder capacity with valid values in the range 0-100. + For Maxwell ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. encoder_query_type (EncoderType): Type of encoder to query. @@ -30299,18 +31377,19 @@ cpdef unsigned int device_get_encoder_capacity(intptr_t device, int encoder_quer cpdef tuple device_get_encoder_stats(intptr_t device): """Retrieves the current encoder statistics for a given device. + For Maxwell ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. Returns: A 3-tuple containing: - - unsigned int: Reference to an unsigned int for count of active - encoder sessions. - - unsigned int: Reference to an unsigned int for trailing - average FPS of all active sessions. - - unsigned int: Reference to an unsigned int for encode latency - in microseconds. + encoder sessions. + - unsigned int: Reference to an unsigned int for trailing average + FPS of all active sessions. + - unsigned int: Reference to an unsigned int for encode latency in + microseconds. .. seealso:: `nvmlDeviceGetEncoderStats` """ @@ -30326,12 +31405,24 @@ cpdef tuple device_get_encoder_stats(intptr_t device): cpdef object device_get_encoder_sessions(intptr_t device): """Retrieves information about active encoder sessions on a target device. + An array of active encoder sessions is returned in the caller-supplied buffer + pointed at by ``session_infos``. The array element count is passed in + ``session_count``, and ``session_count`` is used to return the number of + sessions written to the buffer. + If the supplied buffer is not large enough to accommodate the active session + array, the function returns NVML_ERROR_INSUFFICIENT_SIZE, with the element + count of ``nvmlEncoderSessionInfo_t`` array required in ``session_count``. To + query the number of active encoder sessions, call this function with + \*session_count = 0. The code will return NVML_SUCCESS with number of active + encoder sessions updated in \*session_count. + For Maxwell ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. Returns: - nvmlEncoderSessionInfo_t: Reference in which to return the - session information. + nvmlEncoderSessionInfo_t: Reference in which to return the session + information. .. seealso:: `nvmlDeviceGetEncoderSessions` """ @@ -30341,28 +31432,30 @@ cpdef object device_get_encoder_sessions(intptr_t device): check_status_size(__status__) cdef EncoderSessionInfo session_infos = EncoderSessionInfo(session_count[0]) cdef nvmlEncoderSessionInfo_t *session_infos_ptr = (session_infos._get_ptr()) - if session_count[0] == 0: - return session_infos - with nogil: - __status__ = nvmlDeviceGetEncoderSessions(device, session_count, session_infos_ptr) - check_status(__status__) - return session_infos + if session_count[0] != 0: + with nogil: + __status__ = nvmlDeviceGetEncoderSessions(device, session_count, session_infos_ptr) + check_status(__status__) + return session_infos[:session_count[0]] cpdef tuple device_get_decoder_utilization(intptr_t device): """Retrieves the current utilization and sampling size in microseconds for the Decoder. + For Kepler ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. Returns: A 2-tuple containing: + - unsigned int: Reference to an unsigned int for decoder utilization + info. + - unsigned int: Reference to an unsigned int for the sampling period + in US. - - unsigned int: Reference to an unsigned int for decoder - utilization info. - - unsigned int: Reference to an unsigned int for the sampling - period in US. - + .. note:: + On MIG-enabled GPUs, querying decoder utilization is not currently supported. .. seealso:: `nvmlDeviceGetDecoderUtilization` """ cdef unsigned int utilization @@ -30376,17 +31469,20 @@ cpdef tuple device_get_decoder_utilization(intptr_t device): cpdef tuple device_get_jpg_utilization(intptr_t device): """Retrieves the current utilization and sampling size in microseconds for the JPG. + For Turing ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. Returns: A 2-tuple containing: - - unsigned int: Reference to an unsigned int for jpg utilization - info. - - unsigned int: Reference to an unsigned int for the sampling - period in US. + info. + - unsigned int: Reference to an unsigned int for the sampling period + in US. + .. note:: + On MIG-enabled GPUs, querying decoder utilization is not currently supported. .. seealso:: `nvmlDeviceGetJpgUtilization` """ cdef unsigned int utilization @@ -30400,17 +31496,20 @@ cpdef tuple device_get_jpg_utilization(intptr_t device): cpdef tuple device_get_ofa_utilization(intptr_t device): """Retrieves the current utilization and sampling size in microseconds for the OFA (Optical Flow Accelerator). + For Turing ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. Returns: A 2-tuple containing: - - unsigned int: Reference to an unsigned int for ofa utilization - info. - - unsigned int: Reference to an unsigned int for the sampling - period in US. + info. + - unsigned int: Reference to an unsigned int for the sampling period + in US. + .. note:: + On MIG-enabled GPUs, querying decoder utilization is not currently supported. .. seealso:: `nvmlDeviceGetOfaUtilization` """ cdef unsigned int utilization @@ -30424,6 +31523,8 @@ cpdef tuple device_get_ofa_utilization(intptr_t device): cpdef object device_get_fbc_stats(intptr_t device): """Retrieves the active frame buffer capture sessions statistics for a given device. + For Maxwell ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. @@ -30444,6 +31545,18 @@ cpdef object device_get_fbc_stats(intptr_t device): cpdef object device_get_fbc_sessions(intptr_t device): """Retrieves information about active frame buffer capture sessions on a target device. + An array of active FBC sessions is returned in the caller-supplied buffer + pointed at by ``session_info``. The array element count is passed in + ``session_count``, and ``session_count`` is used to return the number of + sessions written to the buffer. + If the supplied buffer is not large enough to accommodate the active session + array, the function returns NVML_ERROR_INSUFFICIENT_SIZE, with the element + count of ``nvmlFBCSessionInfo_t`` array required in ``session_count``. To query + the number of active FBC sessions, call this function with \*session_count = 0. + The code will return NVML_SUCCESS with number of active FBC sessions updated in + \*session_count. + For Maxwell ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. @@ -30451,6 +31564,10 @@ cpdef object device_get_fbc_sessions(intptr_t device): nvmlFBCSessionInfo_t: Reference in which to return the session information. + .. note:: + hResolution, vResolution, averageFPS and averageLatency data for a FBC session + returned in ``session_info`` may be zero if there are no new frames captured + since the session started. .. seealso:: `nvmlDeviceGetFBCSessions` """ cdef unsigned int[1] session_count = [0] @@ -30459,23 +31576,29 @@ cpdef object device_get_fbc_sessions(intptr_t device): check_status_size(__status__) cdef FBCSessionInfo session_info = FBCSessionInfo(session_count[0]) cdef nvmlFBCSessionInfo_t *session_info_ptr = (session_info._get_ptr()) - if session_count[0] == 0: - return session_info - with nogil: - __status__ = nvmlDeviceGetFBCSessions(device, session_count, session_info_ptr) - check_status(__status__) - return session_info + if session_count[0] != 0: + with nogil: + __status__ = nvmlDeviceGetFBCSessions(device, session_count, session_info_ptr) + check_status(__status__) + return session_info[:session_count[0]] cpdef tuple device_get_driver_model_v2(intptr_t device): """Retrieves the current and pending driver model for the device. + For Kepler ™️ or newer fully supported devices. For windows only. + On Windows platforms the device driver can run in either WDDM, MCDM or WDM + (TCC) modes. If a display is attached to the device it must run in WDDM mode. + MCDM mode is preferred if a display is not attached. TCC mode is deprecated. + Driver-model availability is architecture-specific; attempting to set an + unsupported driver model returns NVML_ERROR_NOT_SUPPORTED. + See ``nvmlDriverModel_t`` for details on available driver models. + Args: device (intptr_t): The identifier of the target device. Returns: A 2-tuple containing: - - int: Reference in which to return the current driver model. - int: Reference in which to return the pending driver model. @@ -30492,6 +31615,11 @@ cpdef tuple device_get_driver_model_v2(intptr_t device): cpdef str device_get_vbios_version(intptr_t device): """Get VBIOS version of the device. + For all products. + The VBIOS version may change from time to time. It will not exceed 32 + characters in length (including the NULL terminator). See + nvmlConstants::NVML_DEVICE_VBIOS_VERSION_BUFFER_SIZE. + Args: device (intptr_t): The identifier of the target device. @@ -30511,12 +31639,14 @@ cpdef str device_get_vbios_version(intptr_t device): cpdef object device_get_bridge_chip_info(intptr_t device): """Get Bridge Chip Information for all the bridge chips on the board. + For all fully supported products. Only applicable to multi-GPU products. + Args: device (intptr_t): The identifier of the target device. Returns: - nvmlBridgeChipHierarchy_t: Reference to the returned bridge - chip Hierarchy. + nvmlBridgeChipHierarchy_t: Reference to the returned bridge chip + Hierarchy. .. seealso:: `nvmlDeviceGetBridgeChipInfo` """ @@ -30531,6 +31661,19 @@ cpdef object device_get_bridge_chip_info(intptr_t device): cpdef object device_get_compute_running_processes_v3(intptr_t device): """Get information about processes with a compute context on a device. + For Fermi ™️ or newer fully supported devices. + This function returns information only about compute running processes (e.g. + CUDA application which have active context). Any graphics applications (e.g. + using OpenGL, DirectX) won't be listed by this function. + To query the current number of running compute processes, call this function + with \*info_count = 0. The return code will be NVML_ERROR_INSUFFICIENT_SIZE, or + NVML_SUCCESS if none are running. For this call ``infos`` is allowed to be + NULL. + The usedGpuMemory field returned is all of the memory used by the application. + Keep in mind that information returned by this call is dynamic and the number + of elements might change in time. Allocate more space for ``infos`` table in + case new compute processes are spawned. + Args: device (intptr_t): The device handle or MIG device handle. @@ -30538,6 +31681,12 @@ cpdef object device_get_compute_running_processes_v3(intptr_t device): nvmlProcessInfo_t: Reference in which to return the process information. + .. note:: + In MIG mode, if device handle is provided, the API returns aggregate + information, only if the caller has appropriate privileges. Per-instance + information can be queried by using specific MIG device handles. Querying per- + instance information using MIG device handles is not supported if the device is + in vGPU Host virtualization mode. .. seealso:: `nvmlDeviceGetComputeRunningProcesses_v3` """ cdef unsigned int[1] info_count = [0] @@ -30546,17 +31695,28 @@ cpdef object device_get_compute_running_processes_v3(intptr_t device): check_status_size(__status__) cdef ProcessInfo infos = ProcessInfo(info_count[0]) cdef nvmlProcessInfo_t *infos_ptr = (infos._get_ptr()) - if info_count[0] == 0: - return infos - with nogil: - __status__ = nvmlDeviceGetComputeRunningProcesses_v3(device, info_count, infos_ptr) - check_status(__status__) - return infos + if info_count[0] != 0: + with nogil: + __status__ = nvmlDeviceGetComputeRunningProcesses_v3(device, info_count, infos_ptr) + check_status(__status__) + return infos[:info_count[0]] cpdef object device_get_graphics_running_processes_v3(intptr_t device): """Get information about processes with a graphics context on a device. + For Kepler ™️ or newer fully supported devices. + This function returns information only about graphics based processes (eg. + applications using OpenGL, DirectX). + To query the current number of running graphics processes, call this function + with \*info_count = 0. The return code will be NVML_ERROR_INSUFFICIENT_SIZE, or + NVML_SUCCESS if none are running. For this call ``infos`` is allowed to be + NULL. + The usedGpuMemory field returned is all of the memory used by the application. + Keep in mind that information returned by this call is dynamic and the number + of elements might change in time. Allocate more space for ``infos`` table in + case new graphics processes are spawned. + Args: device (intptr_t): The device handle or MIG device handle. @@ -30564,6 +31724,12 @@ cpdef object device_get_graphics_running_processes_v3(intptr_t device): nvmlProcessInfo_t: Reference in which to return the process information. + .. note:: + In MIG mode, if device handle is provided, the API returns aggregate + information, only if the caller has appropriate privileges. Per-instance + information can be queried by using specific MIG device handles. Querying per- + instance information using MIG device handles is not supported if the device is + in vGPU Host virtualization mode. .. seealso:: `nvmlDeviceGetGraphicsRunningProcesses_v3` """ cdef unsigned int[1] info_count = [0] @@ -30572,17 +31738,29 @@ cpdef object device_get_graphics_running_processes_v3(intptr_t device): check_status_size(__status__) cdef ProcessInfo infos = ProcessInfo(info_count[0]) cdef nvmlProcessInfo_t *infos_ptr = (infos._get_ptr()) - if info_count[0] == 0: - return infos - with nogil: - __status__ = nvmlDeviceGetGraphicsRunningProcesses_v3(device, info_count, infos_ptr) - check_status(__status__) - return infos + if info_count[0] != 0: + with nogil: + __status__ = nvmlDeviceGetGraphicsRunningProcesses_v3(device, info_count, infos_ptr) + check_status(__status__) + return infos[:info_count[0]] cpdef object device_get_mps_compute_running_processes_v3(intptr_t device): """Get information about processes with a Multi-Process Service (MPS) compute context on a device. + For Volta ™️ or newer fully supported devices. + This function returns information only about compute running processes (e.g. + CUDA application which have active context) utilizing MPS. Any graphics + applications (e.g. using OpenGL, DirectX) won't be listed by this function. + To query the current number of running compute processes, call this function + with \*info_count = 0. The return code will be NVML_ERROR_INSUFFICIENT_SIZE, or + NVML_SUCCESS if none are running. For this call ``infos`` is allowed to be + NULL. + The usedGpuMemory field returned is all of the memory used by the application. + Keep in mind that information returned by this call is dynamic and the number + of elements might change in time. Allocate more space for ``infos`` table in + case new compute processes are spawned. + Args: device (intptr_t): The device handle or MIG device handle. @@ -30590,6 +31768,12 @@ cpdef object device_get_mps_compute_running_processes_v3(intptr_t device): nvmlProcessInfo_t: Reference in which to return the process information. + .. note:: + In MIG mode, if device handle is provided, the API returns aggregate + information, only if the caller has appropriate privileges. Per-instance + information can be queried by using specific MIG device handles. Querying per- + instance information using MIG device handles is not supported if the device is + in vGPU Host virtualization mode. .. seealso:: `nvmlDeviceGetMPSComputeRunningProcesses_v3` """ cdef unsigned int[1] info_count = [0] @@ -30598,24 +31782,25 @@ cpdef object device_get_mps_compute_running_processes_v3(intptr_t device): check_status_size(__status__) cdef ProcessInfo infos = ProcessInfo(info_count[0]) cdef nvmlProcessInfo_t *infos_ptr = (infos._get_ptr()) - if info_count[0] == 0: - return infos - with nogil: - __status__ = nvmlDeviceGetMPSComputeRunningProcesses_v3(device, info_count, infos_ptr) - check_status(__status__) - return infos + if info_count[0] != 0: + with nogil: + __status__ = nvmlDeviceGetMPSComputeRunningProcesses_v3(device, info_count, infos_ptr) + check_status(__status__) + return infos[:info_count[0]] cpdef int device_on_same_board(intptr_t device1, intptr_t device2) except? 0: """Check if the GPU devices are on the same physical board. + For all fully supported products. + Args: device1 (intptr_t): The first GPU device. device2 (intptr_t): The second GPU device. Returns: - int: Reference in which to return the status. Non-zero - indicates that the GPUs are on the same board. + int: Reference in which to return the status. Non-zero indicates + that the GPUs are on the same board. .. seealso:: `nvmlDeviceOnSameBoard` """ @@ -30629,6 +31814,8 @@ cpdef int device_on_same_board(intptr_t device1, intptr_t device2) except? 0: cpdef int device_get_api_restriction(intptr_t device, int api_type) except? -1: """Retrieves the root/admin permissions on the target API. See ``nvmlRestrictedAPI_t`` for the list of supported APIs. If an API is restricted only root users can call that API. See ``nvmlDeviceSetAPIRestriction`` to change current permissions. + For all fully supported products. + Args: device (intptr_t): The identifier of the target device. api_type (RestrictedAPI): Target API type for this operation. @@ -30636,8 +31823,8 @@ cpdef int device_get_api_restriction(intptr_t device, int api_type) except? -1: Returns: int: Reference in which to return the current restriction NVML_FEATURE_ENABLED indicates that the API is root-only - NVML_FEATURE_DISABLED indicates that the API is accessible - to all users. + NVML_FEATURE_DISABLED indicates that the API is accessible to + all users. .. seealso:: `nvmlDeviceGetAPIRestriction` """ @@ -30648,16 +31835,79 @@ cpdef int device_get_api_restriction(intptr_t device, int api_type) except? -1: return is_restricted +cpdef tuple device_get_samples(intptr_t device, int type, unsigned long long last_seen_time_stamp): + """Gets recent samples for the GPU. + + For Kepler ™️ or newer fully supported devices. + Based on type, this method can be used to fetch the power, utilization or clock + samples maintained in the buffer by the driver. + Power, Utilization and Clock samples are returned as type "unsigned int" for + the union ``nvmlValue_t``. + To get the size of samples that user needs to allocate, the method is invoked + with samples set to NULL. The returned samplesCount will provide the number of + samples that can be queried. The user needs to allocate the buffer with size as + samplesCount \* sizeof(nvmlSample_t). + last_seen_time_stamp represents CPU timestamp in microseconds. Set it to 0 to + fetch all the samples maintained by the underlying buffer. Set + last_seen_time_stamp to one of the timeStamps retrieved from the date of the + previous query to get more recent samples. + This method fetches the number of entries which can be accommodated in the + provided samples array, and the reference samplesCount is updated to indicate + how many samples were actually retrieved. The advantage of using this method + for samples in contrast to polling via existing methods is to get get higher + frequency data at lower polling cost. + + Args: + device (intptr_t): The identifier for the target device. + type (SamplingType): Type of sampling event. + last_seen_time_stamp (unsigned long long): Return only samples + with timestamp greater than last_seen_time_stamp. + + Returns: + A 2-tuple containing: + - int: Output parameter to represent the type of sample value as + described in nvmlSampleVal_t. + - nvmlSample_t: Reference in which samples are returned. + + .. note:: + On MIG-enabled GPUs, querying the following sample types, + NVML_GPU_UTILIZATION_SAMPLES, NVML_MEMORY_UTILIZATION_SAMPLES + NVML_ENC_UTILIZATION_SAMPLES and NVML_DEC_UTILIZATION_SAMPLES, is not currently + supported. + .. seealso:: `nvmlDeviceGetSamples` + """ + cdef _ValueType sample_val_type + cdef unsigned int[1] sample_count = [0] + with nogil: + __status__ = nvmlDeviceGetSamples(device, <_SamplingType>type, last_seen_time_stamp, &sample_val_type, sample_count, NULL) + check_status_size(__status__) + cdef Sample samples = Sample(sample_count[0]) + cdef nvmlSample_t *samples_ptr = (samples._get_ptr()) + if not (sample_count[0] == 0): + with nogil: + __status__ = nvmlDeviceGetSamples(device, <_SamplingType>type, last_seen_time_stamp, &sample_val_type, sample_count, samples_ptr) + check_status(__status__) + return (sample_val_type, samples[:sample_count[0]]) + + cpdef object device_get_bar1_memory_info(intptr_t device): """Gets Total, Available and Used size of BAR1 memory. + BAR1 is used to map the FB (device memory) so that it can be directly accessed + by the CPU or by 3rd party devices (peer-to-peer on the PCIE bus). + For Kepler ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. Returns: - nvmlBAR1Memory_t: Reference in which BAR1 memory information - is returned. + nvmlBAR1Memory_t: Reference in which BAR1 memory information is + returned. + .. note:: + In MIG mode, if device handle is provided, the API returns aggregate + information, only if the caller has appropriate privileges. Per-instance + information can be queried by using specific MIG device handles. .. seealso:: `nvmlDeviceGetBAR1MemoryInfo` """ cdef BAR1Memory bar1memory_py = BAR1Memory() @@ -30671,12 +31921,13 @@ cpdef object device_get_bar1_memory_info(intptr_t device): cpdef unsigned int device_get_irq_num(intptr_t device) except? 0: """Gets the device's interrupt number. + Args: device (intptr_t): The identifier of the target device. Returns: - unsigned int: The interrupt number associated with the - specified device. + unsigned int: The interrupt number associated with the specified + device. .. seealso:: `nvmlDeviceGetIrqNum` """ @@ -30690,12 +31941,17 @@ cpdef unsigned int device_get_irq_num(intptr_t device) except? 0: cpdef unsigned int device_get_num_gpu_cores(intptr_t device) except? 0: """Gets the device's core count. + Args: device (intptr_t): The identifier of the target device. Returns: unsigned int: The number of cores for the specified device. + .. note:: + On MIG-enabled GPUs, querying the device's core count is currently not + supported using this API. Please use ``nvmlDeviceGetGpuInstanceProfileInfo`` to + fetch the MIG device's core count. .. seealso:: `nvmlDeviceGetNumGpuCores` """ cdef unsigned int num_cores @@ -30708,6 +31964,7 @@ cpdef unsigned int device_get_num_gpu_cores(intptr_t device) except? 0: cpdef unsigned int device_get_power_source(intptr_t device) except *: """Gets the devices power source. + Args: device (intptr_t): The identifier of the target device. @@ -30726,6 +31983,7 @@ cpdef unsigned int device_get_power_source(intptr_t device) except *: cpdef unsigned int device_get_memory_bus_width(intptr_t device) except? 0: """Gets the device's memory bus width. + Args: device (intptr_t): The identifier of the target device. @@ -30744,6 +32002,7 @@ cpdef unsigned int device_get_memory_bus_width(intptr_t device) except? 0: cpdef unsigned int device_get_pcie_link_max_speed(intptr_t device) except? 0: """Gets the device's PCIE Max Link speed in MBPS. + Args: device (intptr_t): The identifier of the target device. @@ -30762,6 +32021,7 @@ cpdef unsigned int device_get_pcie_link_max_speed(intptr_t device) except? 0: cpdef unsigned int device_get_pcie_speed(intptr_t device) except? 0: """Gets the device's PCIe Link speed in Mbps. + Args: device (intptr_t): The identifier of the target device. @@ -30780,6 +32040,7 @@ cpdef unsigned int device_get_pcie_speed(intptr_t device) except? 0: cpdef unsigned int device_get_adaptive_clock_info_status(intptr_t device) except? 0: """Gets the device's Adaptive Clock status. + Args: device (intptr_t): The identifier of the target device. @@ -30800,6 +32061,14 @@ cpdef unsigned int device_get_adaptive_clock_info_status(intptr_t device) except cpdef unsigned int device_get_bus_type(intptr_t device) except? 0: """Get the type of the GPU Bus (PCIe, PCI, ...). + return. + + - ``NVML_SUCCESS`` if the bus ``type`` is successfully retreived. + - ``NVML_ERROR_UNINITIALIZED`` if the library has not been successfully + initialized. + - ``NVML_ERROR_INVALID_ARGUMENT`` if ``device`` is invalid or ``type`` is NULL. + - ``NVML_ERROR_UNKNOWN`` on any unexpected error. + Args: device (intptr_t): The identifier of the target device. @@ -30818,6 +32087,9 @@ cpdef unsigned int device_get_bus_type(intptr_t device) except? 0: cpdef object system_get_conf_compute_capabilities(): """Get Conf Computing System capabilities. + For Ampere ™️ or newer fully supported devices. Supported on Linux, Windows + TCC. + Returns: nvmlConfComputeSystemCaps_t: System CC capabilities. @@ -30834,6 +32106,9 @@ cpdef object system_get_conf_compute_capabilities(): cpdef object system_get_conf_compute_state(): """Get Conf Computing System State. + For Ampere ™️ or newer fully supported devices. Supported on Linux, Windows + TCC. + Returns: nvmlConfComputeSystemState_t: System CC State. @@ -30850,12 +32125,14 @@ cpdef object system_get_conf_compute_state(): cpdef object device_get_conf_compute_mem_size_info(intptr_t device): """Get Conf Computing Protected and Unprotected Memory Sizes. + For Ampere ™️ or newer fully supported devices. Supported on Linux, Windows + TCC. + Args: device (intptr_t): Device handle. Returns: - nvmlConfComputeMemSizeInfo_t: Protected/Unprotected Memory - sizes. + nvmlConfComputeMemSizeInfo_t: Protected/Unprotected Memory sizes. .. seealso:: `nvmlDeviceGetConfComputeMemSizeInfo` """ @@ -30870,6 +32147,16 @@ cpdef object device_get_conf_compute_mem_size_info(intptr_t device): cpdef unsigned int system_get_conf_compute_gpus_ready_state() except? 0: """Get Conf Computing GPUs ready state. + For Ampere ™️ or newer fully supported devices. Supported on Linux, Windows + TCC. + return. + + - ``NVML_SUCCESS`` if ``current`` GPUs ready state were successfully queried. + - ``NVML_ERROR_UNINITIALIZED`` if the library has not been successfully + initialized. + - ``NVML_ERROR_INVALID_ARGUMENT`` if ``is_accepting_work`` is NULL. + - ``NVML_ERROR_NOT_SUPPORTED`` if this query is not supported by the device. + Returns: unsigned int: Returns GPU current work accepting state, NVML_CC_ACCEPTING_CLIENT_REQUESTS_TRUE or @@ -30887,12 +32174,14 @@ cpdef unsigned int system_get_conf_compute_gpus_ready_state() except? 0: cpdef object device_get_conf_compute_protected_memory_usage(intptr_t device): """Get Conf Computing protected memory usage. + For Ampere ™️ or newer fully supported devices. Supported on Linux, Windows + TCC. + Args: device (intptr_t): The identifier of the target device. Returns: - nvmlMemory_t: Reference in which to return the memory - information. + nvmlMemory_t: Reference in which to return the memory information. .. seealso:: `nvmlDeviceGetConfComputeProtectedMemoryUsage` """ @@ -30907,12 +32196,15 @@ cpdef object device_get_conf_compute_protected_memory_usage(intptr_t device): cpdef object device_get_conf_compute_gpu_certificate(intptr_t device): """Get Conf Computing GPU certificate details. + For Ampere ™️ or newer fully supported devices. Supported on Linux, Windows + TCC. + Args: device (intptr_t): The identifier of the target device. Returns: - nvmlConfComputeGpuCertificate_t: Reference in which to return - the gpu certificate information. + nvmlConfComputeGpuCertificate_t: Reference in which to return the + gpu certificate information. .. seealso:: `nvmlDeviceGetConfComputeGpuCertificate` """ @@ -30927,10 +32219,13 @@ cpdef object device_get_conf_compute_gpu_certificate(intptr_t device): cpdef device_set_conf_compute_unprotected_mem_size(intptr_t device, unsigned long long size_ki_b): """Set Conf Computing Unprotected Memory Size. + For Ampere ™️ or newer fully supported devices. Supported on Linux, Windows + TCC. + Args: device (intptr_t): Device Handle. - size_ki_b (unsigned long long): Unprotected Memory size to be - set in KiB. + size_ki_b (unsigned long long): Unprotected Memory size to be set + in KiB. .. seealso:: `nvmlDeviceSetConfComputeUnprotectedMemSize` """ @@ -30942,6 +32237,16 @@ cpdef device_set_conf_compute_unprotected_mem_size(intptr_t device, unsigned lon cpdef system_set_conf_compute_gpus_ready_state(unsigned int is_accepting_work): """Set Conf Computing GPUs ready state. + For Ampere ™️ or newer fully supported devices. Supported on Linux, Windows + TCC. + return. + + - ``NVML_SUCCESS`` if ``current`` GPUs ready state is successfully set. + - ``NVML_ERROR_UNINITIALIZED`` if the library has not been successfully + initialized. + - ``NVML_ERROR_INVALID_ARGUMENT`` if ``is_accepting_work`` is invalid. + - ``NVML_ERROR_NOT_SUPPORTED`` if this query is not supported by the device. + Args: is_accepting_work (unsigned int): GPU accepting new work, NVML_CC_ACCEPTING_CLIENT_REQUESTS_TRUE or @@ -30957,6 +32262,9 @@ cpdef system_set_conf_compute_gpus_ready_state(unsigned int is_accepting_work): cpdef object system_get_conf_compute_settings(): """Get Conf Computing System Settings. + For Hopper ™️ or newer fully supported devices. Supported on Linux, Windows + TCC. + Returns: nvmlSystemConfComputeSettings_v1_t: System CC settings. @@ -30974,6 +32282,9 @@ cpdef object system_get_conf_compute_settings(): cpdef char device_get_gsp_firmware_version(intptr_t device) except? 0: """Retrieve GSP firmware version. + The caller passes in buffer via ``version`` and corresponding GSP firmware + numbered version is returned with the same parameter in string format. + Args: device (intptr_t): Device handle. @@ -30992,15 +32303,18 @@ cpdef char device_get_gsp_firmware_version(intptr_t device) except? 0: cpdef tuple device_get_gsp_firmware_mode(intptr_t device): """Retrieve GSP firmware mode. + The caller passes in integer pointers. GSP firmware enablement and default mode + information is returned with corresponding parameters. The return value in + ``is_enabled`` and ``default_mode`` should be treated as boolean. + Args: device (intptr_t): Device handle. Returns: A 2-tuple containing: - - unsigned int: Pointer to specify if GSP firmware is enabled. - - unsigned int: Pointer to specify if GSP firmware is supported - by default on ``device``. + - unsigned int: Pointer to specify if GSP firmware is supported by + default on ``device``. .. seealso:: `nvmlDeviceGetGspFirmwareMode` """ @@ -31015,6 +32329,10 @@ cpdef tuple device_get_gsp_firmware_mode(intptr_t device): cpdef object device_get_sram_ecc_error_status(intptr_t device): """Get SRAM ECC error status of this device. + For Ampere ™️ or newer fully supported devices. Requires root/admin + permissions. + See ``nvmlEccSramErrorStatus_v1_t`` for more information on the struct. + Args: device (intptr_t): The identifier of the target device. @@ -31035,6 +32353,10 @@ cpdef object device_get_sram_ecc_error_status(intptr_t device): cpdef int device_get_accounting_mode(intptr_t device) except? -1: """Queries the state of per process accounting mode. + For Kepler ™️ or newer fully supported devices. + See ``nvmlDeviceGetAccountingStats`` for more details. See + ``nvmlDeviceSetAccountingMode``. + Args: device (intptr_t): The identifier of the target device. @@ -31053,15 +32375,38 @@ cpdef int device_get_accounting_mode(intptr_t device) except? -1: cpdef object device_get_accounting_stats(intptr_t device, unsigned int pid): """Queries process's accounting stats. + For Kepler ™️ or newer fully supported devices. + Accounting stats capture GPU utilization and other statistics across the + lifetime of a process. Accounting stats can be queried during life time of the + process and after its termination. The time field in ``nvmlAccountingStats_t`` + is reported as 0 during the lifetime of the process and updated to actual + running time after its termination. Accounting stats are kept in a circular + buffer, newly created processes overwrite information about old processes. + See ``nvmlAccountingStats_t`` for description of each returned metric. List of + processes that can be queried can be retrieved from + ``nvmlDeviceGetAccountingPids``. + Args: device (intptr_t): The identifier of the target device. pid (unsigned int): Process Id of the target process to query stats for. Returns: - nvmlAccountingStats_t: Reference in which to return the - process's accounting stats. - + nvmlAccountingStats_t: Reference in which to return the process's + accounting stats. + + .. note:: + Accounting Mode needs to be on. See ``nvmlDeviceGetAccountingMode``. + .. note:: + Only compute and graphics applications stats can be queried. Monitoring + applications stats can't be queried since they don't contribute to GPU + utilization. + .. note:: + In case of pid collision stats of only the latest process (that terminated + last) will be reported. + .. note:: + On Kepler devices per process statistics are accurate only if there's one + process running on a GPU. .. seealso:: `nvmlDeviceGetAccountingStats` """ cdef AccountingStats stats_py = AccountingStats() @@ -31075,39 +32420,51 @@ cpdef object device_get_accounting_stats(intptr_t device, unsigned int pid): cpdef object device_get_accounting_pids(intptr_t device): """Queries list of processes that can be queried for accounting stats. The list of processes returned can be in running or terminated state. + For Kepler ™️ or newer fully supported devices. + To query the number of processes under Accounting Mode, call this function with + \*count = 0 and pids=NULL. The return code will be NVML_ERROR_INSUFFICIENT_SIZE + with an updated count value indicating the number of processes. + For more details see ``nvmlDeviceGetAccountingStats``. + Args: device (intptr_t): The identifier of the target device. Returns: - unsigned int: Reference in which to return list of process - ids. + unsigned int: Reference in which to return list of process ids. + .. note:: + In case of PID collision some processes might not be accessible before the + circular buffer is full. .. seealso:: `nvmlDeviceGetAccountingPids` """ cdef unsigned int[1] count = [0] with nogil: __status__ = nvmlDeviceGetAccountingPids(device, count, NULL) check_status_size(__status__) - if count[0] == 0: - return _cyb_view.array(shape=(1,), itemsize=sizeof(unsigned int), format="I", mode="c")[:0] - cdef _cyb_view.array pids = _cyb_view.array(shape=(count[0],), itemsize=sizeof(unsigned int), format="I", mode="c") - cdef unsigned int *pids_ptr = (pids.data) - with nogil: - __status__ = nvmlDeviceGetAccountingPids(device, count, pids_ptr) - check_status(__status__) - return pids + cdef _cyb_view.array _pids_alloc_ = _cyb_view.array(shape=(max(count[0], 1),), itemsize=sizeof(unsigned int), format="I", mode="c") + cdef unsigned int *pids_ptr = (_pids_alloc_.data) + cdef object pids = _pids_alloc_[:count[0]] + if count[0] != 0: + with nogil: + __status__ = nvmlDeviceGetAccountingPids(device, count, pids_ptr) + check_status(__status__) + return pids[:count[0]] cpdef unsigned int device_get_accounting_buffer_size(intptr_t device) except? 0: """Returns the number of processes that the circular buffer with accounting pids can hold. + For Kepler ™️ or newer fully supported devices. + This is the maximum number of processes that accounting information will be + stored for before information about oldest processes will get overwritten by + information about new processes. + Args: device (intptr_t): The identifier of the target device. Returns: - unsigned int: Reference in which to provide the size (in - number of elements) of the circular buffer for accounting - stats. + unsigned int: Reference in which to provide the size (in number of + elements) of the circular buffer for accounting stats. .. seealso:: `nvmlDeviceGetAccountingBufferSize` """ @@ -31121,6 +32478,8 @@ cpdef unsigned int device_get_accounting_buffer_size(intptr_t device) except? 0: cpdef object device_get_retired_pages(intptr_t device, int cause): """Returns the list of retired pages by source, including pages that are pending retirement The address information provided from this API is the hardware address of the page that was retired. Note that this does not match the virtual address used in CUDA, but will match the address information in Xid 63. + For Kepler ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. cause (PageRetirementCause): Filter page addresses by cause of @@ -31135,19 +32494,60 @@ cpdef object device_get_retired_pages(intptr_t device, int cause): with nogil: __status__ = nvmlDeviceGetRetiredPages(device, <_PageRetirementCause>cause, page_count, NULL) check_status_size(__status__) - if page_count[0] == 0: - return _cyb_view.array(shape=(1,), itemsize=sizeof(unsigned long long), format="Q", mode="c")[:0] - cdef _cyb_view.array addresses = _cyb_view.array(shape=(page_count[0],), itemsize=sizeof(unsigned long long), format="Q", mode="c") - cdef unsigned long long *addresses_ptr = (addresses.data) + cdef _cyb_view.array _addresses_alloc_ = _cyb_view.array(shape=(max(page_count[0], 1),), itemsize=sizeof(unsigned long long), format="Q", mode="c") + cdef unsigned long long *addresses_ptr = (_addresses_alloc_.data) + cdef object addresses = _addresses_alloc_[:page_count[0]] + if page_count[0] != 0: + with nogil: + __status__ = nvmlDeviceGetRetiredPages(device, <_PageRetirementCause>cause, page_count, addresses_ptr) + check_status(__status__) + return addresses[:page_count[0]] + + +cpdef tuple device_get_retired_pages_v2(intptr_t device, int cause): + """Returns the list of retired pages by source, including pages that are pending retirement The address information provided from this API is the hardware address of the page that was retired. Note that this does not match the virtual address used in CUDA, but will match the address information in Xid 63. + + For Kepler ™️ or newer fully supported devices. + + Args: + device (intptr_t): The identifier of the target device. + cause (PageRetirementCause): Filter page addresses by cause of + retirement. + + Returns: + A 2-tuple containing: + - unsigned long long: Buffer to write the page addresses into. + - unsigned long long: Buffer to write the timestamps of page + retirement, additional for _v2. + + .. note:: + nvmlDeviceGetRetiredPages_v2 adds an additional timestamps parameter to return + the time of each page's retirement. This is supported for Pascal and newer + architecture. + .. seealso:: `nvmlDeviceGetRetiredPages_v2` + """ + cdef unsigned int[1] page_count = [0] with nogil: - __status__ = nvmlDeviceGetRetiredPages(device, <_PageRetirementCause>cause, page_count, addresses_ptr) - check_status(__status__) - return addresses + __status__ = nvmlDeviceGetRetiredPages_v2(device, <_PageRetirementCause>cause, page_count, NULL, NULL) + check_status_size(__status__) + cdef _cyb_view.array _addresses_alloc_ = _cyb_view.array(shape=(max(page_count[0], 1),), itemsize=sizeof(unsigned long long), format="Q", mode="c") + cdef unsigned long long *addresses_ptr = (_addresses_alloc_.data) + cdef object addresses = _addresses_alloc_[:page_count[0]] + cdef _cyb_view.array _timestamps_alloc_ = _cyb_view.array(shape=(max(page_count[0], 1),), itemsize=sizeof(unsigned long long), format="Q", mode="c") + cdef unsigned long long *timestamps_ptr = (_timestamps_alloc_.data) + cdef object timestamps = _timestamps_alloc_[:page_count[0]] + if not (page_count[0] == 0): + with nogil: + __status__ = nvmlDeviceGetRetiredPages_v2(device, <_PageRetirementCause>cause, page_count, addresses_ptr, timestamps_ptr) + check_status(__status__) + return (addresses[:page_count[0]], timestamps[:page_count[0]]) cpdef int device_get_retired_pages_pending_status(intptr_t device) except? -1: """Check if any pages are pending retirement and need a reboot to fully retire. + For Kepler ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. @@ -31166,21 +32566,24 @@ cpdef int device_get_retired_pages_pending_status(intptr_t device) except? -1: cpdef tuple device_get_remapped_rows(intptr_t device): """Get number of remapped rows. The number of rows reported will be based on the cause of the remapping. is_pending indicates whether or not there are pending remappings. A reset will be required to actually remap the row. failure_occurred will be set if a row remapping ever failed in the past. A pending remapping won't affect future work on the GPU since error-containment and dynamic page blacklisting will take care of that. + For Ampere ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. Returns: A 4-tuple containing: - - unsigned int: Reference for number of rows remapped due to - correctable errors. + correctable errors. - unsigned int: Reference for number of rows remapped due to - uncorrectable errors. - - unsigned int: Reference for whether or not remappings are - pending. - - unsigned int: Reference that is set when a remapping has - failed in the past. - + uncorrectable errors. + - unsigned int: Reference for whether or not remappings are pending. + - unsigned int: Reference that is set when a remapping has failed in + the past. + + .. note:: + On MIG-enabled GPUs with active instances, querying the number of remapped rows + is not supported. .. seealso:: `nvmlDeviceGetRemappedRows` """ cdef unsigned int corr_rows @@ -31196,6 +32599,7 @@ cpdef tuple device_get_remapped_rows(intptr_t device): cpdef object device_get_row_remapper_histogram(intptr_t device): """Get the row remapper histogram. Returns the remap availability for each bank on the GPU. + Args: device (intptr_t): Device handle. @@ -31215,12 +32619,13 @@ cpdef object device_get_row_remapper_histogram(intptr_t device): cpdef unsigned int device_get_architecture(intptr_t device) except? 0: """Get architecture for device. + Args: device (intptr_t): The identifier of the target device. Returns: - unsigned int: Reference where architecture is returned, if - call successful. Set to NVML_DEVICE_ARCH_* upon success. + unsigned int: Reference where architecture is returned, if call + successful. Set to NVML_DEVICE_ARCH_* upon success. .. seealso:: `nvmlDeviceGetArchitecture` """ @@ -31234,12 +32639,15 @@ cpdef unsigned int device_get_architecture(intptr_t device) except? 0: cpdef object device_get_clk_mon_status(intptr_t device): """Retrieves the frequency monitor fault status for the device. + For Ampere ™️ or newer fully supported devices. Requires root user. + See ``nvmlClkMonStatus_t`` for details on decoding the status output. + Args: device (intptr_t): The identifier of the target device. Returns: - nvmlClkMonStatus_t: Reference in which to return the clkmon - fault status. + nvmlClkMonStatus_t: Reference in which to return the clkmon fault + status. .. seealso:: `nvmlDeviceGetClkMonStatus` """ @@ -31254,16 +32662,43 @@ cpdef object device_get_clk_mon_status(intptr_t device): cpdef object device_get_process_utilization(intptr_t device, unsigned long long last_seen_time_stamp): """Retrieves the current utilization and process ID. + For Maxwell ™️ or newer fully supported devices. + Reads recent utilization of GPU SM (3D/Compute), framebuffer, video encoder, + and video decoder for processes running. Utilization values are returned as an + array of utilization sample structures in the caller-supplied buffer pointed at + by ``utilization``. One utilization sample structure is returned per process + running, that had some non-zero utilization during the last sample period. It + includes the CPU timestamp at which the samples were recorded. Individual + utilization values are returned as "unsigned int" values. If no valid sample + entries are found since the last_seen_time_stamp, NVML_ERROR_NOT_FOUND is + returned. + To read utilization values, first determine the size of buffer required to hold + the samples by invoking the function with ``utilization`` set to NULL. The + caller should allocate a buffer of size process_samples_count \* + sizeof(nvmlProcessUtilizationSample_t). Invoke the function again with the + allocated buffer passed in ``utilization``, and ``process_samples_count`` set + to the number of entries the buffer is sized for. + On successful return, the function updates ``process_samples_count`` with the + number of process utilization sample structures that were actually written. + This may differ from a previously read value as instances are created or + destroyed. + last_seen_time_stamp represents the CPU timestamp in microseconds at which + utilization samples were last read. Set it to 0 to read utilization based on + all the samples maintained by the driver's internal sample buffer. Set + last_seen_time_stamp to a timeStamp retrieved from a previous query to read + utilization since the previous query. + Args: device (intptr_t): The identifier of the target device. last_seen_time_stamp (unsigned long long): Return only samples with timestamp greater than last_seen_time_stamp. Returns: - nvmlProcessUtilizationSample_t: Pointer to caller-supplied - buffer in which guest process utilization samples are - returned. + nvmlProcessUtilizationSample_t: Pointer to caller-supplied buffer + in which guest process utilization samples are returned. + .. note:: + On MIG-enabled GPUs, querying process utilization is not currently supported. .. seealso:: `nvmlDeviceGetProcessUtilization` """ cdef unsigned int[1] process_samples_count = [0] @@ -31272,17 +32707,23 @@ cpdef object device_get_process_utilization(intptr_t device, unsigned long long check_status_size(__status__) cdef ProcessUtilizationSample utilization = ProcessUtilizationSample(process_samples_count[0]) cdef nvmlProcessUtilizationSample_t *utilization_ptr = (utilization._get_ptr()) - if process_samples_count[0] == 0: - return utilization - with nogil: - __status__ = nvmlDeviceGetProcessUtilization(device, utilization_ptr, process_samples_count, last_seen_time_stamp) - check_status(__status__) - return utilization + if process_samples_count[0] != 0: + with nogil: + __status__ = nvmlDeviceGetProcessUtilization(device, utilization_ptr, process_samples_count, last_seen_time_stamp) + check_status(__status__) + return utilization[:process_samples_count[0]] cpdef unit_set_led_state(intptr_t unit, int color): """Set the LED state for the unit. The LED can be either green (0) or amber (1). + For S-class products. Requires root/admin permissions. + This operation takes effect immediately. + Current S-Class products don't provide unique LEDs for each unit. As such, both + front and back LEDs will be toggled in unison regardless of which unit is + specified with this command. + See ``nvmlLedColor_t`` for available colors. + Args: unit (intptr_t): The identifier of the target unit. color (LedColor): The target LED color. @@ -31297,6 +32738,18 @@ cpdef unit_set_led_state(intptr_t unit, int color): cpdef device_set_persistence_mode(intptr_t device, int mode): """Set the persistence mode for the device. + For all products. For Linux only. Requires root/admin permissions. + The persistence mode determines whether the GPU driver software is torn down + after the last client exits. + This operation takes effect immediately. It is not persistent across reboots. + After each reboot the persistence mode is reset to "Disabled". + See ``nvmlEnableState_t`` for available modes. + After calling this API with mode set to NVML_FEATURE_DISABLED on a device that + has its own NUMA memory, the given device handle will no longer be valid, and + to continue to interact with this device, a new handle should be obtained from + one of the nvmlDeviceGetHandleBy*() APIs. This limitation is currently only + applicable to devices that have a coherent NVLink connection to system memory. + Args: device (intptr_t): The identifier of the target device. mode (EnableState): The target persistence mode. @@ -31311,11 +32764,21 @@ cpdef device_set_persistence_mode(intptr_t device, int mode): cpdef device_set_compute_mode(intptr_t device, int mode): """Set the compute mode for the device or MIG device. + For all products. Requires root/admin permissions. + The compute mode determines whether a GPU can be used for compute operations + and whether it can be shared across contexts. + This operation takes effect immediately. Under Linux it is not persistent + across reboots and always resets to "Default". Under windows it is persistent. + Under windows compute mode may only be set to DEFAULT when running in WDDM. + See ``nvmlComputeMode_t`` for details on available compute modes. + Args: - device (intptr_t): The identifier of the target device handle - or MIG device handle. + device (intptr_t): The identifier of the target device handle or + MIG device handle. mode (ComputeMode): The target compute mode. + .. note:: + If MIG is enabled on a GPU, device must be MIG device handle. .. seealso:: `nvmlDeviceSetComputeMode` """ with nogil: @@ -31326,6 +32789,13 @@ cpdef device_set_compute_mode(intptr_t device, int mode): cpdef device_set_ecc_mode(intptr_t device, int ecc): """Set the ECC mode for the device. + For Kepler ™️ or newer fully supported devices. Only applicable to devices with + ECC. Requires ``NVML_INFOROM_ECC`` version 1.0 or higher. Requires root/admin + permissions. + The ECC mode determines whether the GPU enables its ECC support. + This operation takes effect after the next reboot. + See ``nvmlEnableState_t`` for details on available modes. + Args: device (intptr_t): The identifier of the target device. ecc (EnableState): The target ECC mode. @@ -31340,10 +32810,20 @@ cpdef device_set_ecc_mode(intptr_t device, int ecc): cpdef device_clear_ecc_error_counts(intptr_t device, int counter_type): """Clear the ECC error and other memory error counts for the device. + For Kepler ™️ or newer fully supported devices. Only applicable to devices with + ECC. Requires ``NVML_INFOROM_ECC`` version 2.0 or higher to clear aggregate + location-based ECC counts. Requires ``NVML_INFOROM_ECC`` version 1.0 or higher + to clear all other ECC counts. Requires root/admin permissions. Requires ECC + Mode to be enabled. + Sets all of the specified ECC counters to 0, including both detailed and total + counts. + This operation takes effect immediately. + See ``nvmlMemoryErrorType_t`` for details on available counter types. + Args: device (intptr_t): The identifier of the target device. - counter_type (EccCounterType): Flag that indicates which type - of errors should be cleared. + counter_type (EccCounterType): Flag that indicates which type of + errors should be cleared. .. seealso:: `nvmlDeviceClearEccErrorCounts` """ @@ -31355,6 +32835,25 @@ cpdef device_clear_ecc_error_counts(intptr_t device, int counter_type): cpdef device_set_driver_model(intptr_t device, int driver_model, unsigned int flags): """Set the driver model for the device. + For Fermi ™️ or newer fully supported devices. For windows only. Requires + root/admin permissions. + On Windows platforms the device driver can run in either WDDM or WDM (TCC) + mode. If a display is attached to the device it must run in WDDM mode. + Driver-model availability is architecture-specific; attempting to set an + unsupported driver model returns NVML_ERROR_NOT_SUPPORTED. + It is possible to force the change to WDM (TCC) while the display is still + attached with a force flag (nvmlFlagForce). This should only be done if the + host is subsequently powered down and the display is detached from the device + before the next reboot. + This operation takes effect after the next reboot. + Windows driver model may only be set to WDDM when running in DEFAULT compute + mode. + Change driver model to WDDM is not supported when GPU doesn't support graphics + acceleration or will not support it after reboot. See + ``nvmlDeviceSetGpuOperationMode``. + See ``nvmlDriverModel_t`` for details on available driver models. See + ``nvmlFlagDefault`` and ``nvmlFlagForce``. + Args: device (intptr_t): The identifier of the target device. driver_model (DriverModel): The target driver model. @@ -31370,12 +32869,30 @@ cpdef device_set_driver_model(intptr_t device, int driver_model, unsigned int fl cpdef device_set_gpu_locked_clocks(intptr_t device, unsigned int min_gpu_clock_m_hz, unsigned int max_gpu_clock_m_hz): """Set clocks that device will lock to. + Sets the clocks that the device will be running at to the value in the range of + min_gpu_clock_m_hz to max_gpu_clock_m_hz. + Can be used as a setting to request constant performance. + This can be called with a pair of integer clock frequencies in MHz, or a pair + of /ref ``nvmlClockLimitId_t`` values. See the table below for valid + combinations of these values. + minGpuClock | maxGpuClock | Effect + ---------—+----------—+-----------------------------------------------— tdp | + tdp | Lock clock to TDP unlimited | tdp | Upper bound is TDP but clock may + drift below this tdp | unlimited | Lower bound is TDP but clock may boost above + this unlimited | unlimited | Unlocked (== nvmlDeviceResetGpuLockedClocks). + If one arg takes one of these values, the other must be one of these values as + well. Mixed numeric and symbolic calls return NVML_ERROR_INVALID_ARGUMENT. + Requires root/admin permissions. + After system reboot or driver reload GPU clocks go back to their default value. + See ``nvmlDeviceResetGpuLockedClocks``. + For Volta ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. - min_gpu_clock_m_hz (unsigned int): Requested minimum gpu clock - in MHz. - max_gpu_clock_m_hz (unsigned int): Requested maximum gpu clock - in MHz. + min_gpu_clock_m_hz (unsigned int): Requested minimum gpu clock in + MHz. + max_gpu_clock_m_hz (unsigned int): Requested maximum gpu clock in + MHz. .. seealso:: `nvmlDeviceSetGpuLockedClocks` """ @@ -31387,6 +32904,10 @@ cpdef device_set_gpu_locked_clocks(intptr_t device, unsigned int min_gpu_clock_m cpdef device_reset_gpu_locked_clocks(intptr_t device): """Resets the gpu clock to the default value. + This is the gpu clock that will be used after system reboot or driver reload. + Default values are idle clocks. + For Volta ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. @@ -31400,12 +32921,20 @@ cpdef device_reset_gpu_locked_clocks(intptr_t device): cpdef device_set_memory_locked_clocks(intptr_t device, unsigned int min_mem_clock_m_hz, unsigned int max_mem_clock_m_hz): """Set memory clocks that device will lock to. + Sets the device's memory clocks to the value in the range of min_mem_clock_m_hz + to max_mem_clock_m_hz. + Can be used as a setting to request constant performance. + Requires root/admin permissions. + After system reboot or driver reload memory clocks go back to their default + value. See ``nvmlDeviceResetMemoryLockedClocks``. + For Ampere ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. - min_mem_clock_m_hz (unsigned int): Requested minimum memory - clock in MHz. - max_mem_clock_m_hz (unsigned int): Requested maximum memory - clock in MHz. + min_mem_clock_m_hz (unsigned int): Requested minimum memory clock + in MHz. + max_mem_clock_m_hz (unsigned int): Requested maximum memory clock + in MHz. .. seealso:: `nvmlDeviceSetMemoryLockedClocks` """ @@ -31417,6 +32946,10 @@ cpdef device_set_memory_locked_clocks(intptr_t device, unsigned int min_mem_cloc cpdef device_reset_memory_locked_clocks(intptr_t device): """Resets the memory clock to the default value. + This is the memory clock that will be used after system reboot or driver + reload. Default values are idle clocks. + For Ampere ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. @@ -31430,6 +32963,18 @@ cpdef device_reset_memory_locked_clocks(intptr_t device): cpdef device_set_auto_boosted_clocks_enabled(intptr_t device, int enabled): """Try to set the current state of Auto Boosted clocks on a device. + For Kepler ™️ or newer fully supported devices. + Auto Boosted clocks are enabled by default on some hardware, allowing the GPU + to run at higher clock rates to maximize performance as thermal limits allow. + Auto Boosted clocks should be disabled if fixed clock rates are desired. + Non-root users may use this API by default but can be restricted by root from + using this API by calling ``nvmlDeviceSetAPIRestriction`` with + apiType=NVML_RESTRICTED_API_SET_AUTO_BOOSTED_CLOCKS. Note: Persistence Mode is + required to modify current Auto Boost settings, therefore, it must be enabled. + On Pascal and newer hardware, Auto Boosted clocks are controlled through + application clocks. Use nvmlDeviceSetApplicationsClocks and + nvmlDeviceResetApplicationsClocks to control Auto Boost behavior. + Args: device (intptr_t): The identifier of the target device. enabled (EnableState): What state to try to set Auto Boosted @@ -31445,6 +32990,15 @@ cpdef device_set_auto_boosted_clocks_enabled(intptr_t device, int enabled): cpdef device_set_default_auto_boosted_clocks_enabled(intptr_t device, int enabled, unsigned int flags): """Try to set the default state of Auto Boosted clocks on a device. This is the default state that Auto Boosted clocks will return to when no compute running processes (e.g. CUDA application which have an active context) are running. + For Kepler ™️ or newer non-GeForce fully supported devices and Maxwell or newer + GeForce devices. Requires root/admin permissions. + Auto Boosted clocks are enabled by default on some hardware, allowing the GPU + to run at higher clock rates to maximize performance as thermal limits allow. + Auto Boosted clocks should be disabled if fixed clock rates are desired. + On Pascal and newer hardware, Auto Boosted clocks are controlled through + application clocks. Use nvmlDeviceSetApplicationsClocks and + nvmlDeviceResetApplicationsClocks to control Auto Boost behavior. + Args: device (intptr_t): The identifier of the target device. enabled (EnableState): What state to try to set default Auto @@ -31462,6 +33016,8 @@ cpdef device_set_default_auto_boosted_clocks_enabled(intptr_t device, int enable cpdef device_set_default_fan_speed_v2(intptr_t device, unsigned int fan): """Sets the speed of the fan control policy to default. + For all cuda-capable discrete products with fans. + Args: device (intptr_t): The identifier of the target device. fan (unsigned int): The index of the fan, starting at zero. @@ -31476,6 +33032,10 @@ cpdef device_set_default_fan_speed_v2(intptr_t device, unsigned int fan): cpdef device_set_fan_control_policy(intptr_t device, unsigned int fan, unsigned int policy): """Sets current fan control policy. + For Maxwell ™️ or newer fully supported devices. + Requires privileged user. + For all cuda-capable discrete products with fans. + Args: device (intptr_t): The identifier of the target ``device``. fan (unsigned int): The index of the fan, starting at zero. @@ -31491,6 +33051,16 @@ cpdef device_set_fan_control_policy(intptr_t device, unsigned int fan, unsigned cpdef device_set_gpu_operation_mode(intptr_t device, int mode): """Sets new GOM. See ``nvmlGpuOperationMode_t`` for details. + For GK110 M-class and X-class Tesla ™️ products from the Kepler family. Modes + ``NVML_GOM_LOW_DP`` and ``NVML_GOM_ALL_ON`` are supported on fully supported + GeForce products. Not supported on Quadro ®️ and Tesla ™️ C-class products. + Requires root/admin permissions. + Changing GOMs requires a reboot. The reboot requirement might be removed in the + future. + Compute only GOMs don't support graphics acceleration. Under windows switching + to these GOMs when pending driver model is WDDM is not supported. See + ``nvmlDeviceSetDriverModel``. + Args: device (intptr_t): The identifier of the target device. mode (GpuOperationMode): Target GOM. @@ -31505,6 +33075,9 @@ cpdef device_set_gpu_operation_mode(intptr_t device, int mode): cpdef device_set_api_restriction(intptr_t device, int api_type, int is_restricted): """Changes the root/admin restructions on certain APIs. See ``nvmlRestrictedAPI_t`` for the list of supported APIs. This method can be used by a root/admin user to give non-root/admin access to certain otherwise-restricted APIs. The new setting lasts for the lifetime of the NVIDIA driver; it is not persistent. See ``nvmlDeviceGetAPIRestriction`` to query the current restriction settings. + For Kepler ™️ or newer fully supported devices. Requires root/admin + permissions. + Args: device (intptr_t): The identifier of the target device. api_type (RestrictedAPI): Target API type for this operation. @@ -31520,11 +33093,27 @@ cpdef device_set_api_restriction(intptr_t device, int api_type, int is_restricte cpdef device_set_fan_speed_v2(intptr_t device, unsigned int fan, unsigned int speed): """Sets the speed of a specified fan. + WARNING: This function changes the fan control policy to manual. It means that + YOU have to monitor the temperature and adjust the fan speed accordingly. If + you set the fan speed too low you can burn your GPU! Use + nvmlDeviceSetDefaultFanSpeed_v2 to restore default control policy. + For all cuda-capable discrete products with fans that are Maxwell or Newer. + return. + + - ``NVML_SUCCESS`` if the fan speed has been set. + - ``NVML_ERROR_UNINITIALIZED`` if the library has not been successfully + initialized. + - ``NVML_ERROR_INVALID_ARGUMENT`` if the device is not valid, or the speed is + outside acceptable ranges, or if the fan index doesn't reference an actual + fan. + - ``NVML_ERROR_NOT_SUPPORTED`` if the device is older than Maxwell. + - ``NVML_ERROR_UNKNOWN`` if there was an unexpected error. + Args: device (intptr_t): The identifier of the target device. fan (unsigned int): The index of the fan, starting at zero. - speed (unsigned int): The target speed of the fan [0-100] in % - of max speed. + speed (unsigned int): The target speed of the fan [0-100] in % of + max speed. .. seealso:: `nvmlDeviceSetFanSpeed_v2` """ @@ -31536,10 +33125,26 @@ cpdef device_set_fan_speed_v2(intptr_t device, unsigned int fan, unsigned int sp cpdef device_set_accounting_mode(intptr_t device, int mode): """Enables or disables per process accounting. + For Kepler ™️ or newer fully supported devices. Requires root/admin + permissions. + See ``nvmlDeviceGetAccountingMode`` See ``nvmlDeviceGetAccountingStats`` See + ``nvmlDeviceClearAccountingPids``. + Args: device (intptr_t): The identifier of the target device. mode (EnableState): The target accounting mode. + .. note:: + This setting is not persistent and will default to disabled after driver + unloads. Enable persistence mode to be sure the setting doesn't switch off to + disabled. + .. note:: + Enabling accounting mode has no negative impact on the GPU performance. + .. note:: + Disabling accounting clears all accounting pids information. + .. note:: + On MIG-enabled GPUs, accounting mode would be set to DISABLED and changing it + is not supported. .. seealso:: `nvmlDeviceSetAccountingMode` """ with nogil: @@ -31550,6 +33155,11 @@ cpdef device_set_accounting_mode(intptr_t device, int mode): cpdef device_clear_accounting_pids(intptr_t device): """Clears accounting information about all processes that have already terminated. + For Kepler ™️ or newer fully supported devices. Requires root/admin + permissions. + See ``nvmlDeviceGetAccountingMode`` See ``nvmlDeviceGetAccountingStats`` See + ``nvmlDeviceSetAccountingMode``. + Args: device (intptr_t): The identifier of the target device. @@ -31563,14 +33173,16 @@ cpdef device_clear_accounting_pids(intptr_t device): cpdef int device_get_nvlink_state(intptr_t device, unsigned int link) except? -1: """Retrieves the state of the device's NvLink for the link specified. + For Pascal ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. link (unsigned int): Specifies the NvLink link to be queried. Returns: - int: ``nvmlEnableState_t`` where NVML_FEATURE_ENABLED - indicates that the link is active and - NVML_FEATURE_DISABLED indicates it is inactive. + int: ``nvmlEnableState_t`` where NVML_FEATURE_ENABLED indicates + that the link is active and NVML_FEATURE_DISABLED indicates it + is inactive. .. seealso:: `nvmlDeviceGetNvLinkState` """ @@ -31584,6 +33196,8 @@ cpdef int device_get_nvlink_state(intptr_t device, unsigned int link) except? -1 cpdef unsigned int device_get_nvlink_version(intptr_t device, unsigned int link) except? 0: """Retrieves the version of the device's NvLink for the link specified. + For Pascal ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. link (unsigned int): Specifies the NvLink link to be queried. @@ -31604,6 +33218,8 @@ cpdef unsigned int device_get_nvlink_version(intptr_t device, unsigned int link) cpdef unsigned int device_get_nvlink_capability(intptr_t device, unsigned int link, int capability) except? 0: """Retrieves the requested capability from the device's NvLink for the link specified Please refer to the ``nvmlNvLinkCapability_t`` structure for the specific caps that can be queried The return value should be treated as a boolean. + For Pascal ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. link (unsigned int): Specifies the NvLink link to be queried. @@ -31611,8 +33227,8 @@ cpdef unsigned int device_get_nvlink_capability(intptr_t device, unsigned int li ``nvmlNvLinkCapability_t`` to be queried. Returns: - unsigned int: A boolean for the queried capability indicating - that feature is available. + unsigned int: A boolean for the queried capability indicating that + feature is available. .. seealso:: `nvmlDeviceGetNvLinkCapability` """ @@ -31626,6 +33242,8 @@ cpdef unsigned int device_get_nvlink_capability(intptr_t device, unsigned int li cpdef object device_get_nvlink_remote_pci_info_v2(intptr_t device, unsigned int link): """Retrieves the PCI information for the remote node on a NvLink link Note: pciSubSystemId is not filled in this function and is indeterminate. + For Pascal ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. link (unsigned int): Specifies the NvLink link to be queried. @@ -31647,11 +33265,13 @@ cpdef object device_get_nvlink_remote_pci_info_v2(intptr_t device, unsigned int cpdef unsigned long long device_get_nvlink_error_counter(intptr_t device, unsigned int link, int counter) except? 0: """Retrieves the specified error counter value Please refer to ``nvmlNvLinkErrorCounter_t`` for error counters that are available. + For Pascal ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. link (unsigned int): Specifies the NvLink link to be queried. - counter (NvLinkErrorCounter): Specifies the NvLink counter to - be queried. + counter (NvLinkErrorCounter): Specifies the NvLink counter to be + queried. Returns: unsigned long long: Returned counter value. @@ -31668,6 +33288,8 @@ cpdef unsigned long long device_get_nvlink_error_counter(intptr_t device, unsign cpdef device_reset_nvlink_error_counters(intptr_t device, unsigned int link): """Resets all error counters to zero Please refer to ``nvmlNvLinkErrorCounter_t`` for the list of error counters that are reset. + For Pascal ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. link (unsigned int): Specifies the NvLink link to be queried. @@ -31682,13 +33304,13 @@ cpdef device_reset_nvlink_error_counters(intptr_t device, unsigned int link): cpdef int device_get_nvlink_remote_device_type(intptr_t device, unsigned int link) except? -1: """Get the NVLink device type of the remote device connected over the given link. + Args: device (intptr_t): The device handle of the target GPU. link (unsigned int): The NVLink link index on the target GPU. Returns: - int: Pointer in which the output remote device type is - returned. + int: Pointer in which the output remote device type is returned. .. seealso:: `nvmlDeviceGetNvLinkRemoteDeviceType` """ @@ -31702,6 +33324,7 @@ cpdef int device_get_nvlink_remote_device_type(intptr_t device, unsigned int lin cpdef system_set_nvlink_bw_mode(unsigned int nvlink_bw_mode): """Set the global nvlink bandwith mode. + Args: nvlink_bw_mode (unsigned int): nvlink bandwidth mode. @@ -31715,6 +33338,7 @@ cpdef system_set_nvlink_bw_mode(unsigned int nvlink_bw_mode): cpdef unsigned int system_get_nvlink_bw_mode() except? 0: """Get the global nvlink bandwith mode. + Returns: unsigned int: reference of nvlink bandwidth mode. @@ -31730,6 +33354,8 @@ cpdef unsigned int system_get_nvlink_bw_mode() except? 0: cpdef object device_get_nvlink_supported_bw_modes(intptr_t device): """Get the supported NvLink Reduced Bandwidth Modes of the device. + For Blackwell ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. @@ -31751,12 +33377,13 @@ cpdef object device_get_nvlink_supported_bw_modes(intptr_t device): cpdef object device_get_nvlink_bw_mode(intptr_t device): """Get the NvLink Reduced Bandwidth Mode for the device. + For Blackwell ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. Returns: - nvmlNvlinkGetBwMode_v1_t: Reference to - ``nvmlNvlinkGetBwMode_t``. + nvmlNvlinkGetBwMode_v1_t: Reference to ``nvmlNvlinkGetBwMode_t``. .. seealso:: `nvmlDeviceGetNvlinkBwMode` """ @@ -31769,25 +33396,29 @@ cpdef object device_get_nvlink_bw_mode(intptr_t device): return get_bw_mode_py -cpdef device_set_nvlink_bw_mode(intptr_t device, intptr_t set_bw_mode): +cpdef device_set_nvlink_bw_mode(intptr_t device, set_bw_mode): """Set the NvLink Reduced Bandwidth Mode for the device. + For Blackwell ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. - set_bw_mode (intptr_t): Reference to - ``nvmlNvlinkSetBwMode_t``. + set_bw_mode (intptr_t): Reference to ``nvmlNvlinkSetBwMode_t``. .. seealso:: `nvmlDeviceSetNvlinkBwMode` """ + cdef intptr_t _set_bw_mode_ptr_ = int(set_bw_mode) set_bw_mode.version = NVML_VERSION_STRUCT(sizeof(nvmlNvlinkSetBwMode_v1_t), 1) with nogil: - __status__ = nvmlDeviceSetNvlinkBwMode(device, set_bw_mode) + __status__ = nvmlDeviceSetNvlinkBwMode(device, _set_bw_mode_ptr_) check_status(__status__) cpdef intptr_t event_set_create() except? 0: """Create an empty set of events. Event set should be freed by ``nvmlEventSetFree``. + For Fermi ™️ or newer fully supported devices. + Returns: intptr_t: Reference in which to return the event handle. @@ -31803,10 +33434,22 @@ cpdef intptr_t event_set_create() except? 0: cpdef device_register_events(intptr_t device, unsigned long long event_types, intptr_t set): """Starts recording of events on a specified devices and add the events to specified ``nvmlEventSet_t``. + For Fermi ™️ or newer fully supported devices. ECC events are available only on + ECC-enabled devices (see ``nvmlDeviceGetTotalEccErrors``) Power capping events + are available only on Power Management enabled devices (see + nvmlDeviceGetPowerManagementMode). + For Linux only. + This call starts recording of events on specific device. All events that + occurred before this call are not recorded. Checking if some event occurred can + be done with ``nvmlEventSetWait_v2``. + If function reports NVML_ERROR_UNKNOWN, event set is in undefined state and + should be freed. If function reports NVML_ERROR_NOT_SUPPORTED, event set can + still be used. None of the requested event_types are registered in that case. + Args: device (intptr_t): The identifier of the target device. - event_types (unsigned long long): Bitmask of ``Event Types`` - to record. + event_types (unsigned long long): Bitmask of ``Event Types`` to + record. set (intptr_t): Set to which add new event types. .. seealso:: `nvmlDeviceRegisterEvents` @@ -31819,6 +33462,10 @@ cpdef device_register_events(intptr_t device, unsigned long long event_types, in cpdef unsigned long long device_get_supported_event_types(intptr_t device) except? 0: """Returns information about events supported on device. + For Fermi ™️ or newer fully supported devices. + Events are not supported on Windows. So this function returns an empty mask in + ``event_types`` on Windows. + Args: device (intptr_t): The identifier of the target device. @@ -31838,6 +33485,25 @@ cpdef unsigned long long device_get_supported_event_types(intptr_t device) excep cpdef object event_set_wait_v2(intptr_t set, unsigned int timeoutms): """Waits on events and delivers events. + For Fermi ™️ or newer fully supported devices. + If some events are ready to be delivered at the time of the call, function + returns immediately. If there are no events ready to be delivered, function + sleeps till event arrives but not longer than specified timeout. This function + in certain conditions can return before specified timeout passes (e.g. when + interrupt arrives). + On Windows, in case of Xid error, the function returns the most recent Xid + error type seen by the system. If there are multiple Xid errors generated + before nvmlEventSetWait is invoked then the last seen Xid error type is + returned for all Xid error events. + On Linux, every Xid error event would return the associated event data and + other information if applicable. + In MIG mode, if device handle is provided, the API reports all the events for + the available instances, only if the caller has appropriate privileges. In + absence of required privileges, only the events which affect all the instances + (i.e. whole device) are reported. + This API does not currently support per-instance event reporting using MIG + device handles. + Args: set (intptr_t): Reference to set of events to wait on. timeoutms (unsigned int): Maximum amount of wait time in @@ -31859,6 +33525,8 @@ cpdef object event_set_wait_v2(intptr_t set, unsigned int timeoutms): cpdef event_set_free(intptr_t set): """Releases events in the set. + For Fermi ™️ or newer fully supported devices. + Args: set (intptr_t): Reference to events to be released. @@ -31869,28 +33537,33 @@ cpdef event_set_free(intptr_t set): check_status(__status__) -cpdef device_modify_drain_state(intptr_t pci_info, int new_state): +cpdef device_modify_drain_state(pci_info, int new_state): """Modify the drain state of a GPU. This method forces a GPU to no longer accept new incoming requests. Any new NVML process will no longer see this GPU. Persistence mode for this GPU must be turned off before this call is made. Must be called as administrator. For Linux only. + For Pascal ™️ or newer fully supported devices. Some Kepler devices supported. + Args: - pci_info (intptr_t): The PCI address of the GPU drain state to - be modified. - new_state (EnableState): The drain state that should be - entered, see ``nvmlEnableState_t``. + pci_info (intptr_t): The PCI address of the GPU drain state to be + modified. + new_state (EnableState): The drain state that should be entered, + see ``nvmlEnableState_t``. .. seealso:: `nvmlDeviceModifyDrainState` """ + cdef intptr_t _pci_info_ptr_ = int(pci_info) with nogil: - __status__ = nvmlDeviceModifyDrainState(pci_info, <_EnableState>new_state) + __status__ = nvmlDeviceModifyDrainState(_pci_info_ptr_, <_EnableState>new_state) check_status(__status__) -cpdef int device_query_drain_state(intptr_t pci_info) except? -1: +cpdef int device_query_drain_state(pci_info) except? -1: """Query the drain state of a GPU. This method is used to check if a GPU is in a currently draining state. For Linux only. + For Pascal ™️ or newer fully supported devices. Some Kepler devices supported. + Args: - pci_info (intptr_t): The PCI address of the GPU drain state to - be queried. + pci_info (intptr_t): The PCI address of the GPU drain state to be + queried. Returns: int: The current drain state for this GPU, see @@ -31898,47 +33571,65 @@ cpdef int device_query_drain_state(intptr_t pci_info) except? -1: .. seealso:: `nvmlDeviceQueryDrainState` """ + cdef intptr_t _pci_info_ptr_ = int(pci_info) cdef _EnableState current_state with nogil: - __status__ = nvmlDeviceQueryDrainState(pci_info, ¤t_state) + __status__ = nvmlDeviceQueryDrainState(_pci_info_ptr_, ¤t_state) check_status(__status__) return current_state -cpdef device_remove_gpu_v2(intptr_t pci_info, int gpu_state, int link_state): +cpdef device_remove_gpu_v2(pci_info, int gpu_state, int link_state): """This method will remove the specified GPU from the view of both NVML and the NVIDIA kernel driver as long as no other processes are attached. If other processes are attached, this call will return NVML_ERROR_IN_USE and the GPU will be returned to its original "draining" state. Note: the only situation where a process can still be attached after :func:`device_modify_drain_state` is called to initiate the draining state is if that process was using, and is still using, a GPU before the call was made. Also note, persistence mode counts as an attachment to the GPU thus it must be disabled prior to this call. + For long-running NVML processes please note that this will change the + enumeration of current GPUs. For example, if there are four GPUs present and + GPU1 is removed, the new enumeration will be 0-2. Also, device handles after + the removed GPU will not be valid and must be re-established. Must be run as + administrator. For Linux only. + For Pascal ™️ or newer fully supported devices. Some Kepler devices supported. + Args: pci_info (intptr_t): The PCI address of the GPU to be removed. - gpu_state (DetachGpuState): Whether the GPU is to be removed, - from the OS see ``nvmlDetachGpuState_t``. - link_state (PcieLinkState): Requested upstream PCIe link - state, see ``nvmlPcieLinkState_t``. + gpu_state (DetachGpuState): Whether the GPU is to be removed, from + the OS see ``nvmlDetachGpuState_t``. + link_state (PcieLinkState): Requested upstream PCIe link state, + see ``nvmlPcieLinkState_t``. .. seealso:: `nvmlDeviceRemoveGpu_v2` """ + cdef intptr_t _pci_info_ptr_ = int(pci_info) with nogil: - __status__ = nvmlDeviceRemoveGpu_v2(pci_info, <_DetachGpuState>gpu_state, <_PcieLinkState>link_state) + __status__ = nvmlDeviceRemoveGpu_v2(_pci_info_ptr_, <_DetachGpuState>gpu_state, <_PcieLinkState>link_state) check_status(__status__) -cpdef device_discover_gpus(intptr_t pci_info): +cpdef device_discover_gpus(pci_info): """Request the OS and the NVIDIA kernel driver to rediscover a portion of the PCI subsystem looking for GPUs that were previously removed. The portion of the PCI tree can be narrowed by specifying a domain, bus, and device. If all are zeroes then the entire PCI tree will be searched. Please note that for long-running NVML processes the enumeration will change based on how many GPUs are discovered and where they are inserted in bus order. + In addition, all newly discovered GPUs will be initialized and their ECC + scrubbed which may take several seconds per GPU. Also, all device handles are + no longer guaranteed to be valid post discovery. + Must be run as administrator. For Linux only. + For Pascal ™️ or newer fully supported devices. Some Kepler devices supported. + Args: - pci_info (intptr_t): The PCI tree to be searched. Only the - domain, bus, and device fields are used in this call. + pci_info (intptr_t): The PCI tree to be searched. Only the domain, + bus, and device fields are used in this call. .. seealso:: `nvmlDeviceDiscoverGpus` """ + cdef intptr_t _pci_info_ptr_ = int(pci_info) with nogil: - __status__ = nvmlDeviceDiscoverGpus(pci_info) + __status__ = nvmlDeviceDiscoverGpus(_pci_info_ptr_) check_status(__status__) cpdef int device_get_virtualization_mode(intptr_t device) except? -1: """This method is used to get the virtualization mode corresponding to the GPU. + For Kepler ™️ or newer fully supported devices. + Args: device (intptr_t): Identifier of the target device. @@ -31958,6 +33649,10 @@ cpdef int device_get_virtualization_mode(intptr_t device) except? -1: cpdef int device_get_host_vgpu_mode(intptr_t device) except? -1: """Queries if SR-IOV host operation is supported on a vGPU supported device. + Checks whether SR-IOV host capability is supported by the device and the + driver, and indicates device is in SR-IOV mode if both of these conditions are + true. + Args: device (intptr_t): The identifier of the target device. @@ -31976,10 +33671,12 @@ cpdef int device_get_host_vgpu_mode(intptr_t device) except? -1: cpdef device_set_virtualization_mode(intptr_t device, int virtual_mode): """This method is used to set the virtualization mode corresponding to the GPU. + For Kepler ™️ or newer fully supported devices. + Args: device (intptr_t): Identifier of the target device. - virtual_mode (GpuVirtualizationMode): virtualization mode. One - of ``NVML_GPU_VIRTUALIZATION_?``. + virtual_mode (GpuVirtualizationMode): virtualization mode. One of + ``NVML_GPU_VIRTUALIZATION_?``. .. seealso:: `nvmlDeviceSetVirtualizationMode` """ @@ -31991,12 +33688,12 @@ cpdef device_set_virtualization_mode(intptr_t device, int virtual_mode): cpdef unsigned long long vgpu_type_get_gsp_heap_size(unsigned int vgpu_type_id) except? 0: """Retrieve the static GSP heap size of the vGPU type in bytes. + Args: vgpu_type_id (unsigned int): Handle to vGPU type. Returns: - unsigned long long: Reference to return the GSP heap size - value. + unsigned long long: Reference to return the GSP heap size value. .. seealso:: `nvmlVgpuTypeGetGspHeapSize` """ @@ -32010,6 +33707,7 @@ cpdef unsigned long long vgpu_type_get_gsp_heap_size(unsigned int vgpu_type_id) cpdef unsigned long long vgpu_type_get_fb_reservation(unsigned int vgpu_type_id) except? 0: """Retrieve the static framebuffer reservation of the vGPU type in bytes. + Args: vgpu_type_id (unsigned int): Handle to vGPU type. @@ -32029,6 +33727,9 @@ cpdef unsigned long long vgpu_type_get_fb_reservation(unsigned int vgpu_type_id) cpdef device_set_vgpu_capabilities(intptr_t device, int capability, int state): """Set the desirable vGPU capability of a device. + Refer to the ``nvmlDeviceVgpuCapability_t`` structure for the specific + capabilities that can be set. See ``nvmlEnableState_t`` for available state. + Args: device (intptr_t): The identifier of the target device. capability (DeviceVgpuCapability): Specifies the @@ -32045,12 +33746,15 @@ cpdef device_set_vgpu_capabilities(intptr_t device, int capability, int state): cpdef object device_get_grid_licensable_features_v4(intptr_t device): """Retrieve the vGPU Software licensable features. + Identifies whether the system supports vGPU Software Licensing. If it does, + return the list of licensable feature(s) and their current license status. + Args: device (intptr_t): Identifier of the target device. Returns: - nvmlGridLicensableFeatures_t: Pointer to structure in which - vGPU software licensable features are returned. + nvmlGridLicensableFeatures_t: Pointer to structure in which vGPU + software licensable features are returned. .. seealso:: `nvmlDeviceGetGridLicensableFeatures_v4` """ @@ -32065,13 +33769,19 @@ cpdef object device_get_grid_licensable_features_v4(intptr_t device): cpdef unsigned int get_vgpu_driver_capabilities(int capability) except? 0: """Retrieve the requested vGPU driver capability. + Refer to the ``nvmlVgpuDriverCapability_t`` structure for the specific + capabilities that can be queried. The return value in ``cap_result`` should be + treated as a boolean, with a non-zero value indicating that the capability is + supported. + For Maxwell ™️ or newer fully supported devices. + Args: capability (VgpuDriverCapability): Specifies the ``nvmlVgpuDriverCapability_t`` to be queried. Returns: - unsigned int: A boolean for the queried capability indicating - that feature is supported. + unsigned int: A boolean for the queried capability indicating that + feature is supported. .. seealso:: `nvmlGetVgpuDriverCapabilities` """ @@ -32085,14 +33795,20 @@ cpdef unsigned int get_vgpu_driver_capabilities(int capability) except? 0: cpdef unsigned int device_get_vgpu_capabilities(intptr_t device, int capability) except? 0: """Retrieve the requested vGPU capability for GPU. + Refer to the ``nvmlDeviceVgpuCapability_t`` structure for the specific + capabilities that can be queried. The return value in ``cap_result`` reports a + non-zero value indicating that the capability is supported, and also reports + the capability's data based on the queried capability. + For Maxwell ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. capability (DeviceVgpuCapability): Specifies the ``nvmlDeviceVgpuCapability_t`` to be queried. Returns: - unsigned int: Specifies that the queried capability is - supported, and also returns capability's data. + unsigned int: Specifies that the queried capability is supported, + and also returns capability's data. .. seealso:: `nvmlDeviceGetVgpuCapabilities` """ @@ -32103,9 +33819,92 @@ cpdef unsigned int device_get_vgpu_capabilities(intptr_t device, int capability) return cap_result +cpdef object device_get_supported_vgpus(intptr_t device): + """Retrieve the supported vGPU types on a physical GPU (device). + + An array of supported vGPU types for the physical GPU indicated by ``device`` + is returned in the caller-supplied buffer pointed at by ``vgpu_type_ids``. The + element count of ``nvmlVgpuTypeId_t`` array is passed in ``vgpu_count``, and + ``vgpu_count`` is used to return the number of vGPU types written to the + buffer. + If the supplied buffer is not large enough to accommodate the vGPU type array, + the function returns NVML_ERROR_INSUFFICIENT_SIZE, with the element count of + ``nvmlVgpuTypeId_t`` array required in ``vgpu_count``. To query the number of + vGPU types supported for the GPU, call this function with \*vgpu_count = 0. The + code will return NVML_ERROR_INSUFFICIENT_SIZE, or NVML_SUCCESS if no vGPU types + are supported. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned int: Pointer to caller-supplied array in which to return + list of vGPU types. + + .. seealso:: `nvmlDeviceGetSupportedVgpus` + """ + cdef unsigned int[1] vgpu_count = [0] + with nogil: + __status__ = nvmlDeviceGetSupportedVgpus(device, vgpu_count, NULL) + check_status_size(__status__) + cdef _cyb_view.array _vgpu_type_ids_alloc_ = _cyb_view.array(shape=(max(vgpu_count[0], 1),), itemsize=sizeof(nvmlVgpuTypeId_t), format="I", mode="c") + cdef nvmlVgpuTypeId_t *vgpu_type_ids_ptr = (_vgpu_type_ids_alloc_.data) + cdef object vgpu_type_ids = _vgpu_type_ids_alloc_[:vgpu_count[0]] + if vgpu_count[0] != 0: + with nogil: + __status__ = nvmlDeviceGetSupportedVgpus(device, vgpu_count, vgpu_type_ids_ptr) + check_status(__status__) + return vgpu_type_ids[:vgpu_count[0]] + + +cpdef object device_get_creatable_vgpus(intptr_t device): + """Retrieve the currently creatable vGPU types on a physical GPU (device). + + An array of creatable vGPU types for the physical GPU indicated by ``device`` + is returned in the caller-supplied buffer pointed at by ``vgpu_type_ids``. The + element count of ``nvmlVgpuTypeId_t`` array is passed in ``vgpu_count``, and + ``vgpu_count`` is used to return the number of vGPU types written to the + buffer. + The creatable vGPU types for a device may differ over time, as there may be + restrictions on what type of vGPU types can concurrently run on a device. For + example, if only one vGPU type is allowed at a time on a device, then the + creatable list will be restricted to whatever vGPU type is already running on + the device. + If the supplied buffer is not large enough to accommodate the vGPU type array, + the function returns NVML_ERROR_INSUFFICIENT_SIZE, with the element count of + ``nvmlVgpuTypeId_t`` array required in ``vgpu_count``. To query the number of + vGPU types that can be created for the GPU, call this function with + \*vgpu_count = 0. The code will return NVML_ERROR_INSUFFICIENT_SIZE, or + NVML_SUCCESS if no vGPU types are creatable. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned int: Pointer to caller-supplied array in which to return + list of vGPU types. + + .. seealso:: `nvmlDeviceGetCreatableVgpus` + """ + cdef unsigned int[1] vgpu_count = [0] + with nogil: + __status__ = nvmlDeviceGetCreatableVgpus(device, vgpu_count, NULL) + check_status_size(__status__) + cdef _cyb_view.array _vgpu_type_ids_alloc_ = _cyb_view.array(shape=(max(vgpu_count[0], 1),), itemsize=sizeof(nvmlVgpuTypeId_t), format="I", mode="c") + cdef nvmlVgpuTypeId_t *vgpu_type_ids_ptr = (_vgpu_type_ids_alloc_.data) + cdef object vgpu_type_ids = _vgpu_type_ids_alloc_[:vgpu_count[0]] + if vgpu_count[0] != 0: + with nogil: + __status__ = nvmlDeviceGetCreatableVgpus(device, vgpu_count, vgpu_type_ids_ptr) + check_status(__status__) + return vgpu_type_ids[:vgpu_count[0]] + + cpdef str vgpu_type_get_class(unsigned int vgpu_type_id): """Retrieve the class of a vGPU type. It will not exceed 64 characters in length (including the NUL terminator). See nvmlConstants::NVML_DEVICE_NAME_BUFFER_SIZE. + For Kepler ™️ or newer fully supported devices. + Args: vgpu_type_id (unsigned int): Handle to vGPU type. @@ -32118,19 +33917,20 @@ cpdef str vgpu_type_get_class(unsigned int vgpu_type_id): with nogil: __status__ = nvmlVgpuTypeGetClass(vgpu_type_id, NULL, size) check_status_size(__status__) - if size[0] == 0: - return "" cdef bytes _vgpu_type_class_ = bytes(size[0]) cdef char* vgpu_type_class = _vgpu_type_class_ - with nogil: - __status__ = nvmlVgpuTypeGetClass(vgpu_type_id, vgpu_type_class, size) - check_status(__status__) + if size[0] != 0: + with nogil: + __status__ = nvmlVgpuTypeGetClass(vgpu_type_id, vgpu_type_class, size) + check_status(__status__) return _cyb_cpython.PyUnicode_FromString(vgpu_type_class) cpdef unsigned int vgpu_type_get_gpu_instance_profile_id(unsigned int vgpu_type_id) except? 0: """Retrieve the GPU Instance Profile ID for the given vGPU type ID. The API will return a valid GPU Instance Profile ID for the MIG capable vGPU types, else INVALID_GPU_INSTANCE_PROFILE_ID is returned. + For Kepler ™️ or newer fully supported devices. + Args: vgpu_type_id (unsigned int): Handle to vGPU type. @@ -32149,16 +33949,17 @@ cpdef unsigned int vgpu_type_get_gpu_instance_profile_id(unsigned int vgpu_type_ cpdef tuple vgpu_type_get_device_id(unsigned int vgpu_type_id): """Retrieve the device ID of a vGPU type. + For Kepler ™️ or newer fully supported devices. + Args: vgpu_type_id (unsigned int): Handle to vGPU type. Returns: A 2-tuple containing: - - unsigned long long: Device ID and vendor ID of the device - contained in single 32 bit value. - - unsigned long long: Subsystem ID and subsystem vendor ID of - the device contained in single 32 bit value. + contained in single 32 bit value. + - unsigned long long: Subsystem ID and subsystem vendor ID of the + device contained in single 32 bit value. .. seealso:: `nvmlVgpuTypeGetDeviceID` """ @@ -32173,6 +33974,8 @@ cpdef tuple vgpu_type_get_device_id(unsigned int vgpu_type_id): cpdef unsigned long long vgpu_type_get_framebuffer_size(unsigned int vgpu_type_id) except? 0: """Retrieve the vGPU framebuffer size in bytes. + For Kepler ™️ or newer fully supported devices. + Args: vgpu_type_id (unsigned int): Handle to vGPU type. @@ -32191,6 +33994,8 @@ cpdef unsigned long long vgpu_type_get_framebuffer_size(unsigned int vgpu_type_i cpdef unsigned int vgpu_type_get_num_display_heads(unsigned int vgpu_type_id) except? 0: """Retrieve count of vGPU's supported display heads. + For Kepler ™️ or newer fully supported devices. + Args: vgpu_type_id (unsigned int): Handle to vGPU type. @@ -32209,18 +34014,16 @@ cpdef unsigned int vgpu_type_get_num_display_heads(unsigned int vgpu_type_id) ex cpdef tuple vgpu_type_get_resolution(unsigned int vgpu_type_id, unsigned int display_index): """Retrieve vGPU display head's maximum supported resolution. + For Kepler ™️ or newer fully supported devices. + Args: vgpu_type_id (unsigned int): Handle to vGPU type. - display_index (unsigned int): Zero-based index of display - head. + display_index (unsigned int): Zero-based index of display head. Returns: A 2-tuple containing: - - - unsigned int: Pointer to maximum number of pixels in X - dimension. - - unsigned int: Pointer to maximum number of pixels in Y - dimension. + - unsigned int: Pointer to maximum number of pixels in X dimension. + - unsigned int: Pointer to maximum number of pixels in Y dimension. .. seealso:: `nvmlVgpuTypeGetResolution` """ @@ -32235,6 +34038,16 @@ cpdef tuple vgpu_type_get_resolution(unsigned int vgpu_type_id, unsigned int dis cpdef str vgpu_type_get_license(unsigned int vgpu_type_id): """Retrieve license requirements for a vGPU type. + The license type and version required to run the specified vGPU type is + returned as an alphanumeric string, in the form ",", for + example "GRID-Virtual-PC,2.0". If a vGPU is runnable with* more than one type + of license, the licenses are delimited by a semicolon, for example "GRID- + Virtual-PC,2.0;GRID-Virtual-WS,2.0;GRID-Virtual-WS-Ext,2.0". + The total length of the returned string will not exceed 128 characters, + including the NUL terminator. See + nvmlVgpuConstants::NVML_GRID_LICENSE_BUFFER_SIZE. + For Kepler ™️ or newer fully supported devices. + Args: vgpu_type_id (unsigned int): Handle to vGPU type. @@ -32254,6 +34067,8 @@ cpdef str vgpu_type_get_license(unsigned int vgpu_type_id): cpdef unsigned int vgpu_type_get_frame_rate_limit(unsigned int vgpu_type_id) except? 0: """Retrieve the static frame rate limit value of the vGPU type. + For Kepler ™️ or newer fully supported devices. + Args: vgpu_type_id (unsigned int): Handle to vGPU type. @@ -32272,13 +34087,15 @@ cpdef unsigned int vgpu_type_get_frame_rate_limit(unsigned int vgpu_type_id) exc cpdef unsigned int vgpu_type_get_max_instances(intptr_t device, unsigned int vgpu_type_id) except? 0: """Retrieve the maximum number of vGPU instances creatable on a device for given vGPU type. + For Kepler ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. vgpu_type_id (unsigned int): Handle to vGPU type. Returns: - unsigned int: Pointer to get the max number of vGPU instances - that can be created on a deicve for given vgpu_type_id. + unsigned int: Pointer to get the max number of vGPU instances that + can be created on a deicve for given vgpu_type_id. .. seealso:: `nvmlVgpuTypeGetMaxInstances` """ @@ -32292,6 +34109,8 @@ cpdef unsigned int vgpu_type_get_max_instances(intptr_t device, unsigned int vgp cpdef unsigned int vgpu_type_get_max_instances_per_vm(unsigned int vgpu_type_id) except? 0: """Retrieve the maximum number of vGPU instances supported per VM for given vGPU type. + For Kepler ™️ or newer fully supported devices. + Args: vgpu_type_id (unsigned int): Handle to vGPU type. @@ -32311,6 +34130,8 @@ cpdef unsigned int vgpu_type_get_max_instances_per_vm(unsigned int vgpu_type_id) cpdef object vgpu_type_get_bar1_info(unsigned int vgpu_type_id): """Retrieve the BAR1 info for given vGPU type. + For Maxwell ™️ or newer fully supported devices. + Args: vgpu_type_id (unsigned int): Handle to vGPU type. @@ -32329,9 +34150,83 @@ cpdef object vgpu_type_get_bar1_info(unsigned int vgpu_type_id): return bar1info_py +cpdef object device_get_active_vgpus(intptr_t device): + """Retrieve the active vGPU instances on a device. + + An array of active vGPU instances is returned in the caller-supplied buffer + pointed at by ``vgpu_instances``. The array element count is passed in + ``vgpu_count``, and ``vgpu_count`` is used to return the number of vGPU + instances written to the buffer. + If the supplied buffer is not large enough to accommodate the vGPU instance + array, the function returns NVML_ERROR_INSUFFICIENT_SIZE, with the element + count of ``nvmlVgpuInstance_t`` array required in ``vgpu_count``. To query the + number of active vGPU instances, call this function with \*vgpu_count = 0. The + code will return NVML_ERROR_INSUFFICIENT_SIZE, or NVML_SUCCESS if no vGPU Types + are supported. + For Kepler ™️ or newer fully supported devices. + + Args: + device (intptr_t): The identifier of the target device. + + Returns: + unsigned int: Pointer to array in which to return list of vGPU + instances. + + .. seealso:: `nvmlDeviceGetActiveVgpus` + """ + cdef unsigned int[1] vgpu_count = [0] + with nogil: + __status__ = nvmlDeviceGetActiveVgpus(device, vgpu_count, NULL) + check_status_size(__status__) + cdef _cyb_view.array _vgpu_instances_alloc_ = _cyb_view.array(shape=(max(vgpu_count[0], 1),), itemsize=sizeof(nvmlVgpuInstance_t), format="I", mode="c") + cdef nvmlVgpuInstance_t *vgpu_instances_ptr = (_vgpu_instances_alloc_.data) + cdef object vgpu_instances = _vgpu_instances_alloc_[:vgpu_count[0]] + if vgpu_count[0] != 0: + with nogil: + __status__ = nvmlDeviceGetActiveVgpus(device, vgpu_count, vgpu_instances_ptr) + check_status(__status__) + return vgpu_instances[:vgpu_count[0]] + + +cpdef tuple vgpu_instance_get_vm_id(unsigned int vgpu_instance): + """Retrieve the VM ID associated with a vGPU instance. + + The VM ID is returned as a string, not exceeding 80 characters in length + (including the NUL terminator). See + nvmlConstants::NVML_DEVICE_UUID_BUFFER_SIZE. + The format of the VM ID varies by platform, and is indicated by the type + identifier returned in ``vm_idType``. + For Kepler ™️ or newer fully supported devices. + + Args: + vgpu_instance (unsigned int): Identifier of the target vGPU + instance. + + Returns: + A 2-tuple containing: + - char: Pointer to caller-supplied buffer to hold VM ID. + - int: Pointer to hold VM ID type. + + .. seealso:: `nvmlVgpuInstanceGetVmID` + """ + cdef unsigned int size = 80 + cdef char[80] vm_id + cdef _VgpuVmIdType vm_id_type + with nogil: + __status__ = nvmlVgpuInstanceGetVmID(vgpu_instance, vm_id, size, &vm_id_type) + check_status(__status__) + return (_cyb_cpython.PyUnicode_FromString(vm_id), vm_id_type) + + cpdef str vgpu_instance_get_uuid(unsigned int vgpu_instance): """Retrieve the UUID of a vGPU instance. + The UUID is a globally unique identifier associated with the vGPU, and is + returned as a 5-part hexadecimal string, not exceeding 80 characters in length + (including the NULL terminator). See + nvmlConstants::NVML_DEVICE_UUID_BUFFER_SIZE. + For Kepler ™️ or newer fully supported devices. + Args: vgpu_instance (unsigned int): Identifier of the target vGPU instance. @@ -32352,6 +34247,16 @@ cpdef str vgpu_instance_get_uuid(unsigned int vgpu_instance): cpdef str vgpu_instance_get_vm_driver_version(unsigned int vgpu_instance): """Retrieve the NVIDIA driver version installed in the VM associated with a vGPU. + The version is returned as an alphanumeric string in the caller-supplied buffer + ``version``. The length of the version string will not exceed 80 characters in + length (including the NUL terminator). See + nvmlConstants::NVML_SYSTEM_DRIVER_VERSION_BUFFER_SIZE. + :func:`vgpu_instance_get_vm_driver_version` may be called at any time for a + vGPU instance. The guest VM driver version is returned as "Not Available" if no + NVIDIA driver is installed in the VM, or the VM has not yet booted to the point + where the NVIDIA driver is loaded and initialized. + For Kepler ™️ or newer fully supported devices. + Args: vgpu_instance (unsigned int): Identifier of the target vGPU instance. @@ -32372,6 +34277,10 @@ cpdef str vgpu_instance_get_vm_driver_version(unsigned int vgpu_instance): cpdef unsigned long long vgpu_instance_get_fb_usage(unsigned int vgpu_instance) except? 0: """Retrieve the framebuffer usage in bytes. + Framebuffer usage is the amont of vGPU framebuffer memory that is currently in + use by the VM. + For Kepler ™️ or newer fully supported devices. + Args: vgpu_instance (unsigned int): The identifier of the target instance. @@ -32391,6 +34300,11 @@ cpdef unsigned long long vgpu_instance_get_fb_usage(unsigned int vgpu_instance) cpdef unsigned int vgpu_instance_get_license_status(unsigned int vgpu_instance) except? 0: """[Deprecated]. + Retrieve the current licensing state of the vGPU instance. + If the vGPU is currently licensed, ``licensed`` is set to 1, otherwise it is + set to 0. + For Kepler ™️ or newer fully supported devices. + Args: vgpu_instance (unsigned int): Identifier of the target vGPU instance. @@ -32410,6 +34324,9 @@ cpdef unsigned int vgpu_instance_get_license_status(unsigned int vgpu_instance) cpdef unsigned int vgpu_instance_get_type(unsigned int vgpu_instance) except? 0: """Retrieve the vGPU type of a vGPU instance. + Returns the vGPU type ID of vgpu assigned to the vGPU instance. + For Kepler ™️ or newer fully supported devices. + Args: vgpu_instance (unsigned int): Identifier of the target vGPU instance. @@ -32429,6 +34346,9 @@ cpdef unsigned int vgpu_instance_get_type(unsigned int vgpu_instance) except? 0: cpdef unsigned int vgpu_instance_get_frame_rate_limit(unsigned int vgpu_instance) except? 0: """Retrieve the frame rate limit set for the vGPU instance. + Returns the value of the frame rate limit set for the vGPU instance. + For Kepler ™️ or newer fully supported devices. + Args: vgpu_instance (unsigned int): Identifier of the target vGPU instance. @@ -32448,9 +34368,10 @@ cpdef unsigned int vgpu_instance_get_frame_rate_limit(unsigned int vgpu_instance cpdef int vgpu_instance_get_ecc_mode(unsigned int vgpu_instance) except? -1: """Retrieve the current ECC mode of vGPU instance. + Args: - vgpu_instance (unsigned int): The identifier of the target - vGPU instance. + vgpu_instance (unsigned int): The identifier of the target vGPU + instance. Returns: int: Reference in which to return the current ECC mode. @@ -32467,6 +34388,8 @@ cpdef int vgpu_instance_get_ecc_mode(unsigned int vgpu_instance) except? -1: cpdef unsigned int vgpu_instance_get_encoder_capacity(unsigned int vgpu_instance) except? 0: """Retrieve the encoder capacity of a vGPU instance, as a percentage of maximum encoder capacity with valid values in the range 0-100. + For Maxwell ™️ or newer fully supported devices. + Args: vgpu_instance (unsigned int): Identifier of the target vGPU instance. @@ -32487,6 +34410,8 @@ cpdef unsigned int vgpu_instance_get_encoder_capacity(unsigned int vgpu_instance cpdef vgpu_instance_set_encoder_capacity(unsigned int vgpu_instance, unsigned int encoder_capacity): """Set the encoder capacity of a vGPU instance, as a percentage of maximum encoder capacity with valid values in the range 0-100. + For Maxwell ™️ or newer fully supported devices. + Args: vgpu_instance (unsigned int): Identifier of the target vGPU instance. @@ -32503,19 +34428,20 @@ cpdef vgpu_instance_set_encoder_capacity(unsigned int vgpu_instance, unsigned in cpdef tuple vgpu_instance_get_encoder_stats(unsigned int vgpu_instance): """Retrieves the current encoder statistics of a vGPU Instance. + For Maxwell ™️ or newer fully supported devices. + Args: vgpu_instance (unsigned int): Identifier of the target vGPU instance. Returns: A 3-tuple containing: - - unsigned int: Reference to an unsigned int for count of active - encoder sessions. - - unsigned int: Reference to an unsigned int for trailing - average FPS of all active sessions. - - unsigned int: Reference to an unsigned int for encode latency - in microseconds. + encoder sessions. + - unsigned int: Reference to an unsigned int for trailing average + FPS of all active sessions. + - unsigned int: Reference to an unsigned int for encode latency in + microseconds. .. seealso:: `nvmlVgpuInstanceGetEncoderStats` """ @@ -32531,13 +34457,25 @@ cpdef tuple vgpu_instance_get_encoder_stats(unsigned int vgpu_instance): cpdef object vgpu_instance_get_encoder_sessions(unsigned int vgpu_instance): """Retrieves information about all active encoder sessions on a vGPU Instance. + An array of active encoder sessions is returned in the caller-supplied buffer + pointed at by ``session_info``. The array element count is passed in + ``session_count``, and ``session_count`` is used to return the number of + sessions written to the buffer. + If the supplied buffer is not large enough to accommodate the active session + array, the function returns NVML_ERROR_INSUFFICIENT_SIZE, with the element + count of ``nvmlEncoderSessionInfo_t`` array required in ``session_count``. To + query the number of active encoder sessions, call this function with + \*session_count = 0. The code will return NVML_SUCCESS with number of active + encoder sessions updated in \*session_count. + For Maxwell ™️ or newer fully supported devices. + Args: vgpu_instance (unsigned int): Identifier of the target vGPU instance. Returns: - nvmlEncoderSessionInfo_t: Reference to caller supplied array - in which the list of session information us returned. + nvmlEncoderSessionInfo_t: Reference to caller supplied array in + which the list of session information us returned. .. seealso:: `nvmlVgpuInstanceGetEncoderSessions` """ @@ -32547,17 +34485,18 @@ cpdef object vgpu_instance_get_encoder_sessions(unsigned int vgpu_instance): check_status_size(__status__) cdef EncoderSessionInfo session_info = EncoderSessionInfo(session_count[0]) cdef nvmlEncoderSessionInfo_t *session_info_ptr = (session_info._get_ptr()) - if session_count[0] == 0: - return session_info - with nogil: - __status__ = nvmlVgpuInstanceGetEncoderSessions(vgpu_instance, session_count, session_info_ptr) - check_status(__status__) - return session_info + if session_count[0] != 0: + with nogil: + __status__ = nvmlVgpuInstanceGetEncoderSessions(vgpu_instance, session_count, session_info_ptr) + check_status(__status__) + return session_info[:session_count[0]] cpdef object vgpu_instance_get_fbc_stats(unsigned int vgpu_instance): """Retrieves the active frame buffer capture sessions statistics of a vGPU Instance. + For Maxwell ™️ or newer fully supported devices. + Args: vgpu_instance (unsigned int): Identifier of the target vGPU instance. @@ -32579,6 +34518,18 @@ cpdef object vgpu_instance_get_fbc_stats(unsigned int vgpu_instance): cpdef object vgpu_instance_get_fbc_sessions(unsigned int vgpu_instance): """Retrieves information about active frame buffer capture sessions on a vGPU Instance. + An array of active FBC sessions is returned in the caller-supplied buffer + pointed at by ``session_info``. The array element count is passed in + ``session_count``, and ``session_count`` is used to return the number of + sessions written to the buffer. + If the supplied buffer is not large enough to accommodate the active session + array, the function returns NVML_ERROR_INSUFFICIENT_SIZE, with the element + count of ``nvmlFBCSessionInfo_t`` array required in ``session_count``. To query + the number of active FBC sessions, call this function with \*session_count = 0. + The code will return NVML_SUCCESS with number of active FBC sessions updated in + \*session_count. + For Maxwell ™️ or newer fully supported devices. + Args: vgpu_instance (unsigned int): Identifier of the target vGPU instance. @@ -32587,6 +34538,10 @@ cpdef object vgpu_instance_get_fbc_sessions(unsigned int vgpu_instance): nvmlFBCSessionInfo_t: Reference in which to return the session information. + .. note:: + hResolution, vResolution, averageFPS and averageLatency data for a FBC session + returned in ``session_info`` may be zero if there are no new frames captured + since the session started. .. seealso:: `nvmlVgpuInstanceGetFBCSessions` """ cdef unsigned int[1] session_count = [0] @@ -32595,17 +34550,18 @@ cpdef object vgpu_instance_get_fbc_sessions(unsigned int vgpu_instance): check_status_size(__status__) cdef FBCSessionInfo session_info = FBCSessionInfo(session_count[0]) cdef nvmlFBCSessionInfo_t *session_info_ptr = (session_info._get_ptr()) - if session_count[0] == 0: - return session_info - with nogil: - __status__ = nvmlVgpuInstanceGetFBCSessions(vgpu_instance, session_count, session_info_ptr) - check_status(__status__) - return session_info + if session_count[0] != 0: + with nogil: + __status__ = nvmlVgpuInstanceGetFBCSessions(vgpu_instance, session_count, session_info_ptr) + check_status(__status__) + return session_info[:session_count[0]] cpdef unsigned int vgpu_instance_get_gpu_instance_id(unsigned int vgpu_instance) except? 0: """Retrieve the GPU Instance ID for the given vGPU Instance. The API will return a valid GPU Instance ID for MIG backed vGPU Instance, else INVALID_GPU_INSTANCE_ID is returned. + For Kepler ™️ or newer fully supported devices. + Args: vgpu_instance (unsigned int): Identifier of the target vGPU instance. @@ -32625,6 +34581,9 @@ cpdef unsigned int vgpu_instance_get_gpu_instance_id(unsigned int vgpu_instance) cpdef str vgpu_instance_get_gpu_pci_id(unsigned int vgpu_instance): """Retrieves the PCI Id of the given vGPU Instance i.e. the PCI Id of the GPU as seen inside the VM. + The vGPU PCI id is returned as "00000000:00:00.0" if NVIDIA driver is not + installed on the vGPU instance. + Args: vgpu_instance (unsigned int): Identifier of the target vGPU instance. @@ -32638,27 +34597,28 @@ cpdef str vgpu_instance_get_gpu_pci_id(unsigned int vgpu_instance): with nogil: __status__ = nvmlVgpuInstanceGetGpuPciId(vgpu_instance, NULL, length) check_status_size(__status__) - if length[0] == 0: - return "" cdef bytes _vgpu_pci_id_ = bytes(length[0]) cdef char* vgpu_pci_id = _vgpu_pci_id_ - with nogil: - __status__ = nvmlVgpuInstanceGetGpuPciId(vgpu_instance, vgpu_pci_id, length) - check_status(__status__) + if length[0] != 0: + with nogil: + __status__ = nvmlVgpuInstanceGetGpuPciId(vgpu_instance, vgpu_pci_id, length) + check_status(__status__) return _cyb_cpython.PyUnicode_FromString(vgpu_pci_id) cpdef unsigned int vgpu_type_get_capabilities(unsigned int vgpu_type_id, int capability) except? 0: """Retrieve the requested capability for a given vGPU type. Refer to the ``nvmlVgpuCapability_t`` structure for the specific capabilities that can be queried. The return value in ``cap_result`` should be treated as a boolean, with a non-zero value indicating that the capability is supported. + For Maxwell ™️ or newer fully supported devices. + Args: vgpu_type_id (unsigned int): Handle to vGPU type. capability (VgpuCapability): Specifies the ``nvmlVgpuCapability_t`` to be queried. Returns: - unsigned int: A boolean for the queried capability indicating - that feature is supported. + unsigned int: A boolean for the queried capability indicating that + feature is supported. .. seealso:: `nvmlVgpuTypeGetCapabilities` """ @@ -32672,6 +34632,12 @@ cpdef unsigned int vgpu_type_get_capabilities(unsigned int vgpu_type_id, int cap cpdef str vgpu_instance_get_mdev_uuid(unsigned int vgpu_instance): """Retrieve the MDEV UUID of a vGPU instance. + The MDEV UUID is a globally unique identifier of the mdev device assigned to + the VM, and is returned as a 5-part hexadecimal string, not exceeding 80 + characters in length (including the NULL terminator). MDEV UUID is displayed + only on KVM platform. See nvmlConstants::NVML_DEVICE_UUID_BUFFER_SIZE. + For Maxwell ™️ or newer fully supported devices. + Args: vgpu_instance (unsigned int): Identifier of the target vGPU instance. @@ -32689,25 +34655,36 @@ cpdef str vgpu_instance_get_mdev_uuid(unsigned int vgpu_instance): return _cyb_cpython.PyUnicode_FromString(mdev_uuid) -cpdef gpu_instance_set_vgpu_scheduler_state(intptr_t gpu_instance, intptr_t p_scheduler): +cpdef gpu_instance_set_vgpu_scheduler_state(intptr_t gpu_instance, p_scheduler): """Set vGPU scheduler state for the given GPU instance. + For Blackwell &tm GB20x; or newer fully supported devices. + Scheduler state and params will be allowed to set only when no VM is running + within the GPU instance. In ``nvmlVgpuSchedulerState_t``, IFF enableARRMode is + enabled then provide the avgFactor and frequency as input. If enableARRMode is + disabled then provide timeslice as input. + The scheduler state change won't persist across module load/unload and GPU + Instance creation/deletion. + Args: gpu_instance (intptr_t): The GPU instance handle. - p_scheduler (intptr_t): Pointer to the caller-provided - structure of ``nvmlVgpuSchedulerState_t``. + p_scheduler (intptr_t): Pointer to the caller-provided structure + of ``nvmlVgpuSchedulerState_t``. .. seealso:: `nvmlGpuInstanceSetVgpuSchedulerState` """ - (p_scheduler).version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuSchedulerState_v1_t), 1) + cdef intptr_t _p_scheduler_ptr_ = int(p_scheduler) + (_p_scheduler_ptr_).version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuSchedulerState_v1_t), 1) with nogil: - __status__ = nvmlGpuInstanceSetVgpuSchedulerState(gpu_instance, p_scheduler) + __status__ = nvmlGpuInstanceSetVgpuSchedulerState(gpu_instance, _p_scheduler_ptr_) check_status(__status__) cpdef object gpu_instance_get_vgpu_scheduler_state(intptr_t gpu_instance): """Returns the vGPU scheduler state for the given GPU instance. The information returned in ``nvmlVgpuSchedulerStateInfo_t`` is not relevant if the BEST EFFORT policy is set. + For Blackwell &tm GB20x; or newer fully supported devices. + Args: gpu_instance (intptr_t): The GPU instance handle. @@ -32729,6 +34706,9 @@ cpdef object gpu_instance_get_vgpu_scheduler_state(intptr_t gpu_instance): cpdef object gpu_instance_get_vgpu_scheduler_log(intptr_t gpu_instance): """Returns the vGPU scheduler logs for the given GPU instance. ``p_scheduler_log_info`` points to a caller-allocated structure to contain the logs. The number of elements returned will never exceed ``NVML_SCHEDULER_SW_MAX_LOG_ENTRIES``. + To get the entire logs, call the function atleast 5 times a second. + For Blackwell &tm GB20x; or newer fully supported devices. + Args: gpu_instance (intptr_t): The GPU instance handle. @@ -32750,6 +34730,11 @@ cpdef object gpu_instance_get_vgpu_scheduler_log(intptr_t gpu_instance): cpdef str device_get_pgpu_metadata_string(intptr_t device): """Returns the properties of the physical GPU indicated by the device in an ascii-encoded string format. + The caller passes in a buffer via ``pgpu_metadata``, with the size of the + buffer in ``buffer_size``. If the string is too large to fit in the supplied + buffer, the function returns NVML_ERROR_INSUFFICIENT_SIZE with the size needed + in ``buffer_size``. + Args: device (intptr_t): The identifier of the target device. @@ -32763,25 +34748,27 @@ cpdef str device_get_pgpu_metadata_string(intptr_t device): with nogil: __status__ = nvmlDeviceGetPgpuMetadataString(device, NULL, buffer_size) check_status_size(__status__) - if buffer_size[0] == 0: - return "" cdef bytes _pgpu_metadata_ = bytes(buffer_size[0]) cdef char* pgpu_metadata = _pgpu_metadata_ - with nogil: - __status__ = nvmlDeviceGetPgpuMetadataString(device, pgpu_metadata, buffer_size) - check_status(__status__) + if buffer_size[0] != 0: + with nogil: + __status__ = nvmlDeviceGetPgpuMetadataString(device, pgpu_metadata, buffer_size) + check_status(__status__) return _cyb_cpython.PyUnicode_FromString(pgpu_metadata) cpdef object device_get_vgpu_scheduler_log(intptr_t device): """Returns the vGPU Software scheduler logs. ``p_scheduler_log`` points to a caller-allocated structure to contain the logs. The number of elements returned will never exceed ``NVML_SCHEDULER_SW_MAX_LOG_ENTRIES``. + To get the entire logs, call the function atleast 5 times a second. + For Pascal ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target ``device``. Returns: - nvmlVgpuSchedulerLog_t: Reference in which ``p_scheduler_log`` - is written. + nvmlVgpuSchedulerLog_t: Reference in which ``p_scheduler_log`` is + written. .. seealso:: `nvmlDeviceGetVgpuSchedulerLog` """ @@ -32796,6 +34783,8 @@ cpdef object device_get_vgpu_scheduler_log(intptr_t device): cpdef object device_get_vgpu_scheduler_state(intptr_t device): """Returns the vGPU scheduler state. The information returned in ``nvmlVgpuSchedulerGetState_t`` is not relevant if the BEST EFFORT policy is set. + For Pascal ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target ``device``. @@ -32816,6 +34805,8 @@ cpdef object device_get_vgpu_scheduler_state(intptr_t device): cpdef object device_get_vgpu_scheduler_capabilities(intptr_t device): """Returns the vGPU scheduler capabilities. The list of supported vGPU schedulers returned in ``nvmlVgpuSchedulerCapabilities_t`` is from the NVML_VGPU_SCHEDULER_POLICY_*. This list enumerates the supported scheduler policies if the engine is Graphics type. The other values in ``nvmlVgpuSchedulerCapabilities_t`` are also applicable if the engine is Graphics type. For other engine types, it is BEST EFFORT policy. If ARR is supported and enabled, scheduling frequency and averaging factor are applicable else timeSlice is applicable. + For Pascal ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target ``device``. @@ -32836,10 +34827,16 @@ cpdef object device_get_vgpu_scheduler_capabilities(intptr_t device): cpdef device_set_vgpu_scheduler_state(intptr_t device, intptr_t p_scheduler_state): """Sets the vGPU scheduler state. + For Pascal ™️ or newer fully supported devices. + The scheduler state change won't persist across module load/unload. Scheduler + state and params will be allowed to set only when no VM is running. In + ``nvmlVgpuSchedulerSetState_t``, IFF enableARRMode is enabled then provide + avgFactorForARR and frequency as input. If enableARRMode is disabled then + provide timeslice as input. + Args: device (intptr_t): The identifier of the target ``device``. - p_scheduler_state (intptr_t): vGPU ``p_scheduler_state`` to - set. + p_scheduler_state (intptr_t): vGPU ``p_scheduler_state`` to set. .. seealso:: `nvmlDeviceSetVgpuSchedulerState` """ @@ -32848,22 +34845,98 @@ cpdef device_set_vgpu_scheduler_state(intptr_t device, intptr_t p_scheduler_stat check_status(__status__) -cpdef set_vgpu_version(intptr_t vgpu_version): +cpdef tuple get_vgpu_version(): + """Query the ranges of supported vGPU versions. + + This function gets the linear range of supported vGPU versions that is preset + for the NVIDIA vGPU Manager and the range set by an administrator. If the + preset range has not been overridden by ``nvmlSetVgpuVersion``, both ranges are + the same. + The caller passes pointers to the following ``nvmlVgpuVersion_t`` structures, + into which the NVIDIA vGPU Manager writes the ranges:. + + Returns: + A 2-tuple containing: + - nvmlVgpuVersion_t: Pointer to the structure in which the preset + range of vGPU versions supported by the NVIDIA vGPU Manager is + written. + - nvmlVgpuVersion_t: Pointer to the structure in which the range of + supported vGPU versions set by an administrator is written. + + .. seealso:: `nvmlGetVgpuVersion` + """ + cdef VgpuVersion supported_py = VgpuVersion() + cdef nvmlVgpuVersion_t *supported = (supported_py._get_ptr()) + cdef VgpuVersion current_py = VgpuVersion() + cdef nvmlVgpuVersion_t *current = (current_py._get_ptr()) + with nogil: + __status__ = nvmlGetVgpuVersion(supported, current) + check_status(__status__) + return (supported_py, current_py) + + +cpdef set_vgpu_version(vgpu_version): """Override the preset range of vGPU versions supported by the NVIDIA vGPU Manager with a range set by an administrator. + This function configures the NVIDIA vGPU Manager with a range of supported vGPU + versions set by an administrator. This range must be a subset of the preset + range that the NVIDIA vGPU Manager supports. The custom range set by an + administrator takes precedence over the preset range and is advertised to the + guest VM for negotiating the vGPU version. See ``nvmlGetVgpuVersion`` for + details of how to query the preset range of versions supported. + This function takes a pointer to vGPU version range structure + ``nvmlVgpuVersion_t`` as input to override the preset vGPU version range that + the NVIDIA vGPU Manager supports. + After host system reboot or driver reload, the range of supported versions + reverts to the range that is preset for the NVIDIA vGPU Manager. + Args: vgpu_version (intptr_t): Pointer to a caller-supplied range of supported vGPU versions. + .. note:: + 1. The range set by the administrator must be a subset of the preset range that + the NVIDIA vGPU Manager supports. Otherwise, an error is returned. .. seealso:: `nvmlSetVgpuVersion` """ + cdef intptr_t _vgpu_version_ptr_ = int(vgpu_version) with nogil: - __status__ = nvmlSetVgpuVersion(vgpu_version) + __status__ = nvmlSetVgpuVersion(_vgpu_version_ptr_) check_status(__status__) -cpdef tuple device_get_vgpu_process_utilization(intptr_t device, unsigned long long last_seen_time_stamp): - """Retrieves current utilization for processes running on vGPUs on a physical GPU (device). +cpdef tuple device_get_vgpu_utilization(intptr_t device, unsigned long long last_seen_time_stamp): + """Retrieves current utilization for vGPUs on a physical GPU (device). + + For Kepler ™️ or newer fully supported devices. + Reads recent utilization of GPU SM (3D/Compute), framebuffer, video encoder, + and video decoder for vGPU instances running on a device. Utilization values + are returned as an array of utilization sample structures in the caller- + supplied buffer pointed at by ``utilization_samples``. One utilization sample + structure is returned per vGPU instance, and includes the CPU timestamp at + which the samples were recorded. Individual utilization values are returned as + "unsigned int" values in ``nvmlValue_t`` unions. The function sets the caller- + supplied ``sample_val_type`` to NVML_VALUE_TYPE_UNSIGNED_INT to indicate the + returned value type. + To read utilization values, first determine the size of buffer required to hold + the samples by invoking the function with ``utilization_samples`` set to NULL. + The function will return NVML_ERROR_INSUFFICIENT_SIZE, with the current vGPU + instance count in ``vgpu_instance_samples_count``, or NVML_SUCCESS if the + current vGPU instance count is zero. The caller should allocate a buffer of + size vgpu_instance_samples_count \* + sizeof(nvmlVgpuInstanceUtilizationSample_t). Invoke the function again with the + allocated buffer passed in ``utilization_samples``, and + ``vgpu_instance_samples_count`` set to the number of entries the buffer is + sized for. + On successful return, the function updates ``vgpuInstanceSampleCount`` with the + number of vGPU utilization sample structures that were actually written. This + may differ from a previously read value as vGPU instances are created or + destroyed. + last_seen_time_stamp represents the CPU timestamp in microseconds at which + utilization samples were last read. Set it to 0 to read utilization based on + all the samples maintained by the driver's internal sample buffer. Set + last_seen_time_stamp to a timeStamp retrieved from a previous query to read + utilization since the previous query. Args: device (intptr_t): The identifier for the target device. @@ -32872,29 +34945,91 @@ cpdef tuple device_get_vgpu_process_utilization(intptr_t device, unsigned long l Returns: A 2-tuple containing: + - int: Pointer to caller-supplied buffer to hold the type of + returned sample values. + - nvmlVgpuInstanceUtilizationSample_t: Pointer to caller-supplied + buffer in which vGPU utilization samples are returned. + + .. seealso:: `nvmlDeviceGetVgpuUtilization` + """ + cdef _ValueType sample_val_type + cdef unsigned int[1] vgpu_instance_samples_count = [0] + with nogil: + __status__ = nvmlDeviceGetVgpuUtilization(device, last_seen_time_stamp, &sample_val_type, vgpu_instance_samples_count, NULL) + check_status_size(__status__) + cdef VgpuInstanceUtilizationSample utilization_samples = VgpuInstanceUtilizationSample(vgpu_instance_samples_count[0]) + cdef nvmlVgpuInstanceUtilizationSample_t *utilization_samples_ptr = (utilization_samples._get_ptr()) + if not (vgpu_instance_samples_count[0] == 0): + with nogil: + __status__ = nvmlDeviceGetVgpuUtilization(device, last_seen_time_stamp, &sample_val_type, vgpu_instance_samples_count, utilization_samples_ptr) + check_status(__status__) + return (sample_val_type, utilization_samples[:vgpu_instance_samples_count[0]]) + + +cpdef object device_get_vgpu_process_utilization(intptr_t device, unsigned long long last_seen_time_stamp): + """Retrieves current utilization for processes running on vGPUs on a physical GPU (device). + + For Maxwell ™️ or newer fully supported devices. + Reads recent utilization of GPU SM (3D/Compute), framebuffer, video encoder, + and video decoder for processes running on vGPU instances active on a device. + Utilization values are returned as an array of utilization sample structures in + the caller-supplied buffer pointed at by ``utilization_samples``. One + utilization sample structure is returned per process running on vGPU instances, + that had some non-zero utilization during the last sample period. It includes + the CPU timestamp at which the samples were recorded. Individual utilization + values are returned as "unsigned int" values. + To read utilization values, first determine the size of buffer required to hold + the samples by invoking the function with ``utilization_samples`` set to NULL. + The function will return NVML_ERROR_INSUFFICIENT_SIZE, with the current vGPU + instance count in ``vgpu_process_samples_count``. The caller should allocate a + buffer of size vgpu_process_samples_count \* + sizeof(nvmlVgpuProcessUtilizationSample_t). Invoke the function again with the + allocated buffer passed in ``utilization_samples``, and + ``vgpu_process_samples_count`` set to the number of entries the buffer is sized + for. + On successful return, the function updates ``vgpuSubProcessSampleCount`` with + the number of vGPU sub process utilization sample structures that were actually + written. This may differ from a previously read value depending on the number + of processes that are active in any given sample period. + last_seen_time_stamp represents the CPU timestamp in microseconds at which + utilization samples were last read. Set it to 0 to read utilization based on + all the samples maintained by the driver's internal sample buffer. Set + last_seen_time_stamp to a timeStamp retrieved from a previous query to read + utilization since the previous query. + + Args: + device (intptr_t): The identifier for the target device. + last_seen_time_stamp (unsigned long long): Return only samples + with timestamp greater than last_seen_time_stamp. - - unsigned int: Pointer to caller-supplied array size, and - returns number of processes running on vGPU instances. - - nvmlVgpuProcessUtilizationSample_t: Pointer to caller-supplied + Returns: + nvmlVgpuProcessUtilizationSample_t: Pointer to caller-supplied buffer in which vGPU sub process utilization samples are returned. .. seealso:: `nvmlDeviceGetVgpuProcessUtilization` """ - cdef unsigned int vgpu_process_samples_count - cdef nvmlVgpuProcessUtilizationSample_t utilization_samples + cdef unsigned int[1] vgpu_process_samples_count = [0] with nogil: - __status__ = nvmlDeviceGetVgpuProcessUtilization(device, last_seen_time_stamp, &vgpu_process_samples_count, &utilization_samples) - check_status(__status__) - return (vgpu_process_samples_count, utilization_samples) + __status__ = nvmlDeviceGetVgpuProcessUtilization(device, last_seen_time_stamp, vgpu_process_samples_count, NULL) + check_status_size(__status__) + cdef VgpuProcessUtilizationSample utilization_samples = VgpuProcessUtilizationSample(vgpu_process_samples_count[0]) + cdef nvmlVgpuProcessUtilizationSample_t *utilization_samples_ptr = (utilization_samples._get_ptr()) + if vgpu_process_samples_count[0] != 0: + with nogil: + __status__ = nvmlDeviceGetVgpuProcessUtilization(device, last_seen_time_stamp, vgpu_process_samples_count, utilization_samples_ptr) + check_status(__status__) + return utilization_samples[:vgpu_process_samples_count[0]] cpdef int vgpu_instance_get_accounting_mode(unsigned int vgpu_instance) except? -1: """Queries the state of per process accounting mode on vGPU. + For Maxwell ™️ or newer fully supported devices. + Args: - vgpu_instance (unsigned int): The identifier of the target - vGPU instance. + vgpu_instance (unsigned int): The identifier of the target vGPU + instance. Returns: int: Reference in which to return the current accounting mode. @@ -32911,43 +35046,71 @@ cpdef int vgpu_instance_get_accounting_mode(unsigned int vgpu_instance) except? cpdef object vgpu_instance_get_accounting_pids(unsigned int vgpu_instance): """Queries list of processes running on vGPU that can be queried for accounting stats. The list of processes returned can be in running or terminated state. + For Maxwell ™️ or newer fully supported devices. + To just query the maximum number of processes that can be queried, call this + function with \*count = 0 and pids=NULL. The return code will be + NVML_ERROR_INSUFFICIENT_SIZE, or NVML_SUCCESS if list is empty. + For more details see ``nvmlVgpuInstanceGetAccountingStats``. + Args: - vgpu_instance (unsigned int): The identifier of the target - vGPU instance. + vgpu_instance (unsigned int): The identifier of the target vGPU + instance. Returns: - unsigned int: Reference in which to return list of process - ids. + unsigned int: Reference in which to return list of process ids. + .. note:: + In case of PID collision some processes might not be accessible before the + circular buffer is full. .. seealso:: `nvmlVgpuInstanceGetAccountingPids` """ cdef unsigned int[1] count = [0] with nogil: __status__ = nvmlVgpuInstanceGetAccountingPids(vgpu_instance, count, NULL) check_status_size(__status__) - if count[0] == 0: - return _cyb_view.array(shape=(1,), itemsize=sizeof(unsigned int), format="I", mode="c")[:0] - cdef _cyb_view.array pids = _cyb_view.array(shape=(count[0],), itemsize=sizeof(unsigned int), format="I", mode="c") - cdef unsigned int *pids_ptr = (pids.data) - with nogil: - __status__ = nvmlVgpuInstanceGetAccountingPids(vgpu_instance, count, pids_ptr) - check_status(__status__) - return pids + cdef _cyb_view.array _pids_alloc_ = _cyb_view.array(shape=(max(count[0], 1),), itemsize=sizeof(unsigned int), format="I", mode="c") + cdef unsigned int *pids_ptr = (_pids_alloc_.data) + cdef object pids = _pids_alloc_[:count[0]] + if count[0] != 0: + with nogil: + __status__ = nvmlVgpuInstanceGetAccountingPids(vgpu_instance, count, pids_ptr) + check_status(__status__) + return pids[:count[0]] cpdef object vgpu_instance_get_accounting_stats(unsigned int vgpu_instance, unsigned int pid): """Queries process's accounting stats. + For Maxwell ™️ or newer fully supported devices. + Accounting stats capture GPU utilization and other statistics across the + lifetime of a process, and can be queried during life time of the process or + after its termination. The time field in ``nvmlAccountingStats_t`` is reported + as 0 during the lifetime of the process and updated to actual running time + after its termination. Accounting stats are kept in a circular buffer, newly + created processes overwrite information about old processes. + See ``nvmlAccountingStats_t`` for description of each returned metric. List of + processes that can be queried can be retrieved from + ``nvmlVgpuInstanceGetAccountingPids``. + Args: - vgpu_instance (unsigned int): The identifier of the target - vGPU instance. + vgpu_instance (unsigned int): The identifier of the target vGPU + instance. pid (unsigned int): Process Id of the target process to query stats for. Returns: - nvmlAccountingStats_t: Reference in which to return the - process's accounting stats. + nvmlAccountingStats_t: Reference in which to return the process's + accounting stats. + .. note:: + Accounting Mode needs to be on. See ``nvmlVgpuInstanceGetAccountingMode``. + .. note:: + Only compute and graphics applications stats can be queried. Monitoring + applications stats can't be queried since they don't contribute to GPU + utilization. + .. note:: + In case of pid collision stats of only the latest process (that terminated + last) will be reported. .. seealso:: `nvmlVgpuInstanceGetAccountingStats` """ cdef AccountingStats stats_py = AccountingStats() @@ -32961,10 +35124,18 @@ cpdef object vgpu_instance_get_accounting_stats(unsigned int vgpu_instance, unsi cpdef vgpu_instance_clear_accounting_pids(unsigned int vgpu_instance): """Clears accounting information of the vGPU instance that have already terminated. + For Maxwell ™️ or newer fully supported devices. Requires root/admin + permissions. + Args: - vgpu_instance (unsigned int): The identifier of the target - vGPU instance. + vgpu_instance (unsigned int): The identifier of the target vGPU + instance. + .. note:: + Accounting Mode needs to be on. See ``nvmlVgpuInstanceGetAccountingMode``. + .. note:: + Only compute and graphics applications stats are reported and can be cleared + since monitoring applications stats don't contribute to GPU utilization. .. seealso:: `nvmlVgpuInstanceClearAccountingPids` """ with nogil: @@ -32975,6 +35146,8 @@ cpdef vgpu_instance_clear_accounting_pids(unsigned int vgpu_instance): cpdef object vgpu_instance_get_license_info_v2(unsigned int vgpu_instance): """Query the license information of the vGPU instance. + For Maxwell ™️ or newer fully supported devices. + Args: vgpu_instance (unsigned int): Identifier of the target vGPU instance. @@ -32996,9 +35169,11 @@ cpdef object vgpu_instance_get_license_info_v2(unsigned int vgpu_instance): cpdef unsigned int get_excluded_device_count() except? 0: """Retrieves the number of excluded GPU devices in the system. + For all products. + Returns: - unsigned int: Reference in which to return the number of - excluded devices. + unsigned int: Reference in which to return the number of excluded + devices. .. seealso:: `nvmlGetExcludedDeviceCount` """ @@ -33012,13 +35187,18 @@ cpdef unsigned int get_excluded_device_count() except? 0: cpdef object get_excluded_device_info_by_index(unsigned int index): """Acquire the device information for an excluded GPU device, based on its index. + For all products. + Valid indices are derived from the ``deviceCount`` returned by + :func:`get_excluded_device_count`. For example, if ``deviceCount`` is 2 the + valid indices are 0 and 1, corresponding to GPU 0 and GPU 1. + Args: index (unsigned int): The index of the target GPU, >= 0 and < ``deviceCount``. Returns: - nvmlExcludedDeviceInfo_t: Reference in which to return the - device information. + nvmlExcludedDeviceInfo_t: Reference in which to return the device + information. .. seealso:: `nvmlGetExcludedDeviceInfoByIndex` """ @@ -33033,6 +35213,20 @@ cpdef object get_excluded_device_info_by_index(unsigned int index): cpdef int device_set_mig_mode(intptr_t device, unsigned int mode) except? -1: """Set MIG mode for the device. + For Ampere ™️ or newer fully supported devices. Requires root user. + This mode determines whether a GPU instance can be created. + This API may unbind or reset the device to activate the requested mode. Thus, + the attributes associated with the device, such as minor number, might change. + The caller of this API is expected to query such attributes again. + On certain platforms like pass-through virtualization, where reset + functionality may not be exposed directly, VM reboot is required. + ``activation_status`` would return ``NVML_ERROR_RESET_REQUIRED`` for such + cases. + ``activation_status`` would return the appropriate error code upon unsuccessful + activation. For example, if device unbind fails because the device isn't idle, + ``NVML_ERROR_IN_USE`` would be returned. The caller of this API is expected to + idle the device and retry setting the ``mode``. + Args: device (intptr_t): The identifier of the target device. mode (unsigned int): The mode to be set, @@ -33041,6 +35235,10 @@ cpdef int device_set_mig_mode(intptr_t device, unsigned int mode) except? -1: Returns: int: The activation_status status. + .. note:: + On Windows, only disabling MIG mode is supported. ``activation_status`` would + return ``NVML_ERROR_NOT_SUPPORTED`` as GPU reset is not supported on Windows + through this API. .. seealso:: `nvmlDeviceSetMigMode` """ cdef _Return activation_status @@ -33053,16 +35251,19 @@ cpdef int device_set_mig_mode(intptr_t device, unsigned int mode) except? -1: cpdef tuple device_get_mig_mode(intptr_t device): """Get MIG mode for the device. + For Ampere ™️ or newer fully supported devices. + Changing MIG modes may require device unbind or reset. The "pending" MIG mode + refers to the target mode following the next activation trigger. + Args: device (intptr_t): The identifier of the target device. Returns: A 2-tuple containing: - - unsigned int: Returns the current mode, - ``NVML_DEVICE_MIG_DISABLE`` or ``NVML_DEVICE_MIG_ENABLE``. + ``NVML_DEVICE_MIG_DISABLE`` or ``NVML_DEVICE_MIG_ENABLE``. - unsigned int: Returns the pending mode, - ``NVML_DEVICE_MIG_DISABLE`` or ``NVML_DEVICE_MIG_ENABLE``. + ``NVML_DEVICE_MIG_DISABLE`` or ``NVML_DEVICE_MIG_ENABLE``. .. seealso:: `nvmlDeviceGetMigMode` """ @@ -33077,6 +35278,14 @@ cpdef tuple device_get_mig_mode(intptr_t device): cpdef object device_get_gpu_instance_possible_placements_v2(intptr_t device, unsigned int profile_id): """Get GPU instance placements. + A placement represents the location of a GPU instance within a device. This API + only returns all the possible placements for the given profile regardless of + whether MIG is enabled or not. A created GPU instance occupies memory slices + described by its placement. Creation of new GPU instance will fail if there is + overlap with the already occupied memory slices. + For Ampere ™️ or newer fully supported devices. Supported on Linux only. + Requires privileged user. + Args: device (intptr_t): The identifier of the target device. profile_id (unsigned int): The GPU instance profile ID. See @@ -33084,10 +35293,9 @@ cpdef object device_get_gpu_instance_possible_placements_v2(intptr_t device, uns Returns: nvmlGpuInstancePlacement_t: Returns placements allowed for the - profile. Can be NULL to discover number of allowed - placements for this profile. If non-NULL must be large - enough to accommodate the placements supported by the - profile. + profile. Can be NULL to discover number of allowed placements + for this profile. If non-NULL must be large enough to + accommodate the placements supported by the profile. .. seealso:: `nvmlDeviceGetGpuInstancePossiblePlacements_v2` """ @@ -33097,25 +35305,26 @@ cpdef object device_get_gpu_instance_possible_placements_v2(intptr_t device, uns check_status_size(__status__) cdef GpuInstancePlacement placements = GpuInstancePlacement(count[0]) cdef nvmlGpuInstancePlacement_t *placements_ptr = (placements._get_ptr()) - if count[0] == 0: - return placements - with nogil: - __status__ = nvmlDeviceGetGpuInstancePossiblePlacements_v2(device, profile_id, placements_ptr, count) - check_status(__status__) - return placements + if count[0] != 0: + with nogil: + __status__ = nvmlDeviceGetGpuInstancePossiblePlacements_v2(device, profile_id, placements_ptr, count) + check_status(__status__) + return placements[:count[0]] cpdef unsigned int device_get_gpu_instance_remaining_capacity(intptr_t device, unsigned int profile_id) except? 0: """Get GPU instance profile capacity. + For Ampere ™️ or newer fully supported devices. Supported on Linux only. + Requires privileged user. + Args: device (intptr_t): The identifier of the target device. profile_id (unsigned int): The GPU instance profile ID. See ``nvmlDeviceGetGpuInstanceProfileInfo``. Returns: - unsigned int: Returns remaining instance count for the profile - ID. + unsigned int: Returns remaining instance count for the profile ID. .. seealso:: `nvmlDeviceGetGpuInstanceRemainingCapacity` """ @@ -33129,6 +35338,12 @@ cpdef unsigned int device_get_gpu_instance_remaining_capacity(intptr_t device, u cpdef intptr_t device_create_gpu_instance(intptr_t device, unsigned int profile_id) except? 0: """Create GPU instance. + For Ampere ™️ or newer fully supported devices. Supported on Linux only. + Requires privileged user. + If the parent device is unbound, reset or the GPU instance is destroyed + explicitly, the GPU instance handle would become invalid. The GPU instance must + be recreated to acquire a valid handle. + Args: device (intptr_t): The identifier of the target device. profile_id (unsigned int): The GPU instance profile ID. See @@ -33146,9 +35361,15 @@ cpdef intptr_t device_create_gpu_instance(intptr_t device, unsigned int profile_ return gpu_instance -cpdef intptr_t device_create_gpu_instance_with_placement(intptr_t device, unsigned int profile_id, intptr_t placement) except? 0: +cpdef intptr_t device_create_gpu_instance_with_placement(intptr_t device, unsigned int profile_id, placement) except? 0: """Create GPU instance with the specified placement. + For Ampere ™️ or newer fully supported devices. Supported on Linux only. + Requires privileged user. + If the parent device is unbound, reset or the GPU instance is destroyed + explicitly, the GPU instance handle would become invalid. The GPU instance must + be recreated to acquire a valid handle. + Args: device (intptr_t): The identifier of the target device. profile_id (unsigned int): The GPU instance profile ID. See @@ -33161,9 +35382,10 @@ cpdef intptr_t device_create_gpu_instance_with_placement(intptr_t device, unsign .. seealso:: `nvmlDeviceCreateGpuInstanceWithPlacement` """ + cdef intptr_t _placement_ptr_ = int(placement) cdef GpuInstance gpu_instance with nogil: - __status__ = nvmlDeviceCreateGpuInstanceWithPlacement(device, profile_id, placement, &gpu_instance) + __status__ = nvmlDeviceCreateGpuInstanceWithPlacement(device, profile_id, _placement_ptr_, &gpu_instance) check_status(__status__) return gpu_instance @@ -33171,6 +35393,9 @@ cpdef intptr_t device_create_gpu_instance_with_placement(intptr_t device, unsign cpdef gpu_instance_destroy(intptr_t gpu_instance): """Destroy GPU instance. + For Ampere ™️ or newer fully supported devices. Supported on Linux only. + Requires privileged user. + Args: gpu_instance (intptr_t): The GPU instance handle. @@ -33184,6 +35409,9 @@ cpdef gpu_instance_destroy(intptr_t gpu_instance): cpdef intptr_t device_get_gpu_instance_by_id(intptr_t device, unsigned int id) except? 0: """Get GPU instances for given instance ID. + For Ampere ™️ or newer fully supported devices. Supported on Linux only. + Requires privileged user. + Args: device (intptr_t): The identifier of the target device. id (unsigned int): The GPU instance ID. @@ -33203,6 +35431,8 @@ cpdef intptr_t device_get_gpu_instance_by_id(intptr_t device, unsigned int id) e cpdef object gpu_instance_get_info(intptr_t gpu_instance): """Get GPU instance information. + For Ampere ™️ or newer fully supported devices. Supported on Linux only. + Args: gpu_instance (intptr_t): The GPU instance handle. @@ -33222,6 +35452,8 @@ cpdef object gpu_instance_get_info(intptr_t gpu_instance): cpdef object gpu_instance_get_compute_instance_profile_info_v(intptr_t gpu_instance, unsigned int profile, unsigned int eng_profile): """Versioned wrapper around ``nvmlGpuInstanceGetComputeInstanceProfileInfo`` that accepts a versioned ``nvmlComputeInstanceProfileInfo_v2_t`` or later output structure. + For Ampere ™️ or newer fully supported devices. Supported on Linux only. + Args: gpu_instance (intptr_t): The identifier of the target GPU instance. @@ -33248,15 +35480,17 @@ cpdef object gpu_instance_get_compute_instance_profile_info_v(intptr_t gpu_insta cpdef unsigned int gpu_instance_get_compute_instance_remaining_capacity(intptr_t gpu_instance, unsigned int profile_id) except? 0: """Get compute instance profile capacity. + For Ampere ™️ or newer fully supported devices. Supported on Linux only. + Requires privileged user. + Args: gpu_instance (intptr_t): The identifier of the target GPU instance. - profile_id (unsigned int): The compute instance profile ID. - See ``nvmlGpuInstanceGetComputeInstanceProfileInfo``. + profile_id (unsigned int): The compute instance profile ID. See + ``nvmlGpuInstanceGetComputeInstanceProfileInfo``. Returns: - unsigned int: Returns remaining instance count for the profile - ID. + unsigned int: Returns remaining instance count for the profile ID. .. seealso:: `nvmlGpuInstanceGetComputeInstanceRemainingCapacity` """ @@ -33270,18 +35504,25 @@ cpdef unsigned int gpu_instance_get_compute_instance_remaining_capacity(intptr_t cpdef object gpu_instance_get_compute_instance_possible_placements(intptr_t gpu_instance, unsigned int profile_id): """Get compute instance placements. + For Ampere ™️ or newer fully supported devices. Supported on Linux only. + Requires privileged user. + A placement represents the location of a compute instance within a GPU + instance. This API only returns all the possible placements for the given + profile. A created compute instance occupies compute slices described by its + placement. Creation of new compute instance will fail if there is overlap with + the already occupied compute slices. + Args: gpu_instance (intptr_t): The identifier of the target GPU instance. - profile_id (unsigned int): The compute instance profile ID. - See ``nvmlGpuInstanceGetComputeInstanceProfileInfo``. + profile_id (unsigned int): The compute instance profile ID. See + ``nvmlGpuInstanceGetComputeInstanceProfileInfo``. Returns: - nvmlComputeInstancePlacement_t: Returns placements allowed for - the profile. Can be NULL to discover number of allowed - placements for this profile. If non-NULL must be large - enough to accommodate the placements supported by the - profile. + nvmlComputeInstancePlacement_t: Returns placements allowed for the + profile. Can be NULL to discover number of allowed placements + for this profile. If non-NULL must be large enough to + accommodate the placements supported by the profile. .. seealso:: `nvmlGpuInstanceGetComputeInstancePossiblePlacements` """ @@ -33291,22 +35532,28 @@ cpdef object gpu_instance_get_compute_instance_possible_placements(intptr_t gpu_ check_status_size(__status__) cdef ComputeInstancePlacement placements = ComputeInstancePlacement(count[0]) cdef nvmlComputeInstancePlacement_t *placements_ptr = (placements._get_ptr()) - if count[0] == 0: - return placements - with nogil: - __status__ = nvmlGpuInstanceGetComputeInstancePossiblePlacements(gpu_instance, profile_id, placements_ptr, count) - check_status(__status__) - return placements + if count[0] != 0: + with nogil: + __status__ = nvmlGpuInstanceGetComputeInstancePossiblePlacements(gpu_instance, profile_id, placements_ptr, count) + check_status(__status__) + return placements[:count[0]] cpdef intptr_t gpu_instance_create_compute_instance(intptr_t gpu_instance, unsigned int profile_id) except? 0: """Create compute instance. + For Ampere ™️ or newer fully supported devices. Supported on Linux only. + Requires privileged user. + If the parent device is unbound, reset or the parent GPU instance is destroyed + or the compute instance is destroyed explicitly, the compute instance handle + would become invalid. The compute instance must be recreated to acquire a valid + handle. + Args: gpu_instance (intptr_t): The identifier of the target GPU instance. - profile_id (unsigned int): The compute instance profile ID. - See ``nvmlGpuInstanceGetComputeInstanceProfileInfo``. + profile_id (unsigned int): The compute instance profile ID. See + ``nvmlGpuInstanceGetComputeInstanceProfileInfo``. Returns: intptr_t: Returns the compute instance handle. @@ -33320,14 +35567,21 @@ cpdef intptr_t gpu_instance_create_compute_instance(intptr_t gpu_instance, unsig return compute_instance -cpdef intptr_t gpu_instance_create_compute_instance_with_placement(intptr_t gpu_instance, unsigned int profile_id, intptr_t placement) except? 0: +cpdef intptr_t gpu_instance_create_compute_instance_with_placement(intptr_t gpu_instance, unsigned int profile_id, placement) except? 0: """Create compute instance with the specified placement. + For Ampere ™️ or newer fully supported devices. Supported on Linux only. + Requires privileged user. + If the parent device is unbound, reset or the parent GPU instance is destroyed + or the compute instance is destroyed explicitly, the compute instance handle + would become invalid. The compute instance must be recreated to acquire a valid + handle. + Args: gpu_instance (intptr_t): The identifier of the target GPU instance. - profile_id (unsigned int): The compute instance profile ID. - See ``nvmlGpuInstanceGetComputeInstanceProfileInfo``. + profile_id (unsigned int): The compute instance profile ID. See + ``nvmlGpuInstanceGetComputeInstanceProfileInfo``. placement (intptr_t): The requested placement. See ``nvmlGpuInstanceGetComputeInstancePossiblePlacements``. @@ -33336,9 +35590,10 @@ cpdef intptr_t gpu_instance_create_compute_instance_with_placement(intptr_t gpu_ .. seealso:: `nvmlGpuInstanceCreateComputeInstanceWithPlacement` """ + cdef intptr_t _placement_ptr_ = int(placement) cdef ComputeInstance compute_instance with nogil: - __status__ = nvmlGpuInstanceCreateComputeInstanceWithPlacement(gpu_instance, profile_id, placement, &compute_instance) + __status__ = nvmlGpuInstanceCreateComputeInstanceWithPlacement(gpu_instance, profile_id, _placement_ptr_, &compute_instance) check_status(__status__) return compute_instance @@ -33346,6 +35601,9 @@ cpdef intptr_t gpu_instance_create_compute_instance_with_placement(intptr_t gpu_ cpdef compute_instance_destroy(intptr_t compute_instance): """Destroy compute instance. + For Ampere ™️ or newer fully supported devices. Supported on Linux only. + Requires privileged user. + Args: compute_instance (intptr_t): The compute instance handle. @@ -33359,6 +35617,9 @@ cpdef compute_instance_destroy(intptr_t compute_instance): cpdef intptr_t gpu_instance_get_compute_instance_by_id(intptr_t gpu_instance, unsigned int id) except? 0: """Get compute instance for given instance ID. + For Ampere ™️ or newer fully supported devices. Supported on Linux only. + Requires privileged user. + Args: gpu_instance (intptr_t): The identifier of the target GPU instance. @@ -33379,12 +35640,13 @@ cpdef intptr_t gpu_instance_get_compute_instance_by_id(intptr_t gpu_instance, un cpdef object compute_instance_get_info_v2(intptr_t compute_instance): """Get compute instance information. + For Ampere ™️ or newer fully supported devices. Supported on Linux only. + Args: compute_instance (intptr_t): The compute instance handle. Returns: - nvmlComputeInstanceInfo_t: Return compute instance - information. + nvmlComputeInstanceInfo_t: Return compute instance information. .. seealso:: `nvmlComputeInstanceGetInfo_v2` """ @@ -33399,6 +35661,12 @@ cpdef object compute_instance_get_info_v2(intptr_t compute_instance): cpdef unsigned int device_is_mig_device_handle(intptr_t device) except? 0: """Test if the given handle refers to a MIG device. + A MIG device handle is an NVML abstraction which maps to a MIG compute + instance. These overloaded references can be used (with some restrictions) + interchangeably with a GPU device handle to execute queries at a per-compute + instance granularity. + For Ampere ™️ or newer fully supported devices. Supported on Linux only. + Args: device (intptr_t): NVML handle to test. @@ -33417,6 +35685,10 @@ cpdef unsigned int device_is_mig_device_handle(intptr_t device) except? 0: cpdef unsigned int device_get_gpu_instance_id(intptr_t device) except? 0: """Get GPU instance ID for the given MIG device handle. + GPU instance IDs are unique per device and remain valid until the GPU instance + is destroyed. + For Ampere ™️ or newer fully supported devices. Supported on Linux only. + Args: device (intptr_t): Target MIG device handle. @@ -33435,6 +35707,10 @@ cpdef unsigned int device_get_gpu_instance_id(intptr_t device) except? 0: cpdef unsigned int device_get_compute_instance_id(intptr_t device) except? 0: """Get compute instance ID for the given MIG device handle. + Compute instance IDs are unique per GPU instance and remain valid until the + compute instance is destroyed. + For Ampere ™️ or newer fully supported devices. Supported on Linux only. + Args: device (intptr_t): Target MIG device handle. @@ -33453,6 +35729,9 @@ cpdef unsigned int device_get_compute_instance_id(intptr_t device) except? 0: cpdef unsigned int device_get_max_mig_device_count(intptr_t device) except? 0: """Get the maximum number of MIG devices that can exist under a given parent NVML device. + Returns zero if MIG is not supported or enabled. + For Ampere ™️ or newer fully supported devices. Supported on Linux only. + Args: device (intptr_t): Target device handle. @@ -33471,6 +35750,12 @@ cpdef unsigned int device_get_max_mig_device_count(intptr_t device) except? 0: cpdef intptr_t device_get_mig_device_handle_by_index(intptr_t device, unsigned int index) except? 0: """Get MIG device handle for the given index under its parent NVML device. + If the compute instance is destroyed either explicitly or by destroying, + resetting or unbinding the parent GPU instance or the GPU device itself the MIG + device handle would remain invalid and must be requested again using this API. + Handles may be reused and their properties can change in the process. + For Ampere ™️ or newer fully supported devices. Supported on Linux only. + Args: device (intptr_t): Reference to the parent GPU device handle. index (unsigned int): Index of the MIG device. @@ -33490,6 +35775,8 @@ cpdef intptr_t device_get_mig_device_handle_by_index(intptr_t device, unsigned i cpdef intptr_t device_get_device_handle_from_mig_device_handle(intptr_t mig_device) except? 0: """Get parent device handle from a MIG device handle. + For Ampere ™️ or newer fully supported devices. Supported on Linux only. + Args: mig_device (intptr_t): MIG device handle. @@ -33508,12 +35795,14 @@ cpdef intptr_t device_get_device_handle_from_mig_device_handle(intptr_t mig_devi cpdef device_power_smoothing_activate_preset_profile(intptr_t device, intptr_t profile): """Activiate a specific preset profile for datacenter power smoothing. The API only sets the active preset profile based on the input profileId, and ignores the other parameters of the structure. Requires root/admin permissions. + For Blackwell ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. profile (intptr_t): Reference to ``nvmlPowerSmoothingProfile_v1_t``. Note that only - ``profile->profileId`` is used and the rest of the - structure is ignored. + ``profile->profileId`` is used and the rest of the structure + is ignored. .. seealso:: `nvmlDevicePowerSmoothingActivatePresetProfile` """ @@ -33525,6 +35814,13 @@ cpdef device_power_smoothing_activate_preset_profile(intptr_t device, intptr_t p cpdef device_power_smoothing_update_preset_profile_param(intptr_t device, intptr_t profile): """Update the value of a specific profile parameter contained within ``nvmlPowerSmoothingProfile_v1_t``. Requires root/admin permissions. + For Blackwell ™️ or newer fully supported devices. + NVML_POWER_SMOOTHING_PROFILE_PARAM_PERCENT_TMP_FLOOR expects a value as a + percentage from 00.00-100.00% NVML_POWER_SMOOTHING_PROFILE_PARAM_RAMP_UP_RATE + expects a value in W/s NVML_POWER_SMOOTHING_PROFILE_PARAM_RAMP_DOWN_RATE + expects a value in W/s NVML_POWER_SMOOTHING_PROFILE_PARAM_RAMP_DOWN_HYSTERESIS + expects a value in ms. + Args: device (intptr_t): The identifier of the target device. profile (intptr_t): Reference to @@ -33540,10 +35836,12 @@ cpdef device_power_smoothing_update_preset_profile_param(intptr_t device, intptr cpdef device_power_smoothing_set_state(intptr_t device, intptr_t state): """Enable or disable the Power Smoothing Feature. Requires root/admin permissions. + For Blackwell ™️ or newer fully supported devices. + See ``nvmlEnableState_t`` for details on allowed states. + Args: device (intptr_t): The identifier of the target device. - state (intptr_t): Reference to - ``nvmlPowerSmoothingState_v1_t``. + state (intptr_t): Reference to ``nvmlPowerSmoothingState_v1_t``. .. seealso:: `nvmlDevicePowerSmoothingSetState` """ @@ -33555,12 +35853,14 @@ cpdef device_power_smoothing_set_state(intptr_t device, intptr_t state): cpdef object device_get_addressing_mode(intptr_t device): """Get the addressing mode for a given GPU. Addressing modes can be one of:. + For Turing ™️ or newer fully supported devices. Supported on Linux only. + Args: device (intptr_t): The device handle. Returns: - nvmlDeviceAddressingMode_v1_t: Pointer to addressing mode of - the device. + nvmlDeviceAddressingMode_v1_t: Pointer to addressing mode of the + device. .. seealso:: `nvmlDeviceGetAddressingMode` """ @@ -33576,6 +35876,8 @@ cpdef object device_get_addressing_mode(intptr_t device): cpdef object device_get_repair_status(intptr_t device): """Get the repair status for TPC/Channel repair. + For Ampere ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. @@ -33596,12 +35898,16 @@ cpdef object device_get_repair_status(intptr_t device): cpdef object device_get_power_mizer_mode_v1(intptr_t device): """Retrieves current power mizer mode on this device. + PowerMizerMode provides a hint to the driver as to how to manage the + performance of the GPU. + For Maxwell ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. Returns: - nvmlDevicePowerMizerModes_v1_t: Reference in which to return - the power mizer mode. + nvmlDevicePowerMizerModes_v1_t: Reference in which to return the + power mizer mode. .. seealso:: `nvmlDeviceGetPowerMizerMode_v1` """ @@ -33613,27 +35919,41 @@ cpdef object device_get_power_mizer_mode_v1(intptr_t device): return power_mizer_mode_py -cpdef device_set_power_mizer_mode_v1(intptr_t device, intptr_t power_mizer_mode): +cpdef device_set_power_mizer_mode_v1(intptr_t device, power_mizer_mode): """Sets the new power mizer mode. + For Maxwell ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. - power_mizer_mode (intptr_t): Reference in which to set the - power mizer mode. + power_mizer_mode (intptr_t): Reference in which to set the power + mizer mode. .. seealso:: `nvmlDeviceSetPowerMizerMode_v1` """ + cdef intptr_t _power_mizer_mode_ptr_ = int(power_mizer_mode) with nogil: - __status__ = nvmlDeviceSetPowerMizerMode_v1(device, power_mizer_mode) + __status__ = nvmlDeviceSetPowerMizerMode_v1(device, _power_mizer_mode_ptr_) check_status(__status__) cpdef device_vgpu_force_gsp_unload(intptr_t device): """Executes a forced GSP unload operation on a device. + For Ada ™️ or newer fully supported devices. Forces the unload of the GSP + firmware on a device currently operating in vGPU mode. This operation forcibly + removes the GSP from the targeted GPU and terminates all GSP operations. + Args: device (intptr_t): The identifier of the target device. + .. note:: + This is a disruptive operation that will impact any active vGPU instances and + should only be used when absolutely necessary, such as during error recovery or + maintenance operations. + .. note:: + This operation may result in a temporary loss of GPU functionality and should + be used with caution. .. seealso:: `nvmlDeviceVgpuForceGspUnload` """ with nogil: @@ -33644,6 +35964,8 @@ cpdef device_vgpu_force_gsp_unload(intptr_t device): cpdef object device_get_vgpu_scheduler_state_v2(intptr_t device): """Returns the vGPU scheduler state. The information returned in ``nvmlVgpuSchedulerStateInfo_v2_t`` is not relevant if the BEST EFFORT policy is set. + For Pascal ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target ``device``. @@ -33664,6 +35986,8 @@ cpdef object device_get_vgpu_scheduler_state_v2(intptr_t device): cpdef object gpu_instance_get_vgpu_scheduler_state_v2(intptr_t gpu_instance): """Returns the vGPU scheduler state for the given GPU instance. The information returned in ``nvmlVgpuSchedulerStateInfo_v2_t`` is not relevant if the BEST EFFORT policy is set. + For Blackwell &tm GB20x; or newer fully supported devices. + Args: gpu_instance (intptr_t): The GPU instance handle. @@ -33684,6 +36008,9 @@ cpdef object gpu_instance_get_vgpu_scheduler_state_v2(intptr_t gpu_instance): cpdef object device_get_vgpu_scheduler_log_v2(intptr_t device): """Returns the vGPU Software scheduler logs for the device. ``p_scheduler_log_info`` points to a caller-allocated structure to contain the logs. The number of elements returned will never exceed ``NVML_SCHEDULER_SW_MAX_LOG_ENTRIES``. + To get the entire logs, call the function atleast 5 times a second. + For Pascal ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target ``device``. @@ -33704,6 +36031,9 @@ cpdef object device_get_vgpu_scheduler_log_v2(intptr_t device): cpdef object gpu_instance_get_vgpu_scheduler_log_v2(intptr_t gpu_instance): """Returns the vGPU scheduler logs for the given GPU instance. ``p_scheduler_log_info`` points to a caller-allocated structure to contain the logs. The number of elements returned will never exceed ``NVML_SCHEDULER_SW_MAX_LOG_ENTRIES``. + To get the entire logs, call the function atleast 5 times a second. + For Blackwell &tm GB20x; or newer fully supported devices. + Args: gpu_instance (intptr_t): The GPU instance handle. @@ -33721,24 +36051,34 @@ cpdef object gpu_instance_get_vgpu_scheduler_log_v2(intptr_t gpu_instance): return p_scheduler_log_info_py -cpdef device_set_vgpu_scheduler_state_v2(intptr_t device, intptr_t p_scheduler_state): +cpdef device_set_vgpu_scheduler_state_v2(intptr_t device, p_scheduler_state): """Sets the vGPU scheduler state. + For Pascal ™️ or newer fully supported devices. + The scheduler state change won't persist across module load/unload. Scheduler + state and params will be allowed to set only when no VM is running. + Args: device (intptr_t): The identifier of the target ``device``. - p_scheduler_state (intptr_t): vGPU ``p_scheduler_state`` to - set. + p_scheduler_state (intptr_t): vGPU ``p_scheduler_state`` to set. .. seealso:: `nvmlDeviceSetVgpuSchedulerState_v2` """ + cdef intptr_t _p_scheduler_state_ptr_ = int(p_scheduler_state) with nogil: - __status__ = nvmlDeviceSetVgpuSchedulerState_v2(device, p_scheduler_state) + __status__ = nvmlDeviceSetVgpuSchedulerState_v2(device, _p_scheduler_state_ptr_) check_status(__status__) -cpdef gpu_instance_set_vgpu_scheduler_state_v2(intptr_t gpu_instance, intptr_t p_scheduler_state): +cpdef gpu_instance_set_vgpu_scheduler_state_v2(intptr_t gpu_instance, p_scheduler_state): """Set vGPU scheduler state for the given GPU instance. + For Blackwell &tm GB20x; or newer fully supported devices. + Scheduler state and params will be allowed to set only when no VM is running + within the GPU instance. + The scheduler state change won't persist across module load/unload and GPU + Instance creation/deletion. + Args: gpu_instance (intptr_t): The GPU instance handle. p_scheduler_state (intptr_t): Pointer to the caller-provided @@ -33746,21 +36086,34 @@ cpdef gpu_instance_set_vgpu_scheduler_state_v2(intptr_t gpu_instance, intptr_t p .. seealso:: `nvmlGpuInstanceSetVgpuSchedulerState_v2` """ + cdef intptr_t _p_scheduler_state_ptr_ = int(p_scheduler_state) with nogil: - __status__ = nvmlGpuInstanceSetVgpuSchedulerState_v2(gpu_instance, p_scheduler_state) + __status__ = nvmlGpuInstanceSetVgpuSchedulerState_v2(gpu_instance, _p_scheduler_state_ptr_) check_status(__status__) cpdef object system_get_cper_v1(): """Retrieves Common Platform Error Record (CPER) data. - Returns: - nvmlGetCPER_v1_t: Pointer to an ``nvmlGetCPER_v1_t``. On entry - set ``cursor.cperTypeMask``, ``cursor.uuid`` (empty string - for all), ``cursor.handle`` (to - ``NVML_CPER_CURSOR_HANDLE_INIT`` for first call), - ``buffer`` (or NULL), ``bufferSize``. On return - ``cursor.handle`` and ``bufferSize`` are updated. + Records are returned in a caller-supplied buffer. Iteration is driven by the + ``cursor`` (``nvmlCPERCursor_v1_t``) struct: pass the same ``cursor`` on every + call in a sequence; the implementation updates ``cursor.handle``. Do not modify + ``cursor`` between calls. To change ``cursor.cperTypeMask`` or ``cursor.uuid``, + set ``cursor.handle`` to ``NVML_CPER_CURSOR_HANDLE_INIT`` and call again (new + iteration). + For a size query, call with ``buffer`` NULL and ``bufferSize`` 0; the function + returns ``NVML_ERROR_INSUFFICIENT_SIZE`` and sets ``bufferSize`` when records + exist, or ``NVML_SUCCESS`` with ``bufferSize`` set to 0 when there are no CPER + records. Use ``bufferSize`` == 0 on return as the indicator for "no records" or + "no more records". + This API requires root privileges. Records are available from initialization. + + Returns: + nvmlGetCPER_v1_t: Pointer to an ``nvmlGetCPER_v1_t``. On entry set + ``cursor.cperTypeMask``, ``cursor.uuid`` (empty string for + all), ``cursor.handle`` (to ``NVML_CPER_CURSOR_HANDLE_INIT`` + for first call), ``buffer`` (or NULL), ``bufferSize``. On + return ``cursor.handle`` and ``bufferSize`` are updated. .. seealso:: `nvmlSystemGetCPER_v1` """ @@ -33775,13 +36128,14 @@ cpdef object system_get_cper_v1(): cpdef object device_get_bbx_time_data_v1(intptr_t device): """Retrieves the cumulative number of seconds the GPU has had the driver loaded. + For all products with an inforom. + Args: device (intptr_t): The identifier of the target device. Returns: - nvmlBBXTimeData_v1_t: Reference in which to return the - cumulative number of seconds the GPU has had the driver - loaded. + nvmlBBXTimeData_v1_t: Reference in which to return the cumulative + number of seconds the GPU has had the driver loaded. .. seealso:: `nvmlDeviceGetBBXTimeData_v1` """ @@ -33796,6 +36150,18 @@ cpdef object device_get_bbx_time_data_v1(intptr_t device): cpdef object device_get_accounting_stats_v2(intptr_t device): """Queries process's accounting stats (v2). + For Kepler ™️ or newer fully supported devices. + Accounting stats (v2) capture GPU utilization and other statistics across the + lifetime of a process. Accounting stats (v2) can be queried during life time of + the process and after its termination. The time field in + ``nvmlAccountingStats_v2_t`` is reported as 0 during the lifetime of the + process and updated to actual running time after its termination. Accounting + stats (v2) are kept in a circular buffer, newly created processes overwrite + information about old processes. + See ``nvmlAccountingStats_v2_t`` for description of each returned metric. List + of processes that can be queried can be retrieved from + ``nvmlDeviceGetAccountingPids``. + Args: device (intptr_t): The identifier of the target device. @@ -33803,6 +36169,18 @@ cpdef object device_get_accounting_stats_v2(intptr_t device): nvmlAccountingStats_v2_t: Reference in which to return the process's accounting stats (v2). + .. note:: + Accounting Mode needs to be on. See ``nvmlDeviceGetAccountingMode``. + .. note:: + Only compute and graphics applications stats can be queried. Monitoring + applications stats can't be queried since they don't contribute to GPU + utilization. + .. note:: + In case of pid collision stats of only the latest process (that terminated + last) will be reported. + .. note:: + On Kepler devices per process statistics are accurate only if there's one + process running on a GPU. .. seealso:: `nvmlDeviceGetAccountingStats_v2` """ cdef AccountingStats_v2 stats_py = AccountingStats_v2() @@ -33816,6 +36194,8 @@ cpdef object device_get_accounting_stats_v2(intptr_t device): cpdef object device_get_remapped_rows_v2(intptr_t device): """Get the status of row remapper. + For Ampere ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. @@ -33823,6 +36203,9 @@ cpdef object device_get_remapped_rows_v2(intptr_t device): nvmlRemappedRowsInfo_v2_t: Reference for ``nvmlRemappedRowsInfo_v2_t``. + .. note:: + On MIG-enabled GPUs with active instances, querying the number of remapped rows + is not supported. .. seealso:: `nvmlDeviceGetRemappedRows_v2` """ cdef RemappedRowsInfo_v2 info_py = RemappedRowsInfo_v2() @@ -33836,10 +36219,15 @@ cpdef object device_get_remapped_rows_v2(intptr_t device): cpdef device_set_adaptive_tgp_mode_v1(intptr_t device, int mode): """Request to enable or disable Adaptive TGP Mode for a GPU. + RUBIN_OR_NEWER% Requires root/admin privileges. + Adaptive TGP Mode assigns tailored power budgets to two binned GPU parts within + the same module, reducing node-to-node and rack-to-rack performance variation. + An out-of-band administrator policy may override the in-band request; use + ``nvmlDeviceGetAdaptiveTgpModeInfo_v1`` to query the arbitrated state. + Args: device (intptr_t): The identifier of the target device. - mode (EnableState): NVML_FEATURE_ENABLED or - NVML_FEATURE_DISABLED. + mode (EnableState): NVML_FEATURE_ENABLED or NVML_FEATURE_DISABLED. .. seealso:: `nvmlDeviceSetAdaptiveTgpMode_v1` """ @@ -33851,6 +36239,12 @@ cpdef device_set_adaptive_tgp_mode_v1(intptr_t device, int mode): cpdef object device_get_adaptive_tgp_mode_info_v1(intptr_t device): """Retrieves Adaptive TGP Mode state and telemetry for a GPU. + RUBIN_OR_NEWER%. + Populates ``info`` with the in-band request, out-of-band enablement status, + out-of-band override status, arbitrated enablement state, and adjusted base + power limit. The adjusted base power is valid only when feature is enabled. See + ``nvmlAdaptiveTgpModeInfo_v1_t`` for field details. + Args: device (intptr_t): The identifier of the target device. @@ -33868,24 +36262,36 @@ cpdef object device_get_adaptive_tgp_mode_info_v1(intptr_t device): return info_py -cpdef device_set_memory_limits_v1(intptr_t device, intptr_t limits): +cpdef device_set_memory_limits_v1(intptr_t device, limits): """Set the memory limits of the device for the cgroup partition. + This method will set the memory limits of the device for the specified cgroup + partition. The limits will indicate the amount of memory that can be allocated + for the device for use of an application in that cgroup. + For all products. For Linux only. Requires root/admin permissions. + Args: device (intptr_t): The identifier of the target device. - limits (intptr_t): A pointer to ``nvmlSetMemoryLimits_v1_t`` - where the limits can be set. + limits (intptr_t): A pointer to ``nvmlSetMemoryLimits_v1_t`` where + the limits can be set. + .. note:: + MIG handles are not supported. .. seealso:: `nvmlDeviceSetMemoryLimits_v1` """ + cdef intptr_t _limits_ptr_ = int(limits) with nogil: - __status__ = nvmlDeviceSetMemoryLimits_v1(device, limits) + __status__ = nvmlDeviceSetMemoryLimits_v1(device, _limits_ptr_) check_status(__status__) cpdef object device_get_memory_limits_v1(intptr_t device): """Get the memory limits of the device for the cgroup partition. + This method will get the current memory limits of the device for the specified + cgroup partition, as well as the current memory used against the limits. + For all products. For Linux only. + Args: device (intptr_t): The identifier of the target device. @@ -33893,6 +36299,8 @@ cpdef object device_get_memory_limits_v1(intptr_t device): nvmlGetMemoryLimits_v1_t: A pointer to ``nvmlGetMemoryLimits_v1_t``. + .. note:: + MIG handles are not supported. .. seealso:: `nvmlDeviceGetMemoryLimits_v1` """ cdef GetMemoryLimits_v1 limits_py = GetMemoryLimits_v1() @@ -33906,6 +36314,17 @@ cpdef object device_get_memory_limits_v1(intptr_t device): cpdef object device_get_gpu_fabric_info_v4(intptr_t device): """Retrieves GPU fabric information including per-type clique assignments. + Returns fabric clique data via ``nvmlGpuFabricInfo_v4_t``. Each entry in the + ``cliques`` array is a (type, id) pair representing a single clique assignment. + The number of valid entries is given by ``numCliques``. Entries are sorted by + ascending type (NVML_GPU_FABRIC_CLIQUE_TYPE_*), then by ascending clique id + within each type. + On Hopper systems, the driver reports Unicast Pointer and Multicast Pointer + cliques. On Blackwell and Rubin, Unicast Logical Endpoint and Multicast Logical + Endpoint are additionally reported. + \*\*View CUDA Toolkit Documentation for a C++ code example*\*. + For Hopper ™️ or newer fully supported devices. + Args: device (intptr_t): The identifier of the target device. @@ -33926,6 +36345,8 @@ cpdef object device_get_gpu_fabric_info_v4(intptr_t device): cpdef object device_perf_metrics_get_samples_v1(intptr_t device): """Get Performance Metric samples. + See ``nvmlPerfMetricsSamples_v1_t`` for more information on the struct. + Args: device (intptr_t): The identifier of the target device. @@ -33946,6 +36367,8 @@ cpdef object device_perf_metrics_get_samples_v1(intptr_t device): cpdef object device_set_nvlink_bw_mode_async_v1(intptr_t device): """Set the NvLink Reduced Bandwidth Mode asynchronously for the device. Polling should be done by checking for ``NVML_GPU_FABRIC_STATE_COMPLETED`` from :func:`device_get_gpu_fabric_info_v`. + RUBIN_OR_NEWER%. + Args: device (intptr_t): The identifier of the target device. @@ -33966,6 +36389,12 @@ cpdef object device_set_nvlink_bw_mode_async_v1(intptr_t device): cpdef object device_get_nv_link_telemetry_samples_v1(intptr_t device): """Retrieve a batch of historical NVLink per-link telemetry samples. + Samples are taken at approximately 100 ms intervals. Intended for use with + periodic polling every ~2 seconds. Longer polling intervals are possible, but + can result in dropped samples if the supported ``sampleCount`` is too low for + the given polling interval. + RUBIN_OR_NEWER%. + Args: device (intptr_t): The device handle of the GPU to retrieve samples for. @@ -33984,32 +36413,55 @@ cpdef object device_get_nv_link_telemetry_samples_v1(intptr_t device): return samples_py -cpdef event_set_register_gpu_operational_events_v1(intptr_t event_set, intptr_t config): +cpdef event_set_register_gpu_operational_events_v1(intptr_t event_set, config): """Adds a GPU Operational Event subscription to an event set. + This API is separate from ``nvmlDeviceRegisterEvents``. Calling this API opts + the event set into the structured GPU Operational Event format for the target + GPU UUID. Subscriptions are identified by ``config``; registering the same + subscription more than once is treated as success. + ``nvmlDeviceRegisterEvents`` and + ``nvmlEventSetRegisterGpuOperationalEvents_v1`` may both be used on the same + event set. In that mixed-subscription model, NVML event-bit subscriptions + continue to deliver event bits such as ``nvmlEventTypeXidCriticalError``, while + GPU Operational Event subscriptions deliver + ``NVML_EVENT_DATA_TYPE_GPU_OPERATIONAL_EVENT`` records through + ``nvmlEventSetWait_v3`` with ``eventType`` set to ``nvmlEventTypeNone``. The + same underlying incident may generate both an NVML event-bit notification and a + structured notification. + This API supports GPU UUID subscriptions. + For Turing ™️ or newer fully supported devices. + For Linux only. + Args: - event_set (intptr_t): Event set created by - ``nvmlEventSetCreate``. + event_set (intptr_t): Event set created by ``nvmlEventSetCreate``. config (intptr_t): GPU Operational Event subscription configuration. .. seealso:: `nvmlEventSetRegisterGpuOperationalEvents_v1` """ + cdef intptr_t _config_ptr_ = int(config) with nogil: - __status__ = nvmlEventSetRegisterGpuOperationalEvents_v1(event_set, config) + __status__ = nvmlEventSetRegisterGpuOperationalEvents_v1(event_set, _config_ptr_) check_status(__status__) cpdef object event_set_get_context_count_v1(intptr_t set): """Gets the number of context records for the most recent event returned by ``nvmlEventSetWait_v3`` on this event set. + This count is tied to the event set, not to a caller-owned copy of + ``nvmlEventSetWait_v3_t``. It is replaced by the next successful call to + ``nvmlEventSetWait_v3`` on the same event set. + For Turing ™️ or newer fully supported devices. + For Linux only. + Args: set (intptr_t): Event set previously used with ``nvmlEventSetWait_v3``. Returns: - nvmlEventSetGetContextCount_v1_t: Parameters in which to - return the number of context records. + nvmlEventSetGetContextCount_v1_t: Parameters in which to return + the number of context records. .. seealso:: `nvmlEventSetGetContextCount_v1` """ @@ -34024,6 +36476,8 @@ cpdef object event_set_get_context_count_v1(intptr_t set): cpdef object device_get_bank_remapper_status_v1(intptr_t device): """Get bank remapper status. + RUBIN_OR_NEWER%. + Args: device (intptr_t): The identifier of the target device. @@ -34041,28 +36495,6 @@ cpdef object device_get_bank_remapper_status_v1(intptr_t device): return p_bank_remapper_status_py -cpdef object system_get_topology_gpu_set(unsigned int cpuNumber): - """Retrieve the set of GPUs that have a CPU affinity with the given CPU number - - Args: - cpuNumber (unsigned int): The CPU number - - Returns: - array: An array of device handles for GPUs found with affinity to cpuNumber - """ - cdef unsigned int[1] count = [0] - with nogil: - __status__ = nvmlSystemGetTopologyGpuSet(cpuNumber, count, NULL) - check_status_size(__status__) - if count[0] == 0: - return view.array(shape=(1,), itemsize=sizeof(intptr_t), format="P", mode="c")[:0] - cdef view.array deviceArray = view.array(shape=(count[0],), itemsize=sizeof(intptr_t), format="P", mode="c") - with nogil: - __status__ = nvmlSystemGetTopologyGpuSet(cpuNumber, count, deviceArray.data) - check_status(__status__) - return deviceArray - - cpdef str system_get_driver_branch(): """Retrieves the driver branch of the NVIDIA driver installed on the system. @@ -34081,61 +36513,6 @@ cpdef str system_get_driver_branch(): return cpython.PyUnicode_FromString(info.branch) -cpdef object unit_get_devices(intptr_t unit): - """Retrieves the set of GPU devices that are attached to the specified unit. - - Args: - unit (Unit): The identifier of the target unit. - - Returns: - array: An array of device handles for GPUs attached to the unit. - """ - cdef unsigned int[1] deviceCount = [0] - with nogil: - __status__ = nvmlUnitGetDevices(unit, deviceCount, NULL) - check_status_size(__status__) - if deviceCount[0] == 0: - return view.array(shape=(1,), itemsize=sizeof(intptr_t), format="P", mode="c")[:0] - cdef view.array deviceArray = view.array(shape=(deviceCount[0],), itemsize=sizeof(intptr_t), format="P", mode="c") - with nogil: - __status__ = nvmlUnitGetDevices(unit, deviceCount, deviceArray.data) - check_status(__status__) - return deviceArray - - -cpdef object device_get_topology_nearest_gpus(intptr_t device, unsigned int level): - """Retrieve the set of GPUs that are nearest to a given device at a specific interconnectivity level - - Args: - device (Device): The identifier of the first device - level (GpuTopologyLevel): The level to search for other GPUs - - Returns: - array: An array of device handles for GPUs found at level - """ - cdef unsigned int[1] count = [0] - with nogil: - __status__ = nvmlDeviceGetTopologyNearestGpus( - device, - level, - count, - NULL - ) - check_status_size(__status__) - if count[0] == 0: - return view.array(shape=(1,), itemsize=sizeof(intptr_t), format="P", mode="c")[:0] - cdef view.array deviceArray = view.array(shape=(count[0],), itemsize=sizeof(intptr_t), format="P", mode="c") - with nogil: - __status__ = nvmlDeviceGetTopologyNearestGpus( - device, - level, - count, - deviceArray.data - ) - check_status(__status__) - return deviceArray - - cpdef int device_get_temperature_v(intptr_t device, nvmlTemperatureSensors_t sensorType): """Retrieves the current temperature readings (in degrees C) for the given device. @@ -34210,58 +36587,6 @@ cpdef object device_get_running_process_detail_list(intptr_t device, unsigned in return plist -cpdef tuple device_get_samples(intptr_t device, int type, unsigned long long last_seen_time_stamp): - """Gets recent samples for the GPU. - - Args: - device (intptr_t): The identifier for the target device. - type (SamplingType): Type of sampling event. - last_seen_time_stamp (unsigned long long): Return only samples with timestamp greater than last_seen_time_stamp. - - .. seealso:: `nvmlDeviceGetSamples` - """ - cdef unsigned int[1] sample_count = [0] - cdef unsigned int[1] sample_val_type = [0] - with nogil: - __status__ = nvmlDeviceGetSamples(device, <_SamplingType>type, last_seen_time_stamp, <_ValueType*>sample_val_type, sample_count, NULL) - check_status_size(__status__) - cdef Sample samples = Sample(sample_count[0]) - cdef nvmlSample_t *samples_ptr = samples._get_ptr() - if sample_count[0] == 0: - return samples - with nogil: - __status__ = nvmlDeviceGetSamples(device, <_SamplingType>type, last_seen_time_stamp, <_ValueType*>sample_val_type, sample_count, samples_ptr) - check_status(__status__) - return (sample_val_type[0], samples) - - -cpdef tuple device_get_retired_pages_v2(intptr_t device, int cause): - """Returns the list of retired pages by source, including pages that are pending retirement - - Args: - device (Device): The identifier of the target device. - cause (PageRetirementCause): Filter page addresses by cause of retirement. - - Returns: - tuple: A tuple of two arrays (addresses, timestamps). - """ - cdef unsigned int[1] page_count = [0] - with nogil: - __status__ = nvmlDeviceGetRetiredPages_v2(device, <_PageRetirementCause>cause, page_count, NULL, NULL) - check_status_size(__status__) - if page_count[0] == 0: - return ( - view.array(shape=(1,), itemsize=sizeof(unsigned long long), format="Q", mode="c")[:0], - view.array(shape=(1,), itemsize=sizeof(unsigned long long), format="Q", mode="c")[:0] - ) - cdef view.array addresses = view.array(shape=(page_count[0],), itemsize=sizeof(unsigned long long), format="Q", mode="c") - cdef view.array timestamps = view.array(shape=(page_count[0],), itemsize=sizeof(unsigned long long), format="Q", mode="c") - with nogil: - __status__ = nvmlDeviceGetRetiredPages_v2(device, <_PageRetirementCause>cause, page_count, addresses.data, timestamps.data) - check_status(__status__) - return (addresses, timestamps) - - cpdef object device_get_processes_utilization_info(intptr_t device, unsigned long long last_seen_time_stamp): """Retrieves the recent utilization and process ID for all running processes @@ -34405,90 +36730,6 @@ cpdef device_clear_field_values(intptr_t device, values): check_status(__status__) -cpdef object device_get_supported_vgpus(intptr_t device): - """Retrieve the supported vGPU types on a physical GPU (device). - - Args: - device (Device): The identifier of the target device. - - Returns: - array: An array of supported vGPU type IDs. - """ - cdef unsigned int[1] vgpuCount = [0] - with nogil: - __status__ = nvmlDeviceGetSupportedVgpus(device, vgpuCount, NULL) - check_status_size(__status__) - if vgpuCount[0] == 0: - return view.array(shape=(1,), itemsize=sizeof(unsigned int), format="I", mode="c")[:0] - cdef view.array vgpuTypeIds = view.array(shape=(deviceCount[0],), itemsize=sizeof(unsigned int), format="I", mode="c") - with nogil: - __status__ = nvmlDeviceGetSupportedVgpus(device, vgpuCount, vgpuTypeIds.data) - check_status(__status__) - return vgpuTypeIds - - -cpdef object device_get_creatable_vgpus(intptr_t device): - """Retrieve the currently creatable vGPU types on a physical GPU (device). - - Args: - device (Device): The identifier of the target device. - - Returns: - array: An array of createable vGPU type IDs. - """ - cdef unsigned int[1] vgpuCount = [0] - with nogil: - __status__ = nvmlDeviceGetCreatableVgpus(device, vgpuCount, NULL) - check_status_size(__status__) - if vgpuCount[0] == 0: - return view.array(shape=(1,), itemsize=sizeof(unsigned int), format="I", mode="c")[:0] - cdef view.array vgpuTypeIds = view.array(shape=(deviceCount[0],), itemsize=sizeof(unsigned int), format="I", mode="c") - with nogil: - __status__ = nvmlDeviceGetCreatableVgpus(device, vgpuCount, vgpuTypeIds.data) - check_status(__status__) - return vgpuTypeIds - - -cpdef object device_get_active_vgpus(intptr_t device): - """Retrieve the active vGPU instances on a device. - - Args: - device (Device): The identifier of the target device. - - Returns: - array: An array of active vGPU instance IDs. - """ - cdef unsigned int[1] vgpuCount = [0] - with nogil: - __status__ = nvmlDeviceGetActiveVgpus(device, vgpuCount, NULL) - check_status_size(__status__) - if vgpuCount[0] == 0: - return view.array(shape=(1,), itemsize=sizeof(unsigned int), format="I", mode="c")[:0] - cdef view.array vgpuInstances = view.array(shape=(deviceCount[0],), itemsize=sizeof(unsigned int), format="I", mode="c") - with nogil: - __status__ = nvmlDeviceGetActiveVgpus(device, vgpuCount, vgpuInstances.data) - check_status(__status__) - return vgpuInstances - - -cpdef tuple vgpu_instance_get_vm_id(unsigned int vgpu_instance): - """Retrieve the VM ID associated with a vGPU instance. - - Args: - vgpu_instance (unsigned int): The identifier of the target vGPU instance. - - Returns: - tuple[str, VgpuVmIdType]: A tuple of (id, id_type). - """ - cdef unsigned int size = 80 - cdef char[80] vmId - cdef nvmlVgpuVmIdType_t[1] vmIdType - with nogil: - __status__ = nvmlVgpuInstanceGetVmID(vgpu_instance, vmId, size, vmIdType) - check_status(__status__) - return (cpython.PyUnicode_FromString(vmId), vmIdType[0]) - - cpdef object gpu_instance_get_creatable_vgpus(intptr_t gpu_instance): """Query the currently creatable vGPU types on a specific GPU Instance. @@ -34696,24 +36937,6 @@ cpdef object get_vgpu_compatibility(VgpuMetadata vgpu_metadata, VgpuPgpuMetadata return compatibilityInfo -cpdef tuple get_vgpu_version(): - """Query the ranges of supported vGPU versions. - - Returns: - tuple: A tuple of (VgpuVersion supported, VgpuVersion current). - """ - cdef VgpuVersion supported = VgpuVersion() - cdef nvmlVgpuVersion_t *supported_ptr = supported._get_ptr() - cdef VgpuVersion current = VgpuVersion() - cdef nvmlVgpuVersion_t *current_ptr = current._get_ptr() - - with nogil: - __status__ = nvmlGetVgpuVersion(supported_ptr, current_ptr) - - check_status(__status__) - return (supported, current) - - cpdef object device_get_vgpu_instances_utilization_info(intptr_t device): """ Retrieves recent utilization for vGPU instances running on a physical GPU (device). @@ -34781,58 +37004,6 @@ cpdef object device_get_vgpu_processes_utilization_info(intptr_t device, unsigne return vgpuProcUtilInfo -cpdef object device_get_gpu_instances(intptr_t device, unsigned int profile_id): - """Get GPU instances for given profile ID. - - Args: - device (Device): The identifier of the target device. - profile_id (unsigned int): The GPU instance profile ID. See device_get_gpu_instance_profile_info(). - - Returns: - array: An array of GPU instance handles. - """ - cdef unsigned int[1] count = [0] - with nogil: - __status__ = nvmlDeviceGetGpuInstances(device, profile_id, NULL, count) - check_status_size(__status__) - - if count[0] == 0: - view.array(shape=(1,), itemsize=sizeof(intptr_t), format="P", mode="c")[:0] - - cdef view.array gpuInstances = view.array(shape=(count[0],), itemsize=sizeof(intptr_t), format="P", mode="c") - with nogil: - __status__ = nvmlDeviceGetGpuInstances(device, profile_id, gpuInstances.data, count) - check_status(__status__) - - return gpuInstances - - -cpdef object gpu_instance_get_compute_instances(intptr_t gpu_instance, unsigned int profile_id): - """Get Compute instances for given profile ID. - - Args: - gpu_instance (GpuInstance): The identifier of the target GPU Instance. - profile_id (unsigned int): The Compute instance profile ID. - - Returns: - array: An array of Compute instance handles. - """ - cdef unsigned int[1] count = [0] - with nogil: - __status__ = nvmlGpuInstanceGetComputeInstances(gpu_instance, profile_id, NULL, count) - check_status_size(__status__) - - if count[0] == 0: - view.array(shape=(1,), itemsize=sizeof(intptr_t), format="P", mode="c")[:0] - - cdef view.array computeInstances = view.array(shape=(count[0],), itemsize=sizeof(intptr_t), format="P", mode="c") - with nogil: - __status__ = nvmlGpuInstanceGetComputeInstances(gpu_instance, profile_id, computeInstances.data, count) - check_status(__status__) - - return computeInstances - - cpdef object device_get_sram_unique_uncorrected_ecc_error_counts(intptr_t device): """Retrieves the counts of SRAM unique uncorrected ECC errors @@ -35265,6 +37436,74 @@ cpdef object device_get_gpu_instance_profile_info_v(intptr_t device, unsigned in return info_py +cpdef object device_get_gpu_instances(intptr_t device, unsigned int profile_id): + """Get GPU instances for given profile ID. + + Unlike most array-returning MIG APIs, ``nvmlDeviceGetGpuInstances`` does + not accept a NULL buffer to discover the count; use the number of possible + placements for the profile as a safe upper bound. + + Args: + device (intptr_t): The identifier of the target device. + profile_id (unsigned int): The GPU instance profile ID. See + ``nvmlDeviceGetGpuInstanceProfileInfo``. + + Returns: + list[intptr_t]: Returns pre-existing GPU instances for the given + profile. + + .. seealso:: `nvmlDeviceGetGpuInstances` + """ + cdef unsigned int[1] count = [0] + with nogil: + __status__ = nvmlDeviceGetGpuInstancePossiblePlacements_v2( + device, profile_id, NULL, count + ) + check_status(__status__) + cdef unsigned int capacity = count[0] + cdef _cyb_view.array _gpu_instances_alloc_ = _cyb_view.array(shape=(max(capacity, 1),), itemsize=sizeof(intptr_t), format="q", mode="c") + cdef intptr_t *gpu_instances_ptr = (_gpu_instances_alloc_.data) + if capacity != 0: + with nogil: + __status__ = nvmlDeviceGetGpuInstances(device, profile_id, gpu_instances_ptr, count) + check_status(__status__) + return _gpu_instances_alloc_[:count[0]] + + +cpdef object gpu_instance_get_compute_instances(intptr_t gpu_instance, unsigned int profile_id): + """Get compute instances for given profile ID. + + Unlike most array-returning MIG APIs, ``nvmlGpuInstanceGetComputeInstances`` + does not accept a NULL buffer to discover the count; use the number of + possible placements for the profile as a safe upper bound. + + Args: + gpu_instance (intptr_t): The identifier of the target GPU instance. + profile_id (unsigned int): The compute instance profile ID. See + ``nvmlGpuInstanceGetComputeInstanceProfileInfo``. + + Returns: + list[intptr_t]: Returns pre-existing compute instances for the given + profile. + + .. seealso:: `nvmlGpuInstanceGetComputeInstances` + """ + cdef unsigned int[1] count = [0] + with nogil: + __status__ = nvmlGpuInstanceGetComputeInstancePossiblePlacements( + gpu_instance, profile_id, NULL, count + ) + check_status(__status__) + cdef unsigned int capacity = count[0] + cdef _cyb_view.array _compute_instances_alloc_ = _cyb_view.array(shape=(max(capacity, 1),), itemsize=sizeof(intptr_t), format="q", mode="c") + cdef intptr_t *compute_instances_ptr = (_compute_instances_alloc_.data) + if capacity != 0: + with nogil: + __status__ = nvmlGpuInstanceGetComputeInstances(gpu_instance, profile_id, compute_instances_ptr, count) + check_status(__status__) + return _compute_instances_alloc_[:count[0]] + + cpdef intptr_t device_get_handle_by_uuidv(int type, bytes uuid) except? 0: """Acquire the handle for a particular device, based on its globally unique immutable UUID (in either ASCII or binary format) associated with each device. See ``nvmlUUID_v1_t`` for more information on the UUID struct. The caller must set the appropriate version prior to calling this API. @@ -35430,55 +37669,6 @@ cpdef gpu_instance_set_vgpu_heterogeneous_mode(intptr_t gpu_instance, unsigned i check_status(__status__) -cpdef tuple device_get_vgpu_utilization(intptr_t device, unsigned long long last_seen_time_stamp): - """Retrieves current utilization for vGPUs on a physical GPU (device). - - Args: - device (intptr_t): The identifier for the target device. - last_seen_time_stamp (unsigned long long): Return only samples with timestamp greater than last_seen_time_stamp. - - Returns: - A 2-tuple containing: - - - samples: Returned sample values. - - utilizationSamples: Utilization samples. - - .. seealso:: `nvmlDeviceGetVgpuUtilization` - """ - cdef unsigned int vgpu_instance_samples_count - with nogil: - __status__ = nvmlDeviceGetVgpuUtilization( - device, - last_seen_time_stamp, - NULL, - &vgpu_instance_samples_count, - NULL - ) - check_status_size(__status__) - - if vgpu_instance_samples_count == 0: - return ( - view.array(shape=(1,), itemsize=sizeof(int), format="I", mode="c")[:0], - VgpuInstanceUtilizationSample(0) - ) - - cdef view.array arr = view.array(shape=(vgpu_instance_samples_count,), itemsize=sizeof(int), format="I", mode="c") - cdef VgpuInstanceUtilizationSample utilization_samples_py = VgpuInstanceUtilizationSample(vgpu_instance_samples_count) - cdef nvmlVgpuInstanceUtilizationSample_t *ptr = utilization_samples_py._get_ptr() - - with nogil: - __status__ = nvmlDeviceGetVgpuUtilization( - device, - last_seen_time_stamp, - arr.data, - &vgpu_instance_samples_count, - ptr - ) - check_status(__status__) - - return (arr, utilization_samples_py) - - cpdef object device_read_prm_counters_v1(intptr_t device, PRMCounter_v1 counters): """Read a list of GPU PRM Counters. diff --git a/cuda_bindings/cuda/bindings/nvrtc.pxd b/cuda_bindings/cuda/bindings/nvrtc.pxd index 2e7ca2b505a..247992ac87d 100644 --- a/cuda_bindings/cuda/bindings/nvrtc.pxd +++ b/cuda_bindings/cuda/bindings/nvrtc.pxd @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 # This code was automatically generated with version 13.4.1. Do not modify it directly. -# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=ba23f6c3908c2fa6496002f8def30ec166cec8643e4de22c1741040b2c4b2965 +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=7b6ce83d58b42aae0455e262bb73a1c97c41e08e4ed6c8ec7dfb74e3cc754202 cimport cuda.bindings.cynvrtc as cynvrtc include "_lib/utils.pxd" @@ -57,5 +57,6 @@ cdef class nvrtcBundledHeadersInfo: getPtr() Get memory address of class instance """ + cdef object _owner cdef cynvrtc.nvrtcBundledHeadersInfo _pvt_val cdef cynvrtc.nvrtcBundledHeadersInfo* _pvt_ptr diff --git a/cuda_bindings/cuda/bindings/nvvm.pyx b/cuda_bindings/cuda/bindings/nvvm.pyx index cff0b446a52..e1d0bb39087 100644 --- a/cuda_bindings/cuda/bindings/nvvm.pyx +++ b/cuda_bindings/cuda/bindings/nvvm.pyx @@ -3,7 +3,7 @@ # SPDX-License-Identifier: Apache-2.0 # # This code was automatically generated across versions from 12.0.1 to 13.4.1. Do not modify it directly. -# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=37902d13a165dba391225d644f9ee67747150ede2f719ea5e0870618f6db50ec +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=92a06aa55bccfabc1d5bb1216489bb147dfb71d6e628480128fee207b8f3794f # <<<< PREAMBLE CONTENT >>>> @@ -20,7 +20,9 @@ cdef intptr_t _cyb_get_buffer_pointer(buf, Py_ssize_t size, readonly=True) excep flags |= _cyb_cpython.PyBUF_WRITABLE cdef int status = -1 cdef _cyb_cpython.Py_buffer view - if isinstance(buf, int): + if buf is None: + ptr = 0 + elif isinstance(buf, int): ptr = buf else: try: @@ -31,7 +33,7 @@ cdef intptr_t _cyb_get_buffer_pointer(buf, Py_ssize_t size, readonly=True) excep except Exception as e: adj = "writable " if not readonly else "" raise ValueError( - "buf must be either a Python int representing the pointer " + "buf must be None, a Python int representing the pointer " f"address to a valid buffer, or a 1D contiguous {adj}" f"buffer, of size {size}" ) from e @@ -119,6 +121,7 @@ cpdef destroy_program(intptr_t prog): cpdef str get_error_string(int result): """Get the message string for the given ``nvvmResult`` code. + Args: result (Result): NVVM API result code. @@ -135,9 +138,9 @@ cpdef str get_error_string(int result): cpdef tuple version(): """Get the NVVM version. + Returns: A 2-tuple containing: - - int: NVVM major version number. - int: NVVM minor version number. @@ -154,9 +157,9 @@ cpdef tuple version(): cpdef tuple ir_version(): """Get the NVVM IR version. + Returns: A 4-tuple containing: - - int: NVVM IR major version number. - int: NVVM IR minor version number. - int: NVVM IR debug metadata major version number. @@ -177,6 +180,7 @@ cpdef tuple ir_version(): cpdef intptr_t create_program() except? 0: """Create a program, and set the value of its handle to ``*prog``. + Returns: intptr_t: NVVM program. @@ -192,13 +196,18 @@ cpdef intptr_t create_program() except? 0: cpdef add_module_to_program(intptr_t prog, buffer, size_t size, name): """Add a module level NVVM IR to a program. + The ``buffer`` should contain an NVVM IR module. The module should have NVVM IR + either in the LLVM 7.0.1 bitcode representation or in the LLVM 7.0.1 text + representation. Support for reading the text representation of NVVM IR is + deprecated and may be removed in a later version. + Args: prog (intptr_t): NVVM program. buffer (bytes): NVVM IR module in the bitcode or text representation. size (size_t): Size of the NVVM IR module. - name (str): Name of the NVVM IR module. If NULL, "" - is used as the name. + name (str): Name of the NVVM IR module. If NULL, "" is + used as the name. .. seealso:: `nvvmAddModuleToProgram` """ @@ -215,12 +224,22 @@ cpdef add_module_to_program(intptr_t prog, buffer, size_t size, name): cpdef lazy_add_module_to_program(intptr_t prog, buffer, size_t size, name): """Add a module level NVVM IR to a program. + The ``buffer`` should contain an NVVM IR module. The module should have NVVM IR + in the LLVM 7.0.1 bitcode representation. + A module added using this API is lazily loaded - the only symbols loaded are + those that are required by module(s) loaded using nvvmAddModuleToProgram. It is + an error for a program to have all modules loaded using this API. Compiler may + also optimize entities in this module by making them internal to the linked + NVVM IR module, making them eligible for other optimizations. Due to these + optimizations, this API to load a module is more efficient and should be used + where possible. + Args: prog (intptr_t): NVVM program. buffer (bytes): NVVM IR module in the bitcode representation. size (size_t): Size of the NVVM IR module. - name (str): Name of the NVVM IR module. If NULL, "" - is used as the name. + name (str): Name of the NVVM IR module. If NULL, "" is + used as the name. .. seealso:: `nvvmLazyAddModuleToProgram` """ @@ -237,18 +256,81 @@ cpdef lazy_add_module_to_program(intptr_t prog, buffer, size_t size, name): cpdef compile_program(intptr_t prog, int num_options, options): """Compile the NVVM program. + The NVVM IR modules in the program will be linked at the IR level. The linked + IR program is compiled to PTX. + The target datalayout in the linked IR program is used to determine the address + size (32bit vs 64bit). + The valid compiler options are:. + + - -g (enable generation of full debugging information). Full debug support is + only valid with '-opt=0'. Debug support requires the input module to utilize + NVVM IR Debug Metadata. Line number (line info) only generation is also + enabled via NVVM IR Debug Metadata, there is no specific libNVVM API flag for + that case. + - -opt=. + - 0 (disable optimizations). + - 3 (default, enable optimizations). + - -arch=. + - compute_75 (default). + - compute_80. + - compute_87. + - compute_89. + - compute_90. + - compute_90a. + - compute_100. + - compute_100a. + - compute_100f. + - compute_103. + - compute_103a. + - compute_103f. + - compute_110. + - compute_110a. + - compute_110f. + - compute_120. + - compute_120a. + - compute_120f. + - compute_121. + - compute_121a. + - compute_121f. + - -ftz=. + - 0 (default, preserve denormal values, when performing single-precision + floating-point operations). + - 1 (flush denormal values to zero, when performing single-precision + floating-point operations). + - -prec-sqrt=. + - 0 (use a faster approximation for single-precision floating-point square + root). + - 1 (default, use IEEE round-to-nearest mode for single-precision floating- + point square root). + - -prec-div=. + - 0 (use a faster approximation for single-precision floating-point division + and reciprocals). + - 1 (default, use IEEE round-to-nearest mode for single-precision floating- + point division and reciprocals). + - -fma=. + - 0 (disable FMA contraction). + - 1 (default, enable FMA contraction). + - -jump-table-density=[0-101] Specify the case density percentage in switch + statements, and use it as a minimal threshold to determine whether jump + table(brx.idx instruction) will be used to implement a switch statement. + Default value is 101. The percentage ranges from 0 to 101 inclusively. + - -gen-lto (Generate LTO IR instead of PTX). + - -ptx-version-target=[86-94] Specify the target PTX version as (MAJOR VERSION + \* 10 + MINOR VERSION). This is supported only for Blackwell and later + architectures (compute capability compute_100 or greater). Using this option + implies that the operations in incoming ``prog`` are compliant with targeted + PTX version. If not set, highest available PTX version is used. + Args: prog (intptr_t): NVVM program. num_options (int): Number of compiler ``options`` passed. - options (object): Compiler options in the form of C string - array. It can be: + options (object): Compiler options in the form of C string array. It can be: - an :class:`int` as the pointer address to the nested sequence, or - a Python sequence of :class:`int`\s, each of which is a pointer address to a valid sequence of 'char', or - a nested Python sequence of ``str``. - .. seealso:: `nvvmCompileProgram` """ cdef nested_resource[ char ] _options_ @@ -261,18 +343,19 @@ cpdef compile_program(intptr_t prog, int num_options, options): cpdef verify_program(intptr_t prog, int num_options, options): """Verify the NVVM program. + The valid compiler options are:. + Same as for :func:`compile_program`. + Args: prog (intptr_t): NVVM program. num_options (int): Number of compiler ``options`` passed. - options (object): Compiler options in the form of C string - array. It can be: + options (object): Compiler options in the form of C string array. It can be: - an :class:`int` as the pointer address to the nested sequence, or - a Python sequence of :class:`int`\s, each of which is a pointer address to a valid sequence of 'char', or - a nested Python sequence of ``str``. - .. seealso:: `nvvmVerifyProgram` """ cdef nested_resource[ char ] _options_ @@ -285,12 +368,12 @@ cpdef verify_program(intptr_t prog, int num_options, options): cpdef size_t get_compiled_result_size(intptr_t prog) except? 0: """Get the size of the compiled result. + Args: prog (intptr_t): NVVM program. Returns: - size_t: Size of the compiled result (including the trailing - NULL). + size_t: Size of the compiled result (including the trailing NULL). .. seealso:: `nvvmGetCompiledResultSize` """ @@ -304,6 +387,8 @@ cpdef size_t get_compiled_result_size(intptr_t prog) except? 0: cpdef get_compiled_result(intptr_t prog, buffer): """Get the compiled result. + The result is stored in the memory pointed to by ``buffer``. + Args: prog (intptr_t): NVVM program. buffer (bytes): Compiled result. @@ -319,12 +404,15 @@ cpdef get_compiled_result(intptr_t prog, buffer): cpdef size_t get_program_log_size(intptr_t prog) except? 0: """Get the Size of Compiler/Verifier Message. + The size of the message string (including the trailing NULL) is stored into + ``buffer_size_ret`` when the return value is NVVM_SUCCESS. + Args: prog (intptr_t): NVVM program. Returns: - size_t: Size of the compilation/verification log (including - the trailing NULL). + size_t: Size of the compilation/verification log (including the + trailing NULL). .. seealso:: `nvvmGetProgramLogSize` """ @@ -338,6 +426,9 @@ cpdef size_t get_program_log_size(intptr_t prog) except? 0: cpdef get_program_log(intptr_t prog, buffer): """Get the Compiler/Verifier Message. + The NULL terminated message string is stored in the memory pointed to by + ``buffer`` when the return value is NVVM_SUCCESS. + Args: prog (intptr_t): NVVM program. buffer (bytes): Compilation/Verification log. @@ -353,6 +444,8 @@ cpdef get_program_log(intptr_t prog, buffer): cpdef int llvm_version(arch) except? 0: """Get the LLVM IR version guaranteed to be supported by NVVM. + The valid arch strings are the ones supported by :func:`compile_program`. + Args: arch (str): Architecture string. diff --git a/cuda_bindings/cuda/bindings/runtime.pxd b/cuda_bindings/cuda/bindings/runtime.pxd index 3665c0a1eba..e2c1125c753 100644 --- a/cuda_bindings/cuda/bindings/runtime.pxd +++ b/cuda_bindings/cuda/bindings/runtime.pxd @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 # This code was automatically generated with version 13.4.1. Do not modify it directly. -# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=7449c15b6137a39e8e9c26a3aee810954cead6b88b7c8a768abb9a2bc5875913 +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=9aed2c4f6e06c8af7d8e05b8da369992de701809a2165dc6bd0cc05e135934f5 cimport cuda.bindings.cyruntime as cyruntime include "_lib/utils.pxd" @@ -320,6 +320,7 @@ cdef class dim3: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.dim3 _pvt_val cdef cyruntime.dim3* _pvt_ptr @@ -355,6 +356,7 @@ cdef class cudaChannelFormatDesc: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaChannelFormatDesc _pvt_val cdef cyruntime.cudaChannelFormatDesc* _pvt_ptr @@ -380,6 +382,7 @@ cdef class anon_struct0: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaArraySparseProperties* _pvt_ptr cdef class cudaArraySparseProperties: @@ -410,6 +413,7 @@ cdef class cudaArraySparseProperties: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaArraySparseProperties _pvt_val cdef cyruntime.cudaArraySparseProperties* _pvt_ptr @@ -436,6 +440,7 @@ cdef class cudaArrayMemoryRequirements: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaArrayMemoryRequirements _pvt_val cdef cyruntime.cudaArrayMemoryRequirements* _pvt_ptr @@ -467,6 +472,7 @@ cdef class cudaPitchedPtr: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaPitchedPtr _pvt_val cdef cyruntime.cudaPitchedPtr* _pvt_ptr @@ -498,6 +504,7 @@ cdef class cudaExtent: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaExtent _pvt_val cdef cyruntime.cudaExtent* _pvt_ptr @@ -525,6 +532,7 @@ cdef class cudaPos: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaPos _pvt_val cdef cyruntime.cudaPos* _pvt_ptr @@ -572,6 +580,7 @@ cdef class cudaMemcpy3DParms: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaMemcpy3DParms _pvt_val cdef cyruntime.cudaMemcpy3DParms* _pvt_ptr @@ -621,6 +630,7 @@ cdef class cudaMemcpyNodeParams: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaMemcpyNodeParams _pvt_val cdef cyruntime.cudaMemcpyNodeParams* _pvt_ptr @@ -678,6 +688,7 @@ cdef class cudaMemcpy3DPeerParms: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaMemcpy3DPeerParms _pvt_val cdef cyruntime.cudaMemcpy3DPeerParms* _pvt_ptr @@ -738,6 +749,7 @@ cdef class cudaMemsetParams: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaMemsetParams _pvt_val cdef cyruntime.cudaMemsetParams* _pvt_ptr @@ -785,6 +797,7 @@ cdef class cudaMemsetParamsV2: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaMemsetParamsV2 _pvt_val cdef cyruntime.cudaMemsetParamsV2* _pvt_ptr @@ -837,6 +850,7 @@ cdef class cudaAccessPolicyWindow: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaAccessPolicyWindow _pvt_val cdef cyruntime.cudaAccessPolicyWindow* _pvt_ptr @@ -863,6 +877,7 @@ cdef class cudaHostNodeParams: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaHostNodeParams _pvt_val cdef cyruntime.cudaHostNodeParams* _pvt_ptr @@ -900,6 +915,7 @@ cdef class cudaHostNodeParamsV2: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaHostNodeParamsV2 _pvt_val cdef cyruntime.cudaHostNodeParamsV2* _pvt_ptr @@ -926,6 +942,7 @@ cdef class anon_struct1: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaResourceDesc* _pvt_ptr cdef cudaArray_t _array @@ -945,6 +962,7 @@ cdef class anon_struct2: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaResourceDesc* _pvt_ptr cdef cudaMipmappedArray_t _mipmap @@ -972,6 +990,7 @@ cdef class anon_struct3: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaResourceDesc* _pvt_ptr cdef _HelperInputVoidPtr _cydevPtr @@ -1010,6 +1029,7 @@ cdef class anon_struct4: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaResourceDesc* _pvt_ptr cdef _HelperInputVoidPtr _cydevPtr @@ -1025,6 +1045,7 @@ cdef class anon_struct5: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaResourceDesc* _pvt_ptr cdef class anon_union0: @@ -1053,6 +1074,7 @@ cdef class anon_union0: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaResourceDesc* _pvt_ptr cdef anon_struct1 _array @@ -1091,6 +1113,7 @@ cdef class cudaResourceDesc: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaResourceDesc* _val_ptr cdef cyruntime.cudaResourceDesc* _pvt_ptr @@ -1141,6 +1164,7 @@ cdef class cudaResourceViewDesc: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaResourceViewDesc _pvt_val cdef cyruntime.cudaResourceViewDesc* _pvt_ptr @@ -1187,6 +1211,7 @@ cdef class cudaPointerAttributes: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaPointerAttributes* _val_ptr cdef cyruntime.cudaPointerAttributes* _pvt_ptr @@ -1325,6 +1350,7 @@ cdef class cudaFuncAttributes: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaFuncAttributes _pvt_val cdef cyruntime.cudaFuncAttributes* _pvt_ptr @@ -1346,6 +1372,7 @@ cdef class anon_struct6: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaMemLocation* _pvt_ptr cdef class cudaMemLocation: @@ -1378,6 +1405,7 @@ cdef class cudaMemLocation: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaMemLocation* _val_ptr cdef cyruntime.cudaMemLocation* _pvt_ptr @@ -1404,6 +1432,7 @@ cdef class cudaMemAccessDesc: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaMemAccessDesc _pvt_val cdef cyruntime.cudaMemAccessDesc* _pvt_ptr @@ -1452,6 +1481,7 @@ cdef class cudaMemPoolProps: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaMemPoolProps _pvt_val cdef cyruntime.cudaMemPoolProps* _pvt_ptr @@ -1470,6 +1500,7 @@ cdef class cudaMemPoolPtrExportData: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaMemPoolPtrExportData _pvt_val cdef cyruntime.cudaMemPoolPtrExportData* _pvt_ptr @@ -1509,6 +1540,7 @@ cdef class cudaMemAllocNodeParams: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaMemAllocNodeParams _pvt_val cdef cyruntime.cudaMemAllocNodeParams* _pvt_ptr @@ -1558,6 +1590,7 @@ cdef class cudaMemAllocNodeParamsV2: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaMemAllocNodeParamsV2 _pvt_val cdef cyruntime.cudaMemAllocNodeParamsV2* _pvt_ptr @@ -1587,6 +1620,7 @@ cdef class cudaMemFreeNodeParams: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaMemFreeNodeParams _pvt_val cdef cyruntime.cudaMemFreeNodeParams* _pvt_ptr @@ -1626,6 +1660,7 @@ cdef class cudaMemcpyAttributes: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaMemcpyAttributes _pvt_val cdef cyruntime.cudaMemcpyAttributes* _pvt_ptr @@ -1659,6 +1694,7 @@ cdef class cudaOffset3D: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaOffset3D _pvt_val cdef cyruntime.cudaOffset3D* _pvt_ptr @@ -1688,6 +1724,7 @@ cdef class anon_struct7: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaMemcpy3DOperand* _pvt_ptr cdef _HelperInputVoidPtr _cyptr @@ -1714,6 +1751,7 @@ cdef class anon_struct8: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaMemcpy3DOperand* _pvt_ptr cdef cudaArray_t _array @@ -1740,6 +1778,7 @@ cdef class anon_union3: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaMemcpy3DOperand* _pvt_ptr cdef anon_struct7 _ptr @@ -1768,6 +1807,7 @@ cdef class cudaMemcpy3DOperand: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaMemcpy3DOperand* _val_ptr cdef cyruntime.cudaMemcpy3DOperand* _pvt_ptr @@ -1805,6 +1845,7 @@ cdef class cudaMemcpy3DBatchOp: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaMemcpy3DBatchOp _pvt_val cdef cyruntime.cudaMemcpy3DBatchOp* _pvt_ptr @@ -1831,6 +1872,7 @@ cdef class CUuuid_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.CUuuid_st _pvt_val cdef cyruntime.CUuuid_st* _pvt_ptr @@ -2237,6 +2279,7 @@ cdef class cudaDeviceProp: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaDeviceProp _pvt_val cdef cyruntime.cudaDeviceProp* _pvt_ptr @@ -2252,6 +2295,7 @@ cdef class cudaIpcEventHandle_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaIpcEventHandle_st _pvt_val cdef cyruntime.cudaIpcEventHandle_st* _pvt_ptr @@ -2264,6 +2308,7 @@ cdef class cudaIpcMemHandle_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaIpcMemHandle_st _pvt_val cdef cyruntime.cudaIpcMemHandle_st* _pvt_ptr @@ -2274,6 +2319,7 @@ cdef class cudaMemFabricHandle_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaMemFabricHandle_st _pvt_val cdef cyruntime.cudaMemFabricHandle_st* _pvt_ptr @@ -2295,6 +2341,7 @@ cdef class anon_struct9: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaExternalMemoryHandleDesc* _pvt_ptr cdef _HelperInputVoidPtr _cyhandle @@ -2325,6 +2372,7 @@ cdef class anon_union4: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaExternalMemoryHandleDesc* _pvt_ptr cdef anon_struct9 _win32 @@ -2361,6 +2409,7 @@ cdef class cudaExternalMemoryHandleDesc: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaExternalMemoryHandleDesc* _val_ptr cdef cyruntime.cudaExternalMemoryHandleDesc* _pvt_ptr @@ -2391,6 +2440,7 @@ cdef class cudaExternalMemoryBufferDesc: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaExternalMemoryBufferDesc _pvt_val cdef cyruntime.cudaExternalMemoryBufferDesc* _pvt_ptr @@ -2428,6 +2478,7 @@ cdef class cudaExternalMemoryMipmappedArrayDesc: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaExternalMemoryMipmappedArrayDesc _pvt_val cdef cyruntime.cudaExternalMemoryMipmappedArrayDesc* _pvt_ptr @@ -2455,6 +2506,7 @@ cdef class anon_struct10: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaExternalSemaphoreHandleDesc* _pvt_ptr cdef _HelperInputVoidPtr _cyhandle @@ -2485,6 +2537,7 @@ cdef class anon_union5: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaExternalSemaphoreHandleDesc* _pvt_ptr cdef anon_struct10 _win32 @@ -2517,6 +2570,7 @@ cdef class cudaExternalSemaphoreHandleDesc: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaExternalSemaphoreHandleDesc* _val_ptr cdef cyruntime.cudaExternalSemaphoreHandleDesc* _pvt_ptr @@ -2537,6 +2591,7 @@ cdef class anon_struct11: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaExternalSemaphoreSignalParams* _pvt_ptr cdef class anon_union6: @@ -2553,6 +2608,7 @@ cdef class anon_union6: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaExternalSemaphoreSignalParams* _pvt_ptr cdef _HelperInputVoidPtr _cyfence @@ -2572,6 +2628,7 @@ cdef class anon_struct12: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaExternalSemaphoreSignalParams* _pvt_ptr cdef class anon_struct13: @@ -2596,6 +2653,7 @@ cdef class anon_struct13: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaExternalSemaphoreSignalParams* _pvt_ptr cdef anon_struct11 _fence @@ -2634,6 +2692,7 @@ cdef class cudaExternalSemaphoreSignalParams: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaExternalSemaphoreSignalParams _pvt_val cdef cyruntime.cudaExternalSemaphoreSignalParams* _pvt_ptr @@ -2654,6 +2713,7 @@ cdef class anon_struct14: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaExternalSemaphoreWaitParams* _pvt_ptr cdef class anon_union7: @@ -2670,6 +2730,7 @@ cdef class anon_union7: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaExternalSemaphoreWaitParams* _pvt_ptr cdef _HelperInputVoidPtr _cyfence @@ -2693,6 +2754,7 @@ cdef class anon_struct15: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaExternalSemaphoreWaitParams* _pvt_ptr cdef class anon_struct16: @@ -2717,6 +2779,7 @@ cdef class anon_struct16: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaExternalSemaphoreWaitParams* _pvt_ptr cdef anon_struct14 _fence @@ -2755,6 +2818,7 @@ cdef class cudaExternalSemaphoreWaitParams: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaExternalSemaphoreWaitParams _pvt_val cdef cyruntime.cudaExternalSemaphoreWaitParams* _pvt_ptr @@ -2800,6 +2864,7 @@ cdef class cudaDevSmResource: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaDevSmResource _pvt_val cdef cyruntime.cudaDevSmResource* _pvt_ptr @@ -2827,6 +2892,7 @@ cdef class cudaDevWorkqueueConfigResource: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaDevWorkqueueConfigResource _pvt_val cdef cyruntime.cudaDevWorkqueueConfigResource* _pvt_ptr @@ -2839,6 +2905,7 @@ cdef class cudaDevWorkqueueResource: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaDevWorkqueueResource _pvt_val cdef cyruntime.cudaDevWorkqueueResource* _pvt_ptr @@ -2878,6 +2945,7 @@ cdef class cudaDevSmResourceGroupParams_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaDevSmResourceGroupParams_st _pvt_val cdef cyruntime.cudaDevSmResourceGroupParams_st* _pvt_ptr @@ -2936,6 +3004,7 @@ cdef class cudaDevResource_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaDevResource_st* _val_ptr cdef cyruntime.cudaDevResource_st* _pvt_ptr @@ -2978,6 +3047,7 @@ cdef class cudalibraryHostUniversalFunctionAndDataTable: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudalibraryHostUniversalFunctionAndDataTable _pvt_val cdef cyruntime.cudalibraryHostUniversalFunctionAndDataTable* _pvt_ptr @@ -3023,6 +3093,7 @@ cdef class cudaKernelNodeParams: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaKernelNodeParams _pvt_val cdef cyruntime.cudaKernelNodeParams* _pvt_ptr @@ -3091,6 +3162,7 @@ cdef class cudaKernelNodeParamsV2: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaKernelNodeParamsV2* _val_ptr cdef cyruntime.cudaKernelNodeParamsV2* _pvt_ptr @@ -3140,6 +3212,7 @@ cdef class cudaExternalSemaphoreSignalNodeParams: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaExternalSemaphoreSignalNodeParams _pvt_val cdef cyruntime.cudaExternalSemaphoreSignalNodeParams* _pvt_ptr @@ -3180,6 +3253,7 @@ cdef class cudaExternalSemaphoreSignalNodeParamsV2: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaExternalSemaphoreSignalNodeParamsV2 _pvt_val cdef cyruntime.cudaExternalSemaphoreSignalNodeParamsV2* _pvt_ptr @@ -3219,6 +3293,7 @@ cdef class cudaExternalSemaphoreWaitNodeParams: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaExternalSemaphoreWaitNodeParams _pvt_val cdef cyruntime.cudaExternalSemaphoreWaitNodeParams* _pvt_ptr @@ -3259,6 +3334,7 @@ cdef class cudaExternalSemaphoreWaitNodeParamsV2: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaExternalSemaphoreWaitNodeParamsV2 _pvt_val cdef cyruntime.cudaExternalSemaphoreWaitNodeParamsV2* _pvt_ptr @@ -3323,6 +3399,7 @@ cdef class cudaConditionalNodeParams: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaConditionalNodeParams _pvt_val cdef cyruntime.cudaConditionalNodeParams* _pvt_ptr @@ -3360,6 +3437,7 @@ cdef class cudaChildGraphNodeParams: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaChildGraphNodeParams _pvt_val cdef cyruntime.cudaChildGraphNodeParams* _pvt_ptr @@ -3386,6 +3464,7 @@ cdef class cudaEventRecordNodeParams: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaEventRecordNodeParams _pvt_val cdef cyruntime.cudaEventRecordNodeParams* _pvt_ptr @@ -3411,6 +3490,7 @@ cdef class cudaEventWaitNodeParams: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaEventWaitNodeParams _pvt_val cdef cyruntime.cudaEventWaitNodeParams* _pvt_ptr @@ -3481,6 +3561,7 @@ cdef class cudaGraphNodeParams: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaGraphNodeParams* _val_ptr cdef cyruntime.cudaGraphNodeParams* _pvt_ptr @@ -3562,6 +3643,7 @@ cdef class cudaGraphEdgeData_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaGraphEdgeData_st _pvt_val cdef cyruntime.cudaGraphEdgeData_st* _pvt_ptr @@ -3593,6 +3675,7 @@ cdef class cudaGraphInstantiateParams_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaGraphInstantiateParams_st _pvt_val cdef cyruntime.cudaGraphInstantiateParams_st* _pvt_ptr @@ -3629,6 +3712,7 @@ cdef class cudaGraphExecUpdateResultInfo_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaGraphExecUpdateResultInfo_st _pvt_val cdef cyruntime.cudaGraphExecUpdateResultInfo_st* _pvt_ptr @@ -3660,6 +3744,7 @@ cdef class anon_struct17: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaGraphKernelNodeUpdate* _pvt_ptr cdef _HelperInputVoidPtr _cypValue @@ -3687,6 +3772,7 @@ cdef class anon_union11: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaGraphKernelNodeUpdate* _pvt_ptr cdef dim3 _gridDim @@ -3721,6 +3807,7 @@ cdef class cudaGraphKernelNodeUpdate: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaGraphKernelNodeUpdate* _val_ptr cdef cyruntime.cudaGraphKernelNodeUpdate* _pvt_ptr @@ -3756,6 +3843,7 @@ cdef class cudaLaunchMemSyncDomainMap_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaLaunchMemSyncDomainMap_st _pvt_val cdef cyruntime.cudaLaunchMemSyncDomainMap_st* _pvt_ptr @@ -3781,6 +3869,7 @@ cdef class anon_struct18: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaLaunchAttributeValue* _pvt_ptr cdef class anon_struct19: @@ -3805,6 +3894,7 @@ cdef class anon_struct19: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaLaunchAttributeValue* _pvt_ptr cdef cudaEvent_t _event @@ -3832,6 +3922,7 @@ cdef class anon_struct20: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaLaunchAttributeValue* _pvt_ptr cdef class anon_struct21: @@ -3852,6 +3943,7 @@ cdef class anon_struct21: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaLaunchAttributeValue* _pvt_ptr cdef cudaEvent_t _event @@ -3875,6 +3967,7 @@ cdef class anon_struct22: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaLaunchAttributeValue* _pvt_ptr cdef cudaGraphDeviceNode_t _devNode @@ -4007,6 +4100,7 @@ cdef class cudaLaunchAttributeValue: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaLaunchAttributeValue _pvt_val cdef cyruntime.cudaLaunchAttributeValue* _pvt_ptr @@ -4051,6 +4145,7 @@ cdef class cudaLaunchAttribute_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaLaunchAttribute_st _pvt_val cdef cyruntime.cudaLaunchAttribute_st* _pvt_ptr @@ -4071,6 +4166,7 @@ cdef class anon_struct23: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaAsyncNotificationInfo* _pvt_ptr cdef class anon_union12: @@ -4087,6 +4183,7 @@ cdef class anon_union12: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaAsyncNotificationInfo* _pvt_ptr cdef anon_struct23 _overBudget @@ -4113,6 +4210,7 @@ cdef class cudaAsyncNotificationInfo: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaAsyncNotificationInfo* _val_ptr cdef cyruntime.cudaAsyncNotificationInfo* _pvt_ptr @@ -4183,6 +4281,7 @@ cdef class cudaTextureDesc: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaTextureDesc _pvt_val cdef cyruntime.cudaTextureDesc* _pvt_ptr @@ -4207,6 +4306,7 @@ cdef class cudaGraphRecaptureCallbackData: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaGraphRecaptureCallbackData _pvt_val cdef cyruntime.cudaGraphRecaptureCallbackData* _pvt_ptr @@ -4253,6 +4353,7 @@ cdef class cudaEglPlaneDesc_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaEglPlaneDesc_st _pvt_val cdef cyruntime.cudaEglPlaneDesc_st* _pvt_ptr @@ -4277,6 +4378,7 @@ cdef class anon_union13: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaEglFrame_st* _pvt_ptr cdef class cudaEglFrame_st: @@ -4318,6 +4420,7 @@ cdef class cudaEglFrame_st: getPtr() Get memory address of class instance """ + cdef object _owner cdef cyruntime.cudaEglFrame_st* _val_ptr cdef cyruntime.cudaEglFrame_st* _pvt_ptr diff --git a/cuda_bindings/cuda/bindings/runtime.pyx b/cuda_bindings/cuda/bindings/runtime.pyx index 4546ed78f45..4c6be9ee02d 100644 --- a/cuda_bindings/cuda/bindings/runtime.pyx +++ b/cuda_bindings/cuda/bindings/runtime.pyx @@ -2,7 +2,7 @@ # SPDX-License-Identifier: Apache-2.0 # This code was automatically generated with version 13.4.1. Do not modify it directly. -# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=144b063e6665a8eda3633307d63f7bd708b343d3f3be6f61e0f39b5890fcc76e +# CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=ea95eb12334cbd4c1bf3fc8e890fb6f9493063b12faea853bb3d8c6288934182 from typing import Any, Optional import cython import ctypes @@ -8024,12 +8024,10 @@ cdef class cudaArraySparseProperties: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._tileExtent = anon_struct0(_ptr=self._pvt_ptr) - + self._tileExtent._owner = self def __dealloc__(self): - pass + self._tileExtent = None def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -8483,30 +8481,24 @@ cdef class cudaMemcpy3DParms: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._srcArray = cudaArray_t(_ptr=&self._pvt_ptr[0].srcArray) - - self._srcPos = cudaPos(_ptr=&self._pvt_ptr[0].srcPos) - - + self._srcPos._owner = self self._srcPtr = cudaPitchedPtr(_ptr=&self._pvt_ptr[0].srcPtr) - - + self._srcPtr._owner = self self._dstArray = cudaArray_t(_ptr=&self._pvt_ptr[0].dstArray) - - self._dstPos = cudaPos(_ptr=&self._pvt_ptr[0].dstPos) - - + self._dstPos._owner = self self._dstPtr = cudaPitchedPtr(_ptr=&self._pvt_ptr[0].dstPtr) - - + self._dstPtr._owner = self self._extent = cudaExtent(_ptr=&self._pvt_ptr[0].extent) - + self._extent._owner = self def __dealloc__(self): - pass + self._srcPos = None + self._srcPtr = None + self._dstPos = None + self._dstPtr = None + self._extent = None def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -8677,15 +8669,11 @@ cdef class cudaMemcpyNodeParams: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._ctx = cudaExecutionContext_t(_ptr=&self._pvt_ptr[0].ctx) - - self._copyParams = cudaMemcpy3DParms(_ptr=&self._pvt_ptr[0].copyParams) - + self._copyParams._owner = self def __dealloc__(self): - pass + self._copyParams = None def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -8800,30 +8788,24 @@ cdef class cudaMemcpy3DPeerParms: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._srcArray = cudaArray_t(_ptr=&self._pvt_ptr[0].srcArray) - - self._srcPos = cudaPos(_ptr=&self._pvt_ptr[0].srcPos) - - + self._srcPos._owner = self self._srcPtr = cudaPitchedPtr(_ptr=&self._pvt_ptr[0].srcPtr) - - + self._srcPtr._owner = self self._dstArray = cudaArray_t(_ptr=&self._pvt_ptr[0].dstArray) - - self._dstPos = cudaPos(_ptr=&self._pvt_ptr[0].dstPos) - - + self._dstPos._owner = self self._dstPtr = cudaPitchedPtr(_ptr=&self._pvt_ptr[0].dstPtr) - - + self._dstPtr._owner = self self._extent = cudaExtent(_ptr=&self._pvt_ptr[0].extent) - + self._extent._owner = self def __dealloc__(self): - pass + self._srcPos = None + self._srcPtr = None + self._dstPos = None + self._dstPtr = None + self._extent = None def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -9163,10 +9145,7 @@ cdef class cudaMemsetParamsV2: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._ctx = cudaExecutionContext_t(_ptr=&self._pvt_ptr[0].ctx) - def __dealloc__(self): pass def getPtr(self): @@ -9444,10 +9423,7 @@ cdef class cudaHostNodeParams: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._fn = cudaHostFn_t(_ptr=&self._pvt_ptr[0].fn) - def __dealloc__(self): pass def getPtr(self): @@ -9531,13 +9507,8 @@ cdef class cudaHostNodeParamsV2: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._fn = cudaHostFn_t(_ptr=&self._pvt_ptr[0].fn) - - self._ctx = cudaExecutionContext_t(_ptr=&self._pvt_ptr[0].ctx) - def __dealloc__(self): pass def getPtr(self): @@ -9642,10 +9613,7 @@ cdef class anon_struct1: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._array = cudaArray_t(_ptr=&self._pvt_ptr[0].res.array.array) - def __dealloc__(self): pass def getPtr(self): @@ -9698,10 +9666,7 @@ cdef class anon_struct2: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._mipmap = cudaMipmappedArray_t(_ptr=&self._pvt_ptr[0].res.mipmap.mipmap) - def __dealloc__(self): pass def getPtr(self): @@ -9762,12 +9727,10 @@ cdef class anon_struct3: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._desc = cudaChannelFormatDesc(_ptr=&self._pvt_ptr[0].res.linear.desc) - + self._desc._owner = self def __dealloc__(self): - pass + self._desc = None def getPtr(self): return &self._pvt_ptr[0].res.linear def __repr__(self): @@ -9854,12 +9817,10 @@ cdef class anon_struct4: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._desc = cudaChannelFormatDesc(_ptr=&self._pvt_ptr[0].res.pitch2D.desc) - + self._desc._owner = self def __dealloc__(self): - pass + self._desc = None def getPtr(self): return &self._pvt_ptr[0].res.pitch2D def __repr__(self): @@ -9994,21 +9955,19 @@ cdef class anon_union0: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._array = anon_struct1(_ptr=self._pvt_ptr) - - + self._array._owner = self self._mipmap = anon_struct2(_ptr=self._pvt_ptr) - - + self._mipmap._owner = self self._linear = anon_struct3(_ptr=self._pvt_ptr) - - + self._linear._owner = self self._pitch2D = anon_struct4(_ptr=self._pvt_ptr) - + self._pitch2D._owner = self def __dealloc__(self): - pass + self._array = None + self._mipmap = None + self._linear = None + self._pitch2D = None def getPtr(self): return &self._pvt_ptr[0].res def __repr__(self): @@ -10105,11 +10064,10 @@ cdef class cudaResourceDesc: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._res = anon_union0(_ptr=self._pvt_ptr) - + self._res._owner = self def __dealloc__(self): + self._res = None if self._val_ptr is not NULL: free(self._val_ptr) def getPtr(self): @@ -10970,11 +10928,10 @@ cdef class cudaMemLocation: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._localized = anon_struct6(_ptr=self._pvt_ptr) - + self._localized._owner = self def __dealloc__(self): + self._localized = None if self._val_ptr is not NULL: free(self._val_ptr) def getPtr(self): @@ -11054,12 +11011,10 @@ cdef class cudaMemAccessDesc: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._location = cudaMemLocation(_ptr=&self._pvt_ptr[0].location) - + self._location._owner = self def __dealloc__(self): - pass + self._location = None def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -11145,12 +11100,10 @@ cdef class cudaMemPoolProps: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._location = cudaMemLocation(_ptr=&self._pvt_ptr[0].location) - + self._location._owner = self def __dealloc__(self): - pass + self._location = None def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -11315,17 +11268,13 @@ cdef class cudaMemAllocNodeParams: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._poolProps = cudaMemPoolProps(_ptr=&self._pvt_ptr[0].poolProps) - + self._poolProps._owner = self def __dealloc__(self): - pass - + self._poolProps = None if self._accessDescs is not NULL: free(self._accessDescs) self._pvt_ptr[0].accessDescs = NULL - def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -11375,8 +11324,12 @@ cdef class cudaMemAllocNodeParams: @property def accessDescs(self): - arrs = [self._pvt_ptr[0].accessDescs + x*sizeof(cyruntime.cudaMemAccessDesc) for x in range(self._accessDescs_length)] - return [cudaMemAccessDesc(_ptr=arr) for arr in arrs] + if self._pvt_ptr[0].accessDescs == NULL: + return [] + out_accessDescs = [cudaMemAccessDesc() for _idx in range(self._accessDescs_length)] + for _idx in range(len(out_accessDescs)): + string.memcpy(out_accessDescs[_idx].getPtr(), &self._pvt_ptr[0].accessDescs[_idx], sizeof(cyruntime.cudaMemAccessDesc)) + return out_accessDescs @accessDescs.setter def accessDescs(self, val): cdef cyruntime.cudaMemAccessDesc* _accessDescs_new @@ -11387,10 +11340,6 @@ cdef class cudaMemAllocNodeParams: self._pvt_ptr[0].accessDescs = NULL else: if self._accessDescs_length != len(val): - # Allocate and fill a new buffer before touching the - # live state so a failure leaves this object unchanged - # (strong exception guarantee); the old buffer is only - # freed once the resize is known to succeed. _accessDescs_new = calloc(len(val), sizeof(cyruntime.cudaMemAccessDesc)) if _accessDescs_new is NULL: raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cyruntime.cudaMemAccessDesc))) @@ -11405,7 +11354,6 @@ cdef class cudaMemAllocNodeParams: string.memcpy(&self._accessDescs[idx], (val[idx])._pvt_ptr, sizeof(cyruntime.cudaMemAccessDesc)) - @property def accessDescCount(self): return self._pvt_ptr[0].accessDescCount @@ -11473,17 +11421,13 @@ cdef class cudaMemAllocNodeParamsV2: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._poolProps = cudaMemPoolProps(_ptr=&self._pvt_ptr[0].poolProps) - + self._poolProps._owner = self def __dealloc__(self): - pass - + self._poolProps = None if self._accessDescs is not NULL: free(self._accessDescs) self._pvt_ptr[0].accessDescs = NULL - def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -11533,8 +11477,12 @@ cdef class cudaMemAllocNodeParamsV2: @property def accessDescs(self): - arrs = [self._pvt_ptr[0].accessDescs + x*sizeof(cyruntime.cudaMemAccessDesc) for x in range(self._accessDescs_length)] - return [cudaMemAccessDesc(_ptr=arr) for arr in arrs] + if self._pvt_ptr[0].accessDescs == NULL: + return [] + out_accessDescs = [cudaMemAccessDesc() for _idx in range(self._accessDescs_length)] + for _idx in range(len(out_accessDescs)): + string.memcpy(out_accessDescs[_idx].getPtr(), &self._pvt_ptr[0].accessDescs[_idx], sizeof(cyruntime.cudaMemAccessDesc)) + return out_accessDescs @accessDescs.setter def accessDescs(self, val): cdef cyruntime.cudaMemAccessDesc* _accessDescs_new @@ -11545,10 +11493,6 @@ cdef class cudaMemAllocNodeParamsV2: self._pvt_ptr[0].accessDescs = NULL else: if self._accessDescs_length != len(val): - # Allocate and fill a new buffer before touching the - # live state so a failure leaves this object unchanged - # (strong exception guarantee); the old buffer is only - # freed once the resize is known to succeed. _accessDescs_new = calloc(len(val), sizeof(cyruntime.cudaMemAccessDesc)) if _accessDescs_new is NULL: raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cyruntime.cudaMemAccessDesc))) @@ -11563,7 +11507,6 @@ cdef class cudaMemAllocNodeParamsV2: string.memcpy(&self._accessDescs[idx], (val[idx])._pvt_ptr, sizeof(cyruntime.cudaMemAccessDesc)) - @property def accessDescCount(self): return self._pvt_ptr[0].accessDescCount @@ -11677,15 +11620,13 @@ cdef class cudaMemcpyAttributes: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._srcLocHint = cudaMemLocation(_ptr=&self._pvt_ptr[0].srcLocHint) - - + self._srcLocHint._owner = self self._dstLocHint = cudaMemLocation(_ptr=&self._pvt_ptr[0].dstLocHint) - + self._dstLocHint._owner = self def __dealloc__(self): - pass + self._srcLocHint = None + self._dstLocHint = None def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -11865,12 +11806,10 @@ cdef class anon_struct7: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._locHint = cudaMemLocation(_ptr=&self._pvt_ptr[0].op.ptr.locHint) - + self._locHint._owner = self def __dealloc__(self): - pass + self._locHint = None def getPtr(self): return &self._pvt_ptr[0].op.ptr def __repr__(self): @@ -11959,15 +11898,11 @@ cdef class anon_struct8: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._array = cudaArray_t(_ptr=&self._pvt_ptr[0].op.array.array) - - self._offset = cudaOffset3D(_ptr=&self._pvt_ptr[0].op.array.offset) - + self._offset._owner = self def __dealloc__(self): - pass + self._offset = None def getPtr(self): return &self._pvt_ptr[0].op.array def __repr__(self): @@ -12036,15 +11971,13 @@ cdef class anon_union3: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._ptr = anon_struct7(_ptr=self._pvt_ptr) - - + self._ptr._owner = self self._array = anon_struct8(_ptr=self._pvt_ptr) - + self._array._owner = self def __dealloc__(self): - pass + self._ptr = None + self._array = None def getPtr(self): return &self._pvt_ptr[0].op def __repr__(self): @@ -12109,11 +12042,10 @@ cdef class cudaMemcpy3DOperand: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._op = anon_union3(_ptr=self._pvt_ptr) - + self._op._owner = self def __dealloc__(self): + self._op = None if self._val_ptr is not NULL: free(self._val_ptr) def getPtr(self): @@ -12190,18 +12122,16 @@ cdef class cudaMemcpy3DBatchOp: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._src = cudaMemcpy3DOperand(_ptr=&self._pvt_ptr[0].src) - - + self._src._owner = self self._dst = cudaMemcpy3DOperand(_ptr=&self._pvt_ptr[0].dst) - - + self._dst._owner = self self._extent = cudaExtent(_ptr=&self._pvt_ptr[0].extent) - + self._extent._owner = self def __dealloc__(self): - pass + self._src = None + self._dst = None + self._extent = None def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -12733,12 +12663,10 @@ cdef class cudaDeviceProp: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._uuid = cudaUUID_t(_ptr=&self._pvt_ptr[0].uuid) - + self._uuid._owner = self def __dealloc__(self): - pass + self._uuid = None def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -14220,12 +14148,10 @@ cdef class anon_union4: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._win32 = anon_struct9(_ptr=self._pvt_ptr) - + self._win32._owner = self def __dealloc__(self): - pass + self._win32 = None def getPtr(self): return &self._pvt_ptr[0].handle def __repr__(self): @@ -14313,11 +14239,10 @@ cdef class cudaExternalMemoryHandleDesc: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._handle = anon_union4(_ptr=self._pvt_ptr) - + self._handle._owner = self def __dealloc__(self): + self._handle = None if self._val_ptr is not NULL: free(self._val_ptr) def getPtr(self): @@ -14509,15 +14434,13 @@ cdef class cudaExternalMemoryMipmappedArrayDesc: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._formatDesc = cudaChannelFormatDesc(_ptr=&self._pvt_ptr[0].formatDesc) - - + self._formatDesc._owner = self self._extent = cudaExtent(_ptr=&self._pvt_ptr[0].extent) - + self._extent._owner = self def __dealloc__(self): - pass + self._formatDesc = None + self._extent = None def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -14687,12 +14610,10 @@ cdef class anon_union5: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._win32 = anon_struct10(_ptr=self._pvt_ptr) - + self._win32._owner = self def __dealloc__(self): - pass + self._win32 = None def getPtr(self): return &self._pvt_ptr[0].handle def __repr__(self): @@ -14776,11 +14697,10 @@ cdef class cudaExternalSemaphoreHandleDesc: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._handle = anon_union5(_ptr=self._pvt_ptr) - + self._handle._owner = self def __dealloc__(self): + self._handle = None if self._val_ptr is not NULL: free(self._val_ptr) def getPtr(self): @@ -14993,18 +14913,16 @@ cdef class anon_struct13: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._fence = anon_struct11(_ptr=self._pvt_ptr) - - + self._fence._owner = self self._nvSciSync = anon_union6(_ptr=self._pvt_ptr) - - + self._nvSciSync._owner = self self._keyedMutex = anon_struct12(_ptr=self._pvt_ptr) - + self._keyedMutex._owner = self def __dealloc__(self): - pass + self._fence = None + self._nvSciSync = None + self._keyedMutex = None def getPtr(self): return &self._pvt_ptr[0].params def __repr__(self): @@ -15089,12 +15007,10 @@ cdef class cudaExternalSemaphoreSignalParams: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._params = anon_struct13(_ptr=self._pvt_ptr) - + self._params._owner = self def __dealloc__(self): - pass + self._params = None def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -15309,18 +15225,16 @@ cdef class anon_struct16: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._fence = anon_struct14(_ptr=self._pvt_ptr) - - + self._fence._owner = self self._nvSciSync = anon_union7(_ptr=self._pvt_ptr) - - + self._nvSciSync._owner = self self._keyedMutex = anon_struct15(_ptr=self._pvt_ptr) - + self._keyedMutex._owner = self def __dealloc__(self): - pass + self._fence = None + self._nvSciSync = None + self._keyedMutex = None def getPtr(self): return &self._pvt_ptr[0].params def __repr__(self): @@ -15405,12 +15319,10 @@ cdef class cudaExternalSemaphoreWaitParams: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._params = anon_struct16(_ptr=self._pvt_ptr) - + self._params._owner = self def __dealloc__(self): - pass + self._params = None def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -15873,24 +15785,21 @@ cdef class cudaDevResource_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._sm = cudaDevSmResource(_ptr=&self._pvt_ptr[0].sm) - - + self._sm._owner = self self._wqConfig = cudaDevWorkqueueConfigResource(_ptr=&self._pvt_ptr[0].wqConfig) - - + self._wqConfig._owner = self self._wq = cudaDevWorkqueueResource(_ptr=&self._pvt_ptr[0].wq) - + self._wq._owner = self def __dealloc__(self): - if self._val_ptr is not NULL: - free(self._val_ptr) - + self._sm = None + self._wqConfig = None + self._wq = None if self._nextResource is not NULL: free(self._nextResource) self._pvt_ptr[0].nextResource = NULL - + if self._val_ptr is not NULL: + free(self._val_ptr) def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -15998,8 +15907,12 @@ cdef class cudaDevResource_st: @property def nextResource(self): - arrs = [self._pvt_ptr[0].nextResource + x*sizeof(cyruntime.cudaDevResource_st) for x in range(self._nextResource_length)] - return [cudaDevResource_st(_ptr=arr) for arr in arrs] + if self._pvt_ptr[0].nextResource == NULL: + return [] + out_nextResource = [cudaDevResource_st() for _idx in range(self._nextResource_length)] + for _idx in range(len(out_nextResource)): + string.memcpy(out_nextResource[_idx].getPtr(), &self._pvt_ptr[0].nextResource[_idx], sizeof(cyruntime.cudaDevResource_st)) + return out_nextResource @nextResource.setter def nextResource(self, val): cdef cyruntime.cudaDevResource_st* _nextResource_new @@ -16010,10 +15923,6 @@ cdef class cudaDevResource_st: self._pvt_ptr[0].nextResource = NULL else: if self._nextResource_length != len(val): - # Allocate and fill a new buffer before touching the - # live state so a failure leaves this object unchanged - # (strong exception guarantee); the old buffer is only - # freed once the resize is known to succeed. _nextResource_new = calloc(len(val), sizeof(cyruntime.cudaDevResource_st)) if _nextResource_new is NULL: raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cyruntime.cudaDevResource_st))) @@ -16028,7 +15937,6 @@ cdef class cudaDevResource_st: string.memcpy(&self._nextResource[idx], (val[idx])._pvt_ptr, sizeof(cyruntime.cudaDevResource_st)) - cdef class cudalibraryHostUniversalFunctionAndDataTable: """ Attributes @@ -16173,15 +16081,13 @@ cdef class cudaKernelNodeParams: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._gridDim = dim3(_ptr=&self._pvt_ptr[0].gridDim) - - + self._gridDim._owner = self self._blockDim = dim3(_ptr=&self._pvt_ptr[0].blockDim) - + self._blockDim._owner = self def __dealloc__(self): - pass + self._gridDim = None + self._blockDim = None def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -16266,7 +16172,7 @@ cdef class cudaKernelNodeParams: @kernelParams.setter def kernelParams(self, kernelParams): self._cykernelParams = _HelperKernelParams(kernelParams) - self._pvt_ptr[0].kernelParams = self._cykernelParams.ckernelParams + self._pvt_ptr[0].kernelParams = self._cykernelParams.ckernelParams @property @@ -16337,23 +16243,16 @@ cdef class cudaKernelNodeParamsV2: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._kern = cudaKernel_t(_ptr=&self._pvt_ptr[0].kern) - - self._cuFunc = cudaFunction_t(_ptr=&self._pvt_ptr[0].cuFunc) - - self._gridDim = dim3(_ptr=&self._pvt_ptr[0].gridDim) - - + self._gridDim._owner = self self._blockDim = dim3(_ptr=&self._pvt_ptr[0].blockDim) - - + self._blockDim._owner = self self._ctx = cudaExecutionContext_t(_ptr=&self._pvt_ptr[0].ctx) - def __dealloc__(self): + self._gridDim = None + self._blockDim = None if self._val_ptr is not NULL: free(self._val_ptr) def getPtr(self): @@ -16498,7 +16397,7 @@ cdef class cudaKernelNodeParamsV2: @kernelParams.setter def kernelParams(self, kernelParams): self._cykernelParams = _HelperKernelParams(kernelParams) - self._pvt_ptr[0].kernelParams = self._cykernelParams.ckernelParams + self._pvt_ptr[0].kernelParams = self._cykernelParams.ckernelParams @property @@ -16567,17 +16466,12 @@ cdef class cudaExternalSemaphoreSignalNodeParams: def __init__(self, void_ptr _ptr = 0): pass def __dealloc__(self): - pass - if self._extSemArray is not NULL: free(self._extSemArray) self._pvt_ptr[0].extSemArray = NULL - - if self._paramsArray is not NULL: free(self._paramsArray) self._pvt_ptr[0].paramsArray = NULL - def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -16631,8 +16525,12 @@ cdef class cudaExternalSemaphoreSignalNodeParams: @property def paramsArray(self): - arrs = [self._pvt_ptr[0].paramsArray + x*sizeof(cyruntime.cudaExternalSemaphoreSignalParams) for x in range(self._paramsArray_length)] - return [cudaExternalSemaphoreSignalParams(_ptr=arr) for arr in arrs] + if self._pvt_ptr[0].paramsArray == NULL: + return [] + out_paramsArray = [cudaExternalSemaphoreSignalParams() for _idx in range(self._paramsArray_length)] + for _idx in range(len(out_paramsArray)): + string.memcpy(out_paramsArray[_idx].getPtr(), &self._pvt_ptr[0].paramsArray[_idx], sizeof(cyruntime.cudaExternalSemaphoreSignalParams)) + return out_paramsArray @paramsArray.setter def paramsArray(self, val): cdef cyruntime.cudaExternalSemaphoreSignalParams* _paramsArray_new @@ -16643,10 +16541,6 @@ cdef class cudaExternalSemaphoreSignalNodeParams: self._pvt_ptr[0].paramsArray = NULL else: if self._paramsArray_length != len(val): - # Allocate and fill a new buffer before touching the - # live state so a failure leaves this object unchanged - # (strong exception guarantee); the old buffer is only - # freed once the resize is known to succeed. _paramsArray_new = calloc(len(val), sizeof(cyruntime.cudaExternalSemaphoreSignalParams)) if _paramsArray_new is NULL: raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cyruntime.cudaExternalSemaphoreSignalParams))) @@ -16661,7 +16555,6 @@ cdef class cudaExternalSemaphoreSignalNodeParams: string.memcpy(&self._paramsArray[idx], (val[idx])._pvt_ptr, sizeof(cyruntime.cudaExternalSemaphoreSignalParams)) - @property def numExtSems(self): return self._pvt_ptr[0].numExtSems @@ -16705,22 +16598,14 @@ cdef class cudaExternalSemaphoreSignalNodeParamsV2: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._ctx = cudaExecutionContext_t(_ptr=&self._pvt_ptr[0].ctx) - def __dealloc__(self): - pass - if self._extSemArray is not NULL: free(self._extSemArray) self._pvt_ptr[0].extSemArray = NULL - - if self._paramsArray is not NULL: free(self._paramsArray) self._pvt_ptr[0].paramsArray = NULL - def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -16780,8 +16665,12 @@ cdef class cudaExternalSemaphoreSignalNodeParamsV2: @property def paramsArray(self): - arrs = [self._pvt_ptr[0].paramsArray + x*sizeof(cyruntime.cudaExternalSemaphoreSignalParams) for x in range(self._paramsArray_length)] - return [cudaExternalSemaphoreSignalParams(_ptr=arr) for arr in arrs] + if self._pvt_ptr[0].paramsArray == NULL: + return [] + out_paramsArray = [cudaExternalSemaphoreSignalParams() for _idx in range(self._paramsArray_length)] + for _idx in range(len(out_paramsArray)): + string.memcpy(out_paramsArray[_idx].getPtr(), &self._pvt_ptr[0].paramsArray[_idx], sizeof(cyruntime.cudaExternalSemaphoreSignalParams)) + return out_paramsArray @paramsArray.setter def paramsArray(self, val): cdef cyruntime.cudaExternalSemaphoreSignalParams* _paramsArray_new @@ -16792,10 +16681,6 @@ cdef class cudaExternalSemaphoreSignalNodeParamsV2: self._pvt_ptr[0].paramsArray = NULL else: if self._paramsArray_length != len(val): - # Allocate and fill a new buffer before touching the - # live state so a failure leaves this object unchanged - # (strong exception guarantee); the old buffer is only - # freed once the resize is known to succeed. _paramsArray_new = calloc(len(val), sizeof(cyruntime.cudaExternalSemaphoreSignalParams)) if _paramsArray_new is NULL: raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cyruntime.cudaExternalSemaphoreSignalParams))) @@ -16810,7 +16695,6 @@ cdef class cudaExternalSemaphoreSignalNodeParamsV2: string.memcpy(&self._paramsArray[idx], (val[idx])._pvt_ptr, sizeof(cyruntime.cudaExternalSemaphoreSignalParams)) - @property def numExtSems(self): return self._pvt_ptr[0].numExtSems @@ -16869,17 +16753,12 @@ cdef class cudaExternalSemaphoreWaitNodeParams: def __init__(self, void_ptr _ptr = 0): pass def __dealloc__(self): - pass - if self._extSemArray is not NULL: free(self._extSemArray) self._pvt_ptr[0].extSemArray = NULL - - if self._paramsArray is not NULL: free(self._paramsArray) self._pvt_ptr[0].paramsArray = NULL - def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -16933,8 +16812,12 @@ cdef class cudaExternalSemaphoreWaitNodeParams: @property def paramsArray(self): - arrs = [self._pvt_ptr[0].paramsArray + x*sizeof(cyruntime.cudaExternalSemaphoreWaitParams) for x in range(self._paramsArray_length)] - return [cudaExternalSemaphoreWaitParams(_ptr=arr) for arr in arrs] + if self._pvt_ptr[0].paramsArray == NULL: + return [] + out_paramsArray = [cudaExternalSemaphoreWaitParams() for _idx in range(self._paramsArray_length)] + for _idx in range(len(out_paramsArray)): + string.memcpy(out_paramsArray[_idx].getPtr(), &self._pvt_ptr[0].paramsArray[_idx], sizeof(cyruntime.cudaExternalSemaphoreWaitParams)) + return out_paramsArray @paramsArray.setter def paramsArray(self, val): cdef cyruntime.cudaExternalSemaphoreWaitParams* _paramsArray_new @@ -16945,10 +16828,6 @@ cdef class cudaExternalSemaphoreWaitNodeParams: self._pvt_ptr[0].paramsArray = NULL else: if self._paramsArray_length != len(val): - # Allocate and fill a new buffer before touching the - # live state so a failure leaves this object unchanged - # (strong exception guarantee); the old buffer is only - # freed once the resize is known to succeed. _paramsArray_new = calloc(len(val), sizeof(cyruntime.cudaExternalSemaphoreWaitParams)) if _paramsArray_new is NULL: raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cyruntime.cudaExternalSemaphoreWaitParams))) @@ -16963,7 +16842,6 @@ cdef class cudaExternalSemaphoreWaitNodeParams: string.memcpy(&self._paramsArray[idx], (val[idx])._pvt_ptr, sizeof(cyruntime.cudaExternalSemaphoreWaitParams)) - @property def numExtSems(self): return self._pvt_ptr[0].numExtSems @@ -17007,22 +16885,14 @@ cdef class cudaExternalSemaphoreWaitNodeParamsV2: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._ctx = cudaExecutionContext_t(_ptr=&self._pvt_ptr[0].ctx) - def __dealloc__(self): - pass - if self._extSemArray is not NULL: free(self._extSemArray) self._pvt_ptr[0].extSemArray = NULL - - if self._paramsArray is not NULL: free(self._paramsArray) self._pvt_ptr[0].paramsArray = NULL - def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -17082,8 +16952,12 @@ cdef class cudaExternalSemaphoreWaitNodeParamsV2: @property def paramsArray(self): - arrs = [self._pvt_ptr[0].paramsArray + x*sizeof(cyruntime.cudaExternalSemaphoreWaitParams) for x in range(self._paramsArray_length)] - return [cudaExternalSemaphoreWaitParams(_ptr=arr) for arr in arrs] + if self._pvt_ptr[0].paramsArray == NULL: + return [] + out_paramsArray = [cudaExternalSemaphoreWaitParams() for _idx in range(self._paramsArray_length)] + for _idx in range(len(out_paramsArray)): + string.memcpy(out_paramsArray[_idx].getPtr(), &self._pvt_ptr[0].paramsArray[_idx], sizeof(cyruntime.cudaExternalSemaphoreWaitParams)) + return out_paramsArray @paramsArray.setter def paramsArray(self, val): cdef cyruntime.cudaExternalSemaphoreWaitParams* _paramsArray_new @@ -17094,10 +16968,6 @@ cdef class cudaExternalSemaphoreWaitNodeParamsV2: self._pvt_ptr[0].paramsArray = NULL else: if self._paramsArray_length != len(val): - # Allocate and fill a new buffer before touching the - # live state so a failure leaves this object unchanged - # (strong exception guarantee); the old buffer is only - # freed once the resize is known to succeed. _paramsArray_new = calloc(len(val), sizeof(cyruntime.cudaExternalSemaphoreWaitParams)) if _paramsArray_new is NULL: raise MemoryError('Failed to allocate length x size memory: ' + str(len(val)) + 'x' + str(sizeof(cyruntime.cudaExternalSemaphoreWaitParams))) @@ -17112,7 +16982,6 @@ cdef class cudaExternalSemaphoreWaitNodeParamsV2: string.memcpy(&self._paramsArray[idx], (val[idx])._pvt_ptr, sizeof(cyruntime.cudaExternalSemaphoreWaitParams)) - @property def numExtSems(self): return self._pvt_ptr[0].numExtSems @@ -17194,13 +17063,8 @@ cdef class cudaConditionalNodeParams: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._handle = cudaGraphConditionalHandle(_ptr=&self._pvt_ptr[0].handle) - - self._ctx = cudaExecutionContext_t(_ptr=&self._pvt_ptr[0].ctx) - def __dealloc__(self): pass def getPtr(self): @@ -17329,10 +17193,7 @@ cdef class cudaChildGraphNodeParams: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._graph = cudaGraph_t(_ptr=&self._pvt_ptr[0].graph) - def __dealloc__(self): pass def getPtr(self): @@ -17407,13 +17268,8 @@ cdef class cudaEventRecordNodeParams: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._event = cudaEvent_t(_ptr=&self._pvt_ptr[0].event) - - self._ctx = cudaExecutionContext_t(_ptr=&self._pvt_ptr[0].ctx) - def __dealloc__(self): pass def getPtr(self): @@ -17493,10 +17349,7 @@ cdef class cudaEventWaitNodeParams: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._event = cudaEvent_t(_ptr=&self._pvt_ptr[0].event) - def __dealloc__(self): pass def getPtr(self): @@ -17602,44 +17455,43 @@ cdef class cudaGraphNodeParams: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._kernel = cudaKernelNodeParamsV2(_ptr=&self._pvt_ptr[0].kernel) - - + self._kernel._owner = self self._memcpy = cudaMemcpyNodeParams(_ptr=&self._pvt_ptr[0].memcpy) - - + self._memcpy._owner = self self._memset = cudaMemsetParamsV2(_ptr=&self._pvt_ptr[0].memset) - - + self._memset._owner = self self._host = cudaHostNodeParamsV2(_ptr=&self._pvt_ptr[0].host) - - + self._host._owner = self self._graph = cudaChildGraphNodeParams(_ptr=&self._pvt_ptr[0].graph) - - + self._graph._owner = self self._eventWait = cudaEventWaitNodeParams(_ptr=&self._pvt_ptr[0].eventWait) - - + self._eventWait._owner = self self._eventRecord = cudaEventRecordNodeParams(_ptr=&self._pvt_ptr[0].eventRecord) - - + self._eventRecord._owner = self self._extSemSignal = cudaExternalSemaphoreSignalNodeParamsV2(_ptr=&self._pvt_ptr[0].extSemSignal) - - + self._extSemSignal._owner = self self._extSemWait = cudaExternalSemaphoreWaitNodeParamsV2(_ptr=&self._pvt_ptr[0].extSemWait) - - + self._extSemWait._owner = self self._alloc = cudaMemAllocNodeParamsV2(_ptr=&self._pvt_ptr[0].alloc) - - + self._alloc._owner = self self._free = cudaMemFreeNodeParams(_ptr=&self._pvt_ptr[0].free) - - + self._free._owner = self self._conditional = cudaConditionalNodeParams(_ptr=&self._pvt_ptr[0].conditional) - + self._conditional._owner = self def __dealloc__(self): + self._kernel = None + self._memcpy = None + self._memset = None + self._host = None + self._graph = None + self._eventWait = None + self._eventRecord = None + self._extSemSignal = None + self._extSemWait = None + self._alloc = None + self._free = None + self._conditional = None if self._val_ptr is not NULL: free(self._val_ptr) def getPtr(self): @@ -17969,13 +17821,8 @@ cdef class cudaGraphInstantiateParams_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._uploadStream = cudaStream_t(_ptr=&self._pvt_ptr[0].uploadStream) - - self._errNode_out = cudaGraphNode_t(_ptr=&self._pvt_ptr[0].errNode_out) - def __dealloc__(self): pass def getPtr(self): @@ -18094,13 +17941,8 @@ cdef class cudaGraphExecUpdateResultInfo_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._errorNode = cudaGraphNode_t(_ptr=&self._pvt_ptr[0].errorNode) - - self._errorFromNode = cudaGraphNode_t(_ptr=&self._pvt_ptr[0].errorFromNode) - def __dealloc__(self): pass def getPtr(self): @@ -18279,15 +18121,13 @@ cdef class anon_union11: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._gridDim = dim3(_ptr=&self._pvt_ptr[0].updateData.gridDim) - - + self._gridDim._owner = self self._param = anon_struct17(_ptr=self._pvt_ptr) - + self._param._owner = self def __dealloc__(self): - pass + self._gridDim = None + self._param = None def getPtr(self): return &self._pvt_ptr[0].updateData def __repr__(self): @@ -18372,14 +18212,11 @@ cdef class cudaGraphKernelNodeUpdate: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._node = cudaGraphDeviceNode_t(_ptr=&self._pvt_ptr[0].node) - - self._updateData = anon_union11(_ptr=self._pvt_ptr) - + self._updateData._owner = self def __dealloc__(self): + self._updateData = None if self._val_ptr is not NULL: free(self._val_ptr) def getPtr(self): @@ -18620,10 +18457,7 @@ cdef class anon_struct19: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._event = cudaEvent_t(_ptr=&self._pvt_ptr[0].programmaticEvent.event) - def __dealloc__(self): pass def getPtr(self): @@ -18788,10 +18622,7 @@ cdef class anon_struct21: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._event = cudaEvent_t(_ptr=&self._pvt_ptr[0].launchCompletionEvent.event) - def __dealloc__(self): pass def getPtr(self): @@ -18862,10 +18693,7 @@ cdef class anon_struct22: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._devNode = cudaGraphDeviceNode_t(_ptr=&self._pvt_ptr[0].deviceUpdatableKernelNode.devNode) - def __dealloc__(self): pass def getPtr(self): @@ -19047,30 +18875,28 @@ cdef class cudaLaunchAttributeValue: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._accessPolicyWindow = cudaAccessPolicyWindow(_ptr=&self._pvt_ptr[0].accessPolicyWindow) - - + self._accessPolicyWindow._owner = self self._clusterDim = anon_struct18(_ptr=self._pvt_ptr) - - + self._clusterDim._owner = self self._programmaticEvent = anon_struct19(_ptr=self._pvt_ptr) - - + self._programmaticEvent._owner = self self._memSyncDomainMap = cudaLaunchMemSyncDomainMap(_ptr=&self._pvt_ptr[0].memSyncDomainMap) - - + self._memSyncDomainMap._owner = self self._preferredClusterDim = anon_struct20(_ptr=self._pvt_ptr) - - + self._preferredClusterDim._owner = self self._launchCompletionEvent = anon_struct21(_ptr=self._pvt_ptr) - - + self._launchCompletionEvent._owner = self self._deviceUpdatableKernelNode = anon_struct22(_ptr=self._pvt_ptr) - + self._deviceUpdatableKernelNode._owner = self def __dealloc__(self): - pass + self._accessPolicyWindow = None + self._clusterDim = None + self._programmaticEvent = None + self._memSyncDomainMap = None + self._preferredClusterDim = None + self._launchCompletionEvent = None + self._deviceUpdatableKernelNode = None def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -19369,12 +19195,10 @@ cdef class cudaLaunchAttribute_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._val = cudaLaunchAttributeValue(_ptr=&self._pvt_ptr[0].val) - + self._val._owner = self def __dealloc__(self): - pass + self._val = None def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -19474,12 +19298,10 @@ cdef class anon_union12: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr): - pass - self._overBudget = anon_struct23(_ptr=self._pvt_ptr) - + self._overBudget._owner = self def __dealloc__(self): - pass + self._overBudget = None def getPtr(self): return &self._pvt_ptr[0].info def __repr__(self): @@ -19531,11 +19353,10 @@ cdef class cudaAsyncNotificationInfo: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._info = anon_union12(_ptr=self._pvt_ptr) - + self._info._owner = self def __dealloc__(self): + self._info = None if self._val_ptr is not NULL: free(self._val_ptr) def getPtr(self): @@ -19866,10 +19687,7 @@ cdef class cudaGraphRecaptureCallbackData: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._callbackFunc = cudaGraphRecaptureCallback_t(_ptr=&self._pvt_ptr[0].callbackFunc) - def __dealloc__(self): pass def getPtr(self): @@ -19962,12 +19780,10 @@ cdef class cudaEglPlaneDesc_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._channelDesc = cudaChannelFormatDesc(_ptr=&self._pvt_ptr[0].channelDesc) - + self._channelDesc._owner = self def __dealloc__(self): - pass + self._channelDesc = None def getPtr(self): return self._pvt_ptr def __repr__(self): @@ -20181,11 +19997,10 @@ cdef class cudaEglFrame_st: else: self._pvt_ptr = _ptr def __init__(self, void_ptr _ptr = 0): - pass - self._frame = anon_union13(_ptr=self._pvt_ptr) - + self._frame._owner = self def __dealloc__(self): + self._frame = None if self._val_ptr is not NULL: free(self._val_ptr) def getPtr(self): @@ -25199,19 +25014,6 @@ def cudaFuncGetParamCount(func): return (_cudaError_t(err), None) return (_cudaError_t_SUCCESS, paramCount) -ctypedef struct cudaStreamHostCallbackData_st: - cyruntime.cudaHostFn_t callback - void *userData - -ctypedef cudaStreamHostCallbackData_st cudaStreamHostCallbackData - -@cython.show_performance_hints(False) -cdef void cudaStreamRtHostCallbackWrapper(void *data) nogil: - cdef cudaStreamHostCallbackData *cbData = data - with gil: - cbData.callback(cbData.userData) - free(cbData) - @cython.embedsignature(True) def cudaLaunchHostFunc(stream, fn, userData): """ Enqueues a host function call in a stream. @@ -25292,20 +25094,9 @@ def cudaLaunchHostFunc(stream, fn, userData): cystream = pstream cdef _HelperInputVoidPtrStruct cyuserDataHelper cdef void* cyuserData = _helper_input_void_ptr(userData, &cyuserDataHelper) - - cdef cudaStreamHostCallbackData *cbData = NULL - cbData = malloc(sizeof(cbData[0])) - if cbData == NULL: - return (cudaError_t.cudaErrorMemoryAllocation,) - cbData.callback = cyfn - cbData.userData = cyuserData - with nogil: - err = cyruntime.cudaLaunchHostFunc(cystream, cudaStreamRtHostCallbackWrapper, cbData) - if err != cyruntime.cudaSuccess: - free(cbData) + err = cyruntime.cudaLaunchHostFunc(cystream, cyfn, cyuserData) _helper_input_void_ptr_free(&cyuserDataHelper) - return (_cudaError_t(err),) @cython.embedsignature(True) @@ -31352,16 +31143,20 @@ def cudaGraphicsResourceGetMappedPointer(resource): Parameters ---------- resource : :py:obj:`~.cudaGraphicsResource_t` - None + Mapped resource to access Returns ------- cudaError_t - + :py:obj:`~.cudaSuccess`, :py:obj:`~.cudaErrorInvalidValue`, :py:obj:`~.cudaErrorInvalidResourceHandle`, :py:obj:`~.cudaErrorUnknown` devPtr : Any - None + Returned pointer through which `resource` may be accessed size : int - None + Returned size of the buffer accessible starting at `*devPtr` + + See Also + -------- + :py:obj:`~.cudaGraphicsMapResources`, :py:obj:`~.cudaGraphicsSubResourceGetMappedArray`, :py:obj:`~.cuGraphicsResourceGetMappedPointer` """ cdef cyruntime.cudaGraphicsResource_t cyresource if resource is None: @@ -34648,7 +34443,7 @@ def cudaGraphNodeGetToolsId(hNode): ------- cudaError_t :py:obj:`~.CUDA_SUCCESS` :py:obj:`~.cudaErrorInvalidValue` - *toolsNodeId : unsigned long long + toolsNodeId : unsigned long long Pointer to return the id used by tools See Also diff --git a/cuda_bindings/docs/source/module/driver.rst b/cuda_bindings/docs/source/module/driver.rst index 4a7b5d68f7e..81a618223b4 100644 --- a/cuda_bindings/docs/source/module/driver.rst +++ b/cuda_bindings/docs/source/module/driver.rst @@ -3,7 +3,7 @@ .. This code was automatically generated with version 13.4.1. Do not modify it directly. -.. CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=8fb799afff57074126fc28394dc578e31f2d13bffcbecea17a8e14da87e419c7 +.. CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=36581a940ea8eab6240dfa90b5b0598bb90a5cfa8364156b1626801c89c39a2d ------ driver ------ @@ -2624,7 +2624,7 @@ Data types used by CUDA driver .. autoattribute:: cuda.bindings.driver.CUjit_option.CU_JIT_FALLBACK_STRATEGY - Specifies choice of fallback strategy if matching cubin is not found. Choice is based on supplied :py:obj:`~.CUjit_fallback`. This option cannot be used with cuLink\* APIs as the linker requires exact matches. + Specifies choice of fallback strategy if matching cubin is not found. Choice is based on supplied :py:obj:`~.CUjit_fallback`. This option cannot be used with cuLink* APIs as the linker requires exact matches. Option type: unsigned int for enumerated type :py:obj:`~.CUjit_fallback`