# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved. # # SPDX-License-Identifier: Apache-2.0 # # This code was automatically generated across versions from 12.9.1 to 13.5.0. Do not modify it directly. # CYTHON-BINDINGS-GENERATED-DO-NOT-MODIFY-THIS-FILE: format=1; content-sha256=82df971c247cf6ab3e4aed0e3fa58bcfc88508a419b3dcd9f099182445ca41cd # <<<< 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 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 import numpy as _numpy cdef _cyb___getbuffer(object self, _cyb_cpython.Py_buffer *buffer, void *ptr, int size, bint readonly): buffer.buf = ptr buffer.format = 'b' buffer.internal = NULL buffer.itemsize = 1 buffer.len = size buffer.ndim = 1 buffer.obj = self buffer.readonly = readonly buffer.shape = &buffer.len buffer.strides = &buffer.itemsize buffer.suboffsets = NULL cdef inline intptr_t _cyb_array_ptr(object arr) except? 0: cdef _cyb_cpython.Py_buffer view cdef intptr_t ptr _cyb_cpython.PyObject_GetBuffer(arr, &view, _cyb_cpython_buffer.PyBUF_STRIDES) ptr = view.buf _cyb_cpython.PyBuffer_Release(&view) return ptr cdef _cyb_from_buffer(buffer, size, lowpp_type): cdef _cyb_cpython.Py_buffer view if _cyb_cpython.PyObject_GetBuffer(buffer, &view, _cyb_cpython_buffer.PyBUF_SIMPLE) != 0: raise TypeError("buffer argument does not support the buffer protocol") try: if view.itemsize != 1: 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, view.readonly != 0, buffer) finally: _cyb_cpython.PyBuffer_Release(&view) cdef _cyb_from_data(data, dtype_name, expected_dtype, lowpp_type): # _numpy.recarray is a subclass of _numpy.ndarray, so implicitly handled here. if isinstance(data, lowpp_type): return data if not isinstance(data, _numpy.ndarray): raise TypeError("data argument must be a NumPy ndarray") if data.size != 1: raise ValueError("data array must have a size of 1") if data.dtype != expected_dtype: raise ValueError(f"data array must be of dtype {dtype_name}") return lowpp_type.from_ptr(data.ctypes.data, not data.flags.writeable, data) # <<<< END OF PREAMBLE CONTENT >>>> cimport cython # NOQA from cython cimport view cimport cpython from libc.string cimport memcpy from ._internal.utils cimport (get_nested_resource_ptr, nested_resource) from cuda.bindings._internal._fast_enum import FastEnum as _FastEnum from cuda.bindings.cydriver cimport CUDA_VERSION cdef inline unsigned int NVML_VERSION_STRUCT(const unsigned int size, const unsigned int ver) nogil: return (size | (ver << 24)) ############################################################################### # Enum ############################################################################### class BridgeChipType(_cyb_FastEnum): """ Enum to represent type of bridge chip See `nvmlBridgeChipType_t`. """ 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): """ Enum to represent the NvLink utilization counter packet units See `nvmlNvLinkUtilizationCountUnits_t`. """ 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): """ Enum to represent the NvLink utilization counter packet types to count ** this is ONLY applicable with the units as packets or bytes ** as specified in ``nvmlNvLinkUtilizationCountUnits_t`` ** all packet filter descriptions are target GPU centric ** these can be "OR'd" together See `nvmlNvLinkUtilizationCountPktTypes_t`. """ 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): """ Enum to represent NvLink queryable capabilities See `nvmlNvLinkCapability_t`. """ 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): """ Enum to represent NvLink queryable error counters See `nvmlNvLinkErrorCounter_t`. """ 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): """ Enum to represent NvLink's remote device type See `nvmlIntNvLinkDeviceType_t`. """ 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): """ Represents level relationships within a system between two GPUs The enums are spaced to allow for future relationships See `nvmlGpuTopologyLevel_t`. """ 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`. """ 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`. """ 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): """ Represents Type of Sampling Event See `nvmlSamplingType_t`. """ TOTAL_POWER_SAMPLES = (NVML_TOTAL_POWER_SAMPLES, 'To represent total power drawn by GPU.') GPU_UTILIZATION_SAMPLES = (NVML_GPU_UTILIZATION_SAMPLES, 'To represent percent of time during which one or more kernels was executing on the GPU.') MEMORY_UTILIZATION_SAMPLES = (NVML_MEMORY_UTILIZATION_SAMPLES, 'To represent percent of time during which global (device) memory was being read or written.') ENC_UTILIZATION_SAMPLES = (NVML_ENC_UTILIZATION_SAMPLES, 'To represent percent of time during which NVENC remains busy.') DEC_UTILIZATION_SAMPLES = (NVML_DEC_UTILIZATION_SAMPLES, 'To represent percent of time during which NVDEC remains busy.') PROCESSOR_CLK_SAMPLES = (NVML_PROCESSOR_CLK_SAMPLES, 'To represent processor clock samples.') MEMORY_CLK_SAMPLES = (NVML_MEMORY_CLK_SAMPLES, 'To represent memory clock samples.') MODULE_POWER_SAMPLES = (NVML_MODULE_POWER_SAMPLES, 'To represent module power samples for total module starting Grace Hopper.') JPG_UTILIZATION_SAMPLES = (NVML_JPG_UTILIZATION_SAMPLES, 'To represent percent of time during which NVJPG remains busy.') OFA_UTILIZATION_SAMPLES = (NVML_OFA_UTILIZATION_SAMPLES, 'To represent percent of time during which NVOFA remains busy.') SAMPLINGTYPE_COUNT = NVML_SAMPLINGTYPE_COUNT class PcieUtilCounter(_cyb_FastEnum): """ Represents the queryable PCIe utilization counters See `nvmlPcieUtilCounter_t`. """ 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): """ Represents the type for sample value returned See `nvmlValueType_t`. """ DOUBLE = (NVML_VALUE_TYPE_DOUBLE, 'Double-precision floating-point value.') UNSIGNED_INT = (NVML_VALUE_TYPE_UNSIGNED_INT, 'Unsigned 32-bit integer value.') UNSIGNED_LONG = (NVML_VALUE_TYPE_UNSIGNED_LONG, 'Unsigned long integer value.') UNSIGNED_LONG_LONG = (NVML_VALUE_TYPE_UNSIGNED_LONG_LONG, 'Unsigned 64-bit integer value.') SIGNED_LONG_LONG = (NVML_VALUE_TYPE_SIGNED_LONG_LONG, 'Signed 64-bit integer value.') SIGNED_INT = (NVML_VALUE_TYPE_SIGNED_INT, 'Signed 32-bit integer value.') UNSIGNED_SHORT = (NVML_VALUE_TYPE_UNSIGNED_SHORT, 'Unsigned 16-bit integer value.') COUNT = (NVML_VALUE_TYPE_COUNT, 'Maximum value above +1.') class PerfPolicyType(_cyb_FastEnum): """ Represents type of perf policy for which violation times can be queried See `nvmlPerfPolicyType_t`. """ 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): """ Represents the thermal sensor targets See `nvmlThermalTarget_t`. """ NONE = NVML_THERMAL_TARGET_NONE GPU = (NVML_THERMAL_TARGET_GPU, 'GPU core temperature requires NvPhysicalGpuHandle.') MEMORY = (NVML_THERMAL_TARGET_MEMORY, 'GPU memory temperature requires NvPhysicalGpuHandle.') POWER_SUPPLY = (NVML_THERMAL_TARGET_POWER_SUPPLY, 'GPU power supply temperature requires NvPhysicalGpuHandle.') BOARD = (NVML_THERMAL_TARGET_BOARD, 'GPU board ambient temperature requires NvPhysicalGpuHandle.') VCD_BOARD = (NVML_THERMAL_TARGET_VCD_BOARD, 'Visual Computing Device Board temperature requires NvVisualComputingDeviceHandle.') VCD_INLET = (NVML_THERMAL_TARGET_VCD_INLET, 'Visual Computing Device Inlet temperature requires NvVisualComputingDeviceHandle.') VCD_OUTLET = (NVML_THERMAL_TARGET_VCD_OUTLET, 'Visual Computing Device Outlet temperature requires NvVisualComputingDeviceHandle.') ALL = NVML_THERMAL_TARGET_ALL UNKNOWN = NVML_THERMAL_TARGET_UNKNOWN class ThermalController(_cyb_FastEnum): """ Represents the thermal sensor controllers See `nvmlThermalController_t`. """ NONE = NVML_THERMAL_CONTROLLER_NONE GPU_INTERNAL = NVML_THERMAL_CONTROLLER_GPU_INTERNAL ADM1032 = NVML_THERMAL_CONTROLLER_ADM1032 ADT7461 = NVML_THERMAL_CONTROLLER_ADT7461 MAX6649 = NVML_THERMAL_CONTROLLER_MAX6649 MAX1617 = NVML_THERMAL_CONTROLLER_MAX1617 LM99 = NVML_THERMAL_CONTROLLER_LM99 LM89 = NVML_THERMAL_CONTROLLER_LM89 LM64 = NVML_THERMAL_CONTROLLER_LM64 G781 = NVML_THERMAL_CONTROLLER_G781 ADT7473 = NVML_THERMAL_CONTROLLER_ADT7473 SBMAX6649 = NVML_THERMAL_CONTROLLER_SBMAX6649 VBIOSEVT = NVML_THERMAL_CONTROLLER_VBIOSEVT OS = NVML_THERMAL_CONTROLLER_OS NVSYSCON_CANOAS = NVML_THERMAL_CONTROLLER_NVSYSCON_CANOAS NVSYSCON_E551 = NVML_THERMAL_CONTROLLER_NVSYSCON_E551 MAX6649R = NVML_THERMAL_CONTROLLER_MAX6649R ADT7473S = NVML_THERMAL_CONTROLLER_ADT7473S UNKNOWN = NVML_THERMAL_CONTROLLER_UNKNOWN class CoolerControl(_cyb_FastEnum): """ Cooler control type See `nvmlCoolerControl_t`. """ 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): """ Cooler's target See `nvmlCoolerTarget_t`. """ 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): """ Enum to represent different UUID types See `nvmlUUIDType_t`. """ NONE = (NVML_UUID_TYPE_NONE, 'Undefined type.') ASCII = (NVML_UUID_TYPE_ASCII, 'ASCII format type.') BINARY = (NVML_UUID_TYPE_BINARY, 'Binary format type.') class EnableState(_cyb_FastEnum): """ Generic enable/disable enum. See `nvmlEnableState_t`. """ 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): """ - The Brand of the GPU See `nvmlBrandType_t`. """ 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_NPU = NVML_BRAND_NVIDIA_NPU BRAND_NVIDIA_NPU = NVIDIA_NPU # backward-compat alias NVIDIA_VGAMEDEV = NVML_BRAND_NVIDIA_VGAMEDEV BRAND_NVIDIA_VGAMEDEV = NVIDIA_VGAMEDEV # backward-compat alias COUNT = NVML_BRAND_COUNT BRAND_COUNT = COUNT # backward-compat alias class TemperatureThresholds(_cyb_FastEnum): """ Temperature thresholds. See `nvmlTemperatureThresholds_t`. """ 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): """ Temperature sensors. See `nvmlTemperatureSensors_t`. """ 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): """ Compute mode. NVML_COMPUTEMODE_EXCLUSIVE_PROCESS was added in CUDA 4.0. Earlier CUDA versions supported a single exclusive mode, which is equivalent to NVML_COMPUTEMODE_EXCLUSIVE_THREAD in CUDA 4.0 and beyond. See `nvmlComputeMode_t`. """ 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): """ Memory error types See `nvmlMemoryErrorType_t`. """ CORRECTED = (NVML_MEMORY_ERROR_TYPE_CORRECTED, 'A memory error that was corrected For ECC errors, these are single bit errors For Texture memory, these are errors fixed by resend') UNCORRECTED = (NVML_MEMORY_ERROR_TYPE_UNCORRECTED, 'A memory error that was not corrected For ECC errors, these are double bit errors For Texture memory, these are errors where the resend fails') COUNT = (NVML_MEMORY_ERROR_TYPE_COUNT, 'Count of memory error types.') class NvlinkVersion(_cyb_FastEnum): """ Represents Nvlink Version See `nvmlNvlinkVersion_t`. """ 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): """ ECC counter types. Note: Volatile counts are reset each time the driver loads. On Windows this is once per boot. On Linux this can be more frequent. On Linux the driver unloads when no active clients exist. If persistence mode is enabled or there is always a driver client active (e.g. X11), then Linux also sees per-boot behavior. If not, volatile counts are reset each time a compute app is run. See `nvmlEccCounterType_t`. """ 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).') 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): """ Clock types. All speeds are in Mhz. See `nvmlClockType_t`. """ 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): """ Clock Ids. These are used in combination with `nvmlClockType_t` to specify a single clock value. See `nvmlClockId_t`. """ CURRENT = (NVML_CLOCK_ID_CURRENT, 'Current actual clock value.') APP_CLOCK_TARGET = (NVML_CLOCK_ID_APP_CLOCK_TARGET, 'Target application clock. Deprecated, do not use.') APP_CLOCK_DEFAULT = (NVML_CLOCK_ID_APP_CLOCK_DEFAULT, 'Default application clock target Deprecated, do not use.') CUSTOMER_BOOST_MAX = (NVML_CLOCK_ID_CUSTOMER_BOOST_MAX, 'OEM-defined maximum clock rate.') COUNT = (NVML_CLOCK_ID_COUNT, 'Count of Clock Ids.') class DriverModel(_cyb_FastEnum): """ Driver models. Windows only. See `nvmlDriverModel_t`. """ 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): """ Allowed PStates. See `nvmlPstates_t`. """ PSTATE_0 = (NVML_PSTATE_0, 'Performance state 0 -- Maximum Performance.') PSTATE_1 = (NVML_PSTATE_1, 'Performance state 1.') PSTATE_2 = (NVML_PSTATE_2, 'Performance state 2.') PSTATE_3 = (NVML_PSTATE_3, 'Performance state 3.') PSTATE_4 = (NVML_PSTATE_4, 'Performance state 4.') PSTATE_5 = (NVML_PSTATE_5, 'Performance state 5.') PSTATE_6 = (NVML_PSTATE_6, 'Performance state 6.') PSTATE_7 = (NVML_PSTATE_7, 'Performance state 7.') PSTATE_8 = (NVML_PSTATE_8, 'Performance state 8.') PSTATE_9 = (NVML_PSTATE_9, 'Performance state 9.') PSTATE_10 = (NVML_PSTATE_10, 'Performance state 10.') PSTATE_11 = (NVML_PSTATE_11, 'Performance state 11.') PSTATE_12 = (NVML_PSTATE_12, 'Performance state 12.') PSTATE_13 = (NVML_PSTATE_13, 'Performance state 13.') PSTATE_14 = (NVML_PSTATE_14, 'Performance state 14.') PSTATE_15 = (NVML_PSTATE_15, 'Performance state 15 -- Minimum Performance.') PSTATE_UNKNOWN = (NVML_PSTATE_UNKNOWN, 'Unknown performance state.') class GpuOperationMode(_cyb_FastEnum): """ GPU Operation Mode GOM allows to reduce power usage and optimize GPU throughput by disabling GPU features. Each GOM is designed to meet specific user needs. See `nvmlGpuOperationMode_t`. """ 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): """ Available infoROM objects. See `nvmlInforomObject_t`. """ 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): """ Return values for NVML API calls. See `nvmlReturn_t`. """ SUCCESS = (NVML_SUCCESS, 'The operation was successful.') ERROR_UNINITIALIZED = (NVML_ERROR_UNINITIALIZED, 'NVML was not first initialized with `nvmlInit()`.') ERROR_INVALID_ARGUMENT = (NVML_ERROR_INVALID_ARGUMENT, 'A supplied argument is invalid.') ERROR_NOT_SUPPORTED = (NVML_ERROR_NOT_SUPPORTED, 'The requested operation is not available on target device.') ERROR_NO_PERMISSION = (NVML_ERROR_NO_PERMISSION, 'The current user does not have permission for operation.') ERROR_ALREADY_INITIALIZED = (NVML_ERROR_ALREADY_INITIALIZED, 'Deprecated: Multiple initializations are now allowed through ref counting.') ERROR_NOT_FOUND = (NVML_ERROR_NOT_FOUND, 'A query to find an object was unsuccessful.') ERROR_INSUFFICIENT_SIZE = (NVML_ERROR_INSUFFICIENT_SIZE, 'An input argument is not large enough.') ERROR_INSUFFICIENT_POWER = (NVML_ERROR_INSUFFICIENT_POWER, "A device's external power cables are not properly attached.") ERROR_DRIVER_NOT_LOADED = (NVML_ERROR_DRIVER_NOT_LOADED, 'NVIDIA driver is not loaded.') ERROR_TIMEOUT = (NVML_ERROR_TIMEOUT, 'User provided timeout passed.') ERROR_IRQ_ISSUE = (NVML_ERROR_IRQ_ISSUE, 'NVIDIA Kernel detected an interrupt issue with a GPU.') ERROR_LIBRARY_NOT_FOUND = (NVML_ERROR_LIBRARY_NOT_FOUND, "NVML Shared Library couldn't be found or loaded.") ERROR_FUNCTION_NOT_FOUND = (NVML_ERROR_FUNCTION_NOT_FOUND, "Local version of NVML doesn't implement this function.") ERROR_CORRUPTED_INFOROM = (NVML_ERROR_CORRUPTED_INFOROM, 'infoROM is corrupted') ERROR_GPU_IS_LOST = (NVML_ERROR_GPU_IS_LOST, 'The GPU has fallen off the bus or has otherwise become inaccessible.') ERROR_RESET_REQUIRED = (NVML_ERROR_RESET_REQUIRED, 'The GPU requires a reset before it can be used again.') ERROR_OPERATING_SYSTEM = (NVML_ERROR_OPERATING_SYSTEM, 'A generic operating system error occurred.') ERROR_LIB_RM_VERSION_MISMATCH = (NVML_ERROR_LIB_RM_VERSION_MISMATCH, 'RM detects a driver/library version mismatch.') ERROR_IN_USE = (NVML_ERROR_IN_USE, 'An operation cannot be performed because the GPU is currently in use.') ERROR_MEMORY = (NVML_ERROR_MEMORY, 'Insufficient memory.') ERROR_NO_DATA = (NVML_ERROR_NO_DATA, 'No data.') ERROR_VGPU_ECC_NOT_SUPPORTED = (NVML_ERROR_VGPU_ECC_NOT_SUPPORTED, 'The requested vgpu operation is not available on target device, becasue ECC is enabled.') ERROR_INSUFFICIENT_RESOURCES = (NVML_ERROR_INSUFFICIENT_RESOURCES, 'Ran out of critical resources, other than memory.') ERROR_FREQ_NOT_SUPPORTED = (NVML_ERROR_FREQ_NOT_SUPPORTED, 'Ran out of critical resources, other than memory.') ERROR_ARGUMENT_VERSION_MISMATCH = (NVML_ERROR_ARGUMENT_VERSION_MISMATCH, 'The provided version is invalid/unsupported.') ERROR_DEPRECATED = (NVML_ERROR_DEPRECATED, 'The requested functionality has been deprecated.') ERROR_NOT_READY = (NVML_ERROR_NOT_READY, 'The system is not ready for the request.') ERROR_GPU_NOT_FOUND = (NVML_ERROR_GPU_NOT_FOUND, 'No GPUs were found.') ERROR_INVALID_STATE = (NVML_ERROR_INVALID_STATE, 'Resource not in correct state to perform requested operation.') ERROR_RESET_TYPE_NOT_SUPPORTED = (NVML_ERROR_RESET_TYPE_NOT_SUPPORTED, 'Reset not supported for given device/parameters.') ERROR_UNKNOWN = (NVML_ERROR_UNKNOWN, 'An internal driver error occurred.') class MemoryLocation(_cyb_FastEnum): """ See `nvmlDeviceGetMemoryErrorCounter` See `nvmlMemoryLocation_t`. """ L1_CACHE = (NVML_MEMORY_LOCATION_L1_CACHE, 'GPU L1 Cache.') L2_CACHE = (NVML_MEMORY_LOCATION_L2_CACHE, 'GPU L2 Cache.') DRAM = (NVML_MEMORY_LOCATION_DRAM, 'Turing+ DRAM.') DEVICE_MEMORY = (NVML_MEMORY_LOCATION_DEVICE_MEMORY, 'GPU Device Memory.') REGISTER_FILE = (NVML_MEMORY_LOCATION_REGISTER_FILE, 'GPU Register File.') TEXTURE_MEMORY = (NVML_MEMORY_LOCATION_TEXTURE_MEMORY, 'GPU Texture Memory.') TEXTURE_SHM = (NVML_MEMORY_LOCATION_TEXTURE_SHM, 'Shared memory.') CBU = (NVML_MEMORY_LOCATION_CBU, 'CBU.') SRAM = (NVML_MEMORY_LOCATION_SRAM, 'Turing+ SRAM.') COUNT = (NVML_MEMORY_LOCATION_COUNT, 'This counts the number of memory locations the driver knows about.') class PageRetirementCause(_cyb_FastEnum): """ Causes for page retirement See `nvmlPageRetirementCause_t`. """ MULTIPLE_SINGLE_BIT_ECC_ERRORS = (NVML_PAGE_RETIREMENT_CAUSE_MULTIPLE_SINGLE_BIT_ECC_ERRORS, 'Page was retired due to multiple single bit ECC error.') DOUBLE_BIT_ECC_ERROR = (NVML_PAGE_RETIREMENT_CAUSE_DOUBLE_BIT_ECC_ERROR, 'Page was retired due to double bit ECC error.') COUNT = NVML_PAGE_RETIREMENT_CAUSE_COUNT class RestrictedAPI(_cyb_FastEnum): """ API types that allow changes to default permission restrictions See `nvmlRestrictedAPI_t`. """ SET_APPLICATION_CLOCKS = (NVML_RESTRICTED_API_SET_APPLICATION_CLOCKS, 'APIs that change application clocks, see nvmlDeviceSetApplicationsClocks and see nvmlDeviceResetApplicationsClocks. Deprecated, keeping definition for backward compatibility.') SET_AUTO_BOOSTED_CLOCKS = (NVML_RESTRICTED_API_SET_AUTO_BOOSTED_CLOCKS, 'APIs that enable/disable Auto Boosted clocks see nvmlDeviceSetAutoBoostedClocksEnabled') COUNT = NVML_RESTRICTED_API_COUNT class GpuUtilizationDomainId(_cyb_FastEnum): """ Represents the GPU utilization domains See `nvmlGpuUtilizationDomainId_t`. """ 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): """ GPU virtualization mode types. See `nvmlGpuVirtualizationMode_t`. """ NONE = (NVML_GPU_VIRTUALIZATION_MODE_NONE, 'Represents Bare Metal GPU.') PASSTHROUGH = (NVML_GPU_VIRTUALIZATION_MODE_PASSTHROUGH, 'Device is associated with GPU-Passthorugh.') VGPU = (NVML_GPU_VIRTUALIZATION_MODE_VGPU, 'Device is associated with vGPU inside virtual machine.') HOST_VGPU = (NVML_GPU_VIRTUALIZATION_MODE_HOST_VGPU, 'Device is associated with VGX hypervisor in vGPU mode.') HOST_VSGA = (NVML_GPU_VIRTUALIZATION_MODE_HOST_VSGA, 'Device is associated with VGX hypervisor in vSGA mode.') class HostVgpuMode(_cyb_FastEnum): """ Host vGPU modes See `nvmlHostVgpuMode_t`. """ NON_SRIOV = (NVML_HOST_VGPU_MODE_NON_SRIOV, 'Non SR-IOV mode.') SRIOV = (NVML_HOST_VGPU_MODE_SRIOV, 'SR-IOV mode.') class VgpuVmIdType(_cyb_FastEnum): """ Types of VM identifiers See `nvmlVgpuVmIdType_t`. """ 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): """ vGPU GUEST info state See `nvmlVgpuGuestInfoState_t`. """ 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): """ vGPU software licensable features See `nvmlGridLicenseFeatureCode_t`. """ UNKNOWN = (NVML_GRID_LICENSE_FEATURE_CODE_UNKNOWN, 'Unknown.') VGPU = (NVML_GRID_LICENSE_FEATURE_CODE_VGPU, 'Virtual GPU.') NVIDIA_RTX = (NVML_GRID_LICENSE_FEATURE_CODE_NVIDIA_RTX, 'Nvidia RTX.') VWORKSTATION = (NVML_GRID_LICENSE_FEATURE_CODE_VWORKSTATION, 'Deprecated, do not use.') GAMING = (NVML_GRID_LICENSE_FEATURE_CODE_GAMING, 'Gaming.') COMPUTE = (NVML_GRID_LICENSE_FEATURE_CODE_COMPUTE, 'Compute.') VGAMEDEV = (NVML_GRID_LICENSE_FEATURE_CODE_VGAMEDEV, 'vGameDev') class VgpuCapability(_cyb_FastEnum): """ vGPU queryable capabilities See `nvmlVgpuCapability_t`. """ 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): """ vGPU driver queryable capabilities See `nvmlVgpuDriverCapability_t`. """ 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): """ Device vGPU queryable capabilities See `nvmlDeviceVgpuCapability_t`. """ 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): """ Enum describing the GPU Recovery Action See `nvmlDeviceGpuRecoveryAction_t`. """ 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): """ Fan state enum. See `nvmlFanState_t`. """ 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): """ Led color enum. See `nvmlLedColor_t`. """ GREEN = (NVML_LED_COLOR_GREEN, 'GREEN, indicates good health.') AMBER = (NVML_LED_COLOR_AMBER, 'AMBER, indicates problem.') class EncoderType(_cyb_FastEnum): """ Represents type of encoder for capacity can be queried See `nvmlEncoderType_t`. """ 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): """ Represents frame buffer capture session type See `nvmlFBCSessionType_t`. """ UNKNOWN = (NVML_FBC_SESSION_TYPE_UNKNOWN, 'Unknown.') TOSYS = (NVML_FBC_SESSION_TYPE_TOSYS, 'ToSys.') CUDA = (NVML_FBC_SESSION_TYPE_CUDA, 'Cuda.') VID = (NVML_FBC_SESSION_TYPE_VID, 'Vid.') HWENC = (NVML_FBC_SESSION_TYPE_HWENC, 'HEnc.') class DetachGpuState(_cyb_FastEnum): """ Is the GPU device to be removed from the kernel by `nvmlDeviceRemoveGpu()` See `nvmlDetachGpuState_t`. """ 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): """ Parent bridge PCIe link state requested by `nvmlDeviceRemoveGpu()` See `nvmlPcieLinkState_t`. """ 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): """ See `nvmlClockLimitId_t`. """ RANGE_START = NVML_CLOCK_LIMIT_ID_RANGE_START TDP = NVML_CLOCK_LIMIT_ID_TDP UNLIMITED = NVML_CLOCK_LIMIT_ID_UNLIMITED class VgpuVmCompatibility(_cyb_FastEnum): """ vGPU VM compatibility codes See `nvmlVgpuVmCompatibility_t`. """ NONE = (NVML_VGPU_VM_COMPATIBILITY_NONE, 'vGPU is not runnable') COLD = (NVML_VGPU_VM_COMPATIBILITY_COLD, 'vGPU is runnable from a cold / powered-off state (ACPI S5)') HIBERNATE = (NVML_VGPU_VM_COMPATIBILITY_HIBERNATE, 'vGPU is runnable from a hibernated state (ACPI S4)') SLEEP = (NVML_VGPU_VM_COMPATIBILITY_SLEEP, 'vGPU is runnable from a sleeped state (ACPI S3)') LIVE = (NVML_VGPU_VM_COMPATIBILITY_LIVE, 'vGPU is runnable from a live/paused (ACPI S0)') class VgpuPgpuCompatibilityLimitCode(_cyb_FastEnum): """ vGPU-pGPU compatibility limit codes See `nvmlVgpuPgpuCompatibilityLimitCode_t`. """ 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): """ GPM Metric Identifiers See `nvmlGpmMetricId_t`. """ 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): """ Workload power profile identifiers. See `nvmlPowerProfileType_t`. """ 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): """ Enum to represent device addressing mode values See `nvmlDeviceAddressingModeType_t`. """ 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): """ PRM Counter IDs See `nvmlPRMCounterId_t`. """ NONE = (NVML_PRM_COUNTER_ID_NONE, 'Sentinel.') PPCNT_PHYSICAL_LAYER_CTRS_LINK_DOWN_EVENTS = (NVML_PRM_COUNTER_ID_PPCNT_PHYSICAL_LAYER_CTRS_LINK_DOWN_EVENTS, 'PPCNT group 0x12, link_down_events.') PPCNT_PHYSICAL_LAYER_CTRS_SUCCESSFUL_RECOVERY_EVENTS = (NVML_PRM_COUNTER_ID_PPCNT_PHYSICAL_LAYER_CTRS_SUCCESSFUL_RECOVERY_EVENTS, 'PPCNT group 0x12, successful_recovery_events.') PPCNT_RECOVERY_CTRS_TOTAL_SUCCESSFUL_RECOVERY_EVENTS = (NVML_PRM_COUNTER_ID_PPCNT_RECOVERY_CTRS_TOTAL_SUCCESSFUL_RECOVERY_EVENTS, 'PPCNT group 0x1A, total_successful_recovery_events.') PPCNT_RECOVERY_CTRS_TIME_SINCE_LAST_RECOVERY = (NVML_PRM_COUNTER_ID_PPCNT_RECOVERY_CTRS_TIME_SINCE_LAST_RECOVERY, 'PPCNT group 0x1A, time_since_last_recovery.') PPCNT_RECOVERY_CTRS_TIME_BETWEEN_LAST_TWO_RECOVERIES = (NVML_PRM_COUNTER_ID_PPCNT_RECOVERY_CTRS_TIME_BETWEEN_LAST_TWO_RECOVERIES, 'PPCNT group 0x1A, time_between_last_two_recoveries.') PPCNT_RECOVERY_CTRS_TIME_IN_LAST_HOST_SERDES_FEQ_RECOVERY = (NVML_PRM_COUNTER_ID_PPCNT_RECOVERY_CTRS_TIME_IN_LAST_HOST_SERDES_FEQ_RECOVERY, 'PPCNT group 0x1A, time_in_last_host_serdes_feq_recovery.') PPCNT_RECOVERY_CTRS_TOTAL_TIME_IN_HOST_SERDES_FEQ_RECOVERY = (NVML_PRM_COUNTER_ID_PPCNT_RECOVERY_CTRS_TOTAL_TIME_IN_HOST_SERDES_FEQ_RECOVERY, 'PPCNT group 0x1A, total_time_in_host_serdes_feq_recovery.') PPCNT_RECOVERY_CTRS_TOTAL_HOST_SERDES_FEQ_RECOVERY_COUNT = (NVML_PRM_COUNTER_ID_PPCNT_RECOVERY_CTRS_TOTAL_HOST_SERDES_FEQ_RECOVERY_COUNT, 'PPCNT group 0x1A, total_host_serdes_feq_recovery_count.') PPCNT_RECOVERY_CTRS_TOTAL_HOST_SERDES_FEQ_SUCCESSFUL_RECOVERY_COUNT = (NVML_PRM_COUNTER_ID_PPCNT_RECOVERY_CTRS_TOTAL_HOST_SERDES_FEQ_SUCCESSFUL_RECOVERY_COUNT, 'PPCNT group 0x1A, total_host_serdes_feq_successful_recovery_count.') PPCNT_RECOVERY_CTRS_LAST_HOST_SERDES_FEQ_ATTEMPTS_COUNT = (NVML_PRM_COUNTER_ID_PPCNT_RECOVERY_CTRS_LAST_HOST_SERDES_FEQ_ATTEMPTS_COUNT, 'PPCNT group 0x1A, last_host_serdes_feq_attempts_count.') PPCNT_RECOVERY_CTRS_LAST_SUCCESSFUL_RECOVERY_STEP_ATTEMPTS = (NVML_PRM_COUNTER_ID_PPCNT_RECOVERY_CTRS_LAST_SUCCESSFUL_RECOVERY_STEP_ATTEMPTS, 'PPCNT group 0x1A, last_successful_recovery_step_attempts.') PPCNT_RECOVERY_CTRS_LAST_SUCCESSFUL_RECOVERY_TIME = (NVML_PRM_COUNTER_ID_PPCNT_RECOVERY_CTRS_LAST_SUCCESSFUL_RECOVERY_TIME, 'PPCNT group 0x1A, last_successful_recovery_time.') PPCNT_RECOVERY_CTRS_TOTAL_SUCCESSFUL_RECOVERY_TIME = (NVML_PRM_COUNTER_ID_PPCNT_RECOVERY_CTRS_TOTAL_SUCCESSFUL_RECOVERY_TIME, 'PPCNT group 0x1A, total_successful_recovery_time.') PPCNT_PORTCOUNTERS_PORT_XMIT_WAIT = (NVML_PRM_COUNTER_ID_PPCNT_PORTCOUNTERS_PORT_XMIT_WAIT, 'PPCNT group 0x20, port_xmit_wait.') PPCNT_PLR_RCV_CODES = (NVML_PRM_COUNTER_ID_PPCNT_PLR_RCV_CODES, 'PPCNT group 0x22, plr_rcv_codes.') PPCNT_PLR_RCV_CODE_ERR = (NVML_PRM_COUNTER_ID_PPCNT_PLR_RCV_CODE_ERR, 'PPCNT group 0x22, plr_rcv_code_err.') PPCNT_PLR_RCV_UNCORRECTABLE_CODE = (NVML_PRM_COUNTER_ID_PPCNT_PLR_RCV_UNCORRECTABLE_CODE, 'PPCNT group 0x22, plr_rcv_uncorrectable_code.') PPCNT_PLR_XMIT_CODES = (NVML_PRM_COUNTER_ID_PPCNT_PLR_XMIT_CODES, 'PPCNT group 0x22, plr_xmit_codes.') PPCNT_PLR_XMIT_RETRY_CODES = (NVML_PRM_COUNTER_ID_PPCNT_PLR_XMIT_RETRY_CODES, 'PPCNT group 0x22, plr_xmit_retry_codes.') PPCNT_PLR_XMIT_RETRY_EVENTS = (NVML_PRM_COUNTER_ID_PPCNT_PLR_XMIT_RETRY_EVENTS, 'PPCNT group 0x22, plr_xmit_retry_events.') PPCNT_PLR_SYNC_EVENTS = (NVML_PRM_COUNTER_ID_PPCNT_PLR_SYNC_EVENTS, 'PPCNT group 0x22, plr_sync_events.') PPRM_OPER_RECOVERY = (NVML_PRM_COUNTER_ID_PPRM_OPER_RECOVERY, 'PPRM, oper_recovery.') class PowerProfileOperation(_cyb_FastEnum): """ Enum for operation to perform on the requested profiles See `nvmlPowerProfileOperation_t`. """ CLEAR = (NVML_POWER_PROFILE_OPERATION_CLEAR, 'Remove the requested profiles from the existing list of requested profiles.') SET = (NVML_POWER_PROFILE_OPERATION_SET, 'Add the requested profiles to the existing list of requested profiles.') SET_AND_OVERWRITE = (NVML_POWER_PROFILE_OPERATION_SET_AND_OVERWRITE, 'Overwrite the existing list of requested profiles with just the requested profiles.') MAX = (NVML_POWER_PROFILE_OPERATION_MAX, 'Max value above +1.') class ProcessMode(_cyb_FastEnum): """ Enum to represent process mode. See `nvmlProcessMode_t`. """ COMPUTE = (NVML_PROCESS_MODE_COMPUTE, 'Processes with a compute context.') GRAPHICS = (NVML_PROCESS_MODE_GRAPHICS, 'Processes with a graphics context.') MPS = (NVML_PROCESS_MODE_MPS, 'Processes with a MPS (Multi-Process Service) compute context.') ALL = (NVML_PROCESS_MODE_ALL, 'All processes running on the GPU (compute, graphics, MPS, and other types).') MAX = (NVML_PROCESS_MODE_MAX, 'Maximum value for bounds checking.') class CPERType(_cyb_FastEnum): """ Bitmask of CPER record types. Multiple values may be combined to request records from several sources in one call. See `nvmlCPERType_t`. """ CPER_ACCESS_TYPE_GPU = (NVML_CPER_ACCESS_TYPE_GPU, 'Access GPU CPER records.') class GpuOperationalEventLogLevel(_cyb_FastEnum): """ Log-level values used by GPU Operational Events. These values are used both for event reporting in `nvmlEventSetWait_v3_t` and for subscription filtering in `nvmlGpuOperationalEventConfig_v1_t`. Higher numeric values represent more selective log levels. `NVML_GPU_OPERATIONAL_EVENT_LOG_LEVEL_ALL` disables log-level filtering when used as a subscription threshold. Event data may contain newer log-level values that are not named in this header; clients should handle unrecognized numeric values. See `nvmlGpuOperationalEventLogLevel_t`. """ ALL = (NVML_GPU_OPERATIONAL_EVENT_LOG_LEVEL_ALL, 'Matches all GPU Operational Event log levels.') TELEMETRY = (NVML_GPU_OPERATIONAL_EVENT_LOG_LEVEL_TELEMETRY, 'High-volume telemetry events.') DIAG = (NVML_GPU_OPERATIONAL_EVENT_LOG_LEVEL_DIAG, 'Diagnostic events.') NOTICE = (NVML_GPU_OPERATIONAL_EVENT_LOG_LEVEL_NOTICE, 'Notable operational events.') WARNING = (NVML_GPU_OPERATIONAL_EVENT_LOG_LEVEL_WARNING, 'Warning events.') ERROR = (NVML_GPU_OPERATIONAL_EVENT_LOG_LEVEL_ERROR, 'Error events.') class OperationalEventSeverity(_cyb_FastEnum): """ Severity values used by Operational Events. These values are used both for event reporting in `nvmlEventSetWait_v3_t` and for subscription filtering in `nvmlGpuOperationalEventConfig_v1_t`. Higher numeric values represent more selective severities. `NVML_OPERATIONAL_EVENT_SEVERITY_ALL` disables severity filtering when used as a subscription threshold. Event data may contain newer severity values that are not named in this header; clients should handle unrecognized numeric values. See `nvmlOperationalEventSeverity_t`. """ ALL = (NVML_OPERATIONAL_EVENT_SEVERITY_ALL, 'Matches all Operational Event severities.') INFORMATIONAL = (NVML_OPERATIONAL_EVENT_SEVERITY_INFORMATIONAL, 'Informational event.') CORRECTED = (NVML_OPERATIONAL_EVENT_SEVERITY_CORRECTED, 'Corrected error event.') RECOVERABLE = (NVML_OPERATIONAL_EVENT_SEVERITY_RECOVERABLE, 'Recoverable error event.') FATAL = (NVML_OPERATIONAL_EVENT_SEVERITY_FATAL, 'Fatal error event.') class EventDataType(_cyb_FastEnum): """ Event data formats returned by `nvmlEventSetWait_v3`. See `nvmlEventDataType_t`. """ 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): """ NVML-defined GPU Operational Event context classifications. These values describe the NVML public interpretation of a context payload. The original source-defined context type is returned separately in `nvmlEventSetGetContextInfo_v1_t.sourceEventContextType`. See `nvmlGpuOperationalEventContextType_t`. """ UNKNOWN = (NVML_GPU_OPERATIONAL_EVENT_CONTEXT_TYPE_UNKNOWN, 'No NVML public interpretation is defined for this context payload.') LEGACY_XID = (NVML_GPU_OPERATIONAL_EVENT_CONTEXT_TYPE_LEGACY_XID, 'Context payload can be decoded with `nvmlEventSetGetGpuOperationalEventContextLegacyXid_v1`.') class NvlinkTelemetrySampleType(_cyb_FastEnum): """ Per-link NVLink telemetry sample types. See `nvmlNvlinkTelemetrySampleType_t`. """ THROUGHPUT_RAW_TX = (NVML_NVLINK_TELEMETRY_SAMPLE_TYPE_THROUGHPUT_RAW_TX, 'Raw TX flit counter for a single link.') THROUGHPUT_RAW_RX = (NVML_NVLINK_TELEMETRY_SAMPLE_TYPE_THROUGHPUT_RAW_RX, 'Raw RX flit counter for a single link.') COUNT = (NVML_NVLINK_TELEMETRY_SAMPLE_TYPE_COUNT, 'Number of valid sample types.') class AffinityScope(_FastEnum): NODE = (0, "Scope of NUMA node for affinity queries") SOCKET = (1, "Scope of processor socket for affinity queries") class FieldId(_FastEnum): DEV_ECC_CURRENT = (1, "Current ECC mode. 1=Active. 0=Inactive") DEV_ECC_PENDING = (2, "Pending ECC mode. 1=Active. 0=Inactive") # ECC Count Totals DEV_ECC_SBE_VOL_TOTAL = (3, "Total single bit volatile ECC errors") DEV_ECC_DBE_VOL_TOTAL = (4, "Total double bit volatile ECC errors") DEV_ECC_SBE_AGG_TOTAL = (5, "Total single bit aggregate (persistent) ECC errors") DEV_ECC_DBE_AGG_TOTAL = (6, "Total double bit aggregate (persistent) ECC errors") # Individual ECC locations DEV_ECC_SBE_VOL_L1 = (7, "L1 cache single bit volatile ECC errors") DEV_ECC_DBE_VOL_L1 = (8, "L1 cache double bit volatile ECC errors") DEV_ECC_SBE_VOL_L2 = (9, "L2 cache single bit volatile ECC errors") DEV_ECC_DBE_VOL_L2 = (10, "L2 cache double bit volatile ECC errors") DEV_ECC_SBE_VOL_DEV = (11, "Device memory single bit volatile ECC errors") DEV_ECC_DBE_VOL_DEV = (12, "Device memory double bit volatile ECC errors") DEV_ECC_SBE_VOL_REG = (13, "Register file single bit volatile ECC errors") DEV_ECC_DBE_VOL_REG = (14, "Register file double bit volatile ECC errors") DEV_ECC_SBE_VOL_TEX = (15, "Texture memory single bit volatile ECC errors") DEV_ECC_DBE_VOL_TEX = (16, "Texture memory double bit volatile ECC errors") DEV_ECC_DBE_VOL_CBU = (17, "CBU double bit volatile ECC errors") DEV_ECC_SBE_AGG_L1 = (18, "L1 cache single bit aggregate (persistent) ECC errors") DEV_ECC_DBE_AGG_L1 = (19, "L1 cache double bit aggregate (persistent) ECC errors") DEV_ECC_SBE_AGG_L2 = (20, "L2 cache single bit aggregate (persistent) ECC errors") DEV_ECC_DBE_AGG_L2 = (21, "L2 cache double bit aggregate (persistent) ECC errors") DEV_ECC_SBE_AGG_DEV = (22, "Device memory single bit aggregate (persistent) ECC errors") DEV_ECC_DBE_AGG_DEV = (23, "Device memory double bit aggregate (persistent) ECC errors") DEV_ECC_SBE_AGG_REG = (24, "Register File single bit aggregate (persistent) ECC errors") DEV_ECC_DBE_AGG_REG = (25, "Register File double bit aggregate (persistent) ECC errors") DEV_ECC_SBE_AGG_TEX = (26, "Texture memory single bit aggregate (persistent) ECC errors") DEV_ECC_DBE_AGG_TEX = (27, "Texture memory double bit aggregate (persistent) ECC errors") DEV_ECC_DBE_AGG_CBU = (28, "CBU double bit aggregate ECC errors") # Page Retirement DEV_RETIRED_SBE = (29, "Number of retired pages because of single bit errors") DEV_RETIRED_DBE = (30, "Number of retired pages because of double bit errors") DEV_RETIRED_PENDING = (31, "If any pages are pending retirement. 1=yes. 0=no.") # NVLink Flit Error Counters DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L0 = (32, "NVLink flow control CRC Error Counter for Lane 0") DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L1 = (33, "NVLink flow control CRC Error Counter for Lane 1") DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L2 = (34, "NVLink flow control CRC Error Counter for Lane 2") DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L3 = (35, "NVLink flow control CRC Error Counter for Lane 3") DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L4 = (36, "NVLink flow control CRC Error Counter for Lane 4") DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L5 = (37, "NVLink flow control CRC Error Counter for Lane 5") DEV_NVLINK_CRC_FLIT_ERROR_COUNT_TOTAL = (38, "NVLink flow control CRC Error Counter total for all Lanes") # NVLink CRC Data Error Counters DEV_NVLINK_CRC_DATA_ERROR_COUNT_L0 = (39, "NVLink data CRC Error Counter for Lane 0") DEV_NVLINK_CRC_DATA_ERROR_COUNT_L1 = (40, "NVLink data CRC Error Counter for Lane 1") DEV_NVLINK_CRC_DATA_ERROR_COUNT_L2 = (41, "NVLink data CRC Error Counter for Lane 2") DEV_NVLINK_CRC_DATA_ERROR_COUNT_L3 = (42, "NVLink data CRC Error Counter for Lane 3") DEV_NVLINK_CRC_DATA_ERROR_COUNT_L4 = (43, "NVLink data CRC Error Counter for Lane 4") DEV_NVLINK_CRC_DATA_ERROR_COUNT_L5 = (44, "NVLink data CRC Error Counter for Lane 5") DEV_NVLINK_CRC_DATA_ERROR_COUNT_TOTAL = (45, "NvLink data CRC Error Counter total for all Lanes") # NVLink Replay Error Counters DEV_NVLINK_REPLAY_ERROR_COUNT_L0 = (46, "NVLink Replay Error Counter for Lane 0") DEV_NVLINK_REPLAY_ERROR_COUNT_L1 = (47, "NVLink Replay Error Counter for Lane 1") DEV_NVLINK_REPLAY_ERROR_COUNT_L2 = (48, "NVLink Replay Error Counter for Lane 2") DEV_NVLINK_REPLAY_ERROR_COUNT_L3 = (49, "NVLink Replay Error Counter for Lane 3") DEV_NVLINK_REPLAY_ERROR_COUNT_L4 = (50, "NVLink Replay Error Counter for Lane 4") DEV_NVLINK_REPLAY_ERROR_COUNT_L5 = (51, "NVLink Replay Error Counter for Lane 5") DEV_NVLINK_REPLAY_ERROR_COUNT_TOTAL = (52, "NVLink Replay Error Counter total for all Lanes") # NVLink Recovery Error Counters DEV_NVLINK_RECOVERY_ERROR_COUNT_L0 = (53, "NVLink Recovery Error Counter for Lane 0") DEV_NVLINK_RECOVERY_ERROR_COUNT_L1 = (54, "NVLink Recovery Error Counter for Lane 1") DEV_NVLINK_RECOVERY_ERROR_COUNT_L2 = (55, "NVLink Recovery Error Counter for Lane 2") DEV_NVLINK_RECOVERY_ERROR_COUNT_L3 = (56, "NVLink Recovery Error Counter for Lane 3") DEV_NVLINK_RECOVERY_ERROR_COUNT_L4 = (57, "NVLink Recovery Error Counter for Lane 4") DEV_NVLINK_RECOVERY_ERROR_COUNT_L5 = (58, "NVLink Recovery Error Counter for Lane 5") DEV_NVLINK_RECOVERY_ERROR_COUNT_TOTAL = (59, "NVLink Recovery Error Counter total for all Lanes") # NvLink Bandwidth Counters DEV_NVLINK_BANDWIDTH_C0_L0 = (60, "NVLink Bandwidth Counter for Counter Set 0, Lane 0") DEV_NVLINK_BANDWIDTH_C0_L1 = (61, "NVLink Bandwidth Counter for Counter Set 0, Lane 1") DEV_NVLINK_BANDWIDTH_C0_L2 = (62, "NVLink Bandwidth Counter for Counter Set 0, Lane 2") DEV_NVLINK_BANDWIDTH_C0_L3 = (63, "NVLink Bandwidth Counter for Counter Set 0, Lane 3") DEV_NVLINK_BANDWIDTH_C0_L4 = (64, "NVLink Bandwidth Counter for Counter Set 0, Lane 4") DEV_NVLINK_BANDWIDTH_C0_L5 = (65, "NVLink Bandwidth Counter for Counter Set 0, Lane 5") DEV_NVLINK_BANDWIDTH_C0_TOTAL = (66, "NVLink Bandwidth Counter Total for Counter Set 0, All Lanes") # NvLink Bandwidth Counters DEV_NVLINK_BANDWIDTH_C1_L0 = (67, "NVLink Bandwidth Counter for Counter Set 1, Lane 0") DEV_NVLINK_BANDWIDTH_C1_L1 = (68, "NVLink Bandwidth Counter for Counter Set 1, Lane 1") DEV_NVLINK_BANDWIDTH_C1_L2 = (69, "NVLink Bandwidth Counter for Counter Set 1, Lane 2") DEV_NVLINK_BANDWIDTH_C1_L3 = (70, "NVLink Bandwidth Counter for Counter Set 1, Lane 3") DEV_NVLINK_BANDWIDTH_C1_L4 = (71, "NVLink Bandwidth Counter for Counter Set 1, Lane 4") DEV_NVLINK_BANDWIDTH_C1_L5 = (72, "NVLink Bandwidth Counter for Counter Set 1, Lane 5") DEV_NVLINK_BANDWIDTH_C1_TOTAL = (73, "NVLink Bandwidth Counter Total for Counter Set 1, All Lanes") # NVML Perf Policy Counters DEV_PERF_POLICY_POWER = (74, "Perf Policy Counter for Power Policy") DEV_PERF_POLICY_THERMAL = (75, "Perf Policy Counter for Thermal Policy") DEV_PERF_POLICY_SYNC_BOOST = (76, "Perf Policy Counter for Sync boost Policy") DEV_PERF_POLICY_BOARD_LIMIT = (77, "Perf Policy Counter for Board Limit") DEV_PERF_POLICY_LOW_UTILIZATION = (78, "Perf Policy Counter for Low GPU Utilization Policy") DEV_PERF_POLICY_RELIABILITY = (79, "Perf Policy Counter for Reliability Policy") DEV_PERF_POLICY_TOTAL_APP_CLOCKS = (80, "Perf Policy Counter for Total App Clock Policy") DEV_PERF_POLICY_TOTAL_BASE_CLOCKS = (81, "Perf Policy Counter for Total Base Clocks Policy") # Memory temperatures DEV_MEMORY_TEMP = (82, "Memory temperature for the device") # Energy Counter DEV_TOTAL_ENERGY_CONSUMPTION = (83, "Total energy consumption for the GPU in mJ since the driver was last reloaded") # NVLink Speed DEV_NVLINK_SPEED_MBPS_L0 = (84, "NVLink Speed in MBps for Link 0") DEV_NVLINK_SPEED_MBPS_L1 = (85, "NVLink Speed in MBps for Link 1") DEV_NVLINK_SPEED_MBPS_L2 = (86, "NVLink Speed in MBps for Link 2") DEV_NVLINK_SPEED_MBPS_L3 = (87, "NVLink Speed in MBps for Link 3") DEV_NVLINK_SPEED_MBPS_L4 = (88, "NVLink Speed in MBps for Link 4") DEV_NVLINK_SPEED_MBPS_L5 = (89, "NVLink Speed in MBps for Link 5") DEV_NVLINK_SPEED_MBPS_COMMON = (90, "Common NVLink Speed in MBps for active links") DEV_NVLINK_LINK_COUNT = (91, "Number of NVLinks present on the device") DEV_RETIRED_PENDING_SBE = (92, "If any pages are pending retirement due to SBE. 1=yes. 0=no.") DEV_RETIRED_PENDING_DBE = (93, "If any pages are pending retirement due to DBE. 1=yes. 0=no.") DEV_PCIE_REPLAY_COUNTER = (94, "PCIe replay counter") DEV_PCIE_REPLAY_ROLLOVER_COUNTER = (95, "PCIe replay rollover counter") # NVLink Flit Error Counters DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L6 = (96, "NVLink flow control CRC Error Counter for Lane 6") DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L7 = (97, "NVLink flow control CRC Error Counter for Lane 7") DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L8 = (98, "NVLink flow control CRC Error Counter for Lane 8") DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L9 = (99, "NVLink flow control CRC Error Counter for Lane 9") DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L10 = (100, "NVLink flow control CRC Error Counter for Lane 10") DEV_NVLINK_CRC_FLIT_ERROR_COUNT_L11 = (101, "NVLink flow control CRC Error Counter for Lane 11") # NVLink CRC Data Error Counters DEV_NVLINK_CRC_DATA_ERROR_COUNT_L6 = (102, "NVLink data CRC Error Counter for Lane 6") DEV_NVLINK_CRC_DATA_ERROR_COUNT_L7 = (103, "NVLink data CRC Error Counter for Lane 7") DEV_NVLINK_CRC_DATA_ERROR_COUNT_L8 = (104, "NVLink data CRC Error Counter for Lane 8") DEV_NVLINK_CRC_DATA_ERROR_COUNT_L9 = (105, "NVLink data CRC Error Counter for Lane 9") DEV_NVLINK_CRC_DATA_ERROR_COUNT_L10 = (106, "NVLink data CRC Error Counter for Lane 10") DEV_NVLINK_CRC_DATA_ERROR_COUNT_L11 = (107, "NVLink data CRC Error Counter for Lane 11") # NVLink Replay Error Counters DEV_NVLINK_REPLAY_ERROR_COUNT_L6 = (108, "NVLink Replay Error Counter for Lane 6") DEV_NVLINK_REPLAY_ERROR_COUNT_L7 = (109, "NVLink Replay Error Counter for Lane 7") DEV_NVLINK_REPLAY_ERROR_COUNT_L8 = (110, "NVLink Replay Error Counter for Lane 8") DEV_NVLINK_REPLAY_ERROR_COUNT_L9 = (111, "NVLink Replay Error Counter for Lane 9") DEV_NVLINK_REPLAY_ERROR_COUNT_L10 = (112, "NVLink Replay Error Counter for Lane 10") DEV_NVLINK_REPLAY_ERROR_COUNT_L11 = (113, "NVLink Replay Error Counter for Lane 11") # NVLink Recovery Error Counters DEV_NVLINK_RECOVERY_ERROR_COUNT_L6 = (114, "NVLink Recovery Error Counter for Lane 6") DEV_NVLINK_RECOVERY_ERROR_COUNT_L7 = (115, "NVLink Recovery Error Counter for Lane 7") DEV_NVLINK_RECOVERY_ERROR_COUNT_L8 = (116, "NVLink Recovery Error Counter for Lane 8") DEV_NVLINK_RECOVERY_ERROR_COUNT_L9 = (117, "NVLink Recovery Error Counter for Lane 9") DEV_NVLINK_RECOVERY_ERROR_COUNT_L10 = (118, "NVLink Recovery Error Counter for Lane 10") DEV_NVLINK_RECOVERY_ERROR_COUNT_L11 = (119, "NVLink Recovery Error Counter for Lane 11") # NvLink Bandwidth Counters */ DEV_NVLINK_BANDWIDTH_C0_L6 = (120, "NVLink Bandwidth Counter for Counter Set 0, Lane 6") DEV_NVLINK_BANDWIDTH_C0_L7 = (121, "NVLink Bandwidth Counter for Counter Set 0, Lane 7") DEV_NVLINK_BANDWIDTH_C0_L8 = (122, "NVLink Bandwidth Counter for Counter Set 0, Lane 8") DEV_NVLINK_BANDWIDTH_C0_L9 = (123, "NVLink Bandwidth Counter for Counter Set 0, Lane 9") DEV_NVLINK_BANDWIDTH_C0_L10 = (124, "NVLink Bandwidth Counter for Counter Set 0, Lane 10") DEV_NVLINK_BANDWIDTH_C0_L11 = (125, "NVLink Bandwidth Counter for Counter Set 0, Lane 11") # NvLink Bandwidth Counters DEV_NVLINK_BANDWIDTH_C1_L6 = (126, "NVLink Bandwidth Counter for Counter Set 1, Lane 6") DEV_NVLINK_BANDWIDTH_C1_L7 = (127, "NVLink Bandwidth Counter for Counter Set 1, Lane 7") DEV_NVLINK_BANDWIDTH_C1_L8 = (128, "NVLink Bandwidth Counter for Counter Set 1, Lane 8") DEV_NVLINK_BANDWIDTH_C1_L9 = (129, "NVLink Bandwidth Counter for Counter Set 1, Lane 9") DEV_NVLINK_BANDWIDTH_C1_L10 = (130, "NVLink Bandwidth Counter for Counter Set 1, Lane 10") DEV_NVLINK_BANDWIDTH_C1_L11 = (131, "NVLink Bandwidth Counter for Counter Set 1, Lane 11") # NVLink Speed DEV_NVLINK_SPEED_MBPS_L6 = (132, "NVLink Speed in MBps for Link 6") DEV_NVLINK_SPEED_MBPS_L7 = (133, "NVLink Speed in MBps for Link 7") DEV_NVLINK_SPEED_MBPS_L8 = (134, "NVLink Speed in MBps for Link 8") DEV_NVLINK_SPEED_MBPS_L9 = (135, "NVLink Speed in MBps for Link 9") DEV_NVLINK_SPEED_MBPS_L10 = (136, "NVLink Speed in MBps for Link 10") DEV_NVLINK_SPEED_MBPS_L11 = (137, "NVLink Speed in MBps for Link 11") # NVLink throughput counters field values DEV_NVLINK_THROUGHPUT_DATA_TX = (138, "NVLink TX Data throughput in KiB") DEV_NVLINK_THROUGHPUT_DATA_RX = (139, "NVLink RX Data throughput in KiB") DEV_NVLINK_THROUGHPUT_RAW_TX = (140, "NVLink TX Data + protocol overhead in KiB") DEV_NVLINK_THROUGHPUT_RAW_RX = (141, "NVLink RX Data + protocol overhead in KiB") # Row Remapper DEV_REMAPPED_COR = (142, "Number of remapped rows due to correctable errors") DEV_REMAPPED_UNC = (143, "Number of remapped rows due to uncorrectable errors") DEV_REMAPPED_PENDING = (144, "If any rows are pending remapping. 1=yes 0=no") DEV_REMAPPED_FAILURE = (145, "If any rows failed to be remapped 1=yes 0=no") # Remote device NVLink ID DEV_NVLINK_REMOTE_NVLINK_ID = (146, "Remote device NVLink ID") # NVSwitch: connected NVLink count DEV_NVSWITCH_CONNECTED_LINK_COUNT = (147, "Number of NVLinks connected to NVSwitch") # NvLink ECC Data Error Counters DEV_NVLINK_ECC_DATA_ERROR_COUNT_L0 = (148, "NVLink data ECC Error Counter for Link 0") DEV_NVLINK_ECC_DATA_ERROR_COUNT_L1 = (149, "NVLink data ECC Error Counter for Link 1") DEV_NVLINK_ECC_DATA_ERROR_COUNT_L2 = (150, "NVLink data ECC Error Counter for Link 2") DEV_NVLINK_ECC_DATA_ERROR_COUNT_L3 = (151, "NVLink data ECC Error Counter for Link 3") DEV_NVLINK_ECC_DATA_ERROR_COUNT_L4 = (152, "NVLink data ECC Error Counter for Link 4") DEV_NVLINK_ECC_DATA_ERROR_COUNT_L5 = (153, "NVLink data ECC Error Counter for Link 5") DEV_NVLINK_ECC_DATA_ERROR_COUNT_L6 = (154, "NVLink data ECC Error Counter for Link 6") DEV_NVLINK_ECC_DATA_ERROR_COUNT_L7 = (155, "NVLink data ECC Error Counter for Link 7") DEV_NVLINK_ECC_DATA_ERROR_COUNT_L8 = (156, "NVLink data ECC Error Counter for Link 8") DEV_NVLINK_ECC_DATA_ERROR_COUNT_L9 = (157, "NVLink data ECC Error Counter for Link 9") DEV_NVLINK_ECC_DATA_ERROR_COUNT_L10 = (158, "NVLink data ECC Error Counter for Link 10") DEV_NVLINK_ECC_DATA_ERROR_COUNT_L11 = (159, "NVLink data ECC Error Counter for Link 11") DEV_NVLINK_ECC_DATA_ERROR_COUNT_TOTAL = (160, "NVLink data ECC Error Counter total for all Links") # NVLink Error Replay DEV_NVLINK_ERROR_DL_REPLAY = (161, "NVLink Replay Error Counter") # NVLink Recovery Error Counter DEV_NVLINK_ERROR_DL_RECOVERY = (162, "NVLink Recovery Error Counter") # NVLink Recovery Error CRC Counter DEV_NVLINK_ERROR_DL_CRC = (163, "NVLink CRC Error Counter") # NVLink Speed, State and Version field id 164, 165, and 166 DEV_NVLINK_GET_SPEED = (164, "NVLink Speed in MBps") DEV_NVLINK_GET_STATE = (165, "NVLink State - Active,Inactive") DEV_NVLINK_GET_VERSION = (166, "NVLink Version") DEV_NVLINK_GET_POWER_STATE = (167, "NVLink Power state. 0=HIGH_SPEED 1=LOW_SPEED") DEV_NVLINK_GET_POWER_THRESHOLD = (168, "NVLink length of idle period (units can be found from DEV_NVLINK_GET_POWER_THRESHOLD_UNITS) before transitioning links to sleep state") DEV_PCIE_L0_TO_RECOVERY_COUNTER = (169, "Device PEX error recovery counter") DEV_C2C_LINK_COUNT = (170, "Number of C2C Links present on the device") DEV_C2C_LINK_GET_STATUS = (171, "C2C Link Status 0=INACTIVE 1=ACTIVE") DEV_C2C_LINK_GET_MAX_BW = (172, "C2C Link Speed in MBps for active links") DEV_PCIE_COUNT_CORRECTABLE_ERRORS = (173, "PCIe Correctable Errors Counter") DEV_PCIE_COUNT_NAKS_RECEIVED = (174, "PCIe NAK Receive Counter") DEV_PCIE_COUNT_RECEIVER_ERROR = (175, "PCIe Receiver Error Counter") DEV_PCIE_COUNT_BAD_TLP = (176, "PCIe Bad TLP Counter") DEV_PCIE_COUNT_NAKS_SENT = (177, "PCIe NAK Send Counter") DEV_PCIE_COUNT_BAD_DLLP = (178, "PCIe Bad DLLP Counter") DEV_PCIE_COUNT_NON_FATAL_ERROR = (179, "PCIe Non Fatal Error Counter") DEV_PCIE_COUNT_FATAL_ERROR = (180, "PCIe Fatal Error Counter") DEV_PCIE_COUNT_UNSUPPORTED_REQ = (181, "PCIe Unsupported Request Counter") DEV_PCIE_COUNT_LCRC_ERROR = (182, "PCIe LCRC Error Counter") DEV_PCIE_COUNT_LANE_ERROR = (183, "PCIe Per Lane Error Counter.") DEV_IS_RESETLESS_MIG_SUPPORTED = (184, "Device's Restless MIG Capability") DEV_POWER_AVERAGE = (185, "GPU power averaged over 1 sec interval, supported on Ampere (except GA100) or newer architectures.") DEV_POWER_INSTANT = (186, "Current GPU power, supported on all architectures.") DEV_POWER_MIN_LIMIT = (187, "Minimum power limit in milliwatts.") DEV_POWER_MAX_LIMIT = (188, "Maximum power limit in milliwatts.") DEV_POWER_DEFAULT_LIMIT = (189, "Default power limit in milliwatts (limit which device boots with).") DEV_POWER_CURRENT_LIMIT = (190, "Limit currently enforced in milliwatts (This includes other limits set elsewhere. E.g. Out-of-band).") DEV_ENERGY = (191, "Total energy consumption (in mJ) since the driver was last reloaded. Same as \ref DEV_TOTAL_ENERGY_CONSUMPTION for the GPU.") DEV_POWER_REQUESTED_LIMIT = (192, "Power limit requested by NVML or any other userspace client.") # GPU T.Limit temperature thresholds in degree Celsius DEV_TEMPERATURE_SHUTDOWN_TLIMIT = (193, "T.Limit temperature after which GPU may shut down for HW protection") DEV_TEMPERATURE_SLOWDOWN_TLIMIT = (194, "T.Limit temperature after which GPU may begin HW slowdown") DEV_TEMPERATURE_MEM_MAX_TLIMIT = (195, "T.Limit temperature after which GPU may begin SW slowdown due to memory temperature") DEV_TEMPERATURE_GPU_MAX_TLIMIT = (196, "T.Limit temperature after which GPU may be throttled below base clock") DEV_PCIE_COUNT_TX_BYTES = (197, "PCIe transmit bytes. Value can be wrapped.") DEV_PCIE_COUNT_RX_BYTES = (198, "PCIe receive bytes. Value can be wrapped.") DEV_IS_MIG_MODE_INDEPENDENT_MIG_QUERY_CAPABLE = (199, "MIG mode independent, MIG query capable device. 1=yes. 0=no.") DEV_NVLINK_GET_POWER_THRESHOLD_MAX = (200, "Max Nvlink Power Threshold. See DEV_NVLINK_GET_POWER_THRESHOLD") # NVLink counter field id 201-225 DEV_NVLINK_COUNT_XMIT_PACKETS = (201, "Total Tx packets on the link in NVLink5") DEV_NVLINK_COUNT_XMIT_BYTES = (202, "Total Tx bytes on the link in NVLink5") DEV_NVLINK_COUNT_RCV_PACKETS = (203, "Total Rx packets on the link in NVLink5") DEV_NVLINK_COUNT_RCV_BYTES = (204, "Total Rx bytes on the link in NVLink5") DEV_NVLINK_COUNT_VL15_DROPPED = (205, "Deprecated, do not use") DEV_NVLINK_COUNT_MALFORMED_PACKET_ERRORS = (206, "Number of packets Rx on a link where packets are malformed") DEV_NVLINK_COUNT_BUFFER_OVERRUN_ERRORS = (207, "Number of packets that were discarded on Rx due to buffer overrun") DEV_NVLINK_COUNT_RCV_ERRORS = (208, "Total number of packets with errors Rx on a link") DEV_NVLINK_COUNT_RCV_REMOTE_ERRORS = (209, "Total number of packets Rx - stomp/EBP marker") DEV_NVLINK_COUNT_RCV_GENERAL_ERRORS = (210, "Total number of packets Rx with header mismatch") DEV_NVLINK_COUNT_LOCAL_LINK_INTEGRITY_ERRORS = (211, "Total number of times that the count of local errors exceeded a threshold") DEV_NVLINK_COUNT_XMIT_DISCARDS = (212, "Total number of tx error packets that were discarded") DEV_NVLINK_COUNT_LINK_RECOVERY_SUCCESSFUL_EVENTS =(213, "Number of times link went from Up to recovery, succeeded and link came back up") DEV_NVLINK_COUNT_LINK_RECOVERY_FAILED_EVENTS = (214, "Number of times link went from Up to recovery, failed and link was declared down") DEV_NVLINK_COUNT_LINK_RECOVERY_EVENTS = (215, "Number of times link went from Up to recovery, irrespective of the result") DEV_NVLINK_COUNT_RAW_BER_LANE0 = (216, "Deprecated, do not use") DEV_NVLINK_COUNT_RAW_BER_LANE1 = (217, "Deprecated, do not use") DEV_NVLINK_COUNT_RAW_BER = (218, "Deprecated, do not use") DEV_NVLINK_COUNT_EFFECTIVE_ERRORS = (219, "Sum of the number of errors in each Nvlink packet") # NVLink Effective BER DEV_NVLINK_COUNT_EFFECTIVE_BER = (220, "Effective BER for effective errors") DEV_NVLINK_COUNT_SYMBOL_ERRORS = (221, "Number of errors in rx symbols") # NVLink Symbol BER DEV_NVLINK_COUNT_SYMBOL_BER = (222, "BER for symbol errors") DEV_NVLINK_GET_POWER_THRESHOLD_MIN = (223, "Min Nvlink Power Threshold. See DEV_NVLINK_GET_POWER_THRESHOLD") DEV_NVLINK_GET_POWER_THRESHOLD_UNITS = (224, "Values are in the form NVML_NVLINK_LOW_POWER_THRESHOLD_UNIT_*") DEV_NVLINK_GET_POWER_THRESHOLD_SUPPORTED = (225, "Determine if Nvlink Power Threshold feature is supported") DEV_RESET_STATUS = (226, "Depracated, do not use (use DEV_GET_GPU_RECOVERY_ACTION instead)") DEV_DRAIN_AND_RESET_STATUS = (227, "Deprecated, do not use (use DEV_GET_GPU_RECOVERY_ACTION instead)") DEV_PCIE_OUTBOUND_ATOMICS_MASK = 228 DEV_PCIE_INBOUND_ATOMICS_MASK = 229 DEV_GET_GPU_RECOVERY_ACTION = (230, "GPU Recovery action - None/Reset/Reboot/Drain P2P/Drain and Reset") DEV_C2C_LINK_ERROR_INTR = (231, "C2C Link CRC Error Counter") DEV_C2C_LINK_ERROR_REPLAY = (232, "C2C Link Replay Error Counter") DEV_C2C_LINK_ERROR_REPLAY_B2B = (233, "C2C Link Back to Back Replay Error Counter") DEV_C2C_LINK_POWER_STATE = (234, "C2C Link Power state. See NVML_C2C_POWER_STATE_*") # NVLink counter field id 235-250 DEV_NVLINK_COUNT_FEC_HISTORY_0 = (235, "Count of symbol errors that are corrected - bin 0") DEV_NVLINK_COUNT_FEC_HISTORY_1 = (236, "Count of symbol errors that are corrected - bin 1") DEV_NVLINK_COUNT_FEC_HISTORY_2 = (237, "Count of symbol errors that are corrected - bin 2") DEV_NVLINK_COUNT_FEC_HISTORY_3 = (238, "Count of symbol errors that are corrected - bin 3") DEV_NVLINK_COUNT_FEC_HISTORY_4 = (239, "Count of symbol errors that are corrected - bin 4") DEV_NVLINK_COUNT_FEC_HISTORY_5 = (240, "Count of symbol errors that are corrected - bin 5") DEV_NVLINK_COUNT_FEC_HISTORY_6 = (241, "Count of symbol errors that are corrected - bin 6") DEV_NVLINK_COUNT_FEC_HISTORY_7 = (242, "Count of symbol errors that are corrected - bin 7") DEV_NVLINK_COUNT_FEC_HISTORY_8 = (243, "Count of symbol errors that are corrected - bin 8") DEV_NVLINK_COUNT_FEC_HISTORY_9 = (244, "Count of symbol errors that are corrected - bin 9") DEV_NVLINK_COUNT_FEC_HISTORY_10 = (245, "Count of symbol errors that are corrected - bin 10") DEV_NVLINK_COUNT_FEC_HISTORY_11 = (246, "Count of symbol errors that are corrected - bin 11") DEV_NVLINK_COUNT_FEC_HISTORY_12 = (247, "Count of symbol errors that are corrected - bin 12") DEV_NVLINK_COUNT_FEC_HISTORY_13 = (248, "Count of symbol errors that are corrected - bin 13") DEV_NVLINK_COUNT_FEC_HISTORY_14 = (249, "Count of symbol errors that are corrected - bin 14") DEV_NVLINK_COUNT_FEC_HISTORY_15 = (250, "Count of symbol errors that are corrected - bin 15") # Power Smoothing PWR_SMOOTHING_ENABLED = (251, "Enablement (0/DISABLED or 1/ENABLED)") PWR_SMOOTHING_PRIV_LVL = (252, "Current privilege level") PWR_SMOOTHING_IMM_RAMP_DOWN_ENABLED = (253, "Immediate ramp down enablement (0/DISABLED or 1/ENABLED)") PWR_SMOOTHING_APPLIED_TMP_CEIL = (254, "Applied TMP ceiling value in Watts") PWR_SMOOTHING_APPLIED_TMP_FLOOR = (255, "Applied TMP floor value in Watts") PWR_SMOOTHING_MAX_PERCENT_TMP_FLOOR_SETTING = (256, "Max % TMP Floor value") PWR_SMOOTHING_MIN_PERCENT_TMP_FLOOR_SETTING = (257, "Min % TMP Floor value") PWR_SMOOTHING_HW_CIRCUITRY_PERCENT_LIFETIME_REMAINING = (258, "HW Circuitry % lifetime remaining") PWR_SMOOTHING_MAX_NUM_PRESET_PROFILES = (259, "Max number of preset profiles") PWR_SMOOTHING_PROFILE_PERCENT_TMP_FLOOR = (260, "% TMP floor for a given profile") PWR_SMOOTHING_PROFILE_RAMP_UP_RATE = (261, "Ramp up rate in mW/s for a given profile") PWR_SMOOTHING_PROFILE_RAMP_DOWN_RATE = (262, "Ramp down rate in mW/s for a given profile") PWR_SMOOTHING_PROFILE_RAMP_DOWN_HYST_VAL = (263, "Ramp down hysteresis value in ms for a given profile") PWR_SMOOTHING_ACTIVE_PRESET_PROFILE = (264, "Active preset profile number") PWR_SMOOTHING_ADMIN_OVERRIDE_PERCENT_TMP_FLOOR = (265, "% TMP floor for a given profile") PWR_SMOOTHING_ADMIN_OVERRIDE_RAMP_UP_RATE = (266, "Ramp up rate in mW/s for a given profile") PWR_SMOOTHING_ADMIN_OVERRIDE_RAMP_DOWN_RATE = (267, "Ramp down rate in mW/s for a given profile") PWR_SMOOTHING_ADMIN_OVERRIDE_RAMP_DOWN_HYST_VAL = (268, "Ramp down hysteresis value in ms for a given profile") # Field values for Clock Throttle Reason Counters DEV_CLOCKS_EVENT_REASON_SW_POWER_CAP = (74, "Throttling to not exceed currently set power limits in ns") DEV_CLOCKS_EVENT_REASON_SYNC_BOOST = (76, "Throttling to match minimum possible clock across Sync Boost Group in ns") DEV_CLOCKS_EVENT_REASON_SW_THERM_SLOWDOWN = (269, "Throttling to ensure ((GPU temp < GPU Max Operating Temp) && (Memory Temp < Memory Max Operating Temp)) in ns") DEV_CLOCKS_EVENT_REASON_HW_THERM_SLOWDOWN = (270, "Throttling due to temperature being too high (reducing core clocks by a factor of 2 or more) in ns") DEV_CLOCKS_EVENT_REASON_HW_POWER_BRAKE_SLOWDOWN = (271, "Throttling due to external power brake assertion trigger (reducing core clocks by a factor of 2 or more) in ns") DEV_POWER_SYNC_BALANCING_FREQ = (272, "Accumulated frequency of the GPU to be used for averaging") DEV_POWER_SYNC_BALANCING_AF = (273, "Accumulated activity factor of the GPU to be used for averaging") DEV_EDPP_MULTIPLIER = (274, "EDPp multiplier expressed as a percentage") PWR_SMOOTHING_PRIMARY_POWER_FLOOR = (275, "Current primary power floor value in Watts") PWR_SMOOTHING_SECONDARY_POWER_FLOOR = (276, "Current secondary power floor value in Watts") PWR_SMOOTHING_MIN_PRIMARY_FLOOR_ACT_OFFSET = (277, "Minimum primary floor activation offset value in Watts") PWR_SMOOTHING_MIN_PRIMARY_FLOOR_ACT_POINT = (278, "Minimum primary floor activation point value in Watts") PWR_SMOOTHING_WINDOW_MULTIPLIER = (279, "Window Multiplier value in ms") PWR_SMOOTHING_DELAYED_PWR_SMOOTHING_SUPPORTED = (280, "Support (0/Not Supported or 1/Supported) for delayed power smoothing") PWR_SMOOTHING_PROFILE_SECONDARY_POWER_FLOOR = (281, "Current secondary power floor value in Watts for a given profile") PWR_SMOOTHING_PROFILE_PRIMARY_FLOOR_ACT_WIN_MULT = (282, "Current primary floor activation window multiplier value for a given profile") PWR_SMOOTHING_PROFILE_PRIMARY_FLOOR_TAR_WIN_MULT = (283, "Current primary floor target window multiplier value for a given profile") PWR_SMOOTHING_PROFILE_PRIMARY_FLOOR_ACT_OFFSET = (284, "Current primary floor activation offset value in Watts for a given profile") PWR_SMOOTHING_ADMIN_OVERRIDE_SECONDARY_POWER_FLOOR = (285, "Current secondary power floor value in Watts for admin override") PWR_SMOOTHING_ADMIN_OVERRIDE_PRIMARY_FLOOR_ACT_WIN_MULT = (286, "Current primary floor activation window multiplier value for admin override") PWR_SMOOTHING_ADMIN_OVERRIDE_PRIMARY_FLOOR_TAR_WIN_MULT = (287, "Current primary floor target window multiplier value for admin override") PWR_SMOOTHING_ADMIN_OVERRIDE_PRIMARY_FLOOR_ACT_OFFSET = (288, "Current primary floor activation offset value in Watts for admin override") DEV_ACTIVE_BANK_REMAPPINGS = (303, "Number of active bank remappings") DEV_INACTIVE_BANK_REMAPPINGS = (304, "Number of inactive bank remappings") DEV_BANK_REMAPPER_HISTOGRAM_MAX = (305, "Number of groups with full bank remap availability") DEV_BANK_REMAPPER_HISTOGRAM_NONE = (306, "Number of groups with no spare bank remap availability") DEV_PENDING_BANK_REMAPPING = (307, "If any banks are pending remapping. 1=yes 0=no") NVLINK_MAX_LINKS = 18 class RUSD(_FastEnum): POLL_NONE = (0x0, "Disable RUSD polling on all metric groups") POLL_CLOCK = (0x1, "Enable RUSD polling on clock group") POLL_PERF = (0x2, "Enable RUSD polling on performance group") POLL_MEMORY = (0x4, "Enable RUSD polling on memory group") POLL_POWER = (0x8, "Enable RUSD polling on power group") POLL_THERMAL = (0x10, "Enable RUSD polling on thermal group") POLL_PCI = (0x20, "Enable RUSD polling on pci group") POLL_FAN = (0x40, "Enable RUSD polling on fan group") POLL_PROC_UTIL = (0x80, "Enable RUSD polling on process utilization group") POLL_ALL = (0xFFFFFFFFFFFFFFFF, "Enable RUSD polling on all groups") class PowerMizerMode(_FastEnum): ADAPTIVE = (0, "Adjust GPU clocks based on GPU utilization") PREFER_MAXIMUM_PERFORMANCE = (1, "Raise GPU clocks to favor maximum performance, to the extent that thermal and other constraints allow") AUTO = (2, "PowerMizer mode is driver controlled") PREFER_CONSISTENT_PERFORMANCE = (3, "lock to GPU base clocks") class DeviceArch(_FastEnum): KEPLER = 2 MAXWELL = 3 PASCAL = 4 VOLTA = 5 TURING = 6 AMPERE = 7 ADA = 8 HOPPER = 9 BLACKWELL = 10 DLA = 11 DLA2 = 12 NPU3 = 15 UNKNOWN = 0xFFFFFFFF class BusType(_FastEnum): UNKNOWN = (0, "Unknown bus type") PCI = (1, "PCI bus") PCIE = (2, "PXI-Express bus") FPCI = (3, "FPCI bus") AGP = (4, "AGP bus") class FanControlPolicy(_FastEnum): TEMPERATURE_CONTINUOUS_SW = (0, "Temperature-controlled fan policy") MANUAL = (1, "Manual fan control policy") class PowerSource(_FastEnum): AC = 0x00000000 BATTERY = 0x00000001 UNDERSIZED = 0x00000002 class PcieLinkMaxSpeed(_FastEnum): SPEED_INVALID = 0x00000000 SPEED_2500MBPS = 0x00000001 SPEED_5000MBPS = 0x00000002 SPEED_8000MBPS = 0x00000003 SPEED_16000MBPS = 0x00000004 SPEED_32000MBPS = 0x00000005 SPEED_64000MBPS = 0x00000006 class AdaptiveClockingInfoStatus(_FastEnum): DISABLED = 0x00000000 ENABLED = 0x00000001 MAX_GPU_UTILIZATIONS = 8 class PcieAtomicsCap(_FastEnum): FETCHADD32 = (0x01, "32-bit fetch and add") FETCHADD64 = (0x02, "64-bit fetch and add") SWAP32 = (0x04, "32-bit swap") SWAP64 = (0x08, "64-bit swap") CAS32 = (0x10, "32-bit compare and swap") CAS64 = (0x20, "64-bit compare and swap") CAS128 = (0x40, "128-bit compare and swap") MAX = 7 class PowerScope(_FastEnum): GPU = (0, "Targets only GPU") MODULE = (1, "Targets the whole module") MEMORY = (2, "Targets the GPU memory") # Need "Enum" suffix to disambiguate from nvmlGridLicenseExpiry_t class GridLicenseExpiryEnum(_FastEnum): NOT_AVAILABLE = (0, "Expiry information not available") INVALID = (1, "Invalid expiry or error fetching expiry") VALID = (2, "Valid expiry") NOT_APPLICABLE = (3, "Expiry not applicable") PERMANENT = (4, "Permanent expiry") GRID_LICENSE_FEATURE_MAX_COUNT = 3 class VgpuVirtualizationCapMigration(_FastEnum): NO = 0x0 YES = 0x1 class VgpuPgpuVirtualizationCapMigration(_FastEnum): NO = 0x0 YES = 0x1 class VgpuSchedulerPolicy(_FastEnum): UNKNOWN = 0 BEST_EFFORT = 1 EQUAL_SHARE = 2 FIXED_SHARE = 3 class VgpuSchedulerArr(_FastEnum): DEFAULT = 0 DISABLE = 1 ENABLE = 2 class VgpuSchedulerEngineType(_FastEnum): GRAPHICS = 1 NVENC1 = 2 class GridLicenseState(_FastEnum): UNKNOWN = 0 UNINITIALIZED = 1 UNLICENSED_UNRESTRICTED = 2 UNLICENSED_RESTRICTED = 3 UNLICENSED = 4 LICENSED = 5 class NvlinkLowPowerThresholdUnit(_FastEnum): UNIT_100US = 0x0 UNIT_50US = 0x1 class NvlinkPowerState(_FastEnum): HIGH_SPEED = 0x0 LOW_SPEED = 0x1 class NvlinkLowPowerThreshold(_FastEnum): MIN = 0x1 MAX = 0x1FFF RESET = 0xFFFFFFFF DEFAULT = 0xFFFFFFFF class C2CPowerState(_FastEnum): FULL_POWER = 0 LOW_POWER = 1 class EventType(_FastEnum): NONE = 0x0000000000000000 SINGLE_BIT_ECC_ERROR = 0x0000000000000001 DOUBLE_BIT_ECC_ERROR = 0x0000000000000002 PSTATE = 0x0000000000000004 XID_CRITICAL_ERROR = 0x0000000000000008 CLOCK = 0x0000000000000010 POWER_SOURCE_CHANGE = 0x0000000000000080 MIG_CONFIG_CHANGE = 0x0000000000000100 SINGLE_BIT_ECC_ERROR_STORM = 0x0000000000000200 DRAM_RETIREMENT_EVENT = 0x0000000000000400 DRAM_RETIREMENT_FAILURE = 0x0000000000000800 NON_FATAL_POISON_ERROR = 0x0000000000001000 FATAL_POISON_ERROR = 0x0000000000002000 GPU_UNAVAILABLE_ERROR = 0x0000000000004000 GPU_RECOVERY_ACTION = 0x0000000000008000 class SystemEventType(_FastEnum): GPU_DRIVER_UNBIND = 0x0000000000000001 GPU_DRIVER_BIND = 0x0000000000000002 class ClocksEventReasons(_FastEnum): EVENT_REASON_GPU_IDLE = 0x0000000000000001 EVENT_REASON_APPLICATIONS_CLOCKS_SETTING = 0x0000000000000002 EVENT_REASON_SW_POWER_CAP = 0x0000000000000004 THROTTLE_REASON_HW_SLOWDOWN = 0x0000000000000008 EVENT_REASON_SYNC_BOOST = 0x0000000000000010 EVENT_REASON_SW_THERMAL_SLOWDOWN = 0x0000000000000020 THROTTLE_REASON_HW_THERMAL_SLOWDOWN = 0x0000000000000040 THROTTLE_REASON_HW_POWER_BRAKE_SLOWDOWN = 0x0000000000000080 EVENT_REASON_DISPLAY_CLOCK_SETTING = 0x0000000000000100 EVENT_REASON_BOARD_LIMIT = 0x0000000000000200 EVENT_REASON_RELIABILITY = 0x0000000000000400 EVENT_REASON_NONE = 0x0000000000000000 class EncoderQuery(_FastEnum): H264 = 0x00 HEVC = 0x01 AV1 = 0x02 UNKNOWN = 0xFF class NvFBCSessionFlag(_FastEnum): DIFFMAP_ENABLED = 0x00000001 CLASSIFICATIONMAP_ENABLED = 0x00000002 CAPTURE_WITH_WAIT_NO_WAIT = 0x00000004 CAPTURE_WITH_WAIT_INFINITE = 0x00000008 CAPTURE_WITH_WAIT_TIMEOUT = 0x00000010 class CCSystemCpuCaps(_FastEnum): NONE = 0 AMD_SEV = 1 INTEL_TDX = 2 AMD_SEV_SNP = 3 AMD_SNP_VTOM = 4 class CCSystemGpus(_FastEnum): CC_NOT_CAPABLE = 0 CC_CAPABLE = 1 class CCSystemDevtoolsMode(_FastEnum): OFF = 0 ON = 1 class CCSystemEnvironment(_FastEnum): UNAVAILABLE = 0 SIM = 1 PROD = 2 class CCSystemFeature(_FastEnum): DISABLED = 0 ENABLED = 1 class CCSystemMultiGpu(_FastEnum): NONE = 0 PROTECTED_PCIE = 1 NVLE = 2 class CCAcceptingClientRequests(_FastEnum): FALSE = 0 TRUE = 1 class GpuFabricState(_FastEnum): NOT_SUPPORTED = 0 NOT_STARTED = 1 IN_PROGRESS = 2 COMPLETED = 3 class GpuFabricHealthMaskDegradedBw(_FastEnum): NOT_SUPPORTED = 0 TRUE = 1 FALSE = 2 class GpuFabricHealthMaskRouteRecovery(_FastEnum): NOT_SUPPORTED = 0 TRUE = 1 FALSE = 2 class GpuFabricHealthMaskRouteUnhealthy(_FastEnum): NOT_SUPPORTED = 0 TRUE = 1 FALSE = 2 class GpuFabricHealthMaskAccessTimeout(_FastEnum): NOT_SUPPORTED = 0 TRUE = 1 FALSE = 2 class GpuFabricHealthMaskIncorrectConfiguration(_FastEnum): NOT_SUPPORTED = 0 NONE = 1 INCORRECT_SYSGUID = 2 INCORRECT_CHASSIS_SN = 3 NO_PARTITION = 4 INSUFFICIENT_NVLINKS = 5 INCOMPATIBLE_GPU_FW = 6 INVALID_LOCATION = 7 class GpuFabricHealthSummary(_FastEnum): NOT_SUPPORTED = 0 HEALTHY = 1 UNHEALTHY = 2 LIMITED_CAPACITY = 3 class InitFlag(_FastEnum): NO_GPUS = 1 NO_ATTACH = 2 class NvlinkState(_FastEnum): INACTIVE = 0x0 ACTIVE = 0x1 SLEEP = 0x2 ACTIVE_TRAFFIC_DISABLED = 0x3 class NvlinkFirmwareUcodeType(_FastEnum): MSE = 0x1 NETIR = 0x2 NETIR_UPHY = 0x3 NETIR_CLN = 0x4 NETIR_DLN = 0x5 class DeviceMig(_FastEnum): DISABLE = 0 ENABLE = 1 class GpuInstanceProfile(_FastEnum): PROFILE_1_SLICE = 0x0 PROFILE_2_SLICE = 0x1 PROFILE_3_SLICE = 0x2 PROFILE_4_SLICE = 0x3 PROFILE_7_SLICE = 0x4 PROFILE_8_SLICE = 0x5 PROFILE_6_SLICE = 0x6 PROFILE_1_SLICE_REV1 = 0x7 PROFILE_2_SLICE_REV1 = 0x8 PROFILE_1_SLICE_REV2 = 0x9 PROFILE_1_SLICE_GFX = 0x0A PROFILE_2_SLICE_GFX = 0x0B PROFILE_4_SLICE_GFX = 0x0C PROFILE_1_SLICE_NO_ME = 0x0D PROFILE_2_SLICE_NO_ME = 0x0E PROFILE_1_SLICE_ALL_ME = 0x0F PROFILE_2_SLICE_ALL_ME = 0x10 PROFILE_COUNT = 0x11 class GpuInstanceProfileCaps(_FastEnum): P2P = 0x1 GFX = 0x2 class ComputeInstanceProfileCaps(_FastEnum): GFX = 0x1 class ComputeInstanceProfile(_FastEnum): PROFILE_1_SLICE = 0x0 PROFILE_2_SLICE = 0x1 PROFILE_3_SLICE = 0x2 PROFILE_4_SLICE = 0x3 PROFILE_7_SLICE = 0x4 PROFILE_8_SLICE = 0x5 PROFILE_6_SLICE = 0x6 PROFILE_1_SLICE_REV1 = 0x7 PROFILE_COUNT = 0x8 class ComputeInstanceEngineProfile(_FastEnum): SHARED = 0x0 COUNT = 0x1 class PowerSmoothingProfileParam(_FastEnum): PERCENT_TMP_FLOOR = 0 RAMP_UP_RATE = 1 RAMP_DOWN_RATE = 2 RAMP_DOWN_HYSTERESIS = 3 SECONDARY_POWER_FLOOR = 4 PRIMARY_FLOOR_ACT_WIN_MULT = 5 PRIMARY_FLOOR_TAR_WIN_MULT = 6 PRIMARY_FLOOR_ACT_OFFSET = 7 class VgpuPgpu(_FastEnum): HETEROGENEOUS_MODE = 0 # Heterogeneous vGPU mode. HOMOGENEOUS_MODE = 1 # Homogeneous vGPU mode. ############################################################################### # Error handling ############################################################################### class NvmlError(Exception): def __init__(self, status): self.status = status s = error_string(status) super(NvmlError, self).__init__(s) def __reduce__(self): return (type(self), (self.status,)) class UninitializedError(NvmlError): pass class InvalidArgumentError(NvmlError): pass class NotSupportedError(NvmlError): pass class NoPermissionError(NvmlError): pass class AlreadyInitializedError(NvmlError): pass class NotFoundError(NvmlError): pass class InsufficientSizeError(NvmlError): pass class InsufficientPowerError(NvmlError): pass class DriverNotLoadedError(NvmlError): pass class NvmlTimeoutError(NvmlError): pass class IrqIssueError(NvmlError): pass class LibraryNotFoundError(NvmlError): pass class FunctionNotFoundError(NvmlError): pass class CorruptedInforomError(NvmlError): pass class GpuIsLostError(NvmlError): pass class ResetRequiredError(NvmlError): pass class OperatingSystemError(NvmlError): pass class LibRmVersionMismatchError(NvmlError): pass class InUseError(NvmlError): pass class NvmlMemoryError(NvmlError): pass class NoDataError(NvmlError): pass class VgpuEccNotSupportedError(NvmlError): pass class InsufficientResourcesError(NvmlError): pass class FreqNotSupportedError(NvmlError): pass class ArgumentVersionMismatchError(NvmlError): pass class DeprecatedError(NvmlError): pass class NotReadyError(NvmlError): pass class GpuNotFoundError(NvmlError): pass class InvalidStateError(NvmlError): pass class ResetTypeNotSupportedError(NvmlError): pass class UnknownError(NvmlError): pass cdef object _nvml_error_factory(int status): cdef object pystatus = status if status == 1: return UninitializedError(pystatus) elif status == 2: return InvalidArgumentError(pystatus) elif status == 3: return NotSupportedError(pystatus) elif status == 4: return NoPermissionError(pystatus) elif status == 5: return AlreadyInitializedError(pystatus) elif status == 6: return NotFoundError(pystatus) elif status == 7: return InsufficientSizeError(pystatus) elif status == 8: return InsufficientPowerError(pystatus) elif status == 9: return DriverNotLoadedError(pystatus) elif status == 10: return NvmlTimeoutError(pystatus) elif status == 11: return IrqIssueError(pystatus) elif status == 12: return LibraryNotFoundError(pystatus) elif status == 13: return FunctionNotFoundError(pystatus) elif status == 14: return CorruptedInforomError(pystatus) elif status == 15: return GpuIsLostError(pystatus) elif status == 16: return ResetRequiredError(pystatus) elif status == 17: return OperatingSystemError(pystatus) elif status == 18: return LibRmVersionMismatchError(pystatus) elif status == 19: return InUseError(pystatus) elif status == 20: return NvmlMemoryError(pystatus) elif status == 21: return NoDataError(pystatus) elif status == 22: return VgpuEccNotSupportedError(pystatus) elif status == 23: return InsufficientResourcesError(pystatus) elif status == 24: return FreqNotSupportedError(pystatus) elif status == 25: return ArgumentVersionMismatchError(pystatus) elif status == 26: return DeprecatedError(pystatus) elif status == 27: return NotReadyError(pystatus) elif status == 28: return GpuNotFoundError(pystatus) elif status == 29: return InvalidStateError(pystatus) elif status == 30: return ResetTypeNotSupportedError(pystatus) elif status == 999: return UnknownError(pystatus) return NvmlError(status) @cython.profile(False) cpdef int check_status(int status) except 1 nogil: if status != 0: with gil: raise _nvml_error_factory(status) return status != 0 @cython.profile(False) cpdef int check_status_size(int status) except 1 nogil: if status == nvmlReturn_t.NVML_ERROR_INSUFFICIENT_SIZE: return 0 return check_status(status) ############################################################################### # Wrapper functions ############################################################################### cdef _get_pci_info_ext_v1_dtype_offsets(): cdef nvmlPciInfoExt_v1_t *pod = _cyb_calloc(1, sizeof(nvmlPciInfoExt_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlPciInfoExt_v1_t") try: return _numpy.dtype({ 'names': ['version', 'domain', 'bus', 'device_', 'pci_device_id', 'pci_sub_system_id', 'base_class', 'sub_class', 'bus_id'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, (_numpy.int8, 32)], 'offsets': [ (&(pod.version)) - (pod), (&(pod.domain)) - (pod), (&(pod.bus)) - (pod), (&(pod.device)) - (pod), (&(pod.pciDeviceId)) - (pod), (&(pod.pciSubSystemId)) - (pod), (&(pod.baseClass)) - (pod), (&(pod.subClass)) - (pod), (&(pod.busId)) - (pod), ], 'itemsize': sizeof(nvmlPciInfoExt_v1_t), }) finally: _cyb_free(pod) pci_info_ext_v1_dtype = _get_pci_info_ext_v1_dtype_offsets() cdef class PciInfoExt_v1: """Empty-initialize an instance of `nvmlPciInfoExt_v1_t`. .. seealso:: `nvmlPciInfoExt_v1_t` """ cdef: nvmlPciInfoExt_v1_t _data nvmlPciInfoExt_v1_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.PciInfoExt_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef PciInfoExt_v1 other_ if not isinstance(other, PciInfoExt_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlPciInfoExt_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlPciInfoExt_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def version(self): """int: The version number of this struct.""" return self._ptr[0].version @version.setter def version(self, val): if self._readonly: raise ValueError("This PciInfoExt_v1 instance is read-only") self._ptr[0].version = val @property def domain(self): """int: The PCI domain on which the device's bus resides, 0 to 0xffffffff.""" return self._ptr[0].domain @domain.setter def domain(self, val): if self._readonly: raise ValueError("This PciInfoExt_v1 instance is read-only") self._ptr[0].domain = val @property def bus(self): """int: The bus on which the device resides, 0 to 0xff.""" return self._ptr[0].bus @bus.setter def bus(self, val): if self._readonly: raise ValueError("This PciInfoExt_v1 instance is read-only") self._ptr[0].bus = val @property def device_(self): """int: The device's id on the bus, 0 to 31.""" return self._ptr[0].device @device_.setter def device_(self, val): if self._readonly: raise ValueError("This PciInfoExt_v1 instance is read-only") self._ptr[0].device = val @property def pci_device_id(self): """int: The combined 16-bit device id and 16-bit vendor id.""" return self._ptr[0].pciDeviceId @pci_device_id.setter def pci_device_id(self, val): if self._readonly: raise ValueError("This PciInfoExt_v1 instance is read-only") self._ptr[0].pciDeviceId = val @property def pci_sub_system_id(self): """int: The 32-bit Sub System Device ID.""" return self._ptr[0].pciSubSystemId @pci_sub_system_id.setter def pci_sub_system_id(self, val): if self._readonly: raise ValueError("This PciInfoExt_v1 instance is read-only") self._ptr[0].pciSubSystemId = val @property def base_class(self): """int: The 8-bit PCI base class code.""" return self._ptr[0].baseClass @base_class.setter def base_class(self, val): if self._readonly: raise ValueError("This PciInfoExt_v1 instance is read-only") self._ptr[0].baseClass = val @property def sub_class(self): """int: The 8-bit PCI sub class code.""" return self._ptr[0].subClass @sub_class.setter def sub_class(self, val): if self._readonly: raise ValueError("This PciInfoExt_v1 instance is read-only") self._ptr[0].subClass = val @property def bus_id(self): """~_numpy.int8: (array of length 32).The tuple domain:bus:device.function PCI identifier (& NULL terminator).""" return _cyb_cpython.PyUnicode_FromString(self._ptr[0].busId) @bus_id.setter def bus_id(self, val): if self._readonly: raise ValueError("This PciInfoExt_v1 instance is read-only") cdef bytes buf = val.encode() if len(buf) >= 32: raise ValueError("String too long for field bus_id, max length is 31") cdef char *ptr = buf _cyb_memcpy((self._ptr[0].busId), ptr, 32) @staticmethod def from_buffer(buffer): """Create an PciInfoExt_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlPciInfoExt_v1_t), PciInfoExt_v1) @staticmethod def from_data(data): """Create an PciInfoExt_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `pci_info_ext_v1_dtype` holding the data. """ return _cyb_from_data(data, "pci_info_ext_v1_dtype", pci_info_ext_v1_dtype, PciInfoExt_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an PciInfoExt_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef PciInfoExt_v1 obj = PciInfoExt_v1.__new__(PciInfoExt_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlPciInfoExt_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_pci_info_dtype_offsets(): cdef nvmlPciInfo_t *pod = _cyb_calloc(1, sizeof(nvmlPciInfo_t)) if pod == NULL: raise MemoryError("Error allocating nvmlPciInfo_t") try: return _numpy.dtype({ 'names': ['bus_id_legacy', 'domain', 'bus', 'device_', 'pci_device_id', 'pci_sub_system_id', 'bus_id'], 'formats': [(_numpy.int8, 16), _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, (_numpy.int8, 32)], 'offsets': [ (&(pod.busIdLegacy)) - (pod), (&(pod.domain)) - (pod), (&(pod.bus)) - (pod), (&(pod.device)) - (pod), (&(pod.pciDeviceId)) - (pod), (&(pod.pciSubSystemId)) - (pod), (&(pod.busId)) - (pod), ], 'itemsize': sizeof(nvmlPciInfo_t), }) finally: _cyb_free(pod) pci_info_dtype = _get_pci_info_dtype_offsets() cdef class PciInfo: """Empty-initialize an instance of `nvmlPciInfo_t`. .. seealso:: `nvmlPciInfo_t` """ cdef: nvmlPciInfo_t *_ptr object _owner 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._readonly = False def __dealloc__(self): cdef nvmlPciInfo_t *ptr if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) def __repr__(self): return f"<{__name__}.PciInfo object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef PciInfo other_ if not isinstance(other, PciInfo): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlPciInfo_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlPciInfo_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def bus_id_legacy(self): """~_numpy.int8: (array of length 16).""" return _cyb_cpython.PyUnicode_FromString(self._ptr[0].busIdLegacy) @bus_id_legacy.setter def bus_id_legacy(self, val): if self._readonly: raise ValueError("This PciInfo instance is read-only") cdef bytes buf = val.encode() if len(buf) >= 16: raise ValueError("String too long for field bus_id_legacy, max length is 15") cdef char *ptr = buf _cyb_memcpy((self._ptr[0].busIdLegacy), ptr, 16) @property def domain(self): """int: """ return self._ptr[0].domain @domain.setter def domain(self, val): if self._readonly: raise ValueError("This PciInfo instance is read-only") self._ptr[0].domain = val @property def bus(self): """int: """ return self._ptr[0].bus @bus.setter def bus(self, val): if self._readonly: raise ValueError("This PciInfo instance is read-only") self._ptr[0].bus = val @property def device_(self): """int: """ return self._ptr[0].device @device_.setter def device_(self, val): if self._readonly: raise ValueError("This PciInfo instance is read-only") self._ptr[0].device = val @property def pci_device_id(self): """int: """ return self._ptr[0].pciDeviceId @pci_device_id.setter def pci_device_id(self, val): if self._readonly: raise ValueError("This PciInfo instance is read-only") self._ptr[0].pciDeviceId = val @property def pci_sub_system_id(self): """int: """ return self._ptr[0].pciSubSystemId @pci_sub_system_id.setter def pci_sub_system_id(self, val): if self._readonly: raise ValueError("This PciInfo instance is read-only") self._ptr[0].pciSubSystemId = val @property def bus_id(self): """~_numpy.int8: (array of length 32).""" return _cyb_cpython.PyUnicode_FromString(self._ptr[0].busId) @bus_id.setter def bus_id(self, val): if self._readonly: raise ValueError("This PciInfo instance is read-only") cdef bytes buf = val.encode() if len(buf) >= 32: raise ValueError("String too long for field bus_id, max length is 31") cdef char *ptr = buf _cyb_memcpy((self._ptr[0].busId), ptr, 32) @staticmethod def from_buffer(buffer): """Create an PciInfo instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlPciInfo_t), PciInfo) @staticmethod def from_data(data): """Create an PciInfo instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `pci_info_dtype` holding the data. """ return _cyb_from_data(data, "pci_info_dtype", pci_info_dtype, PciInfo) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an PciInfo instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef PciInfo obj = PciInfo.__new__(PciInfo) if owner is None: obj._ptr = _cyb_malloc(sizeof(nvmlPciInfo_t)) if obj._ptr == NULL: raise MemoryError("Error allocating PciInfo") _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlPciInfo_t)) obj._owns_ptr = True obj._owner = None else: obj._ptr = ptr obj._owns_ptr = False obj._owner = owner obj._readonly = readonly return obj cdef _get_utilization_dtype_offsets(): cdef nvmlUtilization_t *pod = _cyb_calloc(1, sizeof(nvmlUtilization_t)) if pod == NULL: raise MemoryError("Error allocating nvmlUtilization_t") try: return _numpy.dtype({ 'names': ['gpu', 'memory'], 'formats': [_numpy.uint32, _numpy.uint32], 'offsets': [ (&(pod.gpu)) - (pod), (&(pod.memory)) - (pod), ], 'itemsize': sizeof(nvmlUtilization_t), }) finally: _cyb_free(pod) utilization_dtype = _get_utilization_dtype_offsets() cdef class Utilization: """Empty-initialize an instance of `nvmlUtilization_t`. .. seealso:: `nvmlUtilization_t` """ cdef: nvmlUtilization_t _data nvmlUtilization_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.Utilization object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef Utilization other_ if not isinstance(other, Utilization): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlUtilization_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlUtilization_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def gpu(self): """int: """ return self._ptr[0].gpu @gpu.setter def gpu(self, val): if self._readonly: raise ValueError("This Utilization instance is read-only") self._ptr[0].gpu = val @property def memory(self): """int: """ return self._ptr[0].memory @memory.setter def memory(self, val): if self._readonly: raise ValueError("This Utilization instance is read-only") self._ptr[0].memory = val @staticmethod def from_buffer(buffer): """Create an Utilization instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlUtilization_t), Utilization) @staticmethod def from_data(data): """Create an Utilization instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `utilization_dtype` holding the data. """ return _cyb_from_data(data, "utilization_dtype", utilization_dtype, Utilization) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an Utilization instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef Utilization obj = Utilization.__new__(Utilization) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlUtilization_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_memory_dtype_offsets(): cdef nvmlMemory_t *pod = _cyb_calloc(1, sizeof(nvmlMemory_t)) if pod == NULL: raise MemoryError("Error allocating nvmlMemory_t") try: return _numpy.dtype({ 'names': ['total', 'free', 'used'], 'formats': [_numpy.uint64, _numpy.uint64, _numpy.uint64], 'offsets': [ (&(pod.total)) - (pod), (&(pod.free)) - (pod), (&(pod.used)) - (pod), ], 'itemsize': sizeof(nvmlMemory_t), }) finally: _cyb_free(pod) memory_dtype = _get_memory_dtype_offsets() cdef class Memory: """Empty-initialize an instance of `nvmlMemory_t`. .. seealso:: `nvmlMemory_t` """ cdef: nvmlMemory_t _data nvmlMemory_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.Memory object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef Memory other_ if not isinstance(other, Memory): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlMemory_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlMemory_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def total(self): """int: """ return self._ptr[0].total @total.setter def total(self, val): if self._readonly: raise ValueError("This Memory instance is read-only") self._ptr[0].total = val @property def free(self): """int: """ return self._ptr[0].free @free.setter def free(self, val): if self._readonly: raise ValueError("This Memory instance is read-only") self._ptr[0].free = val @property def used(self): """int: """ return self._ptr[0].used @used.setter def used(self, val): if self._readonly: raise ValueError("This Memory instance is read-only") self._ptr[0].used = val @staticmethod def from_buffer(buffer): """Create an Memory instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlMemory_t), Memory) @staticmethod def from_data(data): """Create an Memory instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `memory_dtype` holding the data. """ return _cyb_from_data(data, "memory_dtype", memory_dtype, Memory) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an Memory instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef Memory obj = Memory.__new__(Memory) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlMemory_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_memory_v2_dtype_offsets(): cdef nvmlMemory_v2_t *pod = _cyb_calloc(1, sizeof(nvmlMemory_v2_t)) if pod == NULL: raise MemoryError("Error allocating nvmlMemory_v2_t") try: return _numpy.dtype({ 'names': ['version', 'total', 'reserved', 'free', 'used'], 'formats': [_numpy.uint32, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64], 'offsets': [ (&(pod.version)) - (pod), (&(pod.total)) - (pod), (&(pod.reserved)) - (pod), (&(pod.free)) - (pod), (&(pod.used)) - (pod), ], 'itemsize': sizeof(nvmlMemory_v2_t), }) finally: _cyb_free(pod) memory_v2_dtype = _get_memory_v2_dtype_offsets() cdef class Memory_v2: """Empty-initialize an instance of `nvmlMemory_v2_t`. .. seealso:: `nvmlMemory_v2_t` """ cdef: nvmlMemory_v2_t _data nvmlMemory_v2_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.Memory_v2 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef Memory_v2 other_ if not isinstance(other, Memory_v2): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlMemory_v2_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlMemory_v2_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def version(self): """int: """ return self._ptr[0].version @version.setter def version(self, val): if self._readonly: raise ValueError("This Memory_v2 instance is read-only") self._ptr[0].version = val @property def total(self): """int: """ return self._ptr[0].total @total.setter def total(self, val): if self._readonly: raise ValueError("This Memory_v2 instance is read-only") self._ptr[0].total = val @property def reserved(self): """int: """ return self._ptr[0].reserved @reserved.setter def reserved(self, val): if self._readonly: raise ValueError("This Memory_v2 instance is read-only") self._ptr[0].reserved = val @property def free(self): """int: """ return self._ptr[0].free @free.setter def free(self, val): if self._readonly: raise ValueError("This Memory_v2 instance is read-only") self._ptr[0].free = val @property def used(self): """int: """ return self._ptr[0].used @used.setter def used(self, val): if self._readonly: raise ValueError("This Memory_v2 instance is read-only") self._ptr[0].used = val @staticmethod def from_buffer(buffer): """Create an Memory_v2 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlMemory_v2_t), Memory_v2) @staticmethod def from_data(data): """Create an Memory_v2 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `memory_v2_dtype` holding the data. """ return _cyb_from_data(data, "memory_v2_dtype", memory_v2_dtype, Memory_v2) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an Memory_v2 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef Memory_v2 obj = Memory_v2.__new__(Memory_v2) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlMemory_v2_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_ba_r1memory_dtype_offsets(): cdef nvmlBAR1Memory_t *pod = _cyb_calloc(1, sizeof(nvmlBAR1Memory_t)) if pod == NULL: raise MemoryError("Error allocating nvmlBAR1Memory_t") try: return _numpy.dtype({ 'names': ['bar1_total', 'bar1_free', 'bar1_used'], 'formats': [_numpy.uint64, _numpy.uint64, _numpy.uint64], 'offsets': [ (&(pod.bar1Total)) - (pod), (&(pod.bar1Free)) - (pod), (&(pod.bar1Used)) - (pod), ], 'itemsize': sizeof(nvmlBAR1Memory_t), }) finally: _cyb_free(pod) ba_r1memory_dtype = _get_ba_r1memory_dtype_offsets() cdef class BAR1Memory: """Empty-initialize an instance of `nvmlBAR1Memory_t`. .. seealso:: `nvmlBAR1Memory_t` """ cdef: nvmlBAR1Memory_t _data nvmlBAR1Memory_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.BAR1Memory object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef BAR1Memory other_ if not isinstance(other, BAR1Memory): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlBAR1Memory_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlBAR1Memory_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def bar1_total(self): """int: """ return self._ptr[0].bar1Total @bar1_total.setter def bar1_total(self, val): if self._readonly: raise ValueError("This BAR1Memory instance is read-only") self._ptr[0].bar1Total = val @property def bar1_free(self): """int: """ return self._ptr[0].bar1Free @bar1_free.setter def bar1_free(self, val): if self._readonly: raise ValueError("This BAR1Memory instance is read-only") self._ptr[0].bar1Free = val @property def bar1_used(self): """int: """ return self._ptr[0].bar1Used @bar1_used.setter def bar1_used(self, val): if self._readonly: raise ValueError("This BAR1Memory instance is read-only") self._ptr[0].bar1Used = val @staticmethod def from_buffer(buffer): """Create an BAR1Memory instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlBAR1Memory_t), BAR1Memory) @staticmethod def from_data(data): """Create an BAR1Memory instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `ba_r1memory_dtype` holding the data. """ return _cyb_from_data(data, "ba_r1memory_dtype", ba_r1memory_dtype, BAR1Memory) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an BAR1Memory instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef BAR1Memory obj = BAR1Memory.__new__(BAR1Memory) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlBAR1Memory_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_process_info_dtype_offsets(): cdef nvmlProcessInfo_t *pod = _cyb_calloc(1, sizeof(nvmlProcessInfo_t)) if pod == NULL: raise MemoryError("Error allocating nvmlProcessInfo_t") try: return _numpy.dtype({ 'names': ['pid', 'used_gpu_memory', 'gpu_instance_id', 'compute_instance_id'], 'formats': [_numpy.uint32, _numpy.uint64, _numpy.uint32, _numpy.uint32], 'offsets': [ (&(pod.pid)) - (pod), (&(pod.usedGpuMemory)) - (pod), (&(pod.gpuInstanceId)) - (pod), (&(pod.computeInstanceId)) - (pod), ], 'itemsize': sizeof(nvmlProcessInfo_t), }) finally: _cyb_free(pod) process_info_dtype = _get_process_info_dtype_offsets() cdef object process_info_dtype_record = _numpy.dtype((_numpy.record, process_info_dtype)) cdef class ProcessInfo: """Empty-initialize an array of `nvmlProcessInfo_t`. The resulting object is of length `size` and of dtype `process_info_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `nvmlProcessInfo_t` """ cdef: readonly object _data object _owner def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=process_info_dtype_record) assert self._data.itemsize == sizeof(nvmlProcessInfo_t), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlProcessInfo_t) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}.ProcessInfo_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}.ProcessInfo object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, ProcessInfo)) 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 pid(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["pid"][0]) return self._data["pid"] @pid.setter def pid(self, val): if not self._data.flags.writeable: raise ValueError("This ProcessInfo instance is read-only") self._data["pid"] = val @property def used_gpu_memory(self): """Union[~_numpy.uint64, int]: """ if self._data.size == 1: return int(self._data["used_gpu_memory"][0]) return self._data["used_gpu_memory"] @used_gpu_memory.setter def used_gpu_memory(self, val): if not self._data.flags.writeable: raise ValueError("This ProcessInfo instance is read-only") self._data["used_gpu_memory"] = val @property def gpu_instance_id(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["gpu_instance_id"][0]) return self._data["gpu_instance_id"] @gpu_instance_id.setter def gpu_instance_id(self, val): if not self._data.flags.writeable: raise ValueError("This ProcessInfo instance is read-only") self._data["gpu_instance_id"] = val @property def compute_instance_id(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["compute_instance_id"][0]) return self._data["compute_instance_id"] @compute_instance_id.setter def compute_instance_id(self, val): if not self._data.flags.writeable: raise ValueError("This ProcessInfo instance is read-only") self._data["compute_instance_id"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef ProcessInfo obj 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 obj = ProcessInfo.__new__(ProcessInfo) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == process_info_dtype: obj = ProcessInfo.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an ProcessInfo instance with the memory from the given buffer.""" return ProcessInfo.from_data(_numpy.frombuffer(buffer, dtype=process_info_dtype)) @staticmethod def from_data(data): """Create an ProcessInfo instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `process_info_dtype` holding the data. """ cdef ProcessInfo obj = ProcessInfo.__new__(ProcessInfo) 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 != process_info_dtype: raise ValueError("data array must be of dtype process_info_dtype") obj._data = data.view(dtype=process_info_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an ProcessInfo 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 ProcessInfo obj = ProcessInfo.__new__(ProcessInfo) 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(nvmlProcessInfo_t) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=process_info_dtype_record) obj._owner = owner return obj cdef _get_process_detail_v1_dtype_offsets(): cdef nvmlProcessDetail_v1_t *pod = _cyb_calloc(1, sizeof(nvmlProcessDetail_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlProcessDetail_v1_t") try: return _numpy.dtype({ 'names': ['pid', 'used_gpu_memory', 'gpu_instance_id', 'compute_instance_id', 'used_gpu_cc_protected_memory'], 'formats': [_numpy.uint32, _numpy.uint64, _numpy.uint32, _numpy.uint32, _numpy.uint64], 'offsets': [ (&(pod.pid)) - (pod), (&(pod.usedGpuMemory)) - (pod), (&(pod.gpuInstanceId)) - (pod), (&(pod.computeInstanceId)) - (pod), (&(pod.usedGpuCcProtectedMemory)) - (pod), ], 'itemsize': sizeof(nvmlProcessDetail_v1_t), }) finally: _cyb_free(pod) process_detail_v1_dtype = _get_process_detail_v1_dtype_offsets() cdef object process_detail_v1_dtype_record = _numpy.dtype((_numpy.record, process_detail_v1_dtype)) cdef class ProcessDetail_v1: """Empty-initialize an array of `nvmlProcessDetail_v1_t`. The resulting object is of length `size` and of dtype `process_detail_v1_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `nvmlProcessDetail_v1_t` """ cdef: readonly object _data object _owner def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=process_detail_v1_dtype_record) assert self._data.itemsize == sizeof(nvmlProcessDetail_v1_t), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlProcessDetail_v1_t) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}.ProcessDetail_v1_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}.ProcessDetail_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, ProcessDetail_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 pid(self): """Union[~_numpy.uint32, int]: Process ID.""" if self._data.size == 1: return int(self._data["pid"][0]) return self._data["pid"] @pid.setter def pid(self, val): if not self._data.flags.writeable: raise ValueError("This ProcessDetail_v1 instance is read-only") self._data["pid"] = val @property def used_gpu_memory(self): """Union[~_numpy.uint64, int]: Amount of used GPU memory in bytes. Under WDDM, NVML_VALUE_NOT_AVAILABLE is always reported because Windows KMD manages all the memory and not the NVIDIA driver""" if self._data.size == 1: return int(self._data["used_gpu_memory"][0]) return self._data["used_gpu_memory"] @used_gpu_memory.setter def used_gpu_memory(self, val): if not self._data.flags.writeable: raise ValueError("This ProcessDetail_v1 instance is read-only") self._data["used_gpu_memory"] = val @property def gpu_instance_id(self): """Union[~_numpy.uint32, int]: If MIG is enabled, stores a valid GPU instance ID. gpuInstanceId is.""" if self._data.size == 1: return int(self._data["gpu_instance_id"][0]) return self._data["gpu_instance_id"] @gpu_instance_id.setter def gpu_instance_id(self, val): if not self._data.flags.writeable: raise ValueError("This ProcessDetail_v1 instance is read-only") self._data["gpu_instance_id"] = val @property def compute_instance_id(self): """Union[~_numpy.uint32, int]: If MIG is enabled, stores a valid compute instance ID. computeInstanceId.""" if self._data.size == 1: return int(self._data["compute_instance_id"][0]) return self._data["compute_instance_id"] @compute_instance_id.setter def compute_instance_id(self, val): if not self._data.flags.writeable: raise ValueError("This ProcessDetail_v1 instance is read-only") self._data["compute_instance_id"] = val @property def used_gpu_cc_protected_memory(self): """Union[~_numpy.uint64, int]: Amount of used GPU conf compute protected memory in bytes.""" if self._data.size == 1: return int(self._data["used_gpu_cc_protected_memory"][0]) return self._data["used_gpu_cc_protected_memory"] @used_gpu_cc_protected_memory.setter def used_gpu_cc_protected_memory(self, val): if not self._data.flags.writeable: raise ValueError("This ProcessDetail_v1 instance is read-only") self._data["used_gpu_cc_protected_memory"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef ProcessDetail_v1 obj 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 obj = ProcessDetail_v1.__new__(ProcessDetail_v1) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == process_detail_v1_dtype: obj = ProcessDetail_v1.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an ProcessDetail_v1 instance with the memory from the given buffer.""" return ProcessDetail_v1.from_data(_numpy.frombuffer(buffer, dtype=process_detail_v1_dtype)) @staticmethod def from_data(data): """Create an ProcessDetail_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `process_detail_v1_dtype` holding the data. """ cdef ProcessDetail_v1 obj = ProcessDetail_v1.__new__(ProcessDetail_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 != process_detail_v1_dtype: raise ValueError("data array must be of dtype process_detail_v1_dtype") obj._data = data.view(dtype=process_detail_v1_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an ProcessDetail_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 ProcessDetail_v1 obj = ProcessDetail_v1.__new__(ProcessDetail_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(nvmlProcessDetail_v1_t) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=process_detail_v1_dtype_record) obj._owner = owner return obj cdef _get_device_attributes_dtype_offsets(): cdef nvmlDeviceAttributes_t *pod = _cyb_calloc(1, sizeof(nvmlDeviceAttributes_t)) if pod == NULL: raise MemoryError("Error allocating nvmlDeviceAttributes_t") try: return _numpy.dtype({ 'names': ['multiprocessor_count', 'shared_copy_engine_count', 'shared_decoder_count', 'shared_encoder_count', 'shared_jpeg_count', 'shared_ofa_count', 'gpu_instance_slice_count', 'compute_instance_slice_count', 'memory_size_mb'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint64], 'offsets': [ (&(pod.multiprocessorCount)) - (pod), (&(pod.sharedCopyEngineCount)) - (pod), (&(pod.sharedDecoderCount)) - (pod), (&(pod.sharedEncoderCount)) - (pod), (&(pod.sharedJpegCount)) - (pod), (&(pod.sharedOfaCount)) - (pod), (&(pod.gpuInstanceSliceCount)) - (pod), (&(pod.computeInstanceSliceCount)) - (pod), (&(pod.memorySizeMB)) - (pod), ], 'itemsize': sizeof(nvmlDeviceAttributes_t), }) finally: _cyb_free(pod) device_attributes_dtype = _get_device_attributes_dtype_offsets() cdef class DeviceAttributes: """Empty-initialize an instance of `nvmlDeviceAttributes_t`. .. seealso:: `nvmlDeviceAttributes_t` """ cdef: nvmlDeviceAttributes_t _data nvmlDeviceAttributes_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.DeviceAttributes object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef DeviceAttributes other_ if not isinstance(other, DeviceAttributes): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlDeviceAttributes_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlDeviceAttributes_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def multiprocessor_count(self): """int: """ return self._ptr[0].multiprocessorCount @multiprocessor_count.setter def multiprocessor_count(self, val): if self._readonly: raise ValueError("This DeviceAttributes instance is read-only") self._ptr[0].multiprocessorCount = val @property def shared_copy_engine_count(self): """int: """ return self._ptr[0].sharedCopyEngineCount @shared_copy_engine_count.setter def shared_copy_engine_count(self, val): if self._readonly: raise ValueError("This DeviceAttributes instance is read-only") self._ptr[0].sharedCopyEngineCount = val @property def shared_decoder_count(self): """int: """ return self._ptr[0].sharedDecoderCount @shared_decoder_count.setter def shared_decoder_count(self, val): if self._readonly: raise ValueError("This DeviceAttributes instance is read-only") self._ptr[0].sharedDecoderCount = val @property def shared_encoder_count(self): """int: """ return self._ptr[0].sharedEncoderCount @shared_encoder_count.setter def shared_encoder_count(self, val): if self._readonly: raise ValueError("This DeviceAttributes instance is read-only") self._ptr[0].sharedEncoderCount = val @property def shared_jpeg_count(self): """int: """ return self._ptr[0].sharedJpegCount @shared_jpeg_count.setter def shared_jpeg_count(self, val): if self._readonly: raise ValueError("This DeviceAttributes instance is read-only") self._ptr[0].sharedJpegCount = val @property def shared_ofa_count(self): """int: """ return self._ptr[0].sharedOfaCount @shared_ofa_count.setter def shared_ofa_count(self, val): if self._readonly: raise ValueError("This DeviceAttributes instance is read-only") self._ptr[0].sharedOfaCount = val @property def gpu_instance_slice_count(self): """int: """ return self._ptr[0].gpuInstanceSliceCount @gpu_instance_slice_count.setter def gpu_instance_slice_count(self, val): if self._readonly: raise ValueError("This DeviceAttributes instance is read-only") self._ptr[0].gpuInstanceSliceCount = val @property def compute_instance_slice_count(self): """int: """ return self._ptr[0].computeInstanceSliceCount @compute_instance_slice_count.setter def compute_instance_slice_count(self, val): if self._readonly: raise ValueError("This DeviceAttributes instance is read-only") self._ptr[0].computeInstanceSliceCount = val @property def memory_size_mb(self): """int: """ return self._ptr[0].memorySizeMB @memory_size_mb.setter def memory_size_mb(self, val): if self._readonly: raise ValueError("This DeviceAttributes instance is read-only") self._ptr[0].memorySizeMB = val @staticmethod def from_buffer(buffer): """Create an DeviceAttributes instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlDeviceAttributes_t), DeviceAttributes) @staticmethod def from_data(data): """Create an DeviceAttributes instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `device_attributes_dtype` holding the data. """ return _cyb_from_data(data, "device_attributes_dtype", device_attributes_dtype, DeviceAttributes) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an DeviceAttributes instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef DeviceAttributes obj = DeviceAttributes.__new__(DeviceAttributes) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlDeviceAttributes_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_c2c_mode_info_v1_dtype_offsets(): cdef nvmlC2cModeInfo_v1_t *pod = _cyb_calloc(1, sizeof(nvmlC2cModeInfo_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlC2cModeInfo_v1_t") try: return _numpy.dtype({ 'names': ['is_c2c_enabled'], 'formats': [_numpy.uint32], 'offsets': [ (&(pod.isC2cEnabled)) - (pod), ], 'itemsize': sizeof(nvmlC2cModeInfo_v1_t), }) finally: _cyb_free(pod) c2c_mode_info_v1_dtype = _get_c2c_mode_info_v1_dtype_offsets() cdef class C2cModeInfo_v1: """Empty-initialize an instance of `nvmlC2cModeInfo_v1_t`. .. seealso:: `nvmlC2cModeInfo_v1_t` """ cdef: nvmlC2cModeInfo_v1_t _data nvmlC2cModeInfo_v1_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.C2cModeInfo_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef C2cModeInfo_v1 other_ if not isinstance(other, C2cModeInfo_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlC2cModeInfo_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlC2cModeInfo_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def is_c2c_enabled(self): """int: """ return self._ptr[0].isC2cEnabled @is_c2c_enabled.setter def is_c2c_enabled(self, val): if self._readonly: raise ValueError("This C2cModeInfo_v1 instance is read-only") self._ptr[0].isC2cEnabled = val @staticmethod def from_buffer(buffer): """Create an C2cModeInfo_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlC2cModeInfo_v1_t), C2cModeInfo_v1) @staticmethod def from_data(data): """Create an C2cModeInfo_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `c2c_mode_info_v1_dtype` holding the data. """ return _cyb_from_data(data, "c2c_mode_info_v1_dtype", c2c_mode_info_v1_dtype, C2cModeInfo_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an C2cModeInfo_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef C2cModeInfo_v1 obj = C2cModeInfo_v1.__new__(C2cModeInfo_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlC2cModeInfo_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_row_remapper_histogram_values_dtype_offsets(): cdef nvmlRowRemapperHistogramValues_t *pod = _cyb_calloc(1, sizeof(nvmlRowRemapperHistogramValues_t)) if pod == NULL: raise MemoryError("Error allocating nvmlRowRemapperHistogramValues_t") try: return _numpy.dtype({ 'names': ['max_', 'high', 'partial', 'low', 'none'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32], 'offsets': [ (&(pod.max)) - (pod), (&(pod.high)) - (pod), (&(pod.partial)) - (pod), (&(pod.low)) - (pod), (&(pod.none)) - (pod), ], 'itemsize': sizeof(nvmlRowRemapperHistogramValues_t), }) finally: _cyb_free(pod) row_remapper_histogram_values_dtype = _get_row_remapper_histogram_values_dtype_offsets() cdef class RowRemapperHistogramValues: """Empty-initialize an instance of `nvmlRowRemapperHistogramValues_t`. .. seealso:: `nvmlRowRemapperHistogramValues_t` """ cdef: nvmlRowRemapperHistogramValues_t _data nvmlRowRemapperHistogramValues_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.RowRemapperHistogramValues object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef RowRemapperHistogramValues other_ if not isinstance(other, RowRemapperHistogramValues): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlRowRemapperHistogramValues_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlRowRemapperHistogramValues_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def max_(self): """int: """ return self._ptr[0].max @max_.setter def max_(self, val): if self._readonly: raise ValueError("This RowRemapperHistogramValues instance is read-only") self._ptr[0].max = val @property def high(self): """int: """ return self._ptr[0].high @high.setter def high(self, val): if self._readonly: raise ValueError("This RowRemapperHistogramValues instance is read-only") self._ptr[0].high = val @property def partial(self): """int: """ return self._ptr[0].partial @partial.setter def partial(self, val): if self._readonly: raise ValueError("This RowRemapperHistogramValues instance is read-only") self._ptr[0].partial = val @property def low(self): """int: """ return self._ptr[0].low @low.setter def low(self, val): if self._readonly: raise ValueError("This RowRemapperHistogramValues instance is read-only") self._ptr[0].low = val @property def none(self): """int: """ return self._ptr[0].none @none.setter def none(self, val): if self._readonly: raise ValueError("This RowRemapperHistogramValues instance is read-only") self._ptr[0].none = val @staticmethod def from_buffer(buffer): """Create an RowRemapperHistogramValues instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlRowRemapperHistogramValues_t), RowRemapperHistogramValues) @staticmethod def from_data(data): """Create an RowRemapperHistogramValues instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `row_remapper_histogram_values_dtype` holding the data. """ return _cyb_from_data(data, "row_remapper_histogram_values_dtype", row_remapper_histogram_values_dtype, RowRemapperHistogramValues) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an RowRemapperHistogramValues instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef RowRemapperHistogramValues obj = RowRemapperHistogramValues.__new__(RowRemapperHistogramValues) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlRowRemapperHistogramValues_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_bridge_chip_info_dtype_offsets(): cdef nvmlBridgeChipInfo_t *pod = _cyb_calloc(1, sizeof(nvmlBridgeChipInfo_t)) if pod == NULL: raise MemoryError("Error allocating nvmlBridgeChipInfo_t") try: return _numpy.dtype({ 'names': ['type', 'fw_version'], 'formats': [_numpy.int32, _numpy.uint32], 'offsets': [ (&(pod.type)) - (pod), (&(pod.fwVersion)) - (pod), ], 'itemsize': sizeof(nvmlBridgeChipInfo_t), }) finally: _cyb_free(pod) bridge_chip_info_dtype = _get_bridge_chip_info_dtype_offsets() cdef object bridge_chip_info_dtype_record = _numpy.dtype((_numpy.record, bridge_chip_info_dtype)) cdef class BridgeChipInfo: """Empty-initialize an array of `nvmlBridgeChipInfo_t`. The resulting object is of length `size` and of dtype `bridge_chip_info_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `nvmlBridgeChipInfo_t` """ cdef: readonly object _data object _owner def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=bridge_chip_info_dtype_record) assert self._data.itemsize == sizeof(nvmlBridgeChipInfo_t), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlBridgeChipInfo_t) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}.BridgeChipInfo_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}.BridgeChipInfo object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, BridgeChipInfo)) 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 type(self): """Union[~_numpy.int32, int]: """ if self._data.size == 1: return int(self._data["type"][0]) return self._data["type"] @type.setter def type(self, val): if not self._data.flags.writeable: raise ValueError("This BridgeChipInfo instance is read-only") self._data["type"] = val @property def fw_version(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["fw_version"][0]) return self._data["fw_version"] @fw_version.setter def fw_version(self, val): if not self._data.flags.writeable: raise ValueError("This BridgeChipInfo instance is read-only") self._data["fw_version"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef BridgeChipInfo obj 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 obj = BridgeChipInfo.__new__(BridgeChipInfo) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == bridge_chip_info_dtype: obj = BridgeChipInfo.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an BridgeChipInfo instance with the memory from the given buffer.""" return BridgeChipInfo.from_data(_numpy.frombuffer(buffer, dtype=bridge_chip_info_dtype)) @staticmethod def from_data(data): """Create an BridgeChipInfo instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `bridge_chip_info_dtype` holding the data. """ cdef BridgeChipInfo obj = BridgeChipInfo.__new__(BridgeChipInfo) 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 != bridge_chip_info_dtype: raise ValueError("data array must be of dtype bridge_chip_info_dtype") obj._data = data.view(dtype=bridge_chip_info_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an BridgeChipInfo 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 BridgeChipInfo obj = BridgeChipInfo.__new__(BridgeChipInfo) 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(nvmlBridgeChipInfo_t) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=bridge_chip_info_dtype_record) obj._owner = owner return obj cdef _get_value_dtype_offsets(): cdef nvmlValue_t *pod = _cyb_calloc(1, sizeof(nvmlValue_t)) if pod == NULL: raise MemoryError("Error allocating nvmlValue_t") try: return _numpy.dtype({ 'names': ['d_val', 'si_val', 'ui_val', 'ul_val', 'ull_val', 'sll_val', 'us_val'], 'formats': [_numpy.float64, _numpy.int32, _numpy.uint32, _numpy.uint32, _numpy.uint64, _numpy.int64, _numpy.uint16], 'offsets': [ (&(pod.dVal)) - (pod), (&(pod.siVal)) - (pod), (&(pod.uiVal)) - (pod), (&(pod.ulVal)) - (pod), (&(pod.ullVal)) - (pod), (&(pod.sllVal)) - (pod), (&(pod.usVal)) - (pod), ], 'itemsize': sizeof(nvmlValue_t), }) finally: _cyb_free(pod) value_dtype = _get_value_dtype_offsets() cdef class Value: """Empty-initialize an instance of `nvmlValue_t`. .. seealso:: `nvmlValue_t` """ cdef: nvmlValue_t *_ptr object _owner 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._readonly = False def __dealloc__(self): cdef nvmlValue_t *ptr if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) def __repr__(self): return f"<{__name__}.Value object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef Value other_ if not isinstance(other, Value): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlValue_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlValue_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def d_val(self): """float: """ return self._ptr[0].dVal @d_val.setter def d_val(self, val): if self._readonly: raise ValueError("This Value instance is read-only") self._ptr[0].dVal = val @property def si_val(self): """int: """ return self._ptr[0].siVal @si_val.setter def si_val(self, val): if self._readonly: raise ValueError("This Value instance is read-only") self._ptr[0].siVal = val @property def ui_val(self): """int: """ return self._ptr[0].uiVal @ui_val.setter def ui_val(self, val): if self._readonly: raise ValueError("This Value instance is read-only") self._ptr[0].uiVal = val @property def ul_val(self): """int: """ return self._ptr[0].ulVal @ul_val.setter def ul_val(self, val): if self._readonly: raise ValueError("This Value instance is read-only") self._ptr[0].ulVal = val @property def ull_val(self): """int: """ return self._ptr[0].ullVal @ull_val.setter def ull_val(self, val): if self._readonly: raise ValueError("This Value instance is read-only") self._ptr[0].ullVal = val @property def sll_val(self): """int: """ return self._ptr[0].sllVal @sll_val.setter def sll_val(self, val): if self._readonly: raise ValueError("This Value instance is read-only") self._ptr[0].sllVal = val @property def us_val(self): """int: """ return self._ptr[0].usVal @us_val.setter def us_val(self, val): if self._readonly: raise ValueError("This Value instance is read-only") self._ptr[0].usVal = val @staticmethod def from_buffer(buffer): """Create an Value instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlValue_t), Value) @staticmethod def from_data(data): """Create an Value instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `value_dtype` holding the data. """ return _cyb_from_data(data, "value_dtype", value_dtype, Value) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an Value instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef Value obj = Value.__new__(Value) if owner is None: obj._ptr = _cyb_malloc(sizeof(nvmlValue_t)) if obj._ptr == NULL: raise MemoryError("Error allocating Value") _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlValue_t)) obj._owns_ptr = True obj._owner = None else: obj._ptr = ptr obj._owns_ptr = False obj._owner = owner obj._readonly = readonly return obj cdef _get__py_anon_pod0_dtype_offsets(): cdef cuda_bindings_nvml__anon_pod0 *pod = _cyb_calloc(1, sizeof(cuda_bindings_nvml__anon_pod0)) if pod == NULL: raise MemoryError("Error allocating cuda_bindings_nvml__anon_pod0") try: return _numpy.dtype({ 'names': ['controller', 'default_min_temp', 'default_max_temp', 'current_temp', 'target'], 'formats': [_numpy.int32, _numpy.int32, _numpy.int32, _numpy.int32, _numpy.int32], 'offsets': [ (&(pod.controller)) - (pod), (&(pod.defaultMinTemp)) - (pod), (&(pod.defaultMaxTemp)) - (pod), (&(pod.currentTemp)) - (pod), (&(pod.target)) - (pod), ], 'itemsize': sizeof(cuda_bindings_nvml__anon_pod0), }) finally: _cyb_free(pod) _py_anon_pod0_dtype = _get__py_anon_pod0_dtype_offsets() cdef object _py_anon_pod0_dtype_record = _numpy.dtype((_numpy.record, _py_anon_pod0_dtype)) cdef class _py_anon_pod0: """Empty-initialize an array of `cuda_bindings_nvml__anon_pod0`. The resulting object is of length `size` and of dtype `_py_anon_pod0_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `cuda_bindings_nvml__anon_pod0` """ cdef: readonly object _data object _owner def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=_py_anon_pod0_dtype_record) assert self._data.itemsize == sizeof(cuda_bindings_nvml__anon_pod0), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(cuda_bindings_nvml__anon_pod0) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}._py_anon_pod0_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}._py_anon_pod0 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, _py_anon_pod0)) 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 controller(self): """Union[~_numpy.int32, int]: """ if self._data.size == 1: return int(self._data["controller"][0]) return self._data["controller"] @controller.setter def controller(self, val): if not self._data.flags.writeable: raise ValueError("This _py_anon_pod0 instance is read-only") self._data["controller"] = val @property def default_min_temp(self): """Union[~_numpy.int32, int]: """ if self._data.size == 1: return int(self._data["default_min_temp"][0]) return self._data["default_min_temp"] @default_min_temp.setter def default_min_temp(self, val): if not self._data.flags.writeable: raise ValueError("This _py_anon_pod0 instance is read-only") self._data["default_min_temp"] = val @property def default_max_temp(self): """Union[~_numpy.int32, int]: """ if self._data.size == 1: return int(self._data["default_max_temp"][0]) return self._data["default_max_temp"] @default_max_temp.setter def default_max_temp(self, val): if not self._data.flags.writeable: raise ValueError("This _py_anon_pod0 instance is read-only") self._data["default_max_temp"] = val @property def current_temp(self): """Union[~_numpy.int32, int]: """ if self._data.size == 1: return int(self._data["current_temp"][0]) return self._data["current_temp"] @current_temp.setter def current_temp(self, val): if not self._data.flags.writeable: raise ValueError("This _py_anon_pod0 instance is read-only") self._data["current_temp"] = val @property def target(self): """Union[~_numpy.int32, int]: """ if self._data.size == 1: return int(self._data["target"][0]) return self._data["target"] @target.setter def target(self, val): if not self._data.flags.writeable: raise ValueError("This _py_anon_pod0 instance is read-only") self._data["target"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef _py_anon_pod0 obj 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 obj = _py_anon_pod0.__new__(_py_anon_pod0) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == _py_anon_pod0_dtype: obj = _py_anon_pod0.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an _py_anon_pod0 instance with the memory from the given buffer.""" return _py_anon_pod0.from_data(_numpy.frombuffer(buffer, dtype=_py_anon_pod0_dtype)) @staticmethod def from_data(data): """Create an _py_anon_pod0 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `_py_anon_pod0_dtype` holding the data. """ cdef _py_anon_pod0 obj = _py_anon_pod0.__new__(_py_anon_pod0) 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 != _py_anon_pod0_dtype: raise ValueError("data array must be of dtype _py_anon_pod0_dtype") obj._data = data.view(dtype=_py_anon_pod0_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an _py_anon_pod0 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 _py_anon_pod0 obj = _py_anon_pod0.__new__(_py_anon_pod0) 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(cuda_bindings_nvml__anon_pod0) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=_py_anon_pod0_dtype_record) obj._owner = owner return obj cdef _get_cooler_info_v1_dtype_offsets(): cdef nvmlCoolerInfo_v1_t *pod = _cyb_calloc(1, sizeof(nvmlCoolerInfo_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlCoolerInfo_v1_t") try: return _numpy.dtype({ 'names': ['version', 'index', 'signal_type', 'target'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.int32, _numpy.int32], 'offsets': [ (&(pod.version)) - (pod), (&(pod.index)) - (pod), (&(pod.signalType)) - (pod), (&(pod.target)) - (pod), ], 'itemsize': sizeof(nvmlCoolerInfo_v1_t), }) finally: _cyb_free(pod) cooler_info_v1_dtype = _get_cooler_info_v1_dtype_offsets() cdef class CoolerInfo_v1: """Empty-initialize an instance of `nvmlCoolerInfo_v1_t`. .. seealso:: `nvmlCoolerInfo_v1_t` """ cdef: nvmlCoolerInfo_v1_t _data nvmlCoolerInfo_v1_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.CoolerInfo_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef CoolerInfo_v1 other_ if not isinstance(other, CoolerInfo_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlCoolerInfo_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlCoolerInfo_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def version(self): """int: the API version number""" return self._ptr[0].version @version.setter def version(self, val): if self._readonly: raise ValueError("This CoolerInfo_v1 instance is read-only") self._ptr[0].version = val @property def index(self): """int: the cooler index""" return self._ptr[0].index @index.setter def index(self, val): if self._readonly: raise ValueError("This CoolerInfo_v1 instance is read-only") self._ptr[0].index = val @property def signal_type(self): """int: OUT: the cooler's control signal characteristics.""" return (self._ptr[0].signalType) @signal_type.setter def signal_type(self, val): if self._readonly: raise ValueError("This CoolerInfo_v1 instance is read-only") self._ptr[0].signalType = val @property def target(self): """int: OUT: the target that cooler cools.""" return (self._ptr[0].target) @target.setter def target(self, val): if self._readonly: raise ValueError("This CoolerInfo_v1 instance is read-only") self._ptr[0].target = val @staticmethod def from_buffer(buffer): """Create an CoolerInfo_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlCoolerInfo_v1_t), CoolerInfo_v1) @staticmethod def from_data(data): """Create an CoolerInfo_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `cooler_info_v1_dtype` holding the data. """ return _cyb_from_data(data, "cooler_info_v1_dtype", cooler_info_v1_dtype, CoolerInfo_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an CoolerInfo_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef CoolerInfo_v1 obj = CoolerInfo_v1.__new__(CoolerInfo_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlCoolerInfo_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_clk_mon_fault_info_dtype_offsets(): cdef nvmlClkMonFaultInfo_t *pod = _cyb_calloc(1, sizeof(nvmlClkMonFaultInfo_t)) if pod == NULL: raise MemoryError("Error allocating nvmlClkMonFaultInfo_t") try: return _numpy.dtype({ 'names': ['clk_api_domain', 'clk_domain_fault_mask'], 'formats': [_numpy.uint32, _numpy.uint32], 'offsets': [ (&(pod.clkApiDomain)) - (pod), (&(pod.clkDomainFaultMask)) - (pod), ], 'itemsize': sizeof(nvmlClkMonFaultInfo_t), }) finally: _cyb_free(pod) clk_mon_fault_info_dtype = _get_clk_mon_fault_info_dtype_offsets() cdef object clk_mon_fault_info_dtype_record = _numpy.dtype((_numpy.record, clk_mon_fault_info_dtype)) cdef class ClkMonFaultInfo: """Empty-initialize an array of `nvmlClkMonFaultInfo_t`. The resulting object is of length `size` and of dtype `clk_mon_fault_info_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `nvmlClkMonFaultInfo_t` """ cdef: readonly object _data object _owner def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=clk_mon_fault_info_dtype_record) assert self._data.itemsize == sizeof(nvmlClkMonFaultInfo_t), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlClkMonFaultInfo_t) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}.ClkMonFaultInfo_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}.ClkMonFaultInfo object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, ClkMonFaultInfo)) 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 clk_api_domain(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["clk_api_domain"][0]) return self._data["clk_api_domain"] @clk_api_domain.setter def clk_api_domain(self, val): if not self._data.flags.writeable: raise ValueError("This ClkMonFaultInfo instance is read-only") self._data["clk_api_domain"] = val @property def clk_domain_fault_mask(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["clk_domain_fault_mask"][0]) return self._data["clk_domain_fault_mask"] @clk_domain_fault_mask.setter def clk_domain_fault_mask(self, val): if not self._data.flags.writeable: raise ValueError("This ClkMonFaultInfo instance is read-only") self._data["clk_domain_fault_mask"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef ClkMonFaultInfo obj 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 obj = ClkMonFaultInfo.__new__(ClkMonFaultInfo) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == clk_mon_fault_info_dtype: obj = ClkMonFaultInfo.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an ClkMonFaultInfo instance with the memory from the given buffer.""" return ClkMonFaultInfo.from_data(_numpy.frombuffer(buffer, dtype=clk_mon_fault_info_dtype)) @staticmethod def from_data(data): """Create an ClkMonFaultInfo instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `clk_mon_fault_info_dtype` holding the data. """ cdef ClkMonFaultInfo obj = ClkMonFaultInfo.__new__(ClkMonFaultInfo) 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 != clk_mon_fault_info_dtype: raise ValueError("data array must be of dtype clk_mon_fault_info_dtype") obj._data = data.view(dtype=clk_mon_fault_info_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an ClkMonFaultInfo 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 ClkMonFaultInfo obj = ClkMonFaultInfo.__new__(ClkMonFaultInfo) 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(nvmlClkMonFaultInfo_t) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=clk_mon_fault_info_dtype_record) obj._owner = owner return obj cdef _get_clock_offset_v1_dtype_offsets(): cdef nvmlClockOffset_v1_t *pod = _cyb_calloc(1, sizeof(nvmlClockOffset_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlClockOffset_v1_t") try: return _numpy.dtype({ 'names': ['version', 'type', 'pstate', 'clock_offset_m_hz', 'min_clock_offset_m_hz', 'max_clock_offset_m_hz'], 'formats': [_numpy.uint32, _numpy.int32, _numpy.int32, _numpy.int32, _numpy.int32, _numpy.int32], 'offsets': [ (&(pod.version)) - (pod), (&(pod.type)) - (pod), (&(pod.pstate)) - (pod), (&(pod.clockOffsetMHz)) - (pod), (&(pod.minClockOffsetMHz)) - (pod), (&(pod.maxClockOffsetMHz)) - (pod), ], 'itemsize': sizeof(nvmlClockOffset_v1_t), }) finally: _cyb_free(pod) clock_offset_v1_dtype = _get_clock_offset_v1_dtype_offsets() cdef class ClockOffset_v1: """Empty-initialize an instance of `nvmlClockOffset_v1_t`. .. seealso:: `nvmlClockOffset_v1_t` """ cdef: nvmlClockOffset_v1_t _data nvmlClockOffset_v1_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.ClockOffset_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef ClockOffset_v1 other_ if not isinstance(other, ClockOffset_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlClockOffset_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlClockOffset_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def version(self): """int: The version number of this struct.""" return self._ptr[0].version @version.setter def version(self, val): if self._readonly: raise ValueError("This ClockOffset_v1 instance is read-only") self._ptr[0].version = val @property def type(self): """int: """ return (self._ptr[0].type) @type.setter def type(self, val): if self._readonly: raise ValueError("This ClockOffset_v1 instance is read-only") self._ptr[0].type = val @property def pstate(self): """int: """ return (self._ptr[0].pstate) @pstate.setter def pstate(self, val): if self._readonly: raise ValueError("This ClockOffset_v1 instance is read-only") self._ptr[0].pstate = val @property def clock_offset_m_hz(self): """int: """ return self._ptr[0].clockOffsetMHz @clock_offset_m_hz.setter def clock_offset_m_hz(self, val): if self._readonly: raise ValueError("This ClockOffset_v1 instance is read-only") self._ptr[0].clockOffsetMHz = val @property def min_clock_offset_m_hz(self): """int: """ return self._ptr[0].minClockOffsetMHz @min_clock_offset_m_hz.setter def min_clock_offset_m_hz(self, val): if self._readonly: raise ValueError("This ClockOffset_v1 instance is read-only") self._ptr[0].minClockOffsetMHz = val @property def max_clock_offset_m_hz(self): """int: """ return self._ptr[0].maxClockOffsetMHz @max_clock_offset_m_hz.setter def max_clock_offset_m_hz(self, val): if self._readonly: raise ValueError("This ClockOffset_v1 instance is read-only") self._ptr[0].maxClockOffsetMHz = val @staticmethod def from_buffer(buffer): """Create an ClockOffset_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlClockOffset_v1_t), ClockOffset_v1) @staticmethod def from_data(data): """Create an ClockOffset_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `clock_offset_v1_dtype` holding the data. """ return _cyb_from_data(data, "clock_offset_v1_dtype", clock_offset_v1_dtype, ClockOffset_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an ClockOffset_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef ClockOffset_v1 obj = ClockOffset_v1.__new__(ClockOffset_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlClockOffset_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_process_utilization_sample_dtype_offsets(): cdef nvmlProcessUtilizationSample_t *pod = _cyb_calloc(1, sizeof(nvmlProcessUtilizationSample_t)) if pod == NULL: raise MemoryError("Error allocating nvmlProcessUtilizationSample_t") try: return _numpy.dtype({ 'names': ['pid', 'time_stamp', 'sm_util', 'mem_util', 'enc_util', 'dec_util'], 'formats': [_numpy.uint32, _numpy.uint64, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32], 'offsets': [ (&(pod.pid)) - (pod), (&(pod.timeStamp)) - (pod), (&(pod.smUtil)) - (pod), (&(pod.memUtil)) - (pod), (&(pod.encUtil)) - (pod), (&(pod.decUtil)) - (pod), ], 'itemsize': sizeof(nvmlProcessUtilizationSample_t), }) finally: _cyb_free(pod) process_utilization_sample_dtype = _get_process_utilization_sample_dtype_offsets() cdef object process_utilization_sample_dtype_record = _numpy.dtype((_numpy.record, process_utilization_sample_dtype)) cdef class ProcessUtilizationSample: """Empty-initialize an array of `nvmlProcessUtilizationSample_t`. The resulting object is of length `size` and of dtype `process_utilization_sample_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `nvmlProcessUtilizationSample_t` """ cdef: readonly object _data object _owner def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=process_utilization_sample_dtype_record) assert self._data.itemsize == sizeof(nvmlProcessUtilizationSample_t), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlProcessUtilizationSample_t) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}.ProcessUtilizationSample_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}.ProcessUtilizationSample object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, ProcessUtilizationSample)) 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 pid(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["pid"][0]) return self._data["pid"] @pid.setter def pid(self, val): if not self._data.flags.writeable: raise ValueError("This ProcessUtilizationSample instance is read-only") self._data["pid"] = 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): if not self._data.flags.writeable: raise ValueError("This ProcessUtilizationSample instance is read-only") self._data["time_stamp"] = val @property def sm_util(self): """Union[~_numpy.uint32, int]: """ 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): if not self._data.flags.writeable: raise ValueError("This ProcessUtilizationSample instance is read-only") self._data["sm_util"] = val @property def mem_util(self): """Union[~_numpy.uint32, int]: """ 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): if not self._data.flags.writeable: raise ValueError("This ProcessUtilizationSample instance is read-only") self._data["mem_util"] = val @property def enc_util(self): """Union[~_numpy.uint32, int]: """ 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): if not self._data.flags.writeable: raise ValueError("This ProcessUtilizationSample instance is read-only") self._data["enc_util"] = val @property def dec_util(self): """Union[~_numpy.uint32, int]: """ 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): if not self._data.flags.writeable: raise ValueError("This ProcessUtilizationSample instance is read-only") self._data["dec_util"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef ProcessUtilizationSample obj 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 obj = ProcessUtilizationSample.__new__(ProcessUtilizationSample) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == process_utilization_sample_dtype: obj = ProcessUtilizationSample.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an ProcessUtilizationSample instance with the memory from the given buffer.""" return ProcessUtilizationSample.from_data(_numpy.frombuffer(buffer, dtype=process_utilization_sample_dtype)) @staticmethod def from_data(data): """Create an ProcessUtilizationSample instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `process_utilization_sample_dtype` holding the data. """ cdef ProcessUtilizationSample obj = ProcessUtilizationSample.__new__(ProcessUtilizationSample) 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 != process_utilization_sample_dtype: raise ValueError("data array must be of dtype process_utilization_sample_dtype") obj._data = data.view(dtype=process_utilization_sample_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an ProcessUtilizationSample 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 ProcessUtilizationSample obj = ProcessUtilizationSample.__new__(ProcessUtilizationSample) 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(nvmlProcessUtilizationSample_t) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=process_utilization_sample_dtype_record) obj._owner = owner return obj cdef _get_process_utilization_info_v1_dtype_offsets(): cdef nvmlProcessUtilizationInfo_v1_t *pod = _cyb_calloc(1, sizeof(nvmlProcessUtilizationInfo_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlProcessUtilizationInfo_v1_t") try: return _numpy.dtype({ 'names': ['time_stamp', 'pid', 'sm_util', 'mem_util', 'enc_util', 'dec_util', 'jpg_util', 'ofa_util'], 'formats': [_numpy.uint64, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32], 'offsets': [ (&(pod.timeStamp)) - (pod), (&(pod.pid)) - (pod), (&(pod.smUtil)) - (pod), (&(pod.memUtil)) - (pod), (&(pod.encUtil)) - (pod), (&(pod.decUtil)) - (pod), (&(pod.jpgUtil)) - (pod), (&(pod.ofaUtil)) - (pod), ], 'itemsize': sizeof(nvmlProcessUtilizationInfo_v1_t), }) finally: _cyb_free(pod) process_utilization_info_v1_dtype = _get_process_utilization_info_v1_dtype_offsets() cdef object process_utilization_info_v1_dtype_record = _numpy.dtype((_numpy.record, process_utilization_info_v1_dtype)) cdef class ProcessUtilizationInfo_v1: """Empty-initialize an array of `nvmlProcessUtilizationInfo_v1_t`. The resulting object is of length `size` and of dtype `process_utilization_info_v1_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `nvmlProcessUtilizationInfo_v1_t` """ cdef: readonly object _data object _owner def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=process_utilization_info_v1_dtype_record) assert self._data.itemsize == sizeof(nvmlProcessUtilizationInfo_v1_t), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlProcessUtilizationInfo_v1_t) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}.ProcessUtilizationInfo_v1_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}.ProcessUtilizationInfo_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, ProcessUtilizationInfo_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 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): if not self._data.flags.writeable: raise ValueError("This ProcessUtilizationInfo_v1 instance is read-only") self._data["time_stamp"] = val @property def pid(self): """Union[~_numpy.uint32, int]: PID of process.""" if self._data.size == 1: return int(self._data["pid"][0]) return self._data["pid"] @pid.setter def pid(self, val): if not self._data.flags.writeable: raise ValueError("This ProcessUtilizationInfo_v1 instance is read-only") 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): if not self._data.flags.writeable: raise ValueError("This ProcessUtilizationInfo_v1 instance is read-only") 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): if not self._data.flags.writeable: raise ValueError("This ProcessUtilizationInfo_v1 instance is read-only") 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): if not self._data.flags.writeable: raise ValueError("This ProcessUtilizationInfo_v1 instance is read-only") 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): if not self._data.flags.writeable: raise ValueError("This ProcessUtilizationInfo_v1 instance is read-only") 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): if not self._data.flags.writeable: raise ValueError("This ProcessUtilizationInfo_v1 instance is read-only") 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): if not self._data.flags.writeable: raise ValueError("This ProcessUtilizationInfo_v1 instance is read-only") self._data["ofa_util"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef ProcessUtilizationInfo_v1 obj 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 obj = ProcessUtilizationInfo_v1.__new__(ProcessUtilizationInfo_v1) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == process_utilization_info_v1_dtype: obj = ProcessUtilizationInfo_v1.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an ProcessUtilizationInfo_v1 instance with the memory from the given buffer.""" return ProcessUtilizationInfo_v1.from_data(_numpy.frombuffer(buffer, dtype=process_utilization_info_v1_dtype)) @staticmethod def from_data(data): """Create an ProcessUtilizationInfo_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `process_utilization_info_v1_dtype` holding the data. """ cdef ProcessUtilizationInfo_v1 obj = ProcessUtilizationInfo_v1.__new__(ProcessUtilizationInfo_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 != process_utilization_info_v1_dtype: raise ValueError("data array must be of dtype process_utilization_info_v1_dtype") obj._data = data.view(dtype=process_utilization_info_v1_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an ProcessUtilizationInfo_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 ProcessUtilizationInfo_v1 obj = ProcessUtilizationInfo_v1.__new__(ProcessUtilizationInfo_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(nvmlProcessUtilizationInfo_v1_t) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=process_utilization_info_v1_dtype_record) obj._owner = owner return obj cdef _get_ecc_sram_error_status_v1_dtype_offsets(): cdef nvmlEccSramErrorStatus_v1_t *pod = _cyb_calloc(1, sizeof(nvmlEccSramErrorStatus_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlEccSramErrorStatus_v1_t") try: return _numpy.dtype({ 'names': ['version', 'aggregate_unc_parity', 'aggregate_unc_sec_ded', 'aggregate_cor', 'volatile_unc_parity', 'volatile_unc_sec_ded', 'volatile_cor', 'aggregate_unc_bucket_l2', 'aggregate_unc_bucket_sm', 'aggregate_unc_bucket_pcie', 'aggregate_unc_bucket_mcu', 'aggregate_unc_bucket_other', 'b_threshold_exceeded'], 'formats': [_numpy.uint32, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint32], 'offsets': [ (&(pod.version)) - (pod), (&(pod.aggregateUncParity)) - (pod), (&(pod.aggregateUncSecDed)) - (pod), (&(pod.aggregateCor)) - (pod), (&(pod.volatileUncParity)) - (pod), (&(pod.volatileUncSecDed)) - (pod), (&(pod.volatileCor)) - (pod), (&(pod.aggregateUncBucketL2)) - (pod), (&(pod.aggregateUncBucketSm)) - (pod), (&(pod.aggregateUncBucketPcie)) - (pod), (&(pod.aggregateUncBucketMcu)) - (pod), (&(pod.aggregateUncBucketOther)) - (pod), (&(pod.bThresholdExceeded)) - (pod), ], 'itemsize': sizeof(nvmlEccSramErrorStatus_v1_t), }) finally: _cyb_free(pod) ecc_sram_error_status_v1_dtype = _get_ecc_sram_error_status_v1_dtype_offsets() cdef class EccSramErrorStatus_v1: """Empty-initialize an instance of `nvmlEccSramErrorStatus_v1_t`. .. seealso:: `nvmlEccSramErrorStatus_v1_t` """ cdef: nvmlEccSramErrorStatus_v1_t _data nvmlEccSramErrorStatus_v1_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.EccSramErrorStatus_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef EccSramErrorStatus_v1 other_ if not isinstance(other, EccSramErrorStatus_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlEccSramErrorStatus_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlEccSramErrorStatus_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def version(self): """int: the API version number""" return self._ptr[0].version @version.setter def version(self, val): if self._readonly: raise ValueError("This EccSramErrorStatus_v1 instance is read-only") self._ptr[0].version = val @property def aggregate_unc_parity(self): """int: aggregate uncorrectable parity error count""" return self._ptr[0].aggregateUncParity @aggregate_unc_parity.setter def aggregate_unc_parity(self, val): if self._readonly: raise ValueError("This EccSramErrorStatus_v1 instance is read-only") self._ptr[0].aggregateUncParity = val @property def aggregate_unc_sec_ded(self): """int: aggregate uncorrectable SEC-DED error count""" return self._ptr[0].aggregateUncSecDed @aggregate_unc_sec_ded.setter def aggregate_unc_sec_ded(self, val): if self._readonly: raise ValueError("This EccSramErrorStatus_v1 instance is read-only") self._ptr[0].aggregateUncSecDed = val @property def aggregate_cor(self): """int: aggregate correctable error count""" return self._ptr[0].aggregateCor @aggregate_cor.setter def aggregate_cor(self, val): if self._readonly: raise ValueError("This EccSramErrorStatus_v1 instance is read-only") self._ptr[0].aggregateCor = val @property def volatile_unc_parity(self): """int: volatile uncorrectable parity error count""" return self._ptr[0].volatileUncParity @volatile_unc_parity.setter def volatile_unc_parity(self, val): if self._readonly: raise ValueError("This EccSramErrorStatus_v1 instance is read-only") self._ptr[0].volatileUncParity = val @property def volatile_unc_sec_ded(self): """int: volatile uncorrectable SEC-DED error count""" return self._ptr[0].volatileUncSecDed @volatile_unc_sec_ded.setter def volatile_unc_sec_ded(self, val): if self._readonly: raise ValueError("This EccSramErrorStatus_v1 instance is read-only") self._ptr[0].volatileUncSecDed = val @property def volatile_cor(self): """int: volatile correctable error count""" return self._ptr[0].volatileCor @volatile_cor.setter def volatile_cor(self, val): if self._readonly: raise ValueError("This EccSramErrorStatus_v1 instance is read-only") self._ptr[0].volatileCor = val @property def aggregate_unc_bucket_l2(self): """int: aggregate uncorrectable error count for L2 cache bucket""" return self._ptr[0].aggregateUncBucketL2 @aggregate_unc_bucket_l2.setter def aggregate_unc_bucket_l2(self, val): if self._readonly: raise ValueError("This EccSramErrorStatus_v1 instance is read-only") self._ptr[0].aggregateUncBucketL2 = val @property def aggregate_unc_bucket_sm(self): """int: aggregate uncorrectable error count for SM bucket""" return self._ptr[0].aggregateUncBucketSm @aggregate_unc_bucket_sm.setter def aggregate_unc_bucket_sm(self, val): if self._readonly: raise ValueError("This EccSramErrorStatus_v1 instance is read-only") self._ptr[0].aggregateUncBucketSm = val @property def aggregate_unc_bucket_pcie(self): """int: aggregate uncorrectable error count for PCIE bucket""" return self._ptr[0].aggregateUncBucketPcie @aggregate_unc_bucket_pcie.setter def aggregate_unc_bucket_pcie(self, val): if self._readonly: raise ValueError("This EccSramErrorStatus_v1 instance is read-only") self._ptr[0].aggregateUncBucketPcie = val @property def aggregate_unc_bucket_mcu(self): """int: aggregate uncorrectable error count for Microcontroller bucket""" return self._ptr[0].aggregateUncBucketMcu @aggregate_unc_bucket_mcu.setter def aggregate_unc_bucket_mcu(self, val): if self._readonly: raise ValueError("This EccSramErrorStatus_v1 instance is read-only") self._ptr[0].aggregateUncBucketMcu = val @property def aggregate_unc_bucket_other(self): """int: aggregate uncorrectable error count for Other bucket""" return self._ptr[0].aggregateUncBucketOther @aggregate_unc_bucket_other.setter def aggregate_unc_bucket_other(self, val): if self._readonly: raise ValueError("This EccSramErrorStatus_v1 instance is read-only") self._ptr[0].aggregateUncBucketOther = val @property def b_threshold_exceeded(self): """int: if the error threshold of field diag is exceeded""" return self._ptr[0].bThresholdExceeded @b_threshold_exceeded.setter def b_threshold_exceeded(self, val): if self._readonly: raise ValueError("This EccSramErrorStatus_v1 instance is read-only") self._ptr[0].bThresholdExceeded = val @staticmethod def from_buffer(buffer): """Create an EccSramErrorStatus_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlEccSramErrorStatus_v1_t), EccSramErrorStatus_v1) @staticmethod def from_data(data): """Create an EccSramErrorStatus_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `ecc_sram_error_status_v1_dtype` holding the data. """ return _cyb_from_data(data, "ecc_sram_error_status_v1_dtype", ecc_sram_error_status_v1_dtype, EccSramErrorStatus_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an EccSramErrorStatus_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef EccSramErrorStatus_v1 obj = EccSramErrorStatus_v1.__new__(EccSramErrorStatus_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlEccSramErrorStatus_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_platform_info_v1_dtype_offsets(): cdef nvmlPlatformInfo_v1_t *pod = _cyb_calloc(1, sizeof(nvmlPlatformInfo_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlPlatformInfo_v1_t") try: return _numpy.dtype({ 'names': ['version', 'ib_guid', 'rack_guid', 'chassis_physical_slot_number', 'compute_slot_index', 'node_index', 'peer_type', 'module_id'], 'formats': [_numpy.uint32, (_numpy.uint8, 16), (_numpy.uint8, 16), _numpy.uint8, _numpy.uint8, _numpy.uint8, _numpy.uint8, _numpy.uint8], 'offsets': [ (&(pod.version)) - (pod), (&(pod.ibGuid)) - (pod), (&(pod.rackGuid)) - (pod), (&(pod.chassisPhysicalSlotNumber)) - (pod), (&(pod.computeSlotIndex)) - (pod), (&(pod.nodeIndex)) - (pod), (&(pod.peerType)) - (pod), (&(pod.moduleId)) - (pod), ], 'itemsize': sizeof(nvmlPlatformInfo_v1_t), }) finally: _cyb_free(pod) platform_info_v1_dtype = _get_platform_info_v1_dtype_offsets() cdef class PlatformInfo_v1: """Empty-initialize an instance of `nvmlPlatformInfo_v1_t`. .. seealso:: `nvmlPlatformInfo_v1_t` """ cdef: nvmlPlatformInfo_v1_t _data nvmlPlatformInfo_v1_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.PlatformInfo_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef PlatformInfo_v1 other_ if not isinstance(other, PlatformInfo_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlPlatformInfo_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlPlatformInfo_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def version(self): """int: the API version number""" return self._ptr[0].version @version.setter def version(self, val): if self._readonly: raise ValueError("This PlatformInfo_v1 instance is read-only") self._ptr[0].version = val @property def ib_guid(self): """~_numpy.uint8: (array of length 16).Infiniband GUID reported by platform (for Blackwell, ibGuid is 8 bytes so indices 8-15 are zero).""" cdef _cyb_view.array arr = _cyb_view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False) arr.data = (&(self._ptr[0].ibGuid)) return _numpy.asarray(arr) @ib_guid.setter def ib_guid(self, val): if self._readonly: raise ValueError("This PlatformInfo_v1 instance is read-only") if len(val) != 16: raise ValueError(f"Expected length { 16 } for field ib_guid, got {len(val)}") cdef _cyb_view.array arr = _cyb_view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c") arr[:] = _numpy.asarray(val, dtype=_numpy.uint8) _cyb_memcpy((&(self._ptr[0].ibGuid)), (arr.data), sizeof(unsigned char) * len(val)) @property def rack_guid(self): """~_numpy.uint8: (array of length 16).GUID of the rack containing this GPU (for Blackwell rackGuid is 13 bytes so indices 13-15 are zero).""" cdef _cyb_view.array arr = _cyb_view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False) arr.data = (&(self._ptr[0].rackGuid)) return _numpy.asarray(arr) @rack_guid.setter def rack_guid(self, val): if self._readonly: raise ValueError("This PlatformInfo_v1 instance is read-only") if len(val) != 16: raise ValueError(f"Expected length { 16 } for field rack_guid, got {len(val)}") cdef _cyb_view.array arr = _cyb_view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c") arr[:] = _numpy.asarray(val, dtype=_numpy.uint8) _cyb_memcpy((&(self._ptr[0].rackGuid)), (arr.data), sizeof(unsigned char) * len(val)) @property def chassis_physical_slot_number(self): """int: The slot number in the rack containing this GPU (includes switches).""" return self._ptr[0].chassisPhysicalSlotNumber @chassis_physical_slot_number.setter def chassis_physical_slot_number(self, val): if self._readonly: raise ValueError("This PlatformInfo_v1 instance is read-only") self._ptr[0].chassisPhysicalSlotNumber = val @property def compute_slot_index(self): """int: The index within the compute slots in the rack containing this GPU (does not include switches).""" return self._ptr[0].computeSlotIndex @compute_slot_index.setter def compute_slot_index(self, val): if self._readonly: raise ValueError("This PlatformInfo_v1 instance is read-only") self._ptr[0].computeSlotIndex = val @property def node_index(self): """int: Index of the node within the slot containing this GPU.""" return self._ptr[0].nodeIndex @node_index.setter def node_index(self, val): if self._readonly: raise ValueError("This PlatformInfo_v1 instance is read-only") self._ptr[0].nodeIndex = val @property def peer_type(self): """int: Platform indicated NVLink-peer type (e.g. switch present or not).""" return self._ptr[0].peerType @peer_type.setter def peer_type(self, val): if self._readonly: raise ValueError("This PlatformInfo_v1 instance is read-only") self._ptr[0].peerType = val @property def module_id(self): """int: ID of this GPU within the node.""" return self._ptr[0].moduleId @module_id.setter def module_id(self, val): if self._readonly: raise ValueError("This PlatformInfo_v1 instance is read-only") self._ptr[0].moduleId = val @staticmethod def from_buffer(buffer): """Create an PlatformInfo_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlPlatformInfo_v1_t), PlatformInfo_v1) @staticmethod def from_data(data): """Create an PlatformInfo_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `platform_info_v1_dtype` holding the data. """ return _cyb_from_data(data, "platform_info_v1_dtype", platform_info_v1_dtype, PlatformInfo_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an PlatformInfo_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef PlatformInfo_v1 obj = PlatformInfo_v1.__new__(PlatformInfo_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlPlatformInfo_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_platform_info_v2_dtype_offsets(): cdef nvmlPlatformInfo_v2_t *pod = _cyb_calloc(1, sizeof(nvmlPlatformInfo_v2_t)) if pod == NULL: raise MemoryError("Error allocating nvmlPlatformInfo_v2_t") try: return _numpy.dtype({ 'names': ['version', 'ib_guid', 'chassis_serial_number', 'slot_number', 'tray_index', 'host_id', 'peer_type', 'module_id'], 'formats': [_numpy.uint32, (_numpy.uint8, 16), (_numpy.uint8, 16), _numpy.uint8, _numpy.uint8, _numpy.uint8, _numpy.uint8, _numpy.uint8], 'offsets': [ (&(pod.version)) - (pod), (&(pod.ibGuid)) - (pod), (&(pod.chassisSerialNumber)) - (pod), (&(pod.slotNumber)) - (pod), (&(pod.trayIndex)) - (pod), (&(pod.hostId)) - (pod), (&(pod.peerType)) - (pod), (&(pod.moduleId)) - (pod), ], 'itemsize': sizeof(nvmlPlatformInfo_v2_t), }) finally: _cyb_free(pod) platform_info_v2_dtype = _get_platform_info_v2_dtype_offsets() cdef class PlatformInfo_v2: """Empty-initialize an instance of `nvmlPlatformInfo_v2_t`. .. seealso:: `nvmlPlatformInfo_v2_t` """ cdef: nvmlPlatformInfo_v2_t _data nvmlPlatformInfo_v2_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.PlatformInfo_v2 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef PlatformInfo_v2 other_ if not isinstance(other, PlatformInfo_v2): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlPlatformInfo_v2_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlPlatformInfo_v2_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def version(self): """int: the API version number""" return self._ptr[0].version @version.setter def version(self, val): if self._readonly: raise ValueError("This PlatformInfo_v2 instance is read-only") self._ptr[0].version = val @property def ib_guid(self): """~_numpy.uint8: (array of length 16).Infiniband GUID reported by platform (for Blackwell, ibGuid is 8 bytes so indices 8-15 are zero).""" cdef _cyb_view.array arr = _cyb_view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False) arr.data = (&(self._ptr[0].ibGuid)) return _numpy.asarray(arr) @ib_guid.setter def ib_guid(self, val): if self._readonly: raise ValueError("This PlatformInfo_v2 instance is read-only") if len(val) != 16: raise ValueError(f"Expected length { 16 } for field ib_guid, got {len(val)}") cdef _cyb_view.array arr = _cyb_view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c") arr[:] = _numpy.asarray(val, dtype=_numpy.uint8) _cyb_memcpy((&(self._ptr[0].ibGuid)), (arr.data), sizeof(unsigned char) * len(val)) @property def chassis_serial_number(self): """~_numpy.uint8: (array of length 16).Serial number of the chassis containing this GPU (for Blackwell it is 13 bytes so indices 13-15 are zero).""" cdef _cyb_view.array arr = _cyb_view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False) arr.data = (&(self._ptr[0].chassisSerialNumber)) return _numpy.asarray(arr) @chassis_serial_number.setter def chassis_serial_number(self, val): if self._readonly: raise ValueError("This PlatformInfo_v2 instance is read-only") if len(val) != 16: raise ValueError(f"Expected length { 16 } for field chassis_serial_number, got {len(val)}") cdef _cyb_view.array arr = _cyb_view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c") arr[:] = _numpy.asarray(val, dtype=_numpy.uint8) _cyb_memcpy((&(self._ptr[0].chassisSerialNumber)), (arr.data), sizeof(unsigned char) * len(val)) @property def slot_number(self): """int: The slot number in the chassis containing this GPU (includes switches).""" return self._ptr[0].slotNumber @slot_number.setter def slot_number(self, val): if self._readonly: raise ValueError("This PlatformInfo_v2 instance is read-only") self._ptr[0].slotNumber = val @property def tray_index(self): """int: The tray index within the compute slots in the chassis containing this GPU (does not include switches).""" return self._ptr[0].trayIndex @tray_index.setter def tray_index(self, val): if self._readonly: raise ValueError("This PlatformInfo_v2 instance is read-only") self._ptr[0].trayIndex = val @property def host_id(self): """int: Index of the node within the slot containing this GPU.""" return self._ptr[0].hostId @host_id.setter def host_id(self, val): if self._readonly: raise ValueError("This PlatformInfo_v2 instance is read-only") self._ptr[0].hostId = val @property def peer_type(self): """int: Platform indicated NVLink-peer type (e.g. switch present or not).""" return self._ptr[0].peerType @peer_type.setter def peer_type(self, val): if self._readonly: raise ValueError("This PlatformInfo_v2 instance is read-only") self._ptr[0].peerType = val @property def module_id(self): """int: ID of this GPU within the node.""" return self._ptr[0].moduleId @module_id.setter def module_id(self, val): if self._readonly: raise ValueError("This PlatformInfo_v2 instance is read-only") self._ptr[0].moduleId = val @staticmethod def from_buffer(buffer): """Create an PlatformInfo_v2 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlPlatformInfo_v2_t), PlatformInfo_v2) @staticmethod def from_data(data): """Create an PlatformInfo_v2 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `platform_info_v2_dtype` holding the data. """ return _cyb_from_data(data, "platform_info_v2_dtype", platform_info_v2_dtype, PlatformInfo_v2) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an PlatformInfo_v2 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef PlatformInfo_v2 obj = PlatformInfo_v2.__new__(PlatformInfo_v2) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlPlatformInfo_v2_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get__py_anon_pod1_dtype_offsets(): cdef cuda_bindings_nvml__anon_pod1 *pod = _cyb_calloc(1, sizeof(cuda_bindings_nvml__anon_pod1)) if pod == NULL: raise MemoryError("Error allocating cuda_bindings_nvml__anon_pod1") try: return _numpy.dtype({ 'names': ['b_is_present', 'percentage', 'inc_threshold', 'dec_threshold'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32], 'offsets': [ (&(pod.bIsPresent)) - (pod), (&(pod.percentage)) - (pod), (&(pod.incThreshold)) - (pod), (&(pod.decThreshold)) - (pod), ], 'itemsize': sizeof(cuda_bindings_nvml__anon_pod1), }) finally: _cyb_free(pod) _py_anon_pod1_dtype = _get__py_anon_pod1_dtype_offsets() cdef object _py_anon_pod1_dtype_record = _numpy.dtype((_numpy.record, _py_anon_pod1_dtype)) cdef class _py_anon_pod1: """Empty-initialize an array of `cuda_bindings_nvml__anon_pod1`. The resulting object is of length `size` and of dtype `_py_anon_pod1_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `cuda_bindings_nvml__anon_pod1` """ cdef: readonly object _data object _owner def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=_py_anon_pod1_dtype_record) assert self._data.itemsize == sizeof(cuda_bindings_nvml__anon_pod1), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(cuda_bindings_nvml__anon_pod1) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}._py_anon_pod1_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}._py_anon_pod1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, _py_anon_pod1)) 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 b_is_present(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["b_is_present"][0]) return self._data["b_is_present"] @b_is_present.setter def b_is_present(self, val): if not self._data.flags.writeable: raise ValueError("This _py_anon_pod1 instance is read-only") self._data["b_is_present"] = val @property def percentage(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["percentage"][0]) return self._data["percentage"] @percentage.setter def percentage(self, val): if not self._data.flags.writeable: raise ValueError("This _py_anon_pod1 instance is read-only") self._data["percentage"] = val @property def inc_threshold(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["inc_threshold"][0]) return self._data["inc_threshold"] @inc_threshold.setter def inc_threshold(self, val): if not self._data.flags.writeable: raise ValueError("This _py_anon_pod1 instance is read-only") self._data["inc_threshold"] = val @property def dec_threshold(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["dec_threshold"][0]) return self._data["dec_threshold"] @dec_threshold.setter def dec_threshold(self, val): if not self._data.flags.writeable: raise ValueError("This _py_anon_pod1 instance is read-only") self._data["dec_threshold"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef _py_anon_pod1 obj 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 obj = _py_anon_pod1.__new__(_py_anon_pod1) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == _py_anon_pod1_dtype: obj = _py_anon_pod1.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an _py_anon_pod1 instance with the memory from the given buffer.""" return _py_anon_pod1.from_data(_numpy.frombuffer(buffer, dtype=_py_anon_pod1_dtype)) @staticmethod def from_data(data): """Create an _py_anon_pod1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `_py_anon_pod1_dtype` holding the data. """ cdef _py_anon_pod1 obj = _py_anon_pod1.__new__(_py_anon_pod1) 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 != _py_anon_pod1_dtype: raise ValueError("data array must be of dtype _py_anon_pod1_dtype") obj._data = data.view(dtype=_py_anon_pod1_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an _py_anon_pod1 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 _py_anon_pod1 obj = _py_anon_pod1.__new__(_py_anon_pod1) 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(cuda_bindings_nvml__anon_pod1) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=_py_anon_pod1_dtype_record) obj._owner = owner return obj cdef _get_vgpu_placement_list_v2_dtype_offsets(): cdef nvmlVgpuPlacementList_v2_t *pod = _cyb_calloc(1, sizeof(nvmlVgpuPlacementList_v2_t)) if pod == NULL: raise MemoryError("Error allocating nvmlVgpuPlacementList_v2_t") try: return _numpy.dtype({ 'names': ['version', 'placement_size', 'count', 'placement_ids', 'mode'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.intp, _numpy.uint32], 'offsets': [ (&(pod.version)) - (pod), (&(pod.placementSize)) - (pod), (&(pod.count)) - (pod), (&(pod.placementIds)) - (pod), (&(pod.mode)) - (pod), ], 'itemsize': sizeof(nvmlVgpuPlacementList_v2_t), }) finally: _cyb_free(pod) vgpu_placement_list_v2_dtype = _get_vgpu_placement_list_v2_dtype_offsets() cdef class VgpuPlacementList_v2: """Empty-initialize an instance of `nvmlVgpuPlacementList_v2_t`. .. seealso:: `nvmlVgpuPlacementList_v2_t` """ cdef: nvmlVgpuPlacementList_v2_t _data nvmlVgpuPlacementList_v2_t *_ptr object _owner bint _readonly dict _refs def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False self._refs = {} def __repr__(self): return f"<{__name__}.VgpuPlacementList_v2 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef VgpuPlacementList_v2 other_ if not isinstance(other, VgpuPlacementList_v2): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuPlacementList_v2_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuPlacementList_v2_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def version(self): """int: IN: The version number of this struct.""" return self._ptr[0].version @version.setter def version(self, val): if self._readonly: raise ValueError("This VgpuPlacementList_v2 instance is read-only") self._ptr[0].version = val @property def placement_size(self): """int: OUT: The number of slots occupied by the vGPU type.""" return self._ptr[0].placementSize @placement_size.setter def placement_size(self, val): if self._readonly: raise ValueError("This VgpuPlacementList_v2 instance is read-only") self._ptr[0].placementSize = val @property def placement_ids(self): """int: IN/OUT: Placement IDs for the vGPU type.""" if self._ptr[0].placementIds == NULL: return [] cdef _cyb_view.array arr = _cyb_view.array(shape=(self._ptr[0].count,), itemsize=sizeof(unsigned int), format="I", mode="c", allocate_buffer=False) arr.data = (self._ptr[0].placementIds) return _numpy.asarray(arr) @placement_ids.setter def placement_ids(self, val): if self._readonly: raise ValueError("This VgpuPlacementList_v2 instance is read-only") cdef _cyb_view.array arr = _cyb_view.array(shape=(len(val),), itemsize=sizeof(unsigned int), format="I", mode="c") arr[:] = _numpy.asarray(val, dtype=_numpy.uint32) self._ptr[0].placementIds = (arr.data) self._ptr[0].count = len(val) self._refs["placement_ids"] = arr @property def mode(self): """int: IN: The vGPU mode. Either NVML_VGPU_PGPU_HETEROGENEOUS_MODE or NVML_VGPU_PGPU_HOMOGENEOUS_MODE.""" return self._ptr[0].mode @mode.setter def mode(self, val): if self._readonly: raise ValueError("This VgpuPlacementList_v2 instance is read-only") self._ptr[0].mode = val @staticmethod def from_buffer(buffer): """Create an VgpuPlacementList_v2 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlVgpuPlacementList_v2_t), VgpuPlacementList_v2) @staticmethod def from_data(data): """Create an VgpuPlacementList_v2 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `vgpu_placement_list_v2_dtype` holding the data. """ return _cyb_from_data(data, "vgpu_placement_list_v2_dtype", vgpu_placement_list_v2_dtype, VgpuPlacementList_v2) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an VgpuPlacementList_v2 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef VgpuPlacementList_v2 obj = VgpuPlacementList_v2.__new__(VgpuPlacementList_v2) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlVgpuPlacementList_v2_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly obj._refs = {} return obj cdef _get_vgpu_type_bar1info_v1_dtype_offsets(): cdef nvmlVgpuTypeBar1Info_v1_t *pod = _cyb_calloc(1, sizeof(nvmlVgpuTypeBar1Info_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlVgpuTypeBar1Info_v1_t") try: return _numpy.dtype({ 'names': ['version', 'bar1size'], 'formats': [_numpy.uint32, _numpy.uint64], 'offsets': [ (&(pod.version)) - (pod), (&(pod.bar1Size)) - (pod), ], 'itemsize': sizeof(nvmlVgpuTypeBar1Info_v1_t), }) finally: _cyb_free(pod) vgpu_type_bar1info_v1_dtype = _get_vgpu_type_bar1info_v1_dtype_offsets() cdef class VgpuTypeBar1Info_v1: """Empty-initialize an instance of `nvmlVgpuTypeBar1Info_v1_t`. .. seealso:: `nvmlVgpuTypeBar1Info_v1_t` """ cdef: nvmlVgpuTypeBar1Info_v1_t _data nvmlVgpuTypeBar1Info_v1_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.VgpuTypeBar1Info_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef VgpuTypeBar1Info_v1 other_ if not isinstance(other, VgpuTypeBar1Info_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuTypeBar1Info_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuTypeBar1Info_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def version(self): """int: The version number of this struct.""" return self._ptr[0].version @version.setter def version(self, val): if self._readonly: raise ValueError("This VgpuTypeBar1Info_v1 instance is read-only") self._ptr[0].version = val @property def bar1size(self): """int: BAR1 size in megabytes.""" return self._ptr[0].bar1Size @bar1size.setter def bar1size(self, val): if self._readonly: raise ValueError("This VgpuTypeBar1Info_v1 instance is read-only") self._ptr[0].bar1Size = val @staticmethod def from_buffer(buffer): """Create an VgpuTypeBar1Info_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlVgpuTypeBar1Info_v1_t), VgpuTypeBar1Info_v1) @staticmethod def from_data(data): """Create an VgpuTypeBar1Info_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `vgpu_type_bar1info_v1_dtype` holding the data. """ return _cyb_from_data(data, "vgpu_type_bar1info_v1_dtype", vgpu_type_bar1info_v1_dtype, VgpuTypeBar1Info_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an VgpuTypeBar1Info_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef VgpuTypeBar1Info_v1 obj = VgpuTypeBar1Info_v1.__new__(VgpuTypeBar1Info_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlVgpuTypeBar1Info_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_vgpu_process_utilization_sample_dtype_offsets(): cdef nvmlVgpuProcessUtilizationSample_t *pod = _cyb_calloc(1, sizeof(nvmlVgpuProcessUtilizationSample_t)) if pod == NULL: raise MemoryError("Error allocating nvmlVgpuProcessUtilizationSample_t") try: return _numpy.dtype({ '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.vgpuInstance)) - (pod), (&(pod.pid)) - (pod), (&(pod.processName)) - (pod), (&(pod.timeStamp)) - (pod), (&(pod.smUtil)) - (pod), (&(pod.memUtil)) - (pod), (&(pod.encUtil)) - (pod), (&(pod.decUtil)) - (pod), ], 'itemsize': sizeof(nvmlVgpuProcessUtilizationSample_t), }) finally: _cyb_free(pod) vgpu_process_utilization_sample_dtype = _get_vgpu_process_utilization_sample_dtype_offsets() cdef object vgpu_process_utilization_sample_dtype_record = _numpy.dtype((_numpy.record, vgpu_process_utilization_sample_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:: `nvmlVgpuProcessUtilizationSample_t` """ cdef: readonly object _data object _owner def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=vgpu_process_utilization_sample_dtype_record) 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__}.VgpuProcessUtilizationSample_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}.VgpuProcessUtilizationSample object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data 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()) 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 vgpu_instance(self): """Union[~_numpy.uint32, int]: """ 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): if not self._data.flags.writeable: raise ValueError("This VgpuProcessUtilizationSample instance is read-only") self._data["vgpu_instance"] = val @property def pid(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["pid"][0]) return self._data["pid"] @pid.setter def pid(self, val): if not self._data.flags.writeable: raise ValueError("This VgpuProcessUtilizationSample instance is read-only") 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): if not self._data.flags.writeable: raise ValueError("This VgpuProcessUtilizationSample instance is read-only") 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): if not self._data.flags.writeable: raise ValueError("This VgpuProcessUtilizationSample instance is read-only") self._data["time_stamp"] = val @property def sm_util(self): """Union[~_numpy.uint32, int]: """ 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): if not self._data.flags.writeable: raise ValueError("This VgpuProcessUtilizationSample instance is read-only") self._data["sm_util"] = val @property def mem_util(self): """Union[~_numpy.uint32, int]: """ 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): if not self._data.flags.writeable: raise ValueError("This VgpuProcessUtilizationSample instance is read-only") self._data["mem_util"] = val @property def enc_util(self): """Union[~_numpy.uint32, int]: """ 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): if not self._data.flags.writeable: raise ValueError("This VgpuProcessUtilizationSample instance is read-only") self._data["enc_util"] = val @property def dec_util(self): """Union[~_numpy.uint32, int]: """ 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): if not self._data.flags.writeable: raise ValueError("This VgpuProcessUtilizationSample instance is read-only") self._data["dec_util"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef VgpuProcessUtilizationSample obj 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 obj = VgpuProcessUtilizationSample.__new__(VgpuProcessUtilizationSample) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == vgpu_process_utilization_sample_dtype: obj = VgpuProcessUtilizationSample.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """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 VgpuProcessUtilizationSample instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `vgpu_process_utilization_sample_dtype` holding the data. """ 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_sample_dtype: raise ValueError("data array must be of dtype vgpu_process_utilization_sample_dtype") obj._data = data.view(dtype=vgpu_process_utilization_sample_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an VgpuProcessUtilizationSample 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 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(nvmlVgpuProcessUtilizationSample_t) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=vgpu_process_utilization_sample_dtype_record) obj._owner = owner return obj cdef _get_vgpu_process_utilization_info_v1_dtype_offsets(): cdef nvmlVgpuProcessUtilizationInfo_v1_t *pod = _cyb_calloc(1, sizeof(nvmlVgpuProcessUtilizationInfo_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlVgpuProcessUtilizationInfo_v1_t") try: 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], 'offsets': [ (&(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(nvmlVgpuProcessUtilizationInfo_v1_t), }) finally: _cyb_free(pod) vgpu_process_utilization_info_v1_dtype = _get_vgpu_process_utilization_info_v1_dtype_offsets() cdef object vgpu_process_utilization_info_v1_dtype_record = _numpy.dtype((_numpy.record, vgpu_process_utilization_info_v1_dtype)) 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): self._data = _numpy.zeros(size, dtype=vgpu_process_utilization_info_v1_dtype_record) 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 _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._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): if not self._data.flags.writeable: raise ValueError("This VgpuProcessUtilizationInfo_v1 instance is read-only") 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): if not self._data.flags.writeable: raise ValueError("This VgpuProcessUtilizationInfo_v1 instance is read-only") 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): if not self._data.flags.writeable: raise ValueError("This VgpuProcessUtilizationInfo_v1 instance is read-only") 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): if not self._data.flags.writeable: raise ValueError("This VgpuProcessUtilizationInfo_v1 instance is read-only") 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): if not self._data.flags.writeable: raise ValueError("This VgpuProcessUtilizationInfo_v1 instance is read-only") 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): if not self._data.flags.writeable: raise ValueError("This VgpuProcessUtilizationInfo_v1 instance is read-only") 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): if not self._data.flags.writeable: raise ValueError("This VgpuProcessUtilizationInfo_v1 instance is read-only") 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): if not self._data.flags.writeable: raise ValueError("This VgpuProcessUtilizationInfo_v1 instance is read-only") 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): if not self._data.flags.writeable: raise ValueError("This VgpuProcessUtilizationInfo_v1 instance is read-only") 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): if not self._data.flags.writeable: raise ValueError("This VgpuProcessUtilizationInfo_v1 instance is read-only") self._data["ofa_util"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef VgpuProcessUtilizationInfo_v1 obj 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 obj = VgpuProcessUtilizationInfo_v1.__new__(VgpuProcessUtilizationInfo_v1) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == vgpu_process_utilization_info_v1_dtype: obj = VgpuProcessUtilizationInfo_v1.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) 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(dtype=vgpu_process_utilization_info_v1_dtype_record, type=_numpy.ndarray) 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) obj._data = _numpy.ndarray(size, buffer=buf, dtype=vgpu_process_utilization_info_v1_dtype_record) obj._owner = owner return obj cdef _get__py_anon_pod2_dtype_offsets(): cdef cuda_bindings_nvml__anon_pod2 *pod = _cyb_calloc(1, sizeof(cuda_bindings_nvml__anon_pod2)) if pod == NULL: raise MemoryError("Error allocating cuda_bindings_nvml__anon_pod2") try: 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), }) finally: _cyb_free(pod) _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` """ cdef: cuda_bindings_nvml__anon_pod2 *_ptr object _owner 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._readonly = False def __dealloc__(self): cdef cuda_bindings_nvml__anon_pod2 *ptr if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) def __repr__(self): return f"<{__name__}._py_anon_pod2 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef _py_anon_pod2 other_ if not isinstance(other, _py_anon_pod2): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(cuda_bindings_nvml__anon_pod2)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(cuda_bindings_nvml__anon_pod2), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def avg_factor(self): """int: """ return self._ptr[0].avgFactor @avg_factor.setter def avg_factor(self, val): if self._readonly: raise ValueError("This _py_anon_pod2 instance is read-only") self._ptr[0].avgFactor = val @property def timeslice(self): """int: """ return self._ptr[0].timeslice @timeslice.setter def timeslice(self, val): if self._readonly: raise ValueError("This _py_anon_pod2 instance is read-only") self._ptr[0].timeslice = val @staticmethod def from_buffer(buffer): """Create an _py_anon_pod2 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(cuda_bindings_nvml__anon_pod2), _py_anon_pod2) @staticmethod def from_data(data): """Create an _py_anon_pod2 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `_py_anon_pod2_dtype` holding the data. """ return _cyb_from_data(data, "_py_anon_pod2_dtype", _py_anon_pod2_dtype, _py_anon_pod2) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an _py_anon_pod2 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: 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(cuda_bindings_nvml__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 else: obj._ptr = ptr obj._owns_ptr = False obj._owner = owner obj._readonly = readonly return obj cdef _get__py_anon_pod3_dtype_offsets(): cdef cuda_bindings_nvml__anon_pod3 *pod = _cyb_calloc(1, sizeof(cuda_bindings_nvml__anon_pod3)) if pod == NULL: raise MemoryError("Error allocating cuda_bindings_nvml__anon_pod3") try: return _numpy.dtype({ 'names': ['timeslice'], 'formats': [_numpy.uint32], 'offsets': [ (&(pod.timeslice)) - (pod), ], 'itemsize': sizeof(cuda_bindings_nvml__anon_pod3), }) finally: _cyb_free(pod) _py_anon_pod3_dtype = _get__py_anon_pod3_dtype_offsets() cdef class _py_anon_pod3: """Empty-initialize an instance of `cuda_bindings_nvml__anon_pod3`. .. seealso:: `cuda_bindings_nvml__anon_pod3` """ cdef: cuda_bindings_nvml__anon_pod3 *_ptr object _owner 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._readonly = False def __dealloc__(self): cdef cuda_bindings_nvml__anon_pod3 *ptr if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) def __repr__(self): return f"<{__name__}._py_anon_pod3 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef _py_anon_pod3 other_ if not isinstance(other, _py_anon_pod3): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(cuda_bindings_nvml__anon_pod3)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(cuda_bindings_nvml__anon_pod3), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def timeslice(self): """int: """ return self._ptr[0].timeslice @timeslice.setter def timeslice(self, val): if self._readonly: raise ValueError("This _py_anon_pod3 instance is read-only") self._ptr[0].timeslice = val @staticmethod def from_buffer(buffer): """Create an _py_anon_pod3 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(cuda_bindings_nvml__anon_pod3), _py_anon_pod3) @staticmethod def from_data(data): """Create an _py_anon_pod3 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `_py_anon_pod3_dtype` holding the data. """ return _cyb_from_data(data, "_py_anon_pod3_dtype", _py_anon_pod3_dtype, _py_anon_pod3) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an _py_anon_pod3 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: 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(cuda_bindings_nvml__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 else: obj._ptr = ptr obj._owns_ptr = False obj._owner = owner obj._readonly = readonly return obj cdef _get_vgpu_scheduler_log_entry_dtype_offsets(): cdef nvmlVgpuSchedulerLogEntry_t *pod = _cyb_calloc(1, sizeof(nvmlVgpuSchedulerLogEntry_t)) if pod == NULL: raise MemoryError("Error allocating nvmlVgpuSchedulerLogEntry_t") try: return _numpy.dtype({ 'names': ['timestamp', 'time_run_total', 'time_run', 'sw_runlist_id', 'target_time_slice', 'cumulative_preemption_time'], 'formats': [_numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint32, _numpy.uint64, _numpy.uint64], 'offsets': [ (&(pod.timestamp)) - (pod), (&(pod.timeRunTotal)) - (pod), (&(pod.timeRun)) - (pod), (&(pod.swRunlistId)) - (pod), (&(pod.targetTimeSlice)) - (pod), (&(pod.cumulativePreemptionTime)) - (pod), ], 'itemsize': sizeof(nvmlVgpuSchedulerLogEntry_t), }) finally: _cyb_free(pod) vgpu_scheduler_log_entry_dtype = _get_vgpu_scheduler_log_entry_dtype_offsets() cdef object vgpu_scheduler_log_entry_dtype_record = _numpy.dtype((_numpy.record, vgpu_scheduler_log_entry_dtype)) cdef class VgpuSchedulerLogEntry: """Empty-initialize an array of `nvmlVgpuSchedulerLogEntry_t`. The resulting object is of length `size` and of dtype `vgpu_scheduler_log_entry_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `nvmlVgpuSchedulerLogEntry_t` """ cdef: readonly object _data object _owner def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=vgpu_scheduler_log_entry_dtype_record) assert self._data.itemsize == sizeof(nvmlVgpuSchedulerLogEntry_t), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlVgpuSchedulerLogEntry_t) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}.VgpuSchedulerLogEntry_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}.VgpuSchedulerLogEntry object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, VgpuSchedulerLogEntry)) 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 timestamp(self): """Union[~_numpy.uint64, int]: """ if self._data.size == 1: return int(self._data["timestamp"][0]) return self._data["timestamp"] @timestamp.setter def timestamp(self, val): if not self._data.flags.writeable: raise ValueError("This VgpuSchedulerLogEntry instance is read-only") self._data["timestamp"] = val @property def time_run_total(self): """Union[~_numpy.uint64, int]: """ if self._data.size == 1: return int(self._data["time_run_total"][0]) return self._data["time_run_total"] @time_run_total.setter def time_run_total(self, val): if not self._data.flags.writeable: raise ValueError("This VgpuSchedulerLogEntry instance is read-only") self._data["time_run_total"] = val @property def time_run(self): """Union[~_numpy.uint64, int]: """ if self._data.size == 1: return int(self._data["time_run"][0]) return self._data["time_run"] @time_run.setter def time_run(self, val): if not self._data.flags.writeable: raise ValueError("This VgpuSchedulerLogEntry instance is read-only") self._data["time_run"] = val @property def sw_runlist_id(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["sw_runlist_id"][0]) return self._data["sw_runlist_id"] @sw_runlist_id.setter def sw_runlist_id(self, val): if not self._data.flags.writeable: raise ValueError("This VgpuSchedulerLogEntry instance is read-only") self._data["sw_runlist_id"] = val @property def target_time_slice(self): """Union[~_numpy.uint64, int]: """ if self._data.size == 1: return int(self._data["target_time_slice"][0]) return self._data["target_time_slice"] @target_time_slice.setter def target_time_slice(self, val): if not self._data.flags.writeable: raise ValueError("This VgpuSchedulerLogEntry instance is read-only") self._data["target_time_slice"] = val @property def cumulative_preemption_time(self): """Union[~_numpy.uint64, int]: """ if self._data.size == 1: return int(self._data["cumulative_preemption_time"][0]) return self._data["cumulative_preemption_time"] @cumulative_preemption_time.setter def cumulative_preemption_time(self, val): if not self._data.flags.writeable: raise ValueError("This VgpuSchedulerLogEntry instance is read-only") self._data["cumulative_preemption_time"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef VgpuSchedulerLogEntry obj 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 obj = VgpuSchedulerLogEntry.__new__(VgpuSchedulerLogEntry) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == vgpu_scheduler_log_entry_dtype: obj = VgpuSchedulerLogEntry.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an VgpuSchedulerLogEntry instance with the memory from the given buffer.""" return VgpuSchedulerLogEntry.from_data(_numpy.frombuffer(buffer, dtype=vgpu_scheduler_log_entry_dtype)) @staticmethod def from_data(data): """Create an VgpuSchedulerLogEntry instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `vgpu_scheduler_log_entry_dtype` holding the data. """ cdef VgpuSchedulerLogEntry obj = VgpuSchedulerLogEntry.__new__(VgpuSchedulerLogEntry) 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_scheduler_log_entry_dtype: raise ValueError("data array must be of dtype vgpu_scheduler_log_entry_dtype") obj._data = data.view(dtype=vgpu_scheduler_log_entry_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an VgpuSchedulerLogEntry 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 VgpuSchedulerLogEntry obj = VgpuSchedulerLogEntry.__new__(VgpuSchedulerLogEntry) 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(nvmlVgpuSchedulerLogEntry_t) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=vgpu_scheduler_log_entry_dtype_record) obj._owner = owner return obj cdef _get__py_anon_pod4_dtype_offsets(): cdef cuda_bindings_nvml__anon_pod4 *pod = _cyb_calloc(1, sizeof(cuda_bindings_nvml__anon_pod4)) if pod == NULL: raise MemoryError("Error allocating cuda_bindings_nvml__anon_pod4") try: return _numpy.dtype({ 'names': ['avg_factor', 'frequency'], 'formats': [_numpy.uint32, _numpy.uint32], 'offsets': [ (&(pod.avgFactor)) - (pod), (&(pod.frequency)) - (pod), ], 'itemsize': sizeof(cuda_bindings_nvml__anon_pod4), }) finally: _cyb_free(pod) _py_anon_pod4_dtype = _get__py_anon_pod4_dtype_offsets() cdef class _py_anon_pod4: """Empty-initialize an instance of `cuda_bindings_nvml__anon_pod4`. .. seealso:: `cuda_bindings_nvml__anon_pod4` """ cdef: cuda_bindings_nvml__anon_pod4 *_ptr object _owner 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._readonly = False def __dealloc__(self): cdef cuda_bindings_nvml__anon_pod4 *ptr if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) def __repr__(self): return f"<{__name__}._py_anon_pod4 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef _py_anon_pod4 other_ if not isinstance(other, _py_anon_pod4): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(cuda_bindings_nvml__anon_pod4)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(cuda_bindings_nvml__anon_pod4), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def avg_factor(self): """int: """ return self._ptr[0].avgFactor @avg_factor.setter def avg_factor(self, val): if self._readonly: raise ValueError("This _py_anon_pod4 instance is read-only") self._ptr[0].avgFactor = val @property def frequency(self): """int: """ return self._ptr[0].frequency @frequency.setter def frequency(self, val): if self._readonly: raise ValueError("This _py_anon_pod4 instance is read-only") self._ptr[0].frequency = val @staticmethod def from_buffer(buffer): """Create an _py_anon_pod4 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(cuda_bindings_nvml__anon_pod4), _py_anon_pod4) @staticmethod def from_data(data): """Create an _py_anon_pod4 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `_py_anon_pod4_dtype` holding the data. """ return _cyb_from_data(data, "_py_anon_pod4_dtype", _py_anon_pod4_dtype, _py_anon_pod4) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an _py_anon_pod4 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef _py_anon_pod4 obj = _py_anon_pod4.__new__(_py_anon_pod4) if owner is None: obj._ptr = _cyb_malloc(sizeof(cuda_bindings_nvml__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 else: obj._ptr = ptr obj._owns_ptr = False obj._owner = owner obj._readonly = readonly return obj cdef _get__py_anon_pod5_dtype_offsets(): cdef cuda_bindings_nvml__anon_pod5 *pod = _cyb_calloc(1, sizeof(cuda_bindings_nvml__anon_pod5)) if pod == NULL: raise MemoryError("Error allocating cuda_bindings_nvml__anon_pod5") try: return _numpy.dtype({ 'names': ['timeslice'], 'formats': [_numpy.uint32], 'offsets': [ (&(pod.timeslice)) - (pod), ], 'itemsize': sizeof(cuda_bindings_nvml__anon_pod5), }) finally: _cyb_free(pod) _py_anon_pod5_dtype = _get__py_anon_pod5_dtype_offsets() cdef class _py_anon_pod5: """Empty-initialize an instance of `cuda_bindings_nvml__anon_pod5`. .. seealso:: `cuda_bindings_nvml__anon_pod5` """ cdef: cuda_bindings_nvml__anon_pod5 *_ptr object _owner 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._readonly = False def __dealloc__(self): cdef cuda_bindings_nvml__anon_pod5 *ptr if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) def __repr__(self): return f"<{__name__}._py_anon_pod5 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef _py_anon_pod5 other_ if not isinstance(other, _py_anon_pod5): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(cuda_bindings_nvml__anon_pod5)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(cuda_bindings_nvml__anon_pod5), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def timeslice(self): """int: """ return self._ptr[0].timeslice @timeslice.setter def timeslice(self, val): if self._readonly: raise ValueError("This _py_anon_pod5 instance is read-only") self._ptr[0].timeslice = val @staticmethod def from_buffer(buffer): """Create an _py_anon_pod5 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(cuda_bindings_nvml__anon_pod5), _py_anon_pod5) @staticmethod def from_data(data): """Create an _py_anon_pod5 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `_py_anon_pod5_dtype` holding the data. """ return _cyb_from_data(data, "_py_anon_pod5_dtype", _py_anon_pod5_dtype, _py_anon_pod5) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an _py_anon_pod5 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef _py_anon_pod5 obj = _py_anon_pod5.__new__(_py_anon_pod5) if owner is None: obj._ptr = _cyb_malloc(sizeof(cuda_bindings_nvml__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 else: obj._ptr = ptr obj._owns_ptr = False obj._owner = owner obj._readonly = readonly return obj cdef _get_vgpu_scheduler_capabilities_dtype_offsets(): cdef nvmlVgpuSchedulerCapabilities_t *pod = _cyb_calloc(1, sizeof(nvmlVgpuSchedulerCapabilities_t)) if pod == NULL: raise MemoryError("Error allocating nvmlVgpuSchedulerCapabilities_t") try: return _numpy.dtype({ 'names': ['supported_schedulers', 'max_timeslice', 'min_timeslice', 'is_arr_mode_supported', 'max_frequency_for_arr', 'min_frequency_for_arr', 'max_avg_factor_for_arr', 'min_avg_factor_for_arr'], 'formats': [(_numpy.uint32, 3), _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32], 'offsets': [ (&(pod.supportedSchedulers)) - (pod), (&(pod.maxTimeslice)) - (pod), (&(pod.minTimeslice)) - (pod), (&(pod.isArrModeSupported)) - (pod), (&(pod.maxFrequencyForARR)) - (pod), (&(pod.minFrequencyForARR)) - (pod), (&(pod.maxAvgFactorForARR)) - (pod), (&(pod.minAvgFactorForARR)) - (pod), ], 'itemsize': sizeof(nvmlVgpuSchedulerCapabilities_t), }) finally: _cyb_free(pod) vgpu_scheduler_capabilities_dtype = _get_vgpu_scheduler_capabilities_dtype_offsets() cdef class VgpuSchedulerCapabilities: """Empty-initialize an instance of `nvmlVgpuSchedulerCapabilities_t`. .. seealso:: `nvmlVgpuSchedulerCapabilities_t` """ cdef: nvmlVgpuSchedulerCapabilities_t _data nvmlVgpuSchedulerCapabilities_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.VgpuSchedulerCapabilities object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef VgpuSchedulerCapabilities other_ if not isinstance(other, VgpuSchedulerCapabilities): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuSchedulerCapabilities_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuSchedulerCapabilities_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def supported_schedulers(self): """~_numpy.uint32: (array of length 3).""" cdef _cyb_view.array arr = _cyb_view.array(shape=(3,), itemsize=sizeof(unsigned int), format="I", mode="c", allocate_buffer=False) arr.data = (&(self._ptr[0].supportedSchedulers)) return _numpy.asarray(arr) @supported_schedulers.setter def supported_schedulers(self, val): if self._readonly: raise ValueError("This VgpuSchedulerCapabilities instance is read-only") if len(val) != 3: raise ValueError(f"Expected length { 3 } for field supported_schedulers, got {len(val)}") cdef _cyb_view.array arr = _cyb_view.array(shape=(3,), itemsize=sizeof(unsigned int), format="I", mode="c") arr[:] = _numpy.asarray(val, dtype=_numpy.uint32) _cyb_memcpy((&(self._ptr[0].supportedSchedulers)), (arr.data), sizeof(unsigned int) * len(val)) @property def max_timeslice(self): """int: """ return self._ptr[0].maxTimeslice @max_timeslice.setter def max_timeslice(self, val): if self._readonly: raise ValueError("This VgpuSchedulerCapabilities instance is read-only") self._ptr[0].maxTimeslice = val @property def min_timeslice(self): """int: """ return self._ptr[0].minTimeslice @min_timeslice.setter def min_timeslice(self, val): if self._readonly: raise ValueError("This VgpuSchedulerCapabilities instance is read-only") self._ptr[0].minTimeslice = val @property def is_arr_mode_supported(self): """int: """ return self._ptr[0].isArrModeSupported @is_arr_mode_supported.setter def is_arr_mode_supported(self, val): if self._readonly: raise ValueError("This VgpuSchedulerCapabilities instance is read-only") self._ptr[0].isArrModeSupported = val @property def max_frequency_for_arr(self): """int: """ return self._ptr[0].maxFrequencyForARR @max_frequency_for_arr.setter def max_frequency_for_arr(self, val): if self._readonly: raise ValueError("This VgpuSchedulerCapabilities instance is read-only") self._ptr[0].maxFrequencyForARR = val @property def min_frequency_for_arr(self): """int: """ return self._ptr[0].minFrequencyForARR @min_frequency_for_arr.setter def min_frequency_for_arr(self, val): if self._readonly: raise ValueError("This VgpuSchedulerCapabilities instance is read-only") self._ptr[0].minFrequencyForARR = val @property def max_avg_factor_for_arr(self): """int: """ return self._ptr[0].maxAvgFactorForARR @max_avg_factor_for_arr.setter def max_avg_factor_for_arr(self, val): if self._readonly: raise ValueError("This VgpuSchedulerCapabilities instance is read-only") self._ptr[0].maxAvgFactorForARR = val @property def min_avg_factor_for_arr(self): """int: """ return self._ptr[0].minAvgFactorForARR @min_avg_factor_for_arr.setter def min_avg_factor_for_arr(self, val): if self._readonly: raise ValueError("This VgpuSchedulerCapabilities instance is read-only") self._ptr[0].minAvgFactorForARR = val @staticmethod def from_buffer(buffer): """Create an VgpuSchedulerCapabilities instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlVgpuSchedulerCapabilities_t), VgpuSchedulerCapabilities) @staticmethod def from_data(data): """Create an VgpuSchedulerCapabilities instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `vgpu_scheduler_capabilities_dtype` holding the data. """ return _cyb_from_data(data, "vgpu_scheduler_capabilities_dtype", vgpu_scheduler_capabilities_dtype, VgpuSchedulerCapabilities) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an VgpuSchedulerCapabilities instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef VgpuSchedulerCapabilities obj = VgpuSchedulerCapabilities.__new__(VgpuSchedulerCapabilities) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlVgpuSchedulerCapabilities_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_vgpu_license_expiry_dtype_offsets(): cdef nvmlVgpuLicenseExpiry_t *pod = _cyb_calloc(1, sizeof(nvmlVgpuLicenseExpiry_t)) if pod == NULL: raise MemoryError("Error allocating nvmlVgpuLicenseExpiry_t") try: return _numpy.dtype({ 'names': ['year', 'month', 'day', 'hour', 'min_', 'sec', 'status'], 'formats': [_numpy.uint32, _numpy.uint16, _numpy.uint16, _numpy.uint16, _numpy.uint16, _numpy.uint16, _numpy.uint8], 'offsets': [ (&(pod.year)) - (pod), (&(pod.month)) - (pod), (&(pod.day)) - (pod), (&(pod.hour)) - (pod), (&(pod.min)) - (pod), (&(pod.sec)) - (pod), (&(pod.status)) - (pod), ], 'itemsize': sizeof(nvmlVgpuLicenseExpiry_t), }) finally: _cyb_free(pod) vgpu_license_expiry_dtype = _get_vgpu_license_expiry_dtype_offsets() cdef class VgpuLicenseExpiry: """Empty-initialize an instance of `nvmlVgpuLicenseExpiry_t`. .. seealso:: `nvmlVgpuLicenseExpiry_t` """ cdef: nvmlVgpuLicenseExpiry_t *_ptr object _owner 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._readonly = False def __dealloc__(self): cdef nvmlVgpuLicenseExpiry_t *ptr if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) def __repr__(self): return f"<{__name__}.VgpuLicenseExpiry object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef VgpuLicenseExpiry other_ if not isinstance(other, VgpuLicenseExpiry): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuLicenseExpiry_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuLicenseExpiry_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def year(self): """int: """ return self._ptr[0].year @year.setter def year(self, val): if self._readonly: raise ValueError("This VgpuLicenseExpiry instance is read-only") self._ptr[0].year = val @property def month(self): """int: """ return self._ptr[0].month @month.setter def month(self, val): if self._readonly: raise ValueError("This VgpuLicenseExpiry instance is read-only") self._ptr[0].month = val @property def day(self): """int: """ return self._ptr[0].day @day.setter def day(self, val): if self._readonly: raise ValueError("This VgpuLicenseExpiry instance is read-only") self._ptr[0].day = val @property def hour(self): """int: """ return self._ptr[0].hour @hour.setter def hour(self, val): if self._readonly: raise ValueError("This VgpuLicenseExpiry instance is read-only") self._ptr[0].hour = val @property def min_(self): """int: """ return self._ptr[0].min @min_.setter def min_(self, val): if self._readonly: raise ValueError("This VgpuLicenseExpiry instance is read-only") self._ptr[0].min = val @property def sec(self): """int: """ return self._ptr[0].sec @sec.setter def sec(self, val): if self._readonly: raise ValueError("This VgpuLicenseExpiry instance is read-only") self._ptr[0].sec = val @property def status(self): """int: """ return self._ptr[0].status @status.setter def status(self, val): if self._readonly: raise ValueError("This VgpuLicenseExpiry instance is read-only") self._ptr[0].status = val @staticmethod def from_buffer(buffer): """Create an VgpuLicenseExpiry instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlVgpuLicenseExpiry_t), VgpuLicenseExpiry) @staticmethod def from_data(data): """Create an VgpuLicenseExpiry instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `vgpu_license_expiry_dtype` holding the data. """ return _cyb_from_data(data, "vgpu_license_expiry_dtype", vgpu_license_expiry_dtype, VgpuLicenseExpiry) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an VgpuLicenseExpiry instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef VgpuLicenseExpiry obj = VgpuLicenseExpiry.__new__(VgpuLicenseExpiry) if owner is None: obj._ptr = _cyb_malloc(sizeof(nvmlVgpuLicenseExpiry_t)) if obj._ptr == NULL: raise MemoryError("Error allocating VgpuLicenseExpiry") _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuLicenseExpiry_t)) obj._owns_ptr = True obj._owner = None else: obj._ptr = ptr obj._owns_ptr = False obj._owner = owner obj._readonly = readonly return obj cdef _get_grid_license_expiry_dtype_offsets(): cdef nvmlGridLicenseExpiry_t *pod = _cyb_calloc(1, sizeof(nvmlGridLicenseExpiry_t)) if pod == NULL: raise MemoryError("Error allocating nvmlGridLicenseExpiry_t") try: return _numpy.dtype({ 'names': ['year', 'month', 'day', 'hour', 'min_', 'sec', 'status'], 'formats': [_numpy.uint32, _numpy.uint16, _numpy.uint16, _numpy.uint16, _numpy.uint16, _numpy.uint16, _numpy.uint8], 'offsets': [ (&(pod.year)) - (pod), (&(pod.month)) - (pod), (&(pod.day)) - (pod), (&(pod.hour)) - (pod), (&(pod.min)) - (pod), (&(pod.sec)) - (pod), (&(pod.status)) - (pod), ], 'itemsize': sizeof(nvmlGridLicenseExpiry_t), }) finally: _cyb_free(pod) grid_license_expiry_dtype = _get_grid_license_expiry_dtype_offsets() cdef class GridLicenseExpiry: """Empty-initialize an instance of `nvmlGridLicenseExpiry_t`. .. seealso:: `nvmlGridLicenseExpiry_t` """ cdef: nvmlGridLicenseExpiry_t *_ptr object _owner 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._readonly = False def __dealloc__(self): cdef nvmlGridLicenseExpiry_t *ptr if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) def __repr__(self): return f"<{__name__}.GridLicenseExpiry object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef GridLicenseExpiry other_ if not isinstance(other, GridLicenseExpiry): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlGridLicenseExpiry_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlGridLicenseExpiry_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def year(self): """int: """ return self._ptr[0].year @year.setter def year(self, val): if self._readonly: raise ValueError("This GridLicenseExpiry instance is read-only") self._ptr[0].year = val @property def month(self): """int: """ return self._ptr[0].month @month.setter def month(self, val): if self._readonly: raise ValueError("This GridLicenseExpiry instance is read-only") self._ptr[0].month = val @property def day(self): """int: """ return self._ptr[0].day @day.setter def day(self, val): if self._readonly: raise ValueError("This GridLicenseExpiry instance is read-only") self._ptr[0].day = val @property def hour(self): """int: """ return self._ptr[0].hour @hour.setter def hour(self, val): if self._readonly: raise ValueError("This GridLicenseExpiry instance is read-only") self._ptr[0].hour = val @property def min_(self): """int: """ return self._ptr[0].min @min_.setter def min_(self, val): if self._readonly: raise ValueError("This GridLicenseExpiry instance is read-only") self._ptr[0].min = val @property def sec(self): """int: """ return self._ptr[0].sec @sec.setter def sec(self, val): if self._readonly: raise ValueError("This GridLicenseExpiry instance is read-only") self._ptr[0].sec = val @property def status(self): """int: """ return self._ptr[0].status @status.setter def status(self, val): if self._readonly: raise ValueError("This GridLicenseExpiry instance is read-only") self._ptr[0].status = val @staticmethod def from_buffer(buffer): """Create an GridLicenseExpiry instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlGridLicenseExpiry_t), GridLicenseExpiry) @staticmethod def from_data(data): """Create an GridLicenseExpiry instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `grid_license_expiry_dtype` holding the data. """ return _cyb_from_data(data, "grid_license_expiry_dtype", grid_license_expiry_dtype, GridLicenseExpiry) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an GridLicenseExpiry instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef GridLicenseExpiry obj = GridLicenseExpiry.__new__(GridLicenseExpiry) if owner is None: obj._ptr = _cyb_malloc(sizeof(nvmlGridLicenseExpiry_t)) if obj._ptr == NULL: raise MemoryError("Error allocating GridLicenseExpiry") _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlGridLicenseExpiry_t)) obj._owns_ptr = True obj._owner = None else: obj._ptr = ptr obj._owns_ptr = False obj._owner = owner obj._readonly = readonly return obj cdef _get_vgpu_type_id_info_v1_dtype_offsets(): cdef nvmlVgpuTypeIdInfo_v1_t *pod = _cyb_calloc(1, sizeof(nvmlVgpuTypeIdInfo_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlVgpuTypeIdInfo_v1_t") try: return _numpy.dtype({ 'names': ['version', 'vgpu_count', 'vgpu_type_ids'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.intp], 'offsets': [ (&(pod.version)) - (pod), (&(pod.vgpuCount)) - (pod), (&(pod.vgpuTypeIds)) - (pod), ], 'itemsize': sizeof(nvmlVgpuTypeIdInfo_v1_t), }) finally: _cyb_free(pod) vgpu_type_id_info_v1_dtype = _get_vgpu_type_id_info_v1_dtype_offsets() cdef class VgpuTypeIdInfo_v1: """Empty-initialize an instance of `nvmlVgpuTypeIdInfo_v1_t`. .. seealso:: `nvmlVgpuTypeIdInfo_v1_t` """ cdef: nvmlVgpuTypeIdInfo_v1_t _data nvmlVgpuTypeIdInfo_v1_t *_ptr object _owner bint _readonly dict _refs def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False self._refs = {} def __repr__(self): return f"<{__name__}.VgpuTypeIdInfo_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef VgpuTypeIdInfo_v1 other_ if not isinstance(other, VgpuTypeIdInfo_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuTypeIdInfo_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuTypeIdInfo_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def version(self): """int: IN: The version number of this struct.""" return self._ptr[0].version @version.setter def version(self, val): if self._readonly: raise ValueError("This VgpuTypeIdInfo_v1 instance is read-only") self._ptr[0].version = val @property def vgpu_type_ids(self): """int: OUT: List of vGPU type IDs.""" if self._ptr[0].vgpuTypeIds == NULL: return [] cdef _cyb_view.array arr = _cyb_view.array(shape=(self._ptr[0].vgpuCount,), itemsize=sizeof(unsigned int), format="I", mode="c", allocate_buffer=False) arr.data = (self._ptr[0].vgpuTypeIds) return _numpy.asarray(arr) @vgpu_type_ids.setter def vgpu_type_ids(self, val): if self._readonly: raise ValueError("This VgpuTypeIdInfo_v1 instance is read-only") cdef _cyb_view.array arr = _cyb_view.array(shape=(len(val),), itemsize=sizeof(unsigned int), format="I", mode="c") arr[:] = _numpy.asarray(val, dtype=_numpy.uint32) self._ptr[0].vgpuTypeIds = (arr.data) self._ptr[0].vgpuCount = len(val) self._refs["vgpu_type_ids"] = arr @staticmethod def from_buffer(buffer): """Create an VgpuTypeIdInfo_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlVgpuTypeIdInfo_v1_t), VgpuTypeIdInfo_v1) @staticmethod def from_data(data): """Create an VgpuTypeIdInfo_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `vgpu_type_id_info_v1_dtype` holding the data. """ return _cyb_from_data(data, "vgpu_type_id_info_v1_dtype", vgpu_type_id_info_v1_dtype, VgpuTypeIdInfo_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an VgpuTypeIdInfo_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef VgpuTypeIdInfo_v1 obj = VgpuTypeIdInfo_v1.__new__(VgpuTypeIdInfo_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlVgpuTypeIdInfo_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly obj._refs = {} return obj cdef _get_active_vgpu_instance_info_v1_dtype_offsets(): cdef nvmlActiveVgpuInstanceInfo_v1_t *pod = _cyb_calloc(1, sizeof(nvmlActiveVgpuInstanceInfo_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlActiveVgpuInstanceInfo_v1_t") try: return _numpy.dtype({ 'names': ['version', 'vgpu_count', 'vgpu_instances'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.intp], 'offsets': [ (&(pod.version)) - (pod), (&(pod.vgpuCount)) - (pod), (&(pod.vgpuInstances)) - (pod), ], 'itemsize': sizeof(nvmlActiveVgpuInstanceInfo_v1_t), }) finally: _cyb_free(pod) active_vgpu_instance_info_v1_dtype = _get_active_vgpu_instance_info_v1_dtype_offsets() cdef class ActiveVgpuInstanceInfo_v1: """Empty-initialize an instance of `nvmlActiveVgpuInstanceInfo_v1_t`. .. seealso:: `nvmlActiveVgpuInstanceInfo_v1_t` """ cdef: nvmlActiveVgpuInstanceInfo_v1_t _data nvmlActiveVgpuInstanceInfo_v1_t *_ptr object _owner bint _readonly dict _refs def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False self._refs = {} def __repr__(self): return f"<{__name__}.ActiveVgpuInstanceInfo_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef ActiveVgpuInstanceInfo_v1 other_ if not isinstance(other, ActiveVgpuInstanceInfo_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlActiveVgpuInstanceInfo_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlActiveVgpuInstanceInfo_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def version(self): """int: IN: The version number of this struct.""" return self._ptr[0].version @version.setter def version(self, val): if self._readonly: raise ValueError("This ActiveVgpuInstanceInfo_v1 instance is read-only") self._ptr[0].version = val @property def vgpu_instances(self): """int: IN/OUT: list of active vGPU instances.""" if self._ptr[0].vgpuInstances == NULL: return [] cdef _cyb_view.array arr = _cyb_view.array(shape=(self._ptr[0].vgpuCount,), itemsize=sizeof(unsigned int), format="I", mode="c", allocate_buffer=False) arr.data = (self._ptr[0].vgpuInstances) return _numpy.asarray(arr) @vgpu_instances.setter def vgpu_instances(self, val): if self._readonly: raise ValueError("This ActiveVgpuInstanceInfo_v1 instance is read-only") cdef _cyb_view.array arr = _cyb_view.array(shape=(len(val),), itemsize=sizeof(unsigned int), format="I", mode="c") arr[:] = _numpy.asarray(val, dtype=_numpy.uint32) self._ptr[0].vgpuInstances = (arr.data) self._ptr[0].vgpuCount = len(val) self._refs["vgpu_instances"] = arr @staticmethod def from_buffer(buffer): """Create an ActiveVgpuInstanceInfo_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlActiveVgpuInstanceInfo_v1_t), ActiveVgpuInstanceInfo_v1) @staticmethod def from_data(data): """Create an ActiveVgpuInstanceInfo_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `active_vgpu_instance_info_v1_dtype` holding the data. """ return _cyb_from_data(data, "active_vgpu_instance_info_v1_dtype", active_vgpu_instance_info_v1_dtype, ActiveVgpuInstanceInfo_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an ActiveVgpuInstanceInfo_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef ActiveVgpuInstanceInfo_v1 obj = ActiveVgpuInstanceInfo_v1.__new__(ActiveVgpuInstanceInfo_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlActiveVgpuInstanceInfo_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly obj._refs = {} return obj cdef _get_vgpu_creatable_placement_info_v1_dtype_offsets(): cdef nvmlVgpuCreatablePlacementInfo_v1_t *pod = _cyb_calloc(1, sizeof(nvmlVgpuCreatablePlacementInfo_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlVgpuCreatablePlacementInfo_v1_t") try: return _numpy.dtype({ 'names': ['version', 'vgpu_type_id', 'count', 'placement_ids', 'placement_size'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.intp, _numpy.uint32], 'offsets': [ (&(pod.version)) - (pod), (&(pod.vgpuTypeId)) - (pod), (&(pod.count)) - (pod), (&(pod.placementIds)) - (pod), (&(pod.placementSize)) - (pod), ], 'itemsize': sizeof(nvmlVgpuCreatablePlacementInfo_v1_t), }) finally: _cyb_free(pod) vgpu_creatable_placement_info_v1_dtype = _get_vgpu_creatable_placement_info_v1_dtype_offsets() cdef class VgpuCreatablePlacementInfo_v1: """Empty-initialize an instance of `nvmlVgpuCreatablePlacementInfo_v1_t`. .. seealso:: `nvmlVgpuCreatablePlacementInfo_v1_t` """ cdef: nvmlVgpuCreatablePlacementInfo_v1_t _data nvmlVgpuCreatablePlacementInfo_v1_t *_ptr object _owner bint _readonly dict _refs def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False self._refs = {} def __repr__(self): return f"<{__name__}.VgpuCreatablePlacementInfo_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef VgpuCreatablePlacementInfo_v1 other_ if not isinstance(other, VgpuCreatablePlacementInfo_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuCreatablePlacementInfo_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuCreatablePlacementInfo_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def version(self): """int: IN: The version number of this struct.""" return self._ptr[0].version @version.setter def version(self, val): if self._readonly: raise ValueError("This VgpuCreatablePlacementInfo_v1 instance is read-only") self._ptr[0].version = val @property def vgpu_type_id(self): """int: IN: Handle to vGPU type.""" return (self._ptr[0].vgpuTypeId) @vgpu_type_id.setter def vgpu_type_id(self, val): if self._readonly: raise ValueError("This VgpuCreatablePlacementInfo_v1 instance is read-only") self._ptr[0].vgpuTypeId = val @property def count(self): """int: IN/OUT: Count of the placement IDs.""" return self._ptr[0].count @count.setter def count(self, val): if self._readonly: raise ValueError("This VgpuCreatablePlacementInfo_v1 instance is read-only") self._ptr[0].count = val @property def placement_ids(self): """int: IN/OUT: Placement IDs for the vGPU type.""" if self._ptr[0].placementIds == NULL: return [] cdef _cyb_view.array arr = _cyb_view.array(shape=(self._ptr[0].placementSize,), itemsize=sizeof(unsigned int), format="I", mode="c", allocate_buffer=False) arr.data = (self._ptr[0].placementIds) return _numpy.asarray(arr) @placement_ids.setter def placement_ids(self, val): if self._readonly: raise ValueError("This VgpuCreatablePlacementInfo_v1 instance is read-only") cdef _cyb_view.array arr = _cyb_view.array(shape=(len(val),), itemsize=sizeof(unsigned int), format="I", mode="c") arr[:] = _numpy.asarray(val, dtype=_numpy.uint32) self._ptr[0].placementIds = (arr.data) self._ptr[0].placementSize = len(val) self._refs["placement_ids"] = arr @staticmethod def from_buffer(buffer): """Create an VgpuCreatablePlacementInfo_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlVgpuCreatablePlacementInfo_v1_t), VgpuCreatablePlacementInfo_v1) @staticmethod def from_data(data): """Create an VgpuCreatablePlacementInfo_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `vgpu_creatable_placement_info_v1_dtype` holding the data. """ return _cyb_from_data(data, "vgpu_creatable_placement_info_v1_dtype", vgpu_creatable_placement_info_v1_dtype, VgpuCreatablePlacementInfo_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an VgpuCreatablePlacementInfo_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef VgpuCreatablePlacementInfo_v1 obj = VgpuCreatablePlacementInfo_v1.__new__(VgpuCreatablePlacementInfo_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlVgpuCreatablePlacementInfo_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly obj._refs = {} return obj cdef _get_hwbc_entry_dtype_offsets(): cdef nvmlHwbcEntry_t *pod = _cyb_calloc(1, sizeof(nvmlHwbcEntry_t)) if pod == NULL: raise MemoryError("Error allocating nvmlHwbcEntry_t") try: return _numpy.dtype({ 'names': ['hwbc_id', 'firmware_version'], 'formats': [_numpy.uint32, (_numpy.int8, 32)], 'offsets': [ (&(pod.hwbcId)) - (pod), (&(pod.firmwareVersion)) - (pod), ], 'itemsize': sizeof(nvmlHwbcEntry_t), }) finally: _cyb_free(pod) hwbc_entry_dtype = _get_hwbc_entry_dtype_offsets() cdef object hwbc_entry_dtype_record = _numpy.dtype((_numpy.record, hwbc_entry_dtype)) cdef class HwbcEntry: """Empty-initialize an array of `nvmlHwbcEntry_t`. The resulting object is of length `size` and of dtype `hwbc_entry_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `nvmlHwbcEntry_t` """ cdef: readonly object _data object _owner def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=hwbc_entry_dtype_record) assert self._data.itemsize == sizeof(nvmlHwbcEntry_t), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlHwbcEntry_t) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}.HwbcEntry_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}.HwbcEntry object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, HwbcEntry)) 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 hwbc_id(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["hwbc_id"][0]) return self._data["hwbc_id"] @hwbc_id.setter def hwbc_id(self, val): if not self._data.flags.writeable: raise ValueError("This HwbcEntry instance is read-only") self._data["hwbc_id"] = val @property def firmware_version(self): """~_numpy.int8: (array of length 32).""" return self._data["firmware_version"] @firmware_version.setter def firmware_version(self, val): if not self._data.flags.writeable: raise ValueError("This HwbcEntry instance is read-only") self._data["firmware_version"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef HwbcEntry obj 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 obj = HwbcEntry.__new__(HwbcEntry) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == hwbc_entry_dtype: obj = HwbcEntry.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an HwbcEntry instance with the memory from the given buffer.""" return HwbcEntry.from_data(_numpy.frombuffer(buffer, dtype=hwbc_entry_dtype)) @staticmethod def from_data(data): """Create an HwbcEntry instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `hwbc_entry_dtype` holding the data. """ cdef HwbcEntry obj = HwbcEntry.__new__(HwbcEntry) 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 != hwbc_entry_dtype: raise ValueError("data array must be of dtype hwbc_entry_dtype") obj._data = data.view(dtype=hwbc_entry_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an HwbcEntry 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 HwbcEntry obj = HwbcEntry.__new__(HwbcEntry) 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(nvmlHwbcEntry_t) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=hwbc_entry_dtype_record) obj._owner = owner return obj cdef _get_led_state_dtype_offsets(): cdef nvmlLedState_t *pod = _cyb_calloc(1, sizeof(nvmlLedState_t)) if pod == NULL: raise MemoryError("Error allocating nvmlLedState_t") try: return _numpy.dtype({ 'names': ['cause', 'color'], 'formats': [(_numpy.int8, 256), _numpy.int32], 'offsets': [ (&(pod.cause)) - (pod), (&(pod.color)) - (pod), ], 'itemsize': sizeof(nvmlLedState_t), }) finally: _cyb_free(pod) led_state_dtype = _get_led_state_dtype_offsets() cdef class LedState: """Empty-initialize an instance of `nvmlLedState_t`. .. seealso:: `nvmlLedState_t` """ cdef: nvmlLedState_t _data nvmlLedState_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.LedState object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef LedState other_ if not isinstance(other, LedState): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlLedState_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlLedState_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def cause(self): """~_numpy.int8: (array of length 256).""" return _cyb_cpython.PyUnicode_FromString(self._ptr[0].cause) @cause.setter def cause(self, val): if self._readonly: raise ValueError("This LedState instance is read-only") cdef bytes buf = val.encode() if len(buf) >= 256: raise ValueError("String too long for field cause, max length is 255") cdef char *ptr = buf _cyb_memcpy((self._ptr[0].cause), ptr, 256) @property def color(self): """int: """ return (self._ptr[0].color) @color.setter def color(self, val): if self._readonly: raise ValueError("This LedState instance is read-only") self._ptr[0].color = val @staticmethod def from_buffer(buffer): """Create an LedState instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlLedState_t), LedState) @staticmethod def from_data(data): """Create an LedState instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `led_state_dtype` holding the data. """ return _cyb_from_data(data, "led_state_dtype", led_state_dtype, LedState) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an LedState instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef LedState obj = LedState.__new__(LedState) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlLedState_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_unit_info_dtype_offsets(): cdef nvmlUnitInfo_t *pod = _cyb_calloc(1, sizeof(nvmlUnitInfo_t)) if pod == NULL: raise MemoryError("Error allocating nvmlUnitInfo_t") try: return _numpy.dtype({ 'names': ['name', 'id', 'serial', 'firmware_version'], 'formats': [(_numpy.int8, 96), (_numpy.int8, 96), (_numpy.int8, 96), (_numpy.int8, 96)], 'offsets': [ (&(pod.name)) - (pod), (&(pod.id)) - (pod), (&(pod.serial)) - (pod), (&(pod.firmwareVersion)) - (pod), ], 'itemsize': sizeof(nvmlUnitInfo_t), }) finally: _cyb_free(pod) unit_info_dtype = _get_unit_info_dtype_offsets() cdef class UnitInfo: """Empty-initialize an instance of `nvmlUnitInfo_t`. .. seealso:: `nvmlUnitInfo_t` """ cdef: nvmlUnitInfo_t _data nvmlUnitInfo_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.UnitInfo object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef UnitInfo other_ if not isinstance(other, UnitInfo): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlUnitInfo_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlUnitInfo_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def name(self): """~_numpy.int8: (array of length 96).""" return _cyb_cpython.PyUnicode_FromString(self._ptr[0].name) @name.setter def name(self, val): if self._readonly: raise ValueError("This UnitInfo instance is read-only") cdef bytes buf = val.encode() if len(buf) >= 96: raise ValueError("String too long for field name, max length is 95") cdef char *ptr = buf _cyb_memcpy((self._ptr[0].name), ptr, 96) @property def id(self): """~_numpy.int8: (array of length 96).""" return _cyb_cpython.PyUnicode_FromString(self._ptr[0].id) @id.setter def id(self, val): if self._readonly: raise ValueError("This UnitInfo instance is read-only") cdef bytes buf = val.encode() if len(buf) >= 96: raise ValueError("String too long for field id, max length is 95") cdef char *ptr = buf _cyb_memcpy((self._ptr[0].id), ptr, 96) @property def serial(self): """~_numpy.int8: (array of length 96).""" return _cyb_cpython.PyUnicode_FromString(self._ptr[0].serial) @serial.setter def serial(self, val): if self._readonly: raise ValueError("This UnitInfo instance is read-only") cdef bytes buf = val.encode() if len(buf) >= 96: raise ValueError("String too long for field serial, max length is 95") cdef char *ptr = buf _cyb_memcpy((self._ptr[0].serial), ptr, 96) @property def firmware_version(self): """~_numpy.int8: (array of length 96).""" return _cyb_cpython.PyUnicode_FromString(self._ptr[0].firmwareVersion) @firmware_version.setter def firmware_version(self, val): if self._readonly: raise ValueError("This UnitInfo instance is read-only") cdef bytes buf = val.encode() if len(buf) >= 96: raise ValueError("String too long for field firmware_version, max length is 95") cdef char *ptr = buf _cyb_memcpy((self._ptr[0].firmwareVersion), ptr, 96) @staticmethod def from_buffer(buffer): """Create an UnitInfo instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlUnitInfo_t), UnitInfo) @staticmethod def from_data(data): """Create an UnitInfo instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `unit_info_dtype` holding the data. """ return _cyb_from_data(data, "unit_info_dtype", unit_info_dtype, UnitInfo) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an UnitInfo instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef UnitInfo obj = UnitInfo.__new__(UnitInfo) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlUnitInfo_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_psu_info_dtype_offsets(): cdef nvmlPSUInfo_t *pod = _cyb_calloc(1, sizeof(nvmlPSUInfo_t)) if pod == NULL: raise MemoryError("Error allocating nvmlPSUInfo_t") try: return _numpy.dtype({ 'names': ['state', 'current', 'voltage', 'power'], 'formats': [(_numpy.int8, 256), _numpy.uint32, _numpy.uint32, _numpy.uint32], 'offsets': [ (&(pod.state)) - (pod), (&(pod.current)) - (pod), (&(pod.voltage)) - (pod), (&(pod.power)) - (pod), ], 'itemsize': sizeof(nvmlPSUInfo_t), }) finally: _cyb_free(pod) psu_info_dtype = _get_psu_info_dtype_offsets() cdef class PSUInfo: """Empty-initialize an instance of `nvmlPSUInfo_t`. .. seealso:: `nvmlPSUInfo_t` """ cdef: nvmlPSUInfo_t _data nvmlPSUInfo_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.PSUInfo object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef PSUInfo other_ if not isinstance(other, PSUInfo): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlPSUInfo_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlPSUInfo_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def state(self): """~_numpy.int8: (array of length 256).""" return _cyb_cpython.PyUnicode_FromString(self._ptr[0].state) @state.setter def state(self, val): if self._readonly: raise ValueError("This PSUInfo instance is read-only") cdef bytes buf = val.encode() if len(buf) >= 256: raise ValueError("String too long for field state, max length is 255") cdef char *ptr = buf _cyb_memcpy((self._ptr[0].state), ptr, 256) @property def current(self): """int: """ return self._ptr[0].current @current.setter def current(self, val): if self._readonly: raise ValueError("This PSUInfo instance is read-only") self._ptr[0].current = val @property def voltage(self): """int: """ return self._ptr[0].voltage @voltage.setter def voltage(self, val): if self._readonly: raise ValueError("This PSUInfo instance is read-only") self._ptr[0].voltage = val @property def power(self): """int: """ return self._ptr[0].power @power.setter def power(self, val): if self._readonly: raise ValueError("This PSUInfo instance is read-only") self._ptr[0].power = val @staticmethod def from_buffer(buffer): """Create an PSUInfo instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlPSUInfo_t), PSUInfo) @staticmethod def from_data(data): """Create an PSUInfo instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `psu_info_dtype` holding the data. """ return _cyb_from_data(data, "psu_info_dtype", psu_info_dtype, PSUInfo) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an PSUInfo instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef PSUInfo obj = PSUInfo.__new__(PSUInfo) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlPSUInfo_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_unit_fan_info_dtype_offsets(): cdef nvmlUnitFanInfo_t *pod = _cyb_calloc(1, sizeof(nvmlUnitFanInfo_t)) if pod == NULL: raise MemoryError("Error allocating nvmlUnitFanInfo_t") try: return _numpy.dtype({ 'names': ['speed', 'state'], 'formats': [_numpy.uint32, _numpy.int32], 'offsets': [ (&(pod.speed)) - (pod), (&(pod.state)) - (pod), ], 'itemsize': sizeof(nvmlUnitFanInfo_t), }) finally: _cyb_free(pod) unit_fan_info_dtype = _get_unit_fan_info_dtype_offsets() cdef object unit_fan_info_dtype_record = _numpy.dtype((_numpy.record, unit_fan_info_dtype)) cdef class UnitFanInfo: """Empty-initialize an array of `nvmlUnitFanInfo_t`. The resulting object is of length `size` and of dtype `unit_fan_info_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `nvmlUnitFanInfo_t` """ cdef: readonly object _data object _owner def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=unit_fan_info_dtype_record) assert self._data.itemsize == sizeof(nvmlUnitFanInfo_t), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlUnitFanInfo_t) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}.UnitFanInfo_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}.UnitFanInfo object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, UnitFanInfo)) 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 speed(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["speed"][0]) return self._data["speed"] @speed.setter def speed(self, val): if not self._data.flags.writeable: raise ValueError("This UnitFanInfo instance is read-only") self._data["speed"] = val @property def state(self): """Union[~_numpy.int32, int]: """ if self._data.size == 1: return int(self._data["state"][0]) return self._data["state"] @state.setter def state(self, val): if not self._data.flags.writeable: raise ValueError("This UnitFanInfo instance is read-only") self._data["state"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef UnitFanInfo obj 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 obj = UnitFanInfo.__new__(UnitFanInfo) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == unit_fan_info_dtype: obj = UnitFanInfo.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an UnitFanInfo instance with the memory from the given buffer.""" return UnitFanInfo.from_data(_numpy.frombuffer(buffer, dtype=unit_fan_info_dtype)) @staticmethod def from_data(data): """Create an UnitFanInfo instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `unit_fan_info_dtype` holding the data. """ cdef UnitFanInfo obj = UnitFanInfo.__new__(UnitFanInfo) 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 != unit_fan_info_dtype: raise ValueError("data array must be of dtype unit_fan_info_dtype") obj._data = data.view(dtype=unit_fan_info_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an UnitFanInfo 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 UnitFanInfo obj = UnitFanInfo.__new__(UnitFanInfo) 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(nvmlUnitFanInfo_t) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=unit_fan_info_dtype_record) obj._owner = owner return obj cdef _get_event_data_dtype_offsets(): cdef nvmlEventData_t *pod = _cyb_calloc(1, sizeof(nvmlEventData_t)) if pod == NULL: raise MemoryError("Error allocating nvmlEventData_t") try: return _numpy.dtype({ 'names': ['device_', 'event_type', 'event_data', 'gpu_instance_id', 'compute_instance_id'], 'formats': [_numpy.intp, _numpy.uint64, _numpy.uint64, _numpy.uint32, _numpy.uint32], 'offsets': [ (&(pod.device)) - (pod), (&(pod.eventType)) - (pod), (&(pod.eventData)) - (pod), (&(pod.gpuInstanceId)) - (pod), (&(pod.computeInstanceId)) - (pod), ], 'itemsize': sizeof(nvmlEventData_t), }) finally: _cyb_free(pod) event_data_dtype = _get_event_data_dtype_offsets() cdef class EventData: """Empty-initialize an instance of `nvmlEventData_t`. .. seealso:: `nvmlEventData_t` """ cdef: nvmlEventData_t _data nvmlEventData_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.EventData object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef EventData other_ if not isinstance(other, EventData): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlEventData_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlEventData_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def device_(self): """int: """ return (self._ptr[0].device) @device_.setter def device_(self, val): if self._readonly: raise ValueError("This EventData instance is read-only") self._ptr[0].device = val @property def event_type(self): """int: """ return self._ptr[0].eventType @event_type.setter def event_type(self, val): if self._readonly: raise ValueError("This EventData instance is read-only") self._ptr[0].eventType = val @property def event_data(self): """int: """ return self._ptr[0].eventData @event_data.setter def event_data(self, val): if self._readonly: raise ValueError("This EventData instance is read-only") self._ptr[0].eventData = val @property def gpu_instance_id(self): """int: """ return self._ptr[0].gpuInstanceId @gpu_instance_id.setter def gpu_instance_id(self, val): if self._readonly: raise ValueError("This EventData instance is read-only") self._ptr[0].gpuInstanceId = val @property def compute_instance_id(self): """int: """ return self._ptr[0].computeInstanceId @compute_instance_id.setter def compute_instance_id(self, val): if self._readonly: raise ValueError("This EventData instance is read-only") self._ptr[0].computeInstanceId = val @staticmethod def from_buffer(buffer): """Create an EventData instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlEventData_t), EventData) @staticmethod def from_data(data): """Create an EventData instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `event_data_dtype` holding the data. """ return _cyb_from_data(data, "event_data_dtype", event_data_dtype, EventData) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an EventData instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef EventData obj = EventData.__new__(EventData) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlEventData_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_system_event_data_v1_dtype_offsets(): cdef nvmlSystemEventData_v1_t *pod = _cyb_calloc(1, sizeof(nvmlSystemEventData_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlSystemEventData_v1_t") try: return _numpy.dtype({ 'names': ['event_type', 'gpu_id'], 'formats': [_numpy.uint64, _numpy.uint32], 'offsets': [ (&(pod.eventType)) - (pod), (&(pod.gpuId)) - (pod), ], 'itemsize': sizeof(nvmlSystemEventData_v1_t), }) finally: _cyb_free(pod) system_event_data_v1_dtype = _get_system_event_data_v1_dtype_offsets() cdef object system_event_data_v1_dtype_record = _numpy.dtype((_numpy.record, system_event_data_v1_dtype)) cdef class SystemEventData_v1: """Empty-initialize an array of `nvmlSystemEventData_v1_t`. The resulting object is of length `size` and of dtype `system_event_data_v1_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `nvmlSystemEventData_v1_t` """ cdef: readonly object _data object _owner def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=system_event_data_v1_dtype_record) assert self._data.itemsize == sizeof(nvmlSystemEventData_v1_t), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlSystemEventData_v1_t) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}.SystemEventData_v1_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}.SystemEventData_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, SystemEventData_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 event_type(self): """Union[~_numpy.uint64, int]: Information about what specific system event occurred.""" if self._data.size == 1: return int(self._data["event_type"][0]) return self._data["event_type"] @event_type.setter def event_type(self, val): if not self._data.flags.writeable: raise ValueError("This SystemEventData_v1 instance is read-only") self._data["event_type"] = val @property def gpu_id(self): """Union[~_numpy.uint32, int]: gpuId in PCI format""" if self._data.size == 1: return int(self._data["gpu_id"][0]) return self._data["gpu_id"] @gpu_id.setter def gpu_id(self, val): if not self._data.flags.writeable: raise ValueError("This SystemEventData_v1 instance is read-only") self._data["gpu_id"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef SystemEventData_v1 obj 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 obj = SystemEventData_v1.__new__(SystemEventData_v1) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == system_event_data_v1_dtype: obj = SystemEventData_v1.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an SystemEventData_v1 instance with the memory from the given buffer.""" return SystemEventData_v1.from_data(_numpy.frombuffer(buffer, dtype=system_event_data_v1_dtype)) @staticmethod def from_data(data): """Create an SystemEventData_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `system_event_data_v1_dtype` holding the data. """ cdef SystemEventData_v1 obj = SystemEventData_v1.__new__(SystemEventData_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 != system_event_data_v1_dtype: raise ValueError("data array must be of dtype system_event_data_v1_dtype") obj._data = data.view(dtype=system_event_data_v1_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an SystemEventData_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 SystemEventData_v1 obj = SystemEventData_v1.__new__(SystemEventData_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(nvmlSystemEventData_v1_t) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=system_event_data_v1_dtype_record) obj._owner = owner return obj cdef _get_accounting_stats_dtype_offsets(): cdef nvmlAccountingStats_t *pod = _cyb_calloc(1, sizeof(nvmlAccountingStats_t)) if pod == NULL: raise MemoryError("Error allocating nvmlAccountingStats_t") try: return _numpy.dtype({ 'names': ['gpu_utilization', 'memory_utilization', 'max_memory_usage', 'time', 'start_time', 'is_running', 'reserved'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint32, (_numpy.uint32, 5)], 'offsets': [ (&(pod.gpuUtilization)) - (pod), (&(pod.memoryUtilization)) - (pod), (&(pod.maxMemoryUsage)) - (pod), (&(pod.time)) - (pod), (&(pod.startTime)) - (pod), (&(pod.isRunning)) - (pod), (&(pod.reserved)) - (pod), ], 'itemsize': sizeof(nvmlAccountingStats_t), }) finally: _cyb_free(pod) accounting_stats_dtype = _get_accounting_stats_dtype_offsets() cdef class AccountingStats: """Empty-initialize an instance of `nvmlAccountingStats_t`. .. seealso:: `nvmlAccountingStats_t` """ cdef: nvmlAccountingStats_t _data nvmlAccountingStats_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.AccountingStats object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef AccountingStats other_ if not isinstance(other, AccountingStats): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlAccountingStats_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlAccountingStats_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def gpu_utilization(self): """int: """ return self._ptr[0].gpuUtilization @gpu_utilization.setter def gpu_utilization(self, val): if self._readonly: raise ValueError("This AccountingStats instance is read-only") self._ptr[0].gpuUtilization = val @property def memory_utilization(self): """int: """ return self._ptr[0].memoryUtilization @memory_utilization.setter def memory_utilization(self, val): if self._readonly: raise ValueError("This AccountingStats instance is read-only") self._ptr[0].memoryUtilization = val @property def max_memory_usage(self): """int: """ return self._ptr[0].maxMemoryUsage @max_memory_usage.setter def max_memory_usage(self, val): if self._readonly: raise ValueError("This AccountingStats instance is read-only") self._ptr[0].maxMemoryUsage = val @property def time(self): """int: """ return self._ptr[0].time @time.setter def time(self, val): if self._readonly: raise ValueError("This AccountingStats instance is read-only") self._ptr[0].time = val @property def start_time(self): """int: """ return self._ptr[0].startTime @start_time.setter def start_time(self, val): if self._readonly: raise ValueError("This AccountingStats instance is read-only") self._ptr[0].startTime = val @property def is_running(self): """int: """ return self._ptr[0].isRunning @is_running.setter def is_running(self, val): if self._readonly: raise ValueError("This AccountingStats instance is read-only") self._ptr[0].isRunning = val @staticmethod def from_buffer(buffer): """Create an AccountingStats instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlAccountingStats_t), AccountingStats) @staticmethod def from_data(data): """Create an AccountingStats instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `accounting_stats_dtype` holding the data. """ return _cyb_from_data(data, "accounting_stats_dtype", accounting_stats_dtype, AccountingStats) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an AccountingStats instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef AccountingStats obj = AccountingStats.__new__(AccountingStats) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlAccountingStats_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_encoder_session_info_dtype_offsets(): cdef nvmlEncoderSessionInfo_t *pod = _cyb_calloc(1, sizeof(nvmlEncoderSessionInfo_t)) if pod == NULL: raise MemoryError("Error allocating nvmlEncoderSessionInfo_t") try: return _numpy.dtype({ 'names': ['session_id', 'pid', 'vgpu_instance', 'codec_type', 'h_resolution', 'v_resolution', 'average_fps', 'average_latency'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.int32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32], 'offsets': [ (&(pod.sessionId)) - (pod), (&(pod.pid)) - (pod), (&(pod.vgpuInstance)) - (pod), (&(pod.codecType)) - (pod), (&(pod.hResolution)) - (pod), (&(pod.vResolution)) - (pod), (&(pod.averageFps)) - (pod), (&(pod.averageLatency)) - (pod), ], 'itemsize': sizeof(nvmlEncoderSessionInfo_t), }) finally: _cyb_free(pod) encoder_session_info_dtype = _get_encoder_session_info_dtype_offsets() cdef object encoder_session_info_dtype_record = _numpy.dtype((_numpy.record, encoder_session_info_dtype)) cdef class EncoderSessionInfo: """Empty-initialize an array of `nvmlEncoderSessionInfo_t`. The resulting object is of length `size` and of dtype `encoder_session_info_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `nvmlEncoderSessionInfo_t` """ cdef: readonly object _data object _owner def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=encoder_session_info_dtype_record) assert self._data.itemsize == sizeof(nvmlEncoderSessionInfo_t), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlEncoderSessionInfo_t) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}.EncoderSessionInfo_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}.EncoderSessionInfo object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, EncoderSessionInfo)) 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 session_id(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["session_id"][0]) return self._data["session_id"] @session_id.setter def session_id(self, val): if not self._data.flags.writeable: raise ValueError("This EncoderSessionInfo instance is read-only") self._data["session_id"] = val @property def pid(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["pid"][0]) return self._data["pid"] @pid.setter def pid(self, val): if not self._data.flags.writeable: raise ValueError("This EncoderSessionInfo instance is read-only") self._data["pid"] = val @property def vgpu_instance(self): """Union[~_numpy.uint32, int]: """ 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): if not self._data.flags.writeable: raise ValueError("This EncoderSessionInfo instance is read-only") self._data["vgpu_instance"] = val @property def codec_type(self): """Union[~_numpy.int32, int]: """ if self._data.size == 1: return int(self._data["codec_type"][0]) return self._data["codec_type"] @codec_type.setter def codec_type(self, val): if not self._data.flags.writeable: raise ValueError("This EncoderSessionInfo instance is read-only") self._data["codec_type"] = val @property def h_resolution(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["h_resolution"][0]) return self._data["h_resolution"] @h_resolution.setter def h_resolution(self, val): if not self._data.flags.writeable: raise ValueError("This EncoderSessionInfo instance is read-only") self._data["h_resolution"] = val @property def v_resolution(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["v_resolution"][0]) return self._data["v_resolution"] @v_resolution.setter def v_resolution(self, val): if not self._data.flags.writeable: raise ValueError("This EncoderSessionInfo instance is read-only") self._data["v_resolution"] = val @property def average_fps(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["average_fps"][0]) return self._data["average_fps"] @average_fps.setter def average_fps(self, val): if not self._data.flags.writeable: raise ValueError("This EncoderSessionInfo instance is read-only") self._data["average_fps"] = val @property def average_latency(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["average_latency"][0]) return self._data["average_latency"] @average_latency.setter def average_latency(self, val): if not self._data.flags.writeable: raise ValueError("This EncoderSessionInfo instance is read-only") self._data["average_latency"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef EncoderSessionInfo obj 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 obj = EncoderSessionInfo.__new__(EncoderSessionInfo) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == encoder_session_info_dtype: obj = EncoderSessionInfo.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an EncoderSessionInfo instance with the memory from the given buffer.""" return EncoderSessionInfo.from_data(_numpy.frombuffer(buffer, dtype=encoder_session_info_dtype)) @staticmethod def from_data(data): """Create an EncoderSessionInfo instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `encoder_session_info_dtype` holding the data. """ cdef EncoderSessionInfo obj = EncoderSessionInfo.__new__(EncoderSessionInfo) 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 != encoder_session_info_dtype: raise ValueError("data array must be of dtype encoder_session_info_dtype") obj._data = data.view(dtype=encoder_session_info_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an EncoderSessionInfo 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 EncoderSessionInfo obj = EncoderSessionInfo.__new__(EncoderSessionInfo) 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(nvmlEncoderSessionInfo_t) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=encoder_session_info_dtype_record) obj._owner = owner return obj cdef _get_fbc_stats_dtype_offsets(): cdef nvmlFBCStats_t *pod = _cyb_calloc(1, sizeof(nvmlFBCStats_t)) if pod == NULL: raise MemoryError("Error allocating nvmlFBCStats_t") try: return _numpy.dtype({ 'names': ['sessions_count', 'average_fps', 'average_latency'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32], 'offsets': [ (&(pod.sessionsCount)) - (pod), (&(pod.averageFPS)) - (pod), (&(pod.averageLatency)) - (pod), ], 'itemsize': sizeof(nvmlFBCStats_t), }) finally: _cyb_free(pod) fbc_stats_dtype = _get_fbc_stats_dtype_offsets() cdef class FBCStats: """Empty-initialize an instance of `nvmlFBCStats_t`. .. seealso:: `nvmlFBCStats_t` """ cdef: nvmlFBCStats_t _data nvmlFBCStats_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.FBCStats object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef FBCStats other_ if not isinstance(other, FBCStats): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlFBCStats_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlFBCStats_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def sessions_count(self): """int: """ return self._ptr[0].sessionsCount @sessions_count.setter def sessions_count(self, val): if self._readonly: raise ValueError("This FBCStats instance is read-only") self._ptr[0].sessionsCount = val @property def average_fps(self): """int: """ return self._ptr[0].averageFPS @average_fps.setter def average_fps(self, val): if self._readonly: raise ValueError("This FBCStats instance is read-only") self._ptr[0].averageFPS = val @property def average_latency(self): """int: """ return self._ptr[0].averageLatency @average_latency.setter def average_latency(self, val): if self._readonly: raise ValueError("This FBCStats instance is read-only") self._ptr[0].averageLatency = val @staticmethod def from_buffer(buffer): """Create an FBCStats instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlFBCStats_t), FBCStats) @staticmethod def from_data(data): """Create an FBCStats instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `fbc_stats_dtype` holding the data. """ return _cyb_from_data(data, "fbc_stats_dtype", fbc_stats_dtype, FBCStats) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an FBCStats instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef FBCStats obj = FBCStats.__new__(FBCStats) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlFBCStats_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_fbc_session_info_dtype_offsets(): cdef nvmlFBCSessionInfo_t *pod = _cyb_calloc(1, sizeof(nvmlFBCSessionInfo_t)) if pod == NULL: raise MemoryError("Error allocating nvmlFBCSessionInfo_t") try: return _numpy.dtype({ 'names': ['session_id', 'pid', 'vgpu_instance', 'display_ordinal', 'session_type', 'session_flags', 'h_max_resolution', 'v_max_resolution', 'h_resolution', 'v_resolution', 'average_fps', 'average_latency'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.int32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32], 'offsets': [ (&(pod.sessionId)) - (pod), (&(pod.pid)) - (pod), (&(pod.vgpuInstance)) - (pod), (&(pod.displayOrdinal)) - (pod), (&(pod.sessionType)) - (pod), (&(pod.sessionFlags)) - (pod), (&(pod.hMaxResolution)) - (pod), (&(pod.vMaxResolution)) - (pod), (&(pod.hResolution)) - (pod), (&(pod.vResolution)) - (pod), (&(pod.averageFPS)) - (pod), (&(pod.averageLatency)) - (pod), ], 'itemsize': sizeof(nvmlFBCSessionInfo_t), }) finally: _cyb_free(pod) fbc_session_info_dtype = _get_fbc_session_info_dtype_offsets() cdef object fbc_session_info_dtype_record = _numpy.dtype((_numpy.record, fbc_session_info_dtype)) cdef class FBCSessionInfo: """Empty-initialize an array of `nvmlFBCSessionInfo_t`. The resulting object is of length `size` and of dtype `fbc_session_info_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `nvmlFBCSessionInfo_t` """ cdef: readonly object _data object _owner def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=fbc_session_info_dtype_record) assert self._data.itemsize == sizeof(nvmlFBCSessionInfo_t), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlFBCSessionInfo_t) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}.FBCSessionInfo_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}.FBCSessionInfo object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, FBCSessionInfo)) 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 session_id(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["session_id"][0]) return self._data["session_id"] @session_id.setter def session_id(self, val): if not self._data.flags.writeable: raise ValueError("This FBCSessionInfo instance is read-only") self._data["session_id"] = val @property def pid(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["pid"][0]) return self._data["pid"] @pid.setter def pid(self, val): if not self._data.flags.writeable: raise ValueError("This FBCSessionInfo instance is read-only") self._data["pid"] = val @property def vgpu_instance(self): """Union[~_numpy.uint32, int]: """ 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): if not self._data.flags.writeable: raise ValueError("This FBCSessionInfo instance is read-only") self._data["vgpu_instance"] = val @property def display_ordinal(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["display_ordinal"][0]) return self._data["display_ordinal"] @display_ordinal.setter def display_ordinal(self, val): if not self._data.flags.writeable: raise ValueError("This FBCSessionInfo instance is read-only") self._data["display_ordinal"] = val @property def session_type(self): """Union[~_numpy.int32, int]: """ if self._data.size == 1: return int(self._data["session_type"][0]) return self._data["session_type"] @session_type.setter def session_type(self, val): if not self._data.flags.writeable: raise ValueError("This FBCSessionInfo instance is read-only") self._data["session_type"] = val @property def session_flags(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["session_flags"][0]) return self._data["session_flags"] @session_flags.setter def session_flags(self, val): if not self._data.flags.writeable: raise ValueError("This FBCSessionInfo instance is read-only") self._data["session_flags"] = val @property def h_max_resolution(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["h_max_resolution"][0]) return self._data["h_max_resolution"] @h_max_resolution.setter def h_max_resolution(self, val): if not self._data.flags.writeable: raise ValueError("This FBCSessionInfo instance is read-only") self._data["h_max_resolution"] = val @property def v_max_resolution(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["v_max_resolution"][0]) return self._data["v_max_resolution"] @v_max_resolution.setter def v_max_resolution(self, val): if not self._data.flags.writeable: raise ValueError("This FBCSessionInfo instance is read-only") self._data["v_max_resolution"] = val @property def h_resolution(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["h_resolution"][0]) return self._data["h_resolution"] @h_resolution.setter def h_resolution(self, val): if not self._data.flags.writeable: raise ValueError("This FBCSessionInfo instance is read-only") self._data["h_resolution"] = val @property def v_resolution(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["v_resolution"][0]) return self._data["v_resolution"] @v_resolution.setter def v_resolution(self, val): if not self._data.flags.writeable: raise ValueError("This FBCSessionInfo instance is read-only") self._data["v_resolution"] = val @property def average_fps(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["average_fps"][0]) return self._data["average_fps"] @average_fps.setter def average_fps(self, val): if not self._data.flags.writeable: raise ValueError("This FBCSessionInfo instance is read-only") self._data["average_fps"] = val @property def average_latency(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["average_latency"][0]) return self._data["average_latency"] @average_latency.setter def average_latency(self, val): if not self._data.flags.writeable: raise ValueError("This FBCSessionInfo instance is read-only") self._data["average_latency"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef FBCSessionInfo obj 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 obj = FBCSessionInfo.__new__(FBCSessionInfo) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == fbc_session_info_dtype: obj = FBCSessionInfo.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an FBCSessionInfo instance with the memory from the given buffer.""" return FBCSessionInfo.from_data(_numpy.frombuffer(buffer, dtype=fbc_session_info_dtype)) @staticmethod def from_data(data): """Create an FBCSessionInfo instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `fbc_session_info_dtype` holding the data. """ cdef FBCSessionInfo obj = FBCSessionInfo.__new__(FBCSessionInfo) 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 != fbc_session_info_dtype: raise ValueError("data array must be of dtype fbc_session_info_dtype") obj._data = data.view(dtype=fbc_session_info_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an FBCSessionInfo 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 FBCSessionInfo obj = FBCSessionInfo.__new__(FBCSessionInfo) 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(nvmlFBCSessionInfo_t) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=fbc_session_info_dtype_record) obj._owner = owner return obj cdef _get_conf_compute_system_caps_dtype_offsets(): cdef nvmlConfComputeSystemCaps_t *pod = _cyb_calloc(1, sizeof(nvmlConfComputeSystemCaps_t)) if pod == NULL: raise MemoryError("Error allocating nvmlConfComputeSystemCaps_t") try: return _numpy.dtype({ 'names': ['cpu_caps', 'gpus_caps'], 'formats': [_numpy.uint32, _numpy.uint32], 'offsets': [ (&(pod.cpuCaps)) - (pod), (&(pod.gpusCaps)) - (pod), ], 'itemsize': sizeof(nvmlConfComputeSystemCaps_t), }) finally: _cyb_free(pod) conf_compute_system_caps_dtype = _get_conf_compute_system_caps_dtype_offsets() cdef class ConfComputeSystemCaps: """Empty-initialize an instance of `nvmlConfComputeSystemCaps_t`. .. seealso:: `nvmlConfComputeSystemCaps_t` """ cdef: nvmlConfComputeSystemCaps_t _data nvmlConfComputeSystemCaps_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.ConfComputeSystemCaps object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef ConfComputeSystemCaps other_ if not isinstance(other, ConfComputeSystemCaps): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlConfComputeSystemCaps_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlConfComputeSystemCaps_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def cpu_caps(self): """int: """ return self._ptr[0].cpuCaps @cpu_caps.setter def cpu_caps(self, val): if self._readonly: raise ValueError("This ConfComputeSystemCaps instance is read-only") self._ptr[0].cpuCaps = val @property def gpus_caps(self): """int: """ return self._ptr[0].gpusCaps @gpus_caps.setter def gpus_caps(self, val): if self._readonly: raise ValueError("This ConfComputeSystemCaps instance is read-only") self._ptr[0].gpusCaps = val @staticmethod def from_buffer(buffer): """Create an ConfComputeSystemCaps instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlConfComputeSystemCaps_t), ConfComputeSystemCaps) @staticmethod def from_data(data): """Create an ConfComputeSystemCaps instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `conf_compute_system_caps_dtype` holding the data. """ return _cyb_from_data(data, "conf_compute_system_caps_dtype", conf_compute_system_caps_dtype, ConfComputeSystemCaps) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an ConfComputeSystemCaps instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef ConfComputeSystemCaps obj = ConfComputeSystemCaps.__new__(ConfComputeSystemCaps) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlConfComputeSystemCaps_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_conf_compute_system_state_dtype_offsets(): cdef nvmlConfComputeSystemState_t *pod = _cyb_calloc(1, sizeof(nvmlConfComputeSystemState_t)) if pod == NULL: raise MemoryError("Error allocating nvmlConfComputeSystemState_t") try: return _numpy.dtype({ 'names': ['environment', 'cc_feature', 'dev_tools_mode'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32], 'offsets': [ (&(pod.environment)) - (pod), (&(pod.ccFeature)) - (pod), (&(pod.devToolsMode)) - (pod), ], 'itemsize': sizeof(nvmlConfComputeSystemState_t), }) finally: _cyb_free(pod) conf_compute_system_state_dtype = _get_conf_compute_system_state_dtype_offsets() cdef class ConfComputeSystemState: """Empty-initialize an instance of `nvmlConfComputeSystemState_t`. .. seealso:: `nvmlConfComputeSystemState_t` """ cdef: nvmlConfComputeSystemState_t _data nvmlConfComputeSystemState_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.ConfComputeSystemState object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef ConfComputeSystemState other_ if not isinstance(other, ConfComputeSystemState): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlConfComputeSystemState_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlConfComputeSystemState_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def environment(self): """int: """ return self._ptr[0].environment @environment.setter def environment(self, val): if self._readonly: raise ValueError("This ConfComputeSystemState instance is read-only") self._ptr[0].environment = val @property def cc_feature(self): """int: """ return self._ptr[0].ccFeature @cc_feature.setter def cc_feature(self, val): if self._readonly: raise ValueError("This ConfComputeSystemState instance is read-only") self._ptr[0].ccFeature = val @property def dev_tools_mode(self): """int: """ return self._ptr[0].devToolsMode @dev_tools_mode.setter def dev_tools_mode(self, val): if self._readonly: raise ValueError("This ConfComputeSystemState instance is read-only") self._ptr[0].devToolsMode = val @staticmethod def from_buffer(buffer): """Create an ConfComputeSystemState instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlConfComputeSystemState_t), ConfComputeSystemState) @staticmethod def from_data(data): """Create an ConfComputeSystemState instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `conf_compute_system_state_dtype` holding the data. """ return _cyb_from_data(data, "conf_compute_system_state_dtype", conf_compute_system_state_dtype, ConfComputeSystemState) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an ConfComputeSystemState instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef ConfComputeSystemState obj = ConfComputeSystemState.__new__(ConfComputeSystemState) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlConfComputeSystemState_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_system_conf_compute_settings_v1_dtype_offsets(): cdef nvmlSystemConfComputeSettings_v1_t *pod = _cyb_calloc(1, sizeof(nvmlSystemConfComputeSettings_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlSystemConfComputeSettings_v1_t") try: return _numpy.dtype({ 'names': ['version', 'environment', 'cc_feature', 'dev_tools_mode', 'multi_gpu_mode'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32], 'offsets': [ (&(pod.version)) - (pod), (&(pod.environment)) - (pod), (&(pod.ccFeature)) - (pod), (&(pod.devToolsMode)) - (pod), (&(pod.multiGpuMode)) - (pod), ], 'itemsize': sizeof(nvmlSystemConfComputeSettings_v1_t), }) finally: _cyb_free(pod) system_conf_compute_settings_v1_dtype = _get_system_conf_compute_settings_v1_dtype_offsets() cdef class SystemConfComputeSettings_v1: """Empty-initialize an instance of `nvmlSystemConfComputeSettings_v1_t`. .. seealso:: `nvmlSystemConfComputeSettings_v1_t` """ cdef: nvmlSystemConfComputeSettings_v1_t _data nvmlSystemConfComputeSettings_v1_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.SystemConfComputeSettings_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef SystemConfComputeSettings_v1 other_ if not isinstance(other, SystemConfComputeSettings_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlSystemConfComputeSettings_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlSystemConfComputeSettings_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def version(self): """int: """ return self._ptr[0].version @version.setter def version(self, val): if self._readonly: raise ValueError("This SystemConfComputeSettings_v1 instance is read-only") self._ptr[0].version = val @property def environment(self): """int: """ return self._ptr[0].environment @environment.setter def environment(self, val): if self._readonly: raise ValueError("This SystemConfComputeSettings_v1 instance is read-only") self._ptr[0].environment = val @property def cc_feature(self): """int: """ return self._ptr[0].ccFeature @cc_feature.setter def cc_feature(self, val): if self._readonly: raise ValueError("This SystemConfComputeSettings_v1 instance is read-only") self._ptr[0].ccFeature = val @property def dev_tools_mode(self): """int: """ return self._ptr[0].devToolsMode @dev_tools_mode.setter def dev_tools_mode(self, val): if self._readonly: raise ValueError("This SystemConfComputeSettings_v1 instance is read-only") self._ptr[0].devToolsMode = val @property def multi_gpu_mode(self): """int: """ return self._ptr[0].multiGpuMode @multi_gpu_mode.setter def multi_gpu_mode(self, val): if self._readonly: raise ValueError("This SystemConfComputeSettings_v1 instance is read-only") self._ptr[0].multiGpuMode = val @staticmethod def from_buffer(buffer): """Create an SystemConfComputeSettings_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlSystemConfComputeSettings_v1_t), SystemConfComputeSettings_v1) @staticmethod def from_data(data): """Create an SystemConfComputeSettings_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `system_conf_compute_settings_v1_dtype` holding the data. """ return _cyb_from_data(data, "system_conf_compute_settings_v1_dtype", system_conf_compute_settings_v1_dtype, SystemConfComputeSettings_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an SystemConfComputeSettings_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef SystemConfComputeSettings_v1 obj = SystemConfComputeSettings_v1.__new__(SystemConfComputeSettings_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlSystemConfComputeSettings_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_conf_compute_mem_size_info_dtype_offsets(): cdef nvmlConfComputeMemSizeInfo_t *pod = _cyb_calloc(1, sizeof(nvmlConfComputeMemSizeInfo_t)) if pod == NULL: raise MemoryError("Error allocating nvmlConfComputeMemSizeInfo_t") try: return _numpy.dtype({ 'names': ['protected_mem_size_kib', 'unprotected_mem_size_kib'], 'formats': [_numpy.uint64, _numpy.uint64], 'offsets': [ (&(pod.protectedMemSizeKib)) - (pod), (&(pod.unprotectedMemSizeKib)) - (pod), ], 'itemsize': sizeof(nvmlConfComputeMemSizeInfo_t), }) finally: _cyb_free(pod) conf_compute_mem_size_info_dtype = _get_conf_compute_mem_size_info_dtype_offsets() cdef class ConfComputeMemSizeInfo: """Empty-initialize an instance of `nvmlConfComputeMemSizeInfo_t`. .. seealso:: `nvmlConfComputeMemSizeInfo_t` """ cdef: nvmlConfComputeMemSizeInfo_t _data nvmlConfComputeMemSizeInfo_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.ConfComputeMemSizeInfo object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef ConfComputeMemSizeInfo other_ if not isinstance(other, ConfComputeMemSizeInfo): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlConfComputeMemSizeInfo_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlConfComputeMemSizeInfo_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def protected_mem_size_kib(self): """int: """ return self._ptr[0].protectedMemSizeKib @protected_mem_size_kib.setter def protected_mem_size_kib(self, val): if self._readonly: raise ValueError("This ConfComputeMemSizeInfo instance is read-only") self._ptr[0].protectedMemSizeKib = val @property def unprotected_mem_size_kib(self): """int: """ return self._ptr[0].unprotectedMemSizeKib @unprotected_mem_size_kib.setter def unprotected_mem_size_kib(self, val): if self._readonly: raise ValueError("This ConfComputeMemSizeInfo instance is read-only") self._ptr[0].unprotectedMemSizeKib = val @staticmethod def from_buffer(buffer): """Create an ConfComputeMemSizeInfo instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlConfComputeMemSizeInfo_t), ConfComputeMemSizeInfo) @staticmethod def from_data(data): """Create an ConfComputeMemSizeInfo instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `conf_compute_mem_size_info_dtype` holding the data. """ return _cyb_from_data(data, "conf_compute_mem_size_info_dtype", conf_compute_mem_size_info_dtype, ConfComputeMemSizeInfo) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an ConfComputeMemSizeInfo instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef ConfComputeMemSizeInfo obj = ConfComputeMemSizeInfo.__new__(ConfComputeMemSizeInfo) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlConfComputeMemSizeInfo_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_conf_compute_gpu_certificate_dtype_offsets(): cdef nvmlConfComputeGpuCertificate_t *pod = _cyb_calloc(1, sizeof(nvmlConfComputeGpuCertificate_t)) if pod == NULL: raise MemoryError("Error allocating nvmlConfComputeGpuCertificate_t") try: return _numpy.dtype({ 'names': ['cert_chain_size', 'attestation_cert_chain_size', 'cert_chain', 'attestation_cert_chain'], 'formats': [_numpy.uint32, _numpy.uint32, (_numpy.uint8, 4096), (_numpy.uint8, 5120)], 'offsets': [ (&(pod.certChainSize)) - (pod), (&(pod.attestationCertChainSize)) - (pod), (&(pod.certChain)) - (pod), (&(pod.attestationCertChain)) - (pod), ], 'itemsize': sizeof(nvmlConfComputeGpuCertificate_t), }) finally: _cyb_free(pod) conf_compute_gpu_certificate_dtype = _get_conf_compute_gpu_certificate_dtype_offsets() cdef class ConfComputeGpuCertificate: """Empty-initialize an instance of `nvmlConfComputeGpuCertificate_t`. .. seealso:: `nvmlConfComputeGpuCertificate_t` """ cdef: nvmlConfComputeGpuCertificate_t _data nvmlConfComputeGpuCertificate_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.ConfComputeGpuCertificate object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef ConfComputeGpuCertificate other_ if not isinstance(other, ConfComputeGpuCertificate): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlConfComputeGpuCertificate_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlConfComputeGpuCertificate_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def cert_chain(self): """~_numpy.uint8: (array of length 4096).""" if self._ptr[0].certChainSize == 0: return _numpy.array([]) cdef _cyb_view.array arr = _cyb_view.array(shape=(self._ptr[0].certChainSize,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False) arr.data = (&(self._ptr[0].certChain)) return _numpy.asarray(arr) @cert_chain.setter def cert_chain(self, val): if self._readonly: raise ValueError("This ConfComputeGpuCertificate instance is read-only") if len(val) > 4096: raise ValueError(f"Too many elements for field cert_chain, max is 4096, got {len(val)}") self._ptr[0].certChainSize = len(val) if len(val) == 0: return cdef _cyb_view.array arr = _cyb_view.array(shape=(self._ptr[0].certChainSize,), itemsize=sizeof(unsigned char), format="B", mode="c") arr[:] = _numpy.asarray(val, dtype=_numpy.uint8) _cyb_memcpy((&(self._ptr[0].certChain)), (arr.data), sizeof(unsigned char) * len(val)) @property def attestation_cert_chain(self): """~_numpy.uint8: (array of length 5120).""" if self._ptr[0].attestationCertChainSize == 0: return _numpy.array([]) cdef _cyb_view.array arr = _cyb_view.array(shape=(self._ptr[0].attestationCertChainSize,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False) arr.data = (&(self._ptr[0].attestationCertChain)) return _numpy.asarray(arr) @attestation_cert_chain.setter def attestation_cert_chain(self, val): if self._readonly: raise ValueError("This ConfComputeGpuCertificate instance is read-only") if len(val) > 5120: raise ValueError(f"Too many elements for field attestation_cert_chain, max is 5120, got {len(val)}") self._ptr[0].attestationCertChainSize = len(val) if len(val) == 0: return cdef _cyb_view.array arr = _cyb_view.array(shape=(self._ptr[0].attestationCertChainSize,), itemsize=sizeof(unsigned char), format="B", mode="c") arr[:] = _numpy.asarray(val, dtype=_numpy.uint8) _cyb_memcpy((&(self._ptr[0].attestationCertChain)), (arr.data), sizeof(unsigned char) * len(val)) @staticmethod def from_buffer(buffer): """Create an ConfComputeGpuCertificate instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlConfComputeGpuCertificate_t), ConfComputeGpuCertificate) @staticmethod def from_data(data): """Create an ConfComputeGpuCertificate instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `conf_compute_gpu_certificate_dtype` holding the data. """ return _cyb_from_data(data, "conf_compute_gpu_certificate_dtype", conf_compute_gpu_certificate_dtype, ConfComputeGpuCertificate) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an ConfComputeGpuCertificate instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef ConfComputeGpuCertificate obj = ConfComputeGpuCertificate.__new__(ConfComputeGpuCertificate) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlConfComputeGpuCertificate_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_conf_compute_gpu_attestation_report_dtype_offsets(): cdef nvmlConfComputeGpuAttestationReport_t *pod = _cyb_calloc(1, sizeof(nvmlConfComputeGpuAttestationReport_t)) if pod == NULL: raise MemoryError("Error allocating nvmlConfComputeGpuAttestationReport_t") try: return _numpy.dtype({ 'names': ['is_cec_attestation_report_present', 'attestation_report_size', 'cec_attestation_report_size', 'nonce', 'attestation_report', 'cec_attestation_report'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, (_numpy.uint8, 32), (_numpy.uint8, 8192), (_numpy.uint8, 4096)], 'offsets': [ (&(pod.isCecAttestationReportPresent)) - (pod), (&(pod.attestationReportSize)) - (pod), (&(pod.cecAttestationReportSize)) - (pod), (&(pod.nonce)) - (pod), (&(pod.attestationReport)) - (pod), (&(pod.cecAttestationReport)) - (pod), ], 'itemsize': sizeof(nvmlConfComputeGpuAttestationReport_t), }) finally: _cyb_free(pod) conf_compute_gpu_attestation_report_dtype = _get_conf_compute_gpu_attestation_report_dtype_offsets() cdef class ConfComputeGpuAttestationReport: """Empty-initialize an instance of `nvmlConfComputeGpuAttestationReport_t`. .. seealso:: `nvmlConfComputeGpuAttestationReport_t` """ cdef: nvmlConfComputeGpuAttestationReport_t _data nvmlConfComputeGpuAttestationReport_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.ConfComputeGpuAttestationReport object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef ConfComputeGpuAttestationReport other_ if not isinstance(other, ConfComputeGpuAttestationReport): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlConfComputeGpuAttestationReport_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlConfComputeGpuAttestationReport_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def is_cec_attestation_report_present(self): """int: """ return self._ptr[0].isCecAttestationReportPresent @is_cec_attestation_report_present.setter def is_cec_attestation_report_present(self, val): if self._readonly: raise ValueError("This ConfComputeGpuAttestationReport instance is read-only") self._ptr[0].isCecAttestationReportPresent = val @property def nonce(self): """~_numpy.uint8: (array of length 32).""" cdef _cyb_view.array arr = _cyb_view.array(shape=(32,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False) arr.data = (&(self._ptr[0].nonce)) return _numpy.asarray(arr) @nonce.setter def nonce(self, val): if self._readonly: raise ValueError("This ConfComputeGpuAttestationReport instance is read-only") if len(val) != 32: raise ValueError(f"Expected length { 32 } for field nonce, got {len(val)}") cdef _cyb_view.array arr = _cyb_view.array(shape=(32,), itemsize=sizeof(unsigned char), format="B", mode="c") arr[:] = _numpy.asarray(val, dtype=_numpy.uint8) _cyb_memcpy((&(self._ptr[0].nonce)), (arr.data), sizeof(unsigned char) * len(val)) @property def attestation_report(self): """~_numpy.uint8: (array of length 8192).""" if self._ptr[0].attestationReportSize == 0: return _numpy.array([]) cdef _cyb_view.array arr = _cyb_view.array(shape=(self._ptr[0].attestationReportSize,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False) arr.data = (&(self._ptr[0].attestationReport)) return _numpy.asarray(arr) @attestation_report.setter def attestation_report(self, val): if self._readonly: raise ValueError("This ConfComputeGpuAttestationReport instance is read-only") if len(val) > 8192: raise ValueError(f"Too many elements for field attestation_report, max is 8192, got {len(val)}") self._ptr[0].attestationReportSize = len(val) if len(val) == 0: return cdef _cyb_view.array arr = _cyb_view.array(shape=(self._ptr[0].attestationReportSize,), itemsize=sizeof(unsigned char), format="B", mode="c") arr[:] = _numpy.asarray(val, dtype=_numpy.uint8) _cyb_memcpy((&(self._ptr[0].attestationReport)), (arr.data), sizeof(unsigned char) * len(val)) @property def cec_attestation_report(self): """~_numpy.uint8: (array of length 4096).""" if self._ptr[0].cecAttestationReportSize == 0: return _numpy.array([]) cdef _cyb_view.array arr = _cyb_view.array(shape=(self._ptr[0].cecAttestationReportSize,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False) arr.data = (&(self._ptr[0].cecAttestationReport)) return _numpy.asarray(arr) @cec_attestation_report.setter def cec_attestation_report(self, val): if self._readonly: raise ValueError("This ConfComputeGpuAttestationReport instance is read-only") if len(val) > 4096: raise ValueError(f"Too many elements for field cec_attestation_report, max is 4096, got {len(val)}") self._ptr[0].cecAttestationReportSize = len(val) if len(val) == 0: return cdef _cyb_view.array arr = _cyb_view.array(shape=(self._ptr[0].cecAttestationReportSize,), itemsize=sizeof(unsigned char), format="B", mode="c") arr[:] = _numpy.asarray(val, dtype=_numpy.uint8) _cyb_memcpy((&(self._ptr[0].cecAttestationReport)), (arr.data), sizeof(unsigned char) * len(val)) @staticmethod def from_buffer(buffer): """Create an ConfComputeGpuAttestationReport instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlConfComputeGpuAttestationReport_t), ConfComputeGpuAttestationReport) @staticmethod def from_data(data): """Create an ConfComputeGpuAttestationReport instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `conf_compute_gpu_attestation_report_dtype` holding the data. """ return _cyb_from_data(data, "conf_compute_gpu_attestation_report_dtype", conf_compute_gpu_attestation_report_dtype, ConfComputeGpuAttestationReport) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an ConfComputeGpuAttestationReport instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef ConfComputeGpuAttestationReport obj = ConfComputeGpuAttestationReport.__new__(ConfComputeGpuAttestationReport) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlConfComputeGpuAttestationReport_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_gpu_fabric_info_v2_dtype_offsets(): cdef nvmlGpuFabricInfo_v2_t *pod = _cyb_calloc(1, sizeof(nvmlGpuFabricInfo_v2_t)) if pod == NULL: raise MemoryError("Error allocating nvmlGpuFabricInfo_v2_t") try: return _numpy.dtype({ 'names': ['version', 'cluster_uuid', 'status', 'clique_id', 'state', 'health_mask'], 'formats': [_numpy.uint32, (_numpy.uint8, 16), _numpy.int32, _numpy.uint32, _numpy.uint8, _numpy.uint32], 'offsets': [ (&(pod.version)) - (pod), (&(pod.clusterUuid)) - (pod), (&(pod.status)) - (pod), (&(pod.cliqueId)) - (pod), (&(pod.state)) - (pod), (&(pod.healthMask)) - (pod), ], 'itemsize': sizeof(nvmlGpuFabricInfo_v2_t), }) finally: _cyb_free(pod) gpu_fabric_info_v2_dtype = _get_gpu_fabric_info_v2_dtype_offsets() cdef class GpuFabricInfo_v2: """Empty-initialize an instance of `nvmlGpuFabricInfo_v2_t`. .. seealso:: `nvmlGpuFabricInfo_v2_t` """ cdef: nvmlGpuFabricInfo_v2_t _data nvmlGpuFabricInfo_v2_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.GpuFabricInfo_v2 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef GpuFabricInfo_v2 other_ if not isinstance(other, GpuFabricInfo_v2): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlGpuFabricInfo_v2_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlGpuFabricInfo_v2_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def version(self): """int: Structure version identifier (set to nvmlGpuFabricInfo_v2).""" return self._ptr[0].version @version.setter def version(self, val): if self._readonly: raise ValueError("This GpuFabricInfo_v2 instance is read-only") self._ptr[0].version = val @property def cluster_uuid(self): """~_numpy.uint8: (array of length 16).Uuid of the cluster to which this GPU belongs.""" cdef _cyb_view.array arr = _cyb_view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False) arr.data = (&(self._ptr[0].clusterUuid)) return _numpy.asarray(arr) @cluster_uuid.setter def cluster_uuid(self, val): if self._readonly: raise ValueError("This GpuFabricInfo_v2 instance is read-only") if len(val) != 16: raise ValueError(f"Expected length { 16 } for field cluster_uuid, got {len(val)}") cdef _cyb_view.array arr = _cyb_view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c") arr[:] = _numpy.asarray(val, dtype=_numpy.uint8) _cyb_memcpy((&(self._ptr[0].clusterUuid)), (arr.data), sizeof(unsigned char) * len(val)) @property def status(self): """int: Probe Error status, if any. Must be checked only if Probe state returns "complete".""" return (self._ptr[0].status) @status.setter def status(self, val): if self._readonly: raise ValueError("This GpuFabricInfo_v2 instance is read-only") self._ptr[0].status = val @property def clique_id(self): """int: ID of the fabric clique to which this GPU belongs.""" return self._ptr[0].cliqueId @clique_id.setter def clique_id(self, val): if self._readonly: raise ValueError("This GpuFabricInfo_v2 instance is read-only") self._ptr[0].cliqueId = val @property def state(self): """int: Current Probe State of GPU registration process. See NVML_GPU_FABRIC_STATE_*.""" return (self._ptr[0].state) @state.setter def state(self, val): if self._readonly: raise ValueError("This GpuFabricInfo_v2 instance is read-only") self._ptr[0].state = val @property def health_mask(self): """int: GPU Fabric health Status Mask. See NVML_GPU_FABRIC_HEALTH_MASK_*.""" return self._ptr[0].healthMask @health_mask.setter def health_mask(self, val): if self._readonly: raise ValueError("This GpuFabricInfo_v2 instance is read-only") self._ptr[0].healthMask = val @staticmethod def from_buffer(buffer): """Create an GpuFabricInfo_v2 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlGpuFabricInfo_v2_t), GpuFabricInfo_v2) @staticmethod def from_data(data): """Create an GpuFabricInfo_v2 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `gpu_fabric_info_v2_dtype` holding the data. """ return _cyb_from_data(data, "gpu_fabric_info_v2_dtype", gpu_fabric_info_v2_dtype, GpuFabricInfo_v2) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an GpuFabricInfo_v2 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef GpuFabricInfo_v2 obj = GpuFabricInfo_v2.__new__(GpuFabricInfo_v2) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlGpuFabricInfo_v2_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_nvlink_supported_bw_modes_v1_dtype_offsets(): cdef nvmlNvlinkSupportedBwModes_v1_t *pod = _cyb_calloc(1, sizeof(nvmlNvlinkSupportedBwModes_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlNvlinkSupportedBwModes_v1_t") try: return _numpy.dtype({ 'names': ['version', 'bw_modes', 'total_bw_modes'], 'formats': [_numpy.uint32, (_numpy.uint8, 23), _numpy.uint8], 'offsets': [ (&(pod.version)) - (pod), (&(pod.bwModes)) - (pod), (&(pod.totalBwModes)) - (pod), ], 'itemsize': sizeof(nvmlNvlinkSupportedBwModes_v1_t), }) finally: _cyb_free(pod) nvlink_supported_bw_modes_v1_dtype = _get_nvlink_supported_bw_modes_v1_dtype_offsets() cdef class NvlinkSupportedBwModes_v1: """Empty-initialize an instance of `nvmlNvlinkSupportedBwModes_v1_t`. .. seealso:: `nvmlNvlinkSupportedBwModes_v1_t` """ cdef: nvmlNvlinkSupportedBwModes_v1_t _data nvmlNvlinkSupportedBwModes_v1_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.NvlinkSupportedBwModes_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef NvlinkSupportedBwModes_v1 other_ if not isinstance(other, NvlinkSupportedBwModes_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlNvlinkSupportedBwModes_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlNvlinkSupportedBwModes_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def version(self): """int: """ return self._ptr[0].version @version.setter def version(self, val): if self._readonly: raise ValueError("This NvlinkSupportedBwModes_v1 instance is read-only") self._ptr[0].version = val @property def bw_modes(self): """~_numpy.uint8: (array of length 23).""" if self._ptr[0].totalBwModes == 0: return _numpy.array([]) cdef _cyb_view.array arr = _cyb_view.array(shape=(self._ptr[0].totalBwModes,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False) arr.data = (&(self._ptr[0].bwModes)) return _numpy.asarray(arr) @bw_modes.setter def bw_modes(self, val): if self._readonly: raise ValueError("This NvlinkSupportedBwModes_v1 instance is read-only") if len(val) > 23: raise ValueError(f"Too many elements for field bw_modes, max is 23, got {len(val)}") self._ptr[0].totalBwModes = len(val) if len(val) == 0: return cdef _cyb_view.array arr = _cyb_view.array(shape=(self._ptr[0].totalBwModes,), itemsize=sizeof(unsigned char), format="B", mode="c") arr[:] = _numpy.asarray(val, dtype=_numpy.uint8) _cyb_memcpy((&(self._ptr[0].bwModes)), (arr.data), sizeof(unsigned char) * len(val)) @staticmethod def from_buffer(buffer): """Create an NvlinkSupportedBwModes_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlNvlinkSupportedBwModes_v1_t), NvlinkSupportedBwModes_v1) @staticmethod def from_data(data): """Create an NvlinkSupportedBwModes_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `nvlink_supported_bw_modes_v1_dtype` holding the data. """ return _cyb_from_data(data, "nvlink_supported_bw_modes_v1_dtype", nvlink_supported_bw_modes_v1_dtype, NvlinkSupportedBwModes_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an NvlinkSupportedBwModes_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef NvlinkSupportedBwModes_v1 obj = NvlinkSupportedBwModes_v1.__new__(NvlinkSupportedBwModes_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlNvlinkSupportedBwModes_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_nvlink_get_bw_mode_v1_dtype_offsets(): cdef nvmlNvlinkGetBwMode_v1_t *pod = _cyb_calloc(1, sizeof(nvmlNvlinkGetBwMode_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlNvlinkGetBwMode_v1_t") try: return _numpy.dtype({ 'names': ['version', 'b_is_best', 'bw_mode'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint8], 'offsets': [ (&(pod.version)) - (pod), (&(pod.bIsBest)) - (pod), (&(pod.bwMode)) - (pod), ], 'itemsize': sizeof(nvmlNvlinkGetBwMode_v1_t), }) finally: _cyb_free(pod) nvlink_get_bw_mode_v1_dtype = _get_nvlink_get_bw_mode_v1_dtype_offsets() cdef class NvlinkGetBwMode_v1: """Empty-initialize an instance of `nvmlNvlinkGetBwMode_v1_t`. .. seealso:: `nvmlNvlinkGetBwMode_v1_t` """ cdef: nvmlNvlinkGetBwMode_v1_t _data nvmlNvlinkGetBwMode_v1_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.NvlinkGetBwMode_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef NvlinkGetBwMode_v1 other_ if not isinstance(other, NvlinkGetBwMode_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlNvlinkGetBwMode_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlNvlinkGetBwMode_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def version(self): """int: """ return self._ptr[0].version @version.setter def version(self, val): if self._readonly: raise ValueError("This NvlinkGetBwMode_v1 instance is read-only") self._ptr[0].version = val @property def b_is_best(self): """int: """ return self._ptr[0].bIsBest @b_is_best.setter def b_is_best(self, val): if self._readonly: raise ValueError("This NvlinkGetBwMode_v1 instance is read-only") self._ptr[0].bIsBest = val @property def bw_mode(self): """int: """ return self._ptr[0].bwMode @bw_mode.setter def bw_mode(self, val): if self._readonly: raise ValueError("This NvlinkGetBwMode_v1 instance is read-only") self._ptr[0].bwMode = val @staticmethod def from_buffer(buffer): """Create an NvlinkGetBwMode_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlNvlinkGetBwMode_v1_t), NvlinkGetBwMode_v1) @staticmethod def from_data(data): """Create an NvlinkGetBwMode_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `nvlink_get_bw_mode_v1_dtype` holding the data. """ return _cyb_from_data(data, "nvlink_get_bw_mode_v1_dtype", nvlink_get_bw_mode_v1_dtype, NvlinkGetBwMode_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an NvlinkGetBwMode_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef NvlinkGetBwMode_v1 obj = NvlinkGetBwMode_v1.__new__(NvlinkGetBwMode_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlNvlinkGetBwMode_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_nvlink_set_bw_mode_v1_dtype_offsets(): cdef nvmlNvlinkSetBwMode_v1_t *pod = _cyb_calloc(1, sizeof(nvmlNvlinkSetBwMode_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlNvlinkSetBwMode_v1_t") try: return _numpy.dtype({ 'names': ['version', 'b_set_best', 'bw_mode'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint8], 'offsets': [ (&(pod.version)) - (pod), (&(pod.bSetBest)) - (pod), (&(pod.bwMode)) - (pod), ], 'itemsize': sizeof(nvmlNvlinkSetBwMode_v1_t), }) finally: _cyb_free(pod) nvlink_set_bw_mode_v1_dtype = _get_nvlink_set_bw_mode_v1_dtype_offsets() cdef class NvlinkSetBwMode_v1: """Empty-initialize an instance of `nvmlNvlinkSetBwMode_v1_t`. .. seealso:: `nvmlNvlinkSetBwMode_v1_t` """ cdef: nvmlNvlinkSetBwMode_v1_t _data nvmlNvlinkSetBwMode_v1_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.NvlinkSetBwMode_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef NvlinkSetBwMode_v1 other_ if not isinstance(other, NvlinkSetBwMode_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlNvlinkSetBwMode_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlNvlinkSetBwMode_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def version(self): """int: """ return self._ptr[0].version @version.setter def version(self, val): if self._readonly: raise ValueError("This NvlinkSetBwMode_v1 instance is read-only") self._ptr[0].version = val @property def b_set_best(self): """int: """ return self._ptr[0].bSetBest @b_set_best.setter def b_set_best(self, val): if self._readonly: raise ValueError("This NvlinkSetBwMode_v1 instance is read-only") self._ptr[0].bSetBest = val @property def bw_mode(self): """int: """ return self._ptr[0].bwMode @bw_mode.setter def bw_mode(self, val): if self._readonly: raise ValueError("This NvlinkSetBwMode_v1 instance is read-only") self._ptr[0].bwMode = val @staticmethod def from_buffer(buffer): """Create an NvlinkSetBwMode_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlNvlinkSetBwMode_v1_t), NvlinkSetBwMode_v1) @staticmethod def from_data(data): """Create an NvlinkSetBwMode_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `nvlink_set_bw_mode_v1_dtype` holding the data. """ return _cyb_from_data(data, "nvlink_set_bw_mode_v1_dtype", nvlink_set_bw_mode_v1_dtype, NvlinkSetBwMode_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an NvlinkSetBwMode_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef NvlinkSetBwMode_v1 obj = NvlinkSetBwMode_v1.__new__(NvlinkSetBwMode_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlNvlinkSetBwMode_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_vgpu_version_dtype_offsets(): cdef nvmlVgpuVersion_t *pod = _cyb_calloc(1, sizeof(nvmlVgpuVersion_t)) if pod == NULL: raise MemoryError("Error allocating nvmlVgpuVersion_t") try: return _numpy.dtype({ 'names': ['min_version', 'max_version'], 'formats': [_numpy.uint32, _numpy.uint32], 'offsets': [ (&(pod.minVersion)) - (pod), (&(pod.maxVersion)) - (pod), ], 'itemsize': sizeof(nvmlVgpuVersion_t), }) finally: _cyb_free(pod) vgpu_version_dtype = _get_vgpu_version_dtype_offsets() cdef class VgpuVersion: """Empty-initialize an instance of `nvmlVgpuVersion_t`. .. seealso:: `nvmlVgpuVersion_t` """ cdef: nvmlVgpuVersion_t *_ptr object _owner 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._readonly = False def __dealloc__(self): cdef nvmlVgpuVersion_t *ptr if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) def __repr__(self): return f"<{__name__}.VgpuVersion object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef VgpuVersion other_ if not isinstance(other, VgpuVersion): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuVersion_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuVersion_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def min_version(self): """int: """ return self._ptr[0].minVersion @min_version.setter def min_version(self, val): if self._readonly: raise ValueError("This VgpuVersion instance is read-only") self._ptr[0].minVersion = val @property def max_version(self): """int: """ return self._ptr[0].maxVersion @max_version.setter def max_version(self, val): if self._readonly: raise ValueError("This VgpuVersion instance is read-only") self._ptr[0].maxVersion = val @staticmethod def from_buffer(buffer): """Create an VgpuVersion instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlVgpuVersion_t), VgpuVersion) @staticmethod def from_data(data): """Create an VgpuVersion instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `vgpu_version_dtype` holding the data. """ return _cyb_from_data(data, "vgpu_version_dtype", vgpu_version_dtype, VgpuVersion) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an VgpuVersion instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef VgpuVersion obj = VgpuVersion.__new__(VgpuVersion) if owner is None: obj._ptr = _cyb_malloc(sizeof(nvmlVgpuVersion_t)) if obj._ptr == NULL: raise MemoryError("Error allocating VgpuVersion") _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuVersion_t)) obj._owns_ptr = True obj._owner = None else: obj._ptr = ptr obj._owns_ptr = False obj._owner = owner obj._readonly = readonly return obj cdef _get_vgpu_metadata_dtype_offsets(): cdef nvmlVgpuMetadata_t *pod = _cyb_calloc(1, sizeof(nvmlVgpuMetadata_t)) if pod == NULL: raise MemoryError("Error allocating nvmlVgpuMetadata_t") try: return _numpy.dtype({ 'names': ['version', 'revision', 'guest_info_state', 'guest_driver_version', 'host_driver_version', 'reserved', 'vgpu_virtualization_caps', 'guest_vgpu_version', 'opaque_data_size', 'opaque_data'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.int32, (_numpy.int8, 80), (_numpy.int8, 80), (_numpy.uint32, 6), _numpy.uint32, _numpy.uint32, _numpy.uint32, (_numpy.int8, 4)], 'offsets': [ (&(pod.version)) - (pod), (&(pod.revision)) - (pod), (&(pod.guestInfoState)) - (pod), (&(pod.guestDriverVersion)) - (pod), (&(pod.hostDriverVersion)) - (pod), (&(pod.reserved)) - (pod), (&(pod.vgpuVirtualizationCaps)) - (pod), (&(pod.guestVgpuVersion)) - (pod), (&(pod.opaqueDataSize)) - (pod), (&(pod.opaqueData)) - (pod), ], 'itemsize': sizeof(nvmlVgpuMetadata_t), }) finally: _cyb_free(pod) vgpu_metadata_dtype = _get_vgpu_metadata_dtype_offsets() cdef class VgpuMetadata: """Empty-initialize an instance of `nvmlVgpuMetadata_t`. .. seealso:: `nvmlVgpuMetadata_t` """ cdef: nvmlVgpuMetadata_t _data nvmlVgpuMetadata_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.VgpuMetadata object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef VgpuMetadata other_ if not isinstance(other, VgpuMetadata): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuMetadata_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuMetadata_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def version(self): """int: """ return self._ptr[0].version @version.setter def version(self, val): if self._readonly: raise ValueError("This VgpuMetadata instance is read-only") self._ptr[0].version = val @property def revision(self): """int: """ return self._ptr[0].revision @revision.setter def revision(self, val): if self._readonly: raise ValueError("This VgpuMetadata instance is read-only") self._ptr[0].revision = val @property def guest_info_state(self): """int: """ return (self._ptr[0].guestInfoState) @guest_info_state.setter def guest_info_state(self, val): if self._readonly: raise ValueError("This VgpuMetadata instance is read-only") self._ptr[0].guestInfoState = val @property def guest_driver_version(self): """~_numpy.int8: (array of length 80).""" return _cyb_cpython.PyUnicode_FromString(self._ptr[0].guestDriverVersion) @guest_driver_version.setter def guest_driver_version(self, val): if self._readonly: raise ValueError("This VgpuMetadata instance is read-only") cdef bytes buf = val.encode() if len(buf) >= 80: raise ValueError("String too long for field guest_driver_version, max length is 79") cdef char *ptr = buf _cyb_memcpy((self._ptr[0].guestDriverVersion), ptr, 80) @property def host_driver_version(self): """~_numpy.int8: (array of length 80).""" return _cyb_cpython.PyUnicode_FromString(self._ptr[0].hostDriverVersion) @host_driver_version.setter def host_driver_version(self, val): if self._readonly: raise ValueError("This VgpuMetadata instance is read-only") cdef bytes buf = val.encode() if len(buf) >= 80: raise ValueError("String too long for field host_driver_version, max length is 79") cdef char *ptr = buf _cyb_memcpy((self._ptr[0].hostDriverVersion), ptr, 80) @property def vgpu_virtualization_caps(self): """int: """ return self._ptr[0].vgpuVirtualizationCaps @vgpu_virtualization_caps.setter def vgpu_virtualization_caps(self, val): if self._readonly: raise ValueError("This VgpuMetadata instance is read-only") self._ptr[0].vgpuVirtualizationCaps = val @property def guest_vgpu_version(self): """int: """ return self._ptr[0].guestVgpuVersion @guest_vgpu_version.setter def guest_vgpu_version(self, val): if self._readonly: raise ValueError("This VgpuMetadata instance is read-only") self._ptr[0].guestVgpuVersion = val @property def opaque_data_size(self): """int: """ return self._ptr[0].opaqueDataSize @opaque_data_size.setter def opaque_data_size(self, val): if self._readonly: raise ValueError("This VgpuMetadata instance is read-only") self._ptr[0].opaqueDataSize = val @property def opaque_data(self): """~_numpy.int8: (array of length 4).""" return _cyb_cpython.PyUnicode_FromString(self._ptr[0].opaqueData) @opaque_data.setter def opaque_data(self, val): if self._readonly: raise ValueError("This VgpuMetadata instance is read-only") cdef bytes buf = val.encode() if len(buf) >= 4: raise ValueError("String too long for field opaque_data, max length is 3") cdef char *ptr = buf _cyb_memcpy((self._ptr[0].opaqueData), ptr, 4) @staticmethod def from_buffer(buffer): """Create an VgpuMetadata instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlVgpuMetadata_t), VgpuMetadata) @staticmethod def from_data(data): """Create an VgpuMetadata instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `vgpu_metadata_dtype` holding the data. """ return _cyb_from_data(data, "vgpu_metadata_dtype", vgpu_metadata_dtype, VgpuMetadata) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an VgpuMetadata instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef VgpuMetadata obj = VgpuMetadata.__new__(VgpuMetadata) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlVgpuMetadata_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_vgpu_pgpu_compatibility_dtype_offsets(): cdef nvmlVgpuPgpuCompatibility_t *pod = _cyb_calloc(1, sizeof(nvmlVgpuPgpuCompatibility_t)) if pod == NULL: raise MemoryError("Error allocating nvmlVgpuPgpuCompatibility_t") try: return _numpy.dtype({ 'names': ['vgpu_vm_compatibility', 'compatibility_limit_code'], 'formats': [_numpy.int32, _numpy.int32], 'offsets': [ (&(pod.vgpuVmCompatibility)) - (pod), (&(pod.compatibilityLimitCode)) - (pod), ], 'itemsize': sizeof(nvmlVgpuPgpuCompatibility_t), }) finally: _cyb_free(pod) vgpu_pgpu_compatibility_dtype = _get_vgpu_pgpu_compatibility_dtype_offsets() cdef class VgpuPgpuCompatibility: """Empty-initialize an instance of `nvmlVgpuPgpuCompatibility_t`. .. seealso:: `nvmlVgpuPgpuCompatibility_t` """ cdef: nvmlVgpuPgpuCompatibility_t _data nvmlVgpuPgpuCompatibility_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.VgpuPgpuCompatibility object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef VgpuPgpuCompatibility other_ if not isinstance(other, VgpuPgpuCompatibility): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuPgpuCompatibility_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuPgpuCompatibility_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def vgpu_vm_compatibility(self): """int: """ return (self._ptr[0].vgpuVmCompatibility) @vgpu_vm_compatibility.setter def vgpu_vm_compatibility(self, val): if self._readonly: raise ValueError("This VgpuPgpuCompatibility instance is read-only") self._ptr[0].vgpuVmCompatibility = val @property def compatibility_limit_code(self): """int: """ return (self._ptr[0].compatibilityLimitCode) @compatibility_limit_code.setter def compatibility_limit_code(self, val): if self._readonly: raise ValueError("This VgpuPgpuCompatibility instance is read-only") self._ptr[0].compatibilityLimitCode = val @staticmethod def from_buffer(buffer): """Create an VgpuPgpuCompatibility instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlVgpuPgpuCompatibility_t), VgpuPgpuCompatibility) @staticmethod def from_data(data): """Create an VgpuPgpuCompatibility instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `vgpu_pgpu_compatibility_dtype` holding the data. """ return _cyb_from_data(data, "vgpu_pgpu_compatibility_dtype", vgpu_pgpu_compatibility_dtype, VgpuPgpuCompatibility) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an VgpuPgpuCompatibility instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef VgpuPgpuCompatibility obj = VgpuPgpuCompatibility.__new__(VgpuPgpuCompatibility) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlVgpuPgpuCompatibility_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_gpu_instance_placement_dtype_offsets(): cdef nvmlGpuInstancePlacement_t *pod = _cyb_calloc(1, sizeof(nvmlGpuInstancePlacement_t)) if pod == NULL: raise MemoryError("Error allocating nvmlGpuInstancePlacement_t") try: return _numpy.dtype({ 'names': ['start', 'size_'], 'formats': [_numpy.uint32, _numpy.uint32], 'offsets': [ (&(pod.start)) - (pod), (&(pod.size)) - (pod), ], 'itemsize': sizeof(nvmlGpuInstancePlacement_t), }) finally: _cyb_free(pod) gpu_instance_placement_dtype = _get_gpu_instance_placement_dtype_offsets() cdef object gpu_instance_placement_dtype_record = _numpy.dtype((_numpy.record, gpu_instance_placement_dtype)) cdef class GpuInstancePlacement: """Empty-initialize an array of `nvmlGpuInstancePlacement_t`. The resulting object is of length `size` and of dtype `gpu_instance_placement_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `nvmlGpuInstancePlacement_t` """ cdef: readonly object _data object _owner def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=gpu_instance_placement_dtype_record) assert self._data.itemsize == sizeof(nvmlGpuInstancePlacement_t), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlGpuInstancePlacement_t) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}.GpuInstancePlacement_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}.GpuInstancePlacement object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, GpuInstancePlacement)) 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 start(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["start"][0]) return self._data["start"] @start.setter def start(self, val): if not self._data.flags.writeable: raise ValueError("This GpuInstancePlacement instance is read-only") self._data["start"] = val @property def size_(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["size_"][0]) return self._data["size_"] @size_.setter def size_(self, val): if not self._data.flags.writeable: raise ValueError("This GpuInstancePlacement instance is read-only") self._data["size_"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef GpuInstancePlacement obj 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 obj = GpuInstancePlacement.__new__(GpuInstancePlacement) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == gpu_instance_placement_dtype: obj = GpuInstancePlacement.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an GpuInstancePlacement instance with the memory from the given buffer.""" return GpuInstancePlacement.from_data(_numpy.frombuffer(buffer, dtype=gpu_instance_placement_dtype)) @staticmethod def from_data(data): """Create an GpuInstancePlacement instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `gpu_instance_placement_dtype` holding the data. """ cdef GpuInstancePlacement obj = GpuInstancePlacement.__new__(GpuInstancePlacement) 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 != gpu_instance_placement_dtype: raise ValueError("data array must be of dtype gpu_instance_placement_dtype") obj._data = data.view(dtype=gpu_instance_placement_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an GpuInstancePlacement 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 GpuInstancePlacement obj = GpuInstancePlacement.__new__(GpuInstancePlacement) 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(nvmlGpuInstancePlacement_t) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=gpu_instance_placement_dtype_record) obj._owner = owner return obj cdef _get_gpu_instance_profile_info_v3_dtype_offsets(): cdef nvmlGpuInstanceProfileInfo_v3_t *pod = _cyb_calloc(1, sizeof(nvmlGpuInstanceProfileInfo_v3_t)) if pod == NULL: raise MemoryError("Error allocating nvmlGpuInstanceProfileInfo_v3_t") try: return _numpy.dtype({ 'names': ['version', 'id', 'slice_count', 'instance_count', 'multiprocessor_count', 'copy_engine_count', 'decoder_count', 'encoder_count', 'jpeg_count', 'ofa_count', 'memory_size_mb', 'name', 'capabilities'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint64, (_numpy.int8, 96), _numpy.uint32], 'offsets': [ (&(pod.version)) - (pod), (&(pod.id)) - (pod), (&(pod.sliceCount)) - (pod), (&(pod.instanceCount)) - (pod), (&(pod.multiprocessorCount)) - (pod), (&(pod.copyEngineCount)) - (pod), (&(pod.decoderCount)) - (pod), (&(pod.encoderCount)) - (pod), (&(pod.jpegCount)) - (pod), (&(pod.ofaCount)) - (pod), (&(pod.memorySizeMB)) - (pod), (&(pod.name)) - (pod), (&(pod.capabilities)) - (pod), ], 'itemsize': sizeof(nvmlGpuInstanceProfileInfo_v3_t), }) finally: _cyb_free(pod) gpu_instance_profile_info_v3_dtype = _get_gpu_instance_profile_info_v3_dtype_offsets() cdef class GpuInstanceProfileInfo_v3: """Empty-initialize an instance of `nvmlGpuInstanceProfileInfo_v3_t`. .. seealso:: `nvmlGpuInstanceProfileInfo_v3_t` """ cdef: nvmlGpuInstanceProfileInfo_v3_t _data nvmlGpuInstanceProfileInfo_v3_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.GpuInstanceProfileInfo_v3 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef GpuInstanceProfileInfo_v3 other_ if not isinstance(other, GpuInstanceProfileInfo_v3): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlGpuInstanceProfileInfo_v3_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlGpuInstanceProfileInfo_v3_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def version(self): """int: """ return self._ptr[0].version @version.setter def version(self, val): if self._readonly: raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only") self._ptr[0].version = val @property def id(self): """int: """ return self._ptr[0].id @id.setter def id(self, val): if self._readonly: raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only") self._ptr[0].id = val @property def slice_count(self): """int: """ return self._ptr[0].sliceCount @slice_count.setter def slice_count(self, val): if self._readonly: raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only") self._ptr[0].sliceCount = val @property def instance_count(self): """int: """ return self._ptr[0].instanceCount @instance_count.setter def instance_count(self, val): if self._readonly: raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only") self._ptr[0].instanceCount = val @property def multiprocessor_count(self): """int: """ return self._ptr[0].multiprocessorCount @multiprocessor_count.setter def multiprocessor_count(self, val): if self._readonly: raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only") self._ptr[0].multiprocessorCount = val @property def copy_engine_count(self): """int: """ return self._ptr[0].copyEngineCount @copy_engine_count.setter def copy_engine_count(self, val): if self._readonly: raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only") self._ptr[0].copyEngineCount = val @property def decoder_count(self): """int: """ return self._ptr[0].decoderCount @decoder_count.setter def decoder_count(self, val): if self._readonly: raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only") self._ptr[0].decoderCount = val @property def encoder_count(self): """int: """ return self._ptr[0].encoderCount @encoder_count.setter def encoder_count(self, val): if self._readonly: raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only") self._ptr[0].encoderCount = val @property def jpeg_count(self): """int: """ return self._ptr[0].jpegCount @jpeg_count.setter def jpeg_count(self, val): if self._readonly: raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only") self._ptr[0].jpegCount = val @property def ofa_count(self): """int: """ return self._ptr[0].ofaCount @ofa_count.setter def ofa_count(self, val): if self._readonly: raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only") self._ptr[0].ofaCount = val @property def memory_size_mb(self): """int: """ return self._ptr[0].memorySizeMB @memory_size_mb.setter def memory_size_mb(self, val): if self._readonly: raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only") self._ptr[0].memorySizeMB = val @property def name(self): """~_numpy.int8: (array of length 96).""" return _cyb_cpython.PyUnicode_FromString(self._ptr[0].name) @name.setter def name(self, val): if self._readonly: raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only") cdef bytes buf = val.encode() if len(buf) >= 96: raise ValueError("String too long for field name, max length is 95") cdef char *ptr = buf _cyb_memcpy((self._ptr[0].name), ptr, 96) @property def capabilities(self): """int: """ return self._ptr[0].capabilities @capabilities.setter def capabilities(self, val): if self._readonly: raise ValueError("This GpuInstanceProfileInfo_v3 instance is read-only") self._ptr[0].capabilities = val @staticmethod def from_buffer(buffer): """Create an GpuInstanceProfileInfo_v3 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlGpuInstanceProfileInfo_v3_t), GpuInstanceProfileInfo_v3) @staticmethod def from_data(data): """Create an GpuInstanceProfileInfo_v3 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `gpu_instance_profile_info_v3_dtype` holding the data. """ return _cyb_from_data(data, "gpu_instance_profile_info_v3_dtype", gpu_instance_profile_info_v3_dtype, GpuInstanceProfileInfo_v3) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an GpuInstanceProfileInfo_v3 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef GpuInstanceProfileInfo_v3 obj = GpuInstanceProfileInfo_v3.__new__(GpuInstanceProfileInfo_v3) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlGpuInstanceProfileInfo_v3_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_compute_instance_placement_dtype_offsets(): cdef nvmlComputeInstancePlacement_t *pod = _cyb_calloc(1, sizeof(nvmlComputeInstancePlacement_t)) if pod == NULL: raise MemoryError("Error allocating nvmlComputeInstancePlacement_t") try: return _numpy.dtype({ 'names': ['start', 'size_'], 'formats': [_numpy.uint32, _numpy.uint32], 'offsets': [ (&(pod.start)) - (pod), (&(pod.size)) - (pod), ], 'itemsize': sizeof(nvmlComputeInstancePlacement_t), }) finally: _cyb_free(pod) compute_instance_placement_dtype = _get_compute_instance_placement_dtype_offsets() cdef object compute_instance_placement_dtype_record = _numpy.dtype((_numpy.record, compute_instance_placement_dtype)) cdef class ComputeInstancePlacement: """Empty-initialize an array of `nvmlComputeInstancePlacement_t`. The resulting object is of length `size` and of dtype `compute_instance_placement_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `nvmlComputeInstancePlacement_t` """ cdef: readonly object _data object _owner def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=compute_instance_placement_dtype_record) assert self._data.itemsize == sizeof(nvmlComputeInstancePlacement_t), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlComputeInstancePlacement_t) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}.ComputeInstancePlacement_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}.ComputeInstancePlacement object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, ComputeInstancePlacement)) 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 start(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["start"][0]) return self._data["start"] @start.setter def start(self, val): if not self._data.flags.writeable: raise ValueError("This ComputeInstancePlacement instance is read-only") self._data["start"] = val @property def size_(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["size_"][0]) return self._data["size_"] @size_.setter def size_(self, val): if not self._data.flags.writeable: raise ValueError("This ComputeInstancePlacement instance is read-only") self._data["size_"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef ComputeInstancePlacement obj 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 obj = ComputeInstancePlacement.__new__(ComputeInstancePlacement) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == compute_instance_placement_dtype: obj = ComputeInstancePlacement.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an ComputeInstancePlacement instance with the memory from the given buffer.""" return ComputeInstancePlacement.from_data(_numpy.frombuffer(buffer, dtype=compute_instance_placement_dtype)) @staticmethod def from_data(data): """Create an ComputeInstancePlacement instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `compute_instance_placement_dtype` holding the data. """ cdef ComputeInstancePlacement obj = ComputeInstancePlacement.__new__(ComputeInstancePlacement) 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 != compute_instance_placement_dtype: raise ValueError("data array must be of dtype compute_instance_placement_dtype") obj._data = data.view(dtype=compute_instance_placement_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an ComputeInstancePlacement 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 ComputeInstancePlacement obj = ComputeInstancePlacement.__new__(ComputeInstancePlacement) 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(nvmlComputeInstancePlacement_t) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=compute_instance_placement_dtype_record) obj._owner = owner return obj cdef _get_compute_instance_profile_info_v2_dtype_offsets(): cdef nvmlComputeInstanceProfileInfo_v2_t *pod = _cyb_calloc(1, sizeof(nvmlComputeInstanceProfileInfo_v2_t)) if pod == NULL: raise MemoryError("Error allocating nvmlComputeInstanceProfileInfo_v2_t") try: return _numpy.dtype({ 'names': ['version', 'id', 'slice_count', 'instance_count', 'multiprocessor_count', 'shared_copy_engine_count', 'shared_decoder_count', 'shared_encoder_count', 'shared_jpeg_count', 'shared_ofa_count', 'name'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, (_numpy.int8, 96)], 'offsets': [ (&(pod.version)) - (pod), (&(pod.id)) - (pod), (&(pod.sliceCount)) - (pod), (&(pod.instanceCount)) - (pod), (&(pod.multiprocessorCount)) - (pod), (&(pod.sharedCopyEngineCount)) - (pod), (&(pod.sharedDecoderCount)) - (pod), (&(pod.sharedEncoderCount)) - (pod), (&(pod.sharedJpegCount)) - (pod), (&(pod.sharedOfaCount)) - (pod), (&(pod.name)) - (pod), ], 'itemsize': sizeof(nvmlComputeInstanceProfileInfo_v2_t), }) finally: _cyb_free(pod) compute_instance_profile_info_v2_dtype = _get_compute_instance_profile_info_v2_dtype_offsets() cdef class ComputeInstanceProfileInfo_v2: """Empty-initialize an instance of `nvmlComputeInstanceProfileInfo_v2_t`. .. seealso:: `nvmlComputeInstanceProfileInfo_v2_t` """ cdef: nvmlComputeInstanceProfileInfo_v2_t _data nvmlComputeInstanceProfileInfo_v2_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.ComputeInstanceProfileInfo_v2 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef ComputeInstanceProfileInfo_v2 other_ if not isinstance(other, ComputeInstanceProfileInfo_v2): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlComputeInstanceProfileInfo_v2_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlComputeInstanceProfileInfo_v2_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def version(self): """int: """ return self._ptr[0].version @version.setter def version(self, val): if self._readonly: raise ValueError("This ComputeInstanceProfileInfo_v2 instance is read-only") self._ptr[0].version = val @property def id(self): """int: """ return self._ptr[0].id @id.setter def id(self, val): if self._readonly: raise ValueError("This ComputeInstanceProfileInfo_v2 instance is read-only") self._ptr[0].id = val @property def slice_count(self): """int: """ return self._ptr[0].sliceCount @slice_count.setter def slice_count(self, val): if self._readonly: raise ValueError("This ComputeInstanceProfileInfo_v2 instance is read-only") self._ptr[0].sliceCount = val @property def instance_count(self): """int: """ return self._ptr[0].instanceCount @instance_count.setter def instance_count(self, val): if self._readonly: raise ValueError("This ComputeInstanceProfileInfo_v2 instance is read-only") self._ptr[0].instanceCount = val @property def multiprocessor_count(self): """int: """ return self._ptr[0].multiprocessorCount @multiprocessor_count.setter def multiprocessor_count(self, val): if self._readonly: raise ValueError("This ComputeInstanceProfileInfo_v2 instance is read-only") self._ptr[0].multiprocessorCount = val @property def shared_copy_engine_count(self): """int: """ return self._ptr[0].sharedCopyEngineCount @shared_copy_engine_count.setter def shared_copy_engine_count(self, val): if self._readonly: raise ValueError("This ComputeInstanceProfileInfo_v2 instance is read-only") self._ptr[0].sharedCopyEngineCount = val @property def shared_decoder_count(self): """int: """ return self._ptr[0].sharedDecoderCount @shared_decoder_count.setter def shared_decoder_count(self, val): if self._readonly: raise ValueError("This ComputeInstanceProfileInfo_v2 instance is read-only") self._ptr[0].sharedDecoderCount = val @property def shared_encoder_count(self): """int: """ return self._ptr[0].sharedEncoderCount @shared_encoder_count.setter def shared_encoder_count(self, val): if self._readonly: raise ValueError("This ComputeInstanceProfileInfo_v2 instance is read-only") self._ptr[0].sharedEncoderCount = val @property def shared_jpeg_count(self): """int: """ return self._ptr[0].sharedJpegCount @shared_jpeg_count.setter def shared_jpeg_count(self, val): if self._readonly: raise ValueError("This ComputeInstanceProfileInfo_v2 instance is read-only") self._ptr[0].sharedJpegCount = val @property def shared_ofa_count(self): """int: """ return self._ptr[0].sharedOfaCount @shared_ofa_count.setter def shared_ofa_count(self, val): if self._readonly: raise ValueError("This ComputeInstanceProfileInfo_v2 instance is read-only") self._ptr[0].sharedOfaCount = val @property def name(self): """~_numpy.int8: (array of length 96).""" return _cyb_cpython.PyUnicode_FromString(self._ptr[0].name) @name.setter def name(self, val): if self._readonly: raise ValueError("This ComputeInstanceProfileInfo_v2 instance is read-only") cdef bytes buf = val.encode() if len(buf) >= 96: raise ValueError("String too long for field name, max length is 95") cdef char *ptr = buf _cyb_memcpy((self._ptr[0].name), ptr, 96) @staticmethod def from_buffer(buffer): """Create an ComputeInstanceProfileInfo_v2 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlComputeInstanceProfileInfo_v2_t), ComputeInstanceProfileInfo_v2) @staticmethod def from_data(data): """Create an ComputeInstanceProfileInfo_v2 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `compute_instance_profile_info_v2_dtype` holding the data. """ return _cyb_from_data(data, "compute_instance_profile_info_v2_dtype", compute_instance_profile_info_v2_dtype, ComputeInstanceProfileInfo_v2) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an ComputeInstanceProfileInfo_v2 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef ComputeInstanceProfileInfo_v2 obj = ComputeInstanceProfileInfo_v2.__new__(ComputeInstanceProfileInfo_v2) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlComputeInstanceProfileInfo_v2_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_compute_instance_profile_info_v3_dtype_offsets(): cdef nvmlComputeInstanceProfileInfo_v3_t *pod = _cyb_calloc(1, sizeof(nvmlComputeInstanceProfileInfo_v3_t)) if pod == NULL: raise MemoryError("Error allocating nvmlComputeInstanceProfileInfo_v3_t") try: return _numpy.dtype({ 'names': ['version', 'id', 'slice_count', 'instance_count', 'multiprocessor_count', 'shared_copy_engine_count', 'shared_decoder_count', 'shared_encoder_count', 'shared_jpeg_count', 'shared_ofa_count', 'name', 'capabilities'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, (_numpy.int8, 96), _numpy.uint32], 'offsets': [ (&(pod.version)) - (pod), (&(pod.id)) - (pod), (&(pod.sliceCount)) - (pod), (&(pod.instanceCount)) - (pod), (&(pod.multiprocessorCount)) - (pod), (&(pod.sharedCopyEngineCount)) - (pod), (&(pod.sharedDecoderCount)) - (pod), (&(pod.sharedEncoderCount)) - (pod), (&(pod.sharedJpegCount)) - (pod), (&(pod.sharedOfaCount)) - (pod), (&(pod.name)) - (pod), (&(pod.capabilities)) - (pod), ], 'itemsize': sizeof(nvmlComputeInstanceProfileInfo_v3_t), }) finally: _cyb_free(pod) compute_instance_profile_info_v3_dtype = _get_compute_instance_profile_info_v3_dtype_offsets() cdef class ComputeInstanceProfileInfo_v3: """Empty-initialize an instance of `nvmlComputeInstanceProfileInfo_v3_t`. .. seealso:: `nvmlComputeInstanceProfileInfo_v3_t` """ cdef: nvmlComputeInstanceProfileInfo_v3_t _data nvmlComputeInstanceProfileInfo_v3_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.ComputeInstanceProfileInfo_v3 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef ComputeInstanceProfileInfo_v3 other_ if not isinstance(other, ComputeInstanceProfileInfo_v3): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlComputeInstanceProfileInfo_v3_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlComputeInstanceProfileInfo_v3_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def version(self): """int: """ return self._ptr[0].version @version.setter def version(self, val): if self._readonly: raise ValueError("This ComputeInstanceProfileInfo_v3 instance is read-only") self._ptr[0].version = val @property def id(self): """int: """ return self._ptr[0].id @id.setter def id(self, val): if self._readonly: raise ValueError("This ComputeInstanceProfileInfo_v3 instance is read-only") self._ptr[0].id = val @property def slice_count(self): """int: """ return self._ptr[0].sliceCount @slice_count.setter def slice_count(self, val): if self._readonly: raise ValueError("This ComputeInstanceProfileInfo_v3 instance is read-only") self._ptr[0].sliceCount = val @property def instance_count(self): """int: """ return self._ptr[0].instanceCount @instance_count.setter def instance_count(self, val): if self._readonly: raise ValueError("This ComputeInstanceProfileInfo_v3 instance is read-only") self._ptr[0].instanceCount = val @property def multiprocessor_count(self): """int: """ return self._ptr[0].multiprocessorCount @multiprocessor_count.setter def multiprocessor_count(self, val): if self._readonly: raise ValueError("This ComputeInstanceProfileInfo_v3 instance is read-only") self._ptr[0].multiprocessorCount = val @property def shared_copy_engine_count(self): """int: """ return self._ptr[0].sharedCopyEngineCount @shared_copy_engine_count.setter def shared_copy_engine_count(self, val): if self._readonly: raise ValueError("This ComputeInstanceProfileInfo_v3 instance is read-only") self._ptr[0].sharedCopyEngineCount = val @property def shared_decoder_count(self): """int: """ return self._ptr[0].sharedDecoderCount @shared_decoder_count.setter def shared_decoder_count(self, val): if self._readonly: raise ValueError("This ComputeInstanceProfileInfo_v3 instance is read-only") self._ptr[0].sharedDecoderCount = val @property def shared_encoder_count(self): """int: """ return self._ptr[0].sharedEncoderCount @shared_encoder_count.setter def shared_encoder_count(self, val): if self._readonly: raise ValueError("This ComputeInstanceProfileInfo_v3 instance is read-only") self._ptr[0].sharedEncoderCount = val @property def shared_jpeg_count(self): """int: """ return self._ptr[0].sharedJpegCount @shared_jpeg_count.setter def shared_jpeg_count(self, val): if self._readonly: raise ValueError("This ComputeInstanceProfileInfo_v3 instance is read-only") self._ptr[0].sharedJpegCount = val @property def shared_ofa_count(self): """int: """ return self._ptr[0].sharedOfaCount @shared_ofa_count.setter def shared_ofa_count(self, val): if self._readonly: raise ValueError("This ComputeInstanceProfileInfo_v3 instance is read-only") self._ptr[0].sharedOfaCount = val @property def name(self): """~_numpy.int8: (array of length 96).""" return _cyb_cpython.PyUnicode_FromString(self._ptr[0].name) @name.setter def name(self, val): if self._readonly: raise ValueError("This ComputeInstanceProfileInfo_v3 instance is read-only") cdef bytes buf = val.encode() if len(buf) >= 96: raise ValueError("String too long for field name, max length is 95") cdef char *ptr = buf _cyb_memcpy((self._ptr[0].name), ptr, 96) @property def capabilities(self): """int: """ return self._ptr[0].capabilities @capabilities.setter def capabilities(self, val): if self._readonly: raise ValueError("This ComputeInstanceProfileInfo_v3 instance is read-only") self._ptr[0].capabilities = val @staticmethod def from_buffer(buffer): """Create an ComputeInstanceProfileInfo_v3 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlComputeInstanceProfileInfo_v3_t), ComputeInstanceProfileInfo_v3) @staticmethod def from_data(data): """Create an ComputeInstanceProfileInfo_v3 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `compute_instance_profile_info_v3_dtype` holding the data. """ return _cyb_from_data(data, "compute_instance_profile_info_v3_dtype", compute_instance_profile_info_v3_dtype, ComputeInstanceProfileInfo_v3) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an ComputeInstanceProfileInfo_v3 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef ComputeInstanceProfileInfo_v3 obj = ComputeInstanceProfileInfo_v3.__new__(ComputeInstanceProfileInfo_v3) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlComputeInstanceProfileInfo_v3_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_device_addressing_mode_v1_dtype_offsets(): cdef nvmlDeviceAddressingMode_v1_t *pod = _cyb_calloc(1, sizeof(nvmlDeviceAddressingMode_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlDeviceAddressingMode_v1_t") try: return _numpy.dtype({ 'names': ['version', 'value'], 'formats': [_numpy.uint32, _numpy.uint32], 'offsets': [ (&(pod.version)) - (pod), (&(pod.value)) - (pod), ], 'itemsize': sizeof(nvmlDeviceAddressingMode_v1_t), }) finally: _cyb_free(pod) device_addressing_mode_v1_dtype = _get_device_addressing_mode_v1_dtype_offsets() cdef class DeviceAddressingMode_v1: """Empty-initialize an instance of `nvmlDeviceAddressingMode_v1_t`. .. seealso:: `nvmlDeviceAddressingMode_v1_t` """ cdef: nvmlDeviceAddressingMode_v1_t _data nvmlDeviceAddressingMode_v1_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.DeviceAddressingMode_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef DeviceAddressingMode_v1 other_ if not isinstance(other, DeviceAddressingMode_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlDeviceAddressingMode_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlDeviceAddressingMode_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def version(self): """int: API version.""" return self._ptr[0].version @version.setter def version(self, val): if self._readonly: raise ValueError("This DeviceAddressingMode_v1 instance is read-only") self._ptr[0].version = val @property def value(self): """int: One of `nvmlDeviceAddressingModeType_t`.""" return self._ptr[0].value @value.setter def value(self, val): if self._readonly: raise ValueError("This DeviceAddressingMode_v1 instance is read-only") self._ptr[0].value = val @staticmethod def from_buffer(buffer): """Create an DeviceAddressingMode_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlDeviceAddressingMode_v1_t), DeviceAddressingMode_v1) @staticmethod def from_data(data): """Create an DeviceAddressingMode_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `device_addressing_mode_v1_dtype` holding the data. """ return _cyb_from_data(data, "device_addressing_mode_v1_dtype", device_addressing_mode_v1_dtype, DeviceAddressingMode_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an DeviceAddressingMode_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef DeviceAddressingMode_v1 obj = DeviceAddressingMode_v1.__new__(DeviceAddressingMode_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlDeviceAddressingMode_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_repair_status_v1_dtype_offsets(): cdef nvmlRepairStatus_v1_t *pod = _cyb_calloc(1, sizeof(nvmlRepairStatus_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlRepairStatus_v1_t") try: return _numpy.dtype({ 'names': ['version', 'b_channel_repair_pending', 'b_tpc_repair_pending'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32], 'offsets': [ (&(pod.version)) - (pod), (&(pod.bChannelRepairPending)) - (pod), (&(pod.bTpcRepairPending)) - (pod), ], 'itemsize': sizeof(nvmlRepairStatus_v1_t), }) finally: _cyb_free(pod) repair_status_v1_dtype = _get_repair_status_v1_dtype_offsets() cdef class RepairStatus_v1: """Empty-initialize an instance of `nvmlRepairStatus_v1_t`. .. seealso:: `nvmlRepairStatus_v1_t` """ cdef: nvmlRepairStatus_v1_t _data nvmlRepairStatus_v1_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.RepairStatus_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef RepairStatus_v1 other_ if not isinstance(other, RepairStatus_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlRepairStatus_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlRepairStatus_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def version(self): """int: API version number.""" return self._ptr[0].version @version.setter def version(self, val): if self._readonly: raise ValueError("This RepairStatus_v1 instance is read-only") self._ptr[0].version = val @property def b_channel_repair_pending(self): """int: Reference to `unsigned` int.""" return self._ptr[0].bChannelRepairPending @b_channel_repair_pending.setter def b_channel_repair_pending(self, val): if self._readonly: raise ValueError("This RepairStatus_v1 instance is read-only") self._ptr[0].bChannelRepairPending = val @property def b_tpc_repair_pending(self): """int: Reference to `unsigned` int.""" return self._ptr[0].bTpcRepairPending @b_tpc_repair_pending.setter def b_tpc_repair_pending(self, val): if self._readonly: raise ValueError("This RepairStatus_v1 instance is read-only") self._ptr[0].bTpcRepairPending = val @staticmethod def from_buffer(buffer): """Create an RepairStatus_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlRepairStatus_v1_t), RepairStatus_v1) @staticmethod def from_data(data): """Create an RepairStatus_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `repair_status_v1_dtype` holding the data. """ return _cyb_from_data(data, "repair_status_v1_dtype", repair_status_v1_dtype, RepairStatus_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an RepairStatus_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef RepairStatus_v1 obj = RepairStatus_v1.__new__(RepairStatus_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlRepairStatus_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_device_power_mizer_modes_v1_dtype_offsets(): cdef nvmlDevicePowerMizerModes_v1_t *pod = _cyb_calloc(1, sizeof(nvmlDevicePowerMizerModes_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlDevicePowerMizerModes_v1_t") try: return _numpy.dtype({ 'names': ['current_mode', 'mode', 'supported_power_mizer_modes'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32], 'offsets': [ (&(pod.currentMode)) - (pod), (&(pod.mode)) - (pod), (&(pod.supportedPowerMizerModes)) - (pod), ], 'itemsize': sizeof(nvmlDevicePowerMizerModes_v1_t), }) finally: _cyb_free(pod) device_power_mizer_modes_v1_dtype = _get_device_power_mizer_modes_v1_dtype_offsets() cdef class DevicePowerMizerModes_v1: """Empty-initialize an instance of `nvmlDevicePowerMizerModes_v1_t`. .. seealso:: `nvmlDevicePowerMizerModes_v1_t` """ cdef: nvmlDevicePowerMizerModes_v1_t _data nvmlDevicePowerMizerModes_v1_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.DevicePowerMizerModes_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef DevicePowerMizerModes_v1 other_ if not isinstance(other, DevicePowerMizerModes_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlDevicePowerMizerModes_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlDevicePowerMizerModes_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def current_mode(self): """int: OUT: the current powermizer mode.""" return self._ptr[0].currentMode @current_mode.setter def current_mode(self, val): if self._readonly: raise ValueError("This DevicePowerMizerModes_v1 instance is read-only") self._ptr[0].currentMode = val @property def mode(self): """int: IN: the powermizer mode to set.""" return self._ptr[0].mode @mode.setter def mode(self, val): if self._readonly: raise ValueError("This DevicePowerMizerModes_v1 instance is read-only") self._ptr[0].mode = val @property def supported_power_mizer_modes(self): """int: OUT: Bitmask of supported powermizer modes. The bitmask of supported power mizer modes on this device. The supported modes can be combined using the bitwise OR operator '|'. For example, if a device supports all PowerMizer modes, the bitmask would be: supportedPowerMizerModes = ((1 << NVML_POWER_MIZER_MODE_ADAPTIVE) | (1 << NVML_POWER_MIZER_MODE_PREFER_MAXIMUM_PERFORMANCE) | (1 << NVML_POWER_MIZER_MODE_AUTO) | (1 << NVML_POWER_MIZER_MODE_PREFER_CONSISTENT_PERFORMANCE)); This bitmask can be used to check which power mizer modes are available on the device by performing a bitwise AND operation with the specific mode you want to check.""" return self._ptr[0].supportedPowerMizerModes @supported_power_mizer_modes.setter def supported_power_mizer_modes(self, val): if self._readonly: raise ValueError("This DevicePowerMizerModes_v1 instance is read-only") self._ptr[0].supportedPowerMizerModes = val @staticmethod def from_buffer(buffer): """Create an DevicePowerMizerModes_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlDevicePowerMizerModes_v1_t), DevicePowerMizerModes_v1) @staticmethod def from_data(data): """Create an DevicePowerMizerModes_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `device_power_mizer_modes_v1_dtype` holding the data. """ return _cyb_from_data(data, "device_power_mizer_modes_v1_dtype", device_power_mizer_modes_v1_dtype, DevicePowerMizerModes_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an DevicePowerMizerModes_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef DevicePowerMizerModes_v1 obj = DevicePowerMizerModes_v1.__new__(DevicePowerMizerModes_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlDevicePowerMizerModes_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_ecc_sram_unique_uncorrected_error_entry_v1_dtype_offsets(): cdef nvmlEccSramUniqueUncorrectedErrorEntry_v1_t *pod = _cyb_calloc(1, sizeof(nvmlEccSramUniqueUncorrectedErrorEntry_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlEccSramUniqueUncorrectedErrorEntry_v1_t") try: return _numpy.dtype({ 'names': ['unit', 'location', 'sublocation', 'extlocation', 'address', 'is_parity', 'count'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32], 'offsets': [ (&(pod.unit)) - (pod), (&(pod.location)) - (pod), (&(pod.sublocation)) - (pod), (&(pod.extlocation)) - (pod), (&(pod.address)) - (pod), (&(pod.isParity)) - (pod), (&(pod.count)) - (pod), ], 'itemsize': sizeof(nvmlEccSramUniqueUncorrectedErrorEntry_v1_t), }) finally: _cyb_free(pod) ecc_sram_unique_uncorrected_error_entry_v1_dtype = _get_ecc_sram_unique_uncorrected_error_entry_v1_dtype_offsets() cdef object ecc_sram_unique_uncorrected_error_entry_v1_dtype_record = _numpy.dtype((_numpy.record, ecc_sram_unique_uncorrected_error_entry_v1_dtype)) cdef class EccSramUniqueUncorrectedErrorEntry_v1: """Empty-initialize an array of `nvmlEccSramUniqueUncorrectedErrorEntry_v1_t`. The resulting object is of length `size` and of dtype `ecc_sram_unique_uncorrected_error_entry_v1_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `nvmlEccSramUniqueUncorrectedErrorEntry_v1_t` """ cdef: readonly object _data object _owner def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=ecc_sram_unique_uncorrected_error_entry_v1_dtype_record) assert self._data.itemsize == sizeof(nvmlEccSramUniqueUncorrectedErrorEntry_v1_t), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlEccSramUniqueUncorrectedErrorEntry_v1_t) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}.EccSramUniqueUncorrectedErrorEntry_v1_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}.EccSramUniqueUncorrectedErrorEntry_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, EccSramUniqueUncorrectedErrorEntry_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 unit(self): """Union[~_numpy.uint32, int]: the SRAM unit index""" if self._data.size == 1: return int(self._data["unit"][0]) return self._data["unit"] @unit.setter def unit(self, val): if not self._data.flags.writeable: raise ValueError("This EccSramUniqueUncorrectedErrorEntry_v1 instance is read-only") self._data["unit"] = val @property def location(self): """Union[~_numpy.uint32, int]: the error location within the SRAM unit""" if self._data.size == 1: return int(self._data["location"][0]) return self._data["location"] @location.setter def location(self, val): if not self._data.flags.writeable: raise ValueError("This EccSramUniqueUncorrectedErrorEntry_v1 instance is read-only") self._data["location"] = val @property def sublocation(self): """Union[~_numpy.uint32, int]: the error sublocation within the SRAM unit""" if self._data.size == 1: return int(self._data["sublocation"][0]) return self._data["sublocation"] @sublocation.setter def sublocation(self, val): if not self._data.flags.writeable: raise ValueError("This EccSramUniqueUncorrectedErrorEntry_v1 instance is read-only") self._data["sublocation"] = val @property def extlocation(self): """Union[~_numpy.uint32, int]: the error extlocation within the SRAM unit""" if self._data.size == 1: return int(self._data["extlocation"][0]) return self._data["extlocation"] @extlocation.setter def extlocation(self, val): if not self._data.flags.writeable: raise ValueError("This EccSramUniqueUncorrectedErrorEntry_v1 instance is read-only") self._data["extlocation"] = val @property def address(self): """Union[~_numpy.uint32, int]: the error address within the SRAM unit""" if self._data.size == 1: return int(self._data["address"][0]) return self._data["address"] @address.setter def address(self, val): if not self._data.flags.writeable: raise ValueError("This EccSramUniqueUncorrectedErrorEntry_v1 instance is read-only") self._data["address"] = val @property def is_parity(self): """Union[~_numpy.uint32, int]: if the SRAM error is parity or not""" if self._data.size == 1: return int(self._data["is_parity"][0]) return self._data["is_parity"] @is_parity.setter def is_parity(self, val): if not self._data.flags.writeable: raise ValueError("This EccSramUniqueUncorrectedErrorEntry_v1 instance is read-only") self._data["is_parity"] = val @property def count(self): """Union[~_numpy.uint32, int]: the error count at the same SRAM address""" if self._data.size == 1: return int(self._data["count"][0]) return self._data["count"] @count.setter def count(self, val): if not self._data.flags.writeable: raise ValueError("This EccSramUniqueUncorrectedErrorEntry_v1 instance is read-only") self._data["count"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef EccSramUniqueUncorrectedErrorEntry_v1 obj 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 obj = EccSramUniqueUncorrectedErrorEntry_v1.__new__(EccSramUniqueUncorrectedErrorEntry_v1) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == ecc_sram_unique_uncorrected_error_entry_v1_dtype: obj = EccSramUniqueUncorrectedErrorEntry_v1.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an EccSramUniqueUncorrectedErrorEntry_v1 instance with the memory from the given buffer.""" return EccSramUniqueUncorrectedErrorEntry_v1.from_data(_numpy.frombuffer(buffer, dtype=ecc_sram_unique_uncorrected_error_entry_v1_dtype)) @staticmethod def from_data(data): """Create an EccSramUniqueUncorrectedErrorEntry_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `ecc_sram_unique_uncorrected_error_entry_v1_dtype` holding the data. """ cdef EccSramUniqueUncorrectedErrorEntry_v1 obj = EccSramUniqueUncorrectedErrorEntry_v1.__new__(EccSramUniqueUncorrectedErrorEntry_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 != ecc_sram_unique_uncorrected_error_entry_v1_dtype: raise ValueError("data array must be of dtype ecc_sram_unique_uncorrected_error_entry_v1_dtype") obj._data = data.view(dtype=ecc_sram_unique_uncorrected_error_entry_v1_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an EccSramUniqueUncorrectedErrorEntry_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 EccSramUniqueUncorrectedErrorEntry_v1 obj = EccSramUniqueUncorrectedErrorEntry_v1.__new__(EccSramUniqueUncorrectedErrorEntry_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(nvmlEccSramUniqueUncorrectedErrorEntry_v1_t) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=ecc_sram_unique_uncorrected_error_entry_v1_dtype_record) obj._owner = owner return obj cdef _get_gpu_fabric_info_v3_dtype_offsets(): cdef nvmlGpuFabricInfo_v3_t *pod = _cyb_calloc(1, sizeof(nvmlGpuFabricInfo_v3_t)) if pod == NULL: raise MemoryError("Error allocating nvmlGpuFabricInfo_v3_t") try: return _numpy.dtype({ 'names': ['version', 'cluster_uuid', 'status', 'clique_id', 'state', 'health_mask', 'health_summary'], 'formats': [_numpy.uint32, (_numpy.uint8, 16), _numpy.int32, _numpy.uint32, _numpy.uint8, _numpy.uint32, _numpy.uint8], 'offsets': [ (&(pod.version)) - (pod), (&(pod.clusterUuid)) - (pod), (&(pod.status)) - (pod), (&(pod.cliqueId)) - (pod), (&(pod.state)) - (pod), (&(pod.healthMask)) - (pod), (&(pod.healthSummary)) - (pod), ], 'itemsize': sizeof(nvmlGpuFabricInfo_v3_t), }) finally: _cyb_free(pod) gpu_fabric_info_v3_dtype = _get_gpu_fabric_info_v3_dtype_offsets() cdef class GpuFabricInfo_v3: """Empty-initialize an instance of `nvmlGpuFabricInfo_v3_t`. .. seealso:: `nvmlGpuFabricInfo_v3_t` """ cdef: nvmlGpuFabricInfo_v3_t _data nvmlGpuFabricInfo_v3_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.GpuFabricInfo_v3 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef GpuFabricInfo_v3 other_ if not isinstance(other, GpuFabricInfo_v3): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlGpuFabricInfo_v3_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlGpuFabricInfo_v3_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def version(self): """int: Structure version identifier (set to nvmlGpuFabricInfo_v3).""" return self._ptr[0].version @version.setter def version(self, val): if self._readonly: raise ValueError("This GpuFabricInfo_v3 instance is read-only") self._ptr[0].version = val @property def cluster_uuid(self): """~_numpy.uint8: (array of length 16).Uuid of the cluster to which this GPU belongs.""" cdef _cyb_view.array arr = _cyb_view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False) arr.data = (&(self._ptr[0].clusterUuid)) return _numpy.asarray(arr) @cluster_uuid.setter def cluster_uuid(self, val): if self._readonly: raise ValueError("This GpuFabricInfo_v3 instance is read-only") if len(val) != 16: raise ValueError(f"Expected length { 16 } for field cluster_uuid, got {len(val)}") cdef _cyb_view.array arr = _cyb_view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c") arr[:] = _numpy.asarray(val, dtype=_numpy.uint8) _cyb_memcpy((&(self._ptr[0].clusterUuid)), (arr.data), sizeof(unsigned char) * len(val)) @property def status(self): """int: Probe Error status, if any. Must be checked only if Probe state returns "complete".""" return (self._ptr[0].status) @status.setter def status(self, val): if self._readonly: raise ValueError("This GpuFabricInfo_v3 instance is read-only") self._ptr[0].status = val @property def clique_id(self): """int: ID of the fabric clique to which this GPU belongs.""" return self._ptr[0].cliqueId @clique_id.setter def clique_id(self, val): if self._readonly: raise ValueError("This GpuFabricInfo_v3 instance is read-only") self._ptr[0].cliqueId = val @property def state(self): """int: Current Probe State of GPU registration process. See NVML_GPU_FABRIC_STATE_*.""" return (self._ptr[0].state) @state.setter def state(self, val): if self._readonly: raise ValueError("This GpuFabricInfo_v3 instance is read-only") self._ptr[0].state = val @property def health_mask(self): """int: GPU Fabric health Status Mask. See NVML_GPU_FABRIC_HEALTH_MASK_*.""" return self._ptr[0].healthMask @health_mask.setter def health_mask(self, val): if self._readonly: raise ValueError("This GpuFabricInfo_v3 instance is read-only") self._ptr[0].healthMask = val @property def health_summary(self): """int: GPU Fabric health summary. See NVML_GPU_FABRIC_HEALTH_SUMMARY_*.""" return self._ptr[0].healthSummary @health_summary.setter def health_summary(self, val): if self._readonly: raise ValueError("This GpuFabricInfo_v3 instance is read-only") self._ptr[0].healthSummary = val @staticmethod def from_buffer(buffer): """Create an GpuFabricInfo_v3 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlGpuFabricInfo_v3_t), GpuFabricInfo_v3) @staticmethod def from_data(data): """Create an GpuFabricInfo_v3 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `gpu_fabric_info_v3_dtype` holding the data. """ return _cyb_from_data(data, "gpu_fabric_info_v3_dtype", gpu_fabric_info_v3_dtype, GpuFabricInfo_v3) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an GpuFabricInfo_v3 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef GpuFabricInfo_v3 obj = GpuFabricInfo_v3.__new__(GpuFabricInfo_v3) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlGpuFabricInfo_v3_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_nv_link_info_v1_dtype_offsets(): cdef nvmlNvLinkInfo_v1_t *pod = _cyb_calloc(1, sizeof(nvmlNvLinkInfo_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlNvLinkInfo_v1_t") try: return _numpy.dtype({ 'names': ['version', 'is_nvle_enabled'], 'formats': [_numpy.uint32, _numpy.uint32], 'offsets': [ (&(pod.version)) - (pod), (&(pod.isNvleEnabled)) - (pod), ], 'itemsize': sizeof(nvmlNvLinkInfo_v1_t), }) finally: _cyb_free(pod) nv_link_info_v1_dtype = _get_nv_link_info_v1_dtype_offsets() cdef class NvLinkInfo_v1: """Empty-initialize an instance of `nvmlNvLinkInfo_v1_t`. .. seealso:: `nvmlNvLinkInfo_v1_t` """ cdef: nvmlNvLinkInfo_v1_t _data nvmlNvLinkInfo_v1_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.NvLinkInfo_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef NvLinkInfo_v1 other_ if not isinstance(other, NvLinkInfo_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlNvLinkInfo_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlNvLinkInfo_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def version(self): """int: IN - the API version number.""" return self._ptr[0].version @version.setter def version(self, val): if self._readonly: raise ValueError("This NvLinkInfo_v1 instance is read-only") self._ptr[0].version = val @property def is_nvle_enabled(self): """int: OUT - NVLINK encryption enablement.""" return self._ptr[0].isNvleEnabled @is_nvle_enabled.setter def is_nvle_enabled(self, val): if self._readonly: raise ValueError("This NvLinkInfo_v1 instance is read-only") self._ptr[0].isNvleEnabled = val @staticmethod def from_buffer(buffer): """Create an NvLinkInfo_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlNvLinkInfo_v1_t), NvLinkInfo_v1) @staticmethod def from_data(data): """Create an NvLinkInfo_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `nv_link_info_v1_dtype` holding the data. """ return _cyb_from_data(data, "nv_link_info_v1_dtype", nv_link_info_v1_dtype, NvLinkInfo_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an NvLinkInfo_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef NvLinkInfo_v1 obj = NvLinkInfo_v1.__new__(NvLinkInfo_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlNvLinkInfo_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_nvlink_firmware_version_dtype_offsets(): cdef nvmlNvlinkFirmwareVersion_t *pod = _cyb_calloc(1, sizeof(nvmlNvlinkFirmwareVersion_t)) if pod == NULL: raise MemoryError("Error allocating nvmlNvlinkFirmwareVersion_t") try: return _numpy.dtype({ 'names': ['ucode_type', 'major', 'minor', 'sub_minor'], 'formats': [_numpy.uint8, _numpy.uint32, _numpy.uint32, _numpy.uint32], 'offsets': [ (&(pod.ucodeType)) - (pod), (&(pod.major)) - (pod), (&(pod.minor)) - (pod), (&(pod.subMinor)) - (pod), ], 'itemsize': sizeof(nvmlNvlinkFirmwareVersion_t), }) finally: _cyb_free(pod) nvlink_firmware_version_dtype = _get_nvlink_firmware_version_dtype_offsets() cdef object nvlink_firmware_version_dtype_record = _numpy.dtype((_numpy.record, nvlink_firmware_version_dtype)) cdef class NvlinkFirmwareVersion: """Empty-initialize an array of `nvmlNvlinkFirmwareVersion_t`. The resulting object is of length `size` and of dtype `nvlink_firmware_version_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `nvmlNvlinkFirmwareVersion_t` """ cdef: readonly object _data object _owner def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=nvlink_firmware_version_dtype_record) assert self._data.itemsize == sizeof(nvmlNvlinkFirmwareVersion_t), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlNvlinkFirmwareVersion_t) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}.NvlinkFirmwareVersion_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}.NvlinkFirmwareVersion object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, NvlinkFirmwareVersion)) 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 ucode_type(self): """Union[~_numpy.uint8, int]: """ if self._data.size == 1: return int(self._data["ucode_type"][0]) return self._data["ucode_type"] @ucode_type.setter def ucode_type(self, val): if not self._data.flags.writeable: raise ValueError("This NvlinkFirmwareVersion instance is read-only") self._data["ucode_type"] = val @property def major(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["major"][0]) return self._data["major"] @major.setter def major(self, val): if not self._data.flags.writeable: raise ValueError("This NvlinkFirmwareVersion instance is read-only") self._data["major"] = val @property def minor(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["minor"][0]) return self._data["minor"] @minor.setter def minor(self, val): if not self._data.flags.writeable: raise ValueError("This NvlinkFirmwareVersion instance is read-only") self._data["minor"] = val @property def sub_minor(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["sub_minor"][0]) return self._data["sub_minor"] @sub_minor.setter def sub_minor(self, val): if not self._data.flags.writeable: raise ValueError("This NvlinkFirmwareVersion instance is read-only") self._data["sub_minor"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef NvlinkFirmwareVersion obj 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 obj = NvlinkFirmwareVersion.__new__(NvlinkFirmwareVersion) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == nvlink_firmware_version_dtype: obj = NvlinkFirmwareVersion.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an NvlinkFirmwareVersion instance with the memory from the given buffer.""" return NvlinkFirmwareVersion.from_data(_numpy.frombuffer(buffer, dtype=nvlink_firmware_version_dtype)) @staticmethod def from_data(data): """Create an NvlinkFirmwareVersion instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `nvlink_firmware_version_dtype` holding the data. """ cdef NvlinkFirmwareVersion obj = NvlinkFirmwareVersion.__new__(NvlinkFirmwareVersion) 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 != nvlink_firmware_version_dtype: raise ValueError("data array must be of dtype nvlink_firmware_version_dtype") obj._data = data.view(dtype=nvlink_firmware_version_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an NvlinkFirmwareVersion 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 NvlinkFirmwareVersion obj = NvlinkFirmwareVersion.__new__(NvlinkFirmwareVersion) 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(nvmlNvlinkFirmwareVersion_t) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=nvlink_firmware_version_dtype_record) obj._owner = owner return obj cdef _get_prm_counter_input_v1_dtype_offsets(): cdef nvmlPRMCounterInput_v1_t *pod = _cyb_calloc(1, sizeof(nvmlPRMCounterInput_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlPRMCounterInput_v1_t") try: return _numpy.dtype({ 'names': ['local_port'], 'formats': [_numpy.uint32], 'offsets': [ (&(pod.localPort)) - (pod), ], 'itemsize': sizeof(nvmlPRMCounterInput_v1_t), }) finally: _cyb_free(pod) prm_counter_input_v1_dtype = _get_prm_counter_input_v1_dtype_offsets() cdef class PRMCounterInput_v1: """Empty-initialize an instance of `nvmlPRMCounterInput_v1_t`. .. seealso:: `nvmlPRMCounterInput_v1_t` """ cdef: nvmlPRMCounterInput_v1_t *_ptr object _owner 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._readonly = False def __dealloc__(self): cdef nvmlPRMCounterInput_v1_t *ptr if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) def __repr__(self): return f"<{__name__}.PRMCounterInput_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef PRMCounterInput_v1 other_ if not isinstance(other, PRMCounterInput_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlPRMCounterInput_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlPRMCounterInput_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def local_port(self): """int: Local port number.""" return self._ptr[0].localPort @local_port.setter def local_port(self, val): if self._readonly: raise ValueError("This PRMCounterInput_v1 instance is read-only") self._ptr[0].localPort = val @staticmethod def from_buffer(buffer): """Create an PRMCounterInput_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlPRMCounterInput_v1_t), PRMCounterInput_v1) @staticmethod def from_data(data): """Create an PRMCounterInput_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `prm_counter_input_v1_dtype` holding the data. """ return _cyb_from_data(data, "prm_counter_input_v1_dtype", prm_counter_input_v1_dtype, PRMCounterInput_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an PRMCounterInput_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef PRMCounterInput_v1 obj = PRMCounterInput_v1.__new__(PRMCounterInput_v1) if owner is None: obj._ptr = _cyb_malloc(sizeof(nvmlPRMCounterInput_v1_t)) 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 else: obj._ptr = ptr obj._owns_ptr = False obj._owner = owner obj._readonly = readonly return obj cdef _get_vgpu_scheduler_state_info_v2_dtype_offsets(): cdef nvmlVgpuSchedulerStateInfo_v2_t *pod = _cyb_calloc(1, sizeof(nvmlVgpuSchedulerStateInfo_v2_t)) if pod == NULL: raise MemoryError("Error allocating nvmlVgpuSchedulerStateInfo_v2_t") try: return _numpy.dtype({ 'names': ['engine_id', 'scheduler_policy', 'avg_factor', 'timeslice'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32], 'offsets': [ (&(pod.engineId)) - (pod), (&(pod.schedulerPolicy)) - (pod), (&(pod.avgFactor)) - (pod), (&(pod.timeslice)) - (pod), ], 'itemsize': sizeof(nvmlVgpuSchedulerStateInfo_v2_t), }) finally: _cyb_free(pod) vgpu_scheduler_state_info_v2_dtype = _get_vgpu_scheduler_state_info_v2_dtype_offsets() cdef class VgpuSchedulerStateInfo_v2: """Empty-initialize an instance of `nvmlVgpuSchedulerStateInfo_v2_t`. .. seealso:: `nvmlVgpuSchedulerStateInfo_v2_t` """ cdef: nvmlVgpuSchedulerStateInfo_v2_t _data nvmlVgpuSchedulerStateInfo_v2_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.VgpuSchedulerStateInfo_v2 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef VgpuSchedulerStateInfo_v2 other_ if not isinstance(other, VgpuSchedulerStateInfo_v2): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuSchedulerStateInfo_v2_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuSchedulerStateInfo_v2_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def engine_id(self): """int: IN: Engine whose software scheduler state info is fetched. One of NVML_VGPU_SCHEDULER_ENGINE_TYPE_*.""" return self._ptr[0].engineId @engine_id.setter def engine_id(self, val): if self._readonly: raise ValueError("This VgpuSchedulerStateInfo_v2 instance is read-only") self._ptr[0].engineId = val @property def scheduler_policy(self): """int: OUT: Scheduler policy.""" return self._ptr[0].schedulerPolicy @scheduler_policy.setter def scheduler_policy(self, val): if self._readonly: raise ValueError("This VgpuSchedulerStateInfo_v2 instance is read-only") self._ptr[0].schedulerPolicy = val @property def avg_factor(self): """int: OUT: Average factor in compensating the timeslice for Adaptive Round Robin mode. 0 when there is no active scheduling.""" return self._ptr[0].avgFactor @avg_factor.setter def avg_factor(self, val): if self._readonly: raise ValueError("This VgpuSchedulerStateInfo_v2 instance is read-only") self._ptr[0].avgFactor = val @property def timeslice(self): """int: OUT: The timeslice in ns for each software run list as configured, or the default value otherwise. 0 when there is no active scheduling.""" return self._ptr[0].timeslice @timeslice.setter def timeslice(self, val): if self._readonly: raise ValueError("This VgpuSchedulerStateInfo_v2 instance is read-only") self._ptr[0].timeslice = val @staticmethod def from_buffer(buffer): """Create an VgpuSchedulerStateInfo_v2 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlVgpuSchedulerStateInfo_v2_t), VgpuSchedulerStateInfo_v2) @staticmethod def from_data(data): """Create an VgpuSchedulerStateInfo_v2 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `vgpu_scheduler_state_info_v2_dtype` holding the data. """ return _cyb_from_data(data, "vgpu_scheduler_state_info_v2_dtype", vgpu_scheduler_state_info_v2_dtype, VgpuSchedulerStateInfo_v2) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an VgpuSchedulerStateInfo_v2 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef VgpuSchedulerStateInfo_v2 obj = VgpuSchedulerStateInfo_v2.__new__(VgpuSchedulerStateInfo_v2) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlVgpuSchedulerStateInfo_v2_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_vgpu_scheduler_log_entry_v2_dtype_offsets(): cdef nvmlVgpuSchedulerLogEntry_v2_t *pod = _cyb_calloc(1, sizeof(nvmlVgpuSchedulerLogEntry_v2_t)) if pod == NULL: raise MemoryError("Error allocating nvmlVgpuSchedulerLogEntry_v2_t") try: return _numpy.dtype({ 'names': ['timestamp', 'time_run_total', 'time_run', 'sw_runlist_id', 'target_time_slice', 'cumulative_preemption_time', 'weight'], 'formats': [_numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint32, _numpy.uint64, _numpy.uint64, _numpy.uint32], 'offsets': [ (&(pod.timestamp)) - (pod), (&(pod.timeRunTotal)) - (pod), (&(pod.timeRun)) - (pod), (&(pod.swRunlistId)) - (pod), (&(pod.targetTimeSlice)) - (pod), (&(pod.cumulativePreemptionTime)) - (pod), (&(pod.weight)) - (pod), ], 'itemsize': sizeof(nvmlVgpuSchedulerLogEntry_v2_t), }) finally: _cyb_free(pod) vgpu_scheduler_log_entry_v2_dtype = _get_vgpu_scheduler_log_entry_v2_dtype_offsets() cdef object vgpu_scheduler_log_entry_v2_dtype_record = _numpy.dtype((_numpy.record, vgpu_scheduler_log_entry_v2_dtype)) cdef class VgpuSchedulerLogEntry_v2: """Empty-initialize an array of `nvmlVgpuSchedulerLogEntry_v2_t`. The resulting object is of length `size` and of dtype `vgpu_scheduler_log_entry_v2_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `nvmlVgpuSchedulerLogEntry_v2_t` """ cdef: readonly object _data object _owner def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=vgpu_scheduler_log_entry_v2_dtype_record) assert self._data.itemsize == sizeof(nvmlVgpuSchedulerLogEntry_v2_t), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlVgpuSchedulerLogEntry_v2_t) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}.VgpuSchedulerLogEntry_v2_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}.VgpuSchedulerLogEntry_v2 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, VgpuSchedulerLogEntry_v2)) 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 timestamp(self): """Union[~_numpy.uint64, int]: OUT: Timestamp in ns when this software runlist was preeempted.""" if self._data.size == 1: return int(self._data["timestamp"][0]) return self._data["timestamp"] @timestamp.setter def timestamp(self, val): if not self._data.flags.writeable: raise ValueError("This VgpuSchedulerLogEntry_v2 instance is read-only") self._data["timestamp"] = val @property def time_run_total(self): """Union[~_numpy.uint64, int]: OUT: Total time in ns this software runlist has run.""" if self._data.size == 1: return int(self._data["time_run_total"][0]) return self._data["time_run_total"] @time_run_total.setter def time_run_total(self, val): if not self._data.flags.writeable: raise ValueError("This VgpuSchedulerLogEntry_v2 instance is read-only") self._data["time_run_total"] = val @property def time_run(self): """Union[~_numpy.uint64, int]: OUT: Time in ns this software runlist ran before preemption.""" if self._data.size == 1: return int(self._data["time_run"][0]) return self._data["time_run"] @time_run.setter def time_run(self, val): if not self._data.flags.writeable: raise ValueError("This VgpuSchedulerLogEntry_v2 instance is read-only") self._data["time_run"] = val @property def sw_runlist_id(self): """Union[~_numpy.uint32, int]: OUT: Software runlist Id.""" if self._data.size == 1: return int(self._data["sw_runlist_id"][0]) return self._data["sw_runlist_id"] @sw_runlist_id.setter def sw_runlist_id(self, val): if not self._data.flags.writeable: raise ValueError("This VgpuSchedulerLogEntry_v2 instance is read-only") self._data["sw_runlist_id"] = val @property def target_time_slice(self): """Union[~_numpy.uint64, int]: OUT: The actual timeslice after deduction.""" if self._data.size == 1: return int(self._data["target_time_slice"][0]) return self._data["target_time_slice"] @target_time_slice.setter def target_time_slice(self, val): if not self._data.flags.writeable: raise ValueError("This VgpuSchedulerLogEntry_v2 instance is read-only") self._data["target_time_slice"] = val @property def cumulative_preemption_time(self): """Union[~_numpy.uint64, int]: OUT: Preemption time in ns for this SW runlist.""" if self._data.size == 1: return int(self._data["cumulative_preemption_time"][0]) return self._data["cumulative_preemption_time"] @cumulative_preemption_time.setter def cumulative_preemption_time(self, val): if not self._data.flags.writeable: raise ValueError("This VgpuSchedulerLogEntry_v2 instance is read-only") self._data["cumulative_preemption_time"] = val @property def weight(self): """Union[~_numpy.uint32, int]: OUT: Current weight of this SW runlist.""" if self._data.size == 1: return int(self._data["weight"][0]) return self._data["weight"] @weight.setter def weight(self, val): if not self._data.flags.writeable: raise ValueError("This VgpuSchedulerLogEntry_v2 instance is read-only") self._data["weight"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef VgpuSchedulerLogEntry_v2 obj 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 obj = VgpuSchedulerLogEntry_v2.__new__(VgpuSchedulerLogEntry_v2) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == vgpu_scheduler_log_entry_v2_dtype: obj = VgpuSchedulerLogEntry_v2.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an VgpuSchedulerLogEntry_v2 instance with the memory from the given buffer.""" return VgpuSchedulerLogEntry_v2.from_data(_numpy.frombuffer(buffer, dtype=vgpu_scheduler_log_entry_v2_dtype)) @staticmethod def from_data(data): """Create an VgpuSchedulerLogEntry_v2 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `vgpu_scheduler_log_entry_v2_dtype` holding the data. """ cdef VgpuSchedulerLogEntry_v2 obj = VgpuSchedulerLogEntry_v2.__new__(VgpuSchedulerLogEntry_v2) 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_scheduler_log_entry_v2_dtype: raise ValueError("data array must be of dtype vgpu_scheduler_log_entry_v2_dtype") obj._data = data.view(dtype=vgpu_scheduler_log_entry_v2_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an VgpuSchedulerLogEntry_v2 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 VgpuSchedulerLogEntry_v2 obj = VgpuSchedulerLogEntry_v2.__new__(VgpuSchedulerLogEntry_v2) 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(nvmlVgpuSchedulerLogEntry_v2_t) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=vgpu_scheduler_log_entry_v2_dtype_record) obj._owner = owner return obj cdef _get_vgpu_scheduler_state_v2_dtype_offsets(): cdef nvmlVgpuSchedulerState_v2_t *pod = _cyb_calloc(1, sizeof(nvmlVgpuSchedulerState_v2_t)) if pod == NULL: raise MemoryError("Error allocating nvmlVgpuSchedulerState_v2_t") try: return _numpy.dtype({ 'names': ['engine_id', 'scheduler_policy', 'avg_factor', 'frequency'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32], 'offsets': [ (&(pod.engineId)) - (pod), (&(pod.schedulerPolicy)) - (pod), (&(pod.avgFactor)) - (pod), (&(pod.frequency)) - (pod), ], 'itemsize': sizeof(nvmlVgpuSchedulerState_v2_t), }) finally: _cyb_free(pod) vgpu_scheduler_state_v2_dtype = _get_vgpu_scheduler_state_v2_dtype_offsets() cdef class VgpuSchedulerState_v2: """Empty-initialize an instance of `nvmlVgpuSchedulerState_v2_t`. .. seealso:: `nvmlVgpuSchedulerState_v2_t` """ cdef: nvmlVgpuSchedulerState_v2_t _data nvmlVgpuSchedulerState_v2_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.VgpuSchedulerState_v2 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef VgpuSchedulerState_v2 other_ if not isinstance(other, VgpuSchedulerState_v2): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuSchedulerState_v2_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuSchedulerState_v2_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def engine_id(self): """int: IN: One of NVML_VGPU_SCHEDULER_ENGINE_TYPE_*.""" return self._ptr[0].engineId @engine_id.setter def engine_id(self, val): if self._readonly: raise ValueError("This VgpuSchedulerState_v2 instance is read-only") self._ptr[0].engineId = val @property def scheduler_policy(self): """int: IN: Scheduler policy.""" return self._ptr[0].schedulerPolicy @scheduler_policy.setter def scheduler_policy(self, val): if self._readonly: raise ValueError("This VgpuSchedulerState_v2 instance is read-only") self._ptr[0].schedulerPolicy = val @property def avg_factor(self): """int: IN: Average factor in compensating the timeslice for Adaptive Round Robin mode. 0 or unspecified uses default.""" return self._ptr[0].avgFactor @avg_factor.setter def avg_factor(self, val): if self._readonly: raise ValueError("This VgpuSchedulerState_v2 instance is read-only") self._ptr[0].avgFactor = val @property def frequency(self): """int: IN: Frequency for Adaptive Round Robin mode. 0 or unspecified uses default.""" return self._ptr[0].frequency @frequency.setter def frequency(self, val): if self._readonly: raise ValueError("This VgpuSchedulerState_v2 instance is read-only") self._ptr[0].frequency = val @staticmethod def from_buffer(buffer): """Create an VgpuSchedulerState_v2 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlVgpuSchedulerState_v2_t), VgpuSchedulerState_v2) @staticmethod def from_data(data): """Create an VgpuSchedulerState_v2 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `vgpu_scheduler_state_v2_dtype` holding the data. """ return _cyb_from_data(data, "vgpu_scheduler_state_v2_dtype", vgpu_scheduler_state_v2_dtype, VgpuSchedulerState_v2) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an VgpuSchedulerState_v2 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef VgpuSchedulerState_v2 obj = VgpuSchedulerState_v2.__new__(VgpuSchedulerState_v2) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlVgpuSchedulerState_v2_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_bbx_time_data_v1_dtype_offsets(): cdef nvmlBBXTimeData_v1_t *pod = _cyb_calloc(1, sizeof(nvmlBBXTimeData_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlBBXTimeData_v1_t") try: return _numpy.dtype({ 'names': ['time_run'], 'formats': [_numpy.uint32], 'offsets': [ (&(pod.timeRun)) - (pod), ], 'itemsize': sizeof(nvmlBBXTimeData_v1_t), }) finally: _cyb_free(pod) bbx_time_data_v1_dtype = _get_bbx_time_data_v1_dtype_offsets() cdef class BBXTimeData_v1: """Empty-initialize an instance of `nvmlBBXTimeData_v1_t`. .. seealso:: `nvmlBBXTimeData_v1_t` """ cdef: nvmlBBXTimeData_v1_t _data nvmlBBXTimeData_v1_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.BBXTimeData_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef BBXTimeData_v1 other_ if not isinstance(other, BBXTimeData_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlBBXTimeData_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlBBXTimeData_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def time_run(self): """int: [out] Cumulative number of seconds the GPU has had the driver loaded""" return self._ptr[0].timeRun @time_run.setter def time_run(self, val): if self._readonly: raise ValueError("This BBXTimeData_v1 instance is read-only") self._ptr[0].timeRun = val @staticmethod def from_buffer(buffer): """Create an BBXTimeData_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlBBXTimeData_v1_t), BBXTimeData_v1) @staticmethod def from_data(data): """Create an BBXTimeData_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `bbx_time_data_v1_dtype` holding the data. """ return _cyb_from_data(data, "bbx_time_data_v1_dtype", bbx_time_data_v1_dtype, BBXTimeData_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an BBXTimeData_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef BBXTimeData_v1 obj = BBXTimeData_v1.__new__(BBXTimeData_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlBBXTimeData_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_remapped_rows_info_v2_dtype_offsets(): cdef nvmlRemappedRowsInfo_v2_t *pod = _cyb_calloc(1, sizeof(nvmlRemappedRowsInfo_v2_t)) if pod == NULL: raise MemoryError("Error allocating nvmlRemappedRowsInfo_v2_t") try: return _numpy.dtype({ 'names': ['corr_active_remaps', 'corr_inactive_remaps', 'unc_active_remaps', 'unc_inactive_remaps', 'b_pending', 'b_failure_occurred'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32], 'offsets': [ (&(pod.corrActiveRemaps)) - (pod), (&(pod.corrInactiveRemaps)) - (pod), (&(pod.uncActiveRemaps)) - (pod), (&(pod.uncInactiveRemaps)) - (pod), (&(pod.bPending)) - (pod), (&(pod.bFailureOccurred)) - (pod), ], 'itemsize': sizeof(nvmlRemappedRowsInfo_v2_t), }) finally: _cyb_free(pod) remapped_rows_info_v2_dtype = _get_remapped_rows_info_v2_dtype_offsets() cdef class RemappedRowsInfo_v2: """Empty-initialize an instance of `nvmlRemappedRowsInfo_v2_t`. .. seealso:: `nvmlRemappedRowsInfo_v2_t` """ cdef: nvmlRemappedRowsInfo_v2_t _data nvmlRemappedRowsInfo_v2_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.RemappedRowsInfo_v2 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef RemappedRowsInfo_v2 other_ if not isinstance(other, RemappedRowsInfo_v2): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlRemappedRowsInfo_v2_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlRemappedRowsInfo_v2_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def corr_active_remaps(self): """int: Number of active row remappings due to correctable errors.""" return self._ptr[0].corrActiveRemaps @corr_active_remaps.setter def corr_active_remaps(self, val): if self._readonly: raise ValueError("This RemappedRowsInfo_v2 instance is read-only") self._ptr[0].corrActiveRemaps = val @property def corr_inactive_remaps(self): """int: Number of inactive row remappings due to correctable errors.""" return self._ptr[0].corrInactiveRemaps @corr_inactive_remaps.setter def corr_inactive_remaps(self, val): if self._readonly: raise ValueError("This RemappedRowsInfo_v2 instance is read-only") self._ptr[0].corrInactiveRemaps = val @property def unc_active_remaps(self): """int: Number of active row remappings due to uncorrectable errors.""" return self._ptr[0].uncActiveRemaps @unc_active_remaps.setter def unc_active_remaps(self, val): if self._readonly: raise ValueError("This RemappedRowsInfo_v2 instance is read-only") self._ptr[0].uncActiveRemaps = val @property def unc_inactive_remaps(self): """int: Number of inactive row remappings due to uncorrectable errors.""" return self._ptr[0].uncInactiveRemaps @unc_inactive_remaps.setter def unc_inactive_remaps(self, val): if self._readonly: raise ValueError("This RemappedRowsInfo_v2 instance is read-only") self._ptr[0].uncInactiveRemaps = val @property def b_pending(self): """int: Whether or not there is any pending row remapping; 0 indicates not pending, 1 indicates pending.""" return self._ptr[0].bPending @b_pending.setter def b_pending(self, val): if self._readonly: raise ValueError("This RemappedRowsInfo_v2 instance is read-only") self._ptr[0].bPending = val @property def b_failure_occurred(self): """int: Whether or not there's any row remapping failure in the past; 0 indicates no failure, 1 indicates failure occurred.""" return self._ptr[0].bFailureOccurred @b_failure_occurred.setter def b_failure_occurred(self, val): if self._readonly: raise ValueError("This RemappedRowsInfo_v2 instance is read-only") self._ptr[0].bFailureOccurred = val @staticmethod def from_buffer(buffer): """Create an RemappedRowsInfo_v2 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlRemappedRowsInfo_v2_t), RemappedRowsInfo_v2) @staticmethod def from_data(data): """Create an RemappedRowsInfo_v2 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `remapped_rows_info_v2_dtype` holding the data. """ return _cyb_from_data(data, "remapped_rows_info_v2_dtype", remapped_rows_info_v2_dtype, RemappedRowsInfo_v2) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an RemappedRowsInfo_v2 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef RemappedRowsInfo_v2 obj = RemappedRowsInfo_v2.__new__(RemappedRowsInfo_v2) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlRemappedRowsInfo_v2_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_accounting_stats_v2_dtype_offsets(): cdef nvmlAccountingStats_v2_t *pod = _cyb_calloc(1, sizeof(nvmlAccountingStats_v2_t)) if pod == NULL: raise MemoryError("Error allocating nvmlAccountingStats_v2_t") try: return _numpy.dtype({ 'names': ['pid', 'is_running', 'gpu_utilization', 'memory_utilization', 'max_memory_usage', 'sample_count', 'sum_gpu_util', 'sum_fb_util', 'time', 'start_time'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint64, _numpy.uint32, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64], 'offsets': [ (&(pod.pid)) - (pod), (&(pod.isRunning)) - (pod), (&(pod.gpuUtilization)) - (pod), (&(pod.memoryUtilization)) - (pod), (&(pod.maxMemoryUsage)) - (pod), (&(pod.sampleCount)) - (pod), (&(pod.sumGpuUtil)) - (pod), (&(pod.sumFbUtil)) - (pod), (&(pod.time)) - (pod), (&(pod.startTime)) - (pod), ], 'itemsize': sizeof(nvmlAccountingStats_v2_t), }) finally: _cyb_free(pod) accounting_stats_v2_dtype = _get_accounting_stats_v2_dtype_offsets() cdef class AccountingStats_v2: """Empty-initialize an instance of `nvmlAccountingStats_v2_t`. .. seealso:: `nvmlAccountingStats_v2_t` """ cdef: nvmlAccountingStats_v2_t _data nvmlAccountingStats_v2_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.AccountingStats_v2 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef AccountingStats_v2 other_ if not isinstance(other, AccountingStats_v2): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlAccountingStats_v2_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlAccountingStats_v2_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def pid(self): """int: Process Id of the target process to query stats for.""" return self._ptr[0].pid @pid.setter def pid(self, val): if self._readonly: raise ValueError("This AccountingStats_v2 instance is read-only") self._ptr[0].pid = val @property def is_running(self): """int: Flag to represent if the process is running (1 for running, 0 for terminated).""" return self._ptr[0].isRunning @is_running.setter def is_running(self, val): if self._readonly: raise ValueError("This AccountingStats_v2 instance is read-only") self._ptr[0].isRunning = val @property def gpu_utilization(self): """int: Percent of time over the process's lifetime during which one or more kernels was executing on the GPU. Utilization stats just like returned by nvmlDeviceGetUtilizationRates but for the life time of a process (not just the last sample period). Set to NVML_VALUE_NOT_AVAILABLE if nvmlDeviceGetUtilizationRates is not supported""" return self._ptr[0].gpuUtilization @gpu_utilization.setter def gpu_utilization(self, val): if self._readonly: raise ValueError("This AccountingStats_v2 instance is read-only") self._ptr[0].gpuUtilization = val @property def memory_utilization(self): """int: Percent of time over the process's lifetime during which global (device) memory was being read or written. Set to NVML_VALUE_NOT_AVAILABLE if nvmlDeviceGetUtilizationRates is not supported""" return self._ptr[0].memoryUtilization @memory_utilization.setter def memory_utilization(self, val): if self._readonly: raise ValueError("This AccountingStats_v2 instance is read-only") self._ptr[0].memoryUtilization = val @property def max_memory_usage(self): """int: Maximum total memory in bytes that was ever allocated by the process. Set to NVML_VALUE_NOT_AVAILABLE if nvmlProcessInfo_t->usedGpuMemory is not supported""" return self._ptr[0].maxMemoryUsage @max_memory_usage.setter def max_memory_usage(self, val): if self._readonly: raise ValueError("This AccountingStats_v2 instance is read-only") self._ptr[0].maxMemoryUsage = val @property def sample_count(self): """int: The sample counts since the process starts.""" return self._ptr[0].sampleCount @sample_count.setter def sample_count(self, val): if self._readonly: raise ValueError("This AccountingStats_v2 instance is read-only") self._ptr[0].sampleCount = val @property def sum_gpu_util(self): """int: The sum of process's GR engine utilization in unit of pct * 100.""" return self._ptr[0].sumGpuUtil @sum_gpu_util.setter def sum_gpu_util(self, val): if self._readonly: raise ValueError("This AccountingStats_v2 instance is read-only") self._ptr[0].sumGpuUtil = val @property def sum_fb_util(self): """int: The sum of process's FB bandwidth utilization in unit of pct * 100.""" return self._ptr[0].sumFbUtil @sum_fb_util.setter def sum_fb_util(self, val): if self._readonly: raise ValueError("This AccountingStats_v2 instance is read-only") self._ptr[0].sumFbUtil = val @property def time(self): """int: Amount of time in ms during which the compute context was active. The time is reported as 0 if the process is not terminated""" return self._ptr[0].time @time.setter def time(self, val): if self._readonly: raise ValueError("This AccountingStats_v2 instance is read-only") self._ptr[0].time = val @property def start_time(self): """int: CPU Timestamp in usec representing start time for the process.""" return self._ptr[0].startTime @start_time.setter def start_time(self, val): if self._readonly: raise ValueError("This AccountingStats_v2 instance is read-only") self._ptr[0].startTime = val @staticmethod def from_buffer(buffer): """Create an AccountingStats_v2 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlAccountingStats_v2_t), AccountingStats_v2) @staticmethod def from_data(data): """Create an AccountingStats_v2 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `accounting_stats_v2_dtype` holding the data. """ return _cyb_from_data(data, "accounting_stats_v2_dtype", accounting_stats_v2_dtype, AccountingStats_v2) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an AccountingStats_v2 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef AccountingStats_v2 obj = AccountingStats_v2.__new__(AccountingStats_v2) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlAccountingStats_v2_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_cper_cursor_v1_dtype_offsets(): cdef nvmlCPERCursor_v1_t *pod = _cyb_calloc(1, sizeof(nvmlCPERCursor_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlCPERCursor_v1_t") try: return _numpy.dtype({ 'names': ['cper_type_mask', 'uuid', 'handle'], 'formats': [_numpy.uint32, (_numpy.int8, 80), _numpy.uint64], 'offsets': [ (&(pod.cperTypeMask)) - (pod), (&(pod.uuid)) - (pod), (&(pod.handle)) - (pod), ], 'itemsize': sizeof(nvmlCPERCursor_v1_t), }) finally: _cyb_free(pod) cper_cursor_v1_dtype = _get_cper_cursor_v1_dtype_offsets() cdef class CPERCursor_v1: """Empty-initialize an instance of `nvmlCPERCursor_v1_t`. .. seealso:: `nvmlCPERCursor_v1_t` """ cdef: nvmlCPERCursor_v1_t *_ptr object _owner 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._readonly = False def __dealloc__(self): cdef nvmlCPERCursor_v1_t *ptr if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) def __repr__(self): return f"<{__name__}.CPERCursor_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef CPERCursor_v1 other_ if not isinstance(other, CPERCursor_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlCPERCursor_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlCPERCursor_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def cper_type_mask(self): """int: [IN] Types of records to access. Bitmask of `nvmlCPERType_t` values. To change, reset `handle` to `NVML_CPER_CURSOR_HANDLE_INIT`.""" return self._ptr[0].cperTypeMask @cper_type_mask.setter def cper_type_mask(self, val): if self._readonly: raise ValueError("This CPERCursor_v1 instance is read-only") self._ptr[0].cperTypeMask = val @property def uuid(self): """~_numpy.int8: (array of length 80).[IN] UUID of target to filter records for. Required for `NVML_CPER_ACCESS_TYPE_GPU`. To change, reset `handle` to `NVML_CPER_CURSOR_HANDLE_INIT`.""" return _cyb_cpython.PyUnicode_FromString(self._ptr[0].uuid) @uuid.setter def uuid(self, val): if self._readonly: raise ValueError("This CPERCursor_v1 instance is read-only") cdef bytes buf = val.encode() if len(buf) >= 80: raise ValueError("String too long for field uuid, max length is 79") cdef char *ptr = buf _cyb_memcpy((self._ptr[0].uuid), ptr, 80) @property def handle(self): """int: [IN/OUT] Opaque handle tracking read position. Initialize to `NVML_CPER_CURSOR_HANDLE_INIT` on first call; pass the same ``nvmlCPERCursor_v1_t`` on the next call to continue. Caller must not interpret or modify.""" return (self._ptr[0].handle) @handle.setter def handle(self, val): if self._readonly: raise ValueError("This CPERCursor_v1 instance is read-only") self._ptr[0].handle = val @staticmethod def from_buffer(buffer): """Create an CPERCursor_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlCPERCursor_v1_t), CPERCursor_v1) @staticmethod def from_data(data): """Create an CPERCursor_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `cper_cursor_v1_dtype` holding the data. """ return _cyb_from_data(data, "cper_cursor_v1_dtype", cper_cursor_v1_dtype, CPERCursor_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an CPERCursor_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef CPERCursor_v1 obj = CPERCursor_v1.__new__(CPERCursor_v1) if owner is None: obj._ptr = _cyb_malloc(sizeof(nvmlCPERCursor_v1_t)) 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 else: obj._ptr = ptr obj._owns_ptr = False obj._owner = owner obj._readonly = readonly return obj cdef _get_set_memory_limits_v1_dtype_offsets(): cdef nvmlSetMemoryLimits_v1_t *pod = _cyb_calloc(1, sizeof(nvmlSetMemoryLimits_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlSetMemoryLimits_v1_t") try: return _numpy.dtype({ 'names': ['name_space', 'soft_limit', 'hard_limit'], 'formats': [_numpy.intp, _numpy.uint64, _numpy.uint64], 'offsets': [ (&(pod.nameSpace)) - (pod), (&(pod.softLimit)) - (pod), (&(pod.hardLimit)) - (pod), ], 'itemsize': sizeof(nvmlSetMemoryLimits_v1_t), }) finally: _cyb_free(pod) set_memory_limits_v1_dtype = _get_set_memory_limits_v1_dtype_offsets() cdef class SetMemoryLimits_v1: """Empty-initialize an instance of `nvmlSetMemoryLimits_v1_t`. .. seealso:: `nvmlSetMemoryLimits_v1_t` """ cdef: nvmlSetMemoryLimits_v1_t _data nvmlSetMemoryLimits_v1_t *_ptr object _owner bint _readonly dict _refs def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False self._refs = {} def __repr__(self): return f"<{__name__}.SetMemoryLimits_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef SetMemoryLimits_v1 other_ if not isinstance(other, SetMemoryLimits_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlSetMemoryLimits_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlSetMemoryLimits_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def name_space(self): """str: [in] Full path to sysfs cgroup file name""" cdef char* ptr = self._ptr[0].nameSpace if ptr: return _cyb_cpython.PyUnicode_FromString(ptr) return "" @name_space.setter def name_space(self, val): if self._readonly: raise ValueError("This SetMemoryLimits_v1 instance is read-only") cdef bytes buf = val.encode() cdef char *ptr = buf self._refs["name_space"] = buf self._ptr[0].nameSpace = ptr @property def soft_limit(self): """int: [in] Soft memory limit in Bytes.""" return self._ptr[0].softLimit @soft_limit.setter def soft_limit(self, val): if self._readonly: raise ValueError("This SetMemoryLimits_v1 instance is read-only") self._ptr[0].softLimit = val @property def hard_limit(self): """int: [in] Hard memory limit in Bytes.""" return self._ptr[0].hardLimit @hard_limit.setter def hard_limit(self, val): if self._readonly: raise ValueError("This SetMemoryLimits_v1 instance is read-only") self._ptr[0].hardLimit = val @staticmethod def from_buffer(buffer): """Create an SetMemoryLimits_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlSetMemoryLimits_v1_t), SetMemoryLimits_v1) @staticmethod def from_data(data): """Create an SetMemoryLimits_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `set_memory_limits_v1_dtype` holding the data. """ return _cyb_from_data(data, "set_memory_limits_v1_dtype", set_memory_limits_v1_dtype, SetMemoryLimits_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an SetMemoryLimits_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef SetMemoryLimits_v1 obj = SetMemoryLimits_v1.__new__(SetMemoryLimits_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlSetMemoryLimits_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly obj._refs = {} return obj cdef _get_get_memory_limits_v1_dtype_offsets(): cdef nvmlGetMemoryLimits_v1_t *pod = _cyb_calloc(1, sizeof(nvmlGetMemoryLimits_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlGetMemoryLimits_v1_t") try: return _numpy.dtype({ 'names': ['name_space', 'soft_limit', 'hard_limit', 'current_used'], 'formats': [_numpy.intp, _numpy.uint64, _numpy.uint64, _numpy.uint64], 'offsets': [ (&(pod.nameSpace)) - (pod), (&(pod.softLimit)) - (pod), (&(pod.hardLimit)) - (pod), (&(pod.currentUsed)) - (pod), ], 'itemsize': sizeof(nvmlGetMemoryLimits_v1_t), }) finally: _cyb_free(pod) get_memory_limits_v1_dtype = _get_get_memory_limits_v1_dtype_offsets() cdef class GetMemoryLimits_v1: """Empty-initialize an instance of `nvmlGetMemoryLimits_v1_t`. .. seealso:: `nvmlGetMemoryLimits_v1_t` """ cdef: nvmlGetMemoryLimits_v1_t _data nvmlGetMemoryLimits_v1_t *_ptr object _owner bint _readonly dict _refs def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False self._refs = {} def __repr__(self): return f"<{__name__}.GetMemoryLimits_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef GetMemoryLimits_v1 other_ if not isinstance(other, GetMemoryLimits_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlGetMemoryLimits_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlGetMemoryLimits_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def name_space(self): """str: [in] Full path to sysfs cgroup file name""" cdef char* ptr = self._ptr[0].nameSpace if ptr: return _cyb_cpython.PyUnicode_FromString(ptr) return "" @name_space.setter def name_space(self, val): if self._readonly: raise ValueError("This GetMemoryLimits_v1 instance is read-only") cdef bytes buf = val.encode() cdef char *ptr = buf self._refs["name_space"] = buf self._ptr[0].nameSpace = ptr @property def soft_limit(self): """int: [out] Currently set soft memory limit in Bytes.""" return self._ptr[0].softLimit @soft_limit.setter def soft_limit(self, val): if self._readonly: raise ValueError("This GetMemoryLimits_v1 instance is read-only") self._ptr[0].softLimit = val @property def hard_limit(self): """int: [out] Currently set hard memory limit in Bytes.""" return self._ptr[0].hardLimit @hard_limit.setter def hard_limit(self, val): if self._readonly: raise ValueError("This GetMemoryLimits_v1 instance is read-only") self._ptr[0].hardLimit = val @property def current_used(self): """int: [out] Currently used memory in Bytes.""" return self._ptr[0].currentUsed @current_used.setter def current_used(self, val): if self._readonly: raise ValueError("This GetMemoryLimits_v1 instance is read-only") self._ptr[0].currentUsed = val @staticmethod def from_buffer(buffer): """Create an GetMemoryLimits_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlGetMemoryLimits_v1_t), GetMemoryLimits_v1) @staticmethod def from_data(data): """Create an GetMemoryLimits_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `get_memory_limits_v1_dtype` holding the data. """ return _cyb_from_data(data, "get_memory_limits_v1_dtype", get_memory_limits_v1_dtype, GetMemoryLimits_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an GetMemoryLimits_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef GetMemoryLimits_v1 obj = GetMemoryLimits_v1.__new__(GetMemoryLimits_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlGetMemoryLimits_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly obj._refs = {} return obj cdef _get_pmgr_pwr_tuple_dtype_offsets(): cdef nvmlPmgrPwrTuple_t *pod = _cyb_calloc(1, sizeof(nvmlPmgrPwrTuple_t)) if pod == NULL: raise MemoryError("Error allocating nvmlPmgrPwrTuple_t") try: return _numpy.dtype({ 'names': ['pwrm_w'], 'formats': [_numpy.uint32], 'offsets': [ (&(pod.pwrmW)) - (pod), ], 'itemsize': sizeof(nvmlPmgrPwrTuple_t), }) finally: _cyb_free(pod) pmgr_pwr_tuple_dtype = _get_pmgr_pwr_tuple_dtype_offsets() cdef object pmgr_pwr_tuple_dtype_record = _numpy.dtype((_numpy.record, pmgr_pwr_tuple_dtype)) cdef class PmgrPwrTuple: """Empty-initialize an array of `nvmlPmgrPwrTuple_t`. The resulting object is of length `size` and of dtype `pmgr_pwr_tuple_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `nvmlPmgrPwrTuple_t` """ cdef: readonly object _data object _owner def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=pmgr_pwr_tuple_dtype_record) assert self._data.itemsize == sizeof(nvmlPmgrPwrTuple_t), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlPmgrPwrTuple_t) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}.PmgrPwrTuple_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}.PmgrPwrTuple object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, PmgrPwrTuple)) 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 pwrm_w(self): """Union[~_numpy.uint32, int]: Power consumption in milliwatts.""" if self._data.size == 1: return int(self._data["pwrm_w"][0]) return self._data["pwrm_w"] @pwrm_w.setter def pwrm_w(self, val): if not self._data.flags.writeable: raise ValueError("This PmgrPwrTuple instance is read-only") self._data["pwrm_w"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef PmgrPwrTuple obj 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 obj = PmgrPwrTuple.__new__(PmgrPwrTuple) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == pmgr_pwr_tuple_dtype: obj = PmgrPwrTuple.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an PmgrPwrTuple instance with the memory from the given buffer.""" return PmgrPwrTuple.from_data(_numpy.frombuffer(buffer, dtype=pmgr_pwr_tuple_dtype)) @staticmethod def from_data(data): """Create an PmgrPwrTuple instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `pmgr_pwr_tuple_dtype` holding the data. """ cdef PmgrPwrTuple obj = PmgrPwrTuple.__new__(PmgrPwrTuple) 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 != pmgr_pwr_tuple_dtype: raise ValueError("data array must be of dtype pmgr_pwr_tuple_dtype") obj._data = data.view(dtype=pmgr_pwr_tuple_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an PmgrPwrTuple 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 PmgrPwrTuple obj = PmgrPwrTuple.__new__(PmgrPwrTuple) 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(nvmlPmgrPwrTuple_t) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=pmgr_pwr_tuple_dtype_record) obj._owner = owner return obj cdef _get_rail_metrics_dtype_offsets(): cdef nvmlRailMetrics_t *pod = _cyb_calloc(1, sizeof(nvmlRailMetrics_t)) if pod == NULL: raise MemoryError("Error allocating nvmlRailMetrics_t") try: return _numpy.dtype({ 'names': ['freqk_hz', 'util_pct'], 'formats': [_numpy.uint32, _numpy.uint64], 'offsets': [ (&(pod.freqkHz)) - (pod), (&(pod.utilPct)) - (pod), ], 'itemsize': sizeof(nvmlRailMetrics_t), }) finally: _cyb_free(pod) rail_metrics_dtype = _get_rail_metrics_dtype_offsets() cdef object rail_metrics_dtype_record = _numpy.dtype((_numpy.record, rail_metrics_dtype)) cdef class RailMetrics: """Empty-initialize an array of `nvmlRailMetrics_t`. The resulting object is of length `size` and of dtype `rail_metrics_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `nvmlRailMetrics_t` """ cdef: readonly object _data object _owner def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=rail_metrics_dtype_record) assert self._data.itemsize == sizeof(nvmlRailMetrics_t), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlRailMetrics_t) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}.RailMetrics_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}.RailMetrics object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, RailMetrics)) 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 freqk_hz(self): """Union[~_numpy.uint32, int]: Frequency in kilohertz.""" if self._data.size == 1: return int(self._data["freqk_hz"][0]) return self._data["freqk_hz"] @freqk_hz.setter def freqk_hz(self, val): if not self._data.flags.writeable: raise ValueError("This RailMetrics instance is read-only") self._data["freqk_hz"] = val @property def util_pct(self): """Union[~_numpy.uint64, int]: Utilization percentage (fixed-point).""" if self._data.size == 1: return int(self._data["util_pct"][0]) return self._data["util_pct"] @util_pct.setter def util_pct(self, val): if not self._data.flags.writeable: raise ValueError("This RailMetrics instance is read-only") self._data["util_pct"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef RailMetrics obj 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 obj = RailMetrics.__new__(RailMetrics) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == rail_metrics_dtype: obj = RailMetrics.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an RailMetrics instance with the memory from the given buffer.""" return RailMetrics.from_data(_numpy.frombuffer(buffer, dtype=rail_metrics_dtype)) @staticmethod def from_data(data): """Create an RailMetrics instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `rail_metrics_dtype` holding the data. """ cdef RailMetrics obj = RailMetrics.__new__(RailMetrics) 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 != rail_metrics_dtype: raise ValueError("data array must be of dtype rail_metrics_dtype") obj._data = data.view(dtype=rail_metrics_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an RailMetrics 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 RailMetrics obj = RailMetrics.__new__(RailMetrics) 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(nvmlRailMetrics_t) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=rail_metrics_dtype_record) obj._owner = owner return obj cdef _get_pwr_model_metrics_dlppm1x_perf_dtype_offsets(): cdef nvmlPwrModelMetricsDlppm1xPerf_t *pod = _cyb_calloc(1, sizeof(nvmlPwrModelMetricsDlppm1xPerf_t)) if pod == NULL: raise MemoryError("Error allocating nvmlPwrModelMetricsDlppm1xPerf_t") try: return _numpy.dtype({ 'names': ['perfms'], 'formats': [_numpy.uint32], 'offsets': [ (&(pod.perfms)) - (pod), ], 'itemsize': sizeof(nvmlPwrModelMetricsDlppm1xPerf_t), }) finally: _cyb_free(pod) pwr_model_metrics_dlppm1x_perf_dtype = _get_pwr_model_metrics_dlppm1x_perf_dtype_offsets() cdef object pwr_model_metrics_dlppm1x_perf_dtype_record = _numpy.dtype((_numpy.record, pwr_model_metrics_dlppm1x_perf_dtype)) cdef class PwrModelMetricsDlppm1xPerf: """Empty-initialize an array of `nvmlPwrModelMetricsDlppm1xPerf_t`. The resulting object is of length `size` and of dtype `pwr_model_metrics_dlppm1x_perf_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `nvmlPwrModelMetricsDlppm1xPerf_t` """ cdef: readonly object _data object _owner def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=pwr_model_metrics_dlppm1x_perf_dtype_record) assert self._data.itemsize == sizeof(nvmlPwrModelMetricsDlppm1xPerf_t), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlPwrModelMetricsDlppm1xPerf_t) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}.PwrModelMetricsDlppm1xPerf_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}.PwrModelMetricsDlppm1xPerf object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, PwrModelMetricsDlppm1xPerf)) 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 perfms(self): """Union[~_numpy.uint32, int]: Performance metric in milliseconds.""" if self._data.size == 1: return int(self._data["perfms"][0]) return self._data["perfms"] @perfms.setter def perfms(self, val): if not self._data.flags.writeable: raise ValueError("This PwrModelMetricsDlppm1xPerf instance is read-only") self._data["perfms"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef PwrModelMetricsDlppm1xPerf obj 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 obj = PwrModelMetricsDlppm1xPerf.__new__(PwrModelMetricsDlppm1xPerf) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == pwr_model_metrics_dlppm1x_perf_dtype: obj = PwrModelMetricsDlppm1xPerf.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an PwrModelMetricsDlppm1xPerf instance with the memory from the given buffer.""" return PwrModelMetricsDlppm1xPerf.from_data(_numpy.frombuffer(buffer, dtype=pwr_model_metrics_dlppm1x_perf_dtype)) @staticmethod def from_data(data): """Create an PwrModelMetricsDlppm1xPerf instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `pwr_model_metrics_dlppm1x_perf_dtype` holding the data. """ cdef PwrModelMetricsDlppm1xPerf obj = PwrModelMetricsDlppm1xPerf.__new__(PwrModelMetricsDlppm1xPerf) 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 != pwr_model_metrics_dlppm1x_perf_dtype: raise ValueError("data array must be of dtype pwr_model_metrics_dlppm1x_perf_dtype") obj._data = data.view(dtype=pwr_model_metrics_dlppm1x_perf_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an PwrModelMetricsDlppm1xPerf 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 PwrModelMetricsDlppm1xPerf obj = PwrModelMetricsDlppm1xPerf.__new__(PwrModelMetricsDlppm1xPerf) 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(nvmlPwrModelMetricsDlppm1xPerf_t) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=pwr_model_metrics_dlppm1x_perf_dtype_record) obj._owner = owner return obj cdef _get_pwr_model_metrics_sample_pfpp1x_dtype_offsets(): cdef nvmlPwrModelMetricsSamplePfpp1x_t *pod = _cyb_calloc(1, sizeof(nvmlPwrModelMetricsSamplePfpp1x_t)) if pod == NULL: raise MemoryError("Error allocating nvmlPwrModelMetricsSamplePfpp1x_t") try: return _numpy.dtype({ 'names': ['freqk_hz', 'est_tgp_pwrm_w'], 'formats': [(_numpy.uint32, 16), _numpy.uint32], 'offsets': [ (&(pod.freqkHz)) - (pod), (&(pod.estTgpPwrmW)) - (pod), ], 'itemsize': sizeof(nvmlPwrModelMetricsSamplePfpp1x_t), }) finally: _cyb_free(pod) pwr_model_metrics_sample_pfpp1x_dtype = _get_pwr_model_metrics_sample_pfpp1x_dtype_offsets() cdef object pwr_model_metrics_sample_pfpp1x_dtype_record = _numpy.dtype((_numpy.record, pwr_model_metrics_sample_pfpp1x_dtype)) cdef class PwrModelMetricsSamplePfpp1x: """Empty-initialize an array of `nvmlPwrModelMetricsSamplePfpp1x_t`. The resulting object is of length `size` and of dtype `pwr_model_metrics_sample_pfpp1x_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `nvmlPwrModelMetricsSamplePfpp1x_t` """ cdef: readonly object _data object _owner def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=pwr_model_metrics_sample_pfpp1x_dtype_record) assert self._data.itemsize == sizeof(nvmlPwrModelMetricsSamplePfpp1x_t), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlPwrModelMetricsSamplePfpp1x_t) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}.PwrModelMetricsSamplePfpp1x_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}.PwrModelMetricsSamplePfpp1x object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, PwrModelMetricsSamplePfpp1x)) 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 freqk_hz(self): """~_numpy.uint32: (array of length 16).Array of input frequencies in kilohertz for each domain.""" return self._data["freqk_hz"] @freqk_hz.setter def freqk_hz(self, val): if not self._data.flags.writeable: raise ValueError("This PwrModelMetricsSamplePfpp1x instance is read-only") self._data["freqk_hz"] = val @property def est_tgp_pwrm_w(self): """Union[~_numpy.uint32, int]: Estimated Total Graphics Power in milliwatts.""" if self._data.size == 1: return int(self._data["est_tgp_pwrm_w"][0]) return self._data["est_tgp_pwrm_w"] @est_tgp_pwrm_w.setter def est_tgp_pwrm_w(self, val): if not self._data.flags.writeable: raise ValueError("This PwrModelMetricsSamplePfpp1x instance is read-only") self._data["est_tgp_pwrm_w"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef PwrModelMetricsSamplePfpp1x obj 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 obj = PwrModelMetricsSamplePfpp1x.__new__(PwrModelMetricsSamplePfpp1x) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == pwr_model_metrics_sample_pfpp1x_dtype: obj = PwrModelMetricsSamplePfpp1x.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an PwrModelMetricsSamplePfpp1x instance with the memory from the given buffer.""" return PwrModelMetricsSamplePfpp1x.from_data(_numpy.frombuffer(buffer, dtype=pwr_model_metrics_sample_pfpp1x_dtype)) @staticmethod def from_data(data): """Create an PwrModelMetricsSamplePfpp1x instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `pwr_model_metrics_sample_pfpp1x_dtype` holding the data. """ cdef PwrModelMetricsSamplePfpp1x obj = PwrModelMetricsSamplePfpp1x.__new__(PwrModelMetricsSamplePfpp1x) 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 != pwr_model_metrics_sample_pfpp1x_dtype: raise ValueError("data array must be of dtype pwr_model_metrics_sample_pfpp1x_dtype") obj._data = data.view(dtype=pwr_model_metrics_sample_pfpp1x_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an PwrModelMetricsSamplePfpp1x 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 PwrModelMetricsSamplePfpp1x obj = PwrModelMetricsSamplePfpp1x.__new__(PwrModelMetricsSamplePfpp1x) 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(nvmlPwrModelMetricsSamplePfpp1x_t) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=pwr_model_metrics_sample_pfpp1x_dtype_record) obj._owner = owner return obj cdef _get_pwr_model_operating_point_pfpp1x_dtype_offsets(): cdef nvmlPwrModelOperatingPointPfpp1x_t *pod = _cyb_calloc(1, sizeof(nvmlPwrModelOperatingPointPfpp1x_t)) if pod == NULL: raise MemoryError("Error allocating nvmlPwrModelOperatingPointPfpp1x_t") try: return _numpy.dtype({ 'names': ['freqk_hz', 'pwrm_w'], 'formats': [_numpy.uint32, _numpy.uint32], 'offsets': [ (&(pod.freqkHz)) - (pod), (&(pod.pwrmW)) - (pod), ], 'itemsize': sizeof(nvmlPwrModelOperatingPointPfpp1x_t), }) finally: _cyb_free(pod) pwr_model_operating_point_pfpp1x_dtype = _get_pwr_model_operating_point_pfpp1x_dtype_offsets() cdef object pwr_model_operating_point_pfpp1x_dtype_record = _numpy.dtype((_numpy.record, pwr_model_operating_point_pfpp1x_dtype)) cdef class PwrModelOperatingPointPfpp1x: """Empty-initialize an array of `nvmlPwrModelOperatingPointPfpp1x_t`. The resulting object is of length `size` and of dtype `pwr_model_operating_point_pfpp1x_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `nvmlPwrModelOperatingPointPfpp1x_t` """ cdef: readonly object _data object _owner def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=pwr_model_operating_point_pfpp1x_dtype_record) assert self._data.itemsize == sizeof(nvmlPwrModelOperatingPointPfpp1x_t), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlPwrModelOperatingPointPfpp1x_t) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}.PwrModelOperatingPointPfpp1x_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}.PwrModelOperatingPointPfpp1x object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, PwrModelOperatingPointPfpp1x)) 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 freqk_hz(self): """Union[~_numpy.uint32, int]: Operating frequency in kilohertz.""" if self._data.size == 1: return int(self._data["freqk_hz"][0]) return self._data["freqk_hz"] @freqk_hz.setter def freqk_hz(self, val): if not self._data.flags.writeable: raise ValueError("This PwrModelOperatingPointPfpp1x instance is read-only") self._data["freqk_hz"] = val @property def pwrm_w(self): """Union[~_numpy.uint32, int]: Power consumption at this frequency in milliwatts.""" if self._data.size == 1: return int(self._data["pwrm_w"][0]) return self._data["pwrm_w"] @pwrm_w.setter def pwrm_w(self, val): if not self._data.flags.writeable: raise ValueError("This PwrModelOperatingPointPfpp1x instance is read-only") self._data["pwrm_w"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef PwrModelOperatingPointPfpp1x obj 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 obj = PwrModelOperatingPointPfpp1x.__new__(PwrModelOperatingPointPfpp1x) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == pwr_model_operating_point_pfpp1x_dtype: obj = PwrModelOperatingPointPfpp1x.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an PwrModelOperatingPointPfpp1x instance with the memory from the given buffer.""" return PwrModelOperatingPointPfpp1x.from_data(_numpy.frombuffer(buffer, dtype=pwr_model_operating_point_pfpp1x_dtype)) @staticmethod def from_data(data): """Create an PwrModelOperatingPointPfpp1x instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `pwr_model_operating_point_pfpp1x_dtype` holding the data. """ cdef PwrModelOperatingPointPfpp1x obj = PwrModelOperatingPointPfpp1x.__new__(PwrModelOperatingPointPfpp1x) 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 != pwr_model_operating_point_pfpp1x_dtype: raise ValueError("data array must be of dtype pwr_model_operating_point_pfpp1x_dtype") obj._data = data.view(dtype=pwr_model_operating_point_pfpp1x_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an PwrModelOperatingPointPfpp1x 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 PwrModelOperatingPointPfpp1x obj = PwrModelOperatingPointPfpp1x.__new__(PwrModelOperatingPointPfpp1x) 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(nvmlPwrModelOperatingPointPfpp1x_t) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=pwr_model_operating_point_pfpp1x_dtype_record) obj._owner = owner return obj cdef _get_adaptive_tgp_mode_info_v1_dtype_offsets(): cdef nvmlAdaptiveTgpModeInfo_v1_t *pod = _cyb_calloc(1, sizeof(nvmlAdaptiveTgpModeInfo_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlAdaptiveTgpModeInfo_v1_t") try: return _numpy.dtype({ 'names': ['in_band_enable_request', 'feature_allowed_by_admin', 'admin_override_enabled', 'enablement_status', 'adjusted_limit_mw'], 'formats': [_numpy.int32, _numpy.int32, _numpy.int32, _numpy.int32, _numpy.uint32], 'offsets': [ (&(pod.inBandEnableRequest)) - (pod), (&(pod.featureAllowedByAdmin)) - (pod), (&(pod.adminOverrideEnabled)) - (pod), (&(pod.enablementStatus)) - (pod), (&(pod.adjustedLimitMw)) - (pod), ], 'itemsize': sizeof(nvmlAdaptiveTgpModeInfo_v1_t), }) finally: _cyb_free(pod) adaptive_tgp_mode_info_v1_dtype = _get_adaptive_tgp_mode_info_v1_dtype_offsets() cdef class AdaptiveTgpModeInfo_v1: """Empty-initialize an instance of `nvmlAdaptiveTgpModeInfo_v1_t`. .. seealso:: `nvmlAdaptiveTgpModeInfo_v1_t` """ cdef: nvmlAdaptiveTgpModeInfo_v1_t _data nvmlAdaptiveTgpModeInfo_v1_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.AdaptiveTgpModeInfo_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef AdaptiveTgpModeInfo_v1 other_ if not isinstance(other, AdaptiveTgpModeInfo_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlAdaptiveTgpModeInfo_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlAdaptiveTgpModeInfo_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def in_band_enable_request(self): """int: [out] In-band enable requested (NVML_FEATURE_ENABLED) or not requested (NVML_FEATURE_DISABLED)""" return (self._ptr[0].inBandEnableRequest) @in_band_enable_request.setter def in_band_enable_request(self, val): if self._readonly: raise ValueError("This AdaptiveTgpModeInfo_v1 instance is read-only") self._ptr[0].inBandEnableRequest = val @property def feature_allowed_by_admin(self): """int: [out] Feature allowed by out-of-band/admin (NVML_FEATURE_ENABLED) or not allowed (NVML_FEATURE_DISABLED)""" return (self._ptr[0].featureAllowedByAdmin) @feature_allowed_by_admin.setter def feature_allowed_by_admin(self, val): if self._readonly: raise ValueError("This AdaptiveTgpModeInfo_v1 instance is read-only") self._ptr[0].featureAllowedByAdmin = val @property def admin_override_enabled(self): """int: [out] Out-of-band/admin override active (NVML_FEATURE_ENABLED) or inactive (NVML_FEATURE_DISABLED)""" return (self._ptr[0].adminOverrideEnabled) @admin_override_enabled.setter def admin_override_enabled(self, val): if self._readonly: raise ValueError("This AdaptiveTgpModeInfo_v1 instance is read-only") self._ptr[0].adminOverrideEnabled = val @property def enablement_status(self): """int: [out] Enablement after arbitration: active (NVML_FEATURE_ENABLED) or inactive (NVML_FEATURE_DISABLED)""" return (self._ptr[0].enablementStatus) @enablement_status.setter def enablement_status(self, val): if self._readonly: raise ValueError("This AdaptiveTgpModeInfo_v1 instance is read-only") self._ptr[0].enablementStatus = val @property def adjusted_limit_mw(self): """int: [out] Adjusted TGP limit in milliwatts (valid only when feature is enabled)""" return self._ptr[0].adjustedLimitMw @adjusted_limit_mw.setter def adjusted_limit_mw(self, val): if self._readonly: raise ValueError("This AdaptiveTgpModeInfo_v1 instance is read-only") self._ptr[0].adjustedLimitMw = val @staticmethod def from_buffer(buffer): """Create an AdaptiveTgpModeInfo_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlAdaptiveTgpModeInfo_v1_t), AdaptiveTgpModeInfo_v1) @staticmethod def from_data(data): """Create an AdaptiveTgpModeInfo_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `adaptive_tgp_mode_info_v1_dtype` holding the data. """ return _cyb_from_data(data, "adaptive_tgp_mode_info_v1_dtype", adaptive_tgp_mode_info_v1_dtype, AdaptiveTgpModeInfo_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an AdaptiveTgpModeInfo_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef AdaptiveTgpModeInfo_v1 obj = AdaptiveTgpModeInfo_v1.__new__(AdaptiveTgpModeInfo_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlAdaptiveTgpModeInfo_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_event_set_get_context_count_v1_dtype_offsets(): cdef nvmlEventSetGetContextCount_v1_t *pod = _cyb_calloc(1, sizeof(nvmlEventSetGetContextCount_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlEventSetGetContextCount_v1_t") try: return _numpy.dtype({ 'names': ['count'], 'formats': [_numpy.uint32], 'offsets': [ (&(pod.count)) - (pod), ], 'itemsize': sizeof(nvmlEventSetGetContextCount_v1_t), }) finally: _cyb_free(pod) event_set_get_context_count_v1_dtype = _get_event_set_get_context_count_v1_dtype_offsets() cdef class EventSetGetContextCount_v1: """Empty-initialize an instance of `nvmlEventSetGetContextCount_v1_t`. .. seealso:: `nvmlEventSetGetContextCount_v1_t` """ cdef: nvmlEventSetGetContextCount_v1_t _data nvmlEventSetGetContextCount_v1_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.EventSetGetContextCount_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef EventSetGetContextCount_v1 other_ if not isinstance(other, EventSetGetContextCount_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlEventSetGetContextCount_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlEventSetGetContextCount_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def count(self): """int: [out] Number of context records associated with the most recent event.""" return self._ptr[0].count @count.setter def count(self, val): if self._readonly: raise ValueError("This EventSetGetContextCount_v1 instance is read-only") self._ptr[0].count = val @staticmethod def from_buffer(buffer): """Create an EventSetGetContextCount_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlEventSetGetContextCount_v1_t), EventSetGetContextCount_v1) @staticmethod def from_data(data): """Create an EventSetGetContextCount_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `event_set_get_context_count_v1_dtype` holding the data. """ return _cyb_from_data(data, "event_set_get_context_count_v1_dtype", event_set_get_context_count_v1_dtype, EventSetGetContextCount_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an EventSetGetContextCount_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef EventSetGetContextCount_v1 obj = EventSetGetContextCount_v1.__new__(EventSetGetContextCount_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlEventSetGetContextCount_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_event_set_get_context_info_v1_dtype_offsets(): cdef nvmlEventSetGetContextInfo_v1_t *pod = _cyb_calloc(1, sizeof(nvmlEventSetGetContextInfo_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlEventSetGetContextInfo_v1_t") try: return _numpy.dtype({ 'names': ['index', 'nvml_gpu_operational_event_context_type', 'source_event_context_type', 'data_size', 'data_format_version'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint16], 'offsets': [ (&(pod.index)) - (pod), (&(pod.nvmlGpuOperationalEventContextType)) - (pod), (&(pod.sourceEventContextType)) - (pod), (&(pod.dataSize)) - (pod), (&(pod.dataFormatVersion)) - (pod), ], 'itemsize': sizeof(nvmlEventSetGetContextInfo_v1_t), }) finally: _cyb_free(pod) event_set_get_context_info_v1_dtype = _get_event_set_get_context_info_v1_dtype_offsets() cdef class EventSetGetContextInfo_v1: """Empty-initialize an instance of `nvmlEventSetGetContextInfo_v1_t`. .. seealso:: `nvmlEventSetGetContextInfo_v1_t` """ cdef: nvmlEventSetGetContextInfo_v1_t _data nvmlEventSetGetContextInfo_v1_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.EventSetGetContextInfo_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef EventSetGetContextInfo_v1 other_ if not isinstance(other, EventSetGetContextInfo_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlEventSetGetContextInfo_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlEventSetGetContextInfo_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def index(self): """int: [in] Zero-based context index.""" return self._ptr[0].index @index.setter def index(self, val): if self._readonly: raise ValueError("This EventSetGetContextInfo_v1 instance is read-only") self._ptr[0].index = val @property def nvml_gpu_operational_event_context_type(self): """int: [out] `nvmlGpuOperationalEventContextType_t` value describing the NVML public interpretation of the context payload.""" return self._ptr[0].nvmlGpuOperationalEventContextType @nvml_gpu_operational_event_context_type.setter def nvml_gpu_operational_event_context_type(self, val): if self._readonly: raise ValueError("This EventSetGetContextInfo_v1 instance is read-only") self._ptr[0].nvmlGpuOperationalEventContextType = val @property def source_event_context_type(self): """int: [out] Source-defined context payload type identifier carried by the event.""" return self._ptr[0].sourceEventContextType @source_event_context_type.setter def source_event_context_type(self, val): if self._readonly: raise ValueError("This EventSetGetContextInfo_v1 instance is read-only") self._ptr[0].sourceEventContextType = val @property def data_size(self): """int: [out] Context payload size in bytes, excluding alignment padding.""" return self._ptr[0].dataSize @data_size.setter def data_size(self, val): if self._readonly: raise ValueError("This EventSetGetContextInfo_v1 instance is read-only") self._ptr[0].dataSize = val @property def data_format_version(self): """int: [out] Payload format version for `sourceEventContextType`.""" return self._ptr[0].dataFormatVersion @data_format_version.setter def data_format_version(self, val): if self._readonly: raise ValueError("This EventSetGetContextInfo_v1 instance is read-only") self._ptr[0].dataFormatVersion = val @staticmethod def from_buffer(buffer): """Create an EventSetGetContextInfo_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlEventSetGetContextInfo_v1_t), EventSetGetContextInfo_v1) @staticmethod def from_data(data): """Create an EventSetGetContextInfo_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `event_set_get_context_info_v1_dtype` holding the data. """ return _cyb_from_data(data, "event_set_get_context_info_v1_dtype", event_set_get_context_info_v1_dtype, EventSetGetContextInfo_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an EventSetGetContextInfo_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef EventSetGetContextInfo_v1 obj = EventSetGetContextInfo_v1.__new__(EventSetGetContextInfo_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlEventSetGetContextInfo_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_event_set_get_gpu_operational_event_context_legacy_xid_v1_dtype_offsets(): cdef nvmlEventSetGetGpuOperationalEventContextLegacyXid_v1_t *pod = _cyb_calloc(1, sizeof(nvmlEventSetGetGpuOperationalEventContextLegacyXid_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlEventSetGetGpuOperationalEventContextLegacyXid_v1_t") try: return _numpy.dtype({ 'names': ['index', 'xid_code'], 'formats': [_numpy.uint32, _numpy.uint32], 'offsets': [ (&(pod.index)) - (pod), (&(pod.xidCode)) - (pod), ], 'itemsize': sizeof(nvmlEventSetGetGpuOperationalEventContextLegacyXid_v1_t), }) finally: _cyb_free(pod) event_set_get_gpu_operational_event_context_legacy_xid_v1_dtype = _get_event_set_get_gpu_operational_event_context_legacy_xid_v1_dtype_offsets() cdef class EventSetGetGpuOperationalEventContextLegacyXid_v1: """Empty-initialize an instance of `nvmlEventSetGetGpuOperationalEventContextLegacyXid_v1_t`. .. seealso:: `nvmlEventSetGetGpuOperationalEventContextLegacyXid_v1_t` """ cdef: nvmlEventSetGetGpuOperationalEventContextLegacyXid_v1_t _data nvmlEventSetGetGpuOperationalEventContextLegacyXid_v1_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.EventSetGetGpuOperationalEventContextLegacyXid_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef EventSetGetGpuOperationalEventContextLegacyXid_v1 other_ if not isinstance(other, EventSetGetGpuOperationalEventContextLegacyXid_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlEventSetGetGpuOperationalEventContextLegacyXid_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlEventSetGetGpuOperationalEventContextLegacyXid_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def index(self): """int: [in] Zero-based context index.""" return self._ptr[0].index @index.setter def index(self, val): if self._readonly: raise ValueError("This EventSetGetGpuOperationalEventContextLegacyXid_v1 instance is read-only") self._ptr[0].index = val @property def xid_code(self): """int: [out] Legacy Xid code carried in a GPU Operational Event context.""" return self._ptr[0].xidCode @xid_code.setter def xid_code(self, val): if self._readonly: raise ValueError("This EventSetGetGpuOperationalEventContextLegacyXid_v1 instance is read-only") self._ptr[0].xidCode = val @staticmethod def from_buffer(buffer): """Create an EventSetGetGpuOperationalEventContextLegacyXid_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlEventSetGetGpuOperationalEventContextLegacyXid_v1_t), EventSetGetGpuOperationalEventContextLegacyXid_v1) @staticmethod def from_data(data): """Create an EventSetGetGpuOperationalEventContextLegacyXid_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `event_set_get_gpu_operational_event_context_legacy_xid_v1_dtype` holding the data. """ return _cyb_from_data(data, "event_set_get_gpu_operational_event_context_legacy_xid_v1_dtype", event_set_get_gpu_operational_event_context_legacy_xid_v1_dtype, EventSetGetGpuOperationalEventContextLegacyXid_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an EventSetGetGpuOperationalEventContextLegacyXid_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef EventSetGetGpuOperationalEventContextLegacyXid_v1 obj = EventSetGetGpuOperationalEventContextLegacyXid_v1.__new__(EventSetGetGpuOperationalEventContextLegacyXid_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlEventSetGetGpuOperationalEventContextLegacyXid_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_gpu_fabric_clique_v1_dtype_offsets(): cdef nvmlGpuFabricClique_v1_t *pod = _cyb_calloc(1, sizeof(nvmlGpuFabricClique_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlGpuFabricClique_v1_t") try: return _numpy.dtype({ 'names': ['type', 'id'], 'formats': [_numpy.uint8, _numpy.uint32], 'offsets': [ (&(pod.type)) - (pod), (&(pod.id)) - (pod), ], 'itemsize': sizeof(nvmlGpuFabricClique_v1_t), }) finally: _cyb_free(pod) gpu_fabric_clique_v1_dtype = _get_gpu_fabric_clique_v1_dtype_offsets() cdef class GpuFabricClique_v1: """Empty-initialize an instance of `nvmlGpuFabricClique_v1_t`. .. seealso:: `nvmlGpuFabricClique_v1_t` """ cdef: nvmlGpuFabricClique_v1_t *_ptr object _owner 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._readonly = False def __dealloc__(self): cdef nvmlGpuFabricClique_v1_t *ptr if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) def __repr__(self): return f"<{__name__}.GpuFabricClique_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef GpuFabricClique_v1 other_ if not isinstance(other, GpuFabricClique_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlGpuFabricClique_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlGpuFabricClique_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def type(self): """int: Clique type. See NVML_GPU_FABRIC_CLIQUE_TYPE_*.""" return self._ptr[0].type @type.setter def type(self, val): if self._readonly: raise ValueError("This GpuFabricClique_v1 instance is read-only") self._ptr[0].type = val @property def id(self): """int: Clique ID assigned by the Fabric Manager.""" return self._ptr[0].id @id.setter def id(self, val): if self._readonly: raise ValueError("This GpuFabricClique_v1 instance is read-only") self._ptr[0].id = val @staticmethod def from_buffer(buffer): """Create an GpuFabricClique_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlGpuFabricClique_v1_t), GpuFabricClique_v1) @staticmethod def from_data(data): """Create an GpuFabricClique_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `gpu_fabric_clique_v1_dtype` holding the data. """ return _cyb_from_data(data, "gpu_fabric_clique_v1_dtype", gpu_fabric_clique_v1_dtype, GpuFabricClique_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an GpuFabricClique_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef GpuFabricClique_v1 obj = GpuFabricClique_v1.__new__(GpuFabricClique_v1) if owner is None: obj._ptr = _cyb_malloc(sizeof(nvmlGpuFabricClique_v1_t)) 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 else: obj._ptr = ptr obj._owns_ptr = False obj._owner = owner obj._readonly = readonly return obj cdef _get_gpu_operational_event_config_v1_dtype_offsets(): cdef nvmlGpuOperationalEventConfig_v1_t *pod = _cyb_calloc(1, sizeof(nvmlGpuOperationalEventConfig_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlGpuOperationalEventConfig_v1_t") try: return _numpy.dtype({ 'names': ['uuid', 'min_log_level', 'min_severity'], 'formats': [(_numpy.int8, 96), _numpy.uint32, _numpy.uint32], 'offsets': [ (&(pod.uuid)) - (pod), (&(pod.minLogLevel)) - (pod), (&(pod.minSeverity)) - (pod), ], 'itemsize': sizeof(nvmlGpuOperationalEventConfig_v1_t), }) finally: _cyb_free(pod) gpu_operational_event_config_v1_dtype = _get_gpu_operational_event_config_v1_dtype_offsets() cdef class GpuOperationalEventConfig_v1: """Empty-initialize an instance of `nvmlGpuOperationalEventConfig_v1_t`. .. seealso:: `nvmlGpuOperationalEventConfig_v1_t` """ cdef: nvmlGpuOperationalEventConfig_v1_t _data nvmlGpuOperationalEventConfig_v1_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.GpuOperationalEventConfig_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef GpuOperationalEventConfig_v1 other_ if not isinstance(other, GpuOperationalEventConfig_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlGpuOperationalEventConfig_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlGpuOperationalEventConfig_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def uuid(self): """~_numpy.int8: (array of length 96).""" return _cyb_cpython.PyUnicode_FromString(self._ptr[0].uuid) @uuid.setter def uuid(self, val): if self._readonly: raise ValueError("This GpuOperationalEventConfig_v1 instance is read-only") cdef bytes buf = val.encode() if len(buf) >= 96: raise ValueError("String too long for field uuid, max length is 95") cdef char *ptr = buf _cyb_memcpy((self._ptr[0].uuid), ptr, 96) @property def min_log_level(self): """int: """ return self._ptr[0].minLogLevel @min_log_level.setter def min_log_level(self, val): if self._readonly: raise ValueError("This GpuOperationalEventConfig_v1 instance is read-only") self._ptr[0].minLogLevel = val @property def min_severity(self): """int: """ return self._ptr[0].minSeverity @min_severity.setter def min_severity(self, val): if self._readonly: raise ValueError("This GpuOperationalEventConfig_v1 instance is read-only") self._ptr[0].minSeverity = val @staticmethod def from_buffer(buffer): """Create an GpuOperationalEventConfig_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlGpuOperationalEventConfig_v1_t), GpuOperationalEventConfig_v1) @staticmethod def from_data(data): """Create an GpuOperationalEventConfig_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `gpu_operational_event_config_v1_dtype` holding the data. """ return _cyb_from_data(data, "gpu_operational_event_config_v1_dtype", gpu_operational_event_config_v1_dtype, GpuOperationalEventConfig_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an GpuOperationalEventConfig_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef GpuOperationalEventConfig_v1 obj = GpuOperationalEventConfig_v1.__new__(GpuOperationalEventConfig_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlGpuOperationalEventConfig_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_event_set_wait_v3_dtype_offsets(): cdef nvmlEventSetWait_v3_t *pod = _cyb_calloc(1, sizeof(nvmlEventSetWait_v3_t)) if pod == NULL: raise MemoryError("Error allocating nvmlEventSetWait_v3_t") try: return _numpy.dtype({ 'names': ['timeout_ms', 'data_type', 'uuid', 'source_module', 'event_type', 'event_data', 'group_cursor', 'instance_id', 'timestamp_usec', 'trace_id', 'gpu_instance_id', 'compute_instance_id', 'severity', 'category_id', 'module_event_code', 'scope', 'originator', 'module_instance', 'chiplet_id', 'log_level', 'attributes', 'group_cper_size', 'group_attributes', 'group_size', 'group_index'], 'formats': [_numpy.uint32, _numpy.uint32, (_numpy.int8, 96), (_numpy.int8, 16), _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint64, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint8, _numpy.uint8], 'offsets': [ (&(pod.timeoutMs)) - (pod), (&(pod.dataType)) - (pod), (&(pod.uuid)) - (pod), (&(pod.sourceModule)) - (pod), (&(pod.eventType)) - (pod), (&(pod.eventData)) - (pod), (&(pod.groupCursor)) - (pod), (&(pod.instanceId)) - (pod), (&(pod.timestampUsec)) - (pod), (&(pod.traceId)) - (pod), (&(pod.gpuInstanceId)) - (pod), (&(pod.computeInstanceId)) - (pod), (&(pod.severity)) - (pod), (&(pod.categoryId)) - (pod), (&(pod.moduleEventCode)) - (pod), (&(pod.scope)) - (pod), (&(pod.originator)) - (pod), (&(pod.moduleInstance)) - (pod), (&(pod.chipletId)) - (pod), (&(pod.logLevel)) - (pod), (&(pod.attributes)) - (pod), (&(pod.groupCperSize)) - (pod), (&(pod.groupAttributes)) - (pod), (&(pod.groupSize)) - (pod), (&(pod.groupIndex)) - (pod), ], 'itemsize': sizeof(nvmlEventSetWait_v3_t), }) finally: _cyb_free(pod) event_set_wait_v3_dtype = _get_event_set_wait_v3_dtype_offsets() cdef class EventSetWait_v3: """Empty-initialize an instance of `nvmlEventSetWait_v3_t`. .. seealso:: `nvmlEventSetWait_v3_t` """ cdef: nvmlEventSetWait_v3_t _data nvmlEventSetWait_v3_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.EventSetWait_v3 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef EventSetWait_v3 other_ if not isinstance(other, EventSetWait_v3): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlEventSetWait_v3_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlEventSetWait_v3_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def timeout_ms(self): """int: [in] Maximum amount of time to wait, in milliseconds.""" return self._ptr[0].timeoutMs @timeout_ms.setter def timeout_ms(self, val): if self._readonly: raise ValueError("This EventSetWait_v3 instance is read-only") self._ptr[0].timeoutMs = val @property def data_type(self): """int: [out] `nvmlEventDataType_t` value indicating which event-data format is populated.""" return self._ptr[0].dataType @data_type.setter def data_type(self, val): if self._readonly: raise ValueError("This EventSetWait_v3 instance is read-only") self._ptr[0].dataType = val @property def uuid(self): """~_numpy.int8: (array of length 96).[out] UUID for the GPU where the event occurred. Empty if unavailable.""" return _cyb_cpython.PyUnicode_FromString(self._ptr[0].uuid) @uuid.setter def uuid(self, val): if self._readonly: raise ValueError("This EventSetWait_v3 instance is read-only") cdef bytes buf = val.encode() if len(buf) >= 96: raise ValueError("String too long for field uuid, max length is 95") cdef char *ptr = buf _cyb_memcpy((self._ptr[0].uuid), ptr, 96) @property def source_module(self): """~_numpy.int8: (array of length 16).[out] Source module signature for structured events. Not guaranteed to be NULL-terminated. Empty for NVML event-bit events.""" return _cyb_cpython.PyUnicode_FromString(self._ptr[0].sourceModule) @source_module.setter def source_module(self, val): if self._readonly: raise ValueError("This EventSetWait_v3 instance is read-only") cdef bytes buf = val.encode() if len(buf) >= 16: raise ValueError("String too long for field source_module, max length is 15") cdef char *ptr = buf _cyb_memcpy((self._ptr[0].sourceModule), ptr, 16) @property def event_type(self): """int: [out] NVML event bit for `NVML_EVENT_DATA_TYPE_NVML_EVENT` events; `nvmlEventTypeNone` for structured events.""" return self._ptr[0].eventType @event_type.setter def event_type(self, val): if self._readonly: raise ValueError("This EventSetWait_v3 instance is read-only") self._ptr[0].eventType = val @property def event_data(self): """int: [out] Xid code for `nvmlEventTypeXidCriticalError`, or 0 when not applicable.""" return self._ptr[0].eventData @event_data.setter def event_data(self, val): if self._readonly: raise ValueError("This EventSetWait_v3 instance is read-only") self._ptr[0].eventData = val @property def group_cursor(self): """int: [out] Structured event group identifier. 0 for NVML event-bit events.""" return self._ptr[0].groupCursor @group_cursor.setter def group_cursor(self, val): if self._readonly: raise ValueError("This EventSetWait_v3 instance is read-only") self._ptr[0].groupCursor = val @property def instance_id(self): """int: [out] Structured event sequence identifier. 0 for NVML event-bit events.""" return self._ptr[0].instanceId @instance_id.setter def instance_id(self, val): if self._readonly: raise ValueError("This EventSetWait_v3 instance is read-only") self._ptr[0].instanceId = val @property def timestamp_usec(self): """int: [out] Event timestamp in microseconds. 0 if unavailable.""" return self._ptr[0].timestampUsec @timestamp_usec.setter def timestamp_usec(self, val): if self._readonly: raise ValueError("This EventSetWait_v3 instance is read-only") self._ptr[0].timestampUsec = val @property def trace_id(self): """int: [out] Structured event trace identifier. 0 for NVML event-bit events.""" return self._ptr[0].traceId @trace_id.setter def trace_id(self, val): if self._readonly: raise ValueError("This EventSetWait_v3 instance is read-only") self._ptr[0].traceId = val @property def gpu_instance_id(self): """int: [out] MIG GPU instance ID for NVML event-bit data, or `NVML_GPU_INSTANCE_ID_ANY` when not applicable.""" return self._ptr[0].gpuInstanceId @gpu_instance_id.setter def gpu_instance_id(self, val): if self._readonly: raise ValueError("This EventSetWait_v3 instance is read-only") self._ptr[0].gpuInstanceId = val @property def compute_instance_id(self): """int: [out] MIG compute instance ID for NVML event-bit data, or `NVML_COMPUTE_INSTANCE_ID_ANY` when not applicable.""" return self._ptr[0].computeInstanceId @compute_instance_id.setter def compute_instance_id(self, val): if self._readonly: raise ValueError("This EventSetWait_v3 instance is read-only") self._ptr[0].computeInstanceId = val @property def severity(self): """int: [out] `nvmlOperationalEventSeverity_t` value for structured events. May contain newer severity values not named in this header. `NVML_OPERATIONAL_EVENT_SEVERITY_ALL` for NVML event-bit events.""" return self._ptr[0].severity @severity.setter def severity(self, val): if self._readonly: raise ValueError("This EventSetWait_v3 instance is read-only") self._ptr[0].severity = val @property def category_id(self): """int: [out] Source-defined structured event category identifier. 0 for NVML event-bit events.""" return self._ptr[0].categoryId @category_id.setter def category_id(self, val): if self._readonly: raise ValueError("This EventSetWait_v3 instance is read-only") self._ptr[0].categoryId = val @property def module_event_code(self): """int: [out] Source-module-defined event code. Interpret with `sourceModule`. 0 for NVML event-bit events.""" return self._ptr[0].moduleEventCode @module_event_code.setter def module_event_code(self, val): if self._readonly: raise ValueError("This EventSetWait_v3 instance is read-only") self._ptr[0].moduleEventCode = val @property def scope(self): """int: [out] Structured event scope identifier. 0 for NVML event-bit events.""" return self._ptr[0].scope @scope.setter def scope(self, val): if self._readonly: raise ValueError("This EventSetWait_v3 instance is read-only") self._ptr[0].scope = val @property def originator(self): """int: [out] Structured event originator identifier. 0 for NVML event-bit events.""" return self._ptr[0].originator @originator.setter def originator(self, val): if self._readonly: raise ValueError("This EventSetWait_v3 instance is read-only") self._ptr[0].originator = val @property def module_instance(self): """int: [out] Structured event module instance identifier. 0 for NVML event-bit events.""" return self._ptr[0].moduleInstance @module_instance.setter def module_instance(self, val): if self._readonly: raise ValueError("This EventSetWait_v3 instance is read-only") self._ptr[0].moduleInstance = val @property def chiplet_id(self): """int: [out] Structured event chiplet identifier. 0 for NVML event-bit events.""" return self._ptr[0].chipletId @chiplet_id.setter def chiplet_id(self, val): if self._readonly: raise ValueError("This EventSetWait_v3 instance is read-only") self._ptr[0].chipletId = val @property def log_level(self): """int: [out] `nvmlGpuOperationalEventLogLevel_t` value for structured GPU Operational Events. May contain newer log-level values not named in this header. `NVML_GPU_OPERATIONAL_EVENT_LOG_LEVEL_ALL` for NVML event-bit events.""" return self._ptr[0].logLevel @log_level.setter def log_level(self, val): if self._readonly: raise ValueError("This EventSetWait_v3 instance is read-only") self._ptr[0].logLevel = val @property def attributes(self): """int: [out] Bitmask of `NVML_OPERATIONAL_EVENT_ATTR_*` values for structured events. May contain newer bits not named in this header. 0 for NVML event-bit events.""" return self._ptr[0].attributes @attributes.setter def attributes(self, val): if self._readonly: raise ValueError("This EventSetWait_v3 instance is read-only") self._ptr[0].attributes = val @property def group_cper_size(self): """int: [out] Associated CPER record size in bytes. 0 when unavailable.""" return self._ptr[0].groupCperSize @group_cper_size.setter def group_cper_size(self, val): if self._readonly: raise ValueError("This EventSetWait_v3 instance is read-only") self._ptr[0].groupCperSize = val @property def group_attributes(self): """int: [out] Bitmask of `NVML_OPERATIONAL_EVENT_GROUP_ATTR_*` values for structured events. May contain newer bits not named in this header. 0 for NVML event-bit events.""" return self._ptr[0].groupAttributes @group_attributes.setter def group_attributes(self, val): if self._readonly: raise ValueError("This EventSetWait_v3 instance is read-only") self._ptr[0].groupAttributes = val @property def group_size(self): """int: [out] Total number of events in the structured event group. 0 for NVML event-bit events.""" return self._ptr[0].groupSize @group_size.setter def group_size(self, val): if self._readonly: raise ValueError("This EventSetWait_v3 instance is read-only") self._ptr[0].groupSize = val @property def group_index(self): """int: [out] Zero-based index within the structured event group. 0 for NVML event-bit events.""" return self._ptr[0].groupIndex @group_index.setter def group_index(self, val): if self._readonly: raise ValueError("This EventSetWait_v3 instance is read-only") self._ptr[0].groupIndex = val @staticmethod def from_buffer(buffer): """Create an EventSetWait_v3 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlEventSetWait_v3_t), EventSetWait_v3) @staticmethod def from_data(data): """Create an EventSetWait_v3 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `event_set_wait_v3_dtype` holding the data. """ return _cyb_from_data(data, "event_set_wait_v3_dtype", event_set_wait_v3_dtype, EventSetWait_v3) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an EventSetWait_v3 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef EventSetWait_v3 obj = EventSetWait_v3.__new__(EventSetWait_v3) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlEventSetWait_v3_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_nvlink_set_bw_mode_async_v1_dtype_offsets(): cdef nvmlNvlinkSetBwModeAsync_v1_t *pod = _cyb_calloc(1, sizeof(nvmlNvlinkSetBwModeAsync_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlNvlinkSetBwModeAsync_v1_t") try: return _numpy.dtype({ 'names': ['b_set_best', 'bw_mode', 'async_poll_timeout_ms'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32], 'offsets': [ (&(pod.bSetBest)) - (pod), (&(pod.bwMode)) - (pod), (&(pod.asyncPollTimeoutMs)) - (pod), ], 'itemsize': sizeof(nvmlNvlinkSetBwModeAsync_v1_t), }) finally: _cyb_free(pod) nvlink_set_bw_mode_async_v1_dtype = _get_nvlink_set_bw_mode_async_v1_dtype_offsets() cdef class NvlinkSetBwModeAsync_v1: """Empty-initialize an instance of `nvmlNvlinkSetBwModeAsync_v1_t`. .. seealso:: `nvmlNvlinkSetBwModeAsync_v1_t` """ cdef: nvmlNvlinkSetBwModeAsync_v1_t _data nvmlNvlinkSetBwModeAsync_v1_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.NvlinkSetBwModeAsync_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef NvlinkSetBwModeAsync_v1 other_ if not isinstance(other, NvlinkSetBwModeAsync_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlNvlinkSetBwModeAsync_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlNvlinkSetBwModeAsync_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def b_set_best(self): """int: [in] - Set to the best available Bandwidth mode""" return self._ptr[0].bSetBest @b_set_best.setter def b_set_best(self, val): if self._readonly: raise ValueError("This NvlinkSetBwModeAsync_v1 instance is read-only") self._ptr[0].bSetBest = val @property def bw_mode(self): """int: [in] - Requested Bandwidth mode to set. Values can be found from `nvmlDeviceGetNvlinkSupportedBwModes()`""" return self._ptr[0].bwMode @bw_mode.setter def bw_mode(self, val): if self._readonly: raise ValueError("This NvlinkSetBwModeAsync_v1 instance is read-only") self._ptr[0].bwMode = val @property def async_poll_timeout_ms(self): """int: [out] - Time in ms to poll to validate bandwidth setting.""" return self._ptr[0].asyncPollTimeoutMs @async_poll_timeout_ms.setter def async_poll_timeout_ms(self, val): if self._readonly: raise ValueError("This NvlinkSetBwModeAsync_v1 instance is read-only") self._ptr[0].asyncPollTimeoutMs = val @staticmethod def from_buffer(buffer): """Create an NvlinkSetBwModeAsync_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlNvlinkSetBwModeAsync_v1_t), NvlinkSetBwModeAsync_v1) @staticmethod def from_data(data): """Create an NvlinkSetBwModeAsync_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `nvlink_set_bw_mode_async_v1_dtype` holding the data. """ return _cyb_from_data(data, "nvlink_set_bw_mode_async_v1_dtype", nvlink_set_bw_mode_async_v1_dtype, NvlinkSetBwModeAsync_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an NvlinkSetBwModeAsync_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef NvlinkSetBwModeAsync_v1 obj = NvlinkSetBwModeAsync_v1.__new__(NvlinkSetBwModeAsync_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlNvlinkSetBwModeAsync_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_nvlink_telemetry_sample_v1_dtype_offsets(): cdef nvmlNvlinkTelemetrySample_v1_t *pod = _cyb_calloc(1, sizeof(nvmlNvlinkTelemetrySample_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlNvlinkTelemetrySample_v1_t") try: return _numpy.dtype({ 'names': ['link_id', 'sample_type', 'sample_count', 'samples', 'nvml_return'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.intp, _numpy.int32], 'offsets': [ (&(pod.linkId)) - (pod), (&(pod.sampleType)) - (pod), (&(pod.sampleCount)) - (pod), (&(pod.samples)) - (pod), (&(pod.nvmlReturn)) - (pod), ], 'itemsize': sizeof(nvmlNvlinkTelemetrySample_v1_t), }) finally: _cyb_free(pod) nvlink_telemetry_sample_v1_dtype = _get_nvlink_telemetry_sample_v1_dtype_offsets() cdef object nvlink_telemetry_sample_v1_dtype_record = _numpy.dtype((_numpy.record, nvlink_telemetry_sample_v1_dtype)) cdef class NvlinkTelemetrySample_v1: """Empty-initialize an array of `nvmlNvlinkTelemetrySample_v1_t`. The resulting object is of length `size` and of dtype `nvlink_telemetry_sample_v1_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `nvmlNvlinkTelemetrySample_v1_t` """ cdef: readonly object _data object _owner def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=nvlink_telemetry_sample_v1_dtype_record) assert self._data.itemsize == sizeof(nvmlNvlinkTelemetrySample_v1_t), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlNvlinkTelemetrySample_v1_t) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}.NvlinkTelemetrySample_v1_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}.NvlinkTelemetrySample_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, NvlinkTelemetrySample_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 link_id(self): """Union[~_numpy.uint32, int]: [in] LinkId""" if self._data.size == 1: return int(self._data["link_id"][0]) return self._data["link_id"] @link_id.setter def link_id(self, val): if not self._data.flags.writeable: raise ValueError("This NvlinkTelemetrySample_v1 instance is read-only") self._data["link_id"] = val @property def sample_type(self): """Union[~_numpy.uint32, int]: [in] Type of telemetry to sample, specified by `nvmlNvlinkTelemetrySampleType_t`""" if self._data.size == 1: return int(self._data["sample_type"][0]) return self._data["sample_type"] @sample_type.setter def sample_type(self, val): if not self._data.flags.writeable: raise ValueError("This NvlinkTelemetrySample_v1 instance is read-only") self._data["sample_type"] = val @property def sample_count(self): """Union[~_numpy.uint32, int]: [in,out]: Number of samples users need to allocate. If set to 0, will return max supported count of samples without touching the ``samples`` pointer.""" if self._data.size == 1: return int(self._data["sample_count"][0]) return self._data["sample_count"] @sample_count.setter def sample_count(self, val): if not self._data.flags.writeable: raise ValueError("This NvlinkTelemetrySample_v1 instance is read-only") self._data["sample_count"] = val @property def samples(self): """Union[~_numpy.intp, int]: [in,out]: Array of samples allocated by the user. Can be set to NULL when getting count""" if self._data.size == 1: return int(self._data["samples"][0]) return self._data["samples"] @samples.setter def samples(self, val): if not self._data.flags.writeable: raise ValueError("This NvlinkTelemetrySample_v1 instance is read-only") self._data["samples"] = val @property def nvml_return(self): """Union[~_numpy.int32, int]: [out]: Return code for retrieving this sample. This must be checked by the client before looking at any output values, as they are invalid if ``nvmlReturn != NVML_SUCCESS``.""" if self._data.size == 1: return int(self._data["nvml_return"][0]) return self._data["nvml_return"] @nvml_return.setter def nvml_return(self, val): if not self._data.flags.writeable: raise ValueError("This NvlinkTelemetrySample_v1 instance is read-only") self._data["nvml_return"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef NvlinkTelemetrySample_v1 obj 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 obj = NvlinkTelemetrySample_v1.__new__(NvlinkTelemetrySample_v1) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == nvlink_telemetry_sample_v1_dtype: obj = NvlinkTelemetrySample_v1.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an NvlinkTelemetrySample_v1 instance with the memory from the given buffer.""" return NvlinkTelemetrySample_v1.from_data(_numpy.frombuffer(buffer, dtype=nvlink_telemetry_sample_v1_dtype)) @staticmethod def from_data(data): """Create an NvlinkTelemetrySample_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `nvlink_telemetry_sample_v1_dtype` holding the data. """ cdef NvlinkTelemetrySample_v1 obj = NvlinkTelemetrySample_v1.__new__(NvlinkTelemetrySample_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 != nvlink_telemetry_sample_v1_dtype: raise ValueError("data array must be of dtype nvlink_telemetry_sample_v1_dtype") obj._data = data.view(dtype=nvlink_telemetry_sample_v1_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an NvlinkTelemetrySample_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 NvlinkTelemetrySample_v1 obj = NvlinkTelemetrySample_v1.__new__(NvlinkTelemetrySample_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(nvmlNvlinkTelemetrySample_v1_t) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=nvlink_telemetry_sample_v1_dtype_record) obj._owner = owner return obj cdef _get_ecc_bank_remapper_histogram_v1_dtype_offsets(): cdef nvmlEccBankRemapperHistogram_v1_t *pod = _cyb_calloc(1, sizeof(nvmlEccBankRemapperHistogram_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlEccBankRemapperHistogram_v1_t") try: return _numpy.dtype({ 'names': ['max_spare_group_count', 'no_spare_group_count'], 'formats': [_numpy.uint32, _numpy.uint32], 'offsets': [ (&(pod.maxSpareGroupCount)) - (pod), (&(pod.noSpareGroupCount)) - (pod), ], 'itemsize': sizeof(nvmlEccBankRemapperHistogram_v1_t), }) finally: _cyb_free(pod) ecc_bank_remapper_histogram_v1_dtype = _get_ecc_bank_remapper_histogram_v1_dtype_offsets() cdef class EccBankRemapperHistogram_v1: """Empty-initialize an instance of `nvmlEccBankRemapperHistogram_v1_t`. .. seealso:: `nvmlEccBankRemapperHistogram_v1_t` """ cdef: nvmlEccBankRemapperHistogram_v1_t *_ptr object _owner 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._readonly = False def __dealloc__(self): cdef nvmlEccBankRemapperHistogram_v1_t *ptr if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) def __repr__(self): return f"<{__name__}.EccBankRemapperHistogram_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef EccBankRemapperHistogram_v1 other_ if not isinstance(other, EccBankRemapperHistogram_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlEccBankRemapperHistogram_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlEccBankRemapperHistogram_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def max_spare_group_count(self): """int: Number of groups that have maximum spare.""" return self._ptr[0].maxSpareGroupCount @max_spare_group_count.setter def max_spare_group_count(self, val): if self._readonly: raise ValueError("This EccBankRemapperHistogram_v1 instance is read-only") self._ptr[0].maxSpareGroupCount = val @property def no_spare_group_count(self): """int: Number of groups that have not spare.""" return self._ptr[0].noSpareGroupCount @no_spare_group_count.setter def no_spare_group_count(self, val): if self._readonly: raise ValueError("This EccBankRemapperHistogram_v1 instance is read-only") self._ptr[0].noSpareGroupCount = val @staticmethod def from_buffer(buffer): """Create an EccBankRemapperHistogram_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlEccBankRemapperHistogram_v1_t), EccBankRemapperHistogram_v1) @staticmethod def from_data(data): """Create an EccBankRemapperHistogram_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `ecc_bank_remapper_histogram_v1_dtype` holding the data. """ return _cyb_from_data(data, "ecc_bank_remapper_histogram_v1_dtype", ecc_bank_remapper_histogram_v1_dtype, EccBankRemapperHistogram_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an EccBankRemapperHistogram_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef EccBankRemapperHistogram_v1 obj = EccBankRemapperHistogram_v1.__new__(EccBankRemapperHistogram_v1) if owner is None: obj._ptr = _cyb_malloc(sizeof(nvmlEccBankRemapperHistogram_v1_t)) 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 else: obj._ptr = ptr obj._owns_ptr = False obj._owner = owner obj._readonly = readonly return obj cdef _get_gpu_uptime_v1_dtype_offsets(): cdef nvmlGpuUptime_v1_t *pod = _cyb_calloc(1, sizeof(nvmlGpuUptime_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlGpuUptime_v1_t") try: return _numpy.dtype({ 'names': ['uptime'], 'formats': [_numpy.uint32], 'offsets': [ (&(pod.uptime)) - (pod), ], 'itemsize': sizeof(nvmlGpuUptime_v1_t), }) finally: _cyb_free(pod) gpu_uptime_v1_dtype = _get_gpu_uptime_v1_dtype_offsets() cdef class GpuUptime_v1: """Empty-initialize an instance of `nvmlGpuUptime_v1_t`. .. seealso:: `nvmlGpuUptime_v1_t` """ cdef: nvmlGpuUptime_v1_t _data nvmlGpuUptime_v1_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.GpuUptime_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef GpuUptime_v1 other_ if not isinstance(other, GpuUptime_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlGpuUptime_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlGpuUptime_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): cdef _cyb_Py_buffer view if key == 0: if self._readonly: raise ValueError("This GpuUptime_v1 instance is read-only") _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) try: if view.len < sizeof(nvmlGpuUptime_v1_t): raise ValueError( "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlGpuUptime_v1_t), view.len) ) _cyb_memmove(&self._data, view.buf, sizeof(nvmlGpuUptime_v1_t)) self._ptr = &self._data self._owner = None self._readonly = view.readonly != 0 finally: _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @property def uptime(self): """int: [out] Number of seconds the GPU has been up since it was initialized by the driver""" return self._ptr[0].uptime @uptime.setter def uptime(self, val): if self._readonly: raise ValueError("This GpuUptime_v1 instance is read-only") self._ptr[0].uptime = val @staticmethod def from_buffer(buffer): """Create an GpuUptime_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlGpuUptime_v1_t), GpuUptime_v1) @staticmethod def from_data(data): """Create an GpuUptime_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `gpu_uptime_v1_dtype` holding the data. """ return _cyb_from_data(data, "gpu_uptime_v1_dtype", gpu_uptime_v1_dtype, GpuUptime_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an GpuUptime_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef GpuUptime_v1 obj = GpuUptime_v1.__new__(GpuUptime_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlGpuUptime_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_system_conf_compute_settings_v2_dtype_offsets(): cdef nvmlSystemConfComputeSettings_v2_t *pod = _cyb_calloc(1, sizeof(nvmlSystemConfComputeSettings_v2_t)) if pod == NULL: raise MemoryError("Error allocating nvmlSystemConfComputeSettings_v2_t") try: return _numpy.dtype({ 'names': ['version', 'environment', 'cc_feature', 'dev_tools_mode', 'multi_gpu_mode', 'tdisp_state'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32], 'offsets': [ (&(pod.version)) - (pod), (&(pod.environment)) - (pod), (&(pod.ccFeature)) - (pod), (&(pod.devToolsMode)) - (pod), (&(pod.multiGpuMode)) - (pod), (&(pod.tdispState)) - (pod), ], 'itemsize': sizeof(nvmlSystemConfComputeSettings_v2_t), }) finally: _cyb_free(pod) system_conf_compute_settings_v2_dtype = _get_system_conf_compute_settings_v2_dtype_offsets() cdef class SystemConfComputeSettings_v2: """Empty-initialize an instance of `nvmlSystemConfComputeSettings_v2_t`. .. seealso:: `nvmlSystemConfComputeSettings_v2_t` """ cdef: nvmlSystemConfComputeSettings_v2_t _data nvmlSystemConfComputeSettings_v2_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.SystemConfComputeSettings_v2 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef SystemConfComputeSettings_v2 other_ if not isinstance(other, SystemConfComputeSettings_v2): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlSystemConfComputeSettings_v2_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlSystemConfComputeSettings_v2_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): cdef _cyb_Py_buffer view if key == 0: if self._readonly: raise ValueError("This SystemConfComputeSettings_v2 instance is read-only") _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) try: if view.len < sizeof(nvmlSystemConfComputeSettings_v2_t): raise ValueError( "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlSystemConfComputeSettings_v2_t), view.len) ) _cyb_memmove(&self._data, view.buf, sizeof(nvmlSystemConfComputeSettings_v2_t)) self._ptr = &self._data self._owner = None self._readonly = view.readonly != 0 finally: _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @property def version(self): """int: """ return self._ptr[0].version @version.setter def version(self, val): if self._readonly: raise ValueError("This SystemConfComputeSettings_v2 instance is read-only") self._ptr[0].version = val @property def environment(self): """int: """ return self._ptr[0].environment @environment.setter def environment(self, val): if self._readonly: raise ValueError("This SystemConfComputeSettings_v2 instance is read-only") self._ptr[0].environment = val @property def cc_feature(self): """int: """ return self._ptr[0].ccFeature @cc_feature.setter def cc_feature(self, val): if self._readonly: raise ValueError("This SystemConfComputeSettings_v2 instance is read-only") self._ptr[0].ccFeature = val @property def dev_tools_mode(self): """int: """ return self._ptr[0].devToolsMode @dev_tools_mode.setter def dev_tools_mode(self, val): if self._readonly: raise ValueError("This SystemConfComputeSettings_v2 instance is read-only") self._ptr[0].devToolsMode = val @property def multi_gpu_mode(self): """int: """ return self._ptr[0].multiGpuMode @multi_gpu_mode.setter def multi_gpu_mode(self, val): if self._readonly: raise ValueError("This SystemConfComputeSettings_v2 instance is read-only") self._ptr[0].multiGpuMode = val @property def tdisp_state(self): """int: """ return self._ptr[0].tdispState @tdisp_state.setter def tdisp_state(self, val): if self._readonly: raise ValueError("This SystemConfComputeSettings_v2 instance is read-only") self._ptr[0].tdispState = val @staticmethod def from_buffer(buffer): """Create an SystemConfComputeSettings_v2 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlSystemConfComputeSettings_v2_t), SystemConfComputeSettings_v2) @staticmethod def from_data(data): """Create an SystemConfComputeSettings_v2 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `system_conf_compute_settings_v2_dtype` holding the data. """ return _cyb_from_data(data, "system_conf_compute_settings_v2_dtype", system_conf_compute_settings_v2_dtype, SystemConfComputeSettings_v2) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an SystemConfComputeSettings_v2 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef SystemConfComputeSettings_v2 obj = SystemConfComputeSettings_v2.__new__(SystemConfComputeSettings_v2) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlSystemConfComputeSettings_v2_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_nvlink_get_remap_table_info_v1_dtype_offsets(): cdef nvmlNvlinkGetRemapTableInfo_v1_t *pod = _cyb_calloc(1, sizeof(nvmlNvlinkGetRemapTableInfo_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlNvlinkGetRemapTableInfo_v1_t") try: return _numpy.dtype({ 'names': ['alid', 'fla_remap_tab_addr', 'gpa_remap_tab_addr', 'remap_tab_size'], 'formats': [_numpy.uint32, (_numpy.uint32, 4096), (_numpy.uint32, 4096), _numpy.uint32], 'offsets': [ (&(pod.alid)) - (pod), (&(pod.flaRemapTabAddr)) - (pod), (&(pod.gpaRemapTabAddr)) - (pod), (&(pod.remapTabSize)) - (pod), ], 'itemsize': sizeof(nvmlNvlinkGetRemapTableInfo_v1_t), }) finally: _cyb_free(pod) nvlink_get_remap_table_info_v1_dtype = _get_nvlink_get_remap_table_info_v1_dtype_offsets() cdef class NvlinkGetRemapTableInfo_v1: """Empty-initialize an instance of `nvmlNvlinkGetRemapTableInfo_v1_t`. .. seealso:: `nvmlNvlinkGetRemapTableInfo_v1_t` """ cdef: nvmlNvlinkGetRemapTableInfo_v1_t _data nvmlNvlinkGetRemapTableInfo_v1_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.NvlinkGetRemapTableInfo_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef NvlinkGetRemapTableInfo_v1 other_ if not isinstance(other, NvlinkGetRemapTableInfo_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlNvlinkGetRemapTableInfo_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlNvlinkGetRemapTableInfo_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): cdef _cyb_Py_buffer view if key == 0: if self._readonly: raise ValueError("This NvlinkGetRemapTableInfo_v1 instance is read-only") _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) try: if view.len < sizeof(nvmlNvlinkGetRemapTableInfo_v1_t): raise ValueError( "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlNvlinkGetRemapTableInfo_v1_t), view.len) ) _cyb_memmove(&self._data, view.buf, sizeof(nvmlNvlinkGetRemapTableInfo_v1_t)) self._ptr = &self._data self._owner = None self._readonly = view.readonly != 0 finally: _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @property def alid(self): """int: ALID of the GPU.""" return self._ptr[0].alid @alid.setter def alid(self, val): if self._readonly: raise ValueError("This NvlinkGetRemapTableInfo_v1 instance is read-only") self._ptr[0].alid = val @property def fla_remap_tab_addr(self): """~_numpy.uint32: (array of length 4096).FLA remap table addrs for all the remap table entries.""" if self._ptr[0].remapTabSize == 0: return _numpy.array([]) cdef _cyb_view.array arr = _cyb_view.array(shape=(self._ptr[0].remapTabSize,), itemsize=sizeof(unsigned int), format="I", mode="c", allocate_buffer=False) arr.data = (&(self._ptr[0].flaRemapTabAddr)) return _numpy.asarray(arr) @fla_remap_tab_addr.setter def fla_remap_tab_addr(self, val): if self._readonly: raise ValueError("This NvlinkGetRemapTableInfo_v1 instance is read-only") if len(val) > 4096: raise ValueError(f"Too many elements for field fla_remap_tab_addr, max is 4096, got {len(val)}") self._ptr[0].remapTabSize = len(val) if len(val) == 0: return cdef _cyb_view.array arr = _cyb_view.array(shape=(self._ptr[0].remapTabSize,), itemsize=sizeof(unsigned int), format="I", mode="c") arr[:] = _numpy.asarray(val, dtype=_numpy.uint32) _cyb_memcpy((&(self._ptr[0].flaRemapTabAddr)), (arr.data), sizeof(unsigned int) * len(val)) @property def gpa_remap_tab_addr(self): """~_numpy.uint32: (array of length 4096).SPA/GPA remap table addrs for all the remap table entries.""" if self._ptr[0].remapTabSize == 0: return _numpy.array([]) cdef _cyb_view.array arr = _cyb_view.array(shape=(self._ptr[0].remapTabSize,), itemsize=sizeof(unsigned int), format="I", mode="c", allocate_buffer=False) arr.data = (&(self._ptr[0].gpaRemapTabAddr)) return _numpy.asarray(arr) @gpa_remap_tab_addr.setter def gpa_remap_tab_addr(self, val): if self._readonly: raise ValueError("This NvlinkGetRemapTableInfo_v1 instance is read-only") if len(val) > 4096: raise ValueError(f"Too many elements for field gpa_remap_tab_addr, max is 4096, got {len(val)}") self._ptr[0].remapTabSize = len(val) if len(val) == 0: return cdef _cyb_view.array arr = _cyb_view.array(shape=(self._ptr[0].remapTabSize,), itemsize=sizeof(unsigned int), format="I", mode="c") arr[:] = _numpy.asarray(val, dtype=_numpy.uint32) _cyb_memcpy((&(self._ptr[0].gpaRemapTabAddr)), (arr.data), sizeof(unsigned int) * len(val)) @staticmethod def from_buffer(buffer): """Create an NvlinkGetRemapTableInfo_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlNvlinkGetRemapTableInfo_v1_t), NvlinkGetRemapTableInfo_v1) @staticmethod def from_data(data): """Create an NvlinkGetRemapTableInfo_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `nvlink_get_remap_table_info_v1_dtype` holding the data. """ return _cyb_from_data(data, "nvlink_get_remap_table_info_v1_dtype", nvlink_get_remap_table_info_v1_dtype, NvlinkGetRemapTableInfo_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an NvlinkGetRemapTableInfo_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef NvlinkGetRemapTableInfo_v1 obj = NvlinkGetRemapTableInfo_v1.__new__(NvlinkGetRemapTableInfo_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlNvlinkGetRemapTableInfo_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_nvlink_set_nvle_ready_v1_dtype_offsets(): cdef nvmlNvlinkSetNvleReady_v1_t *pod = _cyb_calloc(1, sizeof(nvmlNvlinkSetNvleReady_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlNvlinkSetNvleReady_v1_t") try: return _numpy.dtype({ 'names': ['b_nvle_ready'], 'formats': [_numpy.uint8], 'offsets': [ (&(pod.bNvleReady)) - (pod), ], 'itemsize': sizeof(nvmlNvlinkSetNvleReady_v1_t), }) finally: _cyb_free(pod) nvlink_set_nvle_ready_v1_dtype = _get_nvlink_set_nvle_ready_v1_dtype_offsets() cdef class NvlinkSetNvleReady_v1: """Empty-initialize an instance of `nvmlNvlinkSetNvleReady_v1_t`. .. seealso:: `nvmlNvlinkSetNvleReady_v1_t` """ cdef: nvmlNvlinkSetNvleReady_v1_t _data nvmlNvlinkSetNvleReady_v1_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.NvlinkSetNvleReady_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef NvlinkSetNvleReady_v1 other_ if not isinstance(other, NvlinkSetNvleReady_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlNvlinkSetNvleReady_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlNvlinkSetNvleReady_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): cdef _cyb_Py_buffer view if key == 0: if self._readonly: raise ValueError("This NvlinkSetNvleReady_v1 instance is read-only") _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) try: if view.len < sizeof(nvmlNvlinkSetNvleReady_v1_t): raise ValueError( "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlNvlinkSetNvleReady_v1_t), view.len) ) _cyb_memmove(&self._data, view.buf, sizeof(nvmlNvlinkSetNvleReady_v1_t)) self._ptr = &self._data self._owner = None self._readonly = view.readonly != 0 finally: _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @property def b_nvle_ready(self): """int: Whether NVLE is ready on the GPU.""" return self._ptr[0].bNvleReady @b_nvle_ready.setter def b_nvle_ready(self, val): if self._readonly: raise ValueError("This NvlinkSetNvleReady_v1 instance is read-only") self._ptr[0].bNvleReady = val @staticmethod def from_buffer(buffer): """Create an NvlinkSetNvleReady_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlNvlinkSetNvleReady_v1_t), NvlinkSetNvleReady_v1) @staticmethod def from_data(data): """Create an NvlinkSetNvleReady_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `nvlink_set_nvle_ready_v1_dtype` holding the data. """ return _cyb_from_data(data, "nvlink_set_nvle_ready_v1_dtype", nvlink_set_nvle_ready_v1_dtype, NvlinkSetNvleReady_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an NvlinkSetNvleReady_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef NvlinkSetNvleReady_v1 obj = NvlinkSetNvleReady_v1.__new__(NvlinkSetNvleReady_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlNvlinkSetNvleReady_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_nvlink_lock_remap_table_v1_dtype_offsets(): cdef nvmlNvlinkLockRemapTable_v1_t *pod = _cyb_calloc(1, sizeof(nvmlNvlinkLockRemapTable_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlNvlinkLockRemapTable_v1_t") try: return _numpy.dtype({ 'names': ['b_remap_table_locked', 'b_remap_table_lock_disabled'], 'formats': [_numpy.uint8, _numpy.uint8], 'offsets': [ (&(pod.bRemapTableLocked)) - (pod), (&(pod.bRemapTableLockDisabled)) - (pod), ], 'itemsize': sizeof(nvmlNvlinkLockRemapTable_v1_t), }) finally: _cyb_free(pod) nvlink_lock_remap_table_v1_dtype = _get_nvlink_lock_remap_table_v1_dtype_offsets() cdef class NvlinkLockRemapTable_v1: """Empty-initialize an instance of `nvmlNvlinkLockRemapTable_v1_t`. .. seealso:: `nvmlNvlinkLockRemapTable_v1_t` """ cdef: nvmlNvlinkLockRemapTable_v1_t _data nvmlNvlinkLockRemapTable_v1_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.NvlinkLockRemapTable_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef NvlinkLockRemapTable_v1 other_ if not isinstance(other, NvlinkLockRemapTable_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlNvlinkLockRemapTable_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlNvlinkLockRemapTable_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): cdef _cyb_Py_buffer view if key == 0: if self._readonly: raise ValueError("This NvlinkLockRemapTable_v1 instance is read-only") _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) try: if view.len < sizeof(nvmlNvlinkLockRemapTable_v1_t): raise ValueError( "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlNvlinkLockRemapTable_v1_t), view.len) ) _cyb_memmove(&self._data, view.buf, sizeof(nvmlNvlinkLockRemapTable_v1_t)) self._ptr = &self._data self._owner = None self._readonly = view.readonly != 0 finally: _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @property def b_remap_table_locked(self): """int: Whether the remap table of the GPU is locked.""" return self._ptr[0].bRemapTableLocked @b_remap_table_locked.setter def b_remap_table_locked(self, val): if self._readonly: raise ValueError("This NvlinkLockRemapTable_v1 instance is read-only") self._ptr[0].bRemapTableLocked = val @property def b_remap_table_lock_disabled(self): """int: Whether locking of the remap table is disabled.""" return self._ptr[0].bRemapTableLockDisabled @b_remap_table_lock_disabled.setter def b_remap_table_lock_disabled(self, val): if self._readonly: raise ValueError("This NvlinkLockRemapTable_v1 instance is read-only") self._ptr[0].bRemapTableLockDisabled = val @staticmethod def from_buffer(buffer): """Create an NvlinkLockRemapTable_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlNvlinkLockRemapTable_v1_t), NvlinkLockRemapTable_v1) @staticmethod def from_data(data): """Create an NvlinkLockRemapTable_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `nvlink_lock_remap_table_v1_dtype` holding the data. """ return _cyb_from_data(data, "nvlink_lock_remap_table_v1_dtype", nvlink_lock_remap_table_v1_dtype, NvlinkLockRemapTable_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an NvlinkLockRemapTable_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef NvlinkLockRemapTable_v1 obj = NvlinkLockRemapTable_v1.__new__(NvlinkLockRemapTable_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlNvlinkLockRemapTable_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_nvlink_nvle_private_info_v1_dtype_offsets(): cdef nvmlNvlinkNvlePrivateInfo_v1_t *pod = _cyb_calloc(1, sizeof(nvmlNvlinkNvlePrivateInfo_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlNvlinkNvlePrivateInfo_v1_t") try: return _numpy.dtype({ 'names': ['data_', 'size_'], 'formats': [(_numpy.uint8, 256), _numpy.uint32], 'offsets': [ (&(pod.data)) - (pod), (&(pod.size)) - (pod), ], 'itemsize': sizeof(nvmlNvlinkNvlePrivateInfo_v1_t), }) finally: _cyb_free(pod) nvlink_nvle_private_info_v1_dtype = _get_nvlink_nvle_private_info_v1_dtype_offsets() cdef class NvlinkNvlePrivateInfo_v1: """Empty-initialize an instance of `nvmlNvlinkNvlePrivateInfo_v1_t`. .. seealso:: `nvmlNvlinkNvlePrivateInfo_v1_t` """ cdef: nvmlNvlinkNvlePrivateInfo_v1_t *_ptr object _owner bint _owns_ptr bint _readonly def __init__(self): self._ptr = _cyb_calloc(1, sizeof(nvmlNvlinkNvlePrivateInfo_v1_t)) if self._ptr == NULL: raise MemoryError("Error allocating NvlinkNvlePrivateInfo_v1") self._owns_ptr = True self._owner = None self._readonly = False def __dealloc__(self): cdef nvmlNvlinkNvlePrivateInfo_v1_t *ptr if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) def __repr__(self): return f"<{__name__}.NvlinkNvlePrivateInfo_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef NvlinkNvlePrivateInfo_v1 other_ if not isinstance(other, NvlinkNvlePrivateInfo_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlNvlinkNvlePrivateInfo_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlNvlinkNvlePrivateInfo_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): cdef _cyb_Py_buffer view if key == 0: if self._readonly: raise ValueError("This NvlinkNvlePrivateInfo_v1 instance is read-only") _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) try: if view.len < sizeof(nvmlNvlinkNvlePrivateInfo_v1_t): raise ValueError( "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlNvlinkNvlePrivateInfo_v1_t), view.len) ) _cyb_memmove(self._ptr, view.buf, sizeof(nvmlNvlinkNvlePrivateInfo_v1_t)) self._readonly = view.readonly != 0 finally: _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @property def data_(self): """~_numpy.uint8: (array of length 256).Buffer that receives the opaque private info blob.""" if self._ptr[0].size == 0: return _numpy.array([]) cdef _cyb_view.array arr = _cyb_view.array(shape=(self._ptr[0].size,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False) arr.data = (&(self._ptr[0].data)) return _numpy.asarray(arr) @data_.setter def data_(self, val): if self._readonly: raise ValueError("This NvlinkNvlePrivateInfo_v1 instance is read-only") if len(val) > 256: raise ValueError(f"Too many elements for field data_, max is 256, got {len(val)}") self._ptr[0].size = len(val) if len(val) == 0: return cdef _cyb_view.array arr = _cyb_view.array(shape=(self._ptr[0].size,), itemsize=sizeof(unsigned char), format="B", mode="c") arr[:] = _numpy.asarray(val, dtype=_numpy.uint8) _cyb_memcpy((&(self._ptr[0].data)), (arr.data), sizeof(unsigned char) * len(val)) @staticmethod def from_buffer(buffer): """Create an NvlinkNvlePrivateInfo_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlNvlinkNvlePrivateInfo_v1_t), NvlinkNvlePrivateInfo_v1) @staticmethod def from_data(data): """Create an NvlinkNvlePrivateInfo_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `nvlink_nvle_private_info_v1_dtype` holding the data. """ return _cyb_from_data(data, "nvlink_nvle_private_info_v1_dtype", nvlink_nvle_private_info_v1_dtype, NvlinkNvlePrivateInfo_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an NvlinkNvlePrivateInfo_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef NvlinkNvlePrivateInfo_v1 obj = NvlinkNvlePrivateInfo_v1.__new__(NvlinkNvlePrivateInfo_v1) if owner is None: obj._ptr = _cyb_malloc(sizeof(nvmlNvlinkNvlePrivateInfo_v1_t)) if obj._ptr == NULL: raise MemoryError("Error allocating NvlinkNvlePrivateInfo_v1") _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlNvlinkNvlePrivateInfo_v1_t)) obj._owns_ptr = True obj._owner = None else: obj._ptr = ptr obj._owns_ptr = False obj._owner = owner obj._readonly = readonly return obj cdef _get_excluded_device_info_dtype_offsets(): cdef nvmlExcludedDeviceInfo_t *pod = _cyb_calloc(1, sizeof(nvmlExcludedDeviceInfo_t)) if pod == NULL: raise MemoryError("Error allocating nvmlExcludedDeviceInfo_t") try: return _numpy.dtype({ 'names': ['pci_info', 'uuid'], 'formats': [pci_info_dtype, (_numpy.int8, 80)], 'offsets': [ (&(pod.pciInfo)) - (pod), (&(pod.uuid)) - (pod), ], 'itemsize': sizeof(nvmlExcludedDeviceInfo_t), }) finally: _cyb_free(pod) excluded_device_info_dtype = _get_excluded_device_info_dtype_offsets() cdef class ExcludedDeviceInfo: """Empty-initialize an instance of `nvmlExcludedDeviceInfo_t`. .. seealso:: `nvmlExcludedDeviceInfo_t` """ cdef: nvmlExcludedDeviceInfo_t _data nvmlExcludedDeviceInfo_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.ExcludedDeviceInfo object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef ExcludedDeviceInfo other_ if not isinstance(other, ExcludedDeviceInfo): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlExcludedDeviceInfo_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlExcludedDeviceInfo_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def pci_info(self): """PciInfo: """ return PciInfo.from_ptr( &(self._ptr[0].pciInfo), readonly=self._readonly, owner=self, ) @pci_info.setter def pci_info(self, val): if self._readonly: raise ValueError("This ExcludedDeviceInfo instance is read-only") cdef PciInfo val_ = val _cyb_memcpy(&(self._ptr[0].pciInfo), (val_._get_ptr()), sizeof(nvmlPciInfo_t) * 1) @property def uuid(self): """~_numpy.int8: (array of length 80).""" return _cyb_cpython.PyUnicode_FromString(self._ptr[0].uuid) @uuid.setter def uuid(self, val): if self._readonly: raise ValueError("This ExcludedDeviceInfo instance is read-only") cdef bytes buf = val.encode() if len(buf) >= 80: raise ValueError("String too long for field uuid, max length is 79") cdef char *ptr = buf _cyb_memcpy((self._ptr[0].uuid), ptr, 80) @staticmethod def from_buffer(buffer): """Create an ExcludedDeviceInfo instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlExcludedDeviceInfo_t), ExcludedDeviceInfo) @staticmethod def from_data(data): """Create an ExcludedDeviceInfo instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `excluded_device_info_dtype` holding the data. """ return _cyb_from_data(data, "excluded_device_info_dtype", excluded_device_info_dtype, ExcludedDeviceInfo) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an ExcludedDeviceInfo instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef ExcludedDeviceInfo obj = ExcludedDeviceInfo.__new__(ExcludedDeviceInfo) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlExcludedDeviceInfo_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_process_detail_list_v1_dtype_offsets(): cdef nvmlProcessDetailList_v1_t *pod = _cyb_calloc(1, sizeof(nvmlProcessDetailList_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlProcessDetailList_v1_t") try: return _numpy.dtype({ 'names': ['version', 'mode', 'num_proc_array_entries', 'proc_array'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.intp], 'offsets': [ (&(pod.version)) - (pod), (&(pod.mode)) - (pod), (&(pod.numProcArrayEntries)) - (pod), (&(pod.procArray)) - (pod), ], 'itemsize': sizeof(nvmlProcessDetailList_v1_t), }) finally: _cyb_free(pod) process_detail_list_v1_dtype = _get_process_detail_list_v1_dtype_offsets() cdef class ProcessDetailList_v1: """Empty-initialize an instance of `nvmlProcessDetailList_v1_t`. .. seealso:: `nvmlProcessDetailList_v1_t` """ cdef: nvmlProcessDetailList_v1_t _data nvmlProcessDetailList_v1_t *_ptr object _owner bint _readonly dict _refs def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False self._refs = {} def __repr__(self): return f"<{__name__}.ProcessDetailList_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef ProcessDetailList_v1 other_ if not isinstance(other, ProcessDetailList_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlProcessDetailList_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlProcessDetailList_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def version(self): """int: Struct version, MUST be nvmlProcessDetailList_v1.""" return self._ptr[0].version @version.setter def version(self, val): if self._readonly: raise ValueError("This ProcessDetailList_v1 instance is read-only") self._ptr[0].version = val @property def mode(self): """int: Process mode, One of `nvmlProcessMode_t`.""" return self._ptr[0].mode @mode.setter def mode(self, val): if self._readonly: raise ValueError("This ProcessDetailList_v1 instance is read-only") self._ptr[0].mode = val @property def proc_array(self): """int: Process array.""" if self._ptr[0].procArray == NULL or self._ptr[0].numProcArrayEntries == 0: return [] return ProcessDetail_v1.from_ptr( (self._ptr[0].procArray), self._ptr[0].numProcArrayEntries, owner=self, readonly=self._readonly ) @proc_array.setter def proc_array(self, val): if self._readonly: raise ValueError("This ProcessDetailList_v1 instance is read-only") cdef ProcessDetail_v1 arr = val self._ptr[0].procArray = (arr._get_ptr()) self._ptr[0].numProcArrayEntries = len(arr) self._refs["proc_array"] = arr @staticmethod def from_buffer(buffer): """Create an ProcessDetailList_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlProcessDetailList_v1_t), ProcessDetailList_v1) @staticmethod def from_data(data): """Create an ProcessDetailList_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `process_detail_list_v1_dtype` holding the data. """ return _cyb_from_data(data, "process_detail_list_v1_dtype", process_detail_list_v1_dtype, ProcessDetailList_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an ProcessDetailList_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef ProcessDetailList_v1 obj = ProcessDetailList_v1.__new__(ProcessDetailList_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlProcessDetailList_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly obj._refs = {} return obj cdef _get_bridge_chip_hierarchy_dtype_offsets(): cdef nvmlBridgeChipHierarchy_t *pod = _cyb_calloc(1, sizeof(nvmlBridgeChipHierarchy_t)) if pod == NULL: raise MemoryError("Error allocating nvmlBridgeChipHierarchy_t") try: return _numpy.dtype({ 'names': ['bridge_count', 'bridge_chip_info'], 'formats': [_numpy.uint8, (bridge_chip_info_dtype, 128)], 'offsets': [ (&(pod.bridgeCount)) - (pod), (&(pod.bridgeChipInfo)) - (pod), ], 'itemsize': sizeof(nvmlBridgeChipHierarchy_t), }) finally: _cyb_free(pod) bridge_chip_hierarchy_dtype = _get_bridge_chip_hierarchy_dtype_offsets() cdef class BridgeChipHierarchy: """Empty-initialize an instance of `nvmlBridgeChipHierarchy_t`. .. seealso:: `nvmlBridgeChipHierarchy_t` """ cdef: nvmlBridgeChipHierarchy_t _data nvmlBridgeChipHierarchy_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.BridgeChipHierarchy object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef BridgeChipHierarchy other_ if not isinstance(other, BridgeChipHierarchy): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlBridgeChipHierarchy_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlBridgeChipHierarchy_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def bridge_chip_info(self): """BridgeChipInfo: """ return BridgeChipInfo.from_ptr( &(self._ptr[0].bridgeChipInfo), self._ptr[0].bridgeCount, readonly=self._readonly, owner=self, ) @bridge_chip_info.setter def bridge_chip_info(self, val): if self._readonly: raise ValueError("This BridgeChipHierarchy instance is read-only") cdef BridgeChipInfo val_ = val if len(val) > 128: raise ValueError(f"Expected length < 128 for field bridge_chip_info, got {len(val)}") self._ptr[0].bridgeCount = len(val) if len(val) == 0: return _cyb_memcpy(&(self._ptr[0].bridgeChipInfo), (val_._get_ptr()), sizeof(nvmlBridgeChipInfo_t) * self._ptr[0].bridgeCount) @staticmethod def from_buffer(buffer): """Create an BridgeChipHierarchy instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlBridgeChipHierarchy_t), BridgeChipHierarchy) @staticmethod def from_data(data): """Create an BridgeChipHierarchy instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `bridge_chip_hierarchy_dtype` holding the data. """ return _cyb_from_data(data, "bridge_chip_hierarchy_dtype", bridge_chip_hierarchy_dtype, BridgeChipHierarchy) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an BridgeChipHierarchy instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef BridgeChipHierarchy obj = BridgeChipHierarchy.__new__(BridgeChipHierarchy) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlBridgeChipHierarchy_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_sample_dtype_offsets(): cdef nvmlSample_t *pod = _cyb_calloc(1, sizeof(nvmlSample_t)) if pod == NULL: raise MemoryError("Error allocating nvmlSample_t") try: return _numpy.dtype({ 'names': ['time_stamp', 'sample_value'], 'formats': [_numpy.uint64, value_dtype], 'offsets': [ (&(pod.timeStamp)) - (pod), (&(pod.sampleValue)) - (pod), ], 'itemsize': sizeof(nvmlSample_t), }) finally: _cyb_free(pod) sample_dtype = _get_sample_dtype_offsets() cdef object sample_dtype_record = _numpy.dtype((_numpy.record, sample_dtype)) cdef class Sample: """Empty-initialize an array of `nvmlSample_t`. The resulting object is of length `size` and of dtype `sample_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `nvmlSample_t` """ cdef: readonly object _data object _owner def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=sample_dtype_record) assert self._data.itemsize == sizeof(nvmlSample_t), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlSample_t) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}.Sample_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}.Sample object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, Sample)) 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 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): if not self._data.flags.writeable: raise ValueError("This Sample instance is read-only") self._data["time_stamp"] = val @property def sample_value(self): """value_dtype: """ return self._data["sample_value"].view(_numpy.recarray) @sample_value.setter def sample_value(self, val): if not self._data.flags.writeable: raise ValueError("This Sample instance is read-only") self._data["sample_value"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef Sample obj 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 obj = Sample.__new__(Sample) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == sample_dtype: obj = Sample.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an Sample instance with the memory from the given buffer.""" return Sample.from_data(_numpy.frombuffer(buffer, dtype=sample_dtype)) @staticmethod def from_data(data): """Create an Sample instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `sample_dtype` holding the data. """ cdef Sample obj = Sample.__new__(Sample) 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 != sample_dtype: raise ValueError("data array must be of dtype sample_dtype") obj._data = data.view(dtype=sample_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an Sample 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 Sample obj = Sample.__new__(Sample) 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(nvmlSample_t) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=sample_dtype_record) obj._owner = owner return obj cdef _get_vgpu_instance_utilization_sample_dtype_offsets(): cdef nvmlVgpuInstanceUtilizationSample_t *pod = _cyb_calloc(1, sizeof(nvmlVgpuInstanceUtilizationSample_t)) if pod == NULL: raise MemoryError("Error allocating nvmlVgpuInstanceUtilizationSample_t") try: return _numpy.dtype({ 'names': ['vgpu_instance', 'time_stamp', 'sm_util', 'mem_util', 'enc_util', 'dec_util'], 'formats': [_numpy.uint32, _numpy.uint64, value_dtype, value_dtype, value_dtype, value_dtype], 'offsets': [ (&(pod.vgpuInstance)) - (pod), (&(pod.timeStamp)) - (pod), (&(pod.smUtil)) - (pod), (&(pod.memUtil)) - (pod), (&(pod.encUtil)) - (pod), (&(pod.decUtil)) - (pod), ], 'itemsize': sizeof(nvmlVgpuInstanceUtilizationSample_t), }) finally: _cyb_free(pod) vgpu_instance_utilization_sample_dtype = _get_vgpu_instance_utilization_sample_dtype_offsets() cdef object vgpu_instance_utilization_sample_dtype_record = _numpy.dtype((_numpy.record, vgpu_instance_utilization_sample_dtype)) cdef class VgpuInstanceUtilizationSample: """Empty-initialize an array of `nvmlVgpuInstanceUtilizationSample_t`. The resulting object is of length `size` and of dtype `vgpu_instance_utilization_sample_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `nvmlVgpuInstanceUtilizationSample_t` """ cdef: readonly object _data object _owner def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=vgpu_instance_utilization_sample_dtype_record) assert self._data.itemsize == sizeof(nvmlVgpuInstanceUtilizationSample_t), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlVgpuInstanceUtilizationSample_t) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}.VgpuInstanceUtilizationSample_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}.VgpuInstanceUtilizationSample object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, VgpuInstanceUtilizationSample)) 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 vgpu_instance(self): """Union[~_numpy.uint32, int]: """ 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): if not self._data.flags.writeable: raise ValueError("This VgpuInstanceUtilizationSample instance is read-only") self._data["vgpu_instance"] = 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): if not self._data.flags.writeable: raise ValueError("This VgpuInstanceUtilizationSample instance is read-only") self._data["time_stamp"] = val @property def sm_util(self): """value_dtype: """ return self._data["sm_util"].view(_numpy.recarray) @sm_util.setter def sm_util(self, val): if not self._data.flags.writeable: raise ValueError("This VgpuInstanceUtilizationSample instance is read-only") self._data["sm_util"] = val @property def mem_util(self): """value_dtype: """ return self._data["mem_util"].view(_numpy.recarray) @mem_util.setter def mem_util(self, val): if not self._data.flags.writeable: raise ValueError("This VgpuInstanceUtilizationSample instance is read-only") self._data["mem_util"] = val @property def enc_util(self): """value_dtype: """ return self._data["enc_util"].view(_numpy.recarray) @enc_util.setter def enc_util(self, val): if not self._data.flags.writeable: raise ValueError("This VgpuInstanceUtilizationSample instance is read-only") self._data["enc_util"] = val @property def dec_util(self): """value_dtype: """ return self._data["dec_util"].view(_numpy.recarray) @dec_util.setter def dec_util(self, val): if not self._data.flags.writeable: raise ValueError("This VgpuInstanceUtilizationSample instance is read-only") self._data["dec_util"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef VgpuInstanceUtilizationSample obj 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 obj = VgpuInstanceUtilizationSample.__new__(VgpuInstanceUtilizationSample) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == vgpu_instance_utilization_sample_dtype: obj = VgpuInstanceUtilizationSample.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an VgpuInstanceUtilizationSample instance with the memory from the given buffer.""" return VgpuInstanceUtilizationSample.from_data(_numpy.frombuffer(buffer, dtype=vgpu_instance_utilization_sample_dtype)) @staticmethod def from_data(data): """Create an VgpuInstanceUtilizationSample instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `vgpu_instance_utilization_sample_dtype` holding the data. """ cdef VgpuInstanceUtilizationSample obj = VgpuInstanceUtilizationSample.__new__(VgpuInstanceUtilizationSample) 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_instance_utilization_sample_dtype: raise ValueError("data array must be of dtype vgpu_instance_utilization_sample_dtype") obj._data = data.view(dtype=vgpu_instance_utilization_sample_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an VgpuInstanceUtilizationSample 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 VgpuInstanceUtilizationSample obj = VgpuInstanceUtilizationSample.__new__(VgpuInstanceUtilizationSample) 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(nvmlVgpuInstanceUtilizationSample_t) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=vgpu_instance_utilization_sample_dtype_record) obj._owner = owner return obj cdef _get_vgpu_instance_utilization_info_v1_dtype_offsets(): cdef nvmlVgpuInstanceUtilizationInfo_v1_t *pod = _cyb_calloc(1, sizeof(nvmlVgpuInstanceUtilizationInfo_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlVgpuInstanceUtilizationInfo_v1_t") try: return _numpy.dtype({ 'names': ['time_stamp', 'vgpu_instance', 'sm_util', 'mem_util', 'enc_util', 'dec_util', 'jpg_util', 'ofa_util'], 'formats': [_numpy.uint64, _numpy.uint32, value_dtype, value_dtype, value_dtype, value_dtype, value_dtype, value_dtype], 'offsets': [ (&(pod.timeStamp)) - (pod), (&(pod.vgpuInstance)) - (pod), (&(pod.smUtil)) - (pod), (&(pod.memUtil)) - (pod), (&(pod.encUtil)) - (pod), (&(pod.decUtil)) - (pod), (&(pod.jpgUtil)) - (pod), (&(pod.ofaUtil)) - (pod), ], 'itemsize': sizeof(nvmlVgpuInstanceUtilizationInfo_v1_t), }) finally: _cyb_free(pod) vgpu_instance_utilization_info_v1_dtype = _get_vgpu_instance_utilization_info_v1_dtype_offsets() cdef object vgpu_instance_utilization_info_v1_dtype_record = _numpy.dtype((_numpy.record, vgpu_instance_utilization_info_v1_dtype)) cdef class VgpuInstanceUtilizationInfo_v1: """Empty-initialize an array of `nvmlVgpuInstanceUtilizationInfo_v1_t`. The resulting object is of length `size` and of dtype `vgpu_instance_utilization_info_v1_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `nvmlVgpuInstanceUtilizationInfo_v1_t` """ cdef: readonly object _data object _owner def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=vgpu_instance_utilization_info_v1_dtype_record) assert self._data.itemsize == sizeof(nvmlVgpuInstanceUtilizationInfo_v1_t), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlVgpuInstanceUtilizationInfo_v1_t) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}.VgpuInstanceUtilizationInfo_v1_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}.VgpuInstanceUtilizationInfo_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, VgpuInstanceUtilizationInfo_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 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): if not self._data.flags.writeable: raise ValueError("This VgpuInstanceUtilizationInfo_v1 instance is read-only") 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): if not self._data.flags.writeable: raise ValueError("This VgpuInstanceUtilizationInfo_v1 instance is read-only") self._data["vgpu_instance"] = val @property def sm_util(self): """value_dtype: SM (3D/Compute) Util Value.""" return self._data["sm_util"].view(_numpy.recarray) @sm_util.setter def sm_util(self, val): if not self._data.flags.writeable: raise ValueError("This VgpuInstanceUtilizationInfo_v1 instance is read-only") self._data["sm_util"] = val @property def mem_util(self): """value_dtype: Frame Buffer Memory Util Value.""" return self._data["mem_util"].view(_numpy.recarray) @mem_util.setter def mem_util(self, val): if not self._data.flags.writeable: raise ValueError("This VgpuInstanceUtilizationInfo_v1 instance is read-only") self._data["mem_util"] = val @property def enc_util(self): """value_dtype: Encoder Util Value.""" return self._data["enc_util"].view(_numpy.recarray) @enc_util.setter def enc_util(self, val): if not self._data.flags.writeable: raise ValueError("This VgpuInstanceUtilizationInfo_v1 instance is read-only") self._data["enc_util"] = val @property def dec_util(self): """value_dtype: Decoder Util Value.""" return self._data["dec_util"].view(_numpy.recarray) @dec_util.setter def dec_util(self, val): if not self._data.flags.writeable: raise ValueError("This VgpuInstanceUtilizationInfo_v1 instance is read-only") self._data["dec_util"] = val @property def jpg_util(self): """value_dtype: Jpeg Util Value.""" return self._data["jpg_util"].view(_numpy.recarray) @jpg_util.setter def jpg_util(self, val): if not self._data.flags.writeable: raise ValueError("This VgpuInstanceUtilizationInfo_v1 instance is read-only") self._data["jpg_util"] = val @property def ofa_util(self): """value_dtype: Ofa Util Value.""" return self._data["ofa_util"].view(_numpy.recarray) @ofa_util.setter def ofa_util(self, val): if not self._data.flags.writeable: raise ValueError("This VgpuInstanceUtilizationInfo_v1 instance is read-only") self._data["ofa_util"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef VgpuInstanceUtilizationInfo_v1 obj 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 obj = VgpuInstanceUtilizationInfo_v1.__new__(VgpuInstanceUtilizationInfo_v1) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == vgpu_instance_utilization_info_v1_dtype: obj = VgpuInstanceUtilizationInfo_v1.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an VgpuInstanceUtilizationInfo_v1 instance with the memory from the given buffer.""" return VgpuInstanceUtilizationInfo_v1.from_data(_numpy.frombuffer(buffer, dtype=vgpu_instance_utilization_info_v1_dtype)) @staticmethod def from_data(data): """Create an VgpuInstanceUtilizationInfo_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `vgpu_instance_utilization_info_v1_dtype` holding the data. """ cdef VgpuInstanceUtilizationInfo_v1 obj = VgpuInstanceUtilizationInfo_v1.__new__(VgpuInstanceUtilizationInfo_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_instance_utilization_info_v1_dtype: raise ValueError("data array must be of dtype vgpu_instance_utilization_info_v1_dtype") obj._data = data.view(dtype=vgpu_instance_utilization_info_v1_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an VgpuInstanceUtilizationInfo_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 VgpuInstanceUtilizationInfo_v1 obj = VgpuInstanceUtilizationInfo_v1.__new__(VgpuInstanceUtilizationInfo_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(nvmlVgpuInstanceUtilizationInfo_v1_t) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=vgpu_instance_utilization_info_v1_dtype_record) obj._owner = owner return obj cdef _get_field_value_dtype_offsets(): cdef nvmlFieldValue_t *pod = _cyb_calloc(1, sizeof(nvmlFieldValue_t)) if pod == NULL: raise MemoryError("Error allocating nvmlFieldValue_t") try: return _numpy.dtype({ 'names': ['field_id', 'scope_id', 'timestamp', 'latency_usec', 'value_type', 'nvml_return', 'value'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.int64, _numpy.int64, _numpy.int32, _numpy.int32, value_dtype], 'offsets': [ (&(pod.fieldId)) - (pod), (&(pod.scopeId)) - (pod), (&(pod.timestamp)) - (pod), (&(pod.latencyUsec)) - (pod), (&(pod.valueType)) - (pod), (&(pod.nvmlReturn)) - (pod), (&(pod.value)) - (pod), ], 'itemsize': sizeof(nvmlFieldValue_t), }) finally: _cyb_free(pod) field_value_dtype = _get_field_value_dtype_offsets() cdef object field_value_dtype_record = _numpy.dtype((_numpy.record, field_value_dtype)) cdef class FieldValue: """Empty-initialize an array of `nvmlFieldValue_t`. The resulting object is of length `size` and of dtype `field_value_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `nvmlFieldValue_t` """ cdef: readonly object _data object _owner def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=field_value_dtype_record) assert self._data.itemsize == sizeof(nvmlFieldValue_t), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlFieldValue_t) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}.FieldValue_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}.FieldValue object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, FieldValue)) 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 field_id(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["field_id"][0]) return self._data["field_id"] @field_id.setter def field_id(self, val): if not self._data.flags.writeable: raise ValueError("This FieldValue instance is read-only") self._data["field_id"] = val @property def scope_id(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["scope_id"][0]) return self._data["scope_id"] @scope_id.setter def scope_id(self, val): if not self._data.flags.writeable: raise ValueError("This FieldValue instance is read-only") self._data["scope_id"] = val @property def timestamp(self): """Union[~_numpy.int64, int]: """ if self._data.size == 1: return int(self._data["timestamp"][0]) return self._data["timestamp"] @timestamp.setter def timestamp(self, val): if not self._data.flags.writeable: raise ValueError("This FieldValue instance is read-only") self._data["timestamp"] = val @property def latency_usec(self): """Union[~_numpy.int64, int]: """ if self._data.size == 1: return int(self._data["latency_usec"][0]) return self._data["latency_usec"] @latency_usec.setter def latency_usec(self, val): if not self._data.flags.writeable: raise ValueError("This FieldValue instance is read-only") self._data["latency_usec"] = val @property def value_type(self): """Union[~_numpy.int32, int]: """ if self._data.size == 1: return int(self._data["value_type"][0]) return self._data["value_type"] @value_type.setter def value_type(self, val): if not self._data.flags.writeable: raise ValueError("This FieldValue instance is read-only") self._data["value_type"] = val @property def nvml_return(self): """Union[~_numpy.int32, int]: """ if self._data.size == 1: return int(self._data["nvml_return"][0]) return self._data["nvml_return"] @nvml_return.setter def nvml_return(self, val): if not self._data.flags.writeable: raise ValueError("This FieldValue instance is read-only") self._data["nvml_return"] = val @property def value(self): """value_dtype: """ return self._data["value"].view(_numpy.recarray) @value.setter def value(self, val): if not self._data.flags.writeable: raise ValueError("This FieldValue instance is read-only") self._data["value"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef FieldValue obj 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 obj = FieldValue.__new__(FieldValue) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == field_value_dtype: obj = FieldValue.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an FieldValue instance with the memory from the given buffer.""" return FieldValue.from_data(_numpy.frombuffer(buffer, dtype=field_value_dtype)) @staticmethod def from_data(data): """Create an FieldValue instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `field_value_dtype` holding the data. """ cdef FieldValue obj = FieldValue.__new__(FieldValue) 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 != field_value_dtype: raise ValueError("data array must be of dtype field_value_dtype") obj._data = data.view(dtype=field_value_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an FieldValue 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 FieldValue obj = FieldValue.__new__(FieldValue) 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(nvmlFieldValue_t) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=field_value_dtype_record) obj._owner = owner return obj cdef _get_prm_counter_value_v1_dtype_offsets(): cdef nvmlPRMCounterValue_v1_t *pod = _cyb_calloc(1, sizeof(nvmlPRMCounterValue_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlPRMCounterValue_v1_t") try: return _numpy.dtype({ 'names': ['status', 'output_type', 'output_value'], 'formats': [_numpy.int32, _numpy.int32, value_dtype], 'offsets': [ (&(pod.status)) - (pod), (&(pod.outputType)) - (pod), (&(pod.outputValue)) - (pod), ], 'itemsize': sizeof(nvmlPRMCounterValue_v1_t), }) finally: _cyb_free(pod) prm_counter_value_v1_dtype = _get_prm_counter_value_v1_dtype_offsets() cdef class PRMCounterValue_v1: """Empty-initialize an instance of `nvmlPRMCounterValue_v1_t`. .. seealso:: `nvmlPRMCounterValue_v1_t` """ cdef: nvmlPRMCounterValue_v1_t *_ptr object _owner 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._readonly = False def __dealloc__(self): cdef nvmlPRMCounterValue_v1_t *ptr if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) def __repr__(self): return f"<{__name__}.PRMCounterValue_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef PRMCounterValue_v1 other_ if not isinstance(other, PRMCounterValue_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlPRMCounterValue_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlPRMCounterValue_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def output_value(self): """Value: Output value.""" return Value.from_ptr( &(self._ptr[0].outputValue), readonly=self._readonly, owner=self, ) @output_value.setter def output_value(self, val): if self._readonly: raise ValueError("This PRMCounterValue_v1 instance is read-only") cdef Value val_ = val _cyb_memcpy(&(self._ptr[0].outputValue), (val_._get_ptr()), sizeof(nvmlValue_t) * 1) @property def status(self): """int: Status of the PRM counter read.""" return (self._ptr[0].status) @status.setter def status(self, val): if self._readonly: raise ValueError("This PRMCounterValue_v1 instance is read-only") self._ptr[0].status = val @property def output_type(self): """int: Output value type.""" return (self._ptr[0].outputType) @output_type.setter def output_type(self, val): if self._readonly: raise ValueError("This PRMCounterValue_v1 instance is read-only") self._ptr[0].outputType = val @staticmethod def from_buffer(buffer): """Create an PRMCounterValue_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlPRMCounterValue_v1_t), PRMCounterValue_v1) @staticmethod def from_data(data): """Create an PRMCounterValue_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `prm_counter_value_v1_dtype` holding the data. """ return _cyb_from_data(data, "prm_counter_value_v1_dtype", prm_counter_value_v1_dtype, PRMCounterValue_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an PRMCounterValue_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef PRMCounterValue_v1 obj = PRMCounterValue_v1.__new__(PRMCounterValue_v1) if owner is None: obj._ptr = _cyb_malloc(sizeof(nvmlPRMCounterValue_v1_t)) 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 else: obj._ptr = ptr obj._owns_ptr = False obj._owner = owner obj._readonly = readonly return obj cdef _get_gpu_thermal_settings_dtype_offsets(): cdef nvmlGpuThermalSettings_t *pod = _cyb_calloc(1, sizeof(nvmlGpuThermalSettings_t)) if pod == NULL: raise MemoryError("Error allocating nvmlGpuThermalSettings_t") try: return _numpy.dtype({ 'names': ['count', 'sensor'], 'formats': [_numpy.uint32, (_py_anon_pod0_dtype, 3)], 'offsets': [ (&(pod.count)) - (pod), (&(pod.sensor)) - (pod), ], 'itemsize': sizeof(nvmlGpuThermalSettings_t), }) finally: _cyb_free(pod) gpu_thermal_settings_dtype = _get_gpu_thermal_settings_dtype_offsets() cdef class GpuThermalSettings: """Empty-initialize an instance of `nvmlGpuThermalSettings_t`. .. seealso:: `nvmlGpuThermalSettings_t` """ cdef: nvmlGpuThermalSettings_t _data nvmlGpuThermalSettings_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.GpuThermalSettings object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef GpuThermalSettings other_ if not isinstance(other, GpuThermalSettings): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlGpuThermalSettings_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlGpuThermalSettings_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def sensor(self): """_py_anon_pod0: """ return _py_anon_pod0.from_ptr( &(self._ptr[0].sensor), 3, readonly=self._readonly, owner=self, ) @sensor.setter def sensor(self, val): if self._readonly: raise ValueError("This GpuThermalSettings instance is read-only") cdef _py_anon_pod0 val_ = val if len(val) != 3: raise ValueError(f"Expected length { 3 } for field sensor, got {len(val)}") _cyb_memcpy(&(self._ptr[0].sensor), (val_._get_ptr()), sizeof(cuda_bindings_nvml__anon_pod0) * 3) @property def count(self): """int: """ return self._ptr[0].count @count.setter def count(self, val): if self._readonly: raise ValueError("This GpuThermalSettings instance is read-only") self._ptr[0].count = val @staticmethod def from_buffer(buffer): """Create an GpuThermalSettings instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlGpuThermalSettings_t), GpuThermalSettings) @staticmethod def from_data(data): """Create an GpuThermalSettings instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `gpu_thermal_settings_dtype` holding the data. """ return _cyb_from_data(data, "gpu_thermal_settings_dtype", gpu_thermal_settings_dtype, GpuThermalSettings) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an GpuThermalSettings instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef GpuThermalSettings obj = GpuThermalSettings.__new__(GpuThermalSettings) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlGpuThermalSettings_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_clk_mon_status_dtype_offsets(): cdef nvmlClkMonStatus_t *pod = _cyb_calloc(1, sizeof(nvmlClkMonStatus_t)) if pod == NULL: raise MemoryError("Error allocating nvmlClkMonStatus_t") try: return _numpy.dtype({ 'names': ['b_global_status', 'clk_mon_list_size', 'clk_mon_list'], 'formats': [_numpy.uint32, _numpy.uint32, (clk_mon_fault_info_dtype, 32)], 'offsets': [ (&(pod.bGlobalStatus)) - (pod), (&(pod.clkMonListSize)) - (pod), (&(pod.clkMonList)) - (pod), ], 'itemsize': sizeof(nvmlClkMonStatus_t), }) finally: _cyb_free(pod) clk_mon_status_dtype = _get_clk_mon_status_dtype_offsets() cdef class ClkMonStatus: """Empty-initialize an instance of `nvmlClkMonStatus_t`. .. seealso:: `nvmlClkMonStatus_t` """ cdef: nvmlClkMonStatus_t _data nvmlClkMonStatus_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.ClkMonStatus object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef ClkMonStatus other_ if not isinstance(other, ClkMonStatus): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlClkMonStatus_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlClkMonStatus_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def clk_mon_list(self): """ClkMonFaultInfo: """ return ClkMonFaultInfo.from_ptr( &(self._ptr[0].clkMonList), self._ptr[0].clkMonListSize, readonly=self._readonly, owner=self, ) @clk_mon_list.setter def clk_mon_list(self, val): if self._readonly: raise ValueError("This ClkMonStatus instance is read-only") cdef ClkMonFaultInfo val_ = val if len(val) > 32: raise ValueError(f"Expected length < 32 for field clk_mon_list, got {len(val)}") self._ptr[0].clkMonListSize = len(val) if len(val) == 0: return _cyb_memcpy(&(self._ptr[0].clkMonList), (val_._get_ptr()), sizeof(nvmlClkMonFaultInfo_t) * self._ptr[0].clkMonListSize) @property def b_global_status(self): """int: """ return self._ptr[0].bGlobalStatus @b_global_status.setter def b_global_status(self, val): if self._readonly: raise ValueError("This ClkMonStatus instance is read-only") self._ptr[0].bGlobalStatus = val @staticmethod def from_buffer(buffer): """Create an ClkMonStatus instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlClkMonStatus_t), ClkMonStatus) @staticmethod def from_data(data): """Create an ClkMonStatus instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `clk_mon_status_dtype` holding the data. """ return _cyb_from_data(data, "clk_mon_status_dtype", clk_mon_status_dtype, ClkMonStatus) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an ClkMonStatus instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef ClkMonStatus obj = ClkMonStatus.__new__(ClkMonStatus) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlClkMonStatus_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_processes_utilization_info_v1_dtype_offsets(): cdef nvmlProcessesUtilizationInfo_v1_t *pod = _cyb_calloc(1, sizeof(nvmlProcessesUtilizationInfo_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlProcessesUtilizationInfo_v1_t") try: return _numpy.dtype({ 'names': ['version', 'process_samples_count', 'last_seen_time_stamp', 'proc_util_array'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint64, _numpy.intp], 'offsets': [ (&(pod.version)) - (pod), (&(pod.processSamplesCount)) - (pod), (&(pod.lastSeenTimeStamp)) - (pod), (&(pod.procUtilArray)) - (pod), ], 'itemsize': sizeof(nvmlProcessesUtilizationInfo_v1_t), }) finally: _cyb_free(pod) processes_utilization_info_v1_dtype = _get_processes_utilization_info_v1_dtype_offsets() cdef class ProcessesUtilizationInfo_v1: """Empty-initialize an instance of `nvmlProcessesUtilizationInfo_v1_t`. .. seealso:: `nvmlProcessesUtilizationInfo_v1_t` """ cdef: nvmlProcessesUtilizationInfo_v1_t _data nvmlProcessesUtilizationInfo_v1_t *_ptr object _owner bint _readonly dict _refs def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False self._refs = {} def __repr__(self): return f"<{__name__}.ProcessesUtilizationInfo_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef ProcessesUtilizationInfo_v1 other_ if not isinstance(other, ProcessesUtilizationInfo_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlProcessesUtilizationInfo_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlProcessesUtilizationInfo_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def version(self): """int: The version number of this struct.""" return self._ptr[0].version @version.setter def version(self, val): if self._readonly: raise ValueError("This ProcessesUtilizationInfo_v1 instance is read-only") self._ptr[0].version = val @property def last_seen_time_stamp(self): """int: Return only samples with timestamp greater than lastSeenTimeStamp.""" return self._ptr[0].lastSeenTimeStamp @last_seen_time_stamp.setter def last_seen_time_stamp(self, val): if self._readonly: raise ValueError("This ProcessesUtilizationInfo_v1 instance is read-only") self._ptr[0].lastSeenTimeStamp = val @property def proc_util_array(self): """int: The array (allocated by caller) of the utilization of GPU SM, framebuffer, video encoder, video decoder, JPEG, and OFA.""" if self._ptr[0].procUtilArray == NULL or self._ptr[0].processSamplesCount == 0: return [] return ProcessUtilizationInfo_v1.from_ptr( (self._ptr[0].procUtilArray), self._ptr[0].processSamplesCount, owner=self, readonly=self._readonly ) @proc_util_array.setter def proc_util_array(self, val): if self._readonly: raise ValueError("This ProcessesUtilizationInfo_v1 instance is read-only") cdef ProcessUtilizationInfo_v1 arr = val self._ptr[0].procUtilArray = (arr._get_ptr()) self._ptr[0].processSamplesCount = len(arr) self._refs["proc_util_array"] = arr @staticmethod def from_buffer(buffer): """Create an ProcessesUtilizationInfo_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlProcessesUtilizationInfo_v1_t), ProcessesUtilizationInfo_v1) @staticmethod def from_data(data): """Create an ProcessesUtilizationInfo_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `processes_utilization_info_v1_dtype` holding the data. """ return _cyb_from_data(data, "processes_utilization_info_v1_dtype", processes_utilization_info_v1_dtype, ProcessesUtilizationInfo_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an ProcessesUtilizationInfo_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef ProcessesUtilizationInfo_v1 obj = ProcessesUtilizationInfo_v1.__new__(ProcessesUtilizationInfo_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlProcessesUtilizationInfo_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly obj._refs = {} return obj cdef _get_gpu_dynamic_pstates_info_dtype_offsets(): cdef nvmlGpuDynamicPstatesInfo_t *pod = _cyb_calloc(1, sizeof(nvmlGpuDynamicPstatesInfo_t)) if pod == NULL: raise MemoryError("Error allocating nvmlGpuDynamicPstatesInfo_t") try: return _numpy.dtype({ 'names': ['flags_', 'utilization'], 'formats': [_numpy.uint32, (_py_anon_pod1_dtype, 8)], 'offsets': [ (&(pod.flags)) - (pod), (&(pod.utilization)) - (pod), ], 'itemsize': sizeof(nvmlGpuDynamicPstatesInfo_t), }) finally: _cyb_free(pod) gpu_dynamic_pstates_info_dtype = _get_gpu_dynamic_pstates_info_dtype_offsets() cdef class GpuDynamicPstatesInfo: """Empty-initialize an instance of `nvmlGpuDynamicPstatesInfo_t`. .. seealso:: `nvmlGpuDynamicPstatesInfo_t` """ cdef: nvmlGpuDynamicPstatesInfo_t _data nvmlGpuDynamicPstatesInfo_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.GpuDynamicPstatesInfo object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef GpuDynamicPstatesInfo other_ if not isinstance(other, GpuDynamicPstatesInfo): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlGpuDynamicPstatesInfo_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlGpuDynamicPstatesInfo_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def utilization(self): """_py_anon_pod1: """ return _py_anon_pod1.from_ptr( &(self._ptr[0].utilization), 8, readonly=self._readonly, owner=self, ) @utilization.setter def utilization(self, val): if self._readonly: raise ValueError("This GpuDynamicPstatesInfo instance is read-only") cdef _py_anon_pod1 val_ = val if len(val) != 8: raise ValueError(f"Expected length { 8 } for field utilization, got {len(val)}") _cyb_memcpy(&(self._ptr[0].utilization), (val_._get_ptr()), sizeof(cuda_bindings_nvml__anon_pod1) * 8) @property def flags_(self): """int: """ return self._ptr[0].flags @flags_.setter def flags_(self, val): if self._readonly: raise ValueError("This GpuDynamicPstatesInfo instance is read-only") self._ptr[0].flags = val @staticmethod def from_buffer(buffer): """Create an GpuDynamicPstatesInfo instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlGpuDynamicPstatesInfo_t), GpuDynamicPstatesInfo) @staticmethod def from_data(data): """Create an GpuDynamicPstatesInfo instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `gpu_dynamic_pstates_info_dtype` holding the data. """ return _cyb_from_data(data, "gpu_dynamic_pstates_info_dtype", gpu_dynamic_pstates_info_dtype, GpuDynamicPstatesInfo) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an GpuDynamicPstatesInfo instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef GpuDynamicPstatesInfo obj = GpuDynamicPstatesInfo.__new__(GpuDynamicPstatesInfo) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlGpuDynamicPstatesInfo_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_vgpu_processes_utilization_info_v1_dtype_offsets(): cdef nvmlVgpuProcessesUtilizationInfo_v1_t *pod = _cyb_calloc(1, sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlVgpuProcessesUtilizationInfo_v1_t") try: return _numpy.dtype({ 'names': ['version', 'vgpu_process_count', 'last_seen_time_stamp', 'vgpu_proc_util_array'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint64, _numpy.intp], 'offsets': [ (&(pod.version)) - (pod), (&(pod.vgpuProcessCount)) - (pod), (&(pod.lastSeenTimeStamp)) - (pod), (&(pod.vgpuProcUtilArray)) - (pod), ], 'itemsize': sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t), }) finally: _cyb_free(pod) vgpu_processes_utilization_info_v1_dtype = _get_vgpu_processes_utilization_info_v1_dtype_offsets() cdef class VgpuProcessesUtilizationInfo_v1: """Empty-initialize an instance of `nvmlVgpuProcessesUtilizationInfo_v1_t`. .. seealso:: `nvmlVgpuProcessesUtilizationInfo_v1_t` """ cdef: nvmlVgpuProcessesUtilizationInfo_v1_t _data nvmlVgpuProcessesUtilizationInfo_v1_t *_ptr object _owner bint _readonly dict _refs def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False self._refs = {} def __repr__(self): return f"<{__name__}.VgpuProcessesUtilizationInfo_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef VgpuProcessesUtilizationInfo_v1 other_ if not isinstance(other, VgpuProcessesUtilizationInfo_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def version(self): """int: The version number of this struct.""" return self._ptr[0].version @version.setter def version(self, val): if self._readonly: raise ValueError("This VgpuProcessesUtilizationInfo_v1 instance is read-only") self._ptr[0].version = val @property def last_seen_time_stamp(self): """int: Return only samples with timestamp greater than lastSeenTimeStamp.""" return self._ptr[0].lastSeenTimeStamp @last_seen_time_stamp.setter def last_seen_time_stamp(self, val): if self._readonly: raise ValueError("This VgpuProcessesUtilizationInfo_v1 instance is read-only") self._ptr[0].lastSeenTimeStamp = val @property def vgpu_proc_util_array(self): """int: The array (allocated by caller) in which utilization of processes running on vGPU instances are returned.""" if self._ptr[0].vgpuProcUtilArray == NULL or self._ptr[0].vgpuProcessCount == 0: return [] return VgpuProcessUtilizationInfo_v1.from_ptr( (self._ptr[0].vgpuProcUtilArray), self._ptr[0].vgpuProcessCount, owner=self, readonly=self._readonly ) @vgpu_proc_util_array.setter def vgpu_proc_util_array(self, val): if self._readonly: raise ValueError("This VgpuProcessesUtilizationInfo_v1 instance is read-only") cdef VgpuProcessUtilizationInfo_v1 arr = val self._ptr[0].vgpuProcUtilArray = (arr._get_ptr()) self._ptr[0].vgpuProcessCount = len(arr) self._refs["vgpu_proc_util_array"] = arr @staticmethod def from_buffer(buffer): """Create an VgpuProcessesUtilizationInfo_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t), VgpuProcessesUtilizationInfo_v1) @staticmethod def from_data(data): """Create an VgpuProcessesUtilizationInfo_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `vgpu_processes_utilization_info_v1_dtype` holding the data. """ return _cyb_from_data(data, "vgpu_processes_utilization_info_v1_dtype", vgpu_processes_utilization_info_v1_dtype, VgpuProcessesUtilizationInfo_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an VgpuProcessesUtilizationInfo_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef VgpuProcessesUtilizationInfo_v1 obj = VgpuProcessesUtilizationInfo_v1.__new__(VgpuProcessesUtilizationInfo_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly obj._refs = {} return obj cdef _get_vgpu_scheduler_params_dtype_offsets(): cdef nvmlVgpuSchedulerParams_t *pod = _cyb_calloc(1, sizeof(nvmlVgpuSchedulerParams_t)) if pod == NULL: raise MemoryError("Error allocating nvmlVgpuSchedulerParams_t") try: return _numpy.dtype({ 'names': ['vgpu_sched_data_with_arr', 'vgpu_sched_data'], 'formats': [_py_anon_pod2_dtype, _py_anon_pod3_dtype], 'offsets': [ (&(pod.vgpuSchedDataWithARR)) - (pod), (&(pod.vgpuSchedData)) - (pod), ], 'itemsize': sizeof(nvmlVgpuSchedulerParams_t), }) finally: _cyb_free(pod) vgpu_scheduler_params_dtype = _get_vgpu_scheduler_params_dtype_offsets() cdef class VgpuSchedulerParams: """Empty-initialize an instance of `nvmlVgpuSchedulerParams_t`. .. seealso:: `nvmlVgpuSchedulerParams_t` """ cdef: nvmlVgpuSchedulerParams_t *_ptr object _owner 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._readonly = False def __dealloc__(self): cdef nvmlVgpuSchedulerParams_t *ptr if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) def __repr__(self): return f"<{__name__}.VgpuSchedulerParams object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef VgpuSchedulerParams other_ if not isinstance(other, VgpuSchedulerParams): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuSchedulerParams_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuSchedulerParams_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def vgpu_sched_data_with_arr(self): """_py_anon_pod2: """ return _py_anon_pod2.from_ptr( &(self._ptr[0].vgpuSchedDataWithARR), readonly=self._readonly, owner=self, ) @vgpu_sched_data_with_arr.setter def vgpu_sched_data_with_arr(self, val): if self._readonly: raise ValueError("This VgpuSchedulerParams instance is read-only") cdef _py_anon_pod2 val_ = val _cyb_memcpy(&(self._ptr[0].vgpuSchedDataWithARR), (val_._get_ptr()), sizeof(cuda_bindings_nvml__anon_pod2) * 1) @property def vgpu_sched_data(self): """_py_anon_pod3: """ return _py_anon_pod3.from_ptr( &(self._ptr[0].vgpuSchedData), readonly=self._readonly, owner=self, ) @vgpu_sched_data.setter def vgpu_sched_data(self, val): if self._readonly: raise ValueError("This VgpuSchedulerParams instance is read-only") cdef _py_anon_pod3 val_ = val _cyb_memcpy(&(self._ptr[0].vgpuSchedData), (val_._get_ptr()), sizeof(cuda_bindings_nvml__anon_pod3) * 1) @staticmethod def from_buffer(buffer): """Create an VgpuSchedulerParams instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlVgpuSchedulerParams_t), VgpuSchedulerParams) @staticmethod def from_data(data): """Create an VgpuSchedulerParams instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `vgpu_scheduler_params_dtype` holding the data. """ return _cyb_from_data(data, "vgpu_scheduler_params_dtype", vgpu_scheduler_params_dtype, VgpuSchedulerParams) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an VgpuSchedulerParams instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef VgpuSchedulerParams obj = VgpuSchedulerParams.__new__(VgpuSchedulerParams) if owner is None: obj._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerParams_t)) if obj._ptr == NULL: raise MemoryError("Error allocating VgpuSchedulerParams") _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerParams_t)) obj._owns_ptr = True obj._owner = None else: obj._ptr = ptr obj._owns_ptr = False obj._owner = owner obj._readonly = readonly return obj cdef _get_vgpu_scheduler_set_params_dtype_offsets(): cdef nvmlVgpuSchedulerSetParams_t *pod = _cyb_calloc(1, sizeof(nvmlVgpuSchedulerSetParams_t)) if pod == NULL: raise MemoryError("Error allocating nvmlVgpuSchedulerSetParams_t") try: return _numpy.dtype({ 'names': ['vgpu_sched_data_with_arr', 'vgpu_sched_data'], 'formats': [_py_anon_pod4_dtype, _py_anon_pod5_dtype], 'offsets': [ (&(pod.vgpuSchedDataWithARR)) - (pod), (&(pod.vgpuSchedData)) - (pod), ], 'itemsize': sizeof(nvmlVgpuSchedulerSetParams_t), }) finally: _cyb_free(pod) vgpu_scheduler_set_params_dtype = _get_vgpu_scheduler_set_params_dtype_offsets() cdef class VgpuSchedulerSetParams: """Empty-initialize an instance of `nvmlVgpuSchedulerSetParams_t`. .. seealso:: `nvmlVgpuSchedulerSetParams_t` """ cdef: nvmlVgpuSchedulerSetParams_t *_ptr object _owner 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._readonly = False def __dealloc__(self): cdef nvmlVgpuSchedulerSetParams_t *ptr if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) def __repr__(self): return f"<{__name__}.VgpuSchedulerSetParams object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef VgpuSchedulerSetParams other_ if not isinstance(other, VgpuSchedulerSetParams): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuSchedulerSetParams_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuSchedulerSetParams_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def vgpu_sched_data_with_arr(self): """_py_anon_pod4: """ return _py_anon_pod4.from_ptr( &(self._ptr[0].vgpuSchedDataWithARR), readonly=self._readonly, owner=self, ) @vgpu_sched_data_with_arr.setter def vgpu_sched_data_with_arr(self, val): if self._readonly: raise ValueError("This VgpuSchedulerSetParams instance is read-only") cdef _py_anon_pod4 val_ = val _cyb_memcpy(&(self._ptr[0].vgpuSchedDataWithARR), (val_._get_ptr()), sizeof(cuda_bindings_nvml__anon_pod4) * 1) @property def vgpu_sched_data(self): """_py_anon_pod5: """ return _py_anon_pod5.from_ptr( &(self._ptr[0].vgpuSchedData), readonly=self._readonly, owner=self, ) @vgpu_sched_data.setter def vgpu_sched_data(self, val): if self._readonly: raise ValueError("This VgpuSchedulerSetParams instance is read-only") cdef _py_anon_pod5 val_ = val _cyb_memcpy(&(self._ptr[0].vgpuSchedData), (val_._get_ptr()), sizeof(cuda_bindings_nvml__anon_pod5) * 1) @staticmethod def from_buffer(buffer): """Create an VgpuSchedulerSetParams instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlVgpuSchedulerSetParams_t), VgpuSchedulerSetParams) @staticmethod def from_data(data): """Create an VgpuSchedulerSetParams instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `vgpu_scheduler_set_params_dtype` holding the data. """ return _cyb_from_data(data, "vgpu_scheduler_set_params_dtype", vgpu_scheduler_set_params_dtype, VgpuSchedulerSetParams) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an VgpuSchedulerSetParams instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef VgpuSchedulerSetParams obj = VgpuSchedulerSetParams.__new__(VgpuSchedulerSetParams) if owner is None: obj._ptr = _cyb_malloc(sizeof(nvmlVgpuSchedulerSetParams_t)) if obj._ptr == NULL: raise MemoryError("Error allocating VgpuSchedulerSetParams") _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlVgpuSchedulerSetParams_t)) obj._owns_ptr = True obj._owner = None else: obj._ptr = ptr obj._owns_ptr = False obj._owner = owner obj._readonly = readonly return obj cdef _get_vgpu_license_info_dtype_offsets(): cdef nvmlVgpuLicenseInfo_t *pod = _cyb_calloc(1, sizeof(nvmlVgpuLicenseInfo_t)) if pod == NULL: raise MemoryError("Error allocating nvmlVgpuLicenseInfo_t") try: return _numpy.dtype({ 'names': ['is_licensed', 'license_expiry', 'current_state'], 'formats': [_numpy.uint8, vgpu_license_expiry_dtype, _numpy.uint32], 'offsets': [ (&(pod.isLicensed)) - (pod), (&(pod.licenseExpiry)) - (pod), (&(pod.currentState)) - (pod), ], 'itemsize': sizeof(nvmlVgpuLicenseInfo_t), }) finally: _cyb_free(pod) vgpu_license_info_dtype = _get_vgpu_license_info_dtype_offsets() cdef class VgpuLicenseInfo: """Empty-initialize an instance of `nvmlVgpuLicenseInfo_t`. .. seealso:: `nvmlVgpuLicenseInfo_t` """ cdef: nvmlVgpuLicenseInfo_t _data nvmlVgpuLicenseInfo_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.VgpuLicenseInfo object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef VgpuLicenseInfo other_ if not isinstance(other, VgpuLicenseInfo): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuLicenseInfo_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuLicenseInfo_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def license_expiry(self): """VgpuLicenseExpiry: """ return VgpuLicenseExpiry.from_ptr( &(self._ptr[0].licenseExpiry), readonly=self._readonly, owner=self, ) @license_expiry.setter def license_expiry(self, val): if self._readonly: raise ValueError("This VgpuLicenseInfo instance is read-only") cdef VgpuLicenseExpiry val_ = val _cyb_memcpy(&(self._ptr[0].licenseExpiry), (val_._get_ptr()), sizeof(nvmlVgpuLicenseExpiry_t) * 1) @property def is_licensed(self): """int: """ return self._ptr[0].isLicensed @is_licensed.setter def is_licensed(self, val): if self._readonly: raise ValueError("This VgpuLicenseInfo instance is read-only") self._ptr[0].isLicensed = val @property def current_state(self): """int: """ return self._ptr[0].currentState @current_state.setter def current_state(self, val): if self._readonly: raise ValueError("This VgpuLicenseInfo instance is read-only") self._ptr[0].currentState = val @staticmethod def from_buffer(buffer): """Create an VgpuLicenseInfo instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlVgpuLicenseInfo_t), VgpuLicenseInfo) @staticmethod def from_data(data): """Create an VgpuLicenseInfo instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `vgpu_license_info_dtype` holding the data. """ return _cyb_from_data(data, "vgpu_license_info_dtype", vgpu_license_info_dtype, VgpuLicenseInfo) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an VgpuLicenseInfo instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef VgpuLicenseInfo obj = VgpuLicenseInfo.__new__(VgpuLicenseInfo) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlVgpuLicenseInfo_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_grid_licensable_feature_dtype_offsets(): cdef nvmlGridLicensableFeature_t *pod = _cyb_calloc(1, sizeof(nvmlGridLicensableFeature_t)) if pod == NULL: raise MemoryError("Error allocating nvmlGridLicensableFeature_t") try: return _numpy.dtype({ 'names': ['feature_code', 'feature_state', 'license_info', 'product_name', 'feature_enabled', 'license_expiry'], 'formats': [_numpy.int32, _numpy.uint32, (_numpy.int8, 128), (_numpy.int8, 128), _numpy.uint32, grid_license_expiry_dtype], 'offsets': [ (&(pod.featureCode)) - (pod), (&(pod.featureState)) - (pod), (&(pod.licenseInfo)) - (pod), (&(pod.productName)) - (pod), (&(pod.featureEnabled)) - (pod), (&(pod.licenseExpiry)) - (pod), ], 'itemsize': sizeof(nvmlGridLicensableFeature_t), }) finally: _cyb_free(pod) grid_licensable_feature_dtype = _get_grid_licensable_feature_dtype_offsets() cdef object grid_licensable_feature_dtype_record = _numpy.dtype((_numpy.record, grid_licensable_feature_dtype)) cdef class GridLicensableFeature: """Empty-initialize an array of `nvmlGridLicensableFeature_t`. The resulting object is of length `size` and of dtype `grid_licensable_feature_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `nvmlGridLicensableFeature_t` """ cdef: readonly object _data object _owner def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=grid_licensable_feature_dtype_record) assert self._data.itemsize == sizeof(nvmlGridLicensableFeature_t), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlGridLicensableFeature_t) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}.GridLicensableFeature_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}.GridLicensableFeature object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, GridLicensableFeature)) 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 feature_code(self): """Union[~_numpy.int32, int]: """ if self._data.size == 1: return int(self._data["feature_code"][0]) return self._data["feature_code"] @feature_code.setter def feature_code(self, val): if not self._data.flags.writeable: raise ValueError("This GridLicensableFeature instance is read-only") self._data["feature_code"] = val @property def feature_state(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["feature_state"][0]) return self._data["feature_state"] @feature_state.setter def feature_state(self, val): if not self._data.flags.writeable: raise ValueError("This GridLicensableFeature instance is read-only") self._data["feature_state"] = val @property def license_info(self): """~_numpy.int8: (array of length 128).""" return self._data["license_info"] @license_info.setter def license_info(self, val): if not self._data.flags.writeable: raise ValueError("This GridLicensableFeature instance is read-only") self._data["license_info"] = val @property def product_name(self): """~_numpy.int8: (array of length 128).""" return self._data["product_name"] @product_name.setter def product_name(self, val): if not self._data.flags.writeable: raise ValueError("This GridLicensableFeature instance is read-only") self._data["product_name"] = val @property def feature_enabled(self): """Union[~_numpy.uint32, int]: """ if self._data.size == 1: return int(self._data["feature_enabled"][0]) return self._data["feature_enabled"] @feature_enabled.setter def feature_enabled(self, val): if not self._data.flags.writeable: raise ValueError("This GridLicensableFeature instance is read-only") self._data["feature_enabled"] = val @property def license_expiry(self): """grid_license_expiry_dtype: """ return self._data["license_expiry"].view(_numpy.recarray) @license_expiry.setter def license_expiry(self, val): if not self._data.flags.writeable: raise ValueError("This GridLicensableFeature instance is read-only") self._data["license_expiry"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef GridLicensableFeature obj 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 obj = GridLicensableFeature.__new__(GridLicensableFeature) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == grid_licensable_feature_dtype: obj = GridLicensableFeature.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an GridLicensableFeature instance with the memory from the given buffer.""" return GridLicensableFeature.from_data(_numpy.frombuffer(buffer, dtype=grid_licensable_feature_dtype)) @staticmethod def from_data(data): """Create an GridLicensableFeature instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `grid_licensable_feature_dtype` holding the data. """ cdef GridLicensableFeature obj = GridLicensableFeature.__new__(GridLicensableFeature) 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 != grid_licensable_feature_dtype: raise ValueError("data array must be of dtype grid_licensable_feature_dtype") obj._data = data.view(dtype=grid_licensable_feature_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an GridLicensableFeature 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 GridLicensableFeature obj = GridLicensableFeature.__new__(GridLicensableFeature) 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(nvmlGridLicensableFeature_t) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=grid_licensable_feature_dtype_record) obj._owner = owner return obj cdef _get_unit_fan_speeds_dtype_offsets(): cdef nvmlUnitFanSpeeds_t *pod = _cyb_calloc(1, sizeof(nvmlUnitFanSpeeds_t)) if pod == NULL: raise MemoryError("Error allocating nvmlUnitFanSpeeds_t") try: return _numpy.dtype({ 'names': ['fans', 'count'], 'formats': [(unit_fan_info_dtype, 24), _numpy.uint32], 'offsets': [ (&(pod.fans)) - (pod), (&(pod.count)) - (pod), ], 'itemsize': sizeof(nvmlUnitFanSpeeds_t), }) finally: _cyb_free(pod) unit_fan_speeds_dtype = _get_unit_fan_speeds_dtype_offsets() cdef class UnitFanSpeeds: """Empty-initialize an instance of `nvmlUnitFanSpeeds_t`. .. seealso:: `nvmlUnitFanSpeeds_t` """ cdef: nvmlUnitFanSpeeds_t _data nvmlUnitFanSpeeds_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.UnitFanSpeeds object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef UnitFanSpeeds other_ if not isinstance(other, UnitFanSpeeds): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlUnitFanSpeeds_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlUnitFanSpeeds_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def fans(self): """UnitFanInfo: """ return UnitFanInfo.from_ptr( &(self._ptr[0].fans), 24, readonly=self._readonly, owner=self, ) @fans.setter def fans(self, val): if self._readonly: raise ValueError("This UnitFanSpeeds instance is read-only") cdef UnitFanInfo val_ = val if len(val) != 24: raise ValueError(f"Expected length { 24 } for field fans, got {len(val)}") _cyb_memcpy(&(self._ptr[0].fans), (val_._get_ptr()), sizeof(nvmlUnitFanInfo_t) * 24) @property def count(self): """int: """ return self._ptr[0].count @count.setter def count(self, val): if self._readonly: raise ValueError("This UnitFanSpeeds instance is read-only") self._ptr[0].count = val @staticmethod def from_buffer(buffer): """Create an UnitFanSpeeds instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlUnitFanSpeeds_t), UnitFanSpeeds) @staticmethod def from_data(data): """Create an UnitFanSpeeds instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `unit_fan_speeds_dtype` holding the data. """ return _cyb_from_data(data, "unit_fan_speeds_dtype", unit_fan_speeds_dtype, UnitFanSpeeds) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an UnitFanSpeeds instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef UnitFanSpeeds obj = UnitFanSpeeds.__new__(UnitFanSpeeds) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlUnitFanSpeeds_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_vgpu_pgpu_metadata_dtype_offsets(): cdef nvmlVgpuPgpuMetadata_t *pod = _cyb_calloc(1, sizeof(nvmlVgpuPgpuMetadata_t)) if pod == NULL: raise MemoryError("Error allocating nvmlVgpuPgpuMetadata_t") try: return _numpy.dtype({ 'names': ['version', 'revision', 'host_driver_version', 'pgpu_virtualization_caps', 'reserved', 'host_supported_vgpu_range', 'opaque_data_size', 'opaque_data'], 'formats': [_numpy.uint32, _numpy.uint32, (_numpy.int8, 80), _numpy.uint32, (_numpy.uint32, 5), vgpu_version_dtype, _numpy.uint32, (_numpy.int8, 4)], 'offsets': [ (&(pod.version)) - (pod), (&(pod.revision)) - (pod), (&(pod.hostDriverVersion)) - (pod), (&(pod.pgpuVirtualizationCaps)) - (pod), (&(pod.reserved)) - (pod), (&(pod.hostSupportedVgpuRange)) - (pod), (&(pod.opaqueDataSize)) - (pod), (&(pod.opaqueData)) - (pod), ], 'itemsize': sizeof(nvmlVgpuPgpuMetadata_t), }) finally: _cyb_free(pod) vgpu_pgpu_metadata_dtype = _get_vgpu_pgpu_metadata_dtype_offsets() cdef class VgpuPgpuMetadata: """Empty-initialize an instance of `nvmlVgpuPgpuMetadata_t`. .. seealso:: `nvmlVgpuPgpuMetadata_t` """ cdef: nvmlVgpuPgpuMetadata_t _data nvmlVgpuPgpuMetadata_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.VgpuPgpuMetadata object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef VgpuPgpuMetadata other_ if not isinstance(other, VgpuPgpuMetadata): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuPgpuMetadata_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuPgpuMetadata_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def host_supported_vgpu_range(self): """VgpuVersion: """ return VgpuVersion.from_ptr( &(self._ptr[0].hostSupportedVgpuRange), readonly=self._readonly, owner=self, ) @host_supported_vgpu_range.setter def host_supported_vgpu_range(self, val): if self._readonly: raise ValueError("This VgpuPgpuMetadata instance is read-only") cdef VgpuVersion val_ = val _cyb_memcpy(&(self._ptr[0].hostSupportedVgpuRange), (val_._get_ptr()), sizeof(nvmlVgpuVersion_t) * 1) @property def version(self): """int: """ return self._ptr[0].version @version.setter def version(self, val): if self._readonly: raise ValueError("This VgpuPgpuMetadata instance is read-only") self._ptr[0].version = val @property def revision(self): """int: """ return self._ptr[0].revision @revision.setter def revision(self, val): if self._readonly: raise ValueError("This VgpuPgpuMetadata instance is read-only") self._ptr[0].revision = val @property def host_driver_version(self): """~_numpy.int8: (array of length 80).""" return _cyb_cpython.PyUnicode_FromString(self._ptr[0].hostDriverVersion) @host_driver_version.setter def host_driver_version(self, val): if self._readonly: raise ValueError("This VgpuPgpuMetadata instance is read-only") cdef bytes buf = val.encode() if len(buf) >= 80: raise ValueError("String too long for field host_driver_version, max length is 79") cdef char *ptr = buf _cyb_memcpy((self._ptr[0].hostDriverVersion), ptr, 80) @property def pgpu_virtualization_caps(self): """int: """ return self._ptr[0].pgpuVirtualizationCaps @pgpu_virtualization_caps.setter def pgpu_virtualization_caps(self, val): if self._readonly: raise ValueError("This VgpuPgpuMetadata instance is read-only") self._ptr[0].pgpuVirtualizationCaps = val @property def opaque_data_size(self): """int: """ return self._ptr[0].opaqueDataSize @opaque_data_size.setter def opaque_data_size(self, val): if self._readonly: raise ValueError("This VgpuPgpuMetadata instance is read-only") self._ptr[0].opaqueDataSize = val @property def opaque_data(self): """~_numpy.int8: (array of length 4).""" return _cyb_cpython.PyUnicode_FromString(self._ptr[0].opaqueData) @opaque_data.setter def opaque_data(self, val): if self._readonly: raise ValueError("This VgpuPgpuMetadata instance is read-only") cdef bytes buf = val.encode() if len(buf) >= 4: raise ValueError("String too long for field opaque_data, max length is 3") cdef char *ptr = buf _cyb_memcpy((self._ptr[0].opaqueData), ptr, 4) @staticmethod def from_buffer(buffer): """Create an VgpuPgpuMetadata instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlVgpuPgpuMetadata_t), VgpuPgpuMetadata) @staticmethod def from_data(data): """Create an VgpuPgpuMetadata instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `vgpu_pgpu_metadata_dtype` holding the data. """ return _cyb_from_data(data, "vgpu_pgpu_metadata_dtype", vgpu_pgpu_metadata_dtype, VgpuPgpuMetadata) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an VgpuPgpuMetadata instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef VgpuPgpuMetadata obj = VgpuPgpuMetadata.__new__(VgpuPgpuMetadata) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlVgpuPgpuMetadata_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_gpu_instance_info_dtype_offsets(): cdef nvmlGpuInstanceInfo_t *pod = _cyb_calloc(1, sizeof(nvmlGpuInstanceInfo_t)) if pod == NULL: raise MemoryError("Error allocating nvmlGpuInstanceInfo_t") try: return _numpy.dtype({ 'names': ['device_', 'id', 'profile_id', 'placement'], 'formats': [_numpy.intp, _numpy.uint32, _numpy.uint32, gpu_instance_placement_dtype], 'offsets': [ (&(pod.device)) - (pod), (&(pod.id)) - (pod), (&(pod.profileId)) - (pod), (&(pod.placement)) - (pod), ], 'itemsize': sizeof(nvmlGpuInstanceInfo_t), }) finally: _cyb_free(pod) gpu_instance_info_dtype = _get_gpu_instance_info_dtype_offsets() cdef class GpuInstanceInfo: """Empty-initialize an instance of `nvmlGpuInstanceInfo_t`. .. seealso:: `nvmlGpuInstanceInfo_t` """ cdef: nvmlGpuInstanceInfo_t _data nvmlGpuInstanceInfo_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.GpuInstanceInfo object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef GpuInstanceInfo other_ if not isinstance(other, GpuInstanceInfo): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlGpuInstanceInfo_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlGpuInstanceInfo_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def placement(self): """GpuInstancePlacement: """ return GpuInstancePlacement.from_ptr( &(self._ptr[0].placement), 1, readonly=self._readonly, owner=self, ) @placement.setter def placement(self, val): if self._readonly: raise ValueError("This GpuInstanceInfo instance is read-only") cdef GpuInstancePlacement val_ = val _cyb_memcpy(&(self._ptr[0].placement), (val_._get_ptr()), sizeof(nvmlGpuInstancePlacement_t) * 1) @property def device_(self): """int: """ return (self._ptr[0].device) @device_.setter def device_(self, val): if self._readonly: raise ValueError("This GpuInstanceInfo instance is read-only") self._ptr[0].device = val @property def id(self): """int: """ return self._ptr[0].id @id.setter def id(self, val): if self._readonly: raise ValueError("This GpuInstanceInfo instance is read-only") self._ptr[0].id = val @property def profile_id(self): """int: """ return self._ptr[0].profileId @profile_id.setter def profile_id(self, val): if self._readonly: raise ValueError("This GpuInstanceInfo instance is read-only") self._ptr[0].profileId = val @staticmethod def from_buffer(buffer): """Create an GpuInstanceInfo instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlGpuInstanceInfo_t), GpuInstanceInfo) @staticmethod def from_data(data): """Create an GpuInstanceInfo instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `gpu_instance_info_dtype` holding the data. """ return _cyb_from_data(data, "gpu_instance_info_dtype", gpu_instance_info_dtype, GpuInstanceInfo) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an GpuInstanceInfo instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef GpuInstanceInfo obj = GpuInstanceInfo.__new__(GpuInstanceInfo) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlGpuInstanceInfo_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_compute_instance_info_dtype_offsets(): cdef nvmlComputeInstanceInfo_t *pod = _cyb_calloc(1, sizeof(nvmlComputeInstanceInfo_t)) if pod == NULL: raise MemoryError("Error allocating nvmlComputeInstanceInfo_t") try: return _numpy.dtype({ 'names': ['device_', 'gpu_instance', 'id', 'profile_id', 'placement'], 'formats': [_numpy.intp, _numpy.intp, _numpy.uint32, _numpy.uint32, compute_instance_placement_dtype], 'offsets': [ (&(pod.device)) - (pod), (&(pod.gpuInstance)) - (pod), (&(pod.id)) - (pod), (&(pod.profileId)) - (pod), (&(pod.placement)) - (pod), ], 'itemsize': sizeof(nvmlComputeInstanceInfo_t), }) finally: _cyb_free(pod) compute_instance_info_dtype = _get_compute_instance_info_dtype_offsets() cdef class ComputeInstanceInfo: """Empty-initialize an instance of `nvmlComputeInstanceInfo_t`. .. seealso:: `nvmlComputeInstanceInfo_t` """ cdef: nvmlComputeInstanceInfo_t _data nvmlComputeInstanceInfo_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.ComputeInstanceInfo object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef ComputeInstanceInfo other_ if not isinstance(other, ComputeInstanceInfo): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlComputeInstanceInfo_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlComputeInstanceInfo_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def placement(self): """ComputeInstancePlacement: """ return ComputeInstancePlacement.from_ptr( &(self._ptr[0].placement), 1, readonly=self._readonly, owner=self, ) @placement.setter def placement(self, val): if self._readonly: raise ValueError("This ComputeInstanceInfo instance is read-only") cdef ComputeInstancePlacement val_ = val _cyb_memcpy(&(self._ptr[0].placement), (val_._get_ptr()), sizeof(nvmlComputeInstancePlacement_t) * 1) @property def device_(self): """int: """ return (self._ptr[0].device) @device_.setter def device_(self, val): if self._readonly: raise ValueError("This ComputeInstanceInfo instance is read-only") self._ptr[0].device = val @property def gpu_instance(self): """int: """ return (self._ptr[0].gpuInstance) @gpu_instance.setter def gpu_instance(self, val): if self._readonly: raise ValueError("This ComputeInstanceInfo instance is read-only") self._ptr[0].gpuInstance = val @property def id(self): """int: """ return self._ptr[0].id @id.setter def id(self, val): if self._readonly: raise ValueError("This ComputeInstanceInfo instance is read-only") self._ptr[0].id = val @property def profile_id(self): """int: """ return self._ptr[0].profileId @profile_id.setter def profile_id(self, val): if self._readonly: raise ValueError("This ComputeInstanceInfo instance is read-only") self._ptr[0].profileId = val @staticmethod def from_buffer(buffer): """Create an ComputeInstanceInfo instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlComputeInstanceInfo_t), ComputeInstanceInfo) @staticmethod def from_data(data): """Create an ComputeInstanceInfo instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `compute_instance_info_dtype` holding the data. """ return _cyb_from_data(data, "compute_instance_info_dtype", compute_instance_info_dtype, ComputeInstanceInfo) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an ComputeInstanceInfo instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef ComputeInstanceInfo obj = ComputeInstanceInfo.__new__(ComputeInstanceInfo) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlComputeInstanceInfo_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_ecc_sram_unique_uncorrected_error_counts_v1_dtype_offsets(): cdef nvmlEccSramUniqueUncorrectedErrorCounts_v1_t *pod = _cyb_calloc(1, sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlEccSramUniqueUncorrectedErrorCounts_v1_t") try: return _numpy.dtype({ 'names': ['version', 'entry_count', 'entries'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.intp], 'offsets': [ (&(pod.version)) - (pod), (&(pod.entryCount)) - (pod), (&(pod.entries)) - (pod), ], 'itemsize': sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t), }) finally: _cyb_free(pod) ecc_sram_unique_uncorrected_error_counts_v1_dtype = _get_ecc_sram_unique_uncorrected_error_counts_v1_dtype_offsets() cdef class EccSramUniqueUncorrectedErrorCounts_v1: """Empty-initialize an instance of `nvmlEccSramUniqueUncorrectedErrorCounts_v1_t`. .. seealso:: `nvmlEccSramUniqueUncorrectedErrorCounts_v1_t` """ cdef: nvmlEccSramUniqueUncorrectedErrorCounts_v1_t _data nvmlEccSramUniqueUncorrectedErrorCounts_v1_t *_ptr object _owner bint _readonly dict _refs def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False self._refs = {} def __repr__(self): return f"<{__name__}.EccSramUniqueUncorrectedErrorCounts_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef EccSramUniqueUncorrectedErrorCounts_v1 other_ if not isinstance(other, EccSramUniqueUncorrectedErrorCounts_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def version(self): """int: the API version number""" return self._ptr[0].version @version.setter def version(self, val): if self._readonly: raise ValueError("This EccSramUniqueUncorrectedErrorCounts_v1 instance is read-only") self._ptr[0].version = val @property def entries(self): """int: pointer to caller-supplied buffer to return the SRAM unique uncorrected ECC error count entries""" if self._ptr[0].entries == NULL or self._ptr[0].entryCount == 0: return [] return EccSramUniqueUncorrectedErrorEntry_v1.from_ptr( (self._ptr[0].entries), self._ptr[0].entryCount, owner=self, readonly=self._readonly ) @entries.setter def entries(self, val): if self._readonly: raise ValueError("This EccSramUniqueUncorrectedErrorCounts_v1 instance is read-only") cdef EccSramUniqueUncorrectedErrorEntry_v1 arr = val self._ptr[0].entries = (arr._get_ptr()) self._ptr[0].entryCount = len(arr) self._refs["entries"] = arr @staticmethod def from_buffer(buffer): """Create an EccSramUniqueUncorrectedErrorCounts_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t), EccSramUniqueUncorrectedErrorCounts_v1) @staticmethod def from_data(data): """Create an EccSramUniqueUncorrectedErrorCounts_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `ecc_sram_unique_uncorrected_error_counts_v1_dtype` holding the data. """ return _cyb_from_data(data, "ecc_sram_unique_uncorrected_error_counts_v1_dtype", ecc_sram_unique_uncorrected_error_counts_v1_dtype, EccSramUniqueUncorrectedErrorCounts_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an EccSramUniqueUncorrectedErrorCounts_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef EccSramUniqueUncorrectedErrorCounts_v1 obj = EccSramUniqueUncorrectedErrorCounts_v1.__new__(EccSramUniqueUncorrectedErrorCounts_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly obj._refs = {} return obj cdef _get_nvlink_firmware_info_dtype_offsets(): cdef nvmlNvlinkFirmwareInfo_t *pod = _cyb_calloc(1, sizeof(nvmlNvlinkFirmwareInfo_t)) if pod == NULL: raise MemoryError("Error allocating nvmlNvlinkFirmwareInfo_t") try: return _numpy.dtype({ 'names': ['firmware_version', 'num_valid_entries'], 'formats': [(nvlink_firmware_version_dtype, 100), _numpy.uint32], 'offsets': [ (&(pod.firmwareVersion)) - (pod), (&(pod.numValidEntries)) - (pod), ], 'itemsize': sizeof(nvmlNvlinkFirmwareInfo_t), }) finally: _cyb_free(pod) nvlink_firmware_info_dtype = _get_nvlink_firmware_info_dtype_offsets() cdef class NvlinkFirmwareInfo: """Empty-initialize an instance of `nvmlNvlinkFirmwareInfo_t`. .. seealso:: `nvmlNvlinkFirmwareInfo_t` """ cdef: nvmlNvlinkFirmwareInfo_t *_ptr object _owner 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._readonly = False def __dealloc__(self): cdef nvmlNvlinkFirmwareInfo_t *ptr if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) def __repr__(self): return f"<{__name__}.NvlinkFirmwareInfo object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef NvlinkFirmwareInfo other_ if not isinstance(other, NvlinkFirmwareInfo): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlNvlinkFirmwareInfo_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlNvlinkFirmwareInfo_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def firmware_version(self): """NvlinkFirmwareVersion: OUT - NVLINK firmware version.""" return NvlinkFirmwareVersion.from_ptr( &(self._ptr[0].firmwareVersion), self._ptr[0].numValidEntries, readonly=self._readonly, owner=self, ) @firmware_version.setter def firmware_version(self, val): 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)}") 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): """Create an NvlinkFirmwareInfo instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlNvlinkFirmwareInfo_t), NvlinkFirmwareInfo) @staticmethod def from_data(data): """Create an NvlinkFirmwareInfo instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `nvlink_firmware_info_dtype` holding the data. """ return _cyb_from_data(data, "nvlink_firmware_info_dtype", nvlink_firmware_info_dtype, NvlinkFirmwareInfo) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an NvlinkFirmwareInfo instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef NvlinkFirmwareInfo obj = NvlinkFirmwareInfo.__new__(NvlinkFirmwareInfo) if owner is None: obj._ptr = _cyb_malloc(sizeof(nvmlNvlinkFirmwareInfo_t)) if obj._ptr == NULL: raise MemoryError("Error allocating NvlinkFirmwareInfo") _cyb_memcpy((obj._ptr), ptr, sizeof(nvmlNvlinkFirmwareInfo_t)) obj._owns_ptr = True obj._owner = None else: obj._ptr = ptr obj._owns_ptr = False obj._owner = owner obj._readonly = readonly return obj cdef _get_vgpu_scheduler_log_info_v2_dtype_offsets(): cdef nvmlVgpuSchedulerLogInfo_v2_t *pod = _cyb_calloc(1, sizeof(nvmlVgpuSchedulerLogInfo_v2_t)) if pod == NULL: raise MemoryError("Error allocating nvmlVgpuSchedulerLogInfo_v2_t") try: return _numpy.dtype({ 'names': ['engine_id', 'scheduler_policy', 'avg_factor', 'timeslice', 'entries_count', 'log_entries'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, (vgpu_scheduler_log_entry_v2_dtype, 200)], 'offsets': [ (&(pod.engineId)) - (pod), (&(pod.schedulerPolicy)) - (pod), (&(pod.avgFactor)) - (pod), (&(pod.timeslice)) - (pod), (&(pod.entriesCount)) - (pod), (&(pod.logEntries)) - (pod), ], 'itemsize': sizeof(nvmlVgpuSchedulerLogInfo_v2_t), }) finally: _cyb_free(pod) vgpu_scheduler_log_info_v2_dtype = _get_vgpu_scheduler_log_info_v2_dtype_offsets() cdef class VgpuSchedulerLogInfo_v2: """Empty-initialize an instance of `nvmlVgpuSchedulerLogInfo_v2_t`. .. seealso:: `nvmlVgpuSchedulerLogInfo_v2_t` """ cdef: nvmlVgpuSchedulerLogInfo_v2_t _data nvmlVgpuSchedulerLogInfo_v2_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.VgpuSchedulerLogInfo_v2 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef VgpuSchedulerLogInfo_v2 other_ if not isinstance(other, VgpuSchedulerLogInfo_v2): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuSchedulerLogInfo_v2_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuSchedulerLogInfo_v2_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def log_entries(self): """VgpuSchedulerLogEntry_v2: OUT: Structure to store the state and logs of a software runlist.""" return VgpuSchedulerLogEntry_v2.from_ptr( &(self._ptr[0].logEntries), 200, readonly=self._readonly, owner=self, ) @log_entries.setter def log_entries(self, val): if self._readonly: raise ValueError("This VgpuSchedulerLogInfo_v2 instance is read-only") cdef VgpuSchedulerLogEntry_v2 val_ = val if len(val) != 200: raise ValueError(f"Expected length { 200 } for field log_entries, got {len(val)}") _cyb_memcpy(&(self._ptr[0].logEntries), (val_._get_ptr()), sizeof(nvmlVgpuSchedulerLogEntry_v2_t) * 200) @property def engine_id(self): """int: IN: Engine whose software runlist log entries are fetched. One of One of NVML_VGPU_SCHEDULER_ENGINE_TYPE_*.""" return self._ptr[0].engineId @engine_id.setter def engine_id(self, val): if self._readonly: raise ValueError("This VgpuSchedulerLogInfo_v2 instance is read-only") self._ptr[0].engineId = val @property def scheduler_policy(self): """int: OUT: Scheduler policy.""" return self._ptr[0].schedulerPolicy @scheduler_policy.setter def scheduler_policy(self, val): if self._readonly: raise ValueError("This VgpuSchedulerLogInfo_v2 instance is read-only") self._ptr[0].schedulerPolicy = val @property def avg_factor(self): """int: OUT: Average factor in compensating the timeslice for Adaptive Round Robin mode. 0 when there is no active scheduling.""" return self._ptr[0].avgFactor @avg_factor.setter def avg_factor(self, val): if self._readonly: raise ValueError("This VgpuSchedulerLogInfo_v2 instance is read-only") self._ptr[0].avgFactor = val @property def timeslice(self): """int: OUT: The timeslice in ns for each software run list as configured, or the default value otherwise. 0 when there is no active scheduling.""" return self._ptr[0].timeslice @timeslice.setter def timeslice(self, val): if self._readonly: raise ValueError("This VgpuSchedulerLogInfo_v2 instance is read-only") self._ptr[0].timeslice = val @property def entries_count(self): """int: OUT: Count of log entries fetched.""" return self._ptr[0].entriesCount @entries_count.setter def entries_count(self, val): if self._readonly: raise ValueError("This VgpuSchedulerLogInfo_v2 instance is read-only") self._ptr[0].entriesCount = val @staticmethod def from_buffer(buffer): """Create an VgpuSchedulerLogInfo_v2 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlVgpuSchedulerLogInfo_v2_t), VgpuSchedulerLogInfo_v2) @staticmethod def from_data(data): """Create an VgpuSchedulerLogInfo_v2 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `vgpu_scheduler_log_info_v2_dtype` holding the data. """ return _cyb_from_data(data, "vgpu_scheduler_log_info_v2_dtype", vgpu_scheduler_log_info_v2_dtype, VgpuSchedulerLogInfo_v2) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an VgpuSchedulerLogInfo_v2 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef VgpuSchedulerLogInfo_v2 obj = VgpuSchedulerLogInfo_v2.__new__(VgpuSchedulerLogInfo_v2) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlVgpuSchedulerLogInfo_v2_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_get_cper_v1_dtype_offsets(): cdef nvmlGetCPER_v1_t *pod = _cyb_calloc(1, sizeof(nvmlGetCPER_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlGetCPER_v1_t") try: return _numpy.dtype({ 'names': ['cursor', 'buffer', 'buffer_size'], 'formats': [cper_cursor_v1_dtype, _numpy.intp, _numpy.uint32], 'offsets': [ (&(pod.cursor)) - (pod), (&(pod.buffer)) - (pod), (&(pod.bufferSize)) - (pod), ], 'itemsize': sizeof(nvmlGetCPER_v1_t), }) finally: _cyb_free(pod) get_cper_v1_dtype = _get_get_cper_v1_dtype_offsets() cdef class GetCPER_v1: """Empty-initialize an instance of `nvmlGetCPER_v1_t`. .. seealso:: `nvmlGetCPER_v1_t` """ cdef: nvmlGetCPER_v1_t _data nvmlGetCPER_v1_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.GetCPER_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef GetCPER_v1 other_ if not isinstance(other, GetCPER_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlGetCPER_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlGetCPER_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def cursor(self): """CPERCursor_v1: [IN/OUT] Query parameters and cursor. See `nvmlCPERCursor_v1_t`""" return CPERCursor_v1.from_ptr( &(self._ptr[0].cursor), readonly=self._readonly, owner=self, ) @cursor.setter def cursor(self, val): if self._readonly: raise ValueError("This GetCPER_v1 instance is read-only") cdef CPERCursor_v1 val_ = val _cyb_memcpy(&(self._ptr[0].cursor), (val_._get_ptr()), sizeof(nvmlCPERCursor_v1_t) * 1) @property def buffer(self): """str: [OUT] Buffer to be filled (allocated by client). May be NULL for size query.""" return (self._ptr[0].buffer) @buffer.setter def buffer(self, val): if self._readonly: raise ValueError("This GetCPER_v1 instance is read-only") self._ptr[0].buffer = val @property def buffer_size(self): """int: [IN/OUT] Size of `buffer`. Set to 0 with `buffer` NULL to query required size. On return, set to required or used size; 0 means no (more) records.""" return self._ptr[0].bufferSize @buffer_size.setter def buffer_size(self, val): if self._readonly: raise ValueError("This GetCPER_v1 instance is read-only") self._ptr[0].bufferSize = val @staticmethod def from_buffer(buffer): """Create an GetCPER_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlGetCPER_v1_t), GetCPER_v1) @staticmethod def from_data(data): """Create an GetCPER_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `get_cper_v1_dtype` holding the data. """ return _cyb_from_data(data, "get_cper_v1_dtype", get_cper_v1_dtype, GetCPER_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an GetCPER_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef GetCPER_v1 obj = GetCPER_v1.__new__(GetCPER_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlGetCPER_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_core_rail_metrics_dtype_offsets(): cdef nvmlCoreRailMetrics_t *pod = _cyb_calloc(1, sizeof(nvmlCoreRailMetrics_t)) if pod == NULL: raise MemoryError("Error allocating nvmlCoreRailMetrics_t") try: return _numpy.dtype({ 'names': ['rails'], 'formats': [(rail_metrics_dtype, 2)], 'offsets': [ (&(pod.rails)) - (pod), ], 'itemsize': sizeof(nvmlCoreRailMetrics_t), }) finally: _cyb_free(pod) core_rail_metrics_dtype = _get_core_rail_metrics_dtype_offsets() cdef object core_rail_metrics_dtype_record = _numpy.dtype((_numpy.record, core_rail_metrics_dtype)) cdef class CoreRailMetrics: """Empty-initialize an array of `nvmlCoreRailMetrics_t`. The resulting object is of length `size` and of dtype `core_rail_metrics_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `nvmlCoreRailMetrics_t` """ cdef: readonly object _data object _owner def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=core_rail_metrics_dtype_record) assert self._data.itemsize == sizeof(nvmlCoreRailMetrics_t), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlCoreRailMetrics_t) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}.CoreRailMetrics_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}.CoreRailMetrics object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, CoreRailMetrics)) 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 rails(self): """rail_metrics_dtype: (array of length 2).Array of core rail metrics.""" return self._data["rails"].view(_numpy.recarray) @rails.setter def rails(self, val): if not self._data.flags.writeable: raise ValueError("This CoreRailMetrics instance is read-only") self._data["rails"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef CoreRailMetrics obj 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 obj = CoreRailMetrics.__new__(CoreRailMetrics) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == core_rail_metrics_dtype: obj = CoreRailMetrics.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an CoreRailMetrics instance with the memory from the given buffer.""" return CoreRailMetrics.from_data(_numpy.frombuffer(buffer, dtype=core_rail_metrics_dtype)) @staticmethod def from_data(data): """Create an CoreRailMetrics instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `core_rail_metrics_dtype` holding the data. """ cdef CoreRailMetrics obj = CoreRailMetrics.__new__(CoreRailMetrics) 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 != core_rail_metrics_dtype: raise ValueError("data array must be of dtype core_rail_metrics_dtype") obj._data = data.view(dtype=core_rail_metrics_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an CoreRailMetrics 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 CoreRailMetrics obj = CoreRailMetrics.__new__(CoreRailMetrics) 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(nvmlCoreRailMetrics_t) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=core_rail_metrics_dtype_record) obj._owner = owner return obj cdef _get_pwr_model_metrics_pfpp1x_dtype_offsets(): cdef nvmlPwrModelMetricsPfpp1x_t *pod = _cyb_calloc(1, sizeof(nvmlPwrModelMetricsPfpp1x_t)) if pod == NULL: raise MemoryError("Error allocating nvmlPwrModelMetricsPfpp1x_t") try: return _numpy.dtype({ 'names': ['num_vf_points', 'estimated_metrics', 'b_valid', 'max_perf_per_watt_point', 'fmax_at_vmax_point', 'tgp_headroomm_w'], 'formats': [_numpy.uint8, (pwr_model_metrics_sample_pfpp1x_dtype, 32), _numpy.uint8, pwr_model_operating_point_pfpp1x_dtype, pwr_model_operating_point_pfpp1x_dtype, _numpy.uint32], 'offsets': [ (&(pod.numVfPoints)) - (pod), (&(pod.estimatedMetrics)) - (pod), (&(pod.bValid)) - (pod), (&(pod.maxPerfPerWattPoint)) - (pod), (&(pod.fmaxAtVmaxPoint)) - (pod), (&(pod.tgpHeadroommW)) - (pod), ], 'itemsize': sizeof(nvmlPwrModelMetricsPfpp1x_t), }) finally: _cyb_free(pod) pwr_model_metrics_pfpp1x_dtype = _get_pwr_model_metrics_pfpp1x_dtype_offsets() cdef object pwr_model_metrics_pfpp1x_dtype_record = _numpy.dtype((_numpy.record, pwr_model_metrics_pfpp1x_dtype)) cdef class PwrModelMetricsPfpp1x: """Empty-initialize an array of `nvmlPwrModelMetricsPfpp1x_t`. The resulting object is of length `size` and of dtype `pwr_model_metrics_pfpp1x_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `nvmlPwrModelMetricsPfpp1x_t` """ cdef: readonly object _data object _owner readonly tuple _estimated_metrics def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=pwr_model_metrics_pfpp1x_dtype_record) assert self._data.itemsize == sizeof(nvmlPwrModelMetricsPfpp1x_t), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlPwrModelMetricsPfpp1x_t) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}.PwrModelMetricsPfpp1x_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}.PwrModelMetricsPfpp1x object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, PwrModelMetricsPfpp1x)) 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 estimated_metrics(self): """PwrModelMetricsSamplePfpp1x: Array of estimated metrics for different operating points.""" if self._estimated_metrics is None: estimated_metrics_list = list() estimated_metrics_base = _cyb_array_ptr(self._data) estimated_metrics_offset = pwr_model_metrics_pfpp1x_dtype.fields["estimated_metrics"][1] estimated_metrics_stride = self._data.strides[0] estimated_metrics_readonly = not self._data.flags.writeable estimated_metrics_sizes = self._data["num_vf_points"] for i in range(self._data.size): addr = estimated_metrics_base + i * estimated_metrics_stride + estimated_metrics_offset n = int(estimated_metrics_sizes[i]) estimated_metrics_obj = PwrModelMetricsSamplePfpp1x.from_ptr(addr, n, owner=self, readonly=estimated_metrics_readonly) estimated_metrics_list.append(estimated_metrics_obj) self._estimated_metrics = tuple(estimated_metrics_list) if self._data.size == 1: return self._estimated_metrics[0] return self._estimated_metrics @property def b_valid(self): """Union[~_numpy.uint8, int]: Validity flag: non-zero if metrics are valid.""" if self._data.size == 1: return int(self._data["b_valid"][0]) return self._data["b_valid"] @b_valid.setter def b_valid(self, val): if not self._data.flags.writeable: raise ValueError("This PwrModelMetricsPfpp1x instance is read-only") self._data["b_valid"] = val @property def max_perf_per_watt_point(self): """pwr_model_operating_point_pfpp1x_dtype: Operating point with maximum performance per watt.""" return self._data["max_perf_per_watt_point"].view(_numpy.recarray) @max_perf_per_watt_point.setter def max_perf_per_watt_point(self, val): if not self._data.flags.writeable: raise ValueError("This PwrModelMetricsPfpp1x instance is read-only") self._data["max_perf_per_watt_point"] = val @property def fmax_at_vmax_point(self): """pwr_model_operating_point_pfpp1x_dtype: Operating point at maximum frequency and voltage.""" return self._data["fmax_at_vmax_point"].view(_numpy.recarray) @fmax_at_vmax_point.setter def fmax_at_vmax_point(self, val): if not self._data.flags.writeable: raise ValueError("This PwrModelMetricsPfpp1x instance is read-only") self._data["fmax_at_vmax_point"] = val @property def tgp_headroomm_w(self): """Union[~_numpy.uint32, int]: TGP headroom in milliwatts.""" if self._data.size == 1: return int(self._data["tgp_headroomm_w"][0]) return self._data["tgp_headroomm_w"] @tgp_headroomm_w.setter def tgp_headroomm_w(self, val): if not self._data.flags.writeable: raise ValueError("This PwrModelMetricsPfpp1x instance is read-only") self._data["tgp_headroomm_w"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef PwrModelMetricsPfpp1x obj 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 obj = PwrModelMetricsPfpp1x.__new__(PwrModelMetricsPfpp1x) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == pwr_model_metrics_pfpp1x_dtype: obj = PwrModelMetricsPfpp1x.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an PwrModelMetricsPfpp1x instance with the memory from the given buffer.""" return PwrModelMetricsPfpp1x.from_data(_numpy.frombuffer(buffer, dtype=pwr_model_metrics_pfpp1x_dtype)) @staticmethod def from_data(data): """Create an PwrModelMetricsPfpp1x instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `pwr_model_metrics_pfpp1x_dtype` holding the data. """ cdef PwrModelMetricsPfpp1x obj = PwrModelMetricsPfpp1x.__new__(PwrModelMetricsPfpp1x) 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 != pwr_model_metrics_pfpp1x_dtype: raise ValueError("data array must be of dtype pwr_model_metrics_pfpp1x_dtype") obj._data = data.view(dtype=pwr_model_metrics_pfpp1x_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an PwrModelMetricsPfpp1x 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 PwrModelMetricsPfpp1x obj = PwrModelMetricsPfpp1x.__new__(PwrModelMetricsPfpp1x) 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(nvmlPwrModelMetricsPfpp1x_t) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=pwr_model_metrics_pfpp1x_dtype_record) obj._owner = owner return obj cdef _get_gpu_fabric_info_v4_dtype_offsets(): cdef nvmlGpuFabricInfo_v4_t *pod = _cyb_calloc(1, sizeof(nvmlGpuFabricInfo_v4_t)) if pod == NULL: raise MemoryError("Error allocating nvmlGpuFabricInfo_v4_t") try: return _numpy.dtype({ 'names': ['cluster_uuid', 'status', 'cliques', 'num_cliques', 'state', 'health_mask', 'health_summary'], 'formats': [(_numpy.uint8, 16), _numpy.int32, (gpu_fabric_clique_v1_dtype, 64), _numpy.uint32, _numpy.uint8, _numpy.uint32, _numpy.uint8], 'offsets': [ (&(pod.clusterUuid)) - (pod), (&(pod.status)) - (pod), (&(pod.cliques)) - (pod), (&(pod.numCliques)) - (pod), (&(pod.state)) - (pod), (&(pod.healthMask)) - (pod), (&(pod.healthSummary)) - (pod), ], 'itemsize': sizeof(nvmlGpuFabricInfo_v4_t), }) finally: _cyb_free(pod) gpu_fabric_info_v4_dtype = _get_gpu_fabric_info_v4_dtype_offsets() cdef class GpuFabricInfo_v4: """Empty-initialize an instance of `nvmlGpuFabricInfo_v4_t`. .. seealso:: `nvmlGpuFabricInfo_v4_t` """ cdef: nvmlGpuFabricInfo_v4_t _data nvmlGpuFabricInfo_v4_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.GpuFabricInfo_v4 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef GpuFabricInfo_v4 other_ if not isinstance(other, GpuFabricInfo_v4): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlGpuFabricInfo_v4_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlGpuFabricInfo_v4_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def cliques(self): """GpuFabricClique_v1: Clique entries, sorted by ascending type then ascending id.""" return GpuFabricClique_v1.from_ptr( &(self._ptr[0].cliques), readonly=self._readonly, owner=self, ) @cliques.setter def cliques(self, val): if self._readonly: raise ValueError("This GpuFabricInfo_v4 instance is read-only") cdef GpuFabricClique_v1 val_ = val if len(val) != 64: raise ValueError(f"Expected length { 64 } for field cliques, got {len(val)}") _cyb_memcpy(&(self._ptr[0].cliques), (val_._get_ptr()), sizeof(nvmlGpuFabricClique_v1_t) * 64) @property def cluster_uuid(self): """~_numpy.uint8: (array of length 16).Uuid of the cluster to which this GPU belongs.""" cdef _cyb_view.array arr = _cyb_view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False) arr.data = (&(self._ptr[0].clusterUuid)) return _numpy.asarray(arr) @cluster_uuid.setter def cluster_uuid(self, val): if self._readonly: raise ValueError("This GpuFabricInfo_v4 instance is read-only") if len(val) != 16: raise ValueError(f"Expected length { 16 } for field cluster_uuid, got {len(val)}") cdef _cyb_view.array arr = _cyb_view.array(shape=(16,), itemsize=sizeof(unsigned char), format="B", mode="c") arr[:] = _numpy.asarray(val, dtype=_numpy.uint8) _cyb_memcpy((&(self._ptr[0].clusterUuid)), (arr.data), sizeof(unsigned char) * len(val)) @property def status(self): """int: Probe Error status, if any. Must be checked only if state returns "complete".""" return (self._ptr[0].status) @status.setter def status(self, val): if self._readonly: raise ValueError("This GpuFabricInfo_v4 instance is read-only") self._ptr[0].status = val @property def num_cliques(self): """int: Number of valid entries in cliques[].""" return self._ptr[0].numCliques @num_cliques.setter def num_cliques(self, val): if self._readonly: raise ValueError("This GpuFabricInfo_v4 instance is read-only") self._ptr[0].numCliques = val @property def state(self): """int: Current Probe State. See NVML_GPU_FABRIC_STATE_*.""" return (self._ptr[0].state) @state.setter def state(self, val): if self._readonly: raise ValueError("This GpuFabricInfo_v4 instance is read-only") self._ptr[0].state = val @property def health_mask(self): """int: GPU Fabric health Status Mask. See NVML_GPU_FABRIC_HEALTH_MASK_*.""" return self._ptr[0].healthMask @health_mask.setter def health_mask(self, val): if self._readonly: raise ValueError("This GpuFabricInfo_v4 instance is read-only") self._ptr[0].healthMask = val @property def health_summary(self): """int: GPU Fabric health summary. See NVML_GPU_FABRIC_HEALTH_SUMMARY_*.""" return self._ptr[0].healthSummary @health_summary.setter def health_summary(self, val): if self._readonly: raise ValueError("This GpuFabricInfo_v4 instance is read-only") self._ptr[0].healthSummary = val @staticmethod def from_buffer(buffer): """Create an GpuFabricInfo_v4 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlGpuFabricInfo_v4_t), GpuFabricInfo_v4) @staticmethod def from_data(data): """Create an GpuFabricInfo_v4 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `gpu_fabric_info_v4_dtype` holding the data. """ return _cyb_from_data(data, "gpu_fabric_info_v4_dtype", gpu_fabric_info_v4_dtype, GpuFabricInfo_v4) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an GpuFabricInfo_v4 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef GpuFabricInfo_v4 obj = GpuFabricInfo_v4.__new__(GpuFabricInfo_v4) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlGpuFabricInfo_v4_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_nvlink_telemetry_samples_v1_dtype_offsets(): cdef nvmlNvlinkTelemetrySamples_v1_t *pod = _cyb_calloc(1, sizeof(nvmlNvlinkTelemetrySamples_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlNvlinkTelemetrySamples_v1_t") try: return _numpy.dtype({ 'names': ['telemetry_count', 'telemetry_samples'], 'formats': [_numpy.uint32, _numpy.intp], 'offsets': [ (&(pod.telemetryCount)) - (pod), (&(pod.telemetrySamples)) - (pod), ], 'itemsize': sizeof(nvmlNvlinkTelemetrySamples_v1_t), }) finally: _cyb_free(pod) nvlink_telemetry_samples_v1_dtype = _get_nvlink_telemetry_samples_v1_dtype_offsets() cdef class NvlinkTelemetrySamples_v1: """Empty-initialize an instance of `nvmlNvlinkTelemetrySamples_v1_t`. .. seealso:: `nvmlNvlinkTelemetrySamples_v1_t` """ cdef: nvmlNvlinkTelemetrySamples_v1_t _data nvmlNvlinkTelemetrySamples_v1_t *_ptr object _owner bint _readonly dict _refs def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False self._refs = {} def __repr__(self): return f"<{__name__}.NvlinkTelemetrySamples_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef NvlinkTelemetrySamples_v1 other_ if not isinstance(other, NvlinkTelemetrySamples_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlNvlinkTelemetrySamples_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlNvlinkTelemetrySamples_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def telemetry_samples(self): """int: [in,out] Caller-allocated array of `telemetryCount` request slots""" if self._ptr[0].telemetrySamples == NULL or self._ptr[0].telemetryCount == 0: return [] return NvlinkTelemetrySample_v1.from_ptr( (self._ptr[0].telemetrySamples), self._ptr[0].telemetryCount, owner=self, readonly=self._readonly ) @telemetry_samples.setter def telemetry_samples(self, val): if self._readonly: raise ValueError("This NvlinkTelemetrySamples_v1 instance is read-only") cdef NvlinkTelemetrySample_v1 arr = val self._ptr[0].telemetrySamples = (arr._get_ptr()) self._ptr[0].telemetryCount = len(arr) self._refs["telemetry_samples"] = arr @staticmethod def from_buffer(buffer): """Create an NvlinkTelemetrySamples_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlNvlinkTelemetrySamples_v1_t), NvlinkTelemetrySamples_v1) @staticmethod def from_data(data): """Create an NvlinkTelemetrySamples_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `nvlink_telemetry_samples_v1_dtype` holding the data. """ return _cyb_from_data(data, "nvlink_telemetry_samples_v1_dtype", nvlink_telemetry_samples_v1_dtype, NvlinkTelemetrySamples_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an NvlinkTelemetrySamples_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef NvlinkTelemetrySamples_v1 obj = NvlinkTelemetrySamples_v1.__new__(NvlinkTelemetrySamples_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlNvlinkTelemetrySamples_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly obj._refs = {} return obj cdef _get_ecc_bank_remapper_status_v1_dtype_offsets(): cdef nvmlEccBankRemapperStatus_v1_t *pod = _cyb_calloc(1, sizeof(nvmlEccBankRemapperStatus_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlEccBankRemapperStatus_v1_t") try: return _numpy.dtype({ 'names': ['active_remappings', 'inactive_remappings', 'b_pending', 'histogram'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, ecc_bank_remapper_histogram_v1_dtype], 'offsets': [ (&(pod.activeRemappings)) - (pod), (&(pod.inactiveRemappings)) - (pod), (&(pod.bPending)) - (pod), (&(pod.histogram)) - (pod), ], 'itemsize': sizeof(nvmlEccBankRemapperStatus_v1_t), }) finally: _cyb_free(pod) ecc_bank_remapper_status_v1_dtype = _get_ecc_bank_remapper_status_v1_dtype_offsets() cdef class EccBankRemapperStatus_v1: """Empty-initialize an instance of `nvmlEccBankRemapperStatus_v1_t`. .. seealso:: `nvmlEccBankRemapperStatus_v1_t` """ cdef: nvmlEccBankRemapperStatus_v1_t _data nvmlEccBankRemapperStatus_v1_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.EccBankRemapperStatus_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef EccBankRemapperStatus_v1 other_ if not isinstance(other, EccBankRemapperStatus_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlEccBankRemapperStatus_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlEccBankRemapperStatus_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def histogram(self): """EccBankRemapperHistogram_v1: Bank remapper histogram.""" return EccBankRemapperHistogram_v1.from_ptr( &(self._ptr[0].histogram), readonly=self._readonly, owner=self, ) @histogram.setter def histogram(self, val): if self._readonly: raise ValueError("This EccBankRemapperStatus_v1 instance is read-only") cdef EccBankRemapperHistogram_v1 val_ = val _cyb_memcpy(&(self._ptr[0].histogram), (val_._get_ptr()), sizeof(nvmlEccBankRemapperHistogram_v1_t) * 1) @property def active_remappings(self): """int: Number of active remappings.""" return self._ptr[0].activeRemappings @active_remappings.setter def active_remappings(self, val): if self._readonly: raise ValueError("This EccBankRemapperStatus_v1 instance is read-only") self._ptr[0].activeRemappings = val @property def inactive_remappings(self): """int: Number of inactive remappings.""" return self._ptr[0].inactiveRemappings @inactive_remappings.setter def inactive_remappings(self, val): if self._readonly: raise ValueError("This EccBankRemapperStatus_v1 instance is read-only") self._ptr[0].inactiveRemappings = val @property def b_pending(self): """int: Whether there exists any pending bank remapping. 0 for no pending remapping, 1 for pending remapping.""" return self._ptr[0].bPending @b_pending.setter def b_pending(self, val): if self._readonly: raise ValueError("This EccBankRemapperStatus_v1 instance is read-only") self._ptr[0].bPending = val @staticmethod def from_buffer(buffer): """Create an EccBankRemapperStatus_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlEccBankRemapperStatus_v1_t), EccBankRemapperStatus_v1) @staticmethod def from_data(data): """Create an EccBankRemapperStatus_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `ecc_bank_remapper_status_v1_dtype` holding the data. """ return _cyb_from_data(data, "ecc_bank_remapper_status_v1_dtype", ecc_bank_remapper_status_v1_dtype, EccBankRemapperStatus_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an EccBankRemapperStatus_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef EccBankRemapperStatus_v1 obj = EccBankRemapperStatus_v1.__new__(EccBankRemapperStatus_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlEccBankRemapperStatus_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_nvlink_setup_nvle_encryption_key_v1_dtype_offsets(): cdef nvmlNvlinkSetupNvleEncryptionKey_v1_t *pod = _cyb_calloc(1, sizeof(nvmlNvlinkSetupNvleEncryptionKey_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlNvlinkSetupNvleEncryptionKey_v1_t") try: return _numpy.dtype({ 'names': ['nvle_key', 'local_gpu_alid', 'remote_gpu_alid', 'local_gpu_nvle_private_info', 'remote_gpu_nvle_private_info'], 'formats': [(_numpy.uint8, 32), _numpy.uint32, _numpy.uint32, nvlink_nvle_private_info_v1_dtype, nvlink_nvle_private_info_v1_dtype], 'offsets': [ (&(pod.nvleKey)) - (pod), (&(pod.localGpuAlid)) - (pod), (&(pod.remoteGpuAlid)) - (pod), (&(pod.localGpuNvlePrivateInfo)) - (pod), (&(pod.remoteGpuNvlePrivateInfo)) - (pod), ], 'itemsize': sizeof(nvmlNvlinkSetupNvleEncryptionKey_v1_t), }) finally: _cyb_free(pod) nvlink_setup_nvle_encryption_key_v1_dtype = _get_nvlink_setup_nvle_encryption_key_v1_dtype_offsets() cdef class NvlinkSetupNvleEncryptionKey_v1: """Empty-initialize an instance of `nvmlNvlinkSetupNvleEncryptionKey_v1_t`. .. seealso:: `nvmlNvlinkSetupNvleEncryptionKey_v1_t` """ cdef: nvmlNvlinkSetupNvleEncryptionKey_v1_t _data nvmlNvlinkSetupNvleEncryptionKey_v1_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.NvlinkSetupNvleEncryptionKey_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef NvlinkSetupNvleEncryptionKey_v1 other_ if not isinstance(other, NvlinkSetupNvleEncryptionKey_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlNvlinkSetupNvleEncryptionKey_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlNvlinkSetupNvleEncryptionKey_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): cdef _cyb_Py_buffer view if key == 0: if self._readonly: raise ValueError("This NvlinkSetupNvleEncryptionKey_v1 instance is read-only") _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) try: if view.len < sizeof(nvmlNvlinkSetupNvleEncryptionKey_v1_t): raise ValueError( "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlNvlinkSetupNvleEncryptionKey_v1_t), view.len) ) _cyb_memmove(&self._data, view.buf, sizeof(nvmlNvlinkSetupNvleEncryptionKey_v1_t)) self._ptr = &self._data self._owner = None self._readonly = view.readonly != 0 finally: _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @property def local_gpu_nvle_private_info(self): """NvlinkNvlePrivateInfo_v1: NVLE private info of the local GPU.""" return NvlinkNvlePrivateInfo_v1.from_ptr( &(self._ptr[0].localGpuNvlePrivateInfo), readonly=self._readonly, owner=self, ) @local_gpu_nvle_private_info.setter def local_gpu_nvle_private_info(self, val): if self._readonly: raise ValueError("This NvlinkSetupNvleEncryptionKey_v1 instance is read-only") cdef NvlinkNvlePrivateInfo_v1 val_ = val _cyb_memcpy(&(self._ptr[0].localGpuNvlePrivateInfo), (val_._get_ptr()), sizeof(nvmlNvlinkNvlePrivateInfo_v1_t) * 1) @property def remote_gpu_nvle_private_info(self): """NvlinkNvlePrivateInfo_v1: NVLE private info of the remote GPU.""" return NvlinkNvlePrivateInfo_v1.from_ptr( &(self._ptr[0].remoteGpuNvlePrivateInfo), readonly=self._readonly, owner=self, ) @remote_gpu_nvle_private_info.setter def remote_gpu_nvle_private_info(self, val): if self._readonly: raise ValueError("This NvlinkSetupNvleEncryptionKey_v1 instance is read-only") cdef NvlinkNvlePrivateInfo_v1 val_ = val _cyb_memcpy(&(self._ptr[0].remoteGpuNvlePrivateInfo), (val_._get_ptr()), sizeof(nvmlNvlinkNvlePrivateInfo_v1_t) * 1) @property def nvle_key(self): """~_numpy.uint8: (array of length 32).Key secret from which keyMgr will derive the key.""" cdef _cyb_view.array arr = _cyb_view.array(shape=(32,), itemsize=sizeof(unsigned char), format="B", mode="c", allocate_buffer=False) arr.data = (&(self._ptr[0].nvleKey)) return _numpy.asarray(arr) @nvle_key.setter def nvle_key(self, val): if self._readonly: raise ValueError("This NvlinkSetupNvleEncryptionKey_v1 instance is read-only") if len(val) != 32: raise ValueError(f"Expected length { 32 } for field nvle_key, got {len(val)}") cdef _cyb_view.array arr = _cyb_view.array(shape=(32,), itemsize=sizeof(unsigned char), format="B", mode="c") arr[:] = _numpy.asarray(val, dtype=_numpy.uint8) _cyb_memcpy((&(self._ptr[0].nvleKey)), (arr.data), sizeof(unsigned char) * len(val)) @property def local_gpu_alid(self): """int: ALID of the local GPU.""" return self._ptr[0].localGpuAlid @local_gpu_alid.setter def local_gpu_alid(self, val): if self._readonly: raise ValueError("This NvlinkSetupNvleEncryptionKey_v1 instance is read-only") self._ptr[0].localGpuAlid = val @property def remote_gpu_alid(self): """int: ALID of the remote GPU.""" return self._ptr[0].remoteGpuAlid @remote_gpu_alid.setter def remote_gpu_alid(self, val): if self._readonly: raise ValueError("This NvlinkSetupNvleEncryptionKey_v1 instance is read-only") self._ptr[0].remoteGpuAlid = val @staticmethod def from_buffer(buffer): """Create an NvlinkSetupNvleEncryptionKey_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlNvlinkSetupNvleEncryptionKey_v1_t), NvlinkSetupNvleEncryptionKey_v1) @staticmethod def from_data(data): """Create an NvlinkSetupNvleEncryptionKey_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `nvlink_setup_nvle_encryption_key_v1_dtype` holding the data. """ return _cyb_from_data(data, "nvlink_setup_nvle_encryption_key_v1_dtype", nvlink_setup_nvle_encryption_key_v1_dtype, NvlinkSetupNvleEncryptionKey_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an NvlinkSetupNvleEncryptionKey_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef NvlinkSetupNvleEncryptionKey_v1 obj = NvlinkSetupNvleEncryptionKey_v1.__new__(NvlinkSetupNvleEncryptionKey_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlNvlinkSetupNvleEncryptionKey_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_vgpu_instances_utilization_info_v1_dtype_offsets(): cdef nvmlVgpuInstancesUtilizationInfo_v1_t *pod = _cyb_calloc(1, sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlVgpuInstancesUtilizationInfo_v1_t") try: return _numpy.dtype({ 'names': ['version', 'sample_val_type', 'vgpu_instance_count', 'last_seen_time_stamp', 'vgpu_util_array'], 'formats': [_numpy.uint32, _numpy.int32, _numpy.uint32, _numpy.uint64, _numpy.intp], 'offsets': [ (&(pod.version)) - (pod), (&(pod.sampleValType)) - (pod), (&(pod.vgpuInstanceCount)) - (pod), (&(pod.lastSeenTimeStamp)) - (pod), (&(pod.vgpuUtilArray)) - (pod), ], 'itemsize': sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t), }) finally: _cyb_free(pod) vgpu_instances_utilization_info_v1_dtype = _get_vgpu_instances_utilization_info_v1_dtype_offsets() cdef class VgpuInstancesUtilizationInfo_v1: """Empty-initialize an instance of `nvmlVgpuInstancesUtilizationInfo_v1_t`. .. seealso:: `nvmlVgpuInstancesUtilizationInfo_v1_t` """ cdef: nvmlVgpuInstancesUtilizationInfo_v1_t _data nvmlVgpuInstancesUtilizationInfo_v1_t *_ptr object _owner bint _readonly dict _refs def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False self._refs = {} def __repr__(self): return f"<{__name__}.VgpuInstancesUtilizationInfo_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef VgpuInstancesUtilizationInfo_v1 other_ if not isinstance(other, VgpuInstancesUtilizationInfo_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def version(self): """int: The version number of this struct.""" return self._ptr[0].version @version.setter def version(self, val): if self._readonly: raise ValueError("This VgpuInstancesUtilizationInfo_v1 instance is read-only") self._ptr[0].version = val @property def sample_val_type(self): """int: Hold the type of returned sample values.""" return (self._ptr[0].sampleValType) @sample_val_type.setter def sample_val_type(self, val): if self._readonly: raise ValueError("This VgpuInstancesUtilizationInfo_v1 instance is read-only") self._ptr[0].sampleValType = val @property def last_seen_time_stamp(self): """int: Return only samples with timestamp greater than lastSeenTimeStamp.""" return self._ptr[0].lastSeenTimeStamp @last_seen_time_stamp.setter def last_seen_time_stamp(self, val): if self._readonly: raise ValueError("This VgpuInstancesUtilizationInfo_v1 instance is read-only") self._ptr[0].lastSeenTimeStamp = val @property def vgpu_util_array(self): """int: The array (allocated by caller) in which vGPU utilization are returned.""" if self._ptr[0].vgpuUtilArray == NULL or self._ptr[0].vgpuInstanceCount == 0: return [] return VgpuInstanceUtilizationInfo_v1.from_ptr( (self._ptr[0].vgpuUtilArray), self._ptr[0].vgpuInstanceCount, owner=self, readonly=self._readonly ) @vgpu_util_array.setter def vgpu_util_array(self, val): if self._readonly: raise ValueError("This VgpuInstancesUtilizationInfo_v1 instance is read-only") cdef VgpuInstanceUtilizationInfo_v1 arr = val self._ptr[0].vgpuUtilArray = (arr._get_ptr()) self._ptr[0].vgpuInstanceCount = len(arr) self._refs["vgpu_util_array"] = arr @staticmethod def from_buffer(buffer): """Create an VgpuInstancesUtilizationInfo_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t), VgpuInstancesUtilizationInfo_v1) @staticmethod def from_data(data): """Create an VgpuInstancesUtilizationInfo_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `vgpu_instances_utilization_info_v1_dtype` holding the data. """ return _cyb_from_data(data, "vgpu_instances_utilization_info_v1_dtype", vgpu_instances_utilization_info_v1_dtype, VgpuInstancesUtilizationInfo_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an VgpuInstancesUtilizationInfo_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef VgpuInstancesUtilizationInfo_v1 obj = VgpuInstancesUtilizationInfo_v1.__new__(VgpuInstancesUtilizationInfo_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly obj._refs = {} return obj cdef _get_prm_counter_v1_dtype_offsets(): cdef nvmlPRMCounter_v1_t *pod = _cyb_calloc(1, sizeof(nvmlPRMCounter_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlPRMCounter_v1_t") try: return _numpy.dtype({ 'names': ['counter_id', 'in_data', 'counter_value'], 'formats': [_numpy.uint32, prm_counter_input_v1_dtype, prm_counter_value_v1_dtype], 'offsets': [ (&(pod.counterId)) - (pod), (&(pod.inData)) - (pod), (&(pod.counterValue)) - (pod), ], 'itemsize': sizeof(nvmlPRMCounter_v1_t), }) finally: _cyb_free(pod) prm_counter_v1_dtype = _get_prm_counter_v1_dtype_offsets() cdef object prm_counter_v1_dtype_record = _numpy.dtype((_numpy.record, prm_counter_v1_dtype)) cdef class PRMCounter_v1: """Empty-initialize an array of `nvmlPRMCounter_v1_t`. The resulting object is of length `size` and of dtype `prm_counter_v1_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `nvmlPRMCounter_v1_t` """ cdef: readonly object _data object _owner def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=prm_counter_v1_dtype_record) assert self._data.itemsize == sizeof(nvmlPRMCounter_v1_t), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlPRMCounter_v1_t) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}.PRMCounter_v1_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}.PRMCounter_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, PRMCounter_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 counter_id(self): """Union[~_numpy.uint32, int]: Counter ID, one of `nvmlPRMCounterId_t`.""" if self._data.size == 1: return int(self._data["counter_id"][0]) return self._data["counter_id"] @counter_id.setter def counter_id(self, val): if not self._data.flags.writeable: raise ValueError("This PRMCounter_v1 instance is read-only") self._data["counter_id"] = val @property def in_data(self): """prm_counter_input_v1_dtype: PRM input values.""" return self._data["in_data"].view(_numpy.recarray) @in_data.setter def in_data(self, val): if not self._data.flags.writeable: raise ValueError("This PRMCounter_v1 instance is read-only") self._data["in_data"] = val @property def counter_value(self): """prm_counter_value_v1_dtype: Counter value.""" return self._data["counter_value"].view(_numpy.recarray) @counter_value.setter def counter_value(self, val): if not self._data.flags.writeable: raise ValueError("This PRMCounter_v1 instance is read-only") self._data["counter_value"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef PRMCounter_v1 obj 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 obj = PRMCounter_v1.__new__(PRMCounter_v1) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == prm_counter_v1_dtype: obj = PRMCounter_v1.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an PRMCounter_v1 instance with the memory from the given buffer.""" return PRMCounter_v1.from_data(_numpy.frombuffer(buffer, dtype=prm_counter_v1_dtype)) @staticmethod def from_data(data): """Create an PRMCounter_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `prm_counter_v1_dtype` holding the data. """ cdef PRMCounter_v1 obj = PRMCounter_v1.__new__(PRMCounter_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 != prm_counter_v1_dtype: raise ValueError("data array must be of dtype prm_counter_v1_dtype") obj._data = data.view(dtype=prm_counter_v1_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an PRMCounter_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 PRMCounter_v1 obj = PRMCounter_v1.__new__(PRMCounter_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(nvmlPRMCounter_v1_t) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=prm_counter_v1_dtype_record) obj._owner = owner return obj cdef _get_vgpu_scheduler_log_dtype_offsets(): cdef nvmlVgpuSchedulerLog_t *pod = _cyb_calloc(1, sizeof(nvmlVgpuSchedulerLog_t)) if pod == NULL: raise MemoryError("Error allocating nvmlVgpuSchedulerLog_t") try: return _numpy.dtype({ 'names': ['engine_id', 'scheduler_policy', 'arr_mode', 'scheduler_params', 'entries_count', 'log_entries'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, vgpu_scheduler_params_dtype, _numpy.uint32, (vgpu_scheduler_log_entry_dtype, 200)], 'offsets': [ (&(pod.engineId)) - (pod), (&(pod.schedulerPolicy)) - (pod), (&(pod.arrMode)) - (pod), (&(pod.schedulerParams)) - (pod), (&(pod.entriesCount)) - (pod), (&(pod.logEntries)) - (pod), ], 'itemsize': sizeof(nvmlVgpuSchedulerLog_t), }) finally: _cyb_free(pod) vgpu_scheduler_log_dtype = _get_vgpu_scheduler_log_dtype_offsets() cdef class VgpuSchedulerLog: """Empty-initialize an instance of `nvmlVgpuSchedulerLog_t`. .. seealso:: `nvmlVgpuSchedulerLog_t` """ cdef: nvmlVgpuSchedulerLog_t _data nvmlVgpuSchedulerLog_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.VgpuSchedulerLog object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef VgpuSchedulerLog other_ if not isinstance(other, VgpuSchedulerLog): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuSchedulerLog_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuSchedulerLog_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def scheduler_params(self): """VgpuSchedulerParams: """ return VgpuSchedulerParams.from_ptr( &(self._ptr[0].schedulerParams), readonly=self._readonly, owner=self, ) @scheduler_params.setter def scheduler_params(self, val): if self._readonly: raise ValueError("This VgpuSchedulerLog instance is read-only") cdef VgpuSchedulerParams val_ = val _cyb_memcpy(&(self._ptr[0].schedulerParams), (val_._get_ptr()), sizeof(nvmlVgpuSchedulerParams_t) * 1) @property def log_entries(self): """VgpuSchedulerLogEntry: """ return VgpuSchedulerLogEntry.from_ptr( &(self._ptr[0].logEntries), 200, readonly=self._readonly, owner=self, ) @log_entries.setter def log_entries(self, val): if self._readonly: raise ValueError("This VgpuSchedulerLog instance is read-only") cdef VgpuSchedulerLogEntry val_ = val if len(val) != 200: raise ValueError(f"Expected length { 200 } for field log_entries, got {len(val)}") _cyb_memcpy(&(self._ptr[0].logEntries), (val_._get_ptr()), sizeof(nvmlVgpuSchedulerLogEntry_t) * 200) @property def engine_id(self): """int: """ return self._ptr[0].engineId @engine_id.setter def engine_id(self, val): if self._readonly: raise ValueError("This VgpuSchedulerLog instance is read-only") self._ptr[0].engineId = val @property def scheduler_policy(self): """int: """ return self._ptr[0].schedulerPolicy @scheduler_policy.setter def scheduler_policy(self, val): if self._readonly: raise ValueError("This VgpuSchedulerLog instance is read-only") self._ptr[0].schedulerPolicy = val @property def arr_mode(self): """int: """ return self._ptr[0].arrMode @arr_mode.setter def arr_mode(self, val): if self._readonly: raise ValueError("This VgpuSchedulerLog instance is read-only") self._ptr[0].arrMode = val @property def entries_count(self): """int: """ return self._ptr[0].entriesCount @entries_count.setter def entries_count(self, val): if self._readonly: raise ValueError("This VgpuSchedulerLog instance is read-only") self._ptr[0].entriesCount = val @staticmethod def from_buffer(buffer): """Create an VgpuSchedulerLog instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlVgpuSchedulerLog_t), VgpuSchedulerLog) @staticmethod def from_data(data): """Create an VgpuSchedulerLog instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `vgpu_scheduler_log_dtype` holding the data. """ return _cyb_from_data(data, "vgpu_scheduler_log_dtype", vgpu_scheduler_log_dtype, VgpuSchedulerLog) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an VgpuSchedulerLog instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef VgpuSchedulerLog obj = VgpuSchedulerLog.__new__(VgpuSchedulerLog) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlVgpuSchedulerLog_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_vgpu_scheduler_get_state_dtype_offsets(): cdef nvmlVgpuSchedulerGetState_t *pod = _cyb_calloc(1, sizeof(nvmlVgpuSchedulerGetState_t)) if pod == NULL: raise MemoryError("Error allocating nvmlVgpuSchedulerGetState_t") try: return _numpy.dtype({ 'names': ['scheduler_policy', 'arr_mode', 'scheduler_params'], 'formats': [_numpy.uint32, _numpy.uint32, vgpu_scheduler_params_dtype], 'offsets': [ (&(pod.schedulerPolicy)) - (pod), (&(pod.arrMode)) - (pod), (&(pod.schedulerParams)) - (pod), ], 'itemsize': sizeof(nvmlVgpuSchedulerGetState_t), }) finally: _cyb_free(pod) vgpu_scheduler_get_state_dtype = _get_vgpu_scheduler_get_state_dtype_offsets() cdef class VgpuSchedulerGetState: """Empty-initialize an instance of `nvmlVgpuSchedulerGetState_t`. .. seealso:: `nvmlVgpuSchedulerGetState_t` """ cdef: nvmlVgpuSchedulerGetState_t _data nvmlVgpuSchedulerGetState_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.VgpuSchedulerGetState object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef VgpuSchedulerGetState other_ if not isinstance(other, VgpuSchedulerGetState): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuSchedulerGetState_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuSchedulerGetState_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def scheduler_params(self): """VgpuSchedulerParams: """ return VgpuSchedulerParams.from_ptr( &(self._ptr[0].schedulerParams), readonly=self._readonly, owner=self, ) @scheduler_params.setter def scheduler_params(self, val): if self._readonly: raise ValueError("This VgpuSchedulerGetState instance is read-only") cdef VgpuSchedulerParams val_ = val _cyb_memcpy(&(self._ptr[0].schedulerParams), (val_._get_ptr()), sizeof(nvmlVgpuSchedulerParams_t) * 1) @property def scheduler_policy(self): """int: """ return self._ptr[0].schedulerPolicy @scheduler_policy.setter def scheduler_policy(self, val): if self._readonly: raise ValueError("This VgpuSchedulerGetState instance is read-only") self._ptr[0].schedulerPolicy = val @property def arr_mode(self): """int: """ return self._ptr[0].arrMode @arr_mode.setter def arr_mode(self, val): if self._readonly: raise ValueError("This VgpuSchedulerGetState instance is read-only") self._ptr[0].arrMode = val @staticmethod def from_buffer(buffer): """Create an VgpuSchedulerGetState instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlVgpuSchedulerGetState_t), VgpuSchedulerGetState) @staticmethod def from_data(data): """Create an VgpuSchedulerGetState instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `vgpu_scheduler_get_state_dtype` holding the data. """ return _cyb_from_data(data, "vgpu_scheduler_get_state_dtype", vgpu_scheduler_get_state_dtype, VgpuSchedulerGetState) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an VgpuSchedulerGetState instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef VgpuSchedulerGetState obj = VgpuSchedulerGetState.__new__(VgpuSchedulerGetState) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlVgpuSchedulerGetState_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_vgpu_scheduler_state_info_v1_dtype_offsets(): cdef nvmlVgpuSchedulerStateInfo_v1_t *pod = _cyb_calloc(1, sizeof(nvmlVgpuSchedulerStateInfo_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlVgpuSchedulerStateInfo_v1_t") try: return _numpy.dtype({ 'names': ['version', 'engine_id', 'scheduler_policy', 'arr_mode', 'scheduler_params'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, vgpu_scheduler_params_dtype], 'offsets': [ (&(pod.version)) - (pod), (&(pod.engineId)) - (pod), (&(pod.schedulerPolicy)) - (pod), (&(pod.arrMode)) - (pod), (&(pod.schedulerParams)) - (pod), ], 'itemsize': sizeof(nvmlVgpuSchedulerStateInfo_v1_t), }) finally: _cyb_free(pod) vgpu_scheduler_state_info_v1_dtype = _get_vgpu_scheduler_state_info_v1_dtype_offsets() cdef class VgpuSchedulerStateInfo_v1: """Empty-initialize an instance of `nvmlVgpuSchedulerStateInfo_v1_t`. .. seealso:: `nvmlVgpuSchedulerStateInfo_v1_t` """ cdef: nvmlVgpuSchedulerStateInfo_v1_t _data nvmlVgpuSchedulerStateInfo_v1_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.VgpuSchedulerStateInfo_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef VgpuSchedulerStateInfo_v1 other_ if not isinstance(other, VgpuSchedulerStateInfo_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuSchedulerStateInfo_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuSchedulerStateInfo_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def scheduler_params(self): """VgpuSchedulerParams: OUT: vGPU Scheduler Parameters.""" return VgpuSchedulerParams.from_ptr( &(self._ptr[0].schedulerParams), readonly=self._readonly, owner=self, ) @scheduler_params.setter def scheduler_params(self, val): if self._readonly: raise ValueError("This VgpuSchedulerStateInfo_v1 instance is read-only") cdef VgpuSchedulerParams val_ = val _cyb_memcpy(&(self._ptr[0].schedulerParams), (val_._get_ptr()), sizeof(nvmlVgpuSchedulerParams_t) * 1) @property def version(self): """int: IN: The version number of this struct.""" return self._ptr[0].version @version.setter def version(self, val): if self._readonly: raise ValueError("This VgpuSchedulerStateInfo_v1 instance is read-only") self._ptr[0].version = val @property def engine_id(self): """int: IN: Engine whose software scheduler state info is fetched. One of NVML_VGPU_SCHEDULER_ENGINE_TYPE_*.""" return self._ptr[0].engineId @engine_id.setter def engine_id(self, val): if self._readonly: raise ValueError("This VgpuSchedulerStateInfo_v1 instance is read-only") self._ptr[0].engineId = val @property def scheduler_policy(self): """int: OUT: Scheduler policy.""" return self._ptr[0].schedulerPolicy @scheduler_policy.setter def scheduler_policy(self, val): if self._readonly: raise ValueError("This VgpuSchedulerStateInfo_v1 instance is read-only") self._ptr[0].schedulerPolicy = val @property def arr_mode(self): """int: OUT: Adaptive Round Robin scheduler mode. One of the NVML_VGPU_SCHEDULER_ARR_*.""" return self._ptr[0].arrMode @arr_mode.setter def arr_mode(self, val): if self._readonly: raise ValueError("This VgpuSchedulerStateInfo_v1 instance is read-only") self._ptr[0].arrMode = val @staticmethod def from_buffer(buffer): """Create an VgpuSchedulerStateInfo_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlVgpuSchedulerStateInfo_v1_t), VgpuSchedulerStateInfo_v1) @staticmethod def from_data(data): """Create an VgpuSchedulerStateInfo_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `vgpu_scheduler_state_info_v1_dtype` holding the data. """ return _cyb_from_data(data, "vgpu_scheduler_state_info_v1_dtype", vgpu_scheduler_state_info_v1_dtype, VgpuSchedulerStateInfo_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an VgpuSchedulerStateInfo_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef VgpuSchedulerStateInfo_v1 obj = VgpuSchedulerStateInfo_v1.__new__(VgpuSchedulerStateInfo_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlVgpuSchedulerStateInfo_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_vgpu_scheduler_log_info_v1_dtype_offsets(): cdef nvmlVgpuSchedulerLogInfo_v1_t *pod = _cyb_calloc(1, sizeof(nvmlVgpuSchedulerLogInfo_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlVgpuSchedulerLogInfo_v1_t") try: return _numpy.dtype({ 'names': ['version', 'engine_id', 'scheduler_policy', 'arr_mode', 'scheduler_params', 'entries_count', 'log_entries'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, vgpu_scheduler_params_dtype, _numpy.uint32, (vgpu_scheduler_log_entry_dtype, 200)], 'offsets': [ (&(pod.version)) - (pod), (&(pod.engineId)) - (pod), (&(pod.schedulerPolicy)) - (pod), (&(pod.arrMode)) - (pod), (&(pod.schedulerParams)) - (pod), (&(pod.entriesCount)) - (pod), (&(pod.logEntries)) - (pod), ], 'itemsize': sizeof(nvmlVgpuSchedulerLogInfo_v1_t), }) finally: _cyb_free(pod) vgpu_scheduler_log_info_v1_dtype = _get_vgpu_scheduler_log_info_v1_dtype_offsets() cdef class VgpuSchedulerLogInfo_v1: """Empty-initialize an instance of `nvmlVgpuSchedulerLogInfo_v1_t`. .. seealso:: `nvmlVgpuSchedulerLogInfo_v1_t` """ cdef: nvmlVgpuSchedulerLogInfo_v1_t _data nvmlVgpuSchedulerLogInfo_v1_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.VgpuSchedulerLogInfo_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef VgpuSchedulerLogInfo_v1 other_ if not isinstance(other, VgpuSchedulerLogInfo_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuSchedulerLogInfo_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuSchedulerLogInfo_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def scheduler_params(self): """VgpuSchedulerParams: OUT: vGPU Scheduler Parameters.""" return VgpuSchedulerParams.from_ptr( &(self._ptr[0].schedulerParams), readonly=self._readonly, owner=self, ) @scheduler_params.setter def scheduler_params(self, val): if self._readonly: raise ValueError("This VgpuSchedulerLogInfo_v1 instance is read-only") cdef VgpuSchedulerParams val_ = val _cyb_memcpy(&(self._ptr[0].schedulerParams), (val_._get_ptr()), sizeof(nvmlVgpuSchedulerParams_t) * 1) @property def log_entries(self): """VgpuSchedulerLogEntry: OUT: Structure to store the state and logs of a software runlist.""" return VgpuSchedulerLogEntry.from_ptr( &(self._ptr[0].logEntries), 200, readonly=self._readonly, owner=self, ) @log_entries.setter def log_entries(self, val): if self._readonly: raise ValueError("This VgpuSchedulerLogInfo_v1 instance is read-only") cdef VgpuSchedulerLogEntry val_ = val if len(val) != 200: raise ValueError(f"Expected length { 200 } for field log_entries, got {len(val)}") _cyb_memcpy(&(self._ptr[0].logEntries), (val_._get_ptr()), sizeof(nvmlVgpuSchedulerLogEntry_t) * 200) @property def version(self): """int: IN: The version number of this struct.""" return self._ptr[0].version @version.setter def version(self, val): if self._readonly: raise ValueError("This VgpuSchedulerLogInfo_v1 instance is read-only") self._ptr[0].version = val @property def engine_id(self): """int: IN: Engine whose software runlist log entries are fetched. One of One of NVML_VGPU_SCHEDULER_ENGINE_TYPE_*.""" return self._ptr[0].engineId @engine_id.setter def engine_id(self, val): if self._readonly: raise ValueError("This VgpuSchedulerLogInfo_v1 instance is read-only") self._ptr[0].engineId = val @property def scheduler_policy(self): """int: OUT: Scheduler policy.""" return self._ptr[0].schedulerPolicy @scheduler_policy.setter def scheduler_policy(self, val): if self._readonly: raise ValueError("This VgpuSchedulerLogInfo_v1 instance is read-only") self._ptr[0].schedulerPolicy = val @property def arr_mode(self): """int: OUT: Adaptive Round Robin scheduler mode. One of the NVML_VGPU_SCHEDULER_ARR_*.""" return self._ptr[0].arrMode @arr_mode.setter def arr_mode(self, val): if self._readonly: raise ValueError("This VgpuSchedulerLogInfo_v1 instance is read-only") self._ptr[0].arrMode = val @property def entries_count(self): """int: OUT: Count of log entries fetched.""" return self._ptr[0].entriesCount @entries_count.setter def entries_count(self, val): if self._readonly: raise ValueError("This VgpuSchedulerLogInfo_v1 instance is read-only") self._ptr[0].entriesCount = val @staticmethod def from_buffer(buffer): """Create an VgpuSchedulerLogInfo_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlVgpuSchedulerLogInfo_v1_t), VgpuSchedulerLogInfo_v1) @staticmethod def from_data(data): """Create an VgpuSchedulerLogInfo_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `vgpu_scheduler_log_info_v1_dtype` holding the data. """ return _cyb_from_data(data, "vgpu_scheduler_log_info_v1_dtype", vgpu_scheduler_log_info_v1_dtype, VgpuSchedulerLogInfo_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an VgpuSchedulerLogInfo_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef VgpuSchedulerLogInfo_v1 obj = VgpuSchedulerLogInfo_v1.__new__(VgpuSchedulerLogInfo_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlVgpuSchedulerLogInfo_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_vgpu_scheduler_state_v1_dtype_offsets(): cdef nvmlVgpuSchedulerState_v1_t *pod = _cyb_calloc(1, sizeof(nvmlVgpuSchedulerState_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlVgpuSchedulerState_v1_t") try: return _numpy.dtype({ 'names': ['version', 'engine_id', 'scheduler_policy', 'enable_arr_mode', 'scheduler_params'], 'formats': [_numpy.uint32, _numpy.uint32, _numpy.uint32, _numpy.uint32, vgpu_scheduler_set_params_dtype], 'offsets': [ (&(pod.version)) - (pod), (&(pod.engineId)) - (pod), (&(pod.schedulerPolicy)) - (pod), (&(pod.enableARRMode)) - (pod), (&(pod.schedulerParams)) - (pod), ], 'itemsize': sizeof(nvmlVgpuSchedulerState_v1_t), }) finally: _cyb_free(pod) vgpu_scheduler_state_v1_dtype = _get_vgpu_scheduler_state_v1_dtype_offsets() cdef class VgpuSchedulerState_v1: """Empty-initialize an instance of `nvmlVgpuSchedulerState_v1_t`. .. seealso:: `nvmlVgpuSchedulerState_v1_t` """ cdef: nvmlVgpuSchedulerState_v1_t _data nvmlVgpuSchedulerState_v1_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.VgpuSchedulerState_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef VgpuSchedulerState_v1 other_ if not isinstance(other, VgpuSchedulerState_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlVgpuSchedulerState_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlVgpuSchedulerState_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def scheduler_params(self): """VgpuSchedulerSetParams: IN: vGPU Scheduler Parameters.""" return VgpuSchedulerSetParams.from_ptr( &(self._ptr[0].schedulerParams), readonly=self._readonly, owner=self, ) @scheduler_params.setter def scheduler_params(self, val): if self._readonly: raise ValueError("This VgpuSchedulerState_v1 instance is read-only") cdef VgpuSchedulerSetParams val_ = val _cyb_memcpy(&(self._ptr[0].schedulerParams), (val_._get_ptr()), sizeof(nvmlVgpuSchedulerSetParams_t) * 1) @property def version(self): """int: IN: The version number of this struct.""" return self._ptr[0].version @version.setter def version(self, val): if self._readonly: raise ValueError("This VgpuSchedulerState_v1 instance is read-only") self._ptr[0].version = val @property def engine_id(self): """int: IN: One of NVML_VGPU_SCHEDULER_ENGINE_TYPE_*.""" return self._ptr[0].engineId @engine_id.setter def engine_id(self, val): if self._readonly: raise ValueError("This VgpuSchedulerState_v1 instance is read-only") self._ptr[0].engineId = val @property def scheduler_policy(self): """int: IN: Scheduler policy.""" return self._ptr[0].schedulerPolicy @scheduler_policy.setter def scheduler_policy(self, val): if self._readonly: raise ValueError("This VgpuSchedulerState_v1 instance is read-only") self._ptr[0].schedulerPolicy = val @property def enable_arr_mode(self): """int: IN: Adaptive Round Robin scheduler.""" return self._ptr[0].enableARRMode @enable_arr_mode.setter def enable_arr_mode(self, val): if self._readonly: raise ValueError("This VgpuSchedulerState_v1 instance is read-only") self._ptr[0].enableARRMode = val @staticmethod def from_buffer(buffer): """Create an VgpuSchedulerState_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlVgpuSchedulerState_v1_t), VgpuSchedulerState_v1) @staticmethod def from_data(data): """Create an VgpuSchedulerState_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `vgpu_scheduler_state_v1_dtype` holding the data. """ return _cyb_from_data(data, "vgpu_scheduler_state_v1_dtype", vgpu_scheduler_state_v1_dtype, VgpuSchedulerState_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an VgpuSchedulerState_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef VgpuSchedulerState_v1 obj = VgpuSchedulerState_v1.__new__(VgpuSchedulerState_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlVgpuSchedulerState_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_grid_licensable_features_dtype_offsets(): cdef nvmlGridLicensableFeatures_t *pod = _cyb_calloc(1, sizeof(nvmlGridLicensableFeatures_t)) if pod == NULL: raise MemoryError("Error allocating nvmlGridLicensableFeatures_t") try: return _numpy.dtype({ 'names': ['is_grid_license_supported', 'licensable_features_count', 'grid_licensable_features'], 'formats': [_numpy.int32, _numpy.uint32, (grid_licensable_feature_dtype, 3)], 'offsets': [ (&(pod.isGridLicenseSupported)) - (pod), (&(pod.licensableFeaturesCount)) - (pod), (&(pod.gridLicensableFeatures)) - (pod), ], 'itemsize': sizeof(nvmlGridLicensableFeatures_t), }) finally: _cyb_free(pod) grid_licensable_features_dtype = _get_grid_licensable_features_dtype_offsets() cdef class GridLicensableFeatures: """Empty-initialize an instance of `nvmlGridLicensableFeatures_t`. .. seealso:: `nvmlGridLicensableFeatures_t` """ cdef: nvmlGridLicensableFeatures_t _data nvmlGridLicensableFeatures_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.GridLicensableFeatures object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef GridLicensableFeatures other_ if not isinstance(other, GridLicensableFeatures): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlGridLicensableFeatures_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlGridLicensableFeatures_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def grid_licensable_features(self): """GridLicensableFeature: """ return GridLicensableFeature.from_ptr( &(self._ptr[0].gridLicensableFeatures), self._ptr[0].licensableFeaturesCount, readonly=self._readonly, owner=self, ) @grid_licensable_features.setter def grid_licensable_features(self, val): if self._readonly: raise ValueError("This GridLicensableFeatures instance is read-only") cdef GridLicensableFeature val_ = val if len(val) > 3: raise ValueError(f"Expected length < 3 for field grid_licensable_features, got {len(val)}") self._ptr[0].licensableFeaturesCount = len(val) if len(val) == 0: return _cyb_memcpy(&(self._ptr[0].gridLicensableFeatures), (val_._get_ptr()), sizeof(nvmlGridLicensableFeature_t) * self._ptr[0].licensableFeaturesCount) @property def is_grid_license_supported(self): """int: """ return self._ptr[0].isGridLicenseSupported @is_grid_license_supported.setter def is_grid_license_supported(self, val): if self._readonly: raise ValueError("This GridLicensableFeatures instance is read-only") self._ptr[0].isGridLicenseSupported = val @staticmethod def from_buffer(buffer): """Create an GridLicensableFeatures instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlGridLicensableFeatures_t), GridLicensableFeatures) @staticmethod def from_data(data): """Create an GridLicensableFeatures instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `grid_licensable_features_dtype` holding the data. """ return _cyb_from_data(data, "grid_licensable_features_dtype", grid_licensable_features_dtype, GridLicensableFeatures) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an GridLicensableFeatures instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef GridLicensableFeatures obj = GridLicensableFeatures.__new__(GridLicensableFeatures) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlGridLicensableFeatures_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_nv_link_info_v2_dtype_offsets(): cdef nvmlNvLinkInfo_v2_t *pod = _cyb_calloc(1, sizeof(nvmlNvLinkInfo_v2_t)) if pod == NULL: raise MemoryError("Error allocating nvmlNvLinkInfo_v2_t") try: return _numpy.dtype({ 'names': ['version', 'is_nvle_enabled', 'firmware_info'], 'formats': [_numpy.uint32, _numpy.uint32, nvlink_firmware_info_dtype], 'offsets': [ (&(pod.version)) - (pod), (&(pod.isNvleEnabled)) - (pod), (&(pod.firmwareInfo)) - (pod), ], 'itemsize': sizeof(nvmlNvLinkInfo_v2_t), }) finally: _cyb_free(pod) nv_link_info_v2_dtype = _get_nv_link_info_v2_dtype_offsets() cdef class NvLinkInfo_v2: """Empty-initialize an instance of `nvmlNvLinkInfo_v2_t`. .. seealso:: `nvmlNvLinkInfo_v2_t` """ cdef: nvmlNvLinkInfo_v2_t _data nvmlNvLinkInfo_v2_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.NvLinkInfo_v2 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef NvLinkInfo_v2 other_ if not isinstance(other, NvLinkInfo_v2): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlNvLinkInfo_v2_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlNvLinkInfo_v2_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def firmware_info(self): """NvlinkFirmwareInfo: OUT - NVLINK Firmware info.""" return NvlinkFirmwareInfo.from_ptr( &(self._ptr[0].firmwareInfo), readonly=self._readonly, owner=self, ) @firmware_info.setter def firmware_info(self, val): if self._readonly: raise ValueError("This NvLinkInfo_v2 instance is read-only") cdef NvlinkFirmwareInfo val_ = val _cyb_memcpy(&(self._ptr[0].firmwareInfo), (val_._get_ptr()), sizeof(nvmlNvlinkFirmwareInfo_t) * 1) @property def version(self): """int: IN - the API version number.""" return self._ptr[0].version @version.setter def version(self, val): if self._readonly: raise ValueError("This NvLinkInfo_v2 instance is read-only") self._ptr[0].version = val @property def is_nvle_enabled(self): """int: OUT - NVLINK encryption enablement.""" return self._ptr[0].isNvleEnabled @is_nvle_enabled.setter def is_nvle_enabled(self, val): if self._readonly: raise ValueError("This NvLinkInfo_v2 instance is read-only") self._ptr[0].isNvleEnabled = val @staticmethod def from_buffer(buffer): """Create an NvLinkInfo_v2 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlNvLinkInfo_v2_t), NvLinkInfo_v2) @staticmethod def from_data(data): """Create an NvLinkInfo_v2 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `nv_link_info_v2_dtype` holding the data. """ return _cyb_from_data(data, "nv_link_info_v2_dtype", nv_link_info_v2_dtype, NvLinkInfo_v2) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an NvLinkInfo_v2 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef NvLinkInfo_v2 obj = NvLinkInfo_v2.__new__(NvLinkInfo_v2) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlNvLinkInfo_v2_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_nv_link_info_v3_dtype_offsets(): cdef nvmlNvLinkInfo_v3_t *pod = _cyb_calloc(1, sizeof(nvmlNvLinkInfo_v3_t)) if pod == NULL: raise MemoryError("Error allocating nvmlNvLinkInfo_v3_t") try: return _numpy.dtype({ 'names': ['is_nvle_enabled', 'firmware_info', 'is_nvle_ready'], 'formats': [_numpy.uint32, nvlink_firmware_info_dtype, _numpy.uint32], 'offsets': [ (&(pod.isNvleEnabled)) - (pod), (&(pod.firmwareInfo)) - (pod), (&(pod.isNvleReady)) - (pod), ], 'itemsize': sizeof(nvmlNvLinkInfo_v3_t), }) finally: _cyb_free(pod) nv_link_info_v3_dtype = _get_nv_link_info_v3_dtype_offsets() cdef class NvLinkInfo_v3: """Empty-initialize an instance of `nvmlNvLinkInfo_v3_t`. .. seealso:: `nvmlNvLinkInfo_v3_t` """ cdef: nvmlNvLinkInfo_v3_t _data nvmlNvLinkInfo_v3_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.NvLinkInfo_v3 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef NvLinkInfo_v3 other_ if not isinstance(other, NvLinkInfo_v3): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlNvLinkInfo_v3_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlNvLinkInfo_v3_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): cdef _cyb_Py_buffer view if key == 0: if self._readonly: raise ValueError("This NvLinkInfo_v3 instance is read-only") _cyb_PyObject_GetBuffer(val, &view, _cyb_PyBUF_SIMPLE) try: if view.len < sizeof(nvmlNvLinkInfo_v3_t): raise ValueError( "source buffer too small: expected at least %d bytes, got %d" % (sizeof(nvmlNvLinkInfo_v3_t), view.len) ) _cyb_memmove(&self._data, view.buf, sizeof(nvmlNvLinkInfo_v3_t)) self._ptr = &self._data self._owner = None self._readonly = view.readonly != 0 finally: _cyb_PyBuffer_Release(&view) else: setattr(self, key, val) @property def firmware_info(self): """NvlinkFirmwareInfo: OUT - NVLINK Firmware info.""" return NvlinkFirmwareInfo.from_ptr( &(self._ptr[0].firmwareInfo), readonly=self._readonly, owner=self, ) @firmware_info.setter def firmware_info(self, val): if self._readonly: raise ValueError("This NvLinkInfo_v3 instance is read-only") cdef NvlinkFirmwareInfo val_ = val _cyb_memcpy(&(self._ptr[0].firmwareInfo), (val_._get_ptr()), sizeof(nvmlNvlinkFirmwareInfo_t) * 1) @property def is_nvle_enabled(self): """int: OUT - NVLINK encryption enablement.""" return self._ptr[0].isNvleEnabled @is_nvle_enabled.setter def is_nvle_enabled(self, val): if self._readonly: raise ValueError("This NvLinkInfo_v3 instance is read-only") self._ptr[0].isNvleEnabled = val @property def is_nvle_ready(self): """int: OUT - Whether NVLE is ready on the GPU.""" return self._ptr[0].isNvleReady @is_nvle_ready.setter def is_nvle_ready(self, val): if self._readonly: raise ValueError("This NvLinkInfo_v3 instance is read-only") self._ptr[0].isNvleReady = val @staticmethod def from_buffer(buffer): """Create an NvLinkInfo_v3 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlNvLinkInfo_v3_t), NvLinkInfo_v3) @staticmethod def from_data(data): """Create an NvLinkInfo_v3 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `nv_link_info_v3_dtype` holding the data. """ return _cyb_from_data(data, "nv_link_info_v3_dtype", nv_link_info_v3_dtype, NvLinkInfo_v3) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an NvLinkInfo_v3 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef NvLinkInfo_v3 obj = NvLinkInfo_v3.__new__(NvLinkInfo_v3) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlNvLinkInfo_v3_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj cdef _get_pwr_model_metrics_dlppm1x_dtype_offsets(): cdef nvmlPwrModelMetricsDlppm1x_t *pod = _cyb_calloc(1, sizeof(nvmlPwrModelMetricsDlppm1x_t)) if pod == NULL: raise MemoryError("Error allocating nvmlPwrModelMetricsDlppm1x_t") try: return _numpy.dtype({ 'names': ['b_valid', 'core_rail', 'fb_rail', 'tgp_pwr_tuple', 'perf_metrics'], 'formats': [_numpy.uint8, core_rail_metrics_dtype, rail_metrics_dtype, pmgr_pwr_tuple_dtype, pwr_model_metrics_dlppm1x_perf_dtype], 'offsets': [ (&(pod.bValid)) - (pod), (&(pod.coreRail)) - (pod), (&(pod.fbRail)) - (pod), (&(pod.tgpPwrTuple)) - (pod), (&(pod.perfMetrics)) - (pod), ], 'itemsize': sizeof(nvmlPwrModelMetricsDlppm1x_t), }) finally: _cyb_free(pod) pwr_model_metrics_dlppm1x_dtype = _get_pwr_model_metrics_dlppm1x_dtype_offsets() cdef object pwr_model_metrics_dlppm1x_dtype_record = _numpy.dtype((_numpy.record, pwr_model_metrics_dlppm1x_dtype)) cdef class PwrModelMetricsDlppm1x: """Empty-initialize an array of `nvmlPwrModelMetricsDlppm1x_t`. The resulting object is of length `size` and of dtype `pwr_model_metrics_dlppm1x_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `nvmlPwrModelMetricsDlppm1x_t` """ cdef: readonly object _data object _owner def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=pwr_model_metrics_dlppm1x_dtype_record) assert self._data.itemsize == sizeof(nvmlPwrModelMetricsDlppm1x_t), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlPwrModelMetricsDlppm1x_t) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}.PwrModelMetricsDlppm1x_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}.PwrModelMetricsDlppm1x object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, PwrModelMetricsDlppm1x)) 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 b_valid(self): """Union[~_numpy.uint8, int]: Validity flag: non-zero if metrics are valid.""" if self._data.size == 1: return int(self._data["b_valid"][0]) return self._data["b_valid"] @b_valid.setter def b_valid(self, val): if not self._data.flags.writeable: raise ValueError("This PwrModelMetricsDlppm1x instance is read-only") self._data["b_valid"] = val @property def core_rail(self): """core_rail_metrics_dtype: Core rail metrics.""" return self._data["core_rail"].view(_numpy.recarray) @core_rail.setter def core_rail(self, val): if not self._data.flags.writeable: raise ValueError("This PwrModelMetricsDlppm1x instance is read-only") self._data["core_rail"] = val @property def fb_rail(self): """rail_metrics_dtype: Fb rail metrics.""" return self._data["fb_rail"].view(_numpy.recarray) @fb_rail.setter def fb_rail(self, val): if not self._data.flags.writeable: raise ValueError("This PwrModelMetricsDlppm1x instance is read-only") self._data["fb_rail"] = val @property def tgp_pwr_tuple(self): """pmgr_pwr_tuple_dtype: Total Graphics Power (TGP) in milliwatts.""" return self._data["tgp_pwr_tuple"].view(_numpy.recarray) @tgp_pwr_tuple.setter def tgp_pwr_tuple(self, val): if not self._data.flags.writeable: raise ValueError("This PwrModelMetricsDlppm1x instance is read-only") self._data["tgp_pwr_tuple"] = val @property def perf_metrics(self): """pwr_model_metrics_dlppm1x_perf_dtype: Performance metrics.""" return self._data["perf_metrics"].view(_numpy.recarray) @perf_metrics.setter def perf_metrics(self, val): if not self._data.flags.writeable: raise ValueError("This PwrModelMetricsDlppm1x instance is read-only") self._data["perf_metrics"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef PwrModelMetricsDlppm1x obj 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 obj = PwrModelMetricsDlppm1x.__new__(PwrModelMetricsDlppm1x) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == pwr_model_metrics_dlppm1x_dtype: obj = PwrModelMetricsDlppm1x.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an PwrModelMetricsDlppm1x instance with the memory from the given buffer.""" return PwrModelMetricsDlppm1x.from_data(_numpy.frombuffer(buffer, dtype=pwr_model_metrics_dlppm1x_dtype)) @staticmethod def from_data(data): """Create an PwrModelMetricsDlppm1x instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `pwr_model_metrics_dlppm1x_dtype` holding the data. """ cdef PwrModelMetricsDlppm1x obj = PwrModelMetricsDlppm1x.__new__(PwrModelMetricsDlppm1x) 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 != pwr_model_metrics_dlppm1x_dtype: raise ValueError("data array must be of dtype pwr_model_metrics_dlppm1x_dtype") obj._data = data.view(dtype=pwr_model_metrics_dlppm1x_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an PwrModelMetricsDlppm1x 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 PwrModelMetricsDlppm1x obj = PwrModelMetricsDlppm1x.__new__(PwrModelMetricsDlppm1x) 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(nvmlPwrModelMetricsDlppm1x_t) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=pwr_model_metrics_dlppm1x_dtype_record) obj._owner = owner return obj cdef _get_perf_metrics_pfpp1x_sample_dtype_offsets(): cdef nvmlPerfMetricsPfpp1xSample_t *pod = _cyb_calloc(1, sizeof(nvmlPerfMetricsPfpp1xSample_t)) if pod == NULL: raise MemoryError("Error allocating nvmlPerfMetricsPfpp1xSample_t") try: return _numpy.dtype({ 'names': ['estimated_metrics'], 'formats': [pwr_model_metrics_pfpp1x_dtype], 'offsets': [ (&(pod.estimatedMetrics)) - (pod), ], 'itemsize': sizeof(nvmlPerfMetricsPfpp1xSample_t), }) finally: _cyb_free(pod) perf_metrics_pfpp1x_sample_dtype = _get_perf_metrics_pfpp1x_sample_dtype_offsets() cdef object perf_metrics_pfpp1x_sample_dtype_record = _numpy.dtype((_numpy.record, perf_metrics_pfpp1x_sample_dtype)) cdef class PerfMetricsPfpp1xSample: """Empty-initialize an array of `nvmlPerfMetricsPfpp1xSample_t`. The resulting object is of length `size` and of dtype `perf_metrics_pfpp1x_sample_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `nvmlPerfMetricsPfpp1xSample_t` """ cdef: readonly object _data object _owner def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=perf_metrics_pfpp1x_sample_dtype_record) assert self._data.itemsize == sizeof(nvmlPerfMetricsPfpp1xSample_t), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlPerfMetricsPfpp1xSample_t) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}.PerfMetricsPfpp1xSample_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}.PerfMetricsPfpp1xSample object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, PerfMetricsPfpp1xSample)) 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 estimated_metrics(self): """pwr_model_metrics_pfpp1x_dtype: Estimated metrics from the PFPP 1x controller.""" return self._data["estimated_metrics"].view(_numpy.recarray) @estimated_metrics.setter def estimated_metrics(self, val): if not self._data.flags.writeable: raise ValueError("This PerfMetricsPfpp1xSample instance is read-only") self._data["estimated_metrics"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef PerfMetricsPfpp1xSample obj 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 obj = PerfMetricsPfpp1xSample.__new__(PerfMetricsPfpp1xSample) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == perf_metrics_pfpp1x_sample_dtype: obj = PerfMetricsPfpp1xSample.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an PerfMetricsPfpp1xSample instance with the memory from the given buffer.""" return PerfMetricsPfpp1xSample.from_data(_numpy.frombuffer(buffer, dtype=perf_metrics_pfpp1x_sample_dtype)) @staticmethod def from_data(data): """Create an PerfMetricsPfpp1xSample instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `perf_metrics_pfpp1x_sample_dtype` holding the data. """ cdef PerfMetricsPfpp1xSample obj = PerfMetricsPfpp1xSample.__new__(PerfMetricsPfpp1xSample) 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 != perf_metrics_pfpp1x_sample_dtype: raise ValueError("data array must be of dtype perf_metrics_pfpp1x_sample_dtype") obj._data = data.view(dtype=perf_metrics_pfpp1x_sample_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an PerfMetricsPfpp1xSample 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 PerfMetricsPfpp1xSample obj = PerfMetricsPfpp1xSample.__new__(PerfMetricsPfpp1xSample) 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(nvmlPerfMetricsPfpp1xSample_t) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=perf_metrics_pfpp1x_sample_dtype_record) obj._owner = owner return obj cdef _get_pwr_model_metrics_dlppm1x_dramclk_estimates_dtype_offsets(): cdef nvmlPwrModelMetricsDlppm1xDramclkEstimates_t *pod = _cyb_calloc(1, sizeof(nvmlPwrModelMetricsDlppm1xDramclkEstimates_t)) if pod == NULL: raise MemoryError("Error allocating nvmlPwrModelMetricsDlppm1xDramclkEstimates_t") try: return _numpy.dtype({ 'names': ['estimated_metrics', 'num_estimated_metrics'], 'formats': [(pwr_model_metrics_dlppm1x_dtype, 8), _numpy.uint8], 'offsets': [ (&(pod.estimatedMetrics)) - (pod), (&(pod.numEstimatedMetrics)) - (pod), ], 'itemsize': sizeof(nvmlPwrModelMetricsDlppm1xDramclkEstimates_t), }) finally: _cyb_free(pod) pwr_model_metrics_dlppm1x_dramclk_estimates_dtype = _get_pwr_model_metrics_dlppm1x_dramclk_estimates_dtype_offsets() cdef object pwr_model_metrics_dlppm1x_dramclk_estimates_dtype_record = _numpy.dtype((_numpy.record, pwr_model_metrics_dlppm1x_dramclk_estimates_dtype)) cdef class PwrModelMetricsDlppm1xDramclkEstimates: """Empty-initialize an array of `nvmlPwrModelMetricsDlppm1xDramclkEstimates_t`. The resulting object is of length `size` and of dtype `pwr_model_metrics_dlppm1x_dramclk_estimates_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `nvmlPwrModelMetricsDlppm1xDramclkEstimates_t` """ cdef: readonly object _data object _owner readonly tuple _estimated_metrics def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=pwr_model_metrics_dlppm1x_dramclk_estimates_dtype_record) assert self._data.itemsize == sizeof(nvmlPwrModelMetricsDlppm1xDramclkEstimates_t), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlPwrModelMetricsDlppm1xDramclkEstimates_t) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}.PwrModelMetricsDlppm1xDramclkEstimates_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}.PwrModelMetricsDlppm1xDramclkEstimates object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, PwrModelMetricsDlppm1xDramclkEstimates)) 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 estimated_metrics(self): """PwrModelMetricsDlppm1x: Array of estimated metrics for each inference loop.""" if self._estimated_metrics is None: estimated_metrics_list = list() estimated_metrics_base = _cyb_array_ptr(self._data) estimated_metrics_offset = pwr_model_metrics_dlppm1x_dramclk_estimates_dtype.fields["estimated_metrics"][1] estimated_metrics_stride = self._data.strides[0] estimated_metrics_readonly = not self._data.flags.writeable estimated_metrics_sizes = self._data["num_estimated_metrics"] for i in range(self._data.size): addr = estimated_metrics_base + i * estimated_metrics_stride + estimated_metrics_offset n = int(estimated_metrics_sizes[i]) estimated_metrics_obj = PwrModelMetricsDlppm1x.from_ptr(addr, n, owner=self, readonly=estimated_metrics_readonly) estimated_metrics_list.append(estimated_metrics_obj) self._estimated_metrics = tuple(estimated_metrics_list) if self._data.size == 1: return self._estimated_metrics[0] return self._estimated_metrics def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef PwrModelMetricsDlppm1xDramclkEstimates obj 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 obj = PwrModelMetricsDlppm1xDramclkEstimates.__new__(PwrModelMetricsDlppm1xDramclkEstimates) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == pwr_model_metrics_dlppm1x_dramclk_estimates_dtype: obj = PwrModelMetricsDlppm1xDramclkEstimates.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an PwrModelMetricsDlppm1xDramclkEstimates instance with the memory from the given buffer.""" return PwrModelMetricsDlppm1xDramclkEstimates.from_data(_numpy.frombuffer(buffer, dtype=pwr_model_metrics_dlppm1x_dramclk_estimates_dtype)) @staticmethod def from_data(data): """Create an PwrModelMetricsDlppm1xDramclkEstimates instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `pwr_model_metrics_dlppm1x_dramclk_estimates_dtype` holding the data. """ cdef PwrModelMetricsDlppm1xDramclkEstimates obj = PwrModelMetricsDlppm1xDramclkEstimates.__new__(PwrModelMetricsDlppm1xDramclkEstimates) 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 != pwr_model_metrics_dlppm1x_dramclk_estimates_dtype: raise ValueError("data array must be of dtype pwr_model_metrics_dlppm1x_dramclk_estimates_dtype") obj._data = data.view(dtype=pwr_model_metrics_dlppm1x_dramclk_estimates_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an PwrModelMetricsDlppm1xDramclkEstimates 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 PwrModelMetricsDlppm1xDramclkEstimates obj = PwrModelMetricsDlppm1xDramclkEstimates.__new__(PwrModelMetricsDlppm1xDramclkEstimates) 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(nvmlPwrModelMetricsDlppm1xDramclkEstimates_t) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=pwr_model_metrics_dlppm1x_dramclk_estimates_dtype_record) obj._owner = owner return obj cdef _get_observed_metrics_dtype_offsets(): cdef nvmlObservedMetrics_t *pod = _cyb_calloc(1, sizeof(nvmlObservedMetrics_t)) if pod == NULL: raise MemoryError("Error allocating nvmlObservedMetrics_t") try: return _numpy.dtype({ 'names': ['initial_dramclk_est', 'b_valid', 'core_rail', 'fb_rail', 'tgp_pwr_tuple', 'perf_metrics'], 'formats': [(pwr_model_metrics_dlppm1x_dramclk_estimates_dtype, 3), _numpy.uint8, core_rail_metrics_dtype, rail_metrics_dtype, pmgr_pwr_tuple_dtype, pwr_model_metrics_dlppm1x_perf_dtype], 'offsets': [ (&(pod.initialDramclkEst)) - (pod), (&(pod.bValid)) - (pod), (&(pod.coreRail)) - (pod), (&(pod.fbRail)) - (pod), (&(pod.tgpPwrTuple)) - (pod), (&(pod.perfMetrics)) - (pod), ], 'itemsize': sizeof(nvmlObservedMetrics_t), }) finally: _cyb_free(pod) observed_metrics_dtype = _get_observed_metrics_dtype_offsets() cdef object observed_metrics_dtype_record = _numpy.dtype((_numpy.record, observed_metrics_dtype)) cdef class ObservedMetrics: """Empty-initialize an array of `nvmlObservedMetrics_t`. The resulting object is of length `size` and of dtype `observed_metrics_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `nvmlObservedMetrics_t` """ cdef: readonly object _data object _owner def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=observed_metrics_dtype_record) assert self._data.itemsize == sizeof(nvmlObservedMetrics_t), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlObservedMetrics_t) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}.ObservedMetrics_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}.ObservedMetrics object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, ObservedMetrics)) 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 initial_dramclk_est(self): """pwr_model_metrics_dlppm1x_dramclk_estimates_dtype: (array of length 3).Initial DRAMCLK estimates for different scenarios.""" return self._data["initial_dramclk_est"].view(_numpy.recarray) @initial_dramclk_est.setter def initial_dramclk_est(self, val): if not self._data.flags.writeable: raise ValueError("This ObservedMetrics instance is read-only") self._data["initial_dramclk_est"] = val @property def b_valid(self): """Union[~_numpy.uint8, int]: Validity flag: non-zero if observed metrics are valid.""" if self._data.size == 1: return int(self._data["b_valid"][0]) return self._data["b_valid"] @b_valid.setter def b_valid(self, val): if not self._data.flags.writeable: raise ValueError("This ObservedMetrics instance is read-only") self._data["b_valid"] = val @property def core_rail(self): """core_rail_metrics_dtype: Observed core rail metrics.""" return self._data["core_rail"].view(_numpy.recarray) @core_rail.setter def core_rail(self, val): if not self._data.flags.writeable: raise ValueError("This ObservedMetrics instance is read-only") self._data["core_rail"] = val @property def fb_rail(self): """rail_metrics_dtype: Observed fb rail metrics.""" return self._data["fb_rail"].view(_numpy.recarray) @fb_rail.setter def fb_rail(self, val): if not self._data.flags.writeable: raise ValueError("This ObservedMetrics instance is read-only") self._data["fb_rail"] = val @property def tgp_pwr_tuple(self): """pmgr_pwr_tuple_dtype: Observed Total Graphics Power (TGP) in milliwatts.""" return self._data["tgp_pwr_tuple"].view(_numpy.recarray) @tgp_pwr_tuple.setter def tgp_pwr_tuple(self, val): if not self._data.flags.writeable: raise ValueError("This ObservedMetrics instance is read-only") self._data["tgp_pwr_tuple"] = val @property def perf_metrics(self): """pwr_model_metrics_dlppm1x_perf_dtype: Observed performance metrics.""" return self._data["perf_metrics"].view(_numpy.recarray) @perf_metrics.setter def perf_metrics(self, val): if not self._data.flags.writeable: raise ValueError("This ObservedMetrics instance is read-only") self._data["perf_metrics"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef ObservedMetrics obj 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 obj = ObservedMetrics.__new__(ObservedMetrics) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == observed_metrics_dtype: obj = ObservedMetrics.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an ObservedMetrics instance with the memory from the given buffer.""" return ObservedMetrics.from_data(_numpy.frombuffer(buffer, dtype=observed_metrics_dtype)) @staticmethod def from_data(data): """Create an ObservedMetrics instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `observed_metrics_dtype` holding the data. """ cdef ObservedMetrics obj = ObservedMetrics.__new__(ObservedMetrics) 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 != observed_metrics_dtype: raise ValueError("data array must be of dtype observed_metrics_dtype") obj._data = data.view(dtype=observed_metrics_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an ObservedMetrics 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 ObservedMetrics obj = ObservedMetrics.__new__(ObservedMetrics) 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(nvmlObservedMetrics_t) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=observed_metrics_dtype_record) obj._owner = owner return obj cdef _get_perf_metrics_dlppc2x_sample_dtype_offsets(): cdef nvmlPerfMetricsDlppc2xSample_t *pod = _cyb_calloc(1, sizeof(nvmlPerfMetricsDlppc2xSample_t)) if pod == NULL: raise MemoryError("Error allocating nvmlPerfMetricsDlppc2xSample_t") try: return _numpy.dtype({ 'names': ['observed_metrics'], 'formats': [observed_metrics_dtype], 'offsets': [ (&(pod.observedMetrics)) - (pod), ], 'itemsize': sizeof(nvmlPerfMetricsDlppc2xSample_t), }) finally: _cyb_free(pod) perf_metrics_dlppc2x_sample_dtype = _get_perf_metrics_dlppc2x_sample_dtype_offsets() cdef object perf_metrics_dlppc2x_sample_dtype_record = _numpy.dtype((_numpy.record, perf_metrics_dlppc2x_sample_dtype)) cdef class PerfMetricsDlppc2xSample: """Empty-initialize an array of `nvmlPerfMetricsDlppc2xSample_t`. The resulting object is of length `size` and of dtype `perf_metrics_dlppc2x_sample_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `nvmlPerfMetricsDlppc2xSample_t` """ cdef: readonly object _data object _owner def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=perf_metrics_dlppc2x_sample_dtype_record) assert self._data.itemsize == sizeof(nvmlPerfMetricsDlppc2xSample_t), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlPerfMetricsDlppc2xSample_t) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}.PerfMetricsDlppc2xSample_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}.PerfMetricsDlppc2xSample object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, PerfMetricsDlppc2xSample)) 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 observed_metrics(self): """observed_metrics_dtype: Observed metrics from the DLPPC 2x controller.""" return self._data["observed_metrics"].view(_numpy.recarray) @observed_metrics.setter def observed_metrics(self, val): if not self._data.flags.writeable: raise ValueError("This PerfMetricsDlppc2xSample instance is read-only") self._data["observed_metrics"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef PerfMetricsDlppc2xSample obj 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 obj = PerfMetricsDlppc2xSample.__new__(PerfMetricsDlppc2xSample) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == perf_metrics_dlppc2x_sample_dtype: obj = PerfMetricsDlppc2xSample.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an PerfMetricsDlppc2xSample instance with the memory from the given buffer.""" return PerfMetricsDlppc2xSample.from_data(_numpy.frombuffer(buffer, dtype=perf_metrics_dlppc2x_sample_dtype)) @staticmethod def from_data(data): """Create an PerfMetricsDlppc2xSample instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `perf_metrics_dlppc2x_sample_dtype` holding the data. """ cdef PerfMetricsDlppc2xSample obj = PerfMetricsDlppc2xSample.__new__(PerfMetricsDlppc2xSample) 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 != perf_metrics_dlppc2x_sample_dtype: raise ValueError("data array must be of dtype perf_metrics_dlppc2x_sample_dtype") obj._data = data.view(dtype=perf_metrics_dlppc2x_sample_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an PerfMetricsDlppc2xSample 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 PerfMetricsDlppc2xSample obj = PerfMetricsDlppc2xSample.__new__(PerfMetricsDlppc2xSample) 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(nvmlPerfMetricsDlppc2xSample_t) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=perf_metrics_dlppc2x_sample_dtype_record) obj._owner = owner return obj cdef _get__py_anon_pod8_dtype_offsets(): cdef cuda_bindings_nvml__anon_pod8 *pod = _cyb_calloc(1, sizeof(cuda_bindings_nvml__anon_pod8)) if pod == NULL: raise MemoryError("Error allocating cuda_bindings_nvml__anon_pod8") try: return _numpy.dtype({ 'names': ['dlppc2x', 'pfpp1x'], 'formats': [perf_metrics_dlppc2x_sample_dtype, perf_metrics_pfpp1x_sample_dtype], 'offsets': [ (&(pod.dlppc2x)) - (pod), (&(pod.pfpp1x)) - (pod), ], 'itemsize': sizeof(cuda_bindings_nvml__anon_pod8), }) finally: _cyb_free(pod) _py_anon_pod8_dtype = _get__py_anon_pod8_dtype_offsets() cdef class _py_anon_pod8: """Empty-initialize an instance of `cuda_bindings_nvml__anon_pod8`. .. seealso:: `cuda_bindings_nvml__anon_pod8` """ cdef: cuda_bindings_nvml__anon_pod8 *_ptr object _owner 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._readonly = False def __dealloc__(self): cdef cuda_bindings_nvml__anon_pod8 *ptr if self._owns_ptr and self._ptr != NULL: ptr = self._ptr self._ptr = NULL _cyb_free(ptr) def __repr__(self): return f"<{__name__}._py_anon_pod8 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef _py_anon_pod8 other_ if not isinstance(other, _py_anon_pod8): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(cuda_bindings_nvml__anon_pod8)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(cuda_bindings_nvml__anon_pod8), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def dlppc2x(self): """PerfMetricsDlppc2xSample: """ return PerfMetricsDlppc2xSample.from_ptr( &(self._ptr[0].dlppc2x), 1, readonly=self._readonly, owner=self, ) @dlppc2x.setter def dlppc2x(self, val): if self._readonly: raise ValueError("This _py_anon_pod8 instance is read-only") cdef PerfMetricsDlppc2xSample val_ = val _cyb_memcpy(&(self._ptr[0].dlppc2x), (val_._get_ptr()), sizeof(nvmlPerfMetricsDlppc2xSample_t) * 1) @property def pfpp1x(self): """PerfMetricsPfpp1xSample: """ return PerfMetricsPfpp1xSample.from_ptr( &(self._ptr[0].pfpp1x), 1, readonly=self._readonly, owner=self, ) @pfpp1x.setter def pfpp1x(self, val): if self._readonly: raise ValueError("This _py_anon_pod8 instance is read-only") cdef PerfMetricsPfpp1xSample val_ = val _cyb_memcpy(&(self._ptr[0].pfpp1x), (val_._get_ptr()), sizeof(nvmlPerfMetricsPfpp1xSample_t) * 1) @staticmethod def from_buffer(buffer): """Create an _py_anon_pod8 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(cuda_bindings_nvml__anon_pod8), _py_anon_pod8) @staticmethod def from_data(data): """Create an _py_anon_pod8 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `_py_anon_pod8_dtype` holding the data. """ return _cyb_from_data(data, "_py_anon_pod8_dtype", _py_anon_pod8_dtype, _py_anon_pod8) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an _py_anon_pod8 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef _py_anon_pod8 obj = _py_anon_pod8.__new__(_py_anon_pod8) if owner is None: obj._ptr = _cyb_malloc(sizeof(cuda_bindings_nvml__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 else: obj._ptr = ptr obj._owns_ptr = False obj._owner = owner obj._readonly = readonly return obj cdef _get_perf_metric_controller_sample_dtype_offsets(): cdef nvmlPerfMetricControllerSample_t *pod = _cyb_calloc(1, sizeof(nvmlPerfMetricControllerSample_t)) if pod == NULL: raise MemoryError("Error allocating nvmlPerfMetricControllerSample_t") try: return _numpy.dtype({ 'names': ['controller_type', 'data_'], 'formats': [_numpy.uint32, _py_anon_pod8_dtype], 'offsets': [ (&(pod.controllerType)) - (pod), (&(pod.data)) - (pod), ], 'itemsize': sizeof(nvmlPerfMetricControllerSample_t), }) finally: _cyb_free(pod) perf_metric_controller_sample_dtype = _get_perf_metric_controller_sample_dtype_offsets() cdef object perf_metric_controller_sample_dtype_record = _numpy.dtype((_numpy.record, perf_metric_controller_sample_dtype)) cdef class PerfMetricControllerSample: """Empty-initialize an array of `nvmlPerfMetricControllerSample_t`. The resulting object is of length `size` and of dtype `perf_metric_controller_sample_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `nvmlPerfMetricControllerSample_t` """ cdef: readonly object _data object _owner def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=perf_metric_controller_sample_dtype_record) assert self._data.itemsize == sizeof(nvmlPerfMetricControllerSample_t), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlPerfMetricControllerSample_t) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}.PerfMetricControllerSample_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}.PerfMetricControllerSample object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, PerfMetricControllerSample)) 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 controller_type(self): """Union[~_numpy.uint32, int]: Controller type: NVML_PERF_METRICS_CONTROLLER_TYPE_DLPPC_2X or NVML_PERF_METRICS_CONTROLLER_TYPE_PFPP_1X.""" if self._data.size == 1: return int(self._data["controller_type"][0]) return self._data["controller_type"] @controller_type.setter def controller_type(self, val): if not self._data.flags.writeable: raise ValueError("This PerfMetricControllerSample instance is read-only") self._data["controller_type"] = val @property def data_(self): """_py_anon_pod8_dtype: Union containing controller-specific data.""" return self._data["data_"].view(_numpy.recarray) @data_.setter def data_(self, val): if not self._data.flags.writeable: raise ValueError("This PerfMetricControllerSample instance is read-only") self._data["data_"] = val def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef PerfMetricControllerSample obj 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 obj = PerfMetricControllerSample.__new__(PerfMetricControllerSample) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == perf_metric_controller_sample_dtype: obj = PerfMetricControllerSample.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an PerfMetricControllerSample instance with the memory from the given buffer.""" return PerfMetricControllerSample.from_data(_numpy.frombuffer(buffer, dtype=perf_metric_controller_sample_dtype)) @staticmethod def from_data(data): """Create an PerfMetricControllerSample instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `perf_metric_controller_sample_dtype` holding the data. """ cdef PerfMetricControllerSample obj = PerfMetricControllerSample.__new__(PerfMetricControllerSample) 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 != perf_metric_controller_sample_dtype: raise ValueError("data array must be of dtype perf_metric_controller_sample_dtype") obj._data = data.view(dtype=perf_metric_controller_sample_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an PerfMetricControllerSample 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 PerfMetricControllerSample obj = PerfMetricControllerSample.__new__(PerfMetricControllerSample) 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(nvmlPerfMetricControllerSample_t) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=perf_metric_controller_sample_dtype_record) obj._owner = owner return obj cdef _get_perf_metrics_sample_dtype_offsets(): cdef nvmlPerfMetricsSample_t *pod = _cyb_calloc(1, sizeof(nvmlPerfMetricsSample_t)) if pod == NULL: raise MemoryError("Error allocating nvmlPerfMetricsSample_t") try: return _numpy.dtype({ 'names': ['num_controller_data', 'controller_data'], 'formats': [_numpy.uint8, (perf_metric_controller_sample_dtype, 4)], 'offsets': [ (&(pod.numControllerData)) - (pod), (&(pod.controllerData)) - (pod), ], 'itemsize': sizeof(nvmlPerfMetricsSample_t), }) finally: _cyb_free(pod) perf_metrics_sample_dtype = _get_perf_metrics_sample_dtype_offsets() cdef object perf_metrics_sample_dtype_record = _numpy.dtype((_numpy.record, perf_metrics_sample_dtype)) cdef class PerfMetricsSample: """Empty-initialize an array of `nvmlPerfMetricsSample_t`. The resulting object is of length `size` and of dtype `perf_metrics_sample_dtype`. If default-constructed, the instance represents a single struct. Args: size (int): number of structs, default=1. .. seealso:: `nvmlPerfMetricsSample_t` """ cdef: readonly object _data object _owner readonly tuple _controller_data def __init__(self, size=1): self._data = _numpy.zeros(size, dtype=perf_metrics_sample_dtype_record) assert self._data.itemsize == sizeof(nvmlPerfMetricsSample_t), \ f"itemsize {self._data.itemsize} mismatches struct size { sizeof(nvmlPerfMetricsSample_t) }" def __repr__(self): if self._data.size > 1: return f"<{__name__}.PerfMetricsSample_Array_{self._data.size} object at {hex(id(self))}>" else: return f"<{__name__}.PerfMetricsSample object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return _cyb_array_ptr(self._data) cdef intptr_t _get_ptr(self): return _cyb_array_ptr(self._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 _cyb_array_ptr(self._data) def __len__(self): return self._data.size def __eq__(self, other): cdef object self_data = self._data if (not isinstance(other, PerfMetricsSample)) 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 controller_data(self): """PerfMetricControllerSample: Array of controller samples.""" if self._controller_data is None: controller_data_list = list() controller_data_base = _cyb_array_ptr(self._data) controller_data_offset = perf_metrics_sample_dtype.fields["controller_data"][1] controller_data_stride = self._data.strides[0] controller_data_readonly = not self._data.flags.writeable controller_data_sizes = self._data["num_controller_data"] for i in range(self._data.size): addr = controller_data_base + i * controller_data_stride + controller_data_offset n = int(controller_data_sizes[i]) controller_data_obj = PerfMetricControllerSample.from_ptr(addr, n, owner=self, readonly=controller_data_readonly) controller_data_list.append(controller_data_obj) self._controller_data = tuple(controller_data_list) if self._data.size == 1: return self._controller_data[0] return self._controller_data def __getitem__(self, key): cdef ssize_t key_ cdef ssize_t size cdef PerfMetricsSample obj 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 obj = PerfMetricsSample.__new__(PerfMetricsSample) obj._data = self._data[key_:key_+1] obj._owner = self._owner return obj out = self._data[key] if isinstance(out, _numpy.ndarray): if out.dtype == perf_metrics_sample_dtype: obj = PerfMetricsSample.from_data(out) obj._owner = self._owner return obj if out.dtype.names is not None: return out.view(_numpy.recarray) return out def __setitem__(self, key, val): self._data[key] = val @staticmethod def from_buffer(buffer): """Create an PerfMetricsSample instance with the memory from the given buffer.""" return PerfMetricsSample.from_data(_numpy.frombuffer(buffer, dtype=perf_metrics_sample_dtype)) @staticmethod def from_data(data): """Create an PerfMetricsSample instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a 1D array of dtype `perf_metrics_sample_dtype` holding the data. """ cdef PerfMetricsSample obj = PerfMetricsSample.__new__(PerfMetricsSample) 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 != perf_metrics_sample_dtype: raise ValueError("data array must be of dtype perf_metrics_sample_dtype") obj._data = data.view(dtype=perf_metrics_sample_dtype_record, type=_numpy.ndarray) return obj @staticmethod def from_ptr(intptr_t ptr, size_t size=1, bint readonly=False, object owner=None): """Create an PerfMetricsSample 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 PerfMetricsSample obj = PerfMetricsSample.__new__(PerfMetricsSample) 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(nvmlPerfMetricsSample_t) * size, flag) obj._data = _numpy.ndarray(size, buffer=buf, dtype=perf_metrics_sample_dtype_record) obj._owner = owner return obj cdef _get_perf_metrics_samples_v1_dtype_offsets(): cdef nvmlPerfMetricsSamples_v1_t *pod = _cyb_calloc(1, sizeof(nvmlPerfMetricsSamples_v1_t)) if pod == NULL: raise MemoryError("Error allocating nvmlPerfMetricsSamples_v1_t") try: return _numpy.dtype({ 'names': ['num_samples', 'samples'], 'formats': [_numpy.uint32, (perf_metrics_sample_dtype, 13)], 'offsets': [ (&(pod.numSamples)) - (pod), (&(pod.samples)) - (pod), ], 'itemsize': sizeof(nvmlPerfMetricsSamples_v1_t), }) finally: _cyb_free(pod) perf_metrics_samples_v1_dtype = _get_perf_metrics_samples_v1_dtype_offsets() cdef class PerfMetricsSamples_v1: """Empty-initialize an instance of `nvmlPerfMetricsSamples_v1_t`. .. seealso:: `nvmlPerfMetricsSamples_v1_t` """ cdef: nvmlPerfMetricsSamples_v1_t _data nvmlPerfMetricsSamples_v1_t *_ptr object _owner bint _readonly def __init__(self): self._ptr = &self._data self._owner = None self._readonly = False def __repr__(self): return f"<{__name__}.PerfMetricsSamples_v1 object at {hex(id(self))}>" @property def ptr(self): """Get the pointer address to the data as Python :class:`int`.""" return (self._ptr) cdef intptr_t _get_ptr(self): return (self._ptr) def __int__(self): return (self._ptr) def __eq__(self, other): cdef PerfMetricsSamples_v1 other_ if not isinstance(other, PerfMetricsSamples_v1): return False other_ = other return (_cyb_memcmp((self._ptr), (other_._ptr), sizeof(nvmlPerfMetricsSamples_v1_t)) == 0) def __getbuffer__(self, _cyb_cpython.Py_buffer *buffer, int flags): _cyb___getbuffer(self, buffer, self._ptr, sizeof(nvmlPerfMetricsSamples_v1_t), self._readonly) def __releasebuffer__(self, Py_buffer *buffer): pass def __setitem__(self, key, val): 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) @property def samples(self): """PerfMetricsSample: Array of performance metrics samples.""" return PerfMetricsSample.from_ptr( &(self._ptr[0].samples), self._ptr[0].numSamples, readonly=self._readonly, owner=self, ) @samples.setter def samples(self, val): if self._readonly: raise ValueError("This PerfMetricsSamples_v1 instance is read-only") cdef PerfMetricsSample val_ = val if len(val) > 13: raise ValueError(f"Expected length < 13 for field samples, got {len(val)}") self._ptr[0].numSamples = len(val) if len(val) == 0: return _cyb_memcpy(&(self._ptr[0].samples), (val_._get_ptr()), sizeof(nvmlPerfMetricsSample_t) * self._ptr[0].numSamples) @staticmethod def from_buffer(buffer): """Create an PerfMetricsSamples_v1 instance with the memory from the given buffer.""" return _cyb_from_buffer(buffer, sizeof(nvmlPerfMetricsSamples_v1_t), PerfMetricsSamples_v1) @staticmethod def from_data(data): """Create an PerfMetricsSamples_v1 instance wrapping the given NumPy array. Args: data (_numpy.ndarray): a single-element array of dtype `perf_metrics_samples_v1_dtype` holding the data. """ return _cyb_from_data(data, "perf_metrics_samples_v1_dtype", perf_metrics_samples_v1_dtype, PerfMetricsSamples_v1) @staticmethod def from_ptr(intptr_t ptr, bint readonly=False, object owner=None): """Create an PerfMetricsSamples_v1 instance wrapping the given pointer. Args: ptr (intptr_t): pointer address as Python :class:`int` to the data. owner (object): The Python object that owns the pointer. If not provided, data will be copied. readonly (bool): whether the data is read-only (to the user). default is `False`. """ if ptr == 0: raise ValueError("ptr must not be null (0)") cdef PerfMetricsSamples_v1 obj = PerfMetricsSamples_v1.__new__(PerfMetricsSamples_v1) if owner is None: _cyb_memcpy(&obj._data, ptr, sizeof(nvmlPerfMetricsSamples_v1_t)) obj._ptr = &obj._data obj._owner = None else: obj._ptr = ptr obj._owner = owner obj._readonly = readonly return obj 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:: With the environment variable ``NVML_MPS_DEVICE_ENUMERATION`` set to 1, this API selects the MPS locality-domain view described in ``MPS Locality Domain Device Enumeration``. .. 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: __status__ = nvmlInit_v2() check_status(__status__) 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. .. note:: With the environment variable ``NVML_MPS_DEVICE_ENUMERATION`` set to 1, this API selects the MPS locality-domain view. ``NVML_INIT_FLAG_NO_ATTACH`` is not supported in that view. See ``MPS Locality Domain Device Enumeration``. .. 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: __status__ = nvmlInitWithFlags(flags) check_status(__status__) 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. .. note:: The final matching shutdown releases the process-local MPS locality-domain view described in ``MPS Locality Domain Device Enumeration``. .. seealso:: `nvmlShutdown` """ with nogil: __status__ = nvmlShutdown() check_status(__status__) 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. .. note:: This helper is available in the MPS locality-domain view described in ``MPS Locality Domain Device Enumeration``. .. seealso:: `nvmlErrorString` """ cdef const char *_output_cstr_ cdef bytes _output_ with nogil: _output_cstr_ = nvmlErrorString(<_Return>result) _output_ = _output_cstr_ return _output_.decode() 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: str: Reference in which to return the version identifier. .. seealso:: `nvmlSystemGetDriverVersion` """ cdef unsigned int length = 80 cdef char[80] version with nogil: __status__ = nvmlSystemGetDriverVersion(version, length) check_status(__status__) return _cyb_cpython.PyUnicode_FromString(version) cpdef str system_get_nvml_version(): """Retrieves the version of the NVML library. For all products. Returns: str: Reference in which to return the version identifier. .. note:: This query is available in the MPS locality-domain view described in ``MPS Locality Domain Device Enumeration``. 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. .. seealso:: `nvmlSystemGetNVMLVersion` """ cdef unsigned int length = 80 cdef char[80] version with nogil: __status__ = nvmlSystemGetNVMLVersion(version, length) check_status(__status__) return _cyb_cpython.PyUnicode_FromString(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 retrieved 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. .. seealso:: `nvmlSystemGetCudaDriverVersion` """ cdef int cuda_driver_version with nogil: __status__ = nvmlSystemGetCudaDriverVersion(&cuda_driver_version) check_status(__status__) return cuda_driver_version 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. .. seealso:: `nvmlSystemGetCudaDriverVersion_v2` """ cdef int cuda_driver_version with nogil: __status__ = nvmlSystemGetCudaDriverVersion_v2(&cuda_driver_version) check_status(__status__) return cuda_driver_version 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. Returns: str: Reference in which to return the process name. .. seealso:: `nvmlSystemGetProcessName` """ cdef unsigned int length = 1024 cdef char[1024] name with nogil: __status__ = nvmlSystemGetProcessName(pid, name, length) check_status(__status__) return _cyb_cpython.PyUnicode_FromString(name) 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. .. seealso:: `nvmlSystemGetHicVersion` """ cdef unsigned int[1] hwbc_count = [0] with nogil: __status__ = nvmlSystemGetHicVersion(hwbc_count, NULL) 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: 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__ = 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. .. seealso:: `nvmlUnitGetCount` """ cdef unsigned int unit_count with nogil: __status__ = nvmlUnitGetCount(&unit_count) check_status(__status__) return unit_count 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``. Returns: intptr_t: Reference in which to return the unit handle. .. seealso:: `nvmlUnitGetHandleByIndex` """ cdef Unit unit with nogil: __status__ = nvmlUnitGetHandleByIndex(index, &unit) check_status(__status__) return unit 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. .. seealso:: `nvmlUnitGetUnitInfo` """ cdef UnitInfo info_py = UnitInfo() cdef nvmlUnitInfo_t *info = (info_py._get_ptr()) with nogil: __status__ = nvmlUnitGetUnitInfo(unit, info) check_status(__status__) return info_py 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. Returns: nvmlLedState_t: Reference in which to return the current LED state. .. seealso:: `nvmlUnitGetLedState` """ cdef LedState state_py = LedState() cdef nvmlLedState_t *state = (state_py._get_ptr()) with nogil: __status__ = nvmlUnitGetLedState(unit, state) check_status(__status__) return state_py 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. .. seealso:: `nvmlUnitGetPsuInfo` """ cdef PSUInfo psu_py = PSUInfo() cdef nvmlPSUInfo_t *psu = (psu_py._get_ptr()) with nogil: __status__ = nvmlUnitGetPsuInfo(unit, psu) check_status(__status__) return psu_py 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. .. seealso:: `nvmlUnitGetTemperature` """ cdef unsigned int temp with nogil: __status__ = nvmlUnitGetTemperature(unit, type, &temp) check_status(__status__) return temp 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. .. seealso:: `nvmlUnitGetFanSpeedInfo` """ cdef UnitFanSpeeds fan_speeds_py = UnitFanSpeeds() cdef nvmlUnitFanSpeeds_t *fan_speeds = (fan_speeds_py._get_ptr()) with nogil: __status__ = nvmlUnitGetFanSpeedInfo(unit, fan_speeds) check_status(__status__) 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. .. note:: In the MPS locality-domain view, this API returns the number of MPS-reported device entries. Each locality domain has its own NVML index and ``nvmlDevice_t`` handle. See ``MPS Locality Domain Device Enumeration``. .. seealso:: `nvmlDeviceGetCount_v2` """ cdef unsigned int device_count with nogil: __status__ = nvmlDeviceGetCount_v2(&device_count) check_status(__status__) return device_count 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() cdef nvmlDeviceAttributes_t *attributes = (attributes_py._get_ptr()) with nogil: __status__ = nvmlDeviceGetAttributes_v2(device, attributes) check_status(__status__) return attributes_py 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``. Returns: intptr_t: Reference in which to return the device handle. .. note:: In the MPS locality-domain view, this API returns the locality-domain handle associated with ``index``. See ``MPS Locality Domain Device Enumeration``. .. seealso:: `nvmlDeviceGetHandleByIndex_v2` """ cdef Device device with nogil: __status__ = nvmlDeviceGetHandleByIndex_v2(index, &device) check_status(__status__) return device 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. Returns: intptr_t: Reference in which to return the device handle. .. seealso:: `nvmlDeviceGetHandleBySerial` """ if not isinstance(serial, str): raise TypeError("serial must be a Python str") cdef bytes _temp_serial_ = (serial).encode() cdef char* _serial_ = _temp_serial_ cdef Device device with nogil: __status__ = nvmlDeviceGetHandleBySerial(_serial_, &device) check_status(__status__) return device 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. .. note:: In the MPS locality-domain view, this API returns the locality-domain handle whose MPS-provided UUID matches ``uuid``. See ``MPS Locality Domain Device Enumeration``. .. seealso:: `nvmlDeviceGetHandleByUUID` """ if not isinstance(uuid, str): raise TypeError("uuid must be a Python str") cdef bytes _temp_uuid_ = (uuid).encode() cdef char* _uuid_ = _temp_uuid_ cdef Device device with nogil: __status__ = nvmlDeviceGetHandleByUUID(_uuid_, &device) check_status(__status__) return device 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. 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. .. note:: In the MPS locality-domain view, multiple locality domains can share a PCI bus ID. This API returns the first matching handle in NVML enumeration order. Use UUID or index to select a specific locality domain. See ``MPS Locality Domain Device Enumeration``. .. seealso:: `nvmlDeviceGetHandleByPciBusId_v2` """ if not isinstance(pci_bus_id, str): raise TypeError("pci_bus_id must be a Python str") cdef bytes _temp_pci_bus_id_ = (pci_bus_id).encode() cdef char* _pci_bus_id_ = _temp_pci_bus_id_ cdef Device device with nogil: __status__ = nvmlDeviceGetHandleByPciBusId_v2(_pci_bus_id_, &device) check_status(__status__) return device 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. Returns: str: Reference in which to return the product name. .. note:: In the MPS locality-domain view, this API returns the name supplied by MPS for the locality domain. See ``MPS Locality Domain Device Enumeration``. .. seealso:: `nvmlDeviceGetName` """ cdef unsigned int length = 96 cdef char[96] name with nogil: __status__ = nvmlDeviceGetName(device, name, length) check_status(__status__) return _cyb_cpython.PyUnicode_FromString(name) 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. Returns: int: Reference in which to return the product brand type. .. seealso:: `nvmlDeviceGetBrand` """ cdef _BrandType type with nogil: __status__ = nvmlDeviceGetBrand(device, &type) check_status(__status__) return type 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. .. note:: In the MPS locality-domain view, this API returns the NVML index of the locality-domain handle. See ``MPS Locality Domain Device Enumeration``. .. seealso:: `nvmlDeviceGetIndex` """ cdef unsigned int index with nogil: __status__ = nvmlDeviceGetIndex(device, &index) check_status(__status__) return index 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: str: Reference in which to return the board/module serial number. .. seealso:: `nvmlDeviceGetSerial` """ cdef unsigned int length = 30 cdef char[30] serial with nogil: __status__ = nvmlDeviceGetSerial(device, serial, length) check_status(__status__) return _cyb_cpython.PyUnicode_FromString(serial) 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. Returns: unsigned int: Unique identifier for the GPU module. .. seealso:: `nvmlDeviceGetModuleId` """ cdef unsigned int module_id with nogil: __status__ = nvmlDeviceGetModuleId(device, &module_id) check_status(__status__) return module_id 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. .. seealso:: `nvmlDeviceGetC2cModeInfoV` """ cdef C2cModeInfo_v1 c2c_mode_info_py = C2cModeInfo_v1() cdef nvmlC2cModeInfo_v1_t *c2c_mode_info = (c2c_mode_info_py._get_ptr()) with nogil: __status__ = nvmlDeviceGetC2cModeInfoV(device, c2c_mode_info) check_status(__status__) return c2c_mode_info_py 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. 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. .. 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` """ 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__) return node_set 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. scope (unsigned int): Scope that change the default behavior. Returns: unsigned long: Array reference in which to return a bitmask of 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` """ 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__) return cpu_set 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. Returns: unsigned long: Array reference in which to return a bitmask of CPUs, 64 CPUs per unsigned long on 64-bit machines, 32 on 32-bit machines. .. note:: In the MPS locality-domain view, this API returns the CPU affinity of the physical parent associated with the locality-domain handle. See ``MPS Locality Domain Device Enumeration``. .. seealso:: `nvmlDeviceGetCpuAffinity` """ 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__) return cpu_set 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. .. seealso:: `nvmlDeviceSetCpuAffinity` """ with nogil: __status__ = nvmlDeviceSetCpuAffinity(device) check_status(__status__) 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. .. seealso:: `nvmlDeviceClearCpuAffinity` """ with nogil: __status__ = nvmlDeviceClearCpuAffinity(device) check_status(__status__) 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. Returns: unsigned int: NUMA node ID of the device. .. note:: In the MPS locality-domain view, this API returns the NUMA node supplied by MPS for the locality domain. See ``MPS Locality Domain Device Enumeration``. .. seealso:: `nvmlDeviceGetNumaNodeId` """ cdef unsigned int node with nogil: __status__ = nvmlDeviceGetNumaNodeId(device, &node) check_status(__status__) return node 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. Returns: int: A ``nvmlGpuTopologyLevel_t`` that gives the path type. .. seealso:: `nvmlDeviceGetTopologyCommonAncestor` """ cdef _GpuTopologyLevel path_info with nogil: __status__ = nvmlDeviceGetTopologyCommonAncestor(device1, device2, &path_info) check_status(__status__) 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``. Returns: int: Reference in which to return the status of the ``p2p_index`` between ``device1`` and ``device2``. .. note:: In the MPS locality-domain view, this API returns the directed P2P status supplied by MPS for the two locality-domain handles. See ``MPS Locality Domain Device Enumeration``. .. seealso:: `nvmlDeviceGetP2PStatus` """ cdef _GpuP2PStatus p2p_status with nogil: __status__ = nvmlDeviceGetP2PStatus(device1, device2, <_GpuP2PCapsIndex>p2p_index, &p2p_status) check_status(__status__) return p2p_status 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. Returns: str: Reference in which to return the GPU UUID. .. note:: In the MPS locality-domain view, this API returns the UUID supplied by MPS for the locality domain. See ``MPS Locality Domain Device Enumeration``. .. seealso:: `nvmlDeviceGetUUID` """ cdef unsigned int length = 96 cdef char[96] uuid with nogil: __status__ = nvmlDeviceGetUUID(device, uuid, length) check_status(__status__) return _cyb_cpython.PyUnicode_FromString(uuid) 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. .. seealso:: `nvmlDeviceGetMinorNumber` """ cdef unsigned int minor_number with nogil: __status__ = nvmlDeviceGetMinorNumber(device, &minor_number) check_status(__status__) return minor_number 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. Returns: str: Reference to the buffer to return. .. seealso:: `nvmlDeviceGetBoardPartNumber` """ cdef unsigned int length = 80 cdef char[80] part_number with nogil: __status__ = nvmlDeviceGetBoardPartNumber(device, part_number, length) check_status(__status__) return _cyb_cpython.PyUnicode_FromString(part_number) 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. Returns: str: Reference in which to return the infoROM version. .. seealso:: `nvmlDeviceGetInforomVersion` """ cdef unsigned int length = 16 cdef char[16] version with nogil: __status__ = nvmlDeviceGetInforomVersion(device, <_InforomObject>object, version, length) check_status(__status__) return _cyb_cpython.PyUnicode_FromString(version) 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. Returns: str: Reference in which to return the infoROM image version. .. seealso:: `nvmlDeviceGetInforomImageVersion` """ cdef unsigned int length = 16 cdef char[16] version with nogil: __status__ = nvmlDeviceGetInforomImageVersion(device, version, length) check_status(__status__) return _cyb_cpython.PyUnicode_FromString(version) 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. Returns: unsigned int: Reference in which to return the infoROM configuration checksum. .. seealso:: `nvmlDeviceGetInforomConfigurationChecksum` """ cdef unsigned int checksum with nogil: __status__ = nvmlDeviceGetInforomConfigurationChecksum(device, &checksum) check_status(__status__) return checksum 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. .. seealso:: `nvmlDeviceValidateInforom` """ with nogil: __status__ = nvmlDeviceValidateInforom(device) check_status(__status__) 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. .. seealso:: `nvmlDeviceGetLastBBXFlushTime` """ cdef unsigned long long timestamp cdef unsigned long duration_us with nogil: __status__ = nvmlDeviceGetLastBBXFlushTime(device, ×tamp, &duration_us) check_status(__status__) return (timestamp, duration_us) 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. Returns: int: Reference in which to return the display mode. .. seealso:: `nvmlDeviceGetDisplayMode` """ cdef _EnableState display with nogil: __status__ = nvmlDeviceGetDisplayMode(device, &display) check_status(__status__) return display 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. Returns: int: Reference in which to return the display active state. .. seealso:: `nvmlDeviceGetDisplayActive` """ cdef _EnableState is_active with nogil: __status__ = nvmlDeviceGetDisplayActive(device, &is_active) check_status(__status__) return is_active 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. .. seealso:: `nvmlDeviceGetPersistenceMode` """ cdef _EnableState mode with nogil: __status__ = nvmlDeviceGetPersistenceMode(device, &mode) check_status(__status__) return mode 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. .. seealso:: `nvmlDeviceGetPciInfoExt` """ cdef PciInfoExt_v1 pci_py = PciInfoExt_v1() cdef nvmlPciInfoExt_t *pci = (pci_py._get_ptr()) pci.version = NVML_VERSION_STRUCT(sizeof(nvmlPciInfoExt_v1_t), 1) with nogil: __status__ = nvmlDeviceGetPciInfoExt(device, pci) check_status(__status__) return pci_py 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. Returns: nvmlPciInfo_t: Reference in which to return the PCI info. .. note:: In the MPS locality-domain view, this API and its v1 and v2 variants return the PCI attributes supplied by MPS. Multiple locality domains can report the same physical parent's PCI attributes. See ``MPS Locality Domain Device Enumeration``. .. seealso:: `nvmlDeviceGetPciInfo_v3` """ cdef PciInfo pci_py = PciInfo() cdef nvmlPciInfo_t *pci = (pci_py._get_ptr()) with nogil: __status__ = nvmlDeviceGetPciInfo_v3(device, pci) check_status(__status__) return pci_py 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. Returns: unsigned int: Reference in which to return the max PCIe link generation. .. seealso:: `nvmlDeviceGetMaxPcieLinkGeneration` """ cdef unsigned int max_link_gen with nogil: __status__ = nvmlDeviceGetMaxPcieLinkGeneration(device, &max_link_gen) check_status(__status__) return max_link_gen 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. Returns: unsigned int: Reference in which to return the max PCIe link generation. .. seealso:: `nvmlDeviceGetGpuMaxPcieLinkGeneration` """ cdef unsigned int max_link_gen_device with nogil: __status__ = nvmlDeviceGetGpuMaxPcieLinkGeneration(device, &max_link_gen_device) check_status(__status__) return max_link_gen_device 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. Returns: unsigned int: Reference in which to return the max PCIe link generation. .. seealso:: `nvmlDeviceGetMaxPcieLinkWidth` """ cdef unsigned int max_link_width with nogil: __status__ = nvmlDeviceGetMaxPcieLinkWidth(device, &max_link_width) check_status(__status__) return max_link_width 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. .. seealso:: `nvmlDeviceGetCurrPcieLinkGeneration` """ cdef unsigned int curr_link_gen with nogil: __status__ = nvmlDeviceGetCurrPcieLinkGeneration(device, &curr_link_gen) check_status(__status__) return curr_link_gen 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. .. seealso:: `nvmlDeviceGetCurrPcieLinkWidth` """ cdef unsigned int curr_link_width with nogil: __status__ = nvmlDeviceGetCurrPcieLinkWidth(device, &curr_link_width) check_status(__status__) return curr_link_width 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 queried ``nvmlPcieUtilCounter_t``. Returns: unsigned int: Reference in which to return throughput in KB/s. .. seealso:: `nvmlDeviceGetPcieThroughput` """ cdef unsigned int value with nogil: __status__ = nvmlDeviceGetPcieThroughput(device, <_PcieUtilCounter>counter, &value) check_status(__status__) return value 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. .. seealso:: `nvmlDeviceGetPcieReplayCounter` """ cdef unsigned int value with nogil: __status__ = nvmlDeviceGetPcieReplayCounter(device, &value) check_status(__status__) return value 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. .. seealso:: `nvmlDeviceGetClockInfo` """ cdef unsigned int clock with nogil: __status__ = nvmlDeviceGetClockInfo(device, <_ClockType>type, &clock) check_status(__status__) return clock 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. .. note:: Current P0 clocks (reported by ``nvmlDeviceGetClockInfo``) can differ from max clocks by a few MHz. .. seealso:: `nvmlDeviceGetMaxClockInfo` """ cdef unsigned int clock with nogil: __status__ = nvmlDeviceGetMaxClockInfo(device, <_ClockType>type, &clock) check_status(__status__) return clock 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. Returns: int: The retrieved GPCCLK VF offset value. .. seealso:: `nvmlDeviceGetGpcClkVfOffset` """ cdef int offset with nogil: __status__ = nvmlDeviceGetGpcClkVfOffset(device, &offset) check_status(__status__) return offset 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. Returns: unsigned int: Reference in which to return the clock in MHz. .. seealso:: `nvmlDeviceGetClock` """ cdef unsigned int clock_m_hz with nogil: __status__ = nvmlDeviceGetClock(device, <_ClockType>clock_type, <_ClockId>clock_id, &clock_m_hz) check_status(__status__) return clock_m_hz 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. Returns: unsigned int: Reference in which to return the clock in MHz. .. seealso:: `nvmlDeviceGetMaxCustomerBoostClock` """ cdef unsigned int clock_m_hz with nogil: __status__ = nvmlDeviceGetMaxCustomerBoostClock(device, <_ClockType>clock_type, &clock_m_hz) check_status(__status__) return clock_m_hz 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. Returns: unsigned int: Reference in which to return the clock in MHz. .. seealso:: `nvmlDeviceGetSupportedMemoryClocks` """ cdef unsigned int[1] count = [0] with nogil: __status__ = nvmlDeviceGetSupportedMemoryClocks(device, count, NULL) check_status_size(__status__) 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. Returns: unsigned int: Reference in which to return the clocks in MHz. .. seealso:: `nvmlDeviceGetSupportedGraphicsClocks` """ cdef unsigned int[1] count = [0] with nogil: __status__ = nvmlDeviceGetSupportedGraphicsClocks(device, memory_clock_m_hz, count, NULL) check_status_size(__status__) 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. .. seealso:: `nvmlDeviceGetAutoBoostedClocksEnabled` """ cdef _EnableState is_enabled cdef _EnableState default_is_enabled with nogil: __status__ = nvmlDeviceGetAutoBoostedClocksEnabled(device, &is_enabled, &default_is_enabled) check_status(__status__) return (is_enabled, default_is_enabled) 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. Returns: unsigned int: Reference in which to return the fan speed percentage. .. seealso:: `nvmlDeviceGetFanSpeed` """ cdef unsigned int speed with nogil: __status__ = nvmlDeviceGetFanSpeed(device, &speed) check_status(__status__) return speed 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. Returns: unsigned int: Reference in which to return the fan speed percentage. .. seealso:: `nvmlDeviceGetFanSpeed_v2` """ cdef unsigned int speed with nogil: __status__ = nvmlDeviceGetFanSpeed_v2(device, fan, &speed) check_status(__status__) return speed 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. Returns: unsigned int: Reference in which to return the fan speed percentage. .. seealso:: `nvmlDeviceGetTargetFanSpeed` """ cdef unsigned int target_speed with nogil: __status__ = nvmlDeviceGetTargetFanSpeed(device, fan, &target_speed) check_status(__status__) return target_speed 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. .. seealso:: `nvmlDeviceGetMinMaxFanSpeed` """ cdef unsigned int min_speed cdef unsigned int max_speed with nogil: __status__ = nvmlDeviceGetMinMaxFanSpeed(device, &min_speed, &max_speed) check_status(__status__) return (min_speed, max_speed) 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. Returns: unsigned int: Reference in which to return the fan control ``policy``. .. seealso:: `nvmlDeviceGetFanControlPolicy_v2` """ cdef nvmlFanControlPolicy_t policy with nogil: __status__ = nvmlDeviceGetFanControlPolicy_v2(device, fan, &policy) check_status(__status__) return policy 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. Returns: unsigned int: The number of fans. .. seealso:: `nvmlDeviceGetNumFans` """ cdef unsigned int num_fans with nogil: __status__ = nvmlDeviceGetNumFans(device, &num_fans) check_status(__status__) return num_fans 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). .. seealso:: `nvmlDeviceGetCoolerInfo` """ cdef CoolerInfo_v1 cooler_info_py = CoolerInfo_v1() cdef nvmlCoolerInfo_t *cooler_info = (cooler_info_py._get_ptr()) cooler_info.version = NVML_VERSION_STRUCT(sizeof(nvmlCoolerInfo_v1_t), 1) with nogil: __status__ = nvmlDeviceGetCoolerInfo(device, cooler_info) check_status(__status__) return cooler_info_py 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 value queried. Returns: unsigned int: Reference in which to return the temperature reading. .. seealso:: `nvmlDeviceGetTemperatureThreshold` """ cdef unsigned int temp with nogil: __status__ = nvmlDeviceGetTemperatureThreshold(device, <_TemperatureThresholds>threshold_type, &temp) check_status(__status__) return temp 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. .. seealso:: `nvmlDeviceGetThermalSettings` """ cdef GpuThermalSettings p_thermal_settings_py = GpuThermalSettings() cdef nvmlGpuThermalSettings_t *p_thermal_settings = (p_thermal_settings_py._get_ptr()) with nogil: __status__ = nvmlDeviceGetThermalSettings(device, sensor_index, p_thermal_settings) check_status(__status__) return p_thermal_settings_py 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. .. seealso:: `nvmlDeviceGetPerformanceState` """ cdef _Pstates p_state with nogil: __status__ = nvmlDeviceGetPerformanceState(device, &p_state) check_status(__status__) return p_state 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. .. 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 with nogil: __status__ = nvmlDeviceGetCurrentClocksEventReasons(device, &clocks_event_reasons) check_status(__status__) return clocks_event_reasons 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. Returns: unsigned long long: Reference in which to return bitmask of supported clocks event reasons. .. seealso:: `nvmlDeviceGetSupportedClocksEventReasons` """ cdef unsigned long long supported_clocks_event_reasons with nogil: __status__ = nvmlDeviceGetSupportedClocksEventReasons(device, &supported_clocks_event_reasons) check_status(__status__) return supported_clocks_event_reasons 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. .. seealso:: `nvmlDeviceGetPowerState` """ cdef _Pstates p_state with nogil: __status__ = nvmlDeviceGetPowerState(device, &p_state) check_status(__status__) return p_state cpdef object device_get_dynamic_pstates_info(intptr_t device): """Retrieve performance monitor samples from the associated subdevice. Args: device (intptr_t): . Returns: nvmlGpuDynamicPstatesInfo_t: . .. seealso:: `nvmlDeviceGetDynamicPstatesInfo` """ cdef GpuDynamicPstatesInfo p_dynamic_pstates_info_py = GpuDynamicPstatesInfo() cdef nvmlGpuDynamicPstatesInfo_t *p_dynamic_pstates_info = (p_dynamic_pstates_info_py._get_ptr()) with nogil: __status__ = nvmlDeviceGetDynamicPstatesInfo(device, p_dynamic_pstates_info) check_status(__status__) return p_dynamic_pstates_info_py 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. Returns: int: The retrieved MemClk VF offset value. .. seealso:: `nvmlDeviceGetMemClkVfOffset` """ cdef int offset with nogil: __status__ = nvmlDeviceGetMemClkVfOffset(device, &offset) check_status(__status__) return offset 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. pstate (Pstates): PState to query. 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. .. seealso:: `nvmlDeviceGetMinMaxClockOfPState` """ cdef unsigned int min_clock_m_hz cdef unsigned int max_clock_m_hz with nogil: __status__ = nvmlDeviceGetMinMaxClockOfPState(device, <_ClockType>type, <_Pstates>pstate, &min_clock_m_hz, &max_clock_m_hz) check_status(__status__) return (min_clock_m_hz, max_clock_m_hz) 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. .. seealso:: `nvmlDeviceGetGpcClkMinMaxVfOffset` """ cdef int min_offset cdef int max_offset with nogil: __status__ = nvmlDeviceGetGpcClkMinMaxVfOffset(device, &min_offset, &max_offset) check_status(__status__) return (min_offset, max_offset) 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. .. seealso:: `nvmlDeviceGetMemClkMinMaxVfOffset` """ cdef int min_offset cdef int max_offset with nogil: __status__ = nvmlDeviceGetMemClkMinMaxVfOffset(device, &min_offset, &max_offset) check_status(__status__) return (min_offset, max_offset) 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). .. seealso:: `nvmlDeviceSetClockOffsets` """ cdef intptr_t _info_ptr_ = 0 if info is None else int(info) with nogil: __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. .. seealso:: `nvmlDeviceGetPowerManagementLimit` """ cdef unsigned int limit with nogil: __status__ = nvmlDeviceGetPowerManagementLimit(device, &limit) check_status(__status__) return limit 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. - unsigned int: Reference in which to return the maximum power management limit in milliwatts. .. seealso:: `nvmlDeviceGetPowerManagementLimitConstraints` """ cdef unsigned int min_limit cdef unsigned int max_limit with nogil: __status__ = nvmlDeviceGetPowerManagementLimitConstraints(device, &min_limit, &max_limit) check_status(__status__) return (min_limit, max_limit) 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. Returns: unsigned int: Reference in which to return the default power management limit in milliwatts. .. seealso:: `nvmlDeviceGetPowerManagementDefaultLimit` """ cdef unsigned int default_limit with nogil: __status__ = nvmlDeviceGetPowerManagementDefaultLimit(device, &default_limit) check_status(__status__) return default_limit 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. Returns: unsigned int: Reference in which to return the power usage information. .. seealso:: `nvmlDeviceGetPowerUsage` """ cdef unsigned int power with nogil: __status__ = nvmlDeviceGetPowerUsage(device, &power) check_status(__status__) return power 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. Returns: unsigned long long: Reference in which to return the energy consumption information. .. seealso:: `nvmlDeviceGetTotalEnergyConsumption` """ cdef unsigned long long energy with nogil: __status__ = nvmlDeviceGetTotalEnergyConsumption(device, &energy) check_status(__status__) return energy 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. .. seealso:: `nvmlDeviceGetEnforcedPowerLimit` """ cdef unsigned int limit with nogil: __status__ = nvmlDeviceGetEnforcedPowerLimit(device, &limit) check_status(__status__) return limit 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. .. seealso:: `nvmlDeviceGetGpuOperationMode` """ cdef _GpuOperationMode current cdef _GpuOperationMode pending with nogil: __status__ = nvmlDeviceGetGpuOperationMode(device, ¤t, &pending) check_status(__status__) return (current, pending) 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. Returns: 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. .. note:: In the MPS locality-domain view, this API returns MPS-provided total, used, free, and reserved memory for the locality domain. See ``MPS Locality Domain Device Enumeration``. .. seealso:: `nvmlDeviceGetMemoryInfo_v2` """ cdef Memory_v2 memory_py = Memory_v2() cdef nvmlMemory_v2_t *memory = (memory_py._get_ptr()) memory.version = NVML_VERSION_STRUCT(sizeof(nvmlMemory_v2_t), 2) with nogil: __status__ = nvmlDeviceGetMemoryInfo_v2(device, memory) check_status(__status__) return memory_py 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. 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 with nogil: __status__ = nvmlDeviceGetComputeMode(device, &mode) check_status(__status__) return mode 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. - int: Reference in which to return the minor CUDA compute capability. .. note:: In the MPS locality-domain view, this API returns the compute capability supplied by MPS for the locality domain. See ``MPS Locality Domain Device Enumeration``. .. seealso:: `nvmlDeviceGetCudaComputeCapability` """ cdef int major cdef int minor with nogil: __status__ = nvmlDeviceGetCudaComputeCapability(device, &major, &minor) check_status(__status__) return (major, minor) 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. .. seealso:: `nvmlDeviceGetEccMode` """ cdef _EnableState current cdef _EnableState pending with nogil: __status__ = nvmlDeviceGetEccMode(device, ¤t, &pending) check_status(__status__) return (current, pending) 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. Returns: int: Reference in which to return the default ECC mode. .. seealso:: `nvmlDeviceGetDefaultEccMode` """ cdef _EnableState default_mode with nogil: __status__ = nvmlDeviceGetDefaultEccMode(device, &default_mode) check_status(__status__) return default_mode 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. .. seealso:: `nvmlDeviceGetBoardId` """ cdef unsigned int board_id with nogil: __status__ = nvmlDeviceGetBoardId(device, &board_id) check_status(__status__) return board_id 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. .. seealso:: `nvmlDeviceGetMultiGpuBoard` """ cdef unsigned int multi_gpu_bool with nogil: __status__ = nvmlDeviceGetMultiGpuBoard(device, &multi_gpu_bool) check_status(__status__) return multi_gpu_bool 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. Returns: unsigned long long: Reference in which to return the specified ECC errors. .. seealso:: `nvmlDeviceGetTotalEccErrors` """ cdef unsigned long long ecc_counts with nogil: __status__ = nvmlDeviceGetTotalEccErrors(device, <_MemoryErrorType>error_type, <_EccCounterType>counter_type, &ecc_counts) check_status(__status__) return ecc_counts 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. location_type (MemoryLocation): Specifies the location of the counter. Returns: 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 with nogil: __status__ = nvmlDeviceGetMemoryErrorCounter(device, <_MemoryErrorType>error_type, <_EccCounterType>counter_type, <_MemoryLocation>location_type, &count) check_status(__status__) return count 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. .. 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() cdef nvmlUtilization_t *utilization = (utilization_py._get_ptr()) with nogil: __status__ = nvmlDeviceGetUtilizationRates(device, utilization) check_status(__status__) return utilization_py 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. .. note:: On MIG-enabled GPUs, querying encoder utilization is not currently supported. .. seealso:: `nvmlDeviceGetEncoderUtilization` """ cdef unsigned int utilization cdef unsigned int sampling_period_us with nogil: __status__ = nvmlDeviceGetEncoderUtilization(device, &utilization, &sampling_period_us) check_status(__status__) return (utilization, sampling_period_us) 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. Returns: unsigned int: Reference to an unsigned int for the encoder capacity. .. seealso:: `nvmlDeviceGetEncoderCapacity` """ cdef unsigned int encoder_capacity with nogil: __status__ = nvmlDeviceGetEncoderCapacity(device, <_EncoderType>encoder_query_type, &encoder_capacity) check_status(__status__) return encoder_capacity 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. .. seealso:: `nvmlDeviceGetEncoderStats` """ cdef unsigned int session_count cdef unsigned int average_fps cdef unsigned int average_latency with nogil: __status__ = nvmlDeviceGetEncoderStats(device, &session_count, &average_fps, &average_latency) check_status(__status__) return (session_count, average_fps, average_latency) 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. .. seealso:: `nvmlDeviceGetEncoderSessions` """ cdef unsigned int[1] session_count = [0] with nogil: __status__ = nvmlDeviceGetEncoderSessions(device, session_count, NULL) 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: 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. .. note:: On MIG-enabled GPUs, querying decoder utilization is not currently supported. .. seealso:: `nvmlDeviceGetDecoderUtilization` """ cdef unsigned int utilization cdef unsigned int sampling_period_us with nogil: __status__ = nvmlDeviceGetDecoderUtilization(device, &utilization, &sampling_period_us) check_status(__status__) return (utilization, sampling_period_us) 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. .. note:: On MIG-enabled GPUs, querying decoder utilization is not currently supported. .. seealso:: `nvmlDeviceGetJpgUtilization` """ cdef unsigned int utilization cdef unsigned int sampling_period_us with nogil: __status__ = nvmlDeviceGetJpgUtilization(device, &utilization, &sampling_period_us) check_status(__status__) return (utilization, sampling_period_us) 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. .. note:: On MIG-enabled GPUs, querying decoder utilization is not currently supported. .. seealso:: `nvmlDeviceGetOfaUtilization` """ cdef unsigned int utilization cdef unsigned int sampling_period_us with nogil: __status__ = nvmlDeviceGetOfaUtilization(device, &utilization, &sampling_period_us) check_status(__status__) return (utilization, sampling_period_us) 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. Returns: nvmlFBCStats_t: Reference to ``nvmlFBCStats_t`` structure containing NvFBC stats. .. seealso:: `nvmlDeviceGetFBCStats` """ cdef FBCStats fbc_stats_py = FBCStats() cdef nvmlFBCStats_t *fbc_stats = (fbc_stats_py._get_ptr()) with nogil: __status__ = nvmlDeviceGetFBCStats(device, fbc_stats) check_status(__status__) return fbc_stats_py 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. Returns: 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] with nogil: __status__ = nvmlDeviceGetFBCSessions(device, session_count, NULL) 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: 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. .. seealso:: `nvmlDeviceGetDriverModel_v2` """ cdef _DriverModel current cdef _DriverModel pending with nogil: __status__ = nvmlDeviceGetDriverModel_v2(device, ¤t, &pending) check_status(__status__) return (current, pending) 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. Returns: str: Reference to which to return the VBIOS version. .. seealso:: `nvmlDeviceGetVbiosVersion` """ cdef unsigned int length = 32 cdef char[32] version with nogil: __status__ = nvmlDeviceGetVbiosVersion(device, version, length) check_status(__status__) return _cyb_cpython.PyUnicode_FromString(version) 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. .. seealso:: `nvmlDeviceGetBridgeChipInfo` """ cdef BridgeChipHierarchy bridge_hierarchy_py = BridgeChipHierarchy() cdef nvmlBridgeChipHierarchy_t *bridge_hierarchy = (bridge_hierarchy_py._get_ptr()) with nogil: __status__ = nvmlDeviceGetBridgeChipInfo(device, bridge_hierarchy) check_status(__status__) return bridge_hierarchy_py 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. Returns: 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] with nogil: __status__ = nvmlDeviceGetComputeRunningProcesses_v3(device, info_count, NULL) check_status_size(__status__) cdef ProcessInfo infos = ProcessInfo(info_count[0]) cdef nvmlProcessInfo_t *infos_ptr = (infos._get_ptr()) 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. Returns: 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] with nogil: __status__ = nvmlDeviceGetGraphicsRunningProcesses_v3(device, info_count, NULL) check_status_size(__status__) cdef ProcessInfo infos = ProcessInfo(info_count[0]) cdef nvmlProcessInfo_t *infos_ptr = (infos._get_ptr()) 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. Returns: 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] with nogil: __status__ = nvmlDeviceGetMPSComputeRunningProcesses_v3(device, info_count, NULL) check_status_size(__status__) cdef ProcessInfo infos = ProcessInfo(info_count[0]) cdef nvmlProcessInfo_t *infos_ptr = (infos._get_ptr()) 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. .. seealso:: `nvmlDeviceOnSameBoard` """ cdef int on_same_board with nogil: __status__ = nvmlDeviceOnSameBoard(device1, device2, &on_same_board) check_status(__status__) return on_same_board 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. 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. .. seealso:: `nvmlDeviceGetAPIRestriction` """ cdef _EnableState is_restricted with nogil: __status__ = nvmlDeviceGetAPIRestriction(device, <_RestrictedAPI>api_type, &is_restricted) check_status(__status__) 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. .. 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() cdef nvmlBAR1Memory_t *bar1memory = (bar1memory_py._get_ptr()) with nogil: __status__ = nvmlDeviceGetBAR1MemoryInfo(device, bar1memory) check_status(__status__) return bar1memory_py 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. .. seealso:: `nvmlDeviceGetIrqNum` """ cdef unsigned int irq_num with nogil: __status__ = nvmlDeviceGetIrqNum(device, &irq_num) check_status(__status__) return irq_num 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 with nogil: __status__ = nvmlDeviceGetNumGpuCores(device, &num_cores) check_status(__status__) return num_cores 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. Returns: unsigned int: The power source of the device. .. seealso:: `nvmlDeviceGetPowerSource` """ cdef nvmlPowerSource_t power_source with nogil: __status__ = nvmlDeviceGetPowerSource(device, &power_source) check_status(__status__) return power_source 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. Returns: unsigned int: The devices's memory bus width. .. seealso:: `nvmlDeviceGetMemoryBusWidth` """ cdef unsigned int bus_width with nogil: __status__ = nvmlDeviceGetMemoryBusWidth(device, &bus_width) check_status(__status__) return bus_width 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. Returns: unsigned int: The devices's PCIE Max Link speed in MBPS. .. seealso:: `nvmlDeviceGetPcieLinkMaxSpeed` """ cdef unsigned int max_speed with nogil: __status__ = nvmlDeviceGetPcieLinkMaxSpeed(device, &max_speed) check_status(__status__) return max_speed 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. Returns: unsigned int: The devices's PCIe Max Link speed in Mbps. .. seealso:: `nvmlDeviceGetPcieSpeed` """ cdef unsigned int pcie_speed with nogil: __status__ = nvmlDeviceGetPcieSpeed(device, &pcie_speed) check_status(__status__) return pcie_speed 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. Returns: unsigned int: The current adaptive clocking status, either NVML_ADAPTIVE_CLOCKING_INFO_STATUS_DISABLED or NVML_ADAPTIVE_CLOCKING_INFO_STATUS_ENABLED. .. seealso:: `nvmlDeviceGetAdaptiveClockInfoStatus` """ cdef unsigned int adaptive_clock_status with nogil: __status__ = nvmlDeviceGetAdaptiveClockInfoStatus(device, &adaptive_clock_status) check_status(__status__) return adaptive_clock_status 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 retrieved. - ``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. Returns: unsigned int: The PCI Bus type. .. seealso:: `nvmlDeviceGetBusType` """ cdef nvmlBusType_t type with nogil: __status__ = nvmlDeviceGetBusType(device, &type) check_status(__status__) return type 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. .. seealso:: `nvmlSystemGetConfComputeCapabilities` """ cdef ConfComputeSystemCaps capabilities_py = ConfComputeSystemCaps() cdef nvmlConfComputeSystemCaps_t *capabilities = (capabilities_py._get_ptr()) with nogil: __status__ = nvmlSystemGetConfComputeCapabilities(capabilities) check_status(__status__) return capabilities_py 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. .. seealso:: `nvmlSystemGetConfComputeState` """ cdef ConfComputeSystemState state_py = ConfComputeSystemState() cdef nvmlConfComputeSystemState_t *state = (state_py._get_ptr()) with nogil: __status__ = nvmlSystemGetConfComputeState(state) check_status(__status__) return state_py 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. .. seealso:: `nvmlDeviceGetConfComputeMemSizeInfo` """ cdef ConfComputeMemSizeInfo mem_info_py = ConfComputeMemSizeInfo() cdef nvmlConfComputeMemSizeInfo_t *mem_info = (mem_info_py._get_ptr()) with nogil: __status__ = nvmlDeviceGetConfComputeMemSizeInfo(device, mem_info) check_status(__status__) return mem_info_py 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 NVML_CC_ACCEPTING_CLIENT_REQUESTS_FALSE. .. seealso:: `nvmlSystemGetConfComputeGpusReadyState` """ cdef unsigned int is_accepting_work with nogil: __status__ = nvmlSystemGetConfComputeGpusReadyState(&is_accepting_work) check_status(__status__) return is_accepting_work 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. .. seealso:: `nvmlDeviceGetConfComputeProtectedMemoryUsage` """ cdef Memory memory_py = Memory() cdef nvmlMemory_t *memory = (memory_py._get_ptr()) with nogil: __status__ = nvmlDeviceGetConfComputeProtectedMemoryUsage(device, memory) check_status(__status__) return memory_py 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. .. seealso:: `nvmlDeviceGetConfComputeGpuCertificate` """ cdef ConfComputeGpuCertificate gpu_cert_py = ConfComputeGpuCertificate() cdef nvmlConfComputeGpuCertificate_t *gpu_cert = (gpu_cert_py._get_ptr()) with nogil: __status__ = nvmlDeviceGetConfComputeGpuCertificate(device, gpu_cert) check_status(__status__) return gpu_cert_py 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. .. seealso:: `nvmlDeviceSetConfComputeUnprotectedMemSize` """ with nogil: __status__ = nvmlDeviceSetConfComputeUnprotectedMemSize(device, size_ki_b) check_status(__status__) 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 NVML_CC_ACCEPTING_CLIENT_REQUESTS_FALSE. .. seealso:: `nvmlSystemSetConfComputeGpusReadyState` """ with nogil: __status__ = nvmlSystemSetConfComputeGpusReadyState(is_accepting_work) check_status(__status__) 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. .. seealso:: `nvmlSystemGetConfComputeSettings` """ cdef SystemConfComputeSettings_v1 settings_py = SystemConfComputeSettings_v1() cdef nvmlSystemConfComputeSettings_t *settings = (settings_py._get_ptr()) settings.version = NVML_VERSION_STRUCT(sizeof(nvmlSystemConfComputeSettings_v1_t), 1) with nogil: __status__ = nvmlSystemGetConfComputeSettings(settings) check_status(__status__) return settings_py 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. Returns: char: The retrieved GSP firmware version. .. seealso:: `nvmlDeviceGetGspFirmwareVersion` """ cdef char version with nogil: __status__ = nvmlDeviceGetGspFirmwareVersion(device, &version) check_status(__status__) return version 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``. .. seealso:: `nvmlDeviceGetGspFirmwareMode` """ cdef unsigned int is_enabled cdef unsigned int default_mode with nogil: __status__ = nvmlDeviceGetGspFirmwareMode(device, &is_enabled, &default_mode) check_status(__status__) return (is_enabled, default_mode) 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. Returns: nvmlEccSramErrorStatus_v1_t: Returns SRAM ECC error status. .. seealso:: `nvmlDeviceGetSramEccErrorStatus` """ cdef EccSramErrorStatus_v1 status_py = EccSramErrorStatus_v1() cdef nvmlEccSramErrorStatus_t *status = (status_py._get_ptr()) status.version = NVML_VERSION_STRUCT(sizeof(nvmlEccSramErrorStatus_v1_t), 1) with nogil: __status__ = nvmlDeviceGetSramEccErrorStatus(device, status) check_status(__status__) return status_py 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. Returns: int: Reference in which to return the current accounting mode. .. note:: In the MPS locality-domain view, this API returns the physical parent's accounting mode as reported by MPS. See ``MPS Locality Domain Device Enumeration``. .. seealso:: `nvmlDeviceGetAccountingMode` """ cdef _EnableState mode with nogil: __status__ = nvmlDeviceGetAccountingMode(device, &mode) check_status(__status__) return mode 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. .. 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() cdef nvmlAccountingStats_t *stats = (stats_py._get_ptr()) with nogil: __status__ = nvmlDeviceGetAccountingStats(device, pid, stats) check_status(__status__) return stats_py 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. .. 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__) 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. .. seealso:: `nvmlDeviceGetAccountingBufferSize` """ cdef unsigned int buffer_size with nogil: __status__ = nvmlDeviceGetAccountingBufferSize(device, &buffer_size) check_status(__status__) return buffer_size 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 retirement. Returns: unsigned long long: Buffer to write the page addresses into. .. seealso:: `nvmlDeviceGetRetiredPages` """ cdef unsigned int[1] page_count = [0] with nogil: __status__ = nvmlDeviceGetRetiredPages(device, <_PageRetirementCause>cause, page_count, 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]] 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_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. Returns: int: Reference in which to return the pending status. .. seealso:: `nvmlDeviceGetRetiredPagesPendingStatus` """ cdef _EnableState is_pending with nogil: __status__ = nvmlDeviceGetRetiredPagesPendingStatus(device, &is_pending) check_status(__status__) return is_pending 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. - 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. .. note:: On MIG-enabled GPUs with active instances, querying the number of remapped rows is not supported. .. seealso:: `nvmlDeviceGetRemappedRows` """ cdef unsigned int corr_rows cdef unsigned int unc_rows cdef unsigned int is_pending cdef unsigned int failure_occurred with nogil: __status__ = nvmlDeviceGetRemappedRows(device, &corr_rows, &unc_rows, &is_pending, &failure_occurred) check_status(__status__) return (corr_rows, unc_rows, is_pending, failure_occurred) 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. Returns: nvmlRowRemapperHistogramValues_t: Histogram values. .. seealso:: `nvmlDeviceGetRowRemapperHistogram` """ cdef RowRemapperHistogramValues values_py = RowRemapperHistogramValues() cdef nvmlRowRemapperHistogramValues_t *values = (values_py._get_ptr()) with nogil: __status__ = nvmlDeviceGetRowRemapperHistogram(device, values) check_status(__status__) return values_py 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. .. seealso:: `nvmlDeviceGetArchitecture` """ cdef nvmlDeviceArchitecture_t arch with nogil: __status__ = nvmlDeviceGetArchitecture(device, &arch) check_status(__status__) return arch 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. .. seealso:: `nvmlDeviceGetClkMonStatus` """ cdef ClkMonStatus status_py = ClkMonStatus() cdef nvmlClkMonStatus_t *status = (status_py._get_ptr()) with nogil: __status__ = nvmlDeviceGetClkMonStatus(device, status) check_status(__status__) return status_py 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. .. note:: On MIG-enabled GPUs, querying process utilization is not currently supported. .. seealso:: `nvmlDeviceGetProcessUtilization` """ cdef unsigned int[1] process_samples_count = [0] with nogil: __status__ = nvmlDeviceGetProcessUtilization(device, NULL, process_samples_count, last_seen_time_stamp) 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: 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. .. seealso:: `nvmlUnitSetLedState` """ with nogil: __status__ = nvmlUnitSetLedState(unit, <_LedColor>color) check_status(__status__) 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. .. seealso:: `nvmlDeviceSetPersistenceMode` """ with nogil: __status__ = nvmlDeviceSetPersistenceMode(device, <_EnableState>mode) check_status(__status__) 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. mode (ComputeMode): The target compute mode. .. note:: If MIG is enabled on a GPU, device must be MIG device handle. .. seealso:: `nvmlDeviceSetComputeMode` """ with nogil: __status__ = nvmlDeviceSetComputeMode(device, <_ComputeMode>mode) check_status(__status__) 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. .. seealso:: `nvmlDeviceSetEccMode` """ with nogil: __status__ = nvmlDeviceSetEccMode(device, <_EnableState>ecc) check_status(__status__) 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. .. seealso:: `nvmlDeviceClearEccErrorCounts` """ with nogil: __status__ = nvmlDeviceClearEccErrorCounts(device, <_EccCounterType>counter_type) check_status(__status__) 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. flags (unsigned int): Flags that change the default behavior. .. seealso:: `nvmlDeviceSetDriverModel` """ with nogil: __status__ = nvmlDeviceSetDriverModel(device, <_DriverModel>driver_model, flags) check_status(__status__) 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. .. seealso:: `nvmlDeviceSetGpuLockedClocks` """ with nogil: __status__ = nvmlDeviceSetGpuLockedClocks(device, min_gpu_clock_m_hz, max_gpu_clock_m_hz) check_status(__status__) 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. .. seealso:: `nvmlDeviceResetGpuLockedClocks` """ with nogil: __status__ = nvmlDeviceResetGpuLockedClocks(device) check_status(__status__) 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. .. seealso:: `nvmlDeviceSetMemoryLockedClocks` """ with nogil: __status__ = nvmlDeviceSetMemoryLockedClocks(device, min_mem_clock_m_hz, max_mem_clock_m_hz) check_status(__status__) 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. .. seealso:: `nvmlDeviceResetMemoryLockedClocks` """ with nogil: __status__ = nvmlDeviceResetMemoryLockedClocks(device) check_status(__status__) 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 clocks of the target device to. .. seealso:: `nvmlDeviceSetAutoBoostedClocksEnabled` """ with nogil: __status__ = nvmlDeviceSetAutoBoostedClocksEnabled(device, <_EnableState>enabled) check_status(__status__) 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 Boosted clocks of the target device to. flags (unsigned int): Flags that change the default behavior. Currently Unused. .. seealso:: `nvmlDeviceSetDefaultAutoBoostedClocksEnabled` """ with nogil: __status__ = nvmlDeviceSetDefaultAutoBoostedClocksEnabled(device, <_EnableState>enabled, flags) check_status(__status__) 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. .. seealso:: `nvmlDeviceSetDefaultFanSpeed_v2` """ with nogil: __status__ = nvmlDeviceSetDefaultFanSpeed_v2(device, fan) check_status(__status__) 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. policy (unsigned int): The fan control ``policy`` to set. .. seealso:: `nvmlDeviceSetFanControlPolicy` """ with nogil: __status__ = nvmlDeviceSetFanControlPolicy(device, fan, policy) check_status(__status__) 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. .. seealso:: `nvmlDeviceSetGpuOperationMode` """ with nogil: __status__ = nvmlDeviceSetGpuOperationMode(device, <_GpuOperationMode>mode) check_status(__status__) 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. is_restricted (EnableState): The target restriction. .. seealso:: `nvmlDeviceSetAPIRestriction` """ with nogil: __status__ = nvmlDeviceSetAPIRestriction(device, <_RestrictedAPI>api_type, <_EnableState>is_restricted) check_status(__status__) 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. .. seealso:: `nvmlDeviceSetFanSpeed_v2` """ with nogil: __status__ = nvmlDeviceSetFanSpeed_v2(device, fan, speed) check_status(__status__) 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: __status__ = nvmlDeviceSetAccountingMode(device, <_EnableState>mode) check_status(__status__) 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. .. seealso:: `nvmlDeviceClearAccountingPids` """ with nogil: __status__ = nvmlDeviceClearAccountingPids(device) check_status(__status__) 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. .. seealso:: `nvmlDeviceGetNvLinkState` """ cdef _EnableState is_active with nogil: __status__ = nvmlDeviceGetNvLinkState(device, link, &is_active) check_status(__status__) return is_active 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. Returns: unsigned int: Requested NvLink version from ``nvmlNvlinkVersion_t``. .. seealso:: `nvmlDeviceGetNvLinkVersion` """ cdef unsigned int version with nogil: __status__ = nvmlDeviceGetNvLinkVersion(device, link, &version) check_status(__status__) return version 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. capability (NvLinkCapability): Specifies the ``nvmlNvLinkCapability_t`` to be queried. Returns: unsigned int: A boolean for the queried capability indicating that feature is available. .. seealso:: `nvmlDeviceGetNvLinkCapability` """ cdef unsigned int cap_result with nogil: __status__ = nvmlDeviceGetNvLinkCapability(device, link, <_NvLinkCapability>capability, &cap_result) check_status(__status__) return cap_result 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. Returns: nvmlPciInfo_t: ``nvmlPciInfo_t`` of the remote node for the specified link. .. seealso:: `nvmlDeviceGetNvLinkRemotePciInfo_v2` """ cdef PciInfo pci_py = PciInfo() cdef nvmlPciInfo_t *pci = (pci_py._get_ptr()) with nogil: __status__ = nvmlDeviceGetNvLinkRemotePciInfo_v2(device, link, pci) check_status(__status__) return pci_py 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. Returns: unsigned long long: Returned counter value. .. seealso:: `nvmlDeviceGetNvLinkErrorCounter` """ cdef unsigned long long counter_value with nogil: __status__ = nvmlDeviceGetNvLinkErrorCounter(device, link, <_NvLinkErrorCounter>counter, &counter_value) check_status(__status__) return counter_value 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. .. seealso:: `nvmlDeviceResetNvLinkErrorCounters` """ with nogil: __status__ = nvmlDeviceResetNvLinkErrorCounters(device, link) check_status(__status__) 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. .. seealso:: `nvmlDeviceGetNvLinkRemoteDeviceType` """ cdef _IntNvLinkDeviceType p_nv_link_device_type with nogil: __status__ = nvmlDeviceGetNvLinkRemoteDeviceType(device, link, &p_nv_link_device_type) check_status(__status__) return p_nv_link_device_type 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. .. seealso:: `nvmlSystemSetNvlinkBwMode` """ with nogil: __status__ = nvmlSystemSetNvlinkBwMode(nvlink_bw_mode) check_status(__status__) cpdef unsigned int system_get_nvlink_bw_mode() except? 0: """Get the global nvlink bandwith mode. Returns: unsigned int: reference of nvlink bandwidth mode. .. seealso:: `nvmlSystemGetNvlinkBwMode` """ cdef unsigned int nvlink_bw_mode with nogil: __status__ = nvmlSystemGetNvlinkBwMode(&nvlink_bw_mode) check_status(__status__) return nvlink_bw_mode 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. Returns: nvmlNvlinkSupportedBwModes_v1_t: Reference to ``nvmlNvlinkSupportedBwModes_t``. .. seealso:: `nvmlDeviceGetNvlinkSupportedBwModes` """ cdef NvlinkSupportedBwModes_v1 supported_bw_mode_py = NvlinkSupportedBwModes_v1() cdef nvmlNvlinkSupportedBwModes_t *supported_bw_mode = (supported_bw_mode_py._get_ptr()) supported_bw_mode.version = NVML_VERSION_STRUCT(sizeof(nvmlNvlinkSupportedBwModes_v1_t), 1) with nogil: __status__ = nvmlDeviceGetNvlinkSupportedBwModes(device, supported_bw_mode) check_status(__status__) return supported_bw_mode_py 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``. .. seealso:: `nvmlDeviceGetNvlinkBwMode` """ cdef NvlinkGetBwMode_v1 get_bw_mode_py = NvlinkGetBwMode_v1() cdef nvmlNvlinkGetBwMode_t *get_bw_mode = (get_bw_mode_py._get_ptr()) get_bw_mode.version = NVML_VERSION_STRUCT(sizeof(nvmlNvlinkGetBwMode_v1_t), 1) with nogil: __status__ = nvmlDeviceGetNvlinkBwMode(device, get_bw_mode) check_status(__status__) return get_bw_mode_py 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``. .. seealso:: `nvmlDeviceSetNvlinkBwMode` """ cdef intptr_t _set_bw_mode_ptr_ = 0 if set_bw_mode is None else int(set_bw_mode) set_bw_mode.version = NVML_VERSION_STRUCT(sizeof(nvmlNvlinkSetBwMode_v1_t), 1) with nogil: __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. .. seealso:: `nvmlEventSetCreate` """ cdef EventSet set with nogil: __status__ = nvmlEventSetCreate(&set) check_status(__status__) return set 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. set (intptr_t): Set to which add new event types. .. seealso:: `nvmlDeviceRegisterEvents` """ with nogil: __status__ = nvmlDeviceRegisterEvents(device, event_types, set) check_status(__status__) 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. Returns: unsigned long long: Reference in which to return bitmask of supported events. .. seealso:: `nvmlDeviceGetSupportedEventTypes` """ cdef unsigned long long event_types with nogil: __status__ = nvmlDeviceGetSupportedEventTypes(device, &event_types) check_status(__status__) return event_types 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 milliseconds for registered event. Returns: nvmlEventData_t: Reference in which to return event data. .. seealso:: `nvmlEventSetWait_v2` """ cdef EventData data_py = EventData() cdef nvmlEventData_t *data = (data_py._get_ptr()) with nogil: __status__ = nvmlEventSetWait_v2(set, data, timeoutms) check_status(__status__) return data_py 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. .. seealso:: `nvmlEventSetFree` """ with nogil: __status__ = nvmlEventSetFree(set) check_status(__status__) 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``. .. seealso:: `nvmlDeviceModifyDrainState` """ cdef intptr_t _pci_info_ptr_ = 0 if pci_info is None else int(pci_info) with nogil: __status__ = nvmlDeviceModifyDrainState(_pci_info_ptr_, <_EnableState>new_state) check_status(__status__) 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. Returns: int: The current drain state for this GPU, see ``nvmlEnableState_t``. .. seealso:: `nvmlDeviceQueryDrainState` """ cdef intptr_t _pci_info_ptr_ = 0 if pci_info is None else int(pci_info) cdef _EnableState current_state with nogil: __status__ = nvmlDeviceQueryDrainState(_pci_info_ptr_, ¤t_state) check_status(__status__) return current_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``. .. seealso:: `nvmlDeviceRemoveGpu_v2` """ cdef intptr_t _pci_info_ptr_ = 0 if pci_info is None else int(pci_info) with nogil: __status__ = nvmlDeviceRemoveGpu_v2(_pci_info_ptr_, <_DetachGpuState>gpu_state, <_PcieLinkState>link_state) check_status(__status__) 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. .. seealso:: `nvmlDeviceDiscoverGpus` """ cdef intptr_t _pci_info_ptr_ = 0 if pci_info is None else int(pci_info) with nogil: __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. Returns: int: Reference to virtualization mode. One of ``NVML_GPU_VIRTUALIZATION_?``. .. seealso:: `nvmlDeviceGetVirtualizationMode` """ cdef _GpuVirtualizationMode p_virtual_mode with nogil: __status__ = nvmlDeviceGetVirtualizationMode(device, &p_virtual_mode) check_status(__status__) return p_virtual_mode 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. Returns: int: Reference in which to return the current vGPU mode. .. seealso:: `nvmlDeviceGetHostVgpuMode` """ cdef _HostVgpuMode p_host_vgpu_mode with nogil: __status__ = nvmlDeviceGetHostVgpuMode(device, &p_host_vgpu_mode) check_status(__status__) return p_host_vgpu_mode 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_?``. .. seealso:: `nvmlDeviceSetVirtualizationMode` """ with nogil: __status__ = nvmlDeviceSetVirtualizationMode(device, <_GpuVirtualizationMode>virtual_mode) check_status(__status__) 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. .. seealso:: `nvmlVgpuTypeGetGspHeapSize` """ cdef unsigned long long gsp_heap_size with nogil: __status__ = nvmlVgpuTypeGetGspHeapSize(vgpu_type_id, &gsp_heap_size) check_status(__status__) return gsp_heap_size 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. Returns: unsigned long long: Reference to return the framebuffer reservation. .. seealso:: `nvmlVgpuTypeGetFbReservation` """ cdef unsigned long long fb_reservation with nogil: __status__ = nvmlVgpuTypeGetFbReservation(vgpu_type_id, &fb_reservation) check_status(__status__) return fb_reservation 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 ``nvmlDeviceVgpuCapability_t`` to be set. state (EnableState): The target capability mode. .. seealso:: `nvmlDeviceSetVgpuCapabilities` """ with nogil: __status__ = nvmlDeviceSetVgpuCapabilities(device, <_DeviceVgpuCapability>capability, <_EnableState>state) check_status(__status__) 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. .. seealso:: `nvmlDeviceGetGridLicensableFeatures_v4` """ cdef GridLicensableFeatures p_grid_licensable_features_py = GridLicensableFeatures() cdef nvmlGridLicensableFeatures_t *p_grid_licensable_features = (p_grid_licensable_features_py._get_ptr()) with nogil: __status__ = nvmlDeviceGetGridLicensableFeatures_v4(device, p_grid_licensable_features) check_status(__status__) return p_grid_licensable_features_py 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. .. seealso:: `nvmlGetVgpuDriverCapabilities` """ cdef unsigned int cap_result with nogil: __status__ = nvmlGetVgpuDriverCapabilities(<_VgpuDriverCapability>capability, &cap_result) check_status(__status__) return cap_result 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. .. seealso:: `nvmlDeviceGetVgpuCapabilities` """ cdef unsigned int cap_result with nogil: __status__ = nvmlDeviceGetVgpuCapabilities(device, <_DeviceVgpuCapability>capability, &cap_result) check_status(__status__) 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. Returns: str: Pointer to string array to return class in. .. seealso:: `nvmlVgpuTypeGetClass` """ cdef unsigned int[1] size = [0] with nogil: __status__ = nvmlVgpuTypeGetClass(vgpu_type_id, NULL, size) check_status_size(__status__) cdef bytes _vgpu_type_class_ = bytes(size[0]) cdef char* vgpu_type_class = _vgpu_type_class_ 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. Returns: unsigned int: GPU Instance Profile ID. .. seealso:: `nvmlVgpuTypeGetGpuInstanceProfileId` """ cdef unsigned int gpu_instance_profile_id with nogil: __status__ = nvmlVgpuTypeGetGpuInstanceProfileId(vgpu_type_id, &gpu_instance_profile_id) check_status(__status__) return gpu_instance_profile_id 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. .. seealso:: `nvmlVgpuTypeGetDeviceID` """ cdef unsigned long long device_id cdef unsigned long long subsystem_id with nogil: __status__ = nvmlVgpuTypeGetDeviceID(vgpu_type_id, &device_id, &subsystem_id) check_status(__status__) return (device_id, subsystem_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. Returns: unsigned long long: Pointer to framebuffer size in bytes. .. seealso:: `nvmlVgpuTypeGetFramebufferSize` """ cdef unsigned long long fb_size with nogil: __status__ = nvmlVgpuTypeGetFramebufferSize(vgpu_type_id, &fb_size) check_status(__status__) return fb_size 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. Returns: unsigned int: Pointer to number of display heads. .. seealso:: `nvmlVgpuTypeGetNumDisplayHeads` """ cdef unsigned int num_display_heads with nogil: __status__ = nvmlVgpuTypeGetNumDisplayHeads(vgpu_type_id, &num_display_heads) check_status(__status__) return num_display_heads 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. 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. .. seealso:: `nvmlVgpuTypeGetResolution` """ cdef unsigned int xdim cdef unsigned int ydim with nogil: __status__ = nvmlVgpuTypeGetResolution(vgpu_type_id, display_index, &xdim, &ydim) check_status(__status__) return (xdim, ydim) 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. Returns: str: Pointer to buffer to return license info. .. seealso:: `nvmlVgpuTypeGetLicense` """ cdef unsigned int size = 128 cdef char[128] vgpu_type_license_string with nogil: __status__ = nvmlVgpuTypeGetLicense(vgpu_type_id, vgpu_type_license_string, size) check_status(__status__) return _cyb_cpython.PyUnicode_FromString(vgpu_type_license_string) 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. Returns: unsigned int: Reference to return the frame rate limit value. .. seealso:: `nvmlVgpuTypeGetFrameRateLimit` """ cdef unsigned int frame_rate_limit with nogil: __status__ = nvmlVgpuTypeGetFrameRateLimit(vgpu_type_id, &frame_rate_limit) check_status(__status__) return frame_rate_limit 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. .. seealso:: `nvmlVgpuTypeGetMaxInstances` """ cdef unsigned int vgpu_instance_count with nogil: __status__ = nvmlVgpuTypeGetMaxInstances(device, vgpu_type_id, &vgpu_instance_count) check_status(__status__) return vgpu_instance_count 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. Returns: unsigned int: Pointer to get the max number of vGPU instances supported per VM for given ``vgpu_type_id``. .. seealso:: `nvmlVgpuTypeGetMaxInstancesPerVm` """ cdef unsigned int vgpu_instance_count_per_vm with nogil: __status__ = nvmlVgpuTypeGetMaxInstancesPerVm(vgpu_type_id, &vgpu_instance_count_per_vm) check_status(__status__) return vgpu_instance_count_per_vm 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. Returns: nvmlVgpuTypeBar1Info_v1_t: Pointer to the vGPU type BAR1 information structure ``nvmlVgpuTypeBar1Info_t``. .. seealso:: `nvmlVgpuTypeGetBAR1Info` """ cdef VgpuTypeBar1Info_v1 bar1info_py = VgpuTypeBar1Info_v1() cdef nvmlVgpuTypeBar1Info_t *bar1info = (bar1info_py._get_ptr()) bar1info.version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuTypeBar1Info_v1_t), 1) with nogil: __status__ = nvmlVgpuTypeGetBAR1Info(vgpu_type_id, bar1info) check_status(__status__) 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: - str: 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. Returns: str: Pointer to caller-supplied buffer to hold vGPU UUID. .. seealso:: `nvmlVgpuInstanceGetUUID` """ cdef unsigned int size = 80 cdef char[80] uuid with nogil: __status__ = nvmlVgpuInstanceGetUUID(vgpu_instance, uuid, size) check_status(__status__) return _cyb_cpython.PyUnicode_FromString(uuid) 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. Returns: str: Caller-supplied buffer to return driver version string. .. seealso:: `nvmlVgpuInstanceGetVmDriverVersion` """ cdef unsigned int length = 80 cdef char[80] version with nogil: __status__ = nvmlVgpuInstanceGetVmDriverVersion(vgpu_instance, version, length) check_status(__status__) return _cyb_cpython.PyUnicode_FromString(version) 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. Returns: unsigned long long: Pointer to framebuffer usage in bytes. .. seealso:: `nvmlVgpuInstanceGetFbUsage` """ cdef unsigned long long fb_usage with nogil: __status__ = nvmlVgpuInstanceGetFbUsage(vgpu_instance, &fb_usage) check_status(__status__) return fb_usage 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. Returns: unsigned int: Reference to return the licensing status. .. seealso:: `nvmlVgpuInstanceGetLicenseStatus` """ cdef unsigned int licensed with nogil: __status__ = nvmlVgpuInstanceGetLicenseStatus(vgpu_instance, &licensed) check_status(__status__) return licensed 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. Returns: unsigned int: Reference to return the vgpu_type_id. .. seealso:: `nvmlVgpuInstanceGetType` """ cdef nvmlVgpuTypeId_t vgpu_type_id with nogil: __status__ = nvmlVgpuInstanceGetType(vgpu_instance, &vgpu_type_id) check_status(__status__) return vgpu_type_id 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. Returns: unsigned int: Reference to return the frame rate limit. .. seealso:: `nvmlVgpuInstanceGetFrameRateLimit` """ cdef unsigned int frame_rate_limit with nogil: __status__ = nvmlVgpuInstanceGetFrameRateLimit(vgpu_instance, &frame_rate_limit) check_status(__status__) return frame_rate_limit 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. Returns: int: Reference in which to return the current ECC mode. .. seealso:: `nvmlVgpuInstanceGetEccMode` """ cdef _EnableState ecc_mode with nogil: __status__ = nvmlVgpuInstanceGetEccMode(vgpu_instance, &ecc_mode) check_status(__status__) return ecc_mode 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. Returns: unsigned int: Reference to an unsigned int for the encoder capacity. .. seealso:: `nvmlVgpuInstanceGetEncoderCapacity` """ cdef unsigned int encoder_capacity with nogil: __status__ = nvmlVgpuInstanceGetEncoderCapacity(vgpu_instance, &encoder_capacity) check_status(__status__) return encoder_capacity 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. encoder_capacity (unsigned int): Unsigned int for the encoder capacity value. .. seealso:: `nvmlVgpuInstanceSetEncoderCapacity` """ with nogil: __status__ = nvmlVgpuInstanceSetEncoderCapacity(vgpu_instance, encoder_capacity) check_status(__status__) 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. .. seealso:: `nvmlVgpuInstanceGetEncoderStats` """ cdef unsigned int session_count cdef unsigned int average_fps cdef unsigned int average_latency with nogil: __status__ = nvmlVgpuInstanceGetEncoderStats(vgpu_instance, &session_count, &average_fps, &average_latency) check_status(__status__) return (session_count, average_fps, average_latency) 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. .. seealso:: `nvmlVgpuInstanceGetEncoderSessions` """ cdef unsigned int[1] session_count = [0] with nogil: __status__ = nvmlVgpuInstanceGetEncoderSessions(vgpu_instance, session_count, NULL) 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: 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. Returns: nvmlFBCStats_t: Reference to ``nvmlFBCStats_t`` structure containing NvFBC stats. .. seealso:: `nvmlVgpuInstanceGetFBCStats` """ cdef FBCStats fbc_stats_py = FBCStats() cdef nvmlFBCStats_t *fbc_stats = (fbc_stats_py._get_ptr()) with nogil: __status__ = nvmlVgpuInstanceGetFBCStats(vgpu_instance, fbc_stats) check_status(__status__) return fbc_stats_py 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. Returns: 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] with nogil: __status__ = nvmlVgpuInstanceGetFBCSessions(vgpu_instance, session_count, NULL) 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: 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. Returns: unsigned int: GPU Instance ID. .. seealso:: `nvmlVgpuInstanceGetGpuInstanceId` """ cdef unsigned int gpu_instance_id with nogil: __status__ = nvmlVgpuInstanceGetGpuInstanceId(vgpu_instance, &gpu_instance_id) check_status(__status__) return gpu_instance_id 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. Returns: str: Caller-supplied buffer to return vGPU PCI Id string. .. seealso:: `nvmlVgpuInstanceGetGpuPciId` """ cdef unsigned int[1] length = [0] with nogil: __status__ = nvmlVgpuInstanceGetGpuPciId(vgpu_instance, NULL, length) check_status_size(__status__) cdef bytes _vgpu_pci_id_ = bytes(length[0]) cdef char* vgpu_pci_id = _vgpu_pci_id_ 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. .. seealso:: `nvmlVgpuTypeGetCapabilities` """ cdef unsigned int cap_result with nogil: __status__ = nvmlVgpuTypeGetCapabilities(vgpu_type_id, <_VgpuCapability>capability, &cap_result) check_status(__status__) return cap_result 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. Returns: str: Pointer to caller-supplied buffer to hold MDEV UUID. .. seealso:: `nvmlVgpuInstanceGetMdevUUID` """ cdef unsigned int size = 80 cdef char[80] mdev_uuid with nogil: __status__ = nvmlVgpuInstanceGetMdevUUID(vgpu_instance, mdev_uuid, size) check_status(__status__) return _cyb_cpython.PyUnicode_FromString(mdev_uuid) 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``. .. seealso:: `nvmlGpuInstanceSetVgpuSchedulerState` """ cdef intptr_t _p_scheduler_ptr_ = 0 if p_scheduler is None else int(p_scheduler) if _p_scheduler_ptr_ == 0: raise ValueError("p_scheduler must not be None") (_p_scheduler_ptr_).version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuSchedulerState_v1_t), 1) with nogil: __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. Returns: nvmlVgpuSchedulerStateInfo_v1_t: Reference in which ``p_scheduler_state_info`` is returned. .. seealso:: `nvmlGpuInstanceGetVgpuSchedulerState` """ cdef VgpuSchedulerStateInfo_v1 p_scheduler_state_info_py = VgpuSchedulerStateInfo_v1() cdef nvmlVgpuSchedulerStateInfo_t *p_scheduler_state_info = (p_scheduler_state_info_py._get_ptr()) p_scheduler_state_info.version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuSchedulerState_v1_t), 1) with nogil: __status__ = nvmlGpuInstanceGetVgpuSchedulerState(gpu_instance, p_scheduler_state_info) check_status(__status__) return p_scheduler_state_info_py 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. Returns: nvmlVgpuSchedulerLogInfo_v1_t: Reference in which ``p_scheduler_log_info`` is written. .. seealso:: `nvmlGpuInstanceGetVgpuSchedulerLog` """ cdef VgpuSchedulerLogInfo_v1 p_scheduler_log_info_py = VgpuSchedulerLogInfo_v1() cdef nvmlVgpuSchedulerLogInfo_t *p_scheduler_log_info = (p_scheduler_log_info_py._get_ptr()) p_scheduler_log_info.version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuSchedulerLogInfo_v1_t), 1) with nogil: __status__ = nvmlGpuInstanceGetVgpuSchedulerLog(gpu_instance, p_scheduler_log_info) check_status(__status__) return p_scheduler_log_info_py 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. Returns: str: Pointer to caller-supplied buffer into which ``pgpu_metadata`` is written. .. seealso:: `nvmlDeviceGetPgpuMetadataString` """ cdef unsigned int[1] buffer_size = [0] with nogil: __status__ = nvmlDeviceGetPgpuMetadataString(device, NULL, buffer_size) check_status_size(__status__) cdef bytes _pgpu_metadata_ = bytes(buffer_size[0]) cdef char* pgpu_metadata = _pgpu_metadata_ 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. .. seealso:: `nvmlDeviceGetVgpuSchedulerLog` """ cdef VgpuSchedulerLog p_scheduler_log_py = VgpuSchedulerLog() cdef nvmlVgpuSchedulerLog_t *p_scheduler_log = (p_scheduler_log_py._get_ptr()) with nogil: __status__ = nvmlDeviceGetVgpuSchedulerLog(device, p_scheduler_log) check_status(__status__) return p_scheduler_log_py 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``. Returns: nvmlVgpuSchedulerGetState_t: Reference in which ``p_scheduler_state`` is returned. .. seealso:: `nvmlDeviceGetVgpuSchedulerState` """ cdef VgpuSchedulerGetState p_scheduler_state_py = VgpuSchedulerGetState() cdef nvmlVgpuSchedulerGetState_t *p_scheduler_state = (p_scheduler_state_py._get_ptr()) with nogil: __status__ = nvmlDeviceGetVgpuSchedulerState(device, p_scheduler_state) check_status(__status__) return p_scheduler_state_py 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``. Returns: nvmlVgpuSchedulerCapabilities_t: Reference in which ``p_capabilities`` is written. .. seealso:: `nvmlDeviceGetVgpuSchedulerCapabilities` """ cdef VgpuSchedulerCapabilities p_capabilities_py = VgpuSchedulerCapabilities() cdef nvmlVgpuSchedulerCapabilities_t *p_capabilities = (p_capabilities_py._get_ptr()) with nogil: __status__ = nvmlDeviceGetVgpuSchedulerCapabilities(device, p_capabilities) check_status(__status__) return p_capabilities_py 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. .. seealso:: `nvmlDeviceSetVgpuSchedulerState` """ with nogil: __status__ = nvmlDeviceSetVgpuSchedulerState(device, p_scheduler_state) check_status(__status__) 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_ = 0 if vgpu_version is None else int(vgpu_version) with nogil: __status__ = nvmlSetVgpuVersion(_vgpu_version_ptr_) 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). 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. last_seen_time_stamp (unsigned long long): Return only samples with timestamp greater than last_seen_time_stamp. 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. Returns: nvmlVgpuProcessUtilizationSample_t: Pointer to caller-supplied buffer in which vGPU sub process utilization samples are returned. .. seealso:: `nvmlDeviceGetVgpuProcessUtilization` """ cdef unsigned int[1] vgpu_process_samples_count = [0] with nogil: __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. Returns: int: Reference in which to return the current accounting mode. .. seealso:: `nvmlVgpuInstanceGetAccountingMode` """ cdef _EnableState mode with nogil: __status__ = nvmlVgpuInstanceGetAccountingMode(vgpu_instance, &mode) check_status(__status__) return mode 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. Returns: 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__) 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. 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. .. 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() cdef nvmlAccountingStats_t *stats = (stats_py._get_ptr()) with nogil: __status__ = nvmlVgpuInstanceGetAccountingStats(vgpu_instance, pid, stats) check_status(__status__) return stats_py 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. .. 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: __status__ = nvmlVgpuInstanceClearAccountingPids(vgpu_instance) check_status(__status__) 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. Returns: nvmlVgpuLicenseInfo_t: Pointer to vGPU license information structure. .. seealso:: `nvmlVgpuInstanceGetLicenseInfo_v2` """ cdef VgpuLicenseInfo license_info_py = VgpuLicenseInfo() cdef nvmlVgpuLicenseInfo_t *license_info = (license_info_py._get_ptr()) with nogil: __status__ = nvmlVgpuInstanceGetLicenseInfo_v2(vgpu_instance, license_info) check_status(__status__) return license_info_py 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. .. seealso:: `nvmlGetExcludedDeviceCount` """ cdef unsigned int device_count with nogil: __status__ = nvmlGetExcludedDeviceCount(&device_count) check_status(__status__) return device_count 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. .. seealso:: `nvmlGetExcludedDeviceInfoByIndex` """ cdef ExcludedDeviceInfo info_py = ExcludedDeviceInfo() cdef nvmlExcludedDeviceInfo_t *info = (info_py._get_ptr()) with nogil: __status__ = nvmlGetExcludedDeviceInfoByIndex(index, info) check_status(__status__) return info_py 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, ``NVML_DEVICE_MIG_DISABLE`` or ``NVML_DEVICE_MIG_ENABLE``. 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 with nogil: __status__ = nvmlDeviceSetMigMode(device, mode, &activation_status) check_status(__status__) return activation_status 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``. - unsigned int: Returns the pending mode, ``NVML_DEVICE_MIG_DISABLE`` or ``NVML_DEVICE_MIG_ENABLE``. .. seealso:: `nvmlDeviceGetMigMode` """ cdef unsigned int current_mode cdef unsigned int pending_mode with nogil: __status__ = nvmlDeviceGetMigMode(device, ¤t_mode, &pending_mode) check_status(__status__) return (current_mode, pending_mode) 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 ``nvmlDeviceGetGpuInstanceProfileInfo``. 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. .. seealso:: `nvmlDeviceGetGpuInstancePossiblePlacements_v2` """ cdef unsigned int[1] count = [0] with nogil: __status__ = nvmlDeviceGetGpuInstancePossiblePlacements_v2(device, profile_id, NULL, count) check_status_size(__status__) cdef GpuInstancePlacement placements = GpuInstancePlacement(count[0]) cdef nvmlGpuInstancePlacement_t *placements_ptr = (placements._get_ptr()) 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. .. seealso:: `nvmlDeviceGetGpuInstanceRemainingCapacity` """ cdef unsigned int count with nogil: __status__ = nvmlDeviceGetGpuInstanceRemainingCapacity(device, profile_id, &count) check_status(__status__) return count 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 ``nvmlDeviceGetGpuInstanceProfileInfo``. Returns: intptr_t: Returns the GPU instance handle. .. seealso:: `nvmlDeviceCreateGpuInstance` """ cdef GpuInstance gpu_instance with nogil: __status__ = nvmlDeviceCreateGpuInstance(device, profile_id, &gpu_instance) check_status(__status__) return gpu_instance 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 ``nvmlDeviceGetGpuInstanceProfileInfo``. placement (intptr_t): The requested placement. See ``nvmlDeviceGetGpuInstancePossiblePlacements_v2``. Returns: intptr_t: Returns the GPU instance handle. .. seealso:: `nvmlDeviceCreateGpuInstanceWithPlacement` """ cdef intptr_t _placement_ptr_ = 0 if placement is None else int(placement) cdef GpuInstance gpu_instance with nogil: __status__ = nvmlDeviceCreateGpuInstanceWithPlacement(device, profile_id, _placement_ptr_, &gpu_instance) check_status(__status__) return gpu_instance 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. .. seealso:: `nvmlGpuInstanceDestroy` """ with nogil: __status__ = nvmlGpuInstanceDestroy(gpu_instance) check_status(__status__) 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. Returns: intptr_t: Returns GPU instance. .. seealso:: `nvmlDeviceGetGpuInstanceById` """ cdef GpuInstance gpu_instance with nogil: __status__ = nvmlDeviceGetGpuInstanceById(device, id, &gpu_instance) check_status(__status__) return gpu_instance 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. Returns: nvmlGpuInstanceInfo_t: Return GPU instance information. .. seealso:: `nvmlGpuInstanceGetInfo` """ cdef GpuInstanceInfo info_py = GpuInstanceInfo() cdef nvmlGpuInstanceInfo_t *info = (info_py._get_ptr()) with nogil: __status__ = nvmlGpuInstanceGetInfo(gpu_instance, info) check_status(__status__) return info_py 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. profile (unsigned int): One of the NVML_COMPUTE_INSTANCE_PROFILE_*. eng_profile (unsigned int): One of the NVML_COMPUTE_INSTANCE_ENGINE_PROFILE_*. Returns: nvmlComputeInstanceProfileInfo_v2_t: Returns detailed profile information. .. seealso:: `nvmlGpuInstanceGetComputeInstanceProfileInfoV` """ cdef ComputeInstanceProfileInfo_v2 info_py = ComputeInstanceProfileInfo_v2() cdef nvmlComputeInstanceProfileInfo_v2_t *info = (info_py._get_ptr()) info.version = NVML_VERSION_STRUCT(sizeof(nvmlComputeInstanceProfileInfo_v2_t), 2) with nogil: __status__ = nvmlGpuInstanceGetComputeInstanceProfileInfoV(gpu_instance, profile, eng_profile, info) check_status(__status__) return info_py 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``. Returns: unsigned int: Returns remaining instance count for the profile ID. .. seealso:: `nvmlGpuInstanceGetComputeInstanceRemainingCapacity` """ cdef unsigned int count with nogil: __status__ = nvmlGpuInstanceGetComputeInstanceRemainingCapacity(gpu_instance, profile_id, &count) check_status(__status__) return count 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``. 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. .. seealso:: `nvmlGpuInstanceGetComputeInstancePossiblePlacements` """ cdef unsigned int[1] count = [0] with nogil: __status__ = nvmlGpuInstanceGetComputeInstancePossiblePlacements(gpu_instance, profile_id, NULL, count) check_status_size(__status__) cdef ComputeInstancePlacement placements = ComputeInstancePlacement(count[0]) cdef nvmlComputeInstancePlacement_t *placements_ptr = (placements._get_ptr()) 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``. Returns: intptr_t: Returns the compute instance handle. .. seealso:: `nvmlGpuInstanceCreateComputeInstance` """ cdef ComputeInstance compute_instance with nogil: __status__ = nvmlGpuInstanceCreateComputeInstance(gpu_instance, profile_id, &compute_instance) check_status(__status__) return compute_instance 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``. placement (intptr_t): The requested placement. See ``nvmlGpuInstanceGetComputeInstancePossiblePlacements``. Returns: intptr_t: Returns the compute instance handle. .. seealso:: `nvmlGpuInstanceCreateComputeInstanceWithPlacement` """ cdef intptr_t _placement_ptr_ = 0 if placement is None else int(placement) cdef ComputeInstance compute_instance with nogil: __status__ = nvmlGpuInstanceCreateComputeInstanceWithPlacement(gpu_instance, profile_id, _placement_ptr_, &compute_instance) check_status(__status__) return compute_instance 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. .. seealso:: `nvmlComputeInstanceDestroy` """ with nogil: __status__ = nvmlComputeInstanceDestroy(compute_instance) check_status(__status__) 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. id (unsigned int): The compute instance ID. Returns: intptr_t: Returns compute instance. .. seealso:: `nvmlGpuInstanceGetComputeInstanceById` """ cdef ComputeInstance compute_instance with nogil: __status__ = nvmlGpuInstanceGetComputeInstanceById(gpu_instance, id, &compute_instance) check_status(__status__) return compute_instance 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. .. seealso:: `nvmlComputeInstanceGetInfo_v2` """ cdef ComputeInstanceInfo info_py = ComputeInstanceInfo() cdef nvmlComputeInstanceInfo_t *info = (info_py._get_ptr()) with nogil: __status__ = nvmlComputeInstanceGetInfo_v2(compute_instance, info) check_status(__status__) return info_py 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. Returns: unsigned int: True when handle refers to a MIG device. .. seealso:: `nvmlDeviceIsMigDeviceHandle` """ cdef unsigned int is_mig_device with nogil: __status__ = nvmlDeviceIsMigDeviceHandle(device, &is_mig_device) check_status(__status__) return is_mig_device 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. Returns: unsigned int: GPU instance ID. .. seealso:: `nvmlDeviceGetGpuInstanceId` """ cdef unsigned int id with nogil: __status__ = nvmlDeviceGetGpuInstanceId(device, &id) check_status(__status__) return id 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. Returns: unsigned int: Compute instance ID. .. seealso:: `nvmlDeviceGetComputeInstanceId` """ cdef unsigned int id with nogil: __status__ = nvmlDeviceGetComputeInstanceId(device, &id) check_status(__status__) return id 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. Returns: unsigned int: Count of MIG devices. .. seealso:: `nvmlDeviceGetMaxMigDeviceCount` """ cdef unsigned int count with nogil: __status__ = nvmlDeviceGetMaxMigDeviceCount(device, &count) check_status(__status__) return count 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. Returns: intptr_t: Reference to the MIG device handle. .. seealso:: `nvmlDeviceGetMigDeviceHandleByIndex` """ cdef Device mig_device with nogil: __status__ = nvmlDeviceGetMigDeviceHandleByIndex(device, index, &mig_device) check_status(__status__) return mig_device 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. Returns: intptr_t: Device handle. .. seealso:: `nvmlDeviceGetDeviceHandleFromMigDeviceHandle` """ cdef Device device with nogil: __status__ = nvmlDeviceGetDeviceHandleFromMigDeviceHandle(mig_device, &device) check_status(__status__) return device 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. .. seealso:: `nvmlDevicePowerSmoothingActivatePresetProfile` """ with nogil: __status__ = nvmlDevicePowerSmoothingActivatePresetProfile(device, profile) check_status(__status__) 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 ``nvmlPowerSmoothingProfile_v1_t`` struct. .. seealso:: `nvmlDevicePowerSmoothingUpdatePresetProfileParam` """ with nogil: __status__ = nvmlDevicePowerSmoothingUpdatePresetProfileParam(device, profile) check_status(__status__) 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``. .. seealso:: `nvmlDevicePowerSmoothingSetState` """ with nogil: __status__ = nvmlDevicePowerSmoothingSetState(device, state) check_status(__status__) 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. .. seealso:: `nvmlDeviceGetAddressingMode` """ cdef DeviceAddressingMode_v1 mode_py = DeviceAddressingMode_v1() cdef nvmlDeviceAddressingMode_t *mode = (mode_py._get_ptr()) mode.version = NVML_VERSION_STRUCT(sizeof(nvmlDeviceAddressingMode_v1_t), 1) with nogil: __status__ = nvmlDeviceGetAddressingMode(device, mode) check_status(__status__) return mode_py 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. Returns: nvmlRepairStatus_v1_t: Reference to ``nvmlRepairStatus_t``. .. seealso:: `nvmlDeviceGetRepairStatus` """ cdef RepairStatus_v1 repair_status_py = RepairStatus_v1() cdef nvmlRepairStatus_t *repair_status = (repair_status_py._get_ptr()) repair_status.version = NVML_VERSION_STRUCT(sizeof(nvmlRepairStatus_v1_t), 1) with nogil: __status__ = nvmlDeviceGetRepairStatus(device, repair_status) check_status(__status__) return repair_status_py 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. .. seealso:: `nvmlDeviceGetPowerMizerMode_v1` """ cdef DevicePowerMizerModes_v1 power_mizer_mode_py = DevicePowerMizerModes_v1() cdef nvmlDevicePowerMizerModes_v1_t *power_mizer_mode = (power_mizer_mode_py._get_ptr()) with nogil: __status__ = nvmlDeviceGetPowerMizerMode_v1(device, power_mizer_mode) check_status(__status__) return power_mizer_mode_py 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. .. seealso:: `nvmlDeviceSetPowerMizerMode_v1` """ cdef intptr_t _power_mizer_mode_ptr_ = 0 if power_mizer_mode is None else int(power_mizer_mode) with nogil: __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: __status__ = nvmlDeviceVgpuForceGspUnload(device) check_status(__status__) 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``. Returns: nvmlVgpuSchedulerStateInfo_v2_t: Reference in which ``p_scheduler_state_info`` is returned. .. seealso:: `nvmlDeviceGetVgpuSchedulerState_v2` """ cdef VgpuSchedulerStateInfo_v2 p_scheduler_state_info_py = VgpuSchedulerStateInfo_v2() cdef nvmlVgpuSchedulerStateInfo_v2_t *p_scheduler_state_info = (p_scheduler_state_info_py._get_ptr()) with nogil: __status__ = nvmlDeviceGetVgpuSchedulerState_v2(device, p_scheduler_state_info) check_status(__status__) return p_scheduler_state_info_py 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. Returns: nvmlVgpuSchedulerStateInfo_v2_t: Reference in which ``p_scheduler_state_info`` is returned. .. seealso:: `nvmlGpuInstanceGetVgpuSchedulerState_v2` """ cdef VgpuSchedulerStateInfo_v2 p_scheduler_state_info_py = VgpuSchedulerStateInfo_v2() cdef nvmlVgpuSchedulerStateInfo_v2_t *p_scheduler_state_info = (p_scheduler_state_info_py._get_ptr()) with nogil: __status__ = nvmlGpuInstanceGetVgpuSchedulerState_v2(gpu_instance, p_scheduler_state_info) check_status(__status__) return p_scheduler_state_info_py 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``. Returns: nvmlVgpuSchedulerLogInfo_v2_t: Reference in which ``p_scheduler_log_info`` is written. .. seealso:: `nvmlDeviceGetVgpuSchedulerLog_v2` """ cdef VgpuSchedulerLogInfo_v2 p_scheduler_log_info_py = VgpuSchedulerLogInfo_v2() cdef nvmlVgpuSchedulerLogInfo_v2_t *p_scheduler_log_info = (p_scheduler_log_info_py._get_ptr()) with nogil: __status__ = nvmlDeviceGetVgpuSchedulerLog_v2(device, p_scheduler_log_info) check_status(__status__) return p_scheduler_log_info_py 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. Returns: nvmlVgpuSchedulerLogInfo_v2_t: Reference in which ``p_scheduler_log_info`` is written. .. seealso:: `nvmlGpuInstanceGetVgpuSchedulerLog_v2` """ cdef VgpuSchedulerLogInfo_v2 p_scheduler_log_info_py = VgpuSchedulerLogInfo_v2() cdef nvmlVgpuSchedulerLogInfo_v2_t *p_scheduler_log_info = (p_scheduler_log_info_py._get_ptr()) with nogil: __status__ = nvmlGpuInstanceGetVgpuSchedulerLog_v2(gpu_instance, p_scheduler_log_info) check_status(__status__) return p_scheduler_log_info_py 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. .. seealso:: `nvmlDeviceSetVgpuSchedulerState_v2` """ cdef intptr_t _p_scheduler_state_ptr_ = 0 if p_scheduler_state is None else int(p_scheduler_state) with nogil: __status__ = nvmlDeviceSetVgpuSchedulerState_v2(device, _p_scheduler_state_ptr_) check_status(__status__) 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 structure of ``nvmlVgpuSchedulerState_v2_t``. .. seealso:: `nvmlGpuInstanceSetVgpuSchedulerState_v2` """ cdef intptr_t _p_scheduler_state_ptr_ = 0 if p_scheduler_state is None else int(p_scheduler_state) with nogil: __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. 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` """ cdef GetCPER_v1 cper_py = GetCPER_v1() cdef nvmlGetCPER_v1_t *cper = (cper_py._get_ptr()) with nogil: __status__ = nvmlSystemGetCPER_v1(cper) check_status(__status__) return cper_py 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. .. seealso:: `nvmlDeviceGetBBXTimeData_v1` """ cdef BBXTimeData_v1 time_data_py = BBXTimeData_v1() cdef nvmlBBXTimeData_v1_t *time_data = (time_data_py._get_ptr()) with nogil: __status__ = nvmlDeviceGetBBXTimeData_v1(device, time_data) check_status(__status__) return time_data_py 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. Returns: 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() cdef nvmlAccountingStats_v2_t *stats = (stats_py._get_ptr()) with nogil: __status__ = nvmlDeviceGetAccountingStats_v2(device, stats) check_status(__status__) return stats_py 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. Returns: 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() cdef nvmlRemappedRowsInfo_v2_t *info = (info_py._get_ptr()) with nogil: __status__ = nvmlDeviceGetRemappedRows_v2(device, info) check_status(__status__) return info_py 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. .. seealso:: `nvmlDeviceSetAdaptiveTgpMode_v1` """ with nogil: __status__ = nvmlDeviceSetAdaptiveTgpMode_v1(device, <_EnableState>mode) check_status(__status__) 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. Returns: nvmlAdaptiveTgpModeInfo_v1_t: Reference in which to return the Adaptive TGP Mode information. .. seealso:: `nvmlDeviceGetAdaptiveTgpModeInfo_v1` """ cdef AdaptiveTgpModeInfo_v1 info_py = AdaptiveTgpModeInfo_v1() cdef nvmlAdaptiveTgpModeInfo_v1_t *info = (info_py._get_ptr()) with nogil: __status__ = nvmlDeviceGetAdaptiveTgpModeInfo_v1(device, info) check_status(__status__) return info_py 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. .. note:: MIG handles are not supported. .. seealso:: `nvmlDeviceSetMemoryLimits_v1` """ cdef intptr_t _limits_ptr_ = 0 if limits is None else int(limits) with nogil: __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. Returns: 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() cdef nvmlGetMemoryLimits_v1_t *limits = (limits_py._get_ptr()) with nogil: __status__ = nvmlDeviceGetMemoryLimits_v1(device, limits) check_status(__status__) return limits_py 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. Returns: nvmlGpuFabricInfo_v4_t: Information about GPU fabric state including per-type cliques. .. seealso:: `nvmlDeviceGetGpuFabricInfo_v4` """ cdef GpuFabricInfo_v4 gpu_fabric_info_py = GpuFabricInfo_v4() cdef nvmlGpuFabricInfo_v4_t *gpu_fabric_info = (gpu_fabric_info_py._get_ptr()) with nogil: __status__ = nvmlDeviceGetGpuFabricInfo_v4(device, gpu_fabric_info) check_status(__status__) return gpu_fabric_info_py 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. Returns: nvmlPerfMetricsSamples_v1_t: Reference to ``nvmlPerfMetricsSamples_v1_t``. .. seealso:: `nvmlDevicePerfMetricsGetSamples_v1` """ cdef PerfMetricsSamples_v1 samples_py = PerfMetricsSamples_v1() cdef nvmlPerfMetricsSamples_v1_t *samples = (samples_py._get_ptr()) with nogil: __status__ = nvmlDevicePerfMetricsGetSamples_v1(device, samples) check_status(__status__) return samples_py 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. Returns: nvmlNvlinkSetBwModeAsync_v1_t: Reference to ``nvmlNvlinkSetBwModeAsync_v1_t``. .. seealso:: `nvmlDeviceSetNvlinkBwModeAsync_v1` """ cdef NvlinkSetBwModeAsync_v1 set_bw_mode_async_py = NvlinkSetBwModeAsync_v1() cdef nvmlNvlinkSetBwModeAsync_v1_t *set_bw_mode_async = (set_bw_mode_async_py._get_ptr()) with nogil: __status__ = nvmlDeviceSetNvlinkBwModeAsync_v1(device, set_bw_mode_async) check_status(__status__) return set_bw_mode_async_py 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. Returns: nvmlNvlinkTelemetrySamples_v1_t: Request/response batch (see ``nvmlNvlinkTelemetrySamples_v1_t``). .. seealso:: `nvmlDeviceGetNvLinkTelemetrySamples_v1` """ cdef NvlinkTelemetrySamples_v1 samples_py = NvlinkTelemetrySamples_v1() cdef nvmlNvlinkTelemetrySamples_v1_t *samples = (samples_py._get_ptr()) with nogil: __status__ = nvmlDeviceGetNvLinkTelemetrySamples_v1(device, samples) check_status(__status__) return samples_py 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``. config (intptr_t): GPU Operational Event subscription configuration. .. seealso:: `nvmlEventSetRegisterGpuOperationalEvents_v1` """ cdef intptr_t _config_ptr_ = 0 if config is None else int(config) with nogil: __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. .. seealso:: `nvmlEventSetGetContextCount_v1` """ cdef EventSetGetContextCount_v1 params_py = EventSetGetContextCount_v1() cdef nvmlEventSetGetContextCount_v1_t *params = (params_py._get_ptr()) with nogil: __status__ = nvmlEventSetGetContextCount_v1(set, params) check_status(__status__) return params_py 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. Returns: nvmlEccBankRemapperStatus_v1_t: Reference to ``nvmlEccBankRemapperStatus_v1_t``. .. seealso:: `nvmlDeviceGetBankRemapperStatus_v1` """ cdef EccBankRemapperStatus_v1 p_bank_remapper_status_py = EccBankRemapperStatus_v1() cdef nvmlEccBankRemapperStatus_v1_t *p_bank_remapper_status = (p_bank_remapper_status_py._get_ptr()) with nogil: __status__ = nvmlDeviceGetBankRemapperStatus_v1(device, p_bank_remapper_status) check_status(__status__) return p_bank_remapper_status_py cpdef object device_get_gpu_uptime_v1(intptr_t device): """Retrieves the GPU uptime. The uptime denotes the number of seconds elapsed since the GPU was initialized by the driver. The uptime resets to zero on a host reboot, driver unload/reload, or a GPU reset. For MIG device handles, the parent GPU uptime is returned. Args: device (intptr_t): The identifier of the target device. Returns: nvmlGpuUptime_v1_t: Reference in which to return the GPU uptime. .. seealso:: `nvmlDeviceGetGpuUptime_v1` """ cdef GpuUptime_v1 uptime_py = GpuUptime_v1() cdef nvmlGpuUptime_v1_t *uptime = (uptime_py._get_ptr()) with nogil: __status__ = nvmlDeviceGetGpuUptime_v1(device, uptime) check_status(__status__) return uptime_py cpdef object system_get_conf_compute_settings_v2(): """Get Conf Computing System Settings, version 2. Returns everything ``nvmlSystemGetConfComputeSettings`` reports, plus the TDISP state of the GPUs in ``tdispState``. All GPUs, and therefore all TDIs, are expected to be in the same state. If they are not, the system level state is ambiguous and NVML_ERROR_UNKNOWN is returned. For Hopper ™️ or newer fully supported devices. Supported on Linux, Windows TCC. Returns: nvmlSystemConfComputeSettings_v2_t: System CC settings. .. seealso:: `nvmlSystemGetConfComputeSettings_v2` """ cdef SystemConfComputeSettings_v2 settings_py = SystemConfComputeSettings_v2() cdef nvmlSystemConfComputeSettings_v2_t *settings = (settings_py._get_ptr()) settings.version = NVML_VERSION_STRUCT(sizeof(nvmlSystemConfComputeSettings_v2_t), 2) with nogil: __status__ = nvmlSystemGetConfComputeSettings_v2(settings) check_status(__status__) return settings_py cpdef object device_get_nvlink_info_v3(intptr_t device): """Query NVLINK information associated with this device (v3). Args: device (intptr_t): The identifier of the target device. Returns: nvmlNvLinkInfo_v3_t: Reference to ``nvmlNvLinkInfo_v3_t``. .. seealso:: `nvmlDeviceGetNvLinkInfo_v3` """ cdef NvLinkInfo_v3 info_py = NvLinkInfo_v3() cdef nvmlNvLinkInfo_v3_t *info = (info_py._get_ptr()) with nogil: __status__ = nvmlDeviceGetNvLinkInfo_v3(device, info) check_status(__status__) return info_py cpdef object device_get_nvlink_remap_table_info_v1(intptr_t device): """Get the NVLink remap table information. This API returns the remap table addresses for all the entries in the FLA and SPA/GPA remap tables. Args: device (intptr_t): The identifier of the target device. Returns: nvmlNvlinkGetRemapTableInfo_v1_t: Reference to ``nvmlNvlinkGetRemapTableInfo_v1_t`` struct. .. seealso:: `nvmlDeviceGetNvlinkRemapTableInfo_v1` """ cdef NvlinkGetRemapTableInfo_v1 remap_table_info_py = NvlinkGetRemapTableInfo_v1() cdef nvmlNvlinkGetRemapTableInfo_v1_t *remap_table_info = (remap_table_info_py._get_ptr()) with nogil: __status__ = nvmlDeviceGetNvlinkRemapTableInfo_v1(device, remap_table_info) check_status(__status__) return remap_table_info_py cpdef device_set_nvlink_nvle_ready_v1(intptr_t device, set_nvle_ready): """Set the NVLink NVLE ready state. This API signals whether NVLE (NVLink Encryption) is ready on the given device. Args: device (intptr_t): The identifier of the target device. set_nvle_ready (intptr_t): Reference to ``nvmlNvlinkSetNvleReady_v1_t`` struct. .. seealso:: `nvmlDeviceSetNvlinkNvleReady_v1` """ cdef intptr_t _set_nvle_ready_ptr_ = 0 if set_nvle_ready is None else int(set_nvle_ready) with nogil: __status__ = nvmlDeviceSetNvlinkNvleReady_v1(device, _set_nvle_ready_ptr_) check_status(__status__) cpdef device_lock_nvlink_remap_table_v1(intptr_t device, remap_table_lock_info): """Lock the NVLink remap table to prevent MSE from making further updates. This API requests to lock the remap table to prevent MSE (Multi-Socket Engine) from making any further updates to the remap table for the given links. Args: device (intptr_t): The identifier of the target device. remap_table_lock_info (intptr_t): Reference to ``nvmlNvlinkLockRemapTable_v1_t`` struct. .. seealso:: `nvmlDeviceLockNvlinkRemapTable_v1` """ cdef intptr_t _remap_table_lock_info_ptr_ = 0 if remap_table_lock_info is None else int(remap_table_lock_info) with nogil: __status__ = nvmlDeviceLockNvlinkRemapTable_v1(device, _remap_table_lock_info_ptr_) check_status(__status__) cpdef device_setup_nvlink_nvle_encryption_key_v1(intptr_t device, encryption_key): """Setup the NVLink NVLE encryption key. This API sets the NVLE encryption key between GPUs with the given ALIDs. Args: device (intptr_t): The identifier of the target device. encryption_key (intptr_t): Reference to ``nvmlNvlinkSetupNvleEncryptionKey_v1_t`` struct. .. seealso:: `nvmlDeviceSetupNvlinkNvleEncryptionKey_v1` """ cdef intptr_t _encryption_key_ptr_ = 0 if encryption_key is None else int(encryption_key) with nogil: __status__ = nvmlDeviceSetupNvlinkNvleEncryptionKey_v1(device, _encryption_key_ptr_) check_status(__status__) cpdef object device_get_nvlink_nvle_private_info_v1(intptr_t device): """Get NVLink NVLE private (opaque) information. This API retrieves opaque NVLE private information for the given device and copies it into the ``data`` buffer, setting ``size`` to the number of bytes written. Args: device (intptr_t): The identifier of the target device. Returns: nvmlNvlinkNvlePrivateInfo_v1_t: Reference to ``nvmlNvlinkNvlePrivateInfo_v1_t`` struct. .. seealso:: `nvmlDeviceGetNvlinkNvlePrivateInfo_v1` """ cdef NvlinkNvlePrivateInfo_v1 private_info_py = NvlinkNvlePrivateInfo_v1() cdef nvmlNvlinkNvlePrivateInfo_v1_t *private_info = (private_info_py._get_ptr()) with nogil: __status__ = nvmlDeviceGetNvlinkNvlePrivateInfo_v1(device, private_info) check_status(__status__) return private_info_py cpdef str system_get_driver_branch(): """Retrieves the driver branch of the NVIDIA driver installed on the system. Returns: str: driver branch. """ cdef nvmlSystemDriverBranchInfo_t info # Calculation copied from the macro NVML_STRUCT_VERSION in nvml.h # Needs to be updated if the version of the nvmlSystemDriverBranchInfo_t # struct changes in the future. info.version = NVML_VERSION_STRUCT(sizeof(nvmlSystemDriverBranchInfo_v1_t), 1) cdef unsigned int length = 80 with nogil: __status__ = nvmlSystemGetDriverBranch(&info, length) check_status(__status__) return cpython.PyUnicode_FromString(info.branch) cpdef int device_get_temperature_v(intptr_t device, nvmlTemperatureSensors_t sensorType): """Retrieves the current temperature readings (in degrees C) for the given device. Args: device (intptr_t): Target device identifier. Returns: nvmlTemperature_v1_t: Structure specifying the sensor type (input) and retrieved temperature value (output). .. seealso:: `nvmlDeviceGetTemperatureV` """ cdef nvmlTemperature_v1_t[1] temperature with nogil: temperature[0].version = NVML_VERSION_STRUCT(sizeof(nvmlTemperature_v1_t), 1) temperature[0].sensorType = sensorType __status__ = nvmlDeviceGetTemperatureV(device, temperature) check_status(__status__) return temperature.temperature cpdef object device_get_supported_performance_states(intptr_t device): """Get all supported Performance States (P-States) for the device. Args: device (Device): The identifier of the target device. """ cdef int size = 16 # NVML_MAX_GPU_PERF_STATES cdef view.array pstates = view.array(shape=(size,), itemsize=sizeof(unsigned int), format="I", mode="c") # The header says "size is the size of the pstates array in bytes". # The size of an enum in C is implementation-defined, so we multiply by `sizeof(nvmlPstates_t)` here. with nogil: __status__ = nvmlDeviceGetSupportedPerformanceStates( device, pstates.data, size * sizeof(nvmlPstates_t) ) check_status(__status__) return pstates cpdef object device_get_running_process_detail_list(intptr_t device, unsigned int mode): """Get information about running processes on a device for input context Args: device (Device): The device handle or MIG handle mode (unsigned int): The process mode (Compute/Graphics/MPSCompute) """ cdef ProcessDetailList_v1 plist = ProcessDetailList_v1() cdef nvmlProcessDetailList_v1_t *ptr = plist._get_ptr() # Get size of array with nogil: ptr.version = NVML_VERSION_STRUCT(sizeof(nvmlProcessDetailList_v1_t), 1) ptr.mode = mode ptr.numProcArrayEntries = 0 ptr.procArray = NULL __status__ = nvmlDeviceGetRunningProcessDetailList(device, ptr) check_status_size(__status__) if ptr.numProcArrayEntries == 0: return plist procArray = ProcessDetail_v1(ptr.numProcArrayEntries) plist.proc_array = procArray with nogil: __status__ = nvmlDeviceGetRunningProcessDetailList(device, ptr) check_status(__status__) return plist 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 Args: device (Device): The identifier of the target device. last_seen_time_stamp (unsigned long long): Timestamp in microseconds. Set it to 0 to read utilization based on all the samples maintained by the driver's internal sample buffer. Set to a timeStamp retrieved from a previous query to read utilization since the previous query. Returns: ProcessesUtilizationInfo_v1: The processes utilization information structure. """ cdef ProcessesUtilizationInfo_v1 procesesUtilInfo = ProcessesUtilizationInfo_v1() cdef nvmlProcessesUtilizationInfo_t *ptr = procesesUtilInfo._get_ptr() # Get size of array with nogil: ptr.version = NVML_VERSION_STRUCT(sizeof(nvmlProcessesUtilizationInfo_v1_t), 1) ptr.processSamplesCount = 0 ptr.lastSeenTimeStamp = last_seen_time_stamp ptr.procUtilArray = NULL __status__ = nvmlDeviceGetProcessesUtilizationInfo( device, ptr ) check_status_size(__status__) if ptr.processSamplesCount == 0: return procesesUtilInfo cdef ProcessUtilizationInfo_v1 procUtilArray = ProcessUtilizationInfo_v1(ptr.processSamplesCount) procesesUtilInfo.proc_util_array = procUtilArray with nogil: __status__ = nvmlDeviceGetProcessesUtilizationInfo( device, ptr ) check_status(__status__) return procesesUtilInfo cpdef device_set_hostname_v1(intptr_t device, str hostname): """Set the hostname for the device. Args: device (Device): The identifier of the target device. hostname (str): The new hostname to set. """ cdef bytes = cpython.PyUnicode_AsASCIIString(hostname) if len(bytes) > 64: raise ValueError("hostname must 64 characters or less") cdef nvmlHostname_v1_t hostname_struct memcpy(hostname_struct.value, cpython.PyBytes_AsString(bytes), len(bytes)) with nogil: __status__ = nvmlDeviceSetHostname_v1(device, &hostname_struct) check_status(__status__) cpdef str device_get_hostname_v1(intptr_t device): """Get the hostname for the device. Args: device (Device): The identifier of the target device. Returns: str: Hostname of the device. """ cdef nvmlHostname_v1_t hostname with nogil: __status__ = nvmlDeviceGetHostname_v1(device, &hostname) check_status(__status__) return cpython.PyUnicode_FromString(hostname.value) cdef FieldValue _cast_field_values(values): if isinstance(values, FieldValue): return values cdef FieldValue values_ cdef unsigned int valuesCount = len(values) values_ = FieldValue(valuesCount) for i, v in enumerate(values): if isinstance(v, tuple): if len(v) != 2: raise ValueError("FieldValue tuple must be of length 2") if not isinstance(v[0], int) or not isinstance(v[1], int): raise ValueError("FieldValue tuple elements must be integers") values_[i].field_id = v[0] values_[i].scope_id = v[1] elif isinstance(v, int): values_[i].field_id = v values_[i].scope_id = 0 else: raise ValueError("Each entry must be an integer field ID, or a tuple of (field ID, scope ID)") return values_ cpdef object device_get_field_values(intptr_t device, values): """Request values for a list of fields for a device. This API allows multiple fields to be queried at once. If any of the underlying fieldIds are populated by the same driver call, the results for those field IDs will be populated from a single call rather than making a driver call for each fieldId. Args: device (intptr_t): The device handle of the GPU to request field values for. values (FieldValue): Array of FieldValue specifying what to retrieve. Entries left unpopulated by NVML report ``ERROR_UNKNOWN`` in ``nvml_return``. .. seealso:: `nvmlDeviceGetFieldValues` """ cdef FieldValue values_ = _cast_field_values(values) cdef nvmlFieldValue_t *ptr = values_._get_ptr() cdef unsigned int valuesCount = len(values) # Passing a valuesCount of 0 to nvmlDeviceGetFieldValues returns NVML_INVALID_ARGUMENT if valuesCount == 0: return values_ # nvbug 6952048: native NVML can return success without populating an entry. # Reset every query so untouched entries cannot retain stale success statuses. values_.nvml_return = NVML_ERROR_UNKNOWN with nogil: __status__ = nvmlDeviceGetFieldValues(device, valuesCount, ptr) check_status(__status__) values_._data = values_._data[:valuesCount] return values_ cpdef device_clear_field_values(intptr_t device, values): """Clear values for a list of fields for a device. This API allows multiple fields to be cleared at once. Args: device (Device): The device handle of the GPU to request field values for values (FieldValue): FieldValue instance to hold field values. Each value's fieldId must be populated prior to this call """ cdef FieldValue values_ = _cast_field_values(values) cdef nvmlFieldValue_t *ptr = values_._get_ptr() cdef unsigned int valuesCount = len(values) # Passing a valuesCount of 0 to nvmlDeviceClearFieldValues returns NVML_INVALID_ARGUMENT if valuesCount == 0: return values_ with nogil: __status__ = nvmlDeviceClearFieldValues(device, valuesCount, ptr) check_status(__status__) cpdef object gpu_instance_get_creatable_vgpus(intptr_t gpu_instance): """Query the currently creatable vGPU types on a specific GPU Instance. Args: gpu_instance (GpuInstance): The identifier of the target GPU Instance. Returns: VgpuTypeIdInfo_v1: The vGPU type ID information structure. """ cdef VgpuTypeIdInfo_v1 pVgpus = VgpuTypeIdInfo_v1() cdef nvmlVgpuTypeIdInfo_v1_t *ptr = pVgpus._get_ptr() # Get size of array with nogil: ptr.version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuTypeIdInfo_v1_t), 1) ptr.vgpuCount = 0 ptr.vgpuTypeIds = NULL __status__ = nvmlGpuInstanceGetCreatableVgpus(gpu_instance, ptr) check_status_size(__status__) if ptr.vgpuCount == 0: return pVgpus cdef view.array vgpuTypeIds = view.array(shape=(ptr.vgpuCount,), itemsize=sizeof(unsigned int), format="I", mode="c") pVgpus.vgpu_type_ids = vgpuTypeIds with nogil: __status__ = nvmlGpuInstanceGetCreatableVgpus(gpu_instance, ptr) check_status(__status__) return pVgpus cpdef object gpu_instance_get_active_vgpus(intptr_t gpu_instance): """Retrieve the active vGPU instances within a GPU instance. Args: gpu_instance (GpuInstance): The identifier of the target GPU Instance. Returns: ActiveVgpuInstanceInfo: The vGPU instance ID information structure. """ cdef ActiveVgpuInstanceInfo_v1 activeVgpuInfo = ActiveVgpuInstanceInfo_v1() cdef nvmlActiveVgpuInstanceInfo_v1_t *ptr = activeVgpuInfo._get_ptr() with nogil: ptr.version = NVML_VERSION_STRUCT(sizeof(nvmlActiveVgpuInstanceInfo_v1_t), 1) ptr.vgpuCount = 0 ptr.vgpuInstances = NULL __status__ = nvmlGpuInstanceGetActiveVgpus(gpu_instance, ptr) check_status_size(__status__) if ptr.vgpuCount == 0: return activeVgpuInfo cdef view.array vgpuInstances = view.array(shape=(ptr.vgpuCount,), itemsize=sizeof(unsigned int), format="I", mode="c") activeVgpuInfo.vgpu_instances = vgpuInstances with nogil: __status__ = nvmlGpuInstanceGetActiveVgpus(gpu_instance, ptr) check_status(__status__) return activeVgpuInfo cpdef object gpu_instance_get_vgpu_type_creatable_placements(intptr_t gpu_instance, unsigned int vgpu_type_id): """Query the creatable vGPU placement ID of the vGPU type within a GPU instance. Args: gpu_instance (GpuInstance): The identifier of the target GPU Instance. vgpu_type_id (unsigned int): The vGPU type ID. Returns: VgpuPlacementList_v2: The vGPU placement list structure. """ cdef VgpuCreatablePlacementInfo_v1 pCreatablePlacementInfo = VgpuCreatablePlacementInfo_v1() cdef nvmlVgpuCreatablePlacementInfo_v1_t *ptr = pCreatablePlacementInfo._get_ptr() # Get size of array with nogil: ptr.version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuCreatablePlacementInfo_v1_t), 1) ptr.count = 0 ptr.placementIds = NULL ptr.vgpuTypeId = vgpu_type_id __status__ = nvmlGpuInstanceGetVgpuTypeCreatablePlacements(gpu_instance, ptr) check_status_size(__status__) if ptr.count == 0: return pCreatablePlacementInfo cdef view.array placementIds = view.array(shape=(ptr.count,), itemsize=sizeof(unsigned int), format="I", mode="c") pCreatablePlacementInfo.placement_ids = placementIds with nogil: __status__ = nvmlGpuInstanceGetVgpuTypeCreatablePlacements(gpu_instance, ptr) check_status(__status__) return pCreatablePlacementInfo cpdef object device_get_vgpu_type_creatable_placements(intptr_t device, unsigned int vgpu_type_id, unsigned int mode): """Query the creatable vGPU placement ID of the vGPU type within a GPU instance. Args: device (Device): The identifier of the target device. vgpu_type_id (unsigned int): The vGPU type ID. mode (unsigned int): The placement mode. 0: Heterogeneous, 1: Homogeneous. Returns: VgpuPlacementList_v2: The vGPU placement list structure. """ cdef VgpuPlacementList_v2 pPlacementList = VgpuPlacementList_v2() cdef nvmlVgpuPlacementList_v2_t *ptr = pPlacementList._get_ptr() # Get size of array with nogil: ptr.version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuPlacementList_v2_t), 2) ptr.count = 0 ptr.placementIds = NULL ptr.mode = mode __status__ = nvmlDeviceGetVgpuTypeCreatablePlacements(device, vgpu_type_id, ptr) check_status_size(__status__) if ptr.count == 0: return pPlacementList cdef view.array placementIds = view.array(shape=(ptr.count,), itemsize=sizeof(unsigned int), format="I", mode="c") pPlacementList.placement_ids = placementIds with nogil: __status__ = nvmlDeviceGetVgpuTypeCreatablePlacements(device, vgpu_type_id, ptr) check_status(__status__) return pPlacementList cpdef object vgpu_instance_get_metadata(unsigned int vgpu_instance): """Returns vGPU metadata structure for a running vGPU. The structure contains information about the vGPU and its associated VM such as the currently installed NVIDIA guest driver version, together with host driver version and an opaque data section containing internal state. Args: vgpu_instance (unsigned int): The identifier of the target vGPU instance. Returns: VgpuMetadata: Metadata. """ cdef VgpuMetadata vgpuMetadata = VgpuMetadata() cdef unsigned int[1] bufferSize = [sizeof(nvmlVgpuMetadata_t)] cdef nvmlVgpuMetadata_t *ptr = vgpuMetadata._get_ptr() with nogil: __status__ = nvmlVgpuInstanceGetMetadata(vgpu_instance, ptr, bufferSize) check_status_size(__status__) return vgpuMetadata cpdef object device_get_vgpu_metadata(intptr_t device): """Returns a vGPU metadata structure for the physical GPU indicated by device. The structure contains information about the GPU and the currently installed NVIDIA host driver version that's controlling it, together with an opaque data section containing internal state. Args: device (Device): The identifier of the target device. Returns: VgpuPgpuMetadata: Metadata. """ cdef VgpuPgpuMetadata pgpuMetadata = VgpuPgpuMetadata() cdef unsigned int[1] bufferSize = [sizeof(nvmlVgpuPgpuMetadata_t)] cdef nvmlVgpuPgpuMetadata_t *ptr = pgpuMetadata._get_ptr() with nogil: __status__ = nvmlDeviceGetVgpuMetadata(device, ptr, bufferSize) check_status_size(__status__) return pgpuMetadata cpdef object get_vgpu_compatibility(VgpuMetadata vgpu_metadata, VgpuPgpuMetadata pgpu_metadata): """Takes a vGPU instance metadata structure read from vgpu_instance_get_metadata() and a vGPU metadata structure for a physical GPU read from device_get_vgpu_metadata, and returns compatibility information of the vGPU instance and the physical GPU. Args: vgpu_metadata (VgpuMetadata): The vGPU instance metadata. pgpu_metadata (VgpuPgpuMetadata): The physical GPU metadata. Returns: VgpuPgpuCompatibility: Compatibility information. """ cdef VgpuPgpuCompatibility compatibilityInfo = VgpuPgpuCompatibility() cdef nvmlVgpuPgpuCompatibility_t *ptr = compatibilityInfo._get_ptr() cdef nvmlVgpuMetadata_t *vgpu_metadata_ptr = vgpu_metadata._get_ptr() cdef nvmlVgpuPgpuMetadata_t *pgpu_metadata_ptr = pgpu_metadata._get_ptr() with nogil: __status__ = nvmlGetVgpuCompatibility(vgpu_metadata_ptr, pgpu_metadata_ptr, ptr) check_status(__status__) return compatibilityInfo cpdef object device_get_vgpu_instances_utilization_info(intptr_t device): """ Retrieves recent utilization for vGPU instances running on a physical GPU (device). Args: device (Device): The identifier of the target device. Returns: VgpuInstancesUtilizationInfo_v1: The vGPU instances utilization information structure. """ cdef VgpuInstancesUtilizationInfo_v1 vgpuUtilInfo = VgpuInstancesUtilizationInfo_v1() cdef nvmlVgpuInstancesUtilizationInfo_v1_t *ptr = vgpuUtilInfo._get_ptr() with nogil: ptr.version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuInstancesUtilizationInfo_v1_t), 1) ptr.vgpuInstanceCount = 0 ptr.vgpuUtilArray = NULL __status__ = nvmlDeviceGetVgpuInstancesUtilizationInfo(device, ptr) check_status_size(__status__) if ptr.vgpuInstanceCount == 0: return vgpuUtilInfo cdef VgpuInstanceUtilizationInfo_v1 vgpuUtilArray = VgpuInstanceUtilizationInfo_v1(ptr.vgpuInstanceCount) vgpuUtilInfo.vgpu_util_array = vgpuUtilArray with nogil: __status__ = nvmlDeviceGetVgpuInstancesUtilizationInfo(device, ptr) check_status(__status__) return vgpuUtilInfo cpdef object device_get_vgpu_processes_utilization_info(intptr_t device, unsigned int last_seen_time_stamp): """ Retrieves recent utilization for processes running on vGPU instances on a physical GPU (device). Args: device (Device): The identifier of the target device. Returns: VgpuProcessesUtilizationInfo: The vGPU processes utilization information structure. """ cdef VgpuProcessesUtilizationInfo_v1 vgpuProcUtilInfo = VgpuProcessesUtilizationInfo_v1() cdef nvmlVgpuProcessesUtilizationInfo_v1_t *ptr = vgpuProcUtilInfo._get_ptr() with nogil: ptr.version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuProcessesUtilizationInfo_v1_t), 1) ptr.vgpuProcessCount = 0 ptr.vgpuProcUtilArray = NULL ptr.lastSeenTimeStamp = last_seen_time_stamp __status__ = nvmlDeviceGetVgpuProcessesUtilizationInfo(device, ptr) check_status_size(__status__) if ptr.vgpuProcessCount == 0: return vgpuProcUtilInfo cdef VgpuProcessUtilizationInfo_v1 vgpuProcUtilArray = VgpuProcessUtilizationInfo_v1(ptr.vgpuProcessCount) vgpuProcUtilInfo.vgpu_proc_util_array = vgpuProcUtilArray with nogil: __status__ = nvmlDeviceGetVgpuProcessesUtilizationInfo(device, ptr) check_status(__status__) return vgpuProcUtilInfo cpdef object device_get_sram_unique_uncorrected_ecc_error_counts(intptr_t device): """Retrieves the counts of SRAM unique uncorrected ECC errors Args: device (Device): The identifier of the target device. Returns: EccSramUniqueUncorrectedErrorCounts_v1: The ECC SRAM unique uncorrected error counts structure. """ cdef EccSramUniqueUncorrectedErrorCounts_v1 errorCounts = EccSramUniqueUncorrectedErrorCounts_v1() cdef nvmlEccSramUniqueUncorrectedErrorCounts_v1_t *ptr = errorCounts._get_ptr() with nogil: ptr.version = NVML_VERSION_STRUCT(sizeof(nvmlEccSramUniqueUncorrectedErrorCounts_v1_t), 1) ptr.entryCount = 0 ptr.entries = NULL __status__ = nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts(device, ptr) check_status_size(__status__) cdef EccSramUniqueUncorrectedErrorEntry_v1 entries = EccSramUniqueUncorrectedErrorEntry_v1(ptr.entryCount) errorCounts.entries = entries if ptr.entryCount == 0: return errorCounts with nogil: __status__ = nvmlDeviceGetSramUniqueUncorrectedEccErrorCounts(device, ptr) check_status(__status__) return errorCounts cpdef object device_get_gpu_fabric_info_v(intptr_t device): """Versioned wrapper around nvmlDeviceGetGpuFabricInfo that accepts a versioned ``nvmlGpuFabricInfo_v2_t`` or later output structure. Args: device (intptr_t): The identifier of the target device. Returns: nvmlGpuFabricInfo_v3_t: Information about GPU fabric state. .. seealso:: `nvmlDeviceGetGpuFabricInfoV` """ cdef GpuFabricInfo_v3 gpu_fabric_info_v3_py cdef GpuFabricInfo_v2 gpu_fabric_info_v2_py cdef nvmlGpuFabricInfoV_t *gpu_fabric_info if CUDA_VERSION >= 13000: gpu_fabric_info_v3_py = GpuFabricInfo_v3() gpu_fabric_info = (gpu_fabric_info_v3_py._get_ptr()) with nogil: gpu_fabric_info.version = NVML_VERSION_STRUCT(sizeof(nvmlGpuFabricInfo_v3_t), 3) __status__ = nvmlDeviceGetGpuFabricInfoV(device, gpu_fabric_info) check_status(__status__) return gpu_fabric_info_v3_py else: gpu_fabric_info_v2_py = GpuFabricInfo_v2() gpu_fabric_info = (gpu_fabric_info_v2_py._get_ptr()) with nogil: gpu_fabric_info.version = NVML_VERSION_STRUCT(sizeof(nvmlGpuFabricInfo_v2_t), 2) __status__ = nvmlDeviceGetGpuFabricInfoV(device, gpu_fabric_info) check_status(__status__) return gpu_fabric_info_v2_py cpdef object device_get_platform_info(intptr_t device): """Get platform information of this device. Args: device (intptr_t): The identifier of the target device. Returns: nvmlPlatformInfo_v2_t: Pointer to the caller-provided structure of nvmlPlatformInfo_t. .. seealso:: `nvmlDeviceGetPlatformInfo` """ cdef PlatformInfo_v1 platform_info_v1_py cdef PlatformInfo_v2 platform_info_v2_py cdef nvmlPlatformInfo_t *platform_info if CUDA_VERSION >= 13000: platform_info_v2_py = PlatformInfo_v2() platform_info = (platform_info_v2_py._get_ptr()) with nogil: platform_info.version = NVML_VERSION_STRUCT(sizeof(nvmlPlatformInfo_v2_t), 2) __status__ = nvmlDeviceGetPlatformInfo(device, platform_info) check_status(__status__) return platform_info_v2_py else: platform_info_v1_py = PlatformInfo_v1() platform_info = (platform_info_v1_py._get_ptr()) with nogil: platform_info.version = NVML_VERSION_STRUCT(sizeof(nvmlPlatformInfo_v1_t), 1) __status__ = nvmlDeviceGetPlatformInfo(device, platform_info) check_status(__status__) return platform_info_v1_py cpdef object device_get_nvlink_info(intptr_t device): """Query NVLINK information associated with this device. Args: device (intptr_t): The identifier of the target device. Returns: nvmlNvLinkInfo_v2_t: Reference to ``nvmlNvLinkInfo_t``. .. seealso:: `nvmlDeviceGetNvLinkInfo` """ cdef NvLinkInfo_v1 info_v1_py cdef NvLinkInfo_v2 info_v2_py cdef nvmlNvLinkInfo_t *info if CUDA_VERSION >= 13000: info_v2_py = NvLinkInfo_v2() info = (info_v2_py._get_ptr()) with nogil: info.version = NVML_VERSION_STRUCT(sizeof(nvmlNvLinkInfo_v2_t), 2) __status__ = nvmlDeviceGetNvLinkInfo(device, info) check_status(__status__) return info_v2_py else: info_v1_py = NvLinkInfo_v1() info = (info_v1_py._get_ptr()) with nogil: info.version = NVML_VERSION_STRUCT(sizeof(nvmlNvLinkInfo_v1_t), 1) __status__ = nvmlDeviceGetNvLinkInfo(device, info) check_status(__status__) return info_v1_py cpdef intptr_t system_event_set_create(): """Create an empty set of system events. Event set should be freed by ``nvmlSystemEventSetFree``.""" cdef nvmlSystemEventSetCreateRequest_v1_t[1] request with nogil: request[0].version = NVML_VERSION_STRUCT(sizeof(nvmlSystemEventSetCreateRequest_v1_t), 1) __status__ = nvmlSystemEventSetCreate(request) check_status(__status__) return (request[0].set) cpdef system_event_set_free(intptr_t event_set): """Frees an event set.""" cdef nvmlSystemEventSetFreeRequest_v1_t[1] request request[0].set = event_set with nogil: request[0].version = NVML_VERSION_STRUCT(sizeof(nvmlSystemEventSetFreeRequest_v1_t), 1) __status__ = nvmlSystemEventSetFree(request) check_status(__status__) cpdef system_register_events(unsigned long long event_types, intptr_t event_set): """Starts recording of events on system and add the events to specified ``nvmlSystemEventSet_t``. Args: event_types (unsigned long long): Bitmask of nvmlSystemEventType_t values representing the events to register. event_set (intptr_t): The system event set handle. """ cdef nvmlSystemRegisterEventRequest_v1_t[1] request with nogil: request[0].version = NVML_VERSION_STRUCT(sizeof(nvmlSystemRegisterEventRequest_v1_t), 1) request[0].set = event_set request[0].eventTypes = event_types __status__ = nvmlSystemRegisterEvents(request) check_status(__status__) cpdef object system_event_set_wait(intptr_t event_set, unsigned int timeout_ms, unsigned int buffer_size): """Waits for events to occur on the system event set. Args: event_set (intptr_t): The system event set handle. timeout_ms (unsigned int): The maximum amount of time in milliseconds to wait for an event. buffer_size (unsigned int): The size of the event buffer. Returns: SystemEvent: The system event that occurred. """ cdef nvmlSystemEventSetWaitRequest_v1_t[1] request cdef SystemEventData_v1 event_data = SystemEventData_v1(buffer_size) request[0].data = (event_data._get_ptr()) with nogil: request[0].version = NVML_VERSION_STRUCT(sizeof(nvmlSystemEventSetWaitRequest_v1_t), 1) request[0].timeoutms = timeout_ms request[0].set = event_set request[0].dataSize = buffer_size __status__ = nvmlSystemEventSetWait(request) check_status(__status__) event_data._data = event_data._data[:request[0].numEvent] return event_data cpdef unsigned int device_get_fan_speed_rpm(intptr_t device, unsigned int fan): """Retrieves the intended operating speed in rotations per minute (RPM) of the device's specified fan. Args: device (intptr_t): The identifier of the target device. fan (unsigned int): The index of the fan to query. Returns: rpm (unsigned int): The fan speed in RPM. .. seealso:: `nvmlDeviceGetFanSpeedRPM` """ cdef nvmlFanSpeedInfo_v1_t[1] fan_speed with nogil: fan_speed[0].version = NVML_VERSION_STRUCT(sizeof(nvmlFanSpeedInfo_v1_t), 1) fan_speed[0].fan = fan __status__ = nvmlDeviceGetFanSpeedRPM(device, fan_speed) check_status(__status__) return fan_speed[0].speed cpdef int device_get_margin_temperature(intptr_t device): """Retrieves the thermal margin temperature (distance to nearest slowdown threshold). Args: device (intptr_t): The identifier of the target device. Returns: margin_temperature (int): The margin temperature value. .. seealso:: `nvmlDeviceGetMarginTemperature` """ cdef nvmlMarginTemperature_v1_t[1] margin_temp_info with nogil: margin_temp_info[0].version = NVML_VERSION_STRUCT(sizeof(nvmlMarginTemperature_v1_t), 1) __status__ = nvmlDeviceGetMarginTemperature(device, margin_temp_info) check_status(__status__) return margin_temp_info[0].marginTemperature cpdef object device_get_clock_offsets(intptr_t device, nvmlClockType_t clock_type, nvmlPstates_t pstate): """Retrieve min, max and current clock offset of some clock domain for a given PState. Args: device (intptr_t): The identifier of the target device. Returns: nvmlClockOffset_v1_t: Structure specifying the clock type (input) and the pstate (input) retrieved clock offset value (output), min clock offset (output) and max clock offset (output). .. seealso:: `nvmlDeviceGetClockOffsets` """ cdef ClockOffset_v1 info_py = ClockOffset_v1() cdef nvmlClockOffset_v1_t *info = (info_py._get_ptr()) with nogil: info.version = NVML_VERSION_STRUCT(sizeof(nvmlClockOffset_v1_t), 1) info.type = clock_type info.pstate = pstate __status__ = nvmlDeviceGetClockOffsets(device, info) check_status(__status__) return info_py cpdef object device_get_vgpu_type_supported_placements(intptr_t device, unsigned int vgpu_type_id, unsigned int mode): """Query the supported vGPU placement ID of the vGPU type. Args: device (intptr_t): Identifier of the target device. vgpu_type_id (unsigned int): Handle to vGPU type. The vGPU type ID. mode (unsigned int): The placement mode. 0: Heterogeneous, 1: Homogeneous. Returns: nvmlVgpuPlacementList_v2_t: Pointer to the vGPU placement structure ``nvmlVgpuPlacementList_t``. .. seealso:: `nvmlDeviceGetVgpuTypeSupportedPlacements` """ cdef VgpuPlacementList_v2 p_placement_list_py = VgpuPlacementList_v2() cdef nvmlVgpuPlacementList_t *p_placement_list = (p_placement_list_py._get_ptr()) with nogil: p_placement_list.count = 0 p_placement_list.placementIds = NULL p_placement_list.version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuPlacementList_v2_t), 2) __status__ = nvmlDeviceGetVgpuTypeSupportedPlacements(device, vgpu_type_id, p_placement_list) check_status_size(__status__) if p_placement_list.count == 0: return p_placement_list_py cdef view.array placement_ids = view.array(shape=(p_placement_list.count,), itemsize=sizeof(unsigned int), format="I", mode="c") p_placement_list_py.placement_ids = placement_ids with nogil: __status__ = nvmlDeviceGetVgpuTypeSupportedPlacements(device, vgpu_type_id, p_placement_list) check_status(__status__) return p_placement_list_py cpdef unsigned int vgpu_instance_get_placement_id(unsigned int vgpu_instance): """Query the placement ID of active vGPU instance. Args: vgpu_instance (unsigned int): Identifier of the target vGPU instance. Returns: unsigned int: The placement ID .. seealso:: `nvmlVgpuInstanceGetPlacementId` """ cdef nvmlVgpuPlacementId_t[1] p_placement with nogil: p_placement[0].version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuPlacementId_v1_t), 1) __status__ = nvmlVgpuInstanceGetPlacementId(vgpu_instance, p_placement) check_status(__status__) return p_placement[0].placementId cpdef object device_get_capabilities(intptr_t device): """Get device capabilities. Args: device (intptr_t): The identifier of the target device. Returns: nvmlDeviceCapabilities_v1_t: Returns GPU's capabilities. .. seealso:: `nvmlDeviceGetCapabilities` """ cdef nvmlDeviceCapabilities_t[1] caps with nogil: caps[0].version = NVML_VERSION_STRUCT(sizeof(nvmlDeviceCapabilities_v1_t), 1) __status__ = nvmlDeviceGetCapabilities(device, caps) check_status(__status__) return caps[0].capMask cpdef object device_get_conf_compute_gpu_attestation_report(intptr_t device, char[32] nonce): """Get Conf Computing GPU attestation report. Args: device (intptr_t): The identifier of the target device. Returns: nvmlConfComputeGpuAttestationReport_t: Reference in which to return the gpu attestation report. .. seealso:: `nvmlDeviceGetConfComputeGpuAttestationReport` """ cdef ConfComputeGpuAttestationReport gpu_atst_report_py = ConfComputeGpuAttestationReport() cdef nvmlConfComputeGpuAttestationReport_t *gpu_atst_report = (gpu_atst_report_py._get_ptr()) with nogil: memcpy(gpu_atst_report.nonce, nonce, 32) __status__ = nvmlDeviceGetConfComputeGpuAttestationReport(device, gpu_atst_report) check_status(__status__) return gpu_atst_report_py cpdef tuple device_get_dram_encryption_mode(intptr_t device): """Retrieves the current and pending DRAM Encryption modes for the device. Args: device (intptr_t): The identifier of the target device. Returns: A 2-tuple containing: - nvmlEnableState_t: Reference in which to return the current DRAM Encryption mode. - nvmlEnableState_t: Reference in which to return the pending DRAM Encryption mode. .. seealso:: `nvmlDeviceGetDramEncryptionMode` """ cdef nvmlDramEncryptionInfo_t current cdef nvmlDramEncryptionInfo_t pending with nogil: current.version = pending.version = NVML_VERSION_STRUCT(sizeof(nvmlDramEncryptionInfo_t), 1) __status__ = nvmlDeviceGetDramEncryptionMode(device, ¤t, &pending) check_status(__status__) return (current.encryptionState, pending.encryptionState) cpdef device_set_dram_encryption_mode(intptr_t device, int dram_encryption): """Set the DRAM Encryption mode for the device. Args: device (intptr_t): The identifier of the target device. dram_encryption (nvmlEnableState_t): The target DRAM Encryption mode. .. seealso:: `nvmlDeviceSetDramEncryptionMode` """ cdef nvmlDramEncryptionInfo_t[1] encryption with nogil: encryption[0].version = NVML_VERSION_STRUCT(sizeof(nvmlDramEncryptionInfo_t), 1) encryption[0].encryptionState = dram_encryption __status__ = nvmlDeviceSetDramEncryptionMode(device, encryption) check_status(__status__) cpdef object device_get_gpu_instance_profile_info_by_id_v(intptr_t device, unsigned int profile_id): """GPU instance profile query function that accepts profile ID, instead of profile name. It accepts a versioned ``nvmlGpuInstanceProfileInfo_v3_t`` or later output structure. Args: device (intptr_t): The identifier of the target device. profile_id (unsigned int): One of the profile IDs. Returns: nvmlGpuInstanceProfileInfo_v3_t: Returns detailed profile information. .. seealso:: `nvmlDeviceGetGpuInstanceProfileInfoByIdV` """ cdef GpuInstanceProfileInfo_v3 info_py = GpuInstanceProfileInfo_v3() cdef nvmlGpuInstanceProfileInfo_v3_t *info = (info_py._get_ptr()) with nogil: info.version = NVML_VERSION_STRUCT(sizeof(nvmlGpuInstanceProfileInfo_v3_t), 3) __status__ = nvmlDeviceGetGpuInstanceProfileInfoByIdV(device, profile_id, info) check_status(__status__) return info_py cpdef object device_get_gpu_instance_profile_info_v(intptr_t device, unsigned int profile): """Versioned wrapper around ``nvmlDeviceGetGpuInstanceProfileInfo`` that accepts a versioned ``nvmlGpuInstanceProfileInfo_v3_t`` or later output structure. Args: device (intptr_t): The identifier of the target device. profile (unsigned int): One of the NVML_GPU_INSTANCE_PROFILE_*. Returns: nvmlGpuInstanceProfileInfo_v3_t: Returns detailed profile information. .. seealso:: `nvmlDeviceGetGpuInstanceProfileInfoV` """ cdef GpuInstanceProfileInfo_v3 info_py = GpuInstanceProfileInfo_v3() cdef nvmlGpuInstanceProfileInfo_v3_t *info = (info_py._get_ptr()) with nogil: info.version = NVML_VERSION_STRUCT(sizeof(nvmlGpuInstanceProfileInfo_v3_t), 3) __status__ = nvmlDeviceGetGpuInstanceProfileInfoV(device, profile, info) check_status(__status__) 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. Args: type (UUIDType): The format of the UUID being provided (ASCII or binary). uuid (intptr_t): The UUID of the target GPU or MIG instance. Returns: intptr_t: Reference in which to return the device handle or MIG device handle. .. seealso:: `nvmlDeviceGetHandleByUUIDV` """ cdef Device device cdef nvmlUUID_t[1] uuid_struct cdef int NVML_DEVICE_UUID_ASCII_LEN = 41 cdef int NVML_DEVICE_UUID_BINARY_LEN = 16 cdef char *uuid_ptr = cpython.PyBytes_AsString(uuid) if type == UUIDType.ASCII: if len(uuid) != NVML_DEVICE_UUID_ASCII_LEN - 1: raise ValueError(f"UUID ASCII string must be {NVML_DEVICE_UUID_ASCII_LEN - 1} bytes long") memcpy((uuid_struct[0].value.str), uuid_ptr, NVML_DEVICE_UUID_ASCII_LEN) elif type == UUIDType.BINARY: if len(uuid) != NVML_DEVICE_UUID_BINARY_LEN - 1: raise ValueError(f"UUID binary string must be {NVML_DEVICE_UUID_BINARY_LEN - 1} bytes long") memcpy((uuid_struct[0].value.bytes), uuid_ptr, NVML_DEVICE_UUID_BINARY_LEN) else: raise ValueError("Invalid UUID format specified") with nogil: uuid_struct[0].version = NVML_VERSION_STRUCT(sizeof(nvmlUUID_v1_t), 1) uuid_struct[0].type = type __status__ = nvmlDeviceGetHandleByUUIDV(uuid_struct, &device) check_status(__status__) return device cpdef unsigned long long device_get_pdi(intptr_t device): """Retrieves the Per Device Identifier (PDI) associated with this device. Args: device (intptr_t): The identifier of the target device. Returns: unsigned long long: The GPU PDI. .. seealso:: `nvmlDeviceGetPdi` """ cdef nvmlPdi_v1_t[1] pdi with nogil: pdi[0].version = NVML_VERSION_STRUCT(sizeof(nvmlPdi_v1_t), 1) __status__ = nvmlDeviceGetPdi(device, pdi) check_status(__status__) return pdi[0].value cpdef str device_get_performance_modes(intptr_t device): """Retrieves a performance mode string with all the performance modes defined for this device along with their associated GPU Clock and Memory Clock values. Not all tokens will be reported on all GPUs, and additional tokens may be added in the future. For backwards compatibility we still provide nvclock and memclock; those are the same as nvclockmin and memclockmin. Args: device (intptr_t): The identifier of the target device. Returns: str: The performance level string. .. seealso:: `nvmlDeviceGetPerformanceModes` """ cdef nvmlDevicePerfModes_t[1] perf_modes with nogil: perf_modes[0].version = NVML_VERSION_STRUCT(sizeof(nvmlDevicePerfModes_v1_t), 1) __status__ = nvmlDeviceGetPerformanceModes(device, perf_modes) check_status(__status__) return cpython.PyUnicode_FromString(perf_modes[0].str) cpdef unsigned int device_get_unrepairable_memory_flag_v1(intptr_t device): """Get the unrepairable memory flag for a given GPU. Args: device (intptr_t): The identifier of the target device. Returns: unsigned int: unrepairable memory status .. seealso:: `nvmlDeviceGetUnrepairableMemoryFlag_v1` """ cdef nvmlUnrepairableMemoryStatus_v1_t[1] unrepairable_memory_status with nogil: __status__ = nvmlDeviceGetUnrepairableMemoryFlag_v1(device, unrepairable_memory_status) check_status(__status__) return unrepairable_memory_status.bUnrepairableMemory cpdef unsigned int device_get_vgpu_heterogeneous_mode(intptr_t device): """Get the vGPU heterogeneous mode for the device. Args: device (intptr_t): The identifier of the target device. Returns: unsigned int: The mode .. seealso:: `nvmlDeviceGetVgpuHeterogeneousMode` """ cdef nvmlVgpuHeterogeneousMode_t[1] heterogeneous_mode with nogil: heterogeneous_mode[0].version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuHeterogeneousMode_v1_t), 1) __status__ = nvmlDeviceGetVgpuHeterogeneousMode(device, heterogeneous_mode) check_status(__status__) return heterogeneous_mode[0].mode cpdef device_set_vgpu_heterogeneous_mode(intptr_t device, int mode): """Enable or disable vGPU heterogeneous mode for the device. Args: device (intptr_t): Identifier of the target device. heterogeneous_mode (unsigned int): mode .. seealso:: `nvmlDeviceSetVgpuHeterogeneousMode` """ cdef nvmlVgpuHeterogeneousMode_t[1] heterogeneous_mode with nogil: heterogeneous_mode[0].version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuHeterogeneousMode_v1_t), 1) heterogeneous_mode[0].mode = mode __status__ = nvmlDeviceSetVgpuHeterogeneousMode(device, heterogeneous_mode) check_status(__status__) cpdef object gpu_instance_get_vgpu_heterogeneous_mode(intptr_t gpu_instance): """Get the vGPU heterogeneous mode for the GPU instance. Args: gpu_instance (intptr_t): The GPU instance handle. Returns: unsigned int: the mode .. seealso:: `nvmlGpuInstanceGetVgpuHeterogeneousMode` """ cdef nvmlVgpuHeterogeneousMode_t[1] heterogeneous_mode with nogil: heterogeneous_mode[0].version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuHeterogeneousMode_v1_t), 1) __status__ = nvmlGpuInstanceGetVgpuHeterogeneousMode(gpu_instance, heterogeneous_mode) check_status(__status__) return heterogeneous_mode[0].mode cpdef gpu_instance_set_vgpu_heterogeneous_mode(intptr_t gpu_instance, unsigned int mode): """Enable or disable vGPU heterogeneous mode for the GPU instance. Args: gpu_instance (intptr_t): The GPU instance handle. mode (unsigned int): The mode .. seealso:: `nvmlGpuInstanceSetVgpuHeterogeneousMode` """ cdef nvmlVgpuHeterogeneousMode_t[1] heterogeneous_mode with nogil: heterogeneous_mode[0].version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuHeterogeneousMode_v1_t), 1) heterogeneous_mode[0].mode = mode __status__ = nvmlGpuInstanceSetVgpuHeterogeneousMode(gpu_instance, heterogeneous_mode) check_status(__status__) cpdef object device_read_prm_counters_v1(intptr_t device, PRMCounter_v1 counters): """Read a list of GPU PRM Counters. Args: device (intptr_t): Identifer of target GPU device. counters (PRMCounter_v1): Array holding the input parameters as well as the retrieved counter values. .. seealso:: `nvmlDeviceReadPRMCounters_v1` """ # Unlike in the raw C API, counter_list here is an PRMCounter_v1 # AUTO_LOWPP_ARRAY, and we need to wrap it in a nvmlPRMCounterList_v1_t. cdef nvmlPRMCounterList_v1_t[1] counter_list counter_list[0].numCounters = len(counters) counter_list[0].counters = counters._get_ptr() with nogil: __status__ = nvmlDeviceReadPRMCounters_v1(device, counter_list) check_status(__status__) return counters ctypedef union __nvmlPRMTLV_v1_value_t: char[496] inData char[496] outData ctypedef struct __nvmlPRMTLV_v1_t: unsigned dataSize unsigned status __nvmlPRMTLV_v1_value_t value cpdef tuple device_read_write_prm_v1(intptr_t device, bytes in_data): """Read or write a GPU PRM register. The input is assumed to be in TLV format in network byte order. Args: device (intptr_t): Identifer of target GPU device. in_data (bytes): The input data for the PRM register. Returns: A 2-tuple containing: - unsigned int: Status of the PRM operation. - bytes: Output data in TLV format. .. seealso:: `nvmlDeviceReadWritePRM_v1` """ cdef int NVML_PRM_DATA_MAX_SIZE = 496 cdef __nvmlPRMTLV_v1_t buffer cdef int in_data_size = len(in_data) if in_data_size > NVML_PRM_DATA_MAX_SIZE - 1: raise ValueError(f"Input data size exceeds maximum allowed size of {NVML_PRM_DATA_MAX_SIZE - 1} bytes") cdef char *in_data_ptr = cpython.PyBytes_AsString(in_data) with nogil: memcpy((buffer.value.inData), in_data_ptr, in_data_size) buffer.dataSize = in_data_size __status__ = nvmlDeviceReadWritePRM_v1(device, &buffer) check_status(__status__) cdef bytes out_data = cpython.PyBytes_FromStringAndSize(buffer.value.outData, buffer.dataSize) cdef unsigned int status = buffer.status return (status, out_data) cpdef device_set_nvlink_device_low_power_threshold(intptr_t device, unsigned int threshold): """Set NvLink Low Power Threshold for device. Args: device (intptr_t): The identifier of the target device. threshold (unsigned int): .. seealso:: `nvmlDeviceSetNvLinkDeviceLowPowerThreshold` """ cdef nvmlNvLinkPowerThres_t[1] info with nogil: info[0].lowPwrThreshold __status__ = nvmlDeviceSetNvLinkDeviceLowPowerThreshold(device, info) check_status(__status__) cpdef device_set_power_management_limit_v2(intptr_t device, int power_scope, unsigned int power_value_mw): """Set new power limit of this device. Args: device (intptr_t): The identifier of the target device. power_scope (PowerScope): Device type power_value_mw (unsigned int): Power value to retrieve or set in milliwatts .. seealso:: `nvmlDeviceSetPowerManagementLimit_v2` """ cdef nvmlPowerValue_v2_t[1] power_value with nogil: power_value[0].version = NVML_VERSION_STRUCT(sizeof(nvmlPowerValue_v2_t), 2) power_value[0].powerScope = power_scope power_value[0].powerValueMw = power_value_mw __status__ = nvmlDeviceSetPowerManagementLimit_v2(device, power_value) check_status(__status__) cpdef device_set_rusd_settings_v1(intptr_t device, unsigned long long poll_mask): """Set Read-only user shared data (RUSD) settings for GPU. Requires root/admin permissions. Args: device (intptr_t): The identifier of the target device. poll_mask (unsigned long long): Bitmask of polling data. 0 value means the GPU's RUSD polling mask is cleared .. seealso:: `nvmlDeviceSetRusdSettings_v1` """ cdef nvmlRusdSettings_v1_t[1] settings with nogil: settings[0].version = NVML_VERSION_STRUCT(sizeof(nvmlRusdSettings_v1_t), 1) settings[0].pollMask = poll_mask __status__ = nvmlDeviceSetRusdSettings_v1(device, settings) check_status(__status__) cpdef device_set_temperature_threshold(intptr_t device, int threshold_type, int temp): """Sets the temperature threshold for the GPU with the specified threshold type in degrees C. Args: device (intptr_t): The identifier of the target device. threshold_type (TemperatureThresholds): The type of threshold value to be set. temp (int): The value to be set. .. seealso:: `nvmlDeviceSetTemperatureThreshold` """ with nogil: __status__ = nvmlDeviceSetTemperatureThreshold(device, <_TemperatureThresholds>threshold_type, &temp) check_status(__status__) cpdef unsigned long long system_get_conf_compute_key_rotation_threshold_info(): """Get Conf Computing key rotation threshold detail. Returns: unsigned long long: The key rotation threshold data. .. seealso:: `nvmlSystemGetConfComputeKeyRotationThresholdInfo` """ cdef nvmlConfComputeGetKeyRotationThresholdInfo_t[1] key_rotation_thr_info with nogil: key_rotation_thr_info[0].version = NVML_VERSION_STRUCT(sizeof(nvmlConfComputeGetKeyRotationThresholdInfo_v1_t), 1) __status__ = nvmlSystemGetConfComputeKeyRotationThresholdInfo(key_rotation_thr_info) check_status(__status__) return key_rotation_thr_info[0].attackerAdvantage cpdef system_set_conf_compute_key_rotation_threshold_info(unsigned long long max_attacker_advantage): """Set Conf Computing key rotation threshold. Args: max_attacker_advantage (unsigned long long): The key rotation threshold data. .. seealso:: `nvmlSystemSetConfComputeKeyRotationThresholdInfo` """ cdef nvmlConfComputeSetKeyRotationThresholdInfo_t[1] key_rotation_thr_info with nogil: key_rotation_thr_info[0].version = NVML_VERSION_STRUCT(sizeof(nvmlConfComputeSetKeyRotationThresholdInfo_v1_t), 1) key_rotation_thr_info[0].maxAttackerAdvantage = max_attacker_advantage __status__ = nvmlSystemSetConfComputeKeyRotationThresholdInfo(key_rotation_thr_info) check_status(__status__) cpdef unsigned long long vgpu_instance_get_runtime_state_size(unsigned int vgpu_instance): """Retrieve the currently used runtime state size of the vGPU instance. Args: vgpu_instance (unsigned int): Identifier of the target vGPU instance. Returns: unsigned long long: Runtime state size of the vGPU instance. .. seealso:: `nvmlVgpuInstanceGetRuntimeStateSize` """ cdef nvmlVgpuRuntimeState_t[1] p_state with nogil: p_state[0].version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuRuntimeState_v1_t), 1) __status__ = nvmlVgpuInstanceGetRuntimeStateSize(vgpu_instance, p_state) check_status(__status__) return p_state[0].size cpdef unsigned int vgpu_type_get_max_instances_per_gpu_instance(unsigned int vgpu_type_id): """Retrieve the maximum number of vGPU instances per GPU instance for given vGPU type. Args: vgpu_type_id (VgpuTypeId): Handle to vGPU type. Returns: unsigned int: Maximum number of vGPU instances per GPU instance .. seealso:: `nvmlVgpuTypeGetMaxInstancesPerGpuInstance` """ cdef nvmlVgpuTypeMaxInstance_t[1] max_instance with nogil: max_instance[0].version = NVML_VERSION_STRUCT(sizeof(nvmlVgpuTypeMaxInstance_v1_t), 1) max_instance[0].vgpuTypeId = vgpu_type_id __status__ = nvmlVgpuTypeGetMaxInstancesPerGpuInstance(max_instance) check_status(__status__) return max_instance[0].maxInstancePerGI cpdef str device_get_current_clock_freqs(intptr_t device): """Retrieves a string with the associated current GPU Clock and Memory Clock values. Args: device (intptr_t): The identifier of the target device. Returns: str: The current clock frequency string. .. seealso:: `nvmlDeviceGetCurrentClockFreqs` """ cdef nvmlDeviceCurrentClockFreqs_t[1] current_clock_freqs with nogil: current_clock_freqs[0].version = NVML_VERSION_STRUCT(sizeof(nvmlDeviceCurrentClockFreqs_v1_t), 1) __status__ = nvmlDeviceGetCurrentClockFreqs(device, current_clock_freqs) check_status(__status__) return cpython.PyUnicode_FromString(current_clock_freqs[0].str) cpdef str vgpu_type_get_name(unsigned int vgpu_type_id): """Retrieve the vGPU type name. Args: vgpu_type_id (unsigned int): Handle to vGPU type. .. seealso:: `nvmlVgpuTypeGetName` """ cdef unsigned int[1] size = [64] cdef char[64] vgpu_type_name with nogil: __status__ = nvmlVgpuTypeGetName(vgpu_type_id, vgpu_type_name, size) check_status(__status__) return cpython.PyUnicode_FromStringAndSize(vgpu_type_name, size[0]) cpdef object event_set_wait_v3(intptr_t set, unsigned int timeout_ms): """Wait for events of the specified type to occur for any device in the set, returning a structured event record. For Turing™ or newer fully supported devices. For Linux only. Args: set (EventSet): Handle to the event set. timeout_ms (unsigned int): Maximum time to wait, in milliseconds. Returns: EventSetWait_v3: Structured event data record. .. seealso:: `nvmlEventSetWait_v3` """ cdef EventSetWait_v3 params = EventSetWait_v3() cdef nvmlEventSetWait_v3_t *ptr = params._get_ptr() ptr.timeoutMs = timeout_ms with nogil: __status__ = nvmlEventSetWait_v3(set, ptr) check_status(__status__) return params cpdef object event_set_get_context_info_v1(intptr_t set, unsigned int index): """Retrieve context metadata for a context record from the most recent event returned by :func:`event_set_wait_v3`. For Turing™ or newer fully supported devices. For Linux only. Args: set (EventSet): Handle to the event set. index (unsigned int): Zero-based index of the context record. Returns: EventSetGetContextInfo_v1: Context metadata record. .. seealso:: `nvmlEventSetGetContextInfo_v1` """ cdef EventSetGetContextInfo_v1 params = EventSetGetContextInfo_v1() cdef nvmlEventSetGetContextInfo_v1_t *ptr = params._get_ptr() ptr.index = index with nogil: __status__ = nvmlEventSetGetContextInfo_v1(set, ptr) check_status(__status__) return params cpdef object event_set_get_gpu_operational_event_context_legacy_xid_v1(intptr_t set, unsigned int index): """Retrieve the decoded legacy-Xid context data for a context record from the most recent event returned by :func:`event_set_wait_v3`. For Turing™ or newer fully supported devices. For Linux only. Args: set (EventSet): Handle to the event set. index (unsigned int): Zero-based index of the context record. Returns: EventSetGetGpuOperationalEventContextLegacyXid_v1: Decoded Xid context record. .. seealso:: `nvmlEventSetGetGpuOperationalEventContextLegacyXid_v1` """ cdef EventSetGetGpuOperationalEventContextLegacyXid_v1 params = EventSetGetGpuOperationalEventContextLegacyXid_v1() cdef nvmlEventSetGetGpuOperationalEventContextLegacyXid_v1_t *ptr = params._get_ptr() ptr.index = index with nogil: __status__ = nvmlEventSetGetGpuOperationalEventContextLegacyXid_v1(set, ptr) check_status(__status__) return params cpdef bytes event_set_get_context_data_v1(intptr_t set, unsigned int index): """Copies the raw payload for a context record from the most recent event returned by :func:`event_set_wait_v3`. For Turing™ or newer fully supported devices. For Linux only. Args: set (EventSet): Handle to the event set. index (unsigned int): Zero-based index of the context record to retrieve. Returns: bytes: The context payload as a bytes object. .. seealso:: `nvmlEventSetGetContextData_v1` """ cdef nvmlEventSetGetContextData_v1_t params params.index = index params.data = NULL params.dataSize = 0 with nogil: __status__ = nvmlEventSetGetContextData_v1(set, ¶ms) check_status_size(__status__) cdef bytes data = bytes(params.dataSize) params.data = data with nogil: __status__ = nvmlEventSetGetContextData_v1(set, ¶ms) check_status(__status__) return data TimeoutError = NvmlTimeoutError MemoryError = NvmlMemoryError del _cyb_FastEnum